SessionStore
Category: Storage
Source: session_store.dart
Enums
SessionTitleSource
Metadata for a saved session, including model ref and timing.
| Value | Description |
|---|---|
auto | |
user |
SessionTitleState
| Value | Description |
|---|---|
provisional | |
stable |
Classes
SessionMeta
Constructor
dart
SessionMeta({
this.schemaVersion = currentSchemaVersion,
required this.id,
required this.cwd,
this.projectPath,
required this.modelRef,
required this.startTime,
this.endTime,
this.forkedFrom,
this.worktreePath,
this.branch,
this.baseBranch,
this.repoRemote,
this.headSha,
this.title,
this.titleSource,
this.titleState,
this.titleGenerationCount = 0,
this.titleGeneratedAt,
this.titleLastEvaluatedAt,
this.titleRenamedAt,
this.tags = const [],
this.prUrl,
this.prStatus,
this.tokenCount,
this.cacheReadTokens,
this.cacheCreationTokens,
this.messageCount,
this.summary,
this.runtimeId,
this.sandboxId,
this.runtimeBootstrapSha,
this.runtimeRemoteUrl,
this.runtimePatchPath,
this.runtimeClosedAt,
})dart
factory SessionMeta.fromJson(Map<String, dynamic> json)Properties
| Property | Type | Description |
|---|---|---|
currentSchemaVersion | const int | |
schemaVersion | int | |
id | SessionId | |
cwd | String | |
projectPath | String? | |
modelRef | String | Fully-qualified model reference: <provider>/<model>. Schema v3+ writes this as model_ref. Schema ≤ 2 is read-compatible: if the stored value has no slash, the legacy provider field is prepended on read (see [fromJson]). |
startTime | DateTime | |
endTime | DateTime? | |
forkedFrom | String? | |
worktreePath | String? | |
branch | String? | |
baseBranch | String? | |
repoRemote | String? | |
headSha | String? | |
title | String? | |
titleSource | SessionTitleSource? | |
titleState | SessionTitleState? | |
titleGenerationCount | int | |
titleGeneratedAt | DateTime? | |
titleLastEvaluatedAt | DateTime? | |
titleRenamedAt | DateTime? | |
tags | List<String> | |
prUrl | String? | |
prStatus | String? | |
tokenCount | int? | |
cacheReadTokens | int? | |
cacheCreationTokens | int? | |
messageCount | int? | |
summary | String? | |
runtimeId | String? | |
sandboxId | String? | |
runtimeBootstrapSha | String? | |
runtimeRemoteUrl | String? | |
runtimePatchPath | String? | |
runtimeClosedAt | DateTime? | |
sessionDir | String | |
meta | SessionMeta |
Methods
`void setTitle(
String title, {
SessionTitleSource? source,
SessionTitleState? state,
int? generationCount,
DateTime? generatedAt,
DateTime? lastEvaluatedAt,
DateTime? renamedAt,
})`
void updateMeta()
Writes the current metadata to disk.
void logEvent(String type, Map<String, dynamic> data)
Appends a timestamped event record to the conversation log.
Future<void> close()
Closes this session, recording the end time.
static List<SessionMeta> listSessions(String sessionsDir)
Lists all saved sessions in [sessionsDir], sorted newest first.
SessionStore
Persistent storage for a single session's metadata and conversation log.
Constructor
dart
SessionStore({required this.sessionDir, required this.meta})Properties
| Property | Type | Description |
|---|---|---|
sessionDir | String | |
meta | SessionMeta |
Methods
`void setTitle(
String title, {
SessionTitleSource? source,
SessionTitleState? state,
int? generationCount,
DateTime? generatedAt,
DateTime? lastEvaluatedAt,
DateTime? renamedAt,
})`
void updateMeta()
Writes the current metadata to disk.
void logEvent(String type, Map<String, dynamic> data)
Appends a timestamped event record to the conversation log.
Future<void> close()
Closes this session, recording the end time.
static List<SessionMeta> listSessions(String sessionsDir)
Lists all saved sessions in [sessionsDir], sorted newest first.