JsonlSessionStorage class final

Append-only JSONL session storage on top of a FileSystem.

Ported from pi's JsonlSessionStorage.

Implemented types

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

appendEntry(SessionRecord record) Future<void>
Appends record to the file and the in-memory index.
override
createEntryId() Future<String>
Generates a record id that is unique within this storage.
override
findEntries(String type) Future<List<SessionRecord>>
Returns all records of the given type, in file order.
override
getEntries() Future<List<SessionRecord>>
Returns all records in file order.
override
getEntry(String id) Future<SessionRecord?>
Looks up a record by id.
override
getLabel(String id) Future<String?>
Returns the current label attached to the record id, if any.
override
getLeafId() Future<String?>
Returns the id of the active leaf record, or null at the tree root.
override
getMetadata() Future<SessionMetadata>
Returns the session metadata (from the file header).
override
getPathToRoot(String? leafId) Future<List<SessionRecord>>
Walks from leafId to the tree root, returning records root-first.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setLeafId(String? leafId) Future<void>
Persists a leaf record that moves the active leaf to leafId.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create(FileSystem fs, String filePath, {required String cwd, required String sessionId, String? parentSessionPath, Map<String, dynamic>? metadata}) Future<JsonlSessionStorage>
Creates a new session file with just the header line.
open(FileSystem fs, String filePath) Future<JsonlSessionStorage>
Opens an existing session file, parsing and validating every line.