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

Function publishThreadUpdate

desktop/runtime/thread-publisher.ts:313–342  ·  view source on GitHub ↗
(runtime: PiRuntime, reason: RuntimeThreadReason)

Source from the content-addressed store, hash-verified

311}
312
313export async function publishThreadUpdate(runtime: PiRuntime, reason: RuntimeThreadReason) {
314 const sessionPath = runtime.session.sessionFile
315 if (!sessionPath) return
316
317 markInternalThreadUpdate(sessionPath)
318
319 const liveThread = buildLiveThreadData(runtime)
320 if (!liveThread) return
321
322 const thread = normalizeThreadDataForReason(liveThread, reason)
323 const projectId = runtime.cwd
324 const timestamp = Date.now()
325
326 rememberLiveThread(sessionPath, thread)
327 rememberSessionPath(sessionPath, projectId)
328
329 const threadId = await applyPersistedThreadUpdate(runtime, sessionPath, thread, reason, timestamp)
330
331 emitDesktopEvent({
332 type: 'thread-update',
333 reason,
334 projectId,
335 threadId,
336 sessionPath,
337 chatGroupId: runtime.chatGroupId ?? null,
338 isChat: isChatSessionPath(sessionPath),
339 thread,
340 composer: await buildComposerState(runtime, { includeContextUsage: reason !== 'update' }),
341 })
342}
343
344export async function publishExternalThreadUpdate({
345 lastModifiedMs,

Callers 6

publishLiveThreadUpdateFunction · 0.90
handleRuntimeMessageEndFunction · 0.90
handleRuntimeAgentEndFunction · 0.90
promptComposerRuntimeFunction · 0.90

Calls 9

markInternalThreadUpdateFunction · 0.90
rememberLiveThreadFunction · 0.90
rememberSessionPathFunction · 0.90
emitDesktopEventFunction · 0.90
isChatSessionPathFunction · 0.90
buildComposerStateFunction · 0.90
buildLiveThreadDataFunction · 0.70

Tested by

no test coverage detected