Skip to content

ACP host hooks — permission, updates, cancel, stream

Elixir · package toolnexus · SPEC §8

Opt-in hooks on an ACP model source: choose the permission option, watch every session/update, cancel a turn, and stream through an in-process client.

Elixir ships Toolnexus.Acp (elixir/lib/toolnexus/acp.ex): connect/2 spawns the agent over stdio and keeps one warm session, prompt/3 runs a turn, close/1 stops it, and the source plugs into the client through the in-process path. What it does not have yet is any of the four Go hooks:

  • Permissions — every session/request_permission is answered inline with the first allow-kind option. There is no host callback, so a plan mode or a human approval prompt cannot sit in front of the agent’s own tool calls. If you need one, configure the agent itself (most ACP agents have their own permission mode) or gate the toolnexus tools the agent is given through before_tool.
  • Updates — only agent_message_chunk text forms the reply; thought chunks, tool-call narration and plans are dropped, and there is no observer.
  • Cancel — a turn cannot be cancelled with session/cancel; stop it with a prompt/3 timeout, or close/1 the session (which ends the agent process).
  • Streaming — an ACP-backed client does not stream; use Client.run/4.

The Go API is documented at ACPOptions.OnPermission. Tracked in openspec/changes/add-go-host-asks, task 2.6d.

  • Toolnexus.Client.create — The unified client: system prompt, skills injection, parallel and chained tool calls, retries, memory.
  • Toolnexus.Client.run — Send a prompt, let the loop call tools until the model stops, get a RunResult.
  • Toolnexus.Client.stream — The streaming loop: text deltas, tool-call events, and suspension events as they happen.
  • Toolnexus.Client.create — Intercept before/after model calls and tool calls: audit, redact, veto, or rewrite.