Skip to main content

Module command_transcript

Module command_transcript 

Source
Expand description

A contained command’s output, streamed into the activity transcript. A contained command’s output, streamed into the activity transcript.

CommandTranscript is the bridge between the two halves this build joins: run_cancellable_command now delivers a command’s output line by line as it is written, and ActivityContext::emit_event is the seam an activity publishes live transcript events on. Wiring the first into the second is what makes a command step readable WHILE it runs, through exactly the machinery an agent step already uses — the same [ActivityEvent] envelope, the same (workflow, run, activity, attempt) stream, the same durable append and cursor reads on the server side. Nothing downstream had to learn what a command is.

§What one line becomes

A line becomes a [ActivityEventKind::Message] attributed to [MessageRole::Tool] — a non-conversational participant’s output, which is what a command’s writing is. The stream it came from is carried by the event’s agent_role (the envelope’s producer label), so stdout and stderr stay distinguishable without inventing a persisted event kind for something the locked set already models. agent_id is the nil UUID: a declared command is not an agent and has no sub-identity to attribute, and nil is what this codebase already writes where agent attribution is absent.

§Size

No byte ceiling is applied here, deliberately. The server’s transcript publisher bounds every event it persists against the operator’s observability.max_event_bytes, truncating on a char boundary with an explicit marker; a second ceiling on this side would be the same rule known in two places, free to drift from the one that is actually enforced. Nor does streaming add an unbounded buffer: a line is a borrowed slice of the capture the command’s completion already retains in full, and the event carries only that one line.

Structs§

CommandTranscript
Publishes a contained command’s output lines onto an activity’s transcript.