Expand description
App API — high-level commands for programmatic control of AgentMux.
These commands orchestrate multiple low-level operations (CreateBlock, SetMeta, ControllerResync) behind stable, intent-based interfaces. Callers express what they want (“open an agent pane with AgentX”), not how to do it.
Functions§
- agent_
define_ 🔒core - allocate_
agent_ workdir - Atomically allocate an agent working directory.
- build_
pane_ 🔒meta - Build the metadata map for a pane.open request, validating required args.
- extract_
digest_ 🔒text - Extract meaningful text from raw stream-json lines for digest summarization. Skips system/result events and raw stream_event deltas; extracts assistant text and tool call summaries.
- find_
agent_ 🔒block - Find an existing agent block in a tab by agent ID.
- global_
output_ 🔒source - If this channel has no local
outputforblock_idbut the agent’s GLOBAL transcript zone (agent:<defId>:current) does, return(global_store, agent_zone). ReturnsNonewhen the local output is present and non-empty, the block isn’t agent-anchored, there’s no global store, or the global zone is empty — callers then read the per-channel store keyed byblock_id. - global_
zone_ 🔒line_ count - Exact non-blank line count of the
outputfile inzone, computed via the same streaming index builderread_rangeuses (so the two endpoints always agree). ReturnsSome(0)for an empty file,Noneon read failure. - infer_
provider_ 🔒from_ model - Create a stub AgentInstance for a definition, idempotently.
- invoke_
cli_ 🔒for_ activity - Invoke the Claude CLI with Haiku model for a lightweight per-turn activity summary.
Uses
--model claude-haiku-4-5-20251001and a 15s timeout. - invoke_
cli_ 🔒for_ digest - Invoke the Claude CLI with a prompt and extract the text response.
Uses
-p --output-format stream-json --verbose(non-interactive mode). - make_
stub_ 🔒idempotent - Returns
(stub_id, newly_inserted).newly_inserted = falsewhen the UNIQUE constraint fires (stub already existed); callers use this to avoid broadcastingagents:changedon no-op calls. - open_
pane - Core
pane.openlogic, shared by the WebSocket RPC handler (register_pane_open) and the HTTP routePOST /api/v1/pane/open(agentmux-mcp’sOpenEditortool). Creates a block for the requested view, enqueues a layout action (split or insert), and broadcasts the block/tab/layout updates so the frontend renders the new pane. - open_
pane_ 🔒floating - Floating-pane branch of
open_pane. The block already exists insource_tab_id’s blockids (created by the caller, with no layout node). This moves it into a fresh floating workspace via thetear_off_blocksaga, sets up the new tab’s layout, broadcasts the new WaveObjs, and asks the source window’s frontend to materialize the chromeless floating OS window via the hostopen_floating_pane_windowcommand (srv cannot open windows itself). See docs/specs/SPEC_OPENEDITOR_FLOATING_AND_COLLAPSED_TREE_2026_06_16.md. - parse_
seed_ 🔒zoom - Parse + validate a saved per-agent
ui:zoomcontent blob for seeding a new agent block’sterm:zoom. ReturnsSome(z)only for a parseable, non-default (≠ 1.0), in-[0.5, 2.0] zoom (the range the frontend enforces in term.tsx); anything else (default, out of range, garbage) returnsNoneso the new block opens at the default 1.0. See SPEC_AGENT_ZOOM_PERSISTENCE §4.2. - persist_
define_ 🔒content - Core logic for the
agent.definecommand, shared by the WebSocket RPC handler and the HTTP service dispatch (("agent", "define")in service.rs). Persistsystem_promptandenvcontent blobs for a freshly created or updated agent definition. Errors are logged but not propagated — the definition row is already committed and the caller has already publishedagents:changed, so a content-write failure must not abort the response. - register_
agent_ 🔒define - register_
agent_ 🔒kill_ process - register_
agent_ 🔒kill_ tree - register_
agent_ 🔒list - register_
agent_ 🔒open - register_
agent_ 🔒output - register_
agent_ 🔒process_ list - register_
agent_ 🔒send - register_
agent_ 🔒status - register_
agent_ 🔒stop - register_
agent_ 🔒tracked_ blocks - register_
app_ api_ handlers - Register all App API handlers on the RPC engine.
- register_
blockfile_ 🔒line_ count - register_
blockfile_ 🔒read_ range - register_
blockfile_ 🔒read_ state - register_
blockfile_ 🔒write_ state - register_
pane_ 🔒open - register_
session_ 🔒activity_ summary - register_
session_ 🔒archive_ handler - register_
session_ 🔒digest - register_
session_ 🔒export_ handler - register_
session_ 🔒restore_ handler - resolve_
placement 🔒 - Translate
split_direction+split_reference_block_idinto the backend layout action triple. Returns(actiontype, targetblockid, position). Falls back to a plaininsertif direction/reference are missing. - resolve_
tab_ 🔒id - Resolve a tab ID: use the provided one, or fall back to the first workspace’s active tab.
- write_
agent_ 🔒config_ files - Write agent config files (CLAUDE.md, .mcp.json, etc.) to the working directory.