Download src/acp/runtime/availability.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 890 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/acp/runtime/availability.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/acp/runtime/availability.ts
-
curl -L -o availability.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/acp/runtime/availability.ts
890 Bytes
| /** 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; | |
| } | |
| } | |