pub struct AssistantSessionProjection {
pub settled: Option<(AssistantSessionState, Option<String>)>,
pub acp_session_ref: Option<String>,
pub load_session: bool,
pub turns: u64,
pub first_turn_text: Option<String>,
pub open_turn_id: Option<String>,
pub latest_context: Option<AssistantTurnContext>,
pub document_revision: u64,
pub commands: Vec<AssistantCommand>,
}Expand description
Everything a session’s transcript says about it.
The one place the projection rules live, so the list surface, the detail
surface, the resume decision and the assistant_context tool all read the
same facts off the same records. Nothing here reads a stored status: there
is none.
Fields§
§settled: Option<(AssistantSessionState, Option<String>)>The last state a record settled the session to, with its cause. None
when no record has settled it — which, for a session with no running
process, is a transcript the boot sweep has not yet written back to.
acp_session_ref: Option<String>The harness’s own session handle from the most recent open.
load_session: boolWhether the agent advertised loadSession at its most recent open.
false until an open has been recorded: a session that never opened
cannot be resumed either.
turns: u64How many turns have started.
first_turn_text: Option<String>What the operator typed on the first turn — the fallback title.
open_turn_id: Option<String>The turn a Request opened that no TurnCompleted/TurnFailed has
closed yet. None when every asked turn has been answered.
This is how a settle path knows there is a turn to close: a session whose process died mid-turn must have that turn FAILED on the record before the session settles, or every reader of the transcript folds an open turn forever — the console reads it as busy, and a later edit batch would be attributed to a turn that ended long ago.
latest_context: Option<AssistantTurnContext>The most recently shared on-screen context.
document_revision: u64The shared document’s revision: how many edit batches have folded into
latest_context. Monotonic and never reset — a fresh context share
rebases the text but does not rewind the count — so a client can use it
as an idempotency guard when replaying frames.
commands: Vec<AssistantCommand>The commands the harness advertised most recently. A later advertisement REPLACES an earlier one whole, as ACP’s own update does.
Implementations§
Source§impl AssistantSessionProjection
impl AssistantSessionProjection
Sourcepub fn of<'events>(
events: impl IntoIterator<Item = &'events AssistantSessionEvent>,
) -> Self
pub fn of<'events>( events: impl IntoIterator<Item = &'events AssistantSessionEvent>, ) -> Self
Project a whole transcript, oldest event first.
Sourcepub fn state(
&self,
live: Option<AssistantSessionState>,
) -> (AssistantSessionState, Option<String>)
pub fn state( &self, live: Option<AssistantSessionState>, ) -> (AssistantSessionState, Option<String>)
The state and cause to report, given whether a process is running.
A running process ALWAYS wins: it is the one fact a transcript cannot
contradict. With no process, the last settling record decides. With no
process and no settling record — a state the boot sweep exists to
prevent — the answer is AssistantSessionState::Ended with a cause
that says exactly that, because a session with no process and no record
of stopping must never be presented as running.
Sourcepub fn is_resumable(&self) -> bool
pub fn is_resumable(&self) -> bool
Whether a dormant session can be reopened: it has a handle to load and the agent said it can load one.
Sourcepub fn derived_title(&self) -> Option<String>
pub fn derived_title(&self) -> Option<String>
The title a listing shows: the first 80 characters of the first turn’s own text, when the caller named no title of their own.
Trait Implementations§
Source§impl Clone for AssistantSessionProjection
impl Clone for AssistantSessionProjection
Source§fn clone(&self) -> AssistantSessionProjection
fn clone(&self) -> AssistantSessionProjection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more