From f8a66ffde26f8d5c5a645e8119cc320dc440f82a Mon Sep 17 00:00:00 2001 From: Mariano Belinky Date: Fri, 27 Mar 2026 07:42:16 +0100 Subject: [PATCH] fix(daemon): lazy-load probe startup deps --- src/cli/daemon-cli/probe.ts | 4 ++-- src/gateway/probe.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/daemon-cli/probe.ts b/src/cli/daemon-cli/probe.ts index 57811ba9002..22ed7d32a99 100644 --- a/src/cli/daemon-cli/probe.ts +++ b/src/cli/daemon-cli/probe.ts @@ -1,5 +1,3 @@ -import { callGateway } from "../../gateway/call.js"; -import { probeGateway } from "../../gateway/probe.js"; import { withProgress } from "../progress.js"; export async function probeGatewayStatus(opts: { @@ -21,6 +19,7 @@ export async function probeGatewayStatus(opts: { }, async () => { if (opts.requireRpc) { + const { callGateway } = await import("../../gateway/call.js"); await callGateway({ url: opts.url, token: opts.token, @@ -32,6 +31,7 @@ export async function probeGatewayStatus(opts: { }); return { ok: true } as const; } + const { probeGateway } = await import("../../gateway/probe.js"); return await probeGateway({ url: opts.url, auth: { diff --git a/src/gateway/probe.ts b/src/gateway/probe.ts index 1840d330039..5ae951bf908 100644 --- a/src/gateway/probe.ts +++ b/src/gateway/probe.ts @@ -1,5 +1,4 @@ import { randomUUID } from "node:crypto"; -import { loadOrCreateDeviceIdentity } from "../infra/device-identity.js"; import { formatErrorMessage } from "../infra/errors.js"; import type { SystemPresence } from "../infra/system-presence.js"; import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js"; @@ -53,7 +52,7 @@ export async function probeGateway(opts: { const detailLevel = opts.includeDetails === false ? "none" : (opts.detailLevel ?? "full"); - const deviceIdentity = (() => { + const deviceIdentity = await (async () => { let hostname: string; try { hostname = new URL(opts.url).hostname; @@ -66,6 +65,7 @@ export async function probeGateway(opts: { return null; } try { + const { loadOrCreateDeviceIdentity } = await import("../infra/device-identity.js"); return loadOrCreateDeviceIdentity(); } catch { // Read-only or restricted environments should still be able to run