pub enum HistoryEntry {
User {
uuid: Option<String>,
timestamp: Option<String>,
cwd: Option<String>,
git_branch: Option<String>,
message: Value,
rest: Map<String, Value>,
},
Assistant {
uuid: Option<String>,
timestamp: Option<String>,
message: Value,
rest: Map<String, Value>,
},
Other {
type_tag: String,
raw: Value,
},
}Expand description
One parsed line from a session .jsonl.
Only user and assistant entry types get typed variants;
everything else (queue-operation, attachment, ai-title,
last-prompt, future types) lands in Self::Other with the
raw JSON for caller inspection.
Variants§
User
A user entry: a prompt turn written by the user.
Fields
rest: Map<String, Value>Every remaining field of the record, keyed as Claude Code
wrote it (camelCase, e.g. promptSource). See
HistoryEntry::field and the typed accessors for common
lookups.
Assistant
An assistant entry: a model response turn.
Fields
rest: Map<String, Value>Every remaining field of the record, keyed as Claude Code
wrote it (camelCase, e.g. requestId). See
HistoryEntry::field and the typed accessors for common
lookups.
Other
Any other entry type, carried as raw JSON for caller inspection.
Implementations§
Source§impl HistoryEntry
impl HistoryEntry
Sourcepub fn field(&self, key: &str) -> Option<&Value>
pub fn field(&self, key: &str) -> Option<&Value>
Raw access to a field by its name as Claude Code wrote it
(camelCase, e.g. "permissionMode").
For Self::User and Self::Assistant this resolves
against rest, so the fields promoted to struct fields
(uuid, timestamp, cwd, gitBranch, message) are not
reachable here. For Self::Other it resolves against the
full raw entry.
These records are Claude Code’s data, not this crate’s: a CLI
update can add, drop, or retype any field, which is why this
returns raw JSON and the typed accessors below are all
Option-shaped.
Sourcepub fn prompt_source(&self) -> Option<&str>
pub fn prompt_source(&self) -> Option<&str>
How the prompt reached the session (typed, queued, sdk,
system, suggestion_accepted), when recorded. Only user
entries carrying an actual prompt have this; tool-result user
turns generally do not.
Sourcepub fn entrypoint(&self) -> Option<&str>
pub fn entrypoint(&self) -> Option<&str>
The surface the session was driven from (cli,
claude-desktop, sdk-cli), when recorded.
Sourcepub fn is_meta(&self) -> Option<bool>
pub fn is_meta(&self) -> Option<bool>
Whether the entry is harness-injected context rather than a
real turn. None when the field is absent.
Sourcepub fn is_sidechain(&self) -> Option<bool>
pub fn is_sidechain(&self) -> Option<bool>
Whether the entry belongs to a subagent sidechain. None
when the field is absent.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
The session id recorded on the entry, when present.
Sourcepub fn parent_uuid(&self) -> Option<&str>
pub fn parent_uuid(&self) -> Option<&str>
The uuid of the parent entry, when present. Root entries carry
parentUuid: null, which also reads as None here.
Trait Implementations§
Source§impl Clone for HistoryEntry
impl Clone for HistoryEntry
Source§fn clone(&self) -> HistoryEntry
fn clone(&self) -> HistoryEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more