SessionStorage class

Manages session transcript persistence.

Handles JSONL-based session file writing with batched I/O, metadata caching, and session enumeration.

Constructors

SessionStorage({required String configHomeDir, required String cwd, required String sessionId})

Properties

configHomeDir String
Config home directory (e.g., ~/.neomage).
final
currentSessionAgentColor String?
getter/setter pair
currentSessionAgentName String?
getter/setter pair
currentSessionAgentSetting String?
getter/setter pair
currentSessionLastPrompt String?
getter/setter pair
currentSessionMode String?
getter/setter pair
getter/setter pair
currentSessionTag String?
getter/setter pair
currentSessionTitle String?
Cached session metadata.
getter/setter pair
currentSessionWorktree WorktreeSessionInfo?
getter/setter pair
cwd String
Current working directory for project resolution.
final
hashCode int
The hash code for this object.
no setterinherited
projectsDir String
Get the projects directory.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String
no setter
transcriptPath String
Get the transcript path for the current session.
no setter

Methods

adoptResumedSessionFile() → void
Adopt an existing session file for resume.
clearAgentTranscriptSubdir(String agentId) → void
Clear an agent's transcript subdirectory.
flush() Future<void>
Flush all pending writes to disk.
getAgentTranscriptPath(String agentId) String
Get the agent transcript path for a subagent.
getProjectDir(String projectDir) String
Get the project directory for a given working directory.
getTranscriptPathForSession(String sessionId) String
Get the transcript path for a specific session.
insertMessageChain(Transcript messages, {bool isSidechain = false, String? agentId, String? startingParentUuid}) Future<void>
Insert a chain of messages into the transcript.
listSessions({int limit = 50}) Future<List<SessionMetadata>>
List all sessions for the current project.
loadTranscriptFile(String filePath) Future<List<Map<String, dynamic>>>
Load a transcript from a JSONL file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readAgentMetadata(String agentId) Future<AgentMetadata?>
Read agent metadata from a sidecar file.
readLiteMetadata(String filePath) Future<SessionMetadata?>
Read lite metadata from the tail of a session file.
reAppendSessionMetadata({bool skipTitleRefresh = false}) → void
Re-append cached session metadata to the end of the transcript.
recordSidechainTranscript(Transcript messages, {String? agentId, String? startingParentUuid}) Future<void>
Record a sidechain transcript (e.g., subagent).
recordTranscript(Transcript messages, {String? startingParentUuidHint}) Future<String?>
Record a transcript (public API, deduplicates against already-recorded).
removeTranscriptMessage(String targetUuid) Future<void>
Remove a message from the transcript by UUID.
resetSessionFile() → void
Reset the session file pointer after session switch.
sessionIdExists(String sessionId) bool
Check if a session ID exists on disk.
setAgentTranscriptSubdir(String agentId, String subdir) → void
Set a subdirectory for an agent's transcripts.
switchSession(String newSessionId) → void
Set the session ID (e.g., on resume or fork).
toString() String
A string representation of this object.
inherited
writeAgentMetadata(String agentId, AgentMetadata metadata) Future<void>
Write agent metadata to a sidecar file.

Operators

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