fix(daemon): lazy-load probe startup deps

This commit is contained in:
Mariano Belinky
2026-03-27 07:42:16 +01:00
parent 735e9ab7f1
commit f8a66ffde2
2 changed files with 4 additions and 4 deletions

View File

@@ -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: {

View File

@@ -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