openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
84 lines (83 loc) • 3.18 kB
JavaScript
import { s as normalizeOptionalLowercaseString } from "./string-coerce-mnp54Vah.js";
import { u as supportsClaudeAdaptiveThinking } from "./src-M7TBQdDX.js";
import "./string-coerce-runtime-CEGJWkQ_.js";
import "./provider-model-shared-D-lyTLvb.js";
//#region extensions/github-copilot/model-metadata.ts
const COPILOT_CHAT_COMPLETIONS_COMPAT = {
supportsStore: false,
supportsDeveloperRole: false,
supportsUsageInStreaming: false,
maxTokensField: "max_tokens"
};
const COPILOT_XHIGH_MODEL_IDS = new Set(["gpt-5.4", "gpt-5.3-codex"]);
const STATIC_MODEL_OVERRIDES = new Map([
["claude-opus-4.6-1m", {
name: "Claude Opus 4.6 (1M context)",
api: "anthropic-messages",
reasoning: true,
contextWindow: 1e6,
maxTokens: 64e3,
thinkingLevelMap: {
xhigh: null,
max: null
},
compat: { supportedReasoningEfforts: [
"low",
"medium",
"high"
] }
}],
["claude-opus-4.7-1m-internal", {
name: "Claude Opus 4.7 (1M context)",
api: "anthropic-messages",
reasoning: true,
contextWindow: 1e6,
maxTokens: 64e3,
thinkingLevelMap: {
xhigh: "xhigh",
max: null
},
compat: { supportedReasoningEfforts: [
"low",
"medium",
"high",
"xhigh"
] }
}],
["gpt-5.5", {
name: "GPT-5.5",
reasoning: true,
contextWindow: 4e5,
maxTokens: 128e3
}]
]);
function isCopilotGeminiModelId(modelId) {
return /(?:^|[-_.])gemini(?:$|[-_.])/.test(modelId);
}
function resolveCopilotTransportApi(modelId) {
const normalized = normalizeOptionalLowercaseString(modelId) ?? "";
if (normalized.includes("claude")) return "anthropic-messages";
if (isCopilotGeminiModelId(normalized)) return "openai-completions";
return "openai-responses";
}
function resolveCopilotModelCompat(modelId) {
return isCopilotGeminiModelId(normalizeOptionalLowercaseString(modelId) ?? "") ? { ...COPILOT_CHAT_COMPLETIONS_COMPAT } : void 0;
}
function compatSupportsEffort(compat, effort) {
return Array.isArray(compat?.supportedReasoningEfforts) && compat.supportedReasoningEfforts.some((candidate) => normalizeOptionalLowercaseString(candidate) === effort);
}
function resolveCopilotExtendedThinkingLevels(modelId, compat) {
const normalizedModelId = normalizeOptionalLowercaseString(modelId) ?? "";
const staticCompat = resolveStaticCopilotModelOverride(normalizedModelId)?.compat;
const isClaudeModel = normalizedModelId.includes("claude");
const supportsAdaptiveClaudeEffort = !isClaudeModel || supportsClaudeAdaptiveThinking({ id: normalizedModelId });
const levels = [];
if (supportsAdaptiveClaudeEffort && (COPILOT_XHIGH_MODEL_IDS.has(normalizedModelId) || compatSupportsEffort(compat, "xhigh") || compatSupportsEffort(staticCompat, "xhigh"))) levels.push("xhigh");
if (isClaudeModel && supportsAdaptiveClaudeEffort && (compatSupportsEffort(compat, "max") || compatSupportsEffort(staticCompat, "max"))) levels.push("max");
return levels;
}
function resolveStaticCopilotModelOverride(modelId) {
return STATIC_MODEL_OVERRIDES.get(normalizeOptionalLowercaseString(modelId) ?? "");
}
//#endregion
export { resolveStaticCopilotModelOverride as i, resolveCopilotModelCompat as n, resolveCopilotTransportApi as r, resolveCopilotExtendedThinkingLevels as t };