@dexto/core 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/DextoAgent.cjs +79 -5
- package/dist/agent/DextoAgent.d.ts +24 -2
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +79 -5
- package/dist/agent/agent-options.d.ts +6 -1
- package/dist/agent/agent-options.d.ts.map +1 -1
- package/dist/agent/schemas.d.ts +18 -18
- package/dist/approval/manager.cjs +87 -27
- package/dist/approval/manager.d.ts +10 -1
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +87 -27
- package/dist/approval/schemas.cjs +22 -8
- package/dist/approval/schemas.d.ts +276 -102
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +22 -8
- package/dist/context/manager.cjs +2 -2
- package/dist/context/manager.d.ts +2 -1
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +2 -2
- package/dist/context/types.d.ts +3 -2
- package/dist/context/types.d.ts.map +1 -1
- package/dist/events/index.d.ts +26 -13
- package/dist/events/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/types.d.ts +1 -22
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.cjs +223 -28
- package/dist/llm/executor/provider-options.d.ts +3 -37
- package/dist/llm/executor/provider-options.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.js +227 -27
- package/dist/llm/executor/stream-processor.cjs +57 -34
- package/dist/llm/executor/stream-processor.d.ts +12 -4
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +55 -32
- package/dist/llm/executor/turn-executor.cjs +66 -44
- package/dist/llm/executor/turn-executor.d.ts +3 -3
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +56 -34
- package/dist/llm/formatters/vercel.cjs +15 -3
- package/dist/llm/formatters/vercel.d.ts +1 -0
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +15 -3
- package/dist/llm/index.cjs +8 -0
- package/dist/llm/index.d.ts +2 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +7 -0
- package/dist/llm/providers/local/schemas.d.ts +2 -2
- package/dist/llm/providers/openrouter-model-registry.cjs +66 -11
- package/dist/llm/providers/openrouter-model-registry.d.ts +26 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts.map +1 -1
- package/dist/llm/providers/openrouter-model-registry.js +65 -11
- package/dist/llm/reasoning/anthropic-betas.cjs +31 -0
- package/dist/llm/reasoning/anthropic-betas.d.ts +3 -0
- package/dist/llm/reasoning/anthropic-betas.d.ts.map +1 -0
- package/dist/llm/reasoning/anthropic-betas.js +7 -0
- package/dist/llm/reasoning/anthropic-thinking.cjs +79 -0
- package/dist/llm/reasoning/anthropic-thinking.d.ts +15 -0
- package/dist/llm/reasoning/anthropic-thinking.d.ts.map +1 -0
- package/dist/llm/reasoning/anthropic-thinking.js +52 -0
- package/dist/llm/reasoning/openai-reasoning-effort.cjs +86 -0
- package/dist/llm/reasoning/openai-reasoning-effort.d.ts +5 -0
- package/dist/llm/reasoning/openai-reasoning-effort.d.ts.map +1 -0
- package/dist/llm/reasoning/openai-reasoning-effort.js +61 -0
- package/dist/llm/reasoning/profile.cjs +113 -0
- package/dist/llm/reasoning/profile.d.ts +13 -0
- package/dist/llm/reasoning/profile.d.ts.map +1 -0
- package/dist/llm/reasoning/profile.js +92 -0
- package/dist/llm/reasoning/profiles/anthropic.cjs +61 -0
- package/dist/llm/reasoning/profiles/anthropic.d.ts +8 -0
- package/dist/llm/reasoning/profiles/anthropic.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/anthropic.js +45 -0
- package/dist/llm/reasoning/profiles/bedrock.cjs +54 -0
- package/dist/llm/reasoning/profiles/bedrock.d.ts +3 -0
- package/dist/llm/reasoning/profiles/bedrock.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/bedrock.js +36 -0
- package/dist/llm/reasoning/profiles/google.cjs +45 -0
- package/dist/llm/reasoning/profiles/google.d.ts +9 -0
- package/dist/llm/reasoning/profiles/google.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/google.js +21 -0
- package/dist/llm/reasoning/profiles/openai-compatible.cjs +39 -0
- package/dist/llm/reasoning/profiles/openai-compatible.d.ts +3 -0
- package/dist/llm/reasoning/profiles/openai-compatible.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openai-compatible.js +16 -0
- package/dist/llm/reasoning/profiles/openai.cjs +41 -0
- package/dist/llm/reasoning/profiles/openai.d.ts +3 -0
- package/dist/llm/reasoning/profiles/openai.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openai.js +18 -0
- package/dist/llm/reasoning/profiles/openrouter.cjs +83 -0
- package/dist/llm/reasoning/profiles/openrouter.d.ts +10 -0
- package/dist/llm/reasoning/profiles/openrouter.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openrouter.js +59 -0
- package/dist/llm/reasoning/profiles/shared.cjs +80 -0
- package/dist/llm/reasoning/profiles/shared.d.ts +25 -0
- package/dist/llm/reasoning/profiles/shared.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/shared.js +53 -0
- package/dist/llm/reasoning/profiles/vertex.cjs +46 -0
- package/dist/llm/reasoning/profiles/vertex.d.ts +3 -0
- package/dist/llm/reasoning/profiles/vertex.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/vertex.js +23 -0
- package/dist/llm/registry/auto-update.cjs +18 -0
- package/dist/llm/registry/auto-update.d.ts.map +1 -1
- package/dist/llm/registry/auto-update.js +18 -0
- package/dist/llm/registry/index.cjs +126 -26
- package/dist/llm/registry/index.d.ts +48 -4
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/registry/index.js +136 -28
- package/dist/llm/registry/models.generated.cjs +5198 -59
- package/dist/llm/registry/models.generated.d.ts +1893 -76
- package/dist/llm/registry/models.generated.d.ts.map +1 -1
- package/dist/llm/registry/models.generated.js +5196 -58
- package/dist/llm/registry/sync.cjs +72 -1
- package/dist/llm/registry/sync.d.ts +21 -1
- package/dist/llm/registry/sync.d.ts.map +1 -1
- package/dist/llm/registry/sync.js +72 -1
- package/dist/llm/resolver.cjs +13 -1
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +13 -1
- package/dist/llm/schemas.cjs +75 -14
- package/dist/llm/schemas.d.ts +84 -27
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +75 -14
- package/dist/llm/services/factory.cjs +55 -8
- package/dist/llm/services/factory.d.ts +1 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +58 -8
- package/dist/llm/services/vercel.cjs +2 -2
- package/dist/llm/services/vercel.js +2 -2
- package/dist/llm/types.d.ts +9 -0
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/logger/default-logger-factory.d.ts +12 -12
- package/dist/logger/v2/dexto-logger.cjs +35 -0
- package/dist/logger/v2/dexto-logger.d.ts +19 -0
- package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
- package/dist/logger/v2/dexto-logger.js +35 -0
- package/dist/logger/v2/schemas.d.ts +6 -6
- package/dist/logger/v2/test-utils.cjs +2 -0
- package/dist/logger/v2/test-utils.d.ts.map +1 -1
- package/dist/logger/v2/test-utils.js +2 -0
- package/dist/logger/v2/types.d.ts +14 -1
- package/dist/logger/v2/types.d.ts.map +1 -1
- package/dist/mcp/schemas.d.ts +15 -15
- package/dist/memory/schemas.d.ts +4 -4
- package/dist/prompts/index.cjs +9 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +10 -0
- package/dist/prompts/prompt-manager.cjs +2 -0
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.js +2 -0
- package/dist/prompts/providers/config-prompt-provider.cjs +11 -1
- package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.js +11 -1
- package/dist/prompts/schemas.cjs +2 -2
- package/dist/prompts/schemas.d.ts +7 -7
- package/dist/prompts/schemas.js +2 -2
- package/dist/prompts/types.d.ts +6 -2
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/systemPrompt/in-built-prompts.cjs +5 -5
- package/dist/systemPrompt/in-built-prompts.d.ts +1 -1
- package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -1
- package/dist/systemPrompt/in-built-prompts.js +5 -5
- package/dist/systemPrompt/schemas.d.ts +5 -5
- package/dist/systemPrompt/types.d.ts +11 -0
- package/dist/systemPrompt/types.d.ts.map +1 -1
- package/dist/tools/display-types.d.ts +10 -0
- package/dist/tools/display-types.d.ts.map +1 -1
- package/dist/tools/index.cjs +3 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/presentation.cjs +49 -0
- package/dist/tools/presentation.d.ts +11 -0
- package/dist/tools/presentation.d.ts.map +1 -0
- package/dist/tools/presentation.js +24 -0
- package/dist/tools/tool-manager.cjs +389 -136
- package/dist/tools/tool-manager.d.ts +36 -24
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +389 -136
- package/dist/tools/types.d.ts +134 -55
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/path.cjs +10 -1
- package/dist/utils/path.d.ts +5 -2
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +10 -1
- package/dist/utils/service-initializer.d.ts +1 -0
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
const OPENROUTER_REASONING_EXCLUDED_FAMILIES = [
|
|
3
|
+
"deepseek",
|
|
4
|
+
"minimax",
|
|
5
|
+
"glm",
|
|
6
|
+
"mistral",
|
|
7
|
+
"kimi",
|
|
8
|
+
// Temporary workaround for OpenRouter models that intermittently error with reasoning params.
|
|
9
|
+
// Keep this explicit so it's easy to remove once upstream stabilizes.
|
|
10
|
+
"k2p5"
|
|
11
|
+
];
|
|
12
|
+
const OPENROUTER_REASONING_TARGET_RULES = {
|
|
13
|
+
openai: {
|
|
14
|
+
upstreamProvider: "openai",
|
|
15
|
+
acceptsModelId: () => true
|
|
16
|
+
},
|
|
17
|
+
anthropic: {
|
|
18
|
+
upstreamProvider: "anthropic",
|
|
19
|
+
acceptsModelId: () => true
|
|
20
|
+
},
|
|
21
|
+
google: {
|
|
22
|
+
upstreamProvider: "google",
|
|
23
|
+
acceptsModelId: (modelId) => modelId.includes("gemini-3")
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function isOpenRouterGatewayProvider(provider) {
|
|
27
|
+
return provider === "openrouter" || provider === "dexto-nova";
|
|
28
|
+
}
|
|
29
|
+
function isOpenRouterReasoningAllowlistedFamily(modelLower) {
|
|
30
|
+
return modelLower.includes("gpt") || modelLower.includes("claude") || modelLower.includes("gemini-3");
|
|
31
|
+
}
|
|
32
|
+
function splitGatewayModelId(modelLower) {
|
|
33
|
+
const slashIndex = modelLower.indexOf("/");
|
|
34
|
+
if (slashIndex <= 0 || slashIndex >= modelLower.length - 1) return null;
|
|
35
|
+
const providerPrefix = modelLower.slice(0, slashIndex);
|
|
36
|
+
const modelId = modelLower.slice(slashIndex + 1);
|
|
37
|
+
return { providerPrefix, modelId };
|
|
38
|
+
}
|
|
39
|
+
function getOpenRouterReasoningTarget(model) {
|
|
40
|
+
const modelLower = model.toLowerCase();
|
|
41
|
+
for (const family of OPENROUTER_REASONING_EXCLUDED_FAMILIES) {
|
|
42
|
+
if (modelLower.includes(family)) return null;
|
|
43
|
+
}
|
|
44
|
+
if (!isOpenRouterReasoningAllowlistedFamily(modelLower)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const split = splitGatewayModelId(modelLower);
|
|
48
|
+
if (!split) return null;
|
|
49
|
+
const { providerPrefix, modelId } = split;
|
|
50
|
+
const rule = OPENROUTER_REASONING_TARGET_RULES[providerPrefix];
|
|
51
|
+
if (!rule || !rule.acceptsModelId(modelId, modelLower)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return { upstreamProvider: rule.upstreamProvider, modelId };
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
getOpenRouterReasoningTarget,
|
|
58
|
+
isOpenRouterGatewayProvider
|
|
59
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shared_exports = {};
|
|
20
|
+
__export(shared_exports, {
|
|
21
|
+
buildBudgetProfile: () => buildBudgetProfile,
|
|
22
|
+
buildThinkingLevelProfile: () => buildThinkingLevelProfile,
|
|
23
|
+
nonCapableProfile: () => nonCapableProfile,
|
|
24
|
+
option: () => option,
|
|
25
|
+
withDefault: () => withDefault
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(shared_exports);
|
|
28
|
+
function option(id, label) {
|
|
29
|
+
return { id, label: label ?? id };
|
|
30
|
+
}
|
|
31
|
+
function withDefault(profile, preferredDefault) {
|
|
32
|
+
const hasPreferred = profile.variants.some((variant) => variant.id === preferredDefault);
|
|
33
|
+
const defaultVariant = hasPreferred ? preferredDefault : profile.variants[0]?.id;
|
|
34
|
+
return {
|
|
35
|
+
...profile,
|
|
36
|
+
supportedVariants: profile.variants.map((variant) => variant.id),
|
|
37
|
+
...defaultVariant !== void 0 && { defaultVariant }
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function nonCapableProfile() {
|
|
41
|
+
return {
|
|
42
|
+
capable: false,
|
|
43
|
+
paradigm: "none",
|
|
44
|
+
variants: [],
|
|
45
|
+
supportedVariants: [],
|
|
46
|
+
supportsBudgetTokens: false
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function buildBudgetProfile(config) {
|
|
50
|
+
const variants = config.includeDisabled ? [option("disabled"), option("enabled")] : [option("enabled")];
|
|
51
|
+
return withDefault(
|
|
52
|
+
{
|
|
53
|
+
capable: true,
|
|
54
|
+
paradigm: "budget",
|
|
55
|
+
variants,
|
|
56
|
+
supportsBudgetTokens: config.supportsBudgetTokens
|
|
57
|
+
},
|
|
58
|
+
"enabled"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function buildThinkingLevelProfile(config) {
|
|
62
|
+
const variants = config.includeDisabled ? [option("disabled"), option("minimal"), option("low"), option("medium"), option("high")] : [option("minimal"), option("low"), option("medium"), option("high")];
|
|
63
|
+
return withDefault(
|
|
64
|
+
{
|
|
65
|
+
capable: true,
|
|
66
|
+
paradigm: "thinking-level",
|
|
67
|
+
variants,
|
|
68
|
+
supportsBudgetTokens: config.supportsBudgetTokens
|
|
69
|
+
},
|
|
70
|
+
"medium"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
buildBudgetProfile,
|
|
76
|
+
buildThinkingLevelProfile,
|
|
77
|
+
nonCapableProfile,
|
|
78
|
+
option,
|
|
79
|
+
withDefault
|
|
80
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ReasoningParadigm = 'effort' | 'adaptive-effort' | 'thinking-level' | 'budget' | 'none';
|
|
2
|
+
export type ReasoningVariantOption = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
export type ReasoningProfile = {
|
|
7
|
+
capable: boolean;
|
|
8
|
+
paradigm: ReasoningParadigm;
|
|
9
|
+
variants: ReasoningVariantOption[];
|
|
10
|
+
supportedVariants: string[];
|
|
11
|
+
defaultVariant?: string;
|
|
12
|
+
supportsBudgetTokens: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function option(id: string, label?: string): ReasoningVariantOption;
|
|
15
|
+
export declare function withDefault(profile: Omit<ReasoningProfile, 'defaultVariant' | 'supportedVariants'>, preferredDefault: string): ReasoningProfile;
|
|
16
|
+
export declare function nonCapableProfile(): ReasoningProfile;
|
|
17
|
+
export declare function buildBudgetProfile(config: {
|
|
18
|
+
includeDisabled: boolean;
|
|
19
|
+
supportsBudgetTokens: boolean;
|
|
20
|
+
}): ReasoningProfile;
|
|
21
|
+
export declare function buildThinkingLevelProfile(config: {
|
|
22
|
+
includeDisabled: boolean;
|
|
23
|
+
supportsBudgetTokens: boolean;
|
|
24
|
+
}): ReasoningProfile;
|
|
25
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/llm/reasoning/profiles/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpG,MAAM,MAAM,sBAAsB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,sBAAsB,CAEzE;AAED,wBAAgB,WAAW,CACvB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,EACvE,gBAAgB,EAAE,MAAM,GACzB,gBAAgB,CAQlB;AAED,wBAAgB,iBAAiB,IAAI,gBAAgB,CAQpD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;CACjC,GAAG,gBAAgB,CAcnB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAC9C,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;CACjC,GAAG,gBAAgB,CAcnB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
function option(id, label) {
|
|
3
|
+
return { id, label: label ?? id };
|
|
4
|
+
}
|
|
5
|
+
function withDefault(profile, preferredDefault) {
|
|
6
|
+
const hasPreferred = profile.variants.some((variant) => variant.id === preferredDefault);
|
|
7
|
+
const defaultVariant = hasPreferred ? preferredDefault : profile.variants[0]?.id;
|
|
8
|
+
return {
|
|
9
|
+
...profile,
|
|
10
|
+
supportedVariants: profile.variants.map((variant) => variant.id),
|
|
11
|
+
...defaultVariant !== void 0 && { defaultVariant }
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function nonCapableProfile() {
|
|
15
|
+
return {
|
|
16
|
+
capable: false,
|
|
17
|
+
paradigm: "none",
|
|
18
|
+
variants: [],
|
|
19
|
+
supportedVariants: [],
|
|
20
|
+
supportsBudgetTokens: false
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function buildBudgetProfile(config) {
|
|
24
|
+
const variants = config.includeDisabled ? [option("disabled"), option("enabled")] : [option("enabled")];
|
|
25
|
+
return withDefault(
|
|
26
|
+
{
|
|
27
|
+
capable: true,
|
|
28
|
+
paradigm: "budget",
|
|
29
|
+
variants,
|
|
30
|
+
supportsBudgetTokens: config.supportsBudgetTokens
|
|
31
|
+
},
|
|
32
|
+
"enabled"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function buildThinkingLevelProfile(config) {
|
|
36
|
+
const variants = config.includeDisabled ? [option("disabled"), option("minimal"), option("low"), option("medium"), option("high")] : [option("minimal"), option("low"), option("medium"), option("high")];
|
|
37
|
+
return withDefault(
|
|
38
|
+
{
|
|
39
|
+
capable: true,
|
|
40
|
+
paradigm: "thinking-level",
|
|
41
|
+
variants,
|
|
42
|
+
supportsBudgetTokens: config.supportsBudgetTokens
|
|
43
|
+
},
|
|
44
|
+
"medium"
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
buildBudgetProfile,
|
|
49
|
+
buildThinkingLevelProfile,
|
|
50
|
+
nonCapableProfile,
|
|
51
|
+
option,
|
|
52
|
+
withDefault
|
|
53
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var vertex_exports = {};
|
|
20
|
+
__export(vertex_exports, {
|
|
21
|
+
buildVertexReasoningProfile: () => buildVertexReasoningProfile
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(vertex_exports);
|
|
24
|
+
var import_anthropic = require("./anthropic.js");
|
|
25
|
+
var import_google = require("./google.js");
|
|
26
|
+
function buildVertexReasoningProfile(model) {
|
|
27
|
+
const modelLower = model.toLowerCase();
|
|
28
|
+
if (modelLower.includes("claude")) {
|
|
29
|
+
return (0, import_anthropic.buildAnthropicReasoningProfile)({
|
|
30
|
+
model,
|
|
31
|
+
includeDisabled: true,
|
|
32
|
+
supportsBudgetTokensForBudgetParadigm: true,
|
|
33
|
+
supportsBudgetTokensForAdaptiveParadigm: false
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return (0, import_google.buildGoogleReasoningProfile)({
|
|
37
|
+
model,
|
|
38
|
+
includeDisabled: true,
|
|
39
|
+
supportsBudgetTokensForBudgetParadigm: true,
|
|
40
|
+
supportsBudgetTokensForThinkingLevelParadigm: false
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
buildVertexReasoningProfile
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../../src/llm/reasoning/profiles/vertex.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAiB3E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
+
import { buildAnthropicReasoningProfile } from "./anthropic.js";
|
|
3
|
+
import { buildGoogleReasoningProfile } from "./google.js";
|
|
4
|
+
function buildVertexReasoningProfile(model) {
|
|
5
|
+
const modelLower = model.toLowerCase();
|
|
6
|
+
if (modelLower.includes("claude")) {
|
|
7
|
+
return buildAnthropicReasoningProfile({
|
|
8
|
+
model,
|
|
9
|
+
includeDisabled: true,
|
|
10
|
+
supportsBudgetTokensForBudgetParadigm: true,
|
|
11
|
+
supportsBudgetTokensForAdaptiveParadigm: false
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return buildGoogleReasoningProfile({
|
|
15
|
+
model,
|
|
16
|
+
includeDisabled: true,
|
|
17
|
+
supportsBudgetTokensForBudgetParadigm: true,
|
|
18
|
+
supportsBudgetTokensForThinkingLevelParadigm: false
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
buildVertexReasoningProfile
|
|
23
|
+
};
|
|
@@ -100,12 +100,30 @@ function applyModelsByProvider(modelsByProvider) {
|
|
|
100
100
|
const maxInputTokens = typeof updated.maxInputTokens === "number" && updated.maxInputTokens > 0 ? updated.maxInputTokens : m.maxInputTokens;
|
|
101
101
|
const supportedFileTypes = Array.isArray(updated.supportedFileTypes) ? updated.supportedFileTypes : m.supportedFileTypes;
|
|
102
102
|
const displayName = updated.displayName ?? m.displayName;
|
|
103
|
+
const reasoning = typeof updated.reasoning === "boolean" ? updated.reasoning : m.reasoning;
|
|
104
|
+
const supportsTemperature = typeof updated.supportsTemperature === "boolean" ? updated.supportsTemperature : m.supportsTemperature;
|
|
105
|
+
const supportsInterleaved = typeof updated.supportsInterleaved === "boolean" ? updated.supportsInterleaved : m.supportsInterleaved;
|
|
106
|
+
const supportsToolCall = typeof updated.supportsToolCall === "boolean" ? updated.supportsToolCall : m.supportsToolCall;
|
|
107
|
+
const releaseDate = updated.releaseDate ?? m.releaseDate;
|
|
108
|
+
const status = updated.status ?? m.status;
|
|
109
|
+
const modalities = updated.modalities ?? m.modalities;
|
|
110
|
+
const providerMetadata = updated.providerMetadata ?? m.providerMetadata;
|
|
111
|
+
const interleaved = updated.interleaved ?? m.interleaved;
|
|
103
112
|
const pricing = updated.pricing ?? m.pricing;
|
|
104
113
|
merged.push({
|
|
105
114
|
name,
|
|
106
115
|
maxInputTokens,
|
|
107
116
|
supportedFileTypes,
|
|
108
117
|
...displayName ? { displayName } : {},
|
|
118
|
+
...typeof reasoning === "boolean" ? { reasoning } : {},
|
|
119
|
+
...typeof supportsTemperature === "boolean" ? { supportsTemperature } : {},
|
|
120
|
+
...typeof supportsInterleaved === "boolean" ? { supportsInterleaved } : {},
|
|
121
|
+
...typeof supportsToolCall === "boolean" ? { supportsToolCall } : {},
|
|
122
|
+
...releaseDate ? { releaseDate } : {},
|
|
123
|
+
...status ? { status } : {},
|
|
124
|
+
...modalities ? { modalities } : {},
|
|
125
|
+
...providerMetadata ? { providerMetadata } : {},
|
|
126
|
+
...interleaved ? { interleaved } : {},
|
|
109
127
|
...pricing ? { pricing } : {}
|
|
110
128
|
});
|
|
111
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-update.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/auto-update.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAOvD,KAAK,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-update.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/auto-update.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAOvD,KAAK,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAmMjE,MAAM,MAAM,2BAA2B,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;CAC3C,CAAC;AAMF,wBAAgB,8BAA8B,IAAI,2BAA2B,CAU5E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAO5E;AAiBD,wBAAsB,uBAAuB,CAAC,OAAO,CAAC,EAAE;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDhB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,CAAC,EAAE;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,IAAI,CA6BP"}
|
|
@@ -65,12 +65,30 @@ function applyModelsByProvider(modelsByProvider) {
|
|
|
65
65
|
const maxInputTokens = typeof updated.maxInputTokens === "number" && updated.maxInputTokens > 0 ? updated.maxInputTokens : m.maxInputTokens;
|
|
66
66
|
const supportedFileTypes = Array.isArray(updated.supportedFileTypes) ? updated.supportedFileTypes : m.supportedFileTypes;
|
|
67
67
|
const displayName = updated.displayName ?? m.displayName;
|
|
68
|
+
const reasoning = typeof updated.reasoning === "boolean" ? updated.reasoning : m.reasoning;
|
|
69
|
+
const supportsTemperature = typeof updated.supportsTemperature === "boolean" ? updated.supportsTemperature : m.supportsTemperature;
|
|
70
|
+
const supportsInterleaved = typeof updated.supportsInterleaved === "boolean" ? updated.supportsInterleaved : m.supportsInterleaved;
|
|
71
|
+
const supportsToolCall = typeof updated.supportsToolCall === "boolean" ? updated.supportsToolCall : m.supportsToolCall;
|
|
72
|
+
const releaseDate = updated.releaseDate ?? m.releaseDate;
|
|
73
|
+
const status = updated.status ?? m.status;
|
|
74
|
+
const modalities = updated.modalities ?? m.modalities;
|
|
75
|
+
const providerMetadata = updated.providerMetadata ?? m.providerMetadata;
|
|
76
|
+
const interleaved = updated.interleaved ?? m.interleaved;
|
|
68
77
|
const pricing = updated.pricing ?? m.pricing;
|
|
69
78
|
merged.push({
|
|
70
79
|
name,
|
|
71
80
|
maxInputTokens,
|
|
72
81
|
supportedFileTypes,
|
|
73
82
|
...displayName ? { displayName } : {},
|
|
83
|
+
...typeof reasoning === "boolean" ? { reasoning } : {},
|
|
84
|
+
...typeof supportsTemperature === "boolean" ? { supportsTemperature } : {},
|
|
85
|
+
...typeof supportsInterleaved === "boolean" ? { supportsInterleaved } : {},
|
|
86
|
+
...typeof supportsToolCall === "boolean" ? { supportsToolCall } : {},
|
|
87
|
+
...releaseDate ? { releaseDate } : {},
|
|
88
|
+
...status ? { status } : {},
|
|
89
|
+
...modalities ? { modalities } : {},
|
|
90
|
+
...providerMetadata ? { providerMetadata } : {},
|
|
91
|
+
...interleaved ? { interleaved } : {},
|
|
74
92
|
...pricing ? { pricing } : {}
|
|
75
93
|
});
|
|
76
94
|
}
|
|
@@ -116,8 +116,9 @@ const LLM_REGISTRY = {
|
|
|
116
116
|
openai: {
|
|
117
117
|
models: mergeModels(import_models_generated.MODELS_BY_PROVIDER.openai, import_models_manual.MANUAL_MODELS_BY_PROVIDER.openai),
|
|
118
118
|
baseURLSupport: "none",
|
|
119
|
-
supportedFileTypes: []
|
|
119
|
+
supportedFileTypes: [],
|
|
120
120
|
// No defaults - models must explicitly specify support
|
|
121
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.openai
|
|
121
122
|
},
|
|
122
123
|
"openai-compatible": {
|
|
123
124
|
models: [],
|
|
@@ -130,52 +131,59 @@ const LLM_REGISTRY = {
|
|
|
130
131
|
anthropic: {
|
|
131
132
|
models: import_models_generated.MODELS_BY_PROVIDER.anthropic,
|
|
132
133
|
baseURLSupport: "none",
|
|
133
|
-
supportedFileTypes: []
|
|
134
|
+
supportedFileTypes: [],
|
|
134
135
|
// No defaults - models must explicitly specify support
|
|
136
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.anthropic
|
|
135
137
|
},
|
|
136
138
|
google: {
|
|
137
139
|
models: import_models_generated.MODELS_BY_PROVIDER.google,
|
|
138
140
|
baseURLSupport: "none",
|
|
139
|
-
supportedFileTypes: []
|
|
141
|
+
supportedFileTypes: [],
|
|
140
142
|
// No defaults - models must explicitly specify support
|
|
143
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.google
|
|
141
144
|
},
|
|
142
145
|
// https://console.groq.com/docs/models
|
|
143
146
|
groq: {
|
|
144
147
|
models: import_models_generated.MODELS_BY_PROVIDER.groq,
|
|
145
148
|
baseURLSupport: "none",
|
|
146
|
-
supportedFileTypes: []
|
|
149
|
+
supportedFileTypes: [],
|
|
147
150
|
// Groq currently doesn't support file uploads
|
|
151
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.groq
|
|
148
152
|
},
|
|
149
153
|
// https://docs.x.ai/docs/models
|
|
150
154
|
// Note: XAI API only supports image uploads (JPG/PNG up to 20MB), not PDFs
|
|
151
155
|
xai: {
|
|
152
156
|
models: import_models_generated.MODELS_BY_PROVIDER.xai,
|
|
153
157
|
baseURLSupport: "none",
|
|
154
|
-
supportedFileTypes: []
|
|
158
|
+
supportedFileTypes: [],
|
|
155
159
|
// No defaults - models must explicitly specify support
|
|
160
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.xai
|
|
156
161
|
},
|
|
157
162
|
// https://docs.cohere.com/reference/models
|
|
158
163
|
cohere: {
|
|
159
164
|
models: import_models_generated.MODELS_BY_PROVIDER.cohere,
|
|
160
165
|
baseURLSupport: "none",
|
|
161
|
-
supportedFileTypes: []
|
|
166
|
+
supportedFileTypes: [],
|
|
162
167
|
// No defaults - models must explicitly specify support
|
|
168
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.cohere
|
|
163
169
|
},
|
|
164
170
|
// https://platform.minimax.io/docs/api-reference/text-openai-api
|
|
165
171
|
// MiniMax provides an OpenAI-compatible endpoint at https://api.minimax.chat/v1
|
|
166
172
|
minimax: {
|
|
167
173
|
models: import_models_generated.MODELS_BY_PROVIDER.minimax,
|
|
168
174
|
baseURLSupport: "none",
|
|
169
|
-
supportedFileTypes: []
|
|
175
|
+
supportedFileTypes: [],
|
|
170
176
|
// No defaults - models must explicitly specify support
|
|
177
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.minimax
|
|
171
178
|
},
|
|
172
179
|
// https://open.bigmodel.cn/dev/api/normal-model/glm-4
|
|
173
180
|
// GLM (Zhipu AI) provides an OpenAI-compatible endpoint
|
|
174
181
|
glm: {
|
|
175
182
|
models: import_models_generated.MODELS_BY_PROVIDER.glm,
|
|
176
183
|
baseURLSupport: "none",
|
|
177
|
-
supportedFileTypes: []
|
|
184
|
+
supportedFileTypes: [],
|
|
178
185
|
// No defaults - models must explicitly specify support
|
|
186
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.glm
|
|
179
187
|
},
|
|
180
188
|
// https://openrouter.ai/docs
|
|
181
189
|
// OpenRouter is a unified API gateway providing access to 100+ models from various providers.
|
|
@@ -187,8 +195,9 @@ const LLM_REGISTRY = {
|
|
|
187
195
|
supportedFileTypes: ["pdf", "image", "audio"],
|
|
188
196
|
// Allow all types - user assumes responsibility
|
|
189
197
|
supportsCustomModels: true,
|
|
190
|
-
supportsAllRegistryModels: true
|
|
198
|
+
supportsAllRegistryModels: true,
|
|
191
199
|
// Can serve models from all other providers
|
|
200
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.openrouter
|
|
192
201
|
},
|
|
193
202
|
// https://docs.litellm.ai/
|
|
194
203
|
// LiteLLM is an OpenAI-compatible proxy that unifies 100+ LLM providers.
|
|
@@ -212,8 +221,9 @@ const LLM_REGISTRY = {
|
|
|
212
221
|
vertex: {
|
|
213
222
|
models: import_models_generated.MODELS_BY_PROVIDER.vertex,
|
|
214
223
|
baseURLSupport: "none",
|
|
215
|
-
supportedFileTypes: []
|
|
224
|
+
supportedFileTypes: [],
|
|
216
225
|
// No defaults - models must explicitly specify support
|
|
226
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.vertex
|
|
217
227
|
},
|
|
218
228
|
// https://docs.aws.amazon.com/bedrock/latest/userguide/models.html
|
|
219
229
|
bedrock: {
|
|
@@ -221,7 +231,8 @@ const LLM_REGISTRY = {
|
|
|
221
231
|
baseURLSupport: "none",
|
|
222
232
|
supportedFileTypes: [],
|
|
223
233
|
// No defaults - models must explicitly specify support
|
|
224
|
-
supportsCustomModels: true
|
|
234
|
+
supportsCustomModels: true,
|
|
235
|
+
modelsDev: import_models_generated.MODELS_DEV_PROVIDER_METADATA_BY_PROVIDER.bedrock
|
|
225
236
|
},
|
|
226
237
|
// Native local model execution via node-llama-cpp
|
|
227
238
|
local: {
|
|
@@ -249,7 +260,7 @@ const LLM_REGISTRY = {
|
|
|
249
260
|
// Claude models (Anthropic via OpenRouter)
|
|
250
261
|
{
|
|
251
262
|
name: "anthropic/claude-haiku-4.5",
|
|
252
|
-
displayName: "Claude 4.5
|
|
263
|
+
displayName: "Claude Haiku 4.5",
|
|
253
264
|
maxInputTokens: 2e5,
|
|
254
265
|
default: true,
|
|
255
266
|
supportedFileTypes: ["pdf", "image"],
|
|
@@ -264,7 +275,7 @@ const LLM_REGISTRY = {
|
|
|
264
275
|
},
|
|
265
276
|
{
|
|
266
277
|
name: "anthropic/claude-sonnet-4.5",
|
|
267
|
-
displayName: "Claude 4.5
|
|
278
|
+
displayName: "Claude Sonnet 4.5",
|
|
268
279
|
maxInputTokens: 2e5,
|
|
269
280
|
supportedFileTypes: ["pdf", "image"],
|
|
270
281
|
pricing: {
|
|
@@ -278,7 +289,7 @@ const LLM_REGISTRY = {
|
|
|
278
289
|
},
|
|
279
290
|
{
|
|
280
291
|
name: "anthropic/claude-opus-4.5",
|
|
281
|
-
displayName: "Claude 4.5
|
|
292
|
+
displayName: "Claude Opus 4.5",
|
|
282
293
|
maxInputTokens: 2e5,
|
|
283
294
|
supportedFileTypes: ["pdf", "image"],
|
|
284
295
|
pricing: {
|
|
@@ -512,20 +523,91 @@ function pickExistingOpenRouterModelId(candidates) {
|
|
|
512
523
|
return null;
|
|
513
524
|
}
|
|
514
525
|
function findModelInfo(provider, model) {
|
|
526
|
+
if (provider === "openrouter" && model.includes("/")) {
|
|
527
|
+
const dynamicOpenRouterModel = getOpenRouterGatewayModelById(model);
|
|
528
|
+
if (dynamicOpenRouterModel) return dynamicOpenRouterModel;
|
|
529
|
+
}
|
|
515
530
|
const providerInfo = LLM_REGISTRY[provider];
|
|
516
531
|
const normalizedModel = getNormalizedModelIdForLookup(provider, model);
|
|
517
532
|
const direct = providerInfo.models.find((m) => m.name.toLowerCase() === normalizedModel);
|
|
518
533
|
if (direct) return direct;
|
|
519
534
|
if (provider !== "openrouter" && hasAllRegistryModelsSupport(provider) && model.includes("/")) {
|
|
520
|
-
const openrouterModel =
|
|
521
|
-
(m) => m.name.toLowerCase() === model.toLowerCase()
|
|
522
|
-
);
|
|
535
|
+
const openrouterModel = getOpenRouterGatewayModelById(model);
|
|
523
536
|
if (openrouterModel) return openrouterModel;
|
|
524
537
|
}
|
|
525
538
|
return null;
|
|
526
539
|
}
|
|
540
|
+
function ensureOpenRouterCatalogRefreshScheduled() {
|
|
541
|
+
const cacheInfo = (0, import_openrouter_model_registry.getOpenRouterModelCacheInfo)();
|
|
542
|
+
if (cacheInfo.modelCount === 0) {
|
|
543
|
+
(0, import_openrouter_model_registry.scheduleOpenRouterModelRefresh)({ force: true });
|
|
544
|
+
} else if (!cacheInfo.isFresh) {
|
|
545
|
+
(0, import_openrouter_model_registry.scheduleOpenRouterModelRefresh)();
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function findOpenRouterSnapshotModelById(modelId) {
|
|
549
|
+
const normalized = modelId.toLowerCase();
|
|
550
|
+
return LLM_REGISTRY.openrouter.models.find((m) => m.name.toLowerCase() === normalized) ?? null;
|
|
551
|
+
}
|
|
552
|
+
function buildOpenRouterGatewayModelInfo(cachedModel, snapshot) {
|
|
553
|
+
const providerDefaults = LLM_REGISTRY.openrouter.supportedFileTypes;
|
|
554
|
+
const displayName = snapshot?.displayName ?? cachedModel.displayName;
|
|
555
|
+
const supportedFileTypes = snapshot?.supportedFileTypes ?? providerDefaults;
|
|
556
|
+
const maxInputTokens = typeof cachedModel.contextLength === "number" && cachedModel.contextLength > 0 ? cachedModel.contextLength : snapshot?.maxInputTokens ?? DEFAULT_MAX_INPUT_TOKENS;
|
|
557
|
+
const inferredReasoning = cachedModel.supportedParameters?.includes("reasoning") === true ? true : void 0;
|
|
558
|
+
const inferredSupportsTemperature = cachedModel.supportedParameters?.includes("temperature") === true ? true : void 0;
|
|
559
|
+
return {
|
|
560
|
+
name: snapshot?.name ?? cachedModel.id,
|
|
561
|
+
maxInputTokens,
|
|
562
|
+
supportedFileTypes,
|
|
563
|
+
...snapshot?.default ? { default: true } : {},
|
|
564
|
+
...displayName ? { displayName } : {},
|
|
565
|
+
...typeof snapshot?.reasoning === "boolean" ? { reasoning: snapshot.reasoning } : typeof inferredReasoning === "boolean" ? { reasoning: inferredReasoning } : {},
|
|
566
|
+
...typeof snapshot?.supportsTemperature === "boolean" ? { supportsTemperature: snapshot.supportsTemperature } : typeof inferredSupportsTemperature === "boolean" ? { supportsTemperature: inferredSupportsTemperature } : {},
|
|
567
|
+
...typeof snapshot?.supportsInterleaved === "boolean" ? { supportsInterleaved: snapshot.supportsInterleaved } : {},
|
|
568
|
+
...snapshot?.releaseDate ? { releaseDate: snapshot.releaseDate } : {},
|
|
569
|
+
...typeof snapshot?.supportsToolCall === "boolean" ? { supportsToolCall: snapshot.supportsToolCall } : {},
|
|
570
|
+
...snapshot?.status ? { status: snapshot.status } : {},
|
|
571
|
+
...snapshot?.modalities ? { modalities: snapshot.modalities } : {},
|
|
572
|
+
...snapshot?.providerMetadata ? { providerMetadata: snapshot.providerMetadata } : {},
|
|
573
|
+
...snapshot?.interleaved ? { interleaved: snapshot.interleaved } : {},
|
|
574
|
+
...snapshot?.pricing ? { pricing: snapshot.pricing } : {}
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function getOpenRouterGatewayModelById(modelId) {
|
|
578
|
+
ensureOpenRouterCatalogRefreshScheduled();
|
|
579
|
+
const snapshot = findOpenRouterSnapshotModelById(modelId);
|
|
580
|
+
const cached = (0, import_openrouter_model_registry.getCachedOpenRouterModelsWithInfo)();
|
|
581
|
+
if (!cached || cached.length === 0) {
|
|
582
|
+
return snapshot ? { ...snapshot } : null;
|
|
583
|
+
}
|
|
584
|
+
const normalized = modelId.toLowerCase();
|
|
585
|
+
const cachedModel = cached.find((m) => m.id.toLowerCase() === normalized);
|
|
586
|
+
if (!cachedModel) return snapshot ? { ...snapshot } : null;
|
|
587
|
+
return buildOpenRouterGatewayModelInfo(cachedModel, snapshot);
|
|
588
|
+
}
|
|
589
|
+
function getOpenRouterGatewayCatalogModels() {
|
|
590
|
+
ensureOpenRouterCatalogRefreshScheduled();
|
|
591
|
+
const cached = (0, import_openrouter_model_registry.getCachedOpenRouterModelsWithInfo)();
|
|
592
|
+
if (!cached || cached.length === 0) {
|
|
593
|
+
return LLM_REGISTRY.openrouter.models.map((m) => ({ ...m }));
|
|
594
|
+
}
|
|
595
|
+
const models = cached.map(
|
|
596
|
+
(cachedModel) => buildOpenRouterGatewayModelInfo(
|
|
597
|
+
cachedModel,
|
|
598
|
+
findOpenRouterSnapshotModelById(cachedModel.id)
|
|
599
|
+
)
|
|
600
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
|
601
|
+
return models;
|
|
602
|
+
}
|
|
527
603
|
function getAllModelsForProvider(provider) {
|
|
528
604
|
const providerInfo = LLM_REGISTRY[provider];
|
|
605
|
+
if (provider === "openrouter") {
|
|
606
|
+
return getOpenRouterGatewayCatalogModels().map((m) => ({
|
|
607
|
+
...m,
|
|
608
|
+
originalProvider: "openrouter"
|
|
609
|
+
}));
|
|
610
|
+
}
|
|
529
611
|
if (!providerInfo.supportsAllRegistryModels) {
|
|
530
612
|
return providerInfo.models.map((m) => ({ ...m }));
|
|
531
613
|
}
|
|
@@ -537,13 +619,11 @@ function getAllModelsForProvider(provider) {
|
|
|
537
619
|
seen.add(key);
|
|
538
620
|
allModels.push({ ...model, originalProvider: provider });
|
|
539
621
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
allModels.push({ ...model, originalProvider: "openrouter" });
|
|
546
|
-
}
|
|
622
|
+
for (const model of getOpenRouterGatewayCatalogModels()) {
|
|
623
|
+
const key = model.name.toLowerCase();
|
|
624
|
+
if (seen.has(key)) continue;
|
|
625
|
+
seen.add(key);
|
|
626
|
+
allModels.push({ ...model, originalProvider: "openrouter" });
|
|
547
627
|
}
|
|
548
628
|
return allModels;
|
|
549
629
|
}
|
|
@@ -750,8 +830,28 @@ function getModelDisplayName(model, provider) {
|
|
|
750
830
|
return model;
|
|
751
831
|
}
|
|
752
832
|
}
|
|
753
|
-
function isReasoningCapableModel(model,
|
|
754
|
-
const
|
|
833
|
+
function isReasoningCapableModel(model, provider) {
|
|
834
|
+
const registryProvider = (() => {
|
|
835
|
+
if (model.includes("/")) return "openrouter";
|
|
836
|
+
if (provider) return provider;
|
|
837
|
+
try {
|
|
838
|
+
return getProviderFromModel(model);
|
|
839
|
+
} catch {
|
|
840
|
+
return void 0;
|
|
841
|
+
}
|
|
842
|
+
})();
|
|
843
|
+
if (registryProvider === "openrouter" && model.includes("/")) {
|
|
844
|
+
const dynamicModel = getOpenRouterGatewayModelById(model);
|
|
845
|
+
if (dynamicModel?.reasoning === true) return true;
|
|
846
|
+
if (dynamicModel?.reasoning === false) return false;
|
|
847
|
+
}
|
|
848
|
+
if (registryProvider) {
|
|
849
|
+
const modelInfo = findModelInfo(registryProvider, model);
|
|
850
|
+
if (modelInfo?.reasoning === true) return true;
|
|
851
|
+
if (modelInfo?.reasoning === false) return false;
|
|
852
|
+
}
|
|
853
|
+
const modelIdForHeuristics = model.includes("/") ? model.split("/").pop() ?? model : model;
|
|
854
|
+
const modelLower = modelIdForHeuristics.toLowerCase();
|
|
755
855
|
if (modelLower.includes("codex")) {
|
|
756
856
|
return true;
|
|
757
857
|
}
|