UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

31 lines (30 loc) • 1.14 kB
import { a as asOptionalRecord } from "./record-coerce-CVPuDqcc.mjs"; import { m as normalizeTrimmedStringList } from "./string-normalization-DLmfYZXI.mjs"; //#region packages/model-catalog-core/src/model-catalog-reasoning.ts const OPENROUTER_REASONING_EFFORTS = [ "minimal", "low", "medium", "high", "xhigh", "max" ]; /** Preserve OpenRouter's declared effort choices and mandatory-thinking wire contract. */ function normalizeOpenRouterModelReasoning(e) { const t = asOptionalRecord(e); const n = t?.supported_efforts; if (!t || typeof t.mandatory !== "boolean" || n !== void 0 && n !== null && !Array.isArray(n)) return; const r = n === void 0 ? void 0 : n === null ? OPENROUTER_REASONING_EFFORTS : normalizeTrimmedStringList(n); const i = t.mandatory; const a = r?.length ? [...new Set(i ? r.filter((e) => e !== "none") : ["none", ...r])] : r; return { reasoning: true, compat: { supportsReasoningEffort: (a?.length ?? 0) > 0, ...a !== void 0 ? { supportedReasoningEfforts: a } : {} }, ...i ? { thinkingLevelMap: { off: null } } : {} }; } //#endregion export { normalizeOpenRouterModelReasoning as t };