mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 06:20:43 +00:00
30 lines
985 B
TypeScript
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,
|
|
});
|
|
}
|