MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / loadThreadSnapshot

Function loadThreadSnapshot

desktop/runtime-host/thread-snapshot-service.ts:5–27  ·  view source on GitHub ↗
(request: {
  sessionPath: string
  historyCompactions?: number | undefined
})

Source from the content-addressed store, hash-verified

3import { getPiModule } from '../pi-module.ts'
4
5export 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}

Callers 1

handleRequestFunction · 0.90

Calls 3

getPiModuleFunction · 0.90
buildThreadHistorySliceFunction · 0.90
buildThreadDataFunction · 0.90

Tested by

no test coverage detected