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

Function invokeRuntimeHost

desktop/runtime-host/client-bridge.ts:472–504  ·  view source on GitHub ↗
(
  name: TName,
  payload: RuntimeHostRequestMap[TName],
)

Source from the content-addressed store, hash-verified

470}
471
472export async function invokeRuntimeHost<TName extends RuntimeHostRequestName>(
473 name: TName,
474 payload: RuntimeHostRequestMap[TName],
475): Promise<RuntimeHostResponseMap[TName]> {
476 const host = getHostForRequest(name, payload)
477 const child = await ensureRuntimeHost(host)
478 const id = randomUUID()
479
480 return await new Promise<RuntimeHostResponseMap[TName]>((resolve, reject) => {
481 if (name === 'sendComposerPrompt') {
482 host.busy = true
483 clearHostIdleTimer(host)
484 }
485
486 host.pendingRequests.set(id, {
487 name,
488 resolve: (value) => resolve(value as RuntimeHostResponseMap[TName]),
489 reject,
490 })
491
492 child.send({ type: 'request', id, name, payload }, (error) => {
493 if (!error) {
494 return
495 }
496 host.pendingRequests.delete(id)
497 if (name === 'sendComposerPrompt') {
498 host.busy = false
499 }
500 scheduleThreadHostIdleStop(host)
501 reject(error)
502 })
503 })
504}
505
506export async function invalidateRuntimeHostSettings(
507 request: {

Callers 15

startNewThreadFunction · 0.90
selectProjectRuntimeFunction · 0.90
openThreadRuntimeFunction · 0.90
getComposerSlashCommandsFunction · 0.90
getComposerSkillsFunction · 0.90
getComposerStateFunction · 0.90
setComposerModelFunction · 0.90
setComposerThinkingLevelFunction · 0.90
sendComposerPromptFunction · 0.90
stopComposerRunFunction · 0.90
dequeueComposerPromptFunction · 0.90
answerNativeAskQuestionsFunction · 0.90

Calls 5

getHostForRequestFunction · 0.85
ensureRuntimeHostFunction · 0.85
clearHostIdleTimerFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected