Skip to main content

Module http_viewer_input

Module http_viewer_input 

Source
Expand description

POST /agentmux/viewer/agents/:name/input: a paired device sends a message to an agent, as the user (agentmux-mobile’s SPEC_SEND_FROM_THE_PHONE_2026_10_13 §4, §5). The one viewer route that changes anything, so it asks for more than the token:

  • the owner’s grant for this device (Settings › Paired devices, Can send);
  • a signature by the key the device made at pairing, over method, path, time and body (viewer::signing), fresh within a minute;
  • a message_id, so a retry is delivered once (viewer::sends), and at most 30 sends a minute.

The agent gets a plain user turn, delivered the way a Swarm broadcast is: a running agent reads it at its next step, mid-turn included; an idle or stopped one starts a turn. The stored record says which device sent it (viewer::origin), for the desktop pane’s note and the phone’s own “Sending…” line.

Structs§

InputBody 🔒

Constants§

MAX_INPUT_BODY 🔒
The largest request body: a message at MAX_MESSAGE_LENGTH bytes, JSON escaped, with room to spare.

Functions§

check_signed 🔒
Whether body, sent to path, is signed by key within a minute of this computer’s clock: else the refusal’s reason and text.
deliver 🔒
Deliver text to block_id as the user’s turn, the way a Swarm broadcast is (app_api::fleet::deliver_broadcast_turn).
delivery_refusal 🔒
Why delivery failed, for the phone: starting and needs_login pass; not_running means nothing will take it until the agent is opened.
forgotten 🔒
A message that was not delivered: nothing is stored for it, and its Audit row says it failed. (A delivered one’s row is written when its line is stored, audit::note_landed.)
handle_viewer_input 🔒
POST /agentmux/viewer/agents/:name/input: {message, message_id}, signed; 202 {message_id, state}. See the module comment and the spec’s §5.2.1 for every refusal.
refuse 🔒
settle 🔒
After a delivery from device to agent: the send ledger learns how it went (a failed one may be retried); a delivered one shows the device as driving the agent on the host, and a failed one’s origin is forgotten.