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

Function handleRuntimeMessageEnd

desktop/runtime/runtime-registry.ts:129–150  ·  view source on GitHub ↗
(
  runtime: PiRuntime,
  runtimeKey: string | null,
  event: Extract<RuntimeSessionEvent, { type: 'message_end' }>,
)

Source from the content-addressed store, hash-verified

127}
128
129function handleRuntimeMessageEnd(
130 runtime: PiRuntime,
131 runtimeKey: string | null,
132 event: Extract<RuntimeSessionEvent, { type: 'message_end' }>,
133) {
134 if (event.message.role === 'user') {
135 cancelLiveThreadUpdate(runtime)
136 void publishThreadUpdate(runtime, 'start')
137 } else {
138 if (event.message.role === 'toolResult') {
139 const toolCallId = 'toolCallId' in event.message ? event.message.toolCallId : undefined
140 clearRuntimeToolProgress(runtime, {
141 toolCallId: typeof toolCallId === 'string' ? toolCallId : undefined,
142 toolName: event.message.toolName,
143 })
144 }
145 deferLiveThreadUpdate(runtime, publishLiveThreadUpdate, {
146 requireStreaming: event.message.role === 'toolResult',
147 })
148 }
149 if (runtimeKey) scheduleRuntimeDisposal(runtimeKey, isHowcodeRuntimeBusy)
150}
151
152function handleRuntimeAgentEnd(runtime: PiRuntime, runtimeKey: string | null) {
153 cancelLiveThreadUpdate(runtime)

Callers 1

Calls 5

cancelLiveThreadUpdateFunction · 0.90
publishThreadUpdateFunction · 0.90
clearRuntimeToolProgressFunction · 0.90
deferLiveThreadUpdateFunction · 0.90
scheduleRuntimeDisposalFunction · 0.90

Tested by

no test coverage detected