Skip to main content

SessionRecord

Enum SessionRecord 

Source
pub enum SessionRecord {
Show 27 variants SessionMeta { schema_version: u32, seq: u64, time: String, session_id: String, cwd: String, title: String, provider: String, model: String, websearch: String, app_version: String, config: Option<SessionConfigMeta>, }, Context { schema_version: u32, seq: u64, time: String, sources: Vec<ContextSourceMeta>, }, ContextLedger { schema_version: u32, seq: u64, time: String, turn_id: String, ledger: ContextLedgerMeta, }, ContextPin { schema_version: u32, seq: u64, time: String, item: ContextItemMeta, reason: String, }, ContextDrop { schema_version: u32, seq: u64, time: String, item: ContextItemMeta, reason: String, }, ContextRecovery { schema_version: u32, seq: u64, time: String, item: ContextItemMeta, reason: String, }, Compaction { schema_version: u32, seq: u64, time: String, audit: CompactionAudit, }, CompactionReview { schema_version: u32, seq: u64, time: String, recovery_handle: String, review: CompactionReviewResult, }, User { schema_version: u32, seq: u64, time: String, turn_id: String, text: String, }, PromptMetadata { schema_version: u32, seq: u64, time: String, turn_id: String, metadata: PromptMetadata, }, AssistantFinished { schema_version: u32, seq: u64, time: String, turn_id: String, text: String, }, ReasoningFinished { schema_version: u32, seq: u64, time: String, turn_id: String, text: String, }, Usage { schema_version: u32, seq: u64, time: String, input_tokens: u64, output_tokens: u64, }, RequestAccounting { schema_version: u32, seq: u64, time: String, turn_id: String, accounting: ProviderRequestAccounting, }, ToolStarted { schema_version: u32, seq: u64, time: String, turn_id: String, call_id: String, name: String, arguments: String, mcp: Option<McpToolSessionMeta>, }, ToolFinished { schema_version: u32, seq: u64, time: String, turn_id: String, call_id: String, status: ToolStatus, output: Vec<String>, artifact: Option<ArtifactMetadata>, mcp: Option<McpToolSessionMeta>, }, Cancelled { schema_version: u32, seq: u64, time: String, turn_id: String, reason: String, }, Failed { schema_version: u32, seq: u64, time: String, turn_id: String, error: String, }, AcpSession { schema_version: u32, seq: u64, time: String, local_session_id: String, agent_name: String, acp_session_id: String, command: String, protocol_version: String, agent_info_name: Option<String>, agent_info_version: Option<String>, client_info_name: Option<String>, client_info_version: Option<String>, }, SessionRenamed { schema_version: u32, seq: u64, time: String, title: String, }, FileWrite { schema_version: u32, seq: u64, time: String, turn_id: String, op: WriteOp, path: String, before_hash: Option<u64>, before_bytes: Option<usize>, after_hash: u64, after_bytes: usize, status: ToolStatus, }, McpConfigChanged { schema_version: u32, seq: u64, time: String, turn_id: String, previous_files: Vec<SessionConfigFile>, current_files: Vec<SessionConfigFile>, diagnostics: Vec<String>, }, ShellExec { schema_version: u32, seq: u64, time: String, turn_id: String, process_id: Option<u64>, command: String, cwd: String, process_status: String, exit_code: Option<i32>, elapsed_ms: u64, kind: String, }, SkillActivated { schema_version: u32, seq: u64, time: String, name: String, path: String, content_hash: u64, byte_count: usize, rendered_content_hash: u64, rendered_byte_count: usize, loaded_references: Vec<SkillReferenceRecord>, }, QueuedInput { schema_version: u32, seq: u64, time: String, kind: String, text: String, }, AcpPermissionRequest { schema_version: u32, seq: u64, time: String, turn_id: String, tool_call_id: String, title: String, options: Vec<AcpPermissionOptionRecord>, }, AcpPermissionOutcome { schema_version: u32, seq: u64, time: String, turn_id: String, tool_call_id: String, outcome: String, },
}
Expand description

A single line in a session JSONL file.

Every record carries schema_version, seq (monotonic within the session), time (ISO 8601 UTC), and a type tag. Records are never rewritten; appends are the only mutation.

Variants§

§

SessionMeta

First line of a session: identity and environment.

Fields

§schema_version: u32
§seq: u64
§time: String
§session_id: String
§title: String
§provider: String
§model: String
§websearch: String
§app_version: String
§config: Option<SessionConfigMeta>

Effective config metadata: loaded config files, key origins, and diagnostics. None when config metadata was not captured.

§

Context

Loaded context source metadata (AGENTS.md etc.).

Fields

§schema_version: u32
§seq: u64
§time: String
§

ContextLedger

Content-free context working-set snapshot for one prompt turn.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§

ContextPin

A user pin action for a context item.

Fields

§schema_version: u32
§seq: u64
§time: String
§reason: String
§

ContextDrop

A user drop action for a context item.

Fields

§schema_version: u32
§seq: u64
§time: String
§reason: String
§

ContextRecovery

A user recovery action for a context item.

Fields

§schema_version: u32
§seq: u64
§time: String
§reason: String
§

Compaction

A manual or automatic compaction audit record.

Fields

§schema_version: u32
§seq: u64
§time: String
§

CompactionReview

The user’s decision on a compaction summary that required review.

Fields

§schema_version: u32
§seq: u64
§time: String
§recovery_handle: String
§

User

A user-submitted prompt.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§text: String
§

PromptMetadata

Prompt assembly metadata for one user turn.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§

AssistantFinished

Final replayable assistant text.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§text: String
§

ReasoningFinished

Final replayable reasoning text.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§text: String
§

Usage

Provider token usage increment.

Fields

§schema_version: u32
§seq: u64
§time: String
§input_tokens: u64
§output_tokens: u64
§

RequestAccounting

Exact request-size accounting and provider usage for one request.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§

ToolStarted

A tool call started.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§call_id: String
§name: String
§arguments: String
§mcp: Option<McpToolSessionMeta>

MCP metadata when this tool came from an MCP server.

§

ToolFinished

A tool call finished.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§call_id: String
§status: ToolStatus
§output: Vec<String>
§artifact: Option<ArtifactMetadata>

Metadata and handle for bounded redacted recoverable evidence.

§mcp: Option<McpToolSessionMeta>

MCP metadata when this tool came from an MCP server.

§

Cancelled

The agent run was cancelled.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§reason: String
§

Failed

The agent run failed.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§error: String
§

AcpSession

ACP session metadata.

Fields

§schema_version: u32
§seq: u64
§time: String
§local_session_id: String

Local append-only thndrs session id.

§agent_name: String

Configured ACP agent name.

§acp_session_id: String

Opaque external ACP session id returned by the agent.

§command: String

Redacted command display used to start the agent.

§protocol_version: String

Selected ACP protocol version.

§agent_info_name: Option<String>

Optional ACP agent info name.

§agent_info_version: Option<String>

Optional ACP agent info version.

§client_info_name: Option<String>

Optional ACP client info name.

§client_info_version: Option<String>

Optional ACP client info version.

§

SessionRenamed

Session title was renamed (latest wins).

Fields

§schema_version: u32
§seq: u64
§time: String
§title: String
§

FileWrite

A file write operation completed.

Records the operation type, target path, and before/after metadata for session audit. Only hashes and byte counts are persisted but not file content.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§path: String
§before_hash: Option<u64>
§before_bytes: Option<usize>
§after_hash: u64
§after_bytes: usize
§status: ToolStatus
§

McpConfigChanged

MCP configuration changed after the session was created.

Records only file paths, sources, hashes, and loader diagnostics; raw MCP server command, env, and header values are not persisted here.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§previous_files: Vec<SessionConfigFile>
§current_files: Vec<SessionConfigFile>
§diagnostics: Vec<String>
§

ShellExec

A shell command lifecycle event.

One-shot commands produce a terminal record. Background commands produce a running start record followed by a terminal record when they exit, time out, or are cancelled. stdout/stderr are not stored directly — they are captured in redacted, capped output records.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§process_id: Option<u64>

Registry id for a background process, when applicable.

§command: String

Full argv (program + args) joined with spaces.

§cwd: String

Working directory the command ran in.

§process_status: String

Lifecycle status: ok, failed, timeout, cancelled.

§exit_code: Option<i32>

Exit code if the process exited normally, else None.

§elapsed_ms: u64

Elapsed time in milliseconds.

§kind: String

“one-shot” or “background”.

§

SkillActivated

A skill was explicitly opened/activated in the session.

Fields

§schema_version: u32
§seq: u64
§time: String
§name: String
§path: String
§content_hash: u64

Hash of the raw SKILL.md file at path.

§byte_count: usize

Byte count of the raw SKILL.md file at path.

§rendered_content_hash: u64

Hash of the model-visible activation text after references are appended.

§rendered_byte_count: usize

Byte count of the model-visible activation text after references are appended.

§loaded_references: Vec<SkillReferenceRecord>
§

QueuedInput

Queued input recorded for audit. Resume does not rebuild pending queues.

Fields

§schema_version: u32
§seq: u64
§time: String
§kind: String

“steering” or “follow-up”.

§text: String
§

AcpPermissionRequest

ACP permission request metadata.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§tool_call_id: String
§title: String
§

AcpPermissionOutcome

ACP permission request outcome.

Fields

§schema_version: u32
§seq: u64
§time: String
§turn_id: String
§tool_call_id: String
§outcome: String

Implementations§

Source§

impl SessionRecord

Source

pub fn seq(&self) -> u64

The sequence number of this record.

Source

pub fn to_json(&self) -> Result<String, Error>

Serialize to a JSON string for JSONL append.

Source

pub fn from_json(json: &str) -> Result<Self, Error>

Deserialize from a JSON string.

Source

pub fn from_entry( entry: &Entry, seq: u64, time: &str, turn_id: &str, ) -> Option<SessionRecord>

Convert a transcript Entry into a SessionRecord.

Only finalized entries are converted — streaming entries (assistant/ reasoning still streaming, tools still running) are skipped because they represent incomplete live state.

Source

pub fn from_entry_with_artifact( entry: &Entry, seq: u64, time: &str, turn_id: &str, artifact: Option<ArtifactMetadata>, ) -> Option<SessionRecord>

Convert a transcript entry while attaching bounded artifact metadata.

Source

pub fn to_entry(&self) -> Option<Entry>

Reconstruct a transcript Entry from this record.

Returns None for records that don’t map to a transcript row (session_meta, context, session_renamed).

Trait Implementations§

Source§

impl Clone for SessionRecord

Source§

fn clone(&self) -> SessionRecord

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 SessionRecord

Source§

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

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

impl<'de> Deserialize<'de> for SessionRecord

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 SessionRecord

Source§

impl PartialEq for SessionRecord

Source§

fn eq(&self, other: &SessionRecord) -> 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 SessionRecord

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 SessionRecord

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more