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.
What to use instead
Section titled “What to use instead”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_permissionis answered inline with the firstallow-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 throughbefore_tool. - Updates — only
agent_message_chunktext 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 aprompt/3timeout, orclose/1the 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.
See also
Section titled “See also”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.