Skip to main content

AssistantSessionEvent

Enum AssistantSessionEvent 

Source
pub enum AssistantSessionEvent {
Show 16 variants SessionOpened { acp_session_ref: String, load_session: bool, at: DateTime<Utc>, resumed: bool, }, ContextShared { context: AssistantTurnContext, source: String, }, Request { turn_id: String, text: String, context: Option<AssistantTurnContext>, command: Option<AssistantCommandInvocation>, }, TurnStarted { turn_id: String, at: DateTime<Utc>, prompt: String, }, AvailableCommands { commands: Vec<AssistantCommand>, }, ConfigOptions { options: Vec<AssistantConfigOption>, }, Delta { turn_id: String, text: String, }, Thought { turn_id: String, text: String, }, ToolCall { turn_id: String, call_id: String, name: String, status: AssistantToolCallStatus, input: Option<Value>, output: Option<Value>, }, PermissionAsk { turn_id: String, request: Value, decided: AssistantPermissionDecision, }, DocumentEdit { edits: Vec<AssistantDocumentEditOp>, revision: u64, }, TurnCompleted { turn_id: String, final_message: String, stop_reason: String, session_ref: Option<String>, }, TurnFailed { turn_id: String, code: String, message: String, }, Raw { turn_id: Option<String>, source: String, value: Value, }, State { state: AssistantSessionState, reason: Option<String>, }, Ended { reason: String, },
}
Expand description

One event on a session’s transcript, and one frame on its WebSocket.

The SAME value is durably appended and streamed live, so replay and live are one stream read at two times rather than two encodings that could disagree.

Variants§

§

SessionOpened

A harness process opened (or reopened) the conversation.

Appended once per spawn — so a resumed session has two of these, and the LAST one carries the capabilities of the process that is running now. It is what makes the resume decision a fact read off the transcript rather than a guess: load_session is what the agent ACTUALLY advertised at initialize, not what its kind is assumed to support.

Fields

§acp_session_ref: String

The harness’s own session handle — what session/load resumes.

§load_session: bool

Whether this agent advertised loadSession at initialize.

§at: DateTime<Utc>

When it opened.

§resumed: bool

Whether this open was a resume of a prior conversation.

§

ContextShared

The operator’s on-screen context, as it stood.

Appended by every turn and by an explicit context push, so the LATEST one is the shared context both surfaces read — and the one the harness’s assistant_context tool answers with. The transcript IS the shared context; there is no second store.

Fields

§context: AssistantTurnContext

What was on screen.

§source: String

What put it there: turn or push.

§

Request

What the OPERATOR asked, appended the moment the turn was accepted and before any frame the harness produces for it.

The record of the question. Without it a reloaded conversation is answers with no questions, and the transcript — which is the shared context both surfaces read — could not say what was asked. It carries the context the turn was sent with, so the request and the screen it was asked from are ONE record rather than two that could be appended out of order.

Fields

§turn_id: String

The turn this frame belongs to.

§text: String

The operator’s own words, without the composed context prefix.

§context: Option<AssistantTurnContext>

What was on the operator’s screen, when they sent any.

§command: Option<AssistantCommandInvocation>

The harness command this turn invokes, when it invokes one.

Recorded beside the text rather than folded into it, because a transcript that showed only the composed /compact … line could not say whether the operator pressed a command control or typed a line that happened to begin with a slash.

§

TurnStarted

A turn was accepted and the prompt was sent.

Fields

§turn_id: String

The turn this frame belongs to.

§at: DateTime<Utc>

When the turn started.

§prompt: String

The prompt exactly as it was sent, context prefix included.

Recorded so the transcript answers “what was the agent actually asked” — a transcript that showed only the operator’s typing would hide the composed context the answer was really shaped by. The operator’s own words are on the Self::Request frame that precedes this one; they are not repeated here.

§

AvailableCommands

The harness advertised the commands it serves.

A COMPLETE replacement of whatever it advertised before, exactly as ACP’s available_commands_update is: an agent that drops a command stops listing it, and a merge would keep offering a command that would now be refused.

Fields

§commands: Vec<AssistantCommand>

Every command the harness serves, in the order it listed them.

§

ConfigOptions

The harness advertised its configuration options — the model picker among them.

A COMPLETE replacement of whatever it advertised before, exactly as ACP’s config_option_update and its session/set_config_option response both are: an agent that drops an option stops listing it, and a merge would keep offering a value that would now be refused.

Fields

§options: Vec<AssistantConfigOption>

Every option, in the order the agent listed them.

§

Delta

An agent text chunk, in order.

Fields

§turn_id: String

The turn this frame belongs to.

§text: String

The chunk.

§

Thought

An agent thought chunk.

Fields

§turn_id: String

The turn this frame belongs to.

§text: String

The thought fragment.

§

ToolCall

A tool call the agent made.

Fields

§turn_id: String

The turn this frame belongs to.

§call_id: String

The agent’s own id for the call, so updates join to one row.

§name: String

The tool’s name.

§status: AssistantToolCallStatus

How the call is going.

§input: Option<Value>

The call’s input, when the agent reported one.

§output: Option<Value>

The call’s output, when the agent reported one.

§

PermissionAsk

A permission request, recorded with the decision the policy made.

Fields

§turn_id: String

The turn this frame belongs to.

§request: Value

The agent’s request, verbatim.

§decided: AssistantPermissionDecision

What the configured policy answered.

§

DocumentEdit

The agent edited the shared document through its assistant_document_edit tool.

Appended by the assistant MCP route AFTER validating the batch against the shared document as the transcript then held it, so a recorded batch always applied cleanly in full. The projection folds it into latest_context — which is how the agent’s own next assistant_context read sees its edits — and the console applies the same operations to the live editor buffer, where the operator keeps or reverts them.

Fields

§edits: Vec<AssistantDocumentEditOp>

The operations, in application order.

§revision: u64

The shared document’s revision AFTER this batch — monotonic per session and never reset, so a client replaying frames after a reconnect can skip batches it already applied.

§

TurnCompleted

The turn ended with an answer.

Fields

§turn_id: String

The turn this frame belongs to.

§final_message: String

The agent’s last completed message.

§stop_reason: String

The canonical stop reason.

§session_ref: Option<String>

The harness’s own session handle, when it reported one.

§

TurnFailed

The turn ended without an answer.

Fields

§turn_id: String

The turn this frame belongs to.

§code: String

auth_required for a -32000, otherwise the typed harness-error variant name in snake_case.

§message: String

The failure, in the harness’s own words.

§

Raw

A frame the neutral vocabulary above cannot represent, passed through verbatim.

The adapter’s own rule — nothing is ever silently dropped — reaching this surface. A console renders what it knows and ignores the rest; an operator reconstructing what an agent actually did still has every frame.

Fields

§turn_id: Option<String>

The turn it belongs to, when it belongs to one.

§source: String

Where the frame came from, as the adapter labelled it.

§value: Value

The frame, verbatim.

§

State

The session’s state changed.

Fields

§state: AssistantSessionState

The state it changed to.

§reason: Option<String>

Why — process_exited, deleted, resume_refused: loadSession not advertised, load_failed: …. None when nothing decided it.

§

Ended

The session is over; nothing further will arrive on this stream.

Fields

§reason: String

Why it ended.

Implementations§

Source§

impl AssistantSessionEvent

Source

pub fn turn_id(&self) -> Option<&str>

The turn this event belongs to, when it belongs to one.

State and Ended are session-wide and belong to no turn; saying so with None is what keeps a caller from inventing an attribution.

Source

pub fn settles(&self) -> Option<(AssistantSessionState, Option<String>)>

The state and cause this record SETTLES the session to, if it settles it at all.

The lifecycle projection is exactly “the last record for which this returns Some, unless a process is running”. A record that decides nothing returns None, which is what lets the scan walk backwards and stop at the first decision it meets.

Trait Implementations§

Source§

impl Clone for AssistantSessionEvent

Source§

fn clone(&self) -> AssistantSessionEvent

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 AssistantSessionEvent

Source§

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

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

impl<'de> Deserialize<'de> for AssistantSessionEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AssistantSessionEvent

Source§

impl PartialEq for AssistantSessionEvent

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for AssistantSessionEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AssistantSessionEvent

Source§

impl TS for AssistantSessionEvent

Source§

type WithoutGenerics = AssistantSessionEvent

If this type does not have generic parameters, then WithoutGenerics should just be Self. If the type does have generic parameters, then all generic parameters must be replaced with a dummy type, e.g ts_rs::Dummy or ().
The only requirement for these dummy types is that EXPORT_TO must be None. Read more
Source§

type OptionInnerType = AssistantSessionEvent

If the implementing type is std::option::Option<T>, then this associated type is set to T. All other implementations of TS should set this type to Self instead.
Source§

fn ident(cfg: &Config) -> String

Identifier of this type, excluding generic parameters.
Source§

fn docs() -> Option<String>

JSDoc comment to describe this type in TypeScript - when TS is derived, docs are automatically read from your doc comments or #[doc = ".."] attributes
Source§

fn name(cfg: &Config) -> String

Name of this type in TypeScript, including generic parameters
Source§

fn decl_concrete(cfg: &Config) -> String

Declaration of this type using the supplied generic arguments. The resulting TypeScript definition will not be generic. For that, see TS::decl(). If this type is not generic, then this function is equivalent to TS::decl().
Source§

fn decl(cfg: &Config) -> String

Declaration of this type, e.g. type User = { user_id: number, ... }. This function will panic if the type has no declaration. Read more
Source§

fn inline(cfg: &Config) -> String

Formats this types definition in TypeScript, e.g { user_id: number }. This function will panic if the type cannot be inlined.
Source§

fn inline_flattened(cfg: &Config) -> String

Flatten a type declaration. This function will panic if the type cannot be flattened.
Source§

fn visit_generics(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all type parameters of this type.
Source§

fn output_path() -> Option<PathBuf>

Returns the output path to where T should be exported, relative to the output directory. The returned path does not include any base directory. Read more
Source§

fn visit_dependencies(v: &mut impl TypeVisitor)
where Self: 'static,

Iterates over all dependency of this type.
Source§

fn dependencies(cfg: &Config) -> Vec<Dependency>
where Self: 'static,

Resolves all dependencies of this type recursively.
Source§

fn export(cfg: &Config) -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem. To export this type together with all of its dependencies, use TS::export_all. Read more
Source§

fn export_all(cfg: &Config) -> Result<(), ExportError>
where Self: 'static,

Manually export this type to the filesystem, together with all of its dependencies. To export only this type, without its dependencies, use TS::export. Read more
Source§

fn export_to_string(cfg: &Config) -> Result<String, ExportError>
where Self: 'static,

Manually generate bindings for this type, returning a String. This function does not format the output, even if the format feature is enabled. Read more

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.