Expand description
The steps of run_agent_turn_joining (input.rs), one function each, in the order it runs them. Moved from it unchanged.
Structs§
- Spawn
Base 🔒 - What a pane’s meta says to run.
- Turn 🔒
- One turn, ready to hand to the controller that will run it.
Constants§
- CONTAINER_
ATTACHMENTS_ 🔒SUBDIR - The subfolder, under a container’s working folder, that rehomed attachments live in.
Functions§
- attachment_
destination 🔒 - Where this turn’s attachments land, or why they can’t:
Ok(None)for a host agent (nothing to rehome — the host path already means something to it);Ok(Some(cwd))for a container agent with a working folder to copy into;Errfor a runtime that refuses attachments and isn’t a container (none does today; kept so a future one still refuses cleanly), or a container with no working folder yet. - dispatch_
app_ 🔒server - App Server owns a persistent thread/turn process and has its own typed protocol path. Keep it ahead of the legacy stream-json branches.
- dispatch_
persistent 🔒 - Dispatch to a persistent controller: it starts (or respawns) the CLI and carries the message on its input.
- dispatch_
session_ 🔒agent - ACP agents (Copilot, OpenClaw, Pi) and Muse Code (MSP): the message becomes a prompt (a turn) on the agent’s running session. If the agent’s process exited or crashed, this starts it again from the pane’s meta; the message waits for the new session.
- dispatch_
subprocess 🔒 - Dispatch to a per-turn subprocess controller (a host CLI, or a Docker exec for a container agent).
- gated_
spawn_ 🔒env - The spawn environment, after the single-live-instance check and the identity gate.
- id_
bearing_ 🔒suffix - The trailing part of a send-copy’s host path that carries its attachment id:
<sha256>.…for an image or other derived file (prompt.rs’s module doc), ornamed/<sha256>/<realname>for any other kind.Nonefor a path with neither shape — a send-copy always has one, so this only trips on a path this function doesn’t recognize, which must not be guessed at. - is_
sha256_ 🔒hex - prepare_
attachments 🔒 - The attachments of a message: a numbered list appended to the text, and the inline images for a persistent Claude.
- refuse_
retired_ 🔒harness - A pane opened with a harness AgentMux no longer offers runs no more turns: it is told why, in the pane, and nothing starts. The pane records the provider and the output format it was opened with, so a pane that was running before the harness was removed (or restored from a layout saved before) is recognised without its agent definition. Every turn path asks this first: subprocess, persistent, app-server and ACP alike.
- register_
turn_ 🔒agent - Register the agent with the cloud subscriber and the reactive handler, so cloud-injected messages reach it.
- rehome_
for_ 🔒container - Copy each resolved attachment’s send-copy from its host path into
host_cwd(the pane’s working folder) and point it at the container-side path instead (narko #198 piece 2): a container agent can open a file under its workspace mount, never a bare host path. The copy keeps the exact trailing pathid_bearing_suffixfinds —<sha256>.…for an image/derived file,named/<sha256>/<realname>for any other kind — the same two shapes the composer’s reload parser (ID_RE,attached-images.ts) and the image counter (images_in_text,transcript/images.rs) already recognize (#7434): renaming to the display name instead would make every container attachment unrecognizable to both on reload. A path with neither shape, or a copy that fails, joinsmissing, the same treatment a send-copy swept by retention gets. - rehome_
one 🔒 - Copies
host_path’s send-copy intohost_cwd’sCONTAINER_ATTACHMENTS_SUBDIR, keeping the exact id-bearing suffixid_bearing_suffixfinds, and returns the container-side path string.Nonewhenhost_pathcarries no recognizable id, or the copy fails — logged either way, so a caller that only has a name to report (missing) still has the reason in the log. - rehome_
text_ 🔒companion - Rewrites a
text version: <path>segment of a document’s note to the container-side pathrehome_onecopied it to, keeping the rest of the note (page count, “contains macros”) as is. Drops just that segment, rather than leaving a host path, when the companion carries no recognizable id or its copy fails. Matches only a segment that STARTS WITH the marker, never a bare substring:file_note’s failure note reads “no text version: {e}”, which contains “text version: “ too but names no path to rehome — matching that would delete the error text instead (#2586). A note with neither segment shape (an image’s note is alwaysNone) is unchanged. - runtime_
for_ 🔒turn - The container runtime a container agent’s turn runs in, or the reason there is none. The reason is written to the pane like every other refusal before a process starts: otherwise the turn returns an error nobody sees and the pane shows work that never happens.
- spawn_
base 🔒 - Re-read the spawn config from block metadata.
- surface_
refusal 🔒 - Show a refusal that happened before any process ran in the pane: the raw frame in the output log, plus the classified failure the recovery row reads.