mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:47:41 +00:00
feat: add exec approvals tooling and service status
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import type { GatewayService } from "../daemon/service.js";
|
||||
import { resolveGatewayService } from "../daemon/service.js";
|
||||
import { resolveNodeService } from "../daemon/node-service.js";
|
||||
import { formatDaemonRuntimeShort } from "./status.format.js";
|
||||
|
||||
export async function getDaemonStatusSummary(): Promise<{
|
||||
type DaemonStatusSummary = {
|
||||
label: string;
|
||||
installed: boolean | null;
|
||||
loadedText: string;
|
||||
runtimeShort: string | null;
|
||||
}> {
|
||||
};
|
||||
|
||||
async function buildDaemonStatusSummary(
|
||||
service: GatewayService,
|
||||
fallbackLabel: string,
|
||||
): Promise<DaemonStatusSummary> {
|
||||
try {
|
||||
const service = resolveGatewayService();
|
||||
const [loaded, runtime, command] = await Promise.all([
|
||||
service.isLoaded({ env: process.env }).catch(() => false),
|
||||
service.readRuntime(process.env).catch(() => undefined),
|
||||
@@ -20,10 +26,18 @@ export async function getDaemonStatusSummary(): Promise<{
|
||||
return { label: service.label, installed, loadedText, runtimeShort };
|
||||
} catch {
|
||||
return {
|
||||
label: "Daemon",
|
||||
label: fallbackLabel,
|
||||
installed: null,
|
||||
loadedText: "unknown",
|
||||
runtimeShort: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDaemonStatusSummary(): Promise<DaemonStatusSummary> {
|
||||
return await buildDaemonStatusSummary(resolveGatewayService(), "Daemon");
|
||||
}
|
||||
|
||||
export async function getNodeDaemonStatusSummary(): Promise<DaemonStatusSummary> {
|
||||
return await buildDaemonStatusSummary(resolveNodeService(), "Node");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user