Skip to main content

Module tool_helpers

Module tool_helpers 

Source
Expand description

Helpers the tool handlers share: cron, durations, quit-self and bulk-stop outcomes, delivery text. Split out of main.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §4.2).

Constants§

HELD_IDLE 🔒
held_reason of a message kept for a session gone cold (srv’s cold_hold::REASON_IDLE).
HELD_QUOTA 🔒
held_reason of a routine message kept back by quota mode (srv’s cold_hold::REASON_QUOTA).
INJECT_TIMEOUT 🔒
How long a send waits for srv’s answer. srv’s own tiers for an agent it does not run (a LAN peer, the cloud relay, then the hold) can add up to more than the client’s default 10 s, and srv finishes the delivery anyway.

Functions§

add_stop_notes 🔒
The note of a Stop agents result: what srv said (a passed signal or staged no longer applies) and, for a target on an older AgentMux on this machine, which only stops (its answer names the effect stop), that its pane was left open.
await_shutdown 🔒
Polls srv for a shutdown waiting on the user’s override (SPEC_AGENT_SELF_QUIT_2026_09_24.md §6.5) until it leaves pending — and proceeding too when to_the_end — and returns the last status seen. One long request instead would outlast the client’s own timeout.
await_shutdown_of 🔒
await_shutdown for a caller whose own pane may be one of several in a request: it also stops waiting once the user has answered for own (kept it), which the request’s shared status does not say until every other agent has been dealt with.
close_pane_outcome 🔒
close_pane_outcome for an answer that did not carry pane_closes.
close_pane_outcome_for 🔒
What ClosePane block_id= and Browser close tell the agent once the tab’s user has answered (§6.5): the tab is named, and so is whether its pane went with it.
close_pane_pending 🔒
Stop pane on another pane: srv’s 202 answer, as the agent sees it. A request that joined a shutdown already under way (via is not a pane close) says whose it is and that the pane may outlive it.
cron_set_enabled 🔒
deferred_delivery_text 🔒
SendMessage’s answer when srv accepted the message but queued it: the target’s process is starting up, restarting or stopping (SPEC_JEKT_IMMEDIATE_DELIVERY_2026_09_28.md §2.1), or it runs one turn at a time (a container agent, a Codex or Gemini agent) and is in one now, so the message waits for that turn to end. A persistent agent that is up gets it at once, mid-turn included, and is reported as delivered.
delivery_failure 🔒
The error for a message srv neither delivered nor held.
format_duration 🔒
Human-readable representation of a clamped Duration — used in the Loop success message so the reported cadence matches the actual run cadence.
held_text 🔒
The reply to held: true: srv kept the message and says why and until when.
held_until_active 🔒
Which of the two “kept until the agent is next active” holds srv’s answer names, for a send to many: a held message is not a failed one.
inject_transport_error 🔒
What a send tells the sender when srv’s answer did not arrive, in place of the transport’s own words (“error sending request for url …”), which say nothing about whether the message was kept.
own_outcome 🔒
One target’s own answer from a settled request over several agents: srv lists what became of each agent (outcomes), while the request’s own status is for all of them. A request for one agent has no list, and its answer is the target’s own.
pane_goes_note 🔒
What srv said about the pane when it took the close of a tab (pane_closes): whether the pane goes with it.
parse_interval 🔒
Parse a loop interval string into a Duration. Accepts a number with an optional unit suffix: s (seconds), m (minutes), h (hours); a bare number is treated as minutes. Clamped to [10s, 24h].
pending_note 🔒
What Stop pane and Stop agents say instead of waiting for the user’s window: the call returns at once, srv runs the window, and the agent is told by one [AgentMux] note only if the user keeps what it asked to close or the close fails.
pending_windows 🔒
The windows a stop opened, one per request id (several targets can share one): their targets and when each closes unless the user keeps it. pending is srv’s list of {block_id, request_id, deadline_ms?}; fallback_deadline_ms is the answer’s own deadline, for an entry without one.
public_stop 🔒
srv’s name for a pending shutdown’s tool (its audit log keeps the endpoint names) as agents call it now.
quit_self_outcome 🔒
What QuitSelf tells the agent once the user’s override window has settled (§6.5).
quit_self_result 🔒
What QuitSelf tells the agent, from srv’s answer (§4.2, §6.3).
send_message_outcome 🔒
What SendMessage tells the sender, from srv’s /agentmux/reactive/inject body. Each answer keeps its first word (Delivered, QUEUED, HELD) so existing prompts keep working, and adds the message id and the receiver’s condition where srv’s answer already implies it (SPEC_JEKT_DELIVERY_STATES_AND_MAILBOX_2026_10_01.md §5.2, Phase 0 item 3).
sent_text 🔒
The reply to success: true, which is either a delivery or a message queued at the relay.