Skip to main content

AssistantSessionProjection

Struct AssistantSessionProjection 

Source
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: bool

Whether 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: u64

How 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: u64

The 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

Source

pub fn of<'events>( events: impl IntoIterator<Item = &'events AssistantSessionEvent>, ) -> Self

Project a whole transcript, oldest event first.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> AssistantSessionProjection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AssistantSessionProjection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AssistantSessionProjection

Source§

fn default() -> AssistantSessionProjection

Returns the “default value” for a type. Read more
Source§

impl Eq for AssistantSessionProjection

Source§

impl PartialEq for AssistantSessionProjection

Source§

fn eq(&self, other: &AssistantSessionProjection) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AssistantSessionProjection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.