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

Function applyPersistedThreadUpdate

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

Source from the content-addressed store, hash-verified

293}
294
295async function applyPersistedThreadUpdate(
296 runtime: PiRuntime,
297 sessionPath: string,
298 thread: ThreadData,
299 reason: RuntimeThreadReason,
300 timestamp: number,
301) {
302 if (!(await hasPersistedSessionFile(sessionPath))) {
303 return runtime.session.sessionId
304 }
305
306 const threadId = upsertPersistedThreadSummary({ runtime, sessionPath, thread, timestamp })
307 updateThreadRunningState(sessionPath, thread, reason)
308 updateInboxStartState(sessionPath, thread, reason)
309 updateInboxEndState(sessionPath, thread, reason, timestamp)
310 return threadId
311}
312
313export async function publishThreadUpdate(runtime: PiRuntime, reason: RuntimeThreadReason) {
314 const sessionPath = runtime.session.sessionFile

Callers 1

publishThreadUpdateFunction · 0.85

Calls 5

hasPersistedSessionFileFunction · 0.85
updateThreadRunningStateFunction · 0.85
updateInboxStartStateFunction · 0.85
updateInboxEndStateFunction · 0.85

Tested by

no test coverage detected