SessionHeader class final
The session header — always the first line of a JSONL session file.
Ported from pi's SessionHeader (version 3).
Constructors
-
SessionHeader({required String id, required DateTime timestamp, required String cwd, String? parentSessionPath, Map<
String, dynamic> ? metadata}) -
Creates a SessionHeader.
const
-
SessionHeader.fromJson(Map<
String, dynamic> json) -
Deserializes and validates a header JSON map.
factory
Properties
- cwd → String
-
Working directory the session belongs to.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique session id.
final
-
metadata
→ Map<
String, dynamic> ? -
Free-form application metadata.
final
- parentSessionPath → String?
-
Path of the session this one was forked from, if any.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp → DateTime
-
When the session was created.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Serializes to the header JSON line (without the trailing newline).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- rotatedVersion → const int
- Format marker written into every segment header once a session has been rotated (gh-1077): a rotated session is a new on-disk format for pre-rotation builds — they read only the primary and either crash on the severed parent chain or silently miss the archived records. The marker (identical record format, higher version) makes an older build fail at header parse with a clear "unsupported session version" instead. This build accepts both version and rotatedVersion.
- version → const int
- On-disk format version. Only version 3 is supported.