MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / resolveDaemonTarget

Function resolveDaemonTarget

apps/cli/src/main.ts:452–481  ·  view source on GitHub ↗
(baseUrl: string)

Source from the content-addressed store, hash-verified

450 });
451
452const resolveDaemonTarget = (baseUrl: string) =>
453 Effect.gen(function* () {
454 const parsed = yield* parseDaemonUrl(baseUrl);
455 const host = canonicalDaemonHost(parsed.hostname);
456 const scopeId = currentDaemonScopeId();
457 const pointer = yield* readDaemonPointer({ hostname: host, scopeId });
458
459 if (pointer) {
460 const pointerUrl = daemonBaseUrl(pointer.hostname, pointer.port);
461 if (isPidAlive(pointer.pid) && (yield* isServerReachable(pointerUrl))) {
462 return {
463 baseUrl: pointerUrl,
464 hostname: pointer.hostname,
465 port: pointer.port,
466 scopeId,
467 fromPointer: true,
468 };
469 }
470
471 yield* cleanupPointer({ hostname: pointer.hostname, scopeId, port: pointer.port });
472 }
473
474 return {
475 baseUrl: daemonBaseUrl(host, parsed.port),
476 hostname: host,
477 port: parsed.port,
478 scopeId,
479 fromPointer: false,
480 };
481 });
482
483const waitForDaemonStartupTarget = (input: {
484 readonly requestedBaseUrl: string;

Callers 4

ensureDaemonFunction · 0.85
stopDaemonFunction · 0.85
runBackgroundDaemonStartFunction · 0.85
main.tsFile · 0.85

Calls 8

canonicalDaemonHostFunction · 0.90
currentDaemonScopeIdFunction · 0.90
readDaemonPointerFunction · 0.90
isPidAliveFunction · 0.90
parseDaemonUrlFunction · 0.85
daemonBaseUrlFunction · 0.85
isServerReachableFunction · 0.85
cleanupPointerFunction · 0.85

Tested by

no test coverage detected