mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 08:22:52 +00:00
* refactor: move terminal core into package * refactor: move terminal module files * fix: clean terminal package CI followups * test: update lint suppression allowlist * fix: ship terminal core runtime aliases
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { colorize, isRich, theme } from "../../../packages/terminal-core/src/theme.js";
|
|
import { defaultRuntime } from "../../runtime.js";
|
|
import { gatherDaemonStatus } from "./status.gather.js";
|
|
import { printDaemonStatus } from "./status.print.js";
|
|
import type { DaemonStatusOptions } from "./types.js";
|
|
|
|
export async function runDaemonStatus(opts: DaemonStatusOptions) {
|
|
try {
|
|
if (opts.requireRpc && !opts.probe) {
|
|
defaultRuntime.error(
|
|
"Gateway status failed: --require-rpc needs probing enabled. Remove --no-probe or drop --require-rpc.",
|
|
);
|
|
defaultRuntime.exit(1);
|
|
return;
|
|
}
|
|
const status = await gatherDaemonStatus({
|
|
rpc: opts.rpc,
|
|
probe: opts.probe,
|
|
requireRpc: opts.requireRpc,
|
|
deep: opts.deep === true,
|
|
});
|
|
printDaemonStatus(status, { json: opts.json });
|
|
if (opts.requireRpc && !status.rpc?.ok) {
|
|
defaultRuntime.exit(1);
|
|
}
|
|
} catch (err) {
|
|
const rich = isRich();
|
|
defaultRuntime.error(colorize(rich, theme.error, `Gateway status failed: ${String(err)}`));
|
|
defaultRuntime.exit(1);
|
|
}
|
|
}
|