pub struct AssistantSessionRecord {
pub session_id: AssistantSessionId,
pub subject: String,
pub harness: String,
pub account: Option<String>,
pub title: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub turns: u64,
pub mcp_token_digest: Option<String>,
pub commands: Vec<AssistantCommand>,
pub config_options: Vec<AssistantConfigOption>,
}Expand description
One durable assistant session.
Fields§
§session_id: AssistantSessionIdThe session’s identity (primary key).
subject: StringThe caller subject that owns it. The list surface is per caller, so this is the field it filters on — never a namespace, because a session is not a workflow and lives in no namespace.
harness: StringThe configured harness name it runs.
account: Option<String>The configured account name, when the harness declares any.
title: Option<String>The first 80 characters of the first prompt; None before one.
created_at: DateTime<Utc>When the session was created.
updated_at: DateTime<Utc>The last time anything about it changed.
turns: u64How many turns have been submitted on it — bookkeeping the server keeps in step with the transcript projection, so a listing does not have to read every session’s whole transcript to count them.
mcp_token_digest: Option<String>The SHA-256 digest, lowercase hex, of the session-scoped bearer this
session’s harness carries to the server’s own MCP endpoint. None when
the session was given no aion MCP server.
The digest, never the token: a store that held the token would be a
store that could hand it out. Verification hashes what the caller
presented and compares. Its LIFETIME is the session’s — a call is
admitted only while the session’s projected lifecycle is not ended, so
revocation is a durable fact rather than an in-memory set that dies with
the process that minted it.
commands: Vec<AssistantCommand>The commands the harness advertised most recently.
A DERIVED CACHE of the transcript’s latest
aion_core::AssistantSessionEvent::AvailableCommands record, kept for
exactly the reason turns and title are: a listing must not read every
session’s whole conversation to answer one field, and an advertisement
can arrive at the first turn of a conversation that runs for hours, so a
bounded tail read cannot find it.
The TRANSCRIPT is the authority. The frame is appended first and this is
written from it inside the same append path, so the two cannot be written
out of order; the_records_command_cache_is_what_the_transcript_projects
pins that a rebuild from the transcript reproduces this field exactly.
Unlike a status, this is not a second ANSWER to a question the transcript
answers differently — it is the same answer, kept where a listing can
afford to read it.
config_options: Vec<AssistantConfigOption>The configuration options the harness advertised most recently — the
model picker among them. The same derived cache as commands, kept for
the same listing-cost reason, with the transcript’s
aion_core::AssistantSessionEvent::ConfigOptions records as the
authority. #[serde(default)] because records written before options
existed decode as having none advertised, which is exactly true.
Implementations§
Source§impl AssistantSessionRecord
impl AssistantSessionRecord
Sourcepub fn encode(&self) -> Result<Vec<u8>, StoreError>
pub fn encode(&self) -> Result<Vec<u8>, StoreError>
Encode the stable backend-neutral representation.
§Errors
StoreError::Serialization when serialization fails.
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, StoreError>
pub fn decode(bytes: &[u8]) -> Result<Self, StoreError>
Decode and re-validate a stored representation.
§Errors
StoreError::Serialization for malformed bytes or an unknown field.
Sourcepub fn summary(
&self,
state: AssistantSessionState,
reason: Option<String>,
) -> AssistantSessionSummary
pub fn summary( &self, state: AssistantSessionState, reason: Option<String>, ) -> AssistantSessionSummary
The listing row for this record under a state the caller has projected.
The state, its lifecycle and its cause are PARAMETERS because none of
them is stored: they are read off the session’s transcript records plus
whether a process is running (see
aion_core::AssistantSessionProjection). A record that carried its own
status would be a second answer to a question the transcript already
answers, and the two would drift.
Trait Implementations§
Source§impl Clone for AssistantSessionRecord
impl Clone for AssistantSessionRecord
Source§fn clone(&self) -> AssistantSessionRecord
fn clone(&self) -> AssistantSessionRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more