File size: 890 Bytes
f778c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /** Availability check for exposing ACP runtime spawning to tools and clients. */
import type { OpenClawConfig } from "../../config/types.openclaw.js";
import { isAcpEnabledByPolicy } from "../policy.js";
import { getAcpRuntimeBackend } from "./registry.js";
/** Returns whether ACP runtime spawning is allowed and the selected backend is healthy enough. */
export function isAcpRuntimeSpawnAvailable(params: {
config?: OpenClawConfig;
sandboxed?: boolean;
backendId?: string;
}): boolean {
if (params.sandboxed === true) {
return false;
}
if (params.config && !isAcpEnabledByPolicy(params.config)) {
return false;
}
const backend = getAcpRuntimeBackend(params.backendId ?? params.config?.acp?.backend);
if (!backend) {
return false;
}
if (!backend.healthy) {
return true;
}
try {
return backend.healthy();
} catch {
return false;
}
}
|