Files
openclaw/src/agents/openclaw-tools.registration.ts
2026-04-11 13:26:50 +01:00

30 lines
985 B
TypeScript

import type { OpenClawConfig } from "../config/types.openclaw.js";
import { isStrictAgenticExecutionContractActive } from "./execution-contract.js";
import type { AnyAgentTool } from "./tools/common.js";
export function collectPresentOpenClawTools(
candidates: readonly (AnyAgentTool | null | undefined)[],
): AnyAgentTool[] {
return candidates.filter((tool): tool is AnyAgentTool => tool !== null && tool !== undefined);
}
export function isUpdatePlanToolEnabledForOpenClawTools(params: {
config?: OpenClawConfig;
agentSessionKey?: string;
agentId?: string | null;
modelProvider?: string;
modelId?: string;
}): boolean {
const configured = params.config?.tools?.experimental?.planTool;
if (configured !== undefined) {
return configured;
}
return isStrictAgenticExecutionContractActive({
config: params.config,
sessionKey: params.agentSessionKey,
agentId: params.agentId,
provider: params.modelProvider,
modelId: params.modelId,
});
}