openclaw / src /cron /execution-root-runtime.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
3144483 verified
Raw
History Blame Contribute Delete
847 Bytes
const CRON_EXECUTION_ROOT_RUNTIME_ERROR =
"collection review requires a runtime that enforces the Workshop root through OpenClaw tools";
export class CronExecutionRootRuntimeError extends Error {
constructor() {
super(CRON_EXECUTION_ROOT_RUNTIME_ERROR);
this.name = "CronExecutionRootRuntimeError";
}
}
/** Shared admission predicate for turns that must enforce a host-owned execution root. */
export function supportsCronExecutionRoot(runtime: string, rootedCliExecution: boolean): boolean {
return runtime === "openclaw" || rootedCliExecution;
}
export function assertCronExecutionRootRuntime(
executionRoot: string | undefined,
runtime: string,
rootedCliExecution: boolean,
): void {
if (executionRoot && !supportsCronExecutionRoot(runtime, rootedCliExecution)) {
throw new CronExecutionRootRuntimeError();
}
}