openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
46 lines (45 loc) • 1.31 kB
JavaScript
import { o as writeRuntimeJson } from "./runtime-B-SLYP-m.mjs";
//#region src/cli/gateway-cli/health-route.ts
/** Run the successful JSON path without loading text presentation modules. */
async function runGatewayHealthJsonRoute(e, t) {
let n = e.rpc;
if (e.localPortOverride !== void 0) {
const { readNonObservingHealthConfig: t } = await import("./health-DfcXdtuz.mjs");
const r = await t();
n = {
...e.rpc,
localPortOverride: e.localPortOverride,
config: {
...r,
gateway: {
...r.gateway,
mode: "local",
port: e.localPortOverride
}
}
};
}
try {
const { callGatewayFromCliWithTransport: e } = await import("./gateway-rpc-DKaWuKlS.mjs");
writeRuntimeJson(t, await e("health", n, void 0, {
defaultTimeoutMs: 1e4,
sharedStateMode: "read-only"
}));
} catch (e) {
const { emitReachableGatewayAuthDiagnostic: r, emitGatewayHealthErrorJson: i, readNonObservingHealthConfig: a } = await import("./health-DfcXdtuz.mjs");
if (await r({
error: e,
config: n.config ?? await a(),
runtime: t,
timeoutMs: Number(n.timeout ?? "10000"),
token: n.token,
password: n.password,
localPortOverride: n.localPortOverride,
json: true
})) return;
if (i(e, t)) return;
throw e;
}
}
//#endregion
export { runGatewayHealthJsonRoute };