(runtime: PiRuntime, reason: RuntimeThreadReason)
| 46 | } |
| 47 | |
| 48 | export async function publishThreadUpdate(runtime: PiRuntime, reason: RuntimeThreadReason) { |
| 49 | const sessionPath = runtime.session.sessionFile |
| 50 | if (!sessionPath) return |
| 51 | const liveThread = buildLiveThreadData(runtime) |
| 52 | if (!liveThread) return |
| 53 | emitDesktopEvent({ type: 'internal-thread-update', sessionPath }) |
| 54 | emitDesktopEvent({ |
| 55 | type: 'thread-update', |
| 56 | reason, |
| 57 | projectId: runtime.cwd, |
| 58 | threadId: runtime.session.sessionId, |
| 59 | sessionPath, |
| 60 | chatGroupId: runtime.chatGroupId ?? null, |
| 61 | isChat: isChatSessionPath(sessionPath), |
| 62 | thread: normalizeThreadDataForReason(liveThread, reason), |
| 63 | composer: await buildComposerState(runtime, { includeContextUsage: reason !== 'update' }), |
| 64 | }) |
| 65 | } |
| 66 | |
| 67 | export function publishComposerUpdate( |
| 68 | composer: Awaited<ReturnType<typeof buildComposerState>>, |
no test coverage detected