MCPcopy Index your code
hub / github.com/callstack/agent-device / readDaemonInfo

Function readDaemonInfo

src/daemon/client/daemon-client-metadata.ts:49–66  ·  view source on GitHub ↗
(infoPath: string)

Source from the content-addressed store, hash-verified

47const DAEMON_TAKEOVER_KILL_TIMEOUT_MS = 1000;
48
49export function readDaemonInfo(infoPath: string): DaemonInfo | null {
50 const data = readJsonFile(infoPath);
51 if (!data || typeof data !== 'object') return null;
52 const parsed = data as Partial<DaemonInfo>;
53 const token = readRequiredDaemonToken(parsed);
54 if (!token) return null;
55 const ports = readDaemonInfoPorts(parsed);
56 if (!ports) return null;
57 return {
58 token,
59 ...ports,
60 transport: readDaemonInfoTransport(parsed.transport),
61 pid: readPositiveInteger(parsed.pid) ?? 0,
62 version: readOptionalString(parsed.version),
63 codeSignature: readOptionalString(parsed.codeSignature),
64 processStartTime: readOptionalString(parsed.processStartTime),
65 };
66}
67
68function readRequiredDaemonToken(parsed: Partial<DaemonInfo>): string | null {
69 return typeof parsed.token === 'string' && parsed.token.length > 0 ? parsed.token : null;

Callers 3

readReusableLocalDaemonFunction · 0.90
waitForDaemonStartupFunction · 0.90

Calls 6

readJsonFileFunction · 0.85
readRequiredDaemonTokenFunction · 0.85
readDaemonInfoPortsFunction · 0.85
readDaemonInfoTransportFunction · 0.85
readPositiveIntegerFunction · 0.70
readOptionalStringFunction · 0.70

Tested by

no test coverage detected