ACP host hooks — permission, updates, cancel, stream
Java · package io.github.muthuishere: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”Java ships io.github.muthuishere.toolnexus.acp.AcpClient: AcpClient.start(command) spawns the
agent over stdio, keeps one warm session, and plugs into the loop as an in-process model (it
implements Function<InProcess.Request, InProcess.Response>). What it does today, in place of each
Go hook:
- Permission —
autoAnswerPermission(defaulttrue) answers everysession/request_permissionwith the first allow-kind option. There is no host callback, so a plan mode or a human approval prompt is not possible yet; restrict the agent with its own mode instead (acp.setMode(modeId)). - Updates — only
agent_message_chunktext forms the reply; othersession/updatenotifications are not surfaced to the host. - Cancel —
timeoutMs(default 10 s) bounds eachsession/prompt, andclose()stops the agent. There is no per-turnsession/cancel. - Streaming — not available through an ACP model; use
LlmClient.run.
If you need these hooks now, use the Go port (ACPOptions.OnPermission, OnUpdate,
ACPClient.GenerateCtx, ACPClient.GenerateStream); see the Go page.
See also
Section titled “See also”LlmClient.create— The unified client: system prompt, skills injection, parallel and chained tool calls, retries, memory.LlmClient.run— Send a prompt, let the loop call tools until the model stops, get a RunResult.LlmClient.stream— The streaming loop: text deltas, tool-call events, and suspension events as they happen.LlmClient.Hooks— Intercept before/after model calls and tool calls: audit, redact, veto, or rewrite.