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§
- can_
release 🔒 - Whether this pane holds the agent’s lease and has a process to stop.
- 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 - 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 - release_
block 🔒 - Let go of one pane’s agent for another instance: gracefully stop its CLI (a turn in flight finishes, then it is
killed at
RELEASE_GRACE) and say so in the pane.Errwhen this pane holds nothing. - surface_
classified_ 🔒failure surface_failurefor a failure already built (its wording set by the caller).- surface_
failure 🔒 - Show
messagein the pane’s recovery row — the same persisted meta and live event a spawn refusal uses. - take_
over 🔒 - Take a pane’s agent over. Reached from the window’s own socket (
agent.takeover,callerNone) and, for an agent’s own pane, frompane_binding::handle_takeover. - wait_
for_ 🔒user - Wait for the user to decide on each request (their override window, then the release itself); each one’s
final status. A request still open after the window and the grace has no final status and reads
pending. - wan_
takeover_ 🔒target