Skip to main content

Module app_api

Module app_api 

Source
Expand description

MuxAPI — 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.

Re-exports§

pub use pane::open_pane;
pub use agent_define::allocate_agent_workdir;

Modules§

agent_define 🔒
agent_io 🔒
agent_open 🔒
attachments 🔒
attachments.ingest / attachments.cancel / attachments.info — image attachments in the agent composer (docs/specs/SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6). The work itself lives in backend::attachments; these only adapt it to the RPC engine. Typed registration, so frontend/types/rpc/ gets the bindings.
blockfile 🔒
blockstats 🔒
blockstats.detail: a terminal’s stats badge and its tooltip (backend::blockstats_detail). The window’s, not an agent API: a connection registered as an agent is refused.
bookmarks 🔒
bookmarks.list / bookmarks.set — the browser pane’s saved-URL list. Deliberately a thin wrapper over backend::bookmarks_store: no Store/ sqlite involvement, no per-agent scoping — see docs/specs/SPEC_BROWSER_PANE_BOOKMARKS_AND_GO_ICON_2026_08_22.md for why this is a dedicated shared_dir file instead of the ABF/db_bundles pattern the rest of this directory mostly follows.
browser_profiles 🔒
browser_profiles.list / .create / .update / .delete: the named browser profiles (docs/specs/SPEC_BROWSER_PANE_PROFILES_MENU_2026_10_09.md §3, §6), a shared_dir file like the bookmarks. Deleting a profile closes its open tabs first, then the host drops its jar and its folder on the next owned-pane push. Only the window changes profiles: a connection registered as an agent may list them, never create, change or delete one.
browser_start_page 🔒
browser_start_page.set — the browser pane’s configured start page. Write-only: the read side is GetFullConfig’s browserstartpage field (crates/srv/src/backend/wconfig/types.rs), not a matching .get here — see docs/specs/SPEC_BROWSER_PANE_START_PAGE_2026_09_16.md §3.1 for why. Deliberately its own file rather than folded into bookmarks.rs: unlike bookmarks, this handler needs AppState’s config_watcher/event_bus to update the live config and broadcast immediately, the same shape COMMAND_SET_CONFIG already has (server/websocket.rs).
bundle 🔒
bundle.* MuxAPI handlers — the Armory Bundle Format (ABF) surface.
connections 🔒
The connection RPCs the frontend’s connection UI already calls (conntypeahead.tsx, blockframe.tsx’s ConnStatusOverlay), which had no handler until now (P0 of SPEC_REMOTE_TERMINALS_AND_DURABLE_SESSIONS_2026_10_02.md).
dev_server 🔒
POST /api/v1/agent/dev_server/register — backs the RegisterDevServer MCP tool. See docs/specs/SPEC_NATIVE_CONTAINER_DEV_PROXY_2026_09_19.md.
fleet 🔒
Fleet control — select, broadcast, and bulk-act on many agents at once. See docs/specs/SPEC_MULTI_AGENT_FLEET_CONTROL_2026_08_20.md.
global_memory 🔒
Global Memory MuxAPI bodies, moved out of app_api/mod.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md item 9).
identity 🔒
layout 🔒
layout.save — write one window as an agentmux.layout file (docs/specs/SPEC_LAYOUT_FILES_2026_09_25.md §6.1). The walk and the per-view allowlist live in backend::layout_file; this is the RPC shell.
mcp 🔒
MuxAPI handlers for the v1 standalone MCP Server primitive. mcp.list / mcp.get / mcp.upsert / mcp.delete / mcp.bind / mcp.unbind
mcp_health 🔒
agentmux-mcp doctor’s two calls (docs/specs/SPEC_AGENT_MCP_SELF_HEAL_2026_10_10.md §7): what srv knows about the caller’s own agentmux MCP server, and “repair it now”.
memory 🔒
pane 🔒
presence 🔒
The cloud presence publisher’s status and “Publish now” (muxbus::wan_presence), for Settings’ “Cloud presence” line.
session 🔒
shells 🔒
shell.list: the shells installed here, and which one a new local terminal starts with, for Settings’ default-shell picker (backend::shells).
skill 🔒
MuxAPI handlers for the v1 standalone Skill primitive. skill.list / skill.get / skill.upsert / skill.delete / skill.bind / skill.unbind
tower_pane 🔒
Tower, the read-only task manager pane (backend::tower_sampler; SPEC_TOWER_TASK_MANAGER_PANE_2026_10_08.md): tower.sample.
viewer 🔒
The desktop’s side of pairing a device with the viewer listener (backend::viewer, agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07 §13.2): the QR, the paired-devices list with Revoke, and an agent’s “hide from paired devices” flag. Reached over the full-key WebSocket only, like every RPC.
voice 🔒
voice.checkPath — live existence check for the local whisper.cpp CLI binary or GGML model file paths configured in Settings -> Recording.

Functions§

check_s1 🔒
S1: the caller may only act on itself.
check_s1_resolved 🔒
check_s1’s decision over plain strings, so it can be tested without constructing an RpcContext.
find_agent_block 🔒
Find an existing agent block in a tab by agent ID.
find_editor_block 🔒
Find an Editor-view block the tab shows (shown_block_ids: in front of its stack, not minimized, not hidden behind a magnified pane) on connection (its meta connection; absent and local are this computer), if any. Direct sibling of find_agent_block above, checking meta.view == "editor" instead of meta.agentId. An editor on another connection is never it: its reads and saves go there (remote terminals spec §6.3).
global_output_source 🔒
If the agent’s GLOBAL transcript zone (agent:<defId>:current) has output, return (global_store, agent_zone) — preferred even when this channel’s local output is non-empty. Returns None when the block isn’t agent-anchored or is archived, there’s no global store, or the global zone is empty — callers then read the per-channel store keyed by block_id.
global_zone_line_count 🔒
Exact non-blank line count of the output file in zone, computed via the same streaming index builder read_range uses (so the two endpoints always agree). Returns Some(0) for an empty file, None on read failure.
now_ms 🔒
Milliseconds since the Unix epoch, as i64.
parse_seed_zoom 🔒
Parse + validate a saved per-agent ui:zoom content blob for seeding a new agent block’s term:zoom. Returns Some(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) returns None so the new block opens at the default 1.0. See SPEC_AGENT_ZOOM_PERSISTENCE §4.2.
register_app_api_handlers
Register all MuxAPI handlers on the RPC engine.
resolve_agent_definition_id 🔒
Resolve an S1-authenticated agent id (the slug — AGENTMUX_AGENT_ID / bus:register id, e.g. “Agent3”) to the agent’s DEFINITION id, which is what db_agent_identity_links.agent_id stores (== AgentDefinition.id; see m0013 and identity/resolver/inject.rs::resolve_bindings_for_instance).
resolve_tab_id 🔒
Resolve a tab ID: use the provided one, or fall back to the first workspace’s active tab.
resolve_tab_id_for_block 🔒
Find which tab a given block currently belongs to, by scanning every tab’s blockids. Needed because resolve_tab_id only resolves an explicit tab_id or “the active tab” — neither answers “which tab is MY OWN block in,” which a caller passing its own block id (e.g. an MCP tool’s split_reference_block_id) actually needs.
same_pane_connection 🔒
Whether two panes’ connections are one: absent and local are this computer; otherwise the same host however it is spelled.
shown_block_ids 🔒
The blocks a tab’s layout shows: each pane’s active member (the tab in front of its stack), leaving out minimized panes, and every pane but the magnified one while one is magnified. A file pushed into an editor the user can’t see would look like nothing happened (SPEC_AGENT_PANE_TOOL_PEEK_ON_LINE_AND_MD_OPEN_IN_EDITOR_2026_10_11.md §2.2).