Skip to main content

Module http_app_api

Module http_app_api 

Source
Expand description

HTTP adapters over app_api: memory, global memory, fleet stop and stop forwarding. Split out of server/mod.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md ยง4.1).

Structsยง

AgentBroadcastConfirmRequest ๐Ÿ”’
A forwarded broadcast as a confirmation names it: the body by its SHA-256, never the words.
AgentBroadcastForwardRequest ๐Ÿ”’
AgentGlobalMemoryDiffQuery ๐Ÿ”’
AgentGlobalMemoryHistoryQuery ๐Ÿ”’
AgentGlobalMemoryReachRequest ๐Ÿ”’
AgentGlobalMemoryReadQuery ๐Ÿ”’
AgentGlobalMemoryRemoveRequest ๐Ÿ”’
AgentGlobalMemoryRevertRequest ๐Ÿ”’
AgentGlobalMemoryWriteProvenanceReq ๐Ÿ”’
AgentGlobalMemoryWriteRequest ๐Ÿ”’
AgentMemoryDiffQuery ๐Ÿ”’
AgentMemoryHistoryQuery ๐Ÿ”’
AgentMemoryListQuery ๐Ÿ”’
AgentMemoryReadQuery ๐Ÿ”’
AgentMemoryRevertRequest ๐Ÿ”’
AgentMemoryWriteRequest ๐Ÿ”’
AgentStopForwardRequest ๐Ÿ”’
AgentStopPendingForwardRequest ๐Ÿ”’

Functionsยง

app_api_response ๐Ÿ”’
A MuxAPI result as its HTTP answer: the value, or the error under the status of its kind (api_error::ApiError). An error that is still a plain String gets its kind from its text.
default_agent_globalmemory_write_detail ๐Ÿ”’
default_agent_globalmemory_write_source ๐Ÿ”’
forwarded_asker ๐Ÿ”’
Who a request from another instance says is asking: the tokenโ€™s agent when it carries one, else the name the forwarding instance sent, shown as a claim.
handle_agent_broadcast_confirm ๐Ÿ”’
POST /agentmux/agent/broadcast/confirm: another instance on this machine asks whether this one sent that forward from the operatorโ€™s window. Answers yes once, and only for a forward this instance sent; a request that carries an agentโ€™s token is refused.
handle_agent_broadcast_forward ๐Ÿ”’
POST /agentmux/agent/broadcast: another channel on this machine asks this one to deliver a Swarm broadcast to one of its agent panes (same trust model as the stop forward above: loopback, this instanceโ€™s own auth key). The header is built here; the caller supplies only the body.
handle_agent_globalmemory_diff ๐Ÿ”’
GET /api/v1/agent/globalmemory/diff?id=<id>&from_version_id=&to_version_id= โ€” a line-based diff between two recorded versions, both of which must belong to id (same ownership check as /api/v1/agent/memory/diffโ€™s agent_id scoping โ€” see global_memory_diff_implโ€™s own doc comment for why). Backs the GlobalMemoryDiff MCP tool.
handle_agent_globalmemory_history ๐Ÿ”’
GET /api/v1/agent/globalmemory/history?id=<id> โ€” list every recorded version of one Global Memory entry, newest first. Refuses a system-tier, blank, or non-global id the same way read/remove already do โ€” see global_memory_history_implโ€™s own doc comment. Backs the GlobalMemoryHistory MCP tool.
handle_agent_globalmemory_list ๐Ÿ”’
GET /api/v1/agent/globalmemory/list โ€” every Global Memory entry, system rows first and flagged system, summary only (id/name/updated_at/system, no content). Read, write and remove still refuse a system id. Backs the GlobalMemoryList MCP tool. See docs/specs/SPEC_GLOBAL_MEMORY_LIST_SYSTEM_ROWS_2026_10_02.md.
handle_agent_globalmemory_reach ๐Ÿ”’
POST /api/v1/agent/globalmemory/reach โ€” set where an existing Global Memory entry goes: fleet (every proven machine) or machine (this one only). Backs the reach action of the Memory tool.
handle_agent_globalmemory_read ๐Ÿ”’
GET /api/v1/agent/globalmemory/read?id=<id> โ€” full content of one ordinary Global Memory entry. Backs the GlobalMemoryRead MCP tool.
handle_agent_globalmemory_remove ๐Ÿ”’
POST /api/v1/agent/globalmemory/remove โ€” demote a Global Memory entry (clears is_global; the bundle row itself survives, same as Memory โ†’ Globalโ€™s own โ€œRemoveโ€ button), recorded as a remove version under the agent the requestโ€™s token names so the removal can be seen and undone. A request without that token is refused. Backs the GlobalMemoryRemove MCP tool.
handle_agent_globalmemory_revert ๐Ÿ”’
POST /api/v1/agent/globalmemory/revert โ€” restore a Global Memory entryโ€™s live content to a prior recorded version, recorded as a NEW version (source: "revert") โ€” never rewrites or deletes history, same as /api/v1/agent/memory/revert. Never reaches a system-tier row โ€” see global_memory_revert_implโ€™s own doc comment. Backs the GlobalMemoryRevert MCP tool.
handle_agent_globalmemory_write ๐Ÿ”’
POST /api/v1/agent/globalmemory/write โ€” create a new ordinary Global Memory entry, or update an existing one by id. Never reaches a system-tier row either way โ€” see global_memory_write_implโ€™s own doc comment for the full invariant. Backs the GlobalMemoryWrite MCP tool.
handle_agent_memory_diff ๐Ÿ”’
GET /api/v1/agent/memory/diff?agent_id=<slug>&from_version_id=&to_version_id= โ€” a line-based diff between two recorded versions, both of which must belong to agent_id (reagent P1 โ€” see memory_diff_implโ€™s own doc for why). Backs the MemoryDiff MCP tool.
handle_agent_memory_history ๐Ÿ”’
GET /api/v1/agent/memory/history?agent_id=<slug>&filename=<f> โ€” list every recorded version of one memory file, newest first. Backs the MemoryHistory MCP tool.
handle_agent_memory_list ๐Ÿ”’
GET /api/v1/agent/memory/list?agent_id=<slug> โ€” list the agentโ€™s own native-memory markdown files. Backs the MemoryList MCP tool.
handle_agent_memory_read ๐Ÿ”’
GET /api/v1/agent/memory/read?agent_id=<slug>&filename=<f> โ€” read one of the agentโ€™s own memory files. Backs the MemoryRead MCP tool.
handle_agent_memory_revert ๐Ÿ”’
POST /api/v1/agent/memory/revert โ€” restore a memory fileโ€™s live content to a prior version, recorded as a NEW version (source: "revert") โ€” never rewrites or deletes history. Backs the MemoryRevert MCP tool.
handle_agent_memory_write ๐Ÿ”’
POST /api/v1/agent/memory/write โ€” create/overwrite one of the agentโ€™s own memory files (atomic tmpโ†’rename). Backs the MemoryWrite MCP tool โ€” the primary write path an agent actually uses, so provenance (optional, see docs/specs/SPEC_MEMORY_VERSION_CONTROL_AND_ARMORY_AUDIT_2026_08_19.md ยง4.1) threads through to the version history here, not just on the WebSocket RPCโ€™s agent:memory:write_file.
handle_agent_stop_forward ๐Ÿ”’
POST /agentmux/agent/stop โ€” the cross-channel bulk-stop forward target. See fleet_bulk_stop_implโ€™s doc comment for the caller side. The request names its asker itself and cannot be checked, so it goes through this instanceโ€™s own override window (banner, chime, Keep running) like /agentmux/agent/stop-pending: the stop happens after 30 s unless the user keeps the agent running.
handle_agent_stop_pending_forward ๐Ÿ”’
POST /agentmux/agent/stop-pending โ€” another instance on this machine forwards an agentโ€™s FleetBulkStop for a block running HERE: open this instanceโ€™s own override window (banner, chime, Keep running) rather than stopping at once. The caller polls /api/v1/agent/shutdown/{request_id} here. Same trust model and gate as /agentmux/agent/stop.
handle_fleet_bulk_stop ๐Ÿ”’
POST /api/v1/fleet/bulk-stop โ€” Stop agents: close each named agentโ€™s tab (docs/specs/SPEC_STOP_AN_AGENT_ONE_WAY_AND_SHUTDOWN_TOAST_2026_10_23.md). Backs the Stop toolโ€™s agents action. Infallible per target (never a single bool): { succeeded, failed }.
open_forwarded_window ๐Ÿ”’
Opens this instanceโ€™s own override window for a stop or close another instance asked for, and answers with it.