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

Function getHostForRequest

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

Source from the content-addressed store, hash-verified

451}
452
453function getHostForRequest<TName extends RuntimeHostRequestName>(
454 name: TName,
455 payload: RuntimeHostRequestMap[TName],
456) {
457 const sessionPath = getPersistedSessionPath(getRequestSessionPath(name, payload))
458 if (!shouldUseThreadHost(name, payload)) {
459 return serviceHost
460 }
461
462 const existingHost = sessionPath ? hostByAlias.get(sessionPath) : null
463 if (existingHost) {
464 return existingHost
465 }
466
467 const host = createHostConnection('thread', sessionPath ?? `thread-${hosts.size}`)
468 rememberHostAlias(host, sessionPath)
469 return host
470}
471
472export async function invokeRuntimeHost<TName extends RuntimeHostRequestName>(
473 name: TName,

Callers 1

invokeRuntimeHostFunction · 0.85

Calls 6

getPersistedSessionPathFunction · 0.90
getRequestSessionPathFunction · 0.85
shouldUseThreadHostFunction · 0.85
createHostConnectionFunction · 0.85
rememberHostAliasFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected