Expand description
Writing an agent’s transcript: the line appends to the block’s output and
the agent’s global zone, the order lock that keeps one block’s events in line
order, and the announcements of a replaced or deleted transcript.
These lived in blockcontroller/shell/file_ops.rs next to the terminal output
path, which made the store-lock warnings (site=) and a reader’s search for
“where does a transcript get written” point at the terminal code. Terminal
output (handle_append_block_file for term) stays in shell/.
Functions§
- append_
agent_ output_ line append_output_linefor a line an agent’s process wrote: besides an echo’s origin, it is stored with which runtime wrote it (origin_sig::stamp_writer), so a reader decides what the message may name by who wrote it.- append_
output_ line - Appends one NDJSON stdout line, plus the newline the frontend’s line
splitter needs, to the block’s
outputfile andglobal_output_zone. - persist_
injected_ user_ line persist_user_linefor a message no pane typed (a jekt, a broadcast, a schedule, the app API): the record is published as a plain one, which an open pane shows, because noagent-message-acceptednode stands for it.- persist_
user_ line - Persist a user message the controller wrote to the agent’s stdin, so
parseHistoryLinescan reconstruct itsuser_messagenode on reopen. - publish_
transcript_ changed - Tell a block’s panes that its transcript
outputwas replaced or deleted as a whole (Phase 5a-3), so an open pane resyncs at once instead of on its next read.fileopismps::FILE_OP_REPLACE— with the new generation and line count read fromfilestore— ormps::FILE_OP_DELETE. Call it, with the replace or delete itself, insidewith_transcript_order. - resolve_
global_ output_ zone - Resolve a block’s GLOBAL transcript zone (
agent:<defId>:current) from itsagentIdmeta, looking the block up inmstore. ReturnsNonefor non-agent blocks, when there’s no store, or when the block can’t be loaded — the caller then passesNoneand no global mirror happens. Shared by the subprocess / persistent / acp agent controllers. - with_
transcript_ order - Run
fholdingblock_id’s transcript order lock — the lock every append holds from its first write to its publish (see [append_transcript]). A replace or delete of the block’s transcript, and its announcement (publish_transcript_changed), run inside it, so no append’s write and event can interleave with them and one block’s events stay in order (review of #3636).fmust not append to the same block: the lock isn’t reentrant.