mirror of https://github.com/openclaw/openclaw.git
fix(daemon): lazy-load probe startup deps
This commit is contained in:
parent
735e9ab7f1
commit
f8a66ffde2
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue