* Loads all messages, summaries, file history snapshots, and attribution snapshots from a specific session file.
(sessionId: UUID)
| 4018 | * Loads all messages, summaries, file history snapshots, and attribution snapshots from a specific session file. |
| 4019 | */ |
| 4020 | async function loadSessionFile(sessionId: UUID): Promise<{ |
| 4021 | messages: Map<UUID, TranscriptMessage> |
| 4022 | summaries: Map<UUID, string> |
| 4023 | customTitles: Map<UUID, string> |
| 4024 | tags: Map<UUID, string> |
| 4025 | agentSettings: Map<UUID, string> |
| 4026 | worktreeStates: Map<UUID, PersistedWorktreeSession | null> |
| 4027 | fileHistorySnapshots: Map<UUID, FileHistorySnapshotMessage> |
| 4028 | attributionSnapshots: Map<UUID, AttributionSnapshotMessage> |
| 4029 | contentReplacements: Map<UUID, ContentReplacementRecord[]> |
| 4030 | contextCollapseCommits: ContextCollapseCommitEntry[] |
| 4031 | contextCollapseSnapshot: ContextCollapseSnapshotEntry | undefined |
| 4032 | }> { |
| 4033 | const sessionFile = join( |
| 4034 | getSessionProjectDir() ?? getProjectDir(getOriginalCwd()), |
| 4035 | `${sessionId}.jsonl`, |
| 4036 | ) |
| 4037 | try { |
| 4038 | return await loadTranscriptFile(sessionFile) |
| 4039 | } catch (e) { |
| 4040 | if (e instanceof TranscriptParseError && e.code === 'ENOENT') { |
| 4041 | return { |
| 4042 | messages: new Map(), |
| 4043 | summaries: new Map(), |
| 4044 | customTitles: new Map(), |
| 4045 | tags: new Map(), |
| 4046 | agentSettings: new Map(), |
| 4047 | worktreeStates: new Map(), |
| 4048 | fileHistorySnapshots: new Map(), |
| 4049 | attributionSnapshots: new Map(), |
| 4050 | contentReplacements: new Map(), |
| 4051 | contextCollapseCommits: [], |
| 4052 | contextCollapseSnapshot: undefined, |
| 4053 | } |
| 4054 | } |
| 4055 | throw e |
| 4056 | } |
| 4057 | } |
| 4058 | |
| 4059 | /** |
| 4060 | * Gets message UUIDs for a specific session without loading all sessions. |
no test coverage detected