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

Function handleRuntimeSessionEvent

desktop/runtime/runtime-registry.ts:188–213  ·  view source on GitHub ↗
(runtime: PiRuntime, event: RuntimeSessionEvent)

Source from the content-addressed store, hash-verified

186}
187
188function handleRuntimeSessionEvent(runtime: PiRuntime, event: RuntimeSessionEvent) {
189 const runtimeKey = getPersistedSessionPath(runtime.session.sessionFile)
190 if (runtimeKey) suspendRuntimeDisposal(runtimeKey)
191 if (event.type === 'message_start' || event.type === 'message_update')
192 return scheduleLiveThreadUpdate(runtime, publishLiveThreadUpdate)
193 if (event.type === 'message_end') return handleRuntimeMessageEnd(runtime, runtimeKey, event)
194 if (event.type === 'agent_end') return handleRuntimeAgentEnd(runtime, runtimeKey)
195 if (event.type === 'compaction_start') {
196 cancelLiveThreadUpdate(runtime)
197 void publishThreadUpdate(runtime, 'compaction-start')
198 void publishRuntimeComposerState(runtime)
199 return
200 }
201 if (event.type === 'compaction_end') return handleRuntimeCompactionEnd(runtime, runtimeKey)
202 if (
203 event.type === 'tool_execution_start' ||
204 event.type === 'tool_execution_update' ||
205 event.type === 'tool_execution_end'
206 )
207 return handleRuntimeToolEvent(runtime, event)
208 if (event.type === 'queue_update')
209 void publishRuntimeComposerState(runtime).finally(() => {
210 if (runtimeKey && !runtime.session.isStreaming)
211 scheduleRuntimeDisposal(runtimeKey, isHowcodeRuntimeBusy)
212 })
213}
214
215async function createRuntime(options: {
216 cwd: string

Callers 1

createRuntimeFunction · 0.70

Calls 11

getPersistedSessionPathFunction · 0.90
suspendRuntimeDisposalFunction · 0.90
scheduleLiveThreadUpdateFunction · 0.90
cancelLiveThreadUpdateFunction · 0.90
publishThreadUpdateFunction · 0.90
scheduleRuntimeDisposalFunction · 0.90
handleRuntimeAgentEndFunction · 0.85
handleRuntimeToolEventFunction · 0.85
handleRuntimeMessageEndFunction · 0.70

Tested by

no test coverage detected