mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-09 06:02:55 +00:00
26 lines
942 B
TypeScript
26 lines
942 B
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
|
import { resolveAgentExecutionContract, resolveSessionAgentIds } from "./agent-scope.js";
|
|
|
|
export function isStrictAgenticExecutionContractActive(params: {
|
|
config?: OpenClawConfig;
|
|
sessionKey?: string;
|
|
agentId?: string | null;
|
|
provider?: string | null;
|
|
modelId?: string | null;
|
|
}): boolean {
|
|
const { sessionAgentId } = resolveSessionAgentIds({
|
|
sessionKey: params.sessionKey,
|
|
config: params.config,
|
|
agentId: params.agentId ?? undefined,
|
|
});
|
|
if (resolveAgentExecutionContract(params.config, sessionAgentId) !== "strict-agentic") {
|
|
return false;
|
|
}
|
|
const provider = normalizeLowercaseStringOrEmpty(params.provider ?? "");
|
|
if (provider !== "openai" && provider !== "openai-codex") {
|
|
return false;
|
|
}
|
|
return /^gpt-5(?:[.-]|$)/i.test(params.modelId?.trim() ?? "");
|
|
}
|