Skip to main content

Module container_tool_chunk

Module container_tool_chunk 

Source
Expand description

POST /api/v1/agent/tool-chunk: a container agent’s agentmux-bashwrap streaming a Bash call’s output into its own pane.

/agentmux/wps/publish is a generic relay: it republishes an undeclared event to any scope, so a container token is refused there (container::credential). This route takes one event, tool_chunk, for one scope, the container’s own block:<id>, and only as the typed ToolChunk. A request that is not a container’s, names another event or scope, or is not a ToolChunk never reaches the broker.

A pid or call op carries a process id from the container’s own pid namespace. The pane files a pid against the background task, and tool_calls labels a host process with a call’s description, so on this srv’s host that pid would name some other process. Neither goes where a host pid goes: not to the broker, not to the registry’s host pid column, not to tool_calls. They are filed apart, with the container’s name (storage::background_container_calls): the liveness sweep checks the pid inside that container (background_task_container_sweep), and the description is the registry row’s label, so a backgrounded call’s dock row knows whether it is alive and is not just “Bash”.

Constants§

MAX_BODY_BYTES 🔒
The largest request body: a line of output, with its envelope.
PERSIST 🔒
How many chunks the broker keeps per block for a late subscriber, as agentmux-bashwrap asks on the host. srv decides it here; the container’s value is not read.

Functions§

check 🔒
The chunk to publish for block_id’s req, or why the request is refused.
file_report 🔒
File a pid or call report of the container agent on block_id (see the module doc). Anything else, a pane that is not a container’s, an id that is not a call’s, or a failed write, is dropped: the report is only ever help for the dock, and the CLI’s own task feed still describes the row.
handle_container_tool_chunk 🔒
is_call_id 🔒
A call’s id as the container may name it (toolu_…): short, and plain characters only.
refuse 🔒