openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
35 lines (34 loc) • 1.37 kB
JavaScript
import { _ as resolveOpenAIReasoningEffortMap, g as resolveOpenAIReasoningEffortMapping, h as resolveOpenAIModelReasoningEfforts } from "./llm-Bp_VCUmP.mjs";
import { d as selectSupportedReasoningEffort } from "./agent-harness-attempt-runtime-DFFgKWgF.mjs";
//#region extensions/agentsapi/agentsapi-reasoning.ts
function resolveAgentsApiReasoningEffort(e) {
if (e.thinkLevel === "ultra") throw new Error("Agents API MVP does not support the ultra delegation mode");
if (e.thinkLevel === "adaptive") return;
const t = resolveOpenAIModelReasoningEfforts(e.model);
const n = e.model.thinkingLevelMap?.[e.thinkLevel];
if (!e.model.reasoning || t?.length === 0 || n === null) return;
const r = (resolveOpenAIReasoningEffortMapping(e.thinkLevel, resolveOpenAIReasoningEffortMap(e.model)) ?? n)?.trim() ?? (e.thinkLevel === "off" ? "none" : e.thinkLevel);
switch (r) {
case "none": return t?.includes("none") ? r : void 0;
case "minimal":
case "low":
case "medium":
case "high":
case "xhigh":
case "max": return t === void 0 ? r : selectSupportedReasoningEffort({
requested: r,
supportedEfforts: t,
effortOrder: [
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
]
});
default: throw new Error(`Agents API does not support reasoning effort ${r}`);
}
}
//#endregion
export { resolveAgentsApiReasoningEffort as t };