Expand description
Taking an agent over from another AgentMux instance on this host
(docs/specs/SPEC_AGENT_SINGLE_LIVE_INSTANCE_2026_09_24.md Phase 2, §4.6).
Two halves, both behind full auth_key auth:
POST /api/v1/agent/takeover {block_id}— on the instance the user is in. Its pane was refused because another instance runs the agent; the user confirmed “Take over”. Finds that instance (lease holder, or the compat probe for one that takes no lease), asks it to let go, and waits until the agent is free. The pane then runs its turn as usual.POST /agentmux/agent/release {uid}— on the holder. Gracefully stops the CLI process of every pane of this srv that holdsuid’s lease, shows “taken over” in those panes, and keeps this srv from re-claiming the agent on its own for a short hold.
Never jekt-drivable (spec I5, D7): a jekt body cannot reach either route. The requester side is reached from the pane’s own Take over action after a confirmation; the holder side authenticates with the holder’s own full auth key, which the requester reads from the host-global shared registry — the same trust cross-channel jekt forwarding already relies on.
Structs§
Enums§
- WanTarget 🔒
- Who holds
agentper the relay, when no local lease or running instance does. Charlie 2026-09-26: a same-computer instance (another channel) held only the relay lease, and Take over looked nowhere else, answeredreleased: false, and the pane was refused again.
Constants§
- RELEASE_
GRACE 🔒 - How long the holder lets a turn in flight finish before killing it.
- TAKEOVER_
WAIT 🔒 - How long the requester waits for the agent to become free.
Functions§
- describe_
requester 🔒 - handle_
agent_ 🔒holding GET /agentmux/agent/holding?uid=…— a LAN peer asking whether this host runsuid(spec §4.4, Phase 4). LAN-key readable, like the agent-name list: it discloses only whether an agent UID is live here, since when, and in which channel/version.- handle_
agent_ 🔒release - handle_
agent_ 🔒takeover - kept_
relay_ 🔒hold_ error - Take over reaches instances on this computer only.
The instance on this computer let go of the pane but the relay still
names it, and the relay wouldn’t move the lease (a relay without
/agents/lease/take, or a lease claimed for another account). - other_
computer_ 🔒error - surface_
failure 🔒 - Show
messagein the pane’s recovery row — the same persisted meta and live event a spawn refusal uses. - wan_
takeover_ 🔒target