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Β§

AgentBroadcastForwardRequest πŸ”’
AgentGlobalMemoryDiffQuery πŸ”’
AgentGlobalMemoryHistoryQuery πŸ”’
AgentGlobalMemoryReadQuery πŸ”’
AgentGlobalMemoryRemoveRequest πŸ”’
AgentGlobalMemoryRevertRequest πŸ”’
AgentGlobalMemoryWriteProvenanceReq πŸ”’
AgentGlobalMemoryWriteRequest πŸ”’
AgentMemoryDiffQuery πŸ”’
AgentMemoryHistoryQuery πŸ”’
AgentMemoryListQuery πŸ”’
AgentMemoryReadQuery πŸ”’
AgentMemoryRevertRequest πŸ”’
AgentMemoryWriteRequest πŸ”’
AgentStopForwardRequest πŸ”’
AgentStopPendingForwardRequest πŸ”’

FunctionsΒ§

app_api_error_status πŸ”’
Classify an app-API or naming error string into an HTTP status. The service layer returns plain String errors, so this matches on text. FORBIDDEN is a 403. β€œnot found” is a 404: a caller holding a stale or unknown id names a missing resource, not a malformed request (SPEC_WINDOW_NAME_API_HARDENING_2026_08_08.md Β§3.2). Argument errors are a 400. Everything unrecognized is a 500 (genuine service faults, e.g. SQLite write failures). The one classifier for MuxAPI routes here and the naming routes in http_naming.rs.
app_api_response πŸ”’
default_agent_globalmemory_write_detail πŸ”’
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_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). 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; this is just stop_one_agent_block run against THIS instance’s own (in-process) controller registry, for a target the CALLING channel couldn’t find in its own β€” same one-hop-forward shape as /agentmux/reactive/inject’s cross-channel tier, no further forwarding.
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 many agent panes (block ids) at once. Backs the FleetBulkStop MCP tool. Infallible per-target (never a single bool) β€” see FleetActionResult’s doc comment.