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

Function handleHostResponseMessage

desktop/runtime-host/client-bridge.ts:232–253  ·  view source on GitHub ↗
(
  host: HostConnection,
  message: Extract<RuntimeHostToMainMessage, { type: 'response' }>,
)

Source from the content-addressed store, hash-verified

230}
231
232function handleHostResponseMessage(
233 host: HostConnection,
234 message: Extract<RuntimeHostToMainMessage, { type: 'response' }>,
235) {
236 const pending = host.pendingRequests.get(message.id)
237 if (!pending) return
238 host.pendingRequests.delete(message.id)
239 if (
240 pending.name === 'sendComposerPrompt' &&
241 (!message.ok || getHostSendOutcome(message) !== 'sent')
242 ) {
243 host.busy = false
244 }
245 scheduleThreadHostIdleStop(host)
246 if (message.ok) {
247 pending.resolve(message.result)
248 return
249 }
250 const error = new Error(message.error)
251 if (message.stack) error.stack = message.stack
252 pending.reject(error)
253}
254
255function handleHostMessage(host: HostConnection, message: RuntimeHostToMainMessage) {
256 if (!message || typeof message !== 'object') return

Callers 1

handleHostMessageFunction · 0.85

Calls 3

getHostSendOutcomeFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected