(request: {
sessionPath: string
historyCompactions?: number | undefined
})
| 3 | import { getPiModule } from '../pi-module.ts' |
| 4 | |
| 5 | export async function loadThreadSnapshot(request: { |
| 6 | sessionPath: string |
| 7 | historyCompactions?: number | undefined |
| 8 | }) { |
| 9 | const { SessionManager } = await getPiModule() |
| 10 | const manager = SessionManager.open(request.sessionPath) |
| 11 | const historySlice = buildThreadHistorySlice( |
| 12 | [...(manager.getBranch() as SessionPathEntry[])], |
| 13 | request.historyCompactions ?? 0, |
| 14 | ) |
| 15 | |
| 16 | return { |
| 17 | projectId: manager.getCwd(), |
| 18 | threadId: manager.getSessionId(), |
| 19 | thread: buildThreadData({ |
| 20 | sessionPath: request.sessionPath, |
| 21 | sourceMessages: historySlice.sourceMessages, |
| 22 | previousMessageCount: historySlice.previousMessageCount, |
| 23 | isStreaming: false, |
| 24 | isCompacting: false, |
| 25 | }), |
| 26 | } |
| 27 | } |
no test coverage detected