Skip to main content

Module conversation_turns

Module conversation_turns 

Source
Expand description

Where a conversation’s turns open, in the shape the fold reads them.

One rule, two readers. A page is cut on the fold’s turn boundaries, and so is the window a session keeps its conversation in: a window that starts part-way through a turn serves its first turn with the head missing. The fold lives above this crate (forge_server::transcript), so the row predicates it reads live here and both readers share the one copy.

This answers no more than the fold would. Every frame TurnScan names is one the fold opens a turn at; it names none the fold would not. Three shapes it cannot read the way the fold does are answered the safe way (no turn), so what they cost is a head the window cannot start on, never a cut inside a turn.

A queued prompt opens a turn in the fold, and the scan answers none for it. That miss is not only the prompt: the fold’s turn opens there and resets the state the next turn opens under, so a frame the fold then draws as a head of its own - the continuation a compaction leaves - is left alone here too. opens_for_debt answers for it, because the counter debt read wants the fold’s openings rather than the cut’s: a missed one carries the previous turn’s counters into the newest.

And a row opening with a bracket is read as an envelope, because every envelope this workspace writes opens with one and the parser that tells an envelope from the reader’s own words lives above this crate. That is broader than the envelopes: a reader’s own [note] ... row, and a bracket-led notice the parser rejects, are heads here that this leaves alone. The shapes read here are exempt from that, so an image note the fold opens a turn at is named. A delivery’s envelope row opens a turn in the fold unless the CLI pressed it into a running turn, and this side answers none for it - the accepted cost a queued prompt pays above: a head the window cannot start on, never a cut inside a turn. The debt read answers for it too, on the row’s bracket alone (is_envelope_row).

And a forge-minted row arriving at an open call is a delivery the CLI pressed into the running turn - the fold keeps it there and opens no turn (#2379). That answer needs the whole list (the fold declines only where the call’s result really comes); a stream cannot read it, so this side answers no turn for the row, and for a call whose result never arrives it keeps answering that way - heads the window cannot start on.

Re-exports§

use forge_primitives::messages::names_a_dispatch; 🔒
use forge_primitives::ContentBlock; 🔒
use forge_primitives::Message; 🔒

Structs§

TurnScan
Where the fold opens a conversation turn, walked frame by frame.

Functions§

claims_skill_call
Whether text is the body of a skill the open turn holds a call for, consuming that claim.
forge_minted
Whether a user row’s id says forge minted it: a reader’s own send (forge_prompt_*) or the machinery’s dispatch (forge_nudge_*), the two namespaces forge_sdk::request_id mints.
is_continuation
Whether text is the continuation prompt a compaction leaves behind.
is_dispatched
A frame a sub-agent produced. What it narrates and calls belongs to the SUBAGENTS surface, never to the session’s own conversation.
is_envelope_row
Whether a frame is a bracket-led row: the shape every envelope this workspace injects opens with - a delivery, a peer wrapper, a failure.
is_image_note
Whether text is the harness’s own line about an image it just read.
is_interrupt_marker
Whether text is the CLI’s interrupt marker: the row it writes when the reader’s own interrupt ends a turn.
is_queued_prompt
Whether a frame is the CLI’s queued prompt, which the fold opens a turn at.
is_task_notice
Whether a turn’s text is the harness’s own task notice rather than anything a person said: the marker the CLI writes at the head of the XML.
names_skill
Whether a Skill call’s own input names the skill a body’s path ended in.
normalized_skill
A skill name as its words, so pr-review-loop and PR Review Loop agree.
opens_for_debt
Whether a frame opens a turn for a reader that attributes counters to the newest turn: the scan’s own openings plus the two shapes the fold opens at and the window cut deliberately cannot name - a queued prompt and a delivery’s envelope row.
skill_body_name
The skill a body’s own frame names, off its first line’s directory.