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
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.
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
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
prompt: StringThe 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.
Thought
An agent thought chunk.
ToolCall
A tool call the agent made.
Fields
status: AssistantToolCallStatusHow the call is going.
PermissionAsk
A permission request, recorded with the decision the policy made.
Fields
decided: AssistantPermissionDecisionWhat 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.
TurnCompleted
The turn ended with an answer.
Fields
TurnFailed
The turn ended without an answer.
Fields
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
State
The session’s state changed.
Fields
state: AssistantSessionStateThe state it changed to.
Ended
The session is over; nothing further will arrive on this stream.
Implementations§
Source§impl AssistantSessionEvent
impl AssistantSessionEvent
Sourcepub fn turn_id(&self) -> Option<&str>
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.
Sourcepub fn settles(&self) -> Option<(AssistantSessionState, Option<String>)>
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
impl Clone for AssistantSessionEvent
Source§fn clone(&self) -> AssistantSessionEvent
fn clone(&self) -> AssistantSessionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AssistantSessionEvent
impl Debug for AssistantSessionEvent
Source§impl<'de> Deserialize<'de> for AssistantSessionEvent
impl<'de> Deserialize<'de> for AssistantSessionEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AssistantSessionEvent
Source§impl PartialEq for AssistantSessionEvent
impl PartialEq for AssistantSessionEvent
Source§impl Serialize for AssistantSessionEvent
impl Serialize for AssistantSessionEvent
impl StructuralPartialEq for AssistantSessionEvent
Source§impl TS for AssistantSessionEvent
impl TS for AssistantSessionEvent
Source§type WithoutGenerics = AssistantSessionEvent
type WithoutGenerics = AssistantSessionEvent
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 moreSource§type OptionInnerType = AssistantSessionEvent
type OptionInnerType = AssistantSessionEvent
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 docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more