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

Function updateInboxEndState

desktop/runtime/thread-publisher.ts:277–293  ·  view source on GitHub ↗
(
  sessionPath: string,
  thread: ThreadData,
  reason: RuntimeThreadReason,
  timestamp: number,
)

Source from the content-addressed store, hash-verified

275}
276
277function updateInboxEndState(
278 sessionPath: string,
279 thread: ThreadData,
280 reason: RuntimeThreadReason,
281 timestamp: number,
282) {
283 if (reason !== 'end') return
284 const latestAssistantMessage = getLatestInboxAssistantMessage(thread.messages)
285 if (!latestAssistantMessage) return
286 upsertInboxThreadMessage({
287 sessionPath,
288 userPrompt: getLatestUserPrompt(thread),
289 content: latestAssistantMessage.content,
290 preview: latestAssistantMessage.preview,
291 lastAssistantAtMs: timestamp,
292 })
293}
294
295async function applyPersistedThreadUpdate(
296 runtime: PiRuntime,

Callers 1

Calls 3

upsertInboxThreadMessageFunction · 0.90
getLatestUserPromptFunction · 0.70

Tested by

no test coverage detected