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

Function buildLiveThreadData

desktop/runtime-host/live-thread-publisher.ts:26–46  ·  view source on GitHub ↗
(runtime: PiRuntime)

Source from the content-addressed store, hash-verified

24}
25
26function buildLiveThreadData(runtime: PiRuntime) {
27 const sessionPath = runtime.session.sessionFile
28 if (!sessionPath) return null
29 const streamingMessage = runtime.session.state.streamingMessage
30 const historySlice = buildThreadHistorySlice(
31 [...(runtime.session.sessionManager.getBranch() as SessionPathEntry[])],
32 0,
33 )
34 const sourceMessages = [
35 ...historySlice.sourceMessages,
36 ...(streamingMessage ? [streamingMessage] : []),
37 ...getLiveToolProgressMessages(runtime),
38 ] as AgentMessage[]
39 return buildThreadData({
40 sessionPath,
41 sourceMessages,
42 previousMessageCount: historySlice.previousMessageCount,
43 isStreaming: runtime.session.isStreaming,
44 isCompacting: runtime.session.isCompacting,
45 })
46}
47
48export async function publishThreadUpdate(runtime: PiRuntime, reason: RuntimeThreadReason) {
49 const sessionPath = runtime.session.sessionFile

Callers 1

publishThreadUpdateFunction · 0.70

Calls 3

buildThreadHistorySliceFunction · 0.90
buildThreadDataFunction · 0.90

Tested by

no test coverage detected