@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
|
@@ -57,9 +57,19 @@ function requireNumber(value, label) {
|
|
|
57
57
|
}
|
|
58
58
|
return value;
|
|
59
59
|
}
|
|
60
|
+
function requireBoolean(value, label) {
|
|
61
|
+
if (typeof value !== "boolean") {
|
|
62
|
+
throw new import_DextoValidationError.DextoValidationError([makeIssue(`Expected ${label} to be a boolean`)]);
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
60
66
|
function parseModelsDevApi(json) {
|
|
61
67
|
const root = requireRecord(json, "models.dev api.json root");
|
|
62
68
|
const api = {};
|
|
69
|
+
function parseStringArray(value) {
|
|
70
|
+
if (!Array.isArray(value)) return [];
|
|
71
|
+
return value.filter((item) => typeof item === "string");
|
|
72
|
+
}
|
|
63
73
|
function parseModalitiesArray(value) {
|
|
64
74
|
if (!Array.isArray(value)) return [];
|
|
65
75
|
const result = [];
|
|
@@ -80,6 +90,10 @@ function parseModelsDevApi(json) {
|
|
|
80
90
|
provider.name ?? providerId,
|
|
81
91
|
`models.dev provider '${providerId}'.name`
|
|
82
92
|
),
|
|
93
|
+
...Array.isArray(provider.env) ? { env: parseStringArray(provider.env) } : {},
|
|
94
|
+
...typeof provider.npm === "string" ? { npm: provider.npm } : {},
|
|
95
|
+
...typeof provider.api === "string" ? { api: provider.api } : {},
|
|
96
|
+
...typeof provider.doc === "string" ? { doc: provider.doc } : {},
|
|
83
97
|
models: {}
|
|
84
98
|
};
|
|
85
99
|
for (const [modelId, modelValue] of Object.entries(models)) {
|
|
@@ -99,6 +113,20 @@ function parseModelsDevApi(json) {
|
|
|
99
113
|
`models.dev model '${providerId}/${modelId}'.name`
|
|
100
114
|
),
|
|
101
115
|
attachment: Boolean(m.attachment),
|
|
116
|
+
...typeof m.reasoning === "boolean" ? { reasoning: m.reasoning } : {},
|
|
117
|
+
...typeof m.temperature === "boolean" ? { temperature: m.temperature } : {},
|
|
118
|
+
...typeof m.release_date === "string" ? { release_date: m.release_date } : {},
|
|
119
|
+
...typeof m.status === "string" ? { status: m.status } : {},
|
|
120
|
+
...typeof m.tool_call === "boolean" ? { tool_call: m.tool_call } : {},
|
|
121
|
+
...isRecord(m.provider) ? {
|
|
122
|
+
provider: {
|
|
123
|
+
...typeof m.provider.npm === "string" ? { npm: m.provider.npm } : {},
|
|
124
|
+
...typeof m.provider.api === "string" ? { api: m.provider.api } : {}
|
|
125
|
+
}
|
|
126
|
+
} : {},
|
|
127
|
+
...m.interleaved === true || isRecord(m.interleaved) ? {
|
|
128
|
+
interleaved: m.interleaved
|
|
129
|
+
} : {},
|
|
102
130
|
limit: {
|
|
103
131
|
context: requireNumber(
|
|
104
132
|
limit.context,
|
|
@@ -116,7 +144,15 @@ function parseModelsDevApi(json) {
|
|
|
116
144
|
output: m.cost.output,
|
|
117
145
|
...typeof m.cost.cache_read === "number" ? { cache_read: m.cost.cache_read } : {},
|
|
118
146
|
...typeof m.cost.cache_write === "number" ? { cache_write: m.cost.cache_write } : {},
|
|
119
|
-
...m.cost.context_over_200k
|
|
147
|
+
...isRecord(m.cost.context_over_200k) && typeof m.cost.context_over_200k.input === "number" && typeof m.cost.context_over_200k.output === "number" ? {
|
|
148
|
+
context_over_200k: {
|
|
149
|
+
input: m.cost.context_over_200k.input,
|
|
150
|
+
output: m.cost.context_over_200k.output
|
|
151
|
+
}
|
|
152
|
+
} : {},
|
|
153
|
+
...typeof m.cost.input_audio === "number" ? { input_audio: m.cost.input_audio } : {},
|
|
154
|
+
...typeof m.cost.output_audio === "number" ? { output_audio: m.cost.output_audio } : {},
|
|
155
|
+
...typeof m.cost.reasoning === "number" ? { reasoning: m.cost.reasoning } : {}
|
|
120
156
|
} : void 0
|
|
121
157
|
};
|
|
122
158
|
parsedProvider.models[modelId] = parsedModel;
|
|
@@ -143,17 +179,52 @@ function getPricing(model) {
|
|
|
143
179
|
outputPerM: model.cost.output,
|
|
144
180
|
...typeof model.cost.cache_read === "number" ? { cacheReadPerM: model.cost.cache_read } : {},
|
|
145
181
|
...typeof model.cost.cache_write === "number" ? { cacheWritePerM: model.cost.cache_write } : {},
|
|
182
|
+
...typeof model.cost.reasoning === "number" ? { reasoningPerM: model.cost.reasoning } : {},
|
|
183
|
+
...typeof model.cost.input_audio === "number" ? { inputAudioPerM: model.cost.input_audio } : {},
|
|
184
|
+
...typeof model.cost.output_audio === "number" ? { outputAudioPerM: model.cost.output_audio } : {},
|
|
185
|
+
...model.cost.context_over_200k ? {
|
|
186
|
+
contextOver200kPerM: {
|
|
187
|
+
inputPerM: model.cost.context_over_200k.input,
|
|
188
|
+
outputPerM: model.cost.context_over_200k.output
|
|
189
|
+
}
|
|
190
|
+
} : {},
|
|
146
191
|
currency: "USD",
|
|
147
192
|
unit: "per_million_tokens"
|
|
148
193
|
};
|
|
149
194
|
}
|
|
150
195
|
function modelToModelInfo(provider, model, options) {
|
|
151
196
|
const pricing = getPricing(model);
|
|
197
|
+
const supportsInterleaved = model.interleaved === true || isRecord(model.interleaved);
|
|
198
|
+
const interleaved = model.interleaved === true ? true : isRecord(model.interleaved) ? {
|
|
199
|
+
...model.interleaved,
|
|
200
|
+
...typeof model.interleaved.field === "string" ? { field: model.interleaved.field } : {}
|
|
201
|
+
} : void 0;
|
|
152
202
|
return {
|
|
153
203
|
name: model.id,
|
|
154
204
|
displayName: model.name,
|
|
155
205
|
maxInputTokens: model.limit.input ?? model.limit.context,
|
|
156
206
|
supportedFileTypes: getSupportedFileTypesFromModel(provider, model),
|
|
207
|
+
reasoning: requireBoolean(
|
|
208
|
+
model.reasoning,
|
|
209
|
+
`models.dev model '${provider}/${model.id}'.reasoning`
|
|
210
|
+
),
|
|
211
|
+
supportsTemperature: requireBoolean(
|
|
212
|
+
model.temperature,
|
|
213
|
+
`models.dev model '${provider}/${model.id}'.temperature`
|
|
214
|
+
),
|
|
215
|
+
supportsToolCall: requireBoolean(
|
|
216
|
+
model.tool_call,
|
|
217
|
+
`models.dev model '${provider}/${model.id}'.tool_call`
|
|
218
|
+
),
|
|
219
|
+
releaseDate: requireString(
|
|
220
|
+
model.release_date,
|
|
221
|
+
`models.dev model '${provider}/${model.id}'.release_date`
|
|
222
|
+
),
|
|
223
|
+
modalities: model.modalities ?? { input: [], output: [] },
|
|
224
|
+
...model.status ? { status: model.status } : {},
|
|
225
|
+
...model.provider ? { providerMetadata: model.provider } : {},
|
|
226
|
+
...supportsInterleaved ? { supportsInterleaved } : {},
|
|
227
|
+
...interleaved ? { interleaved } : {},
|
|
157
228
|
...pricing ? { pricing } : {},
|
|
158
229
|
...options.defaultModelId === model.id ? { default: true } : {}
|
|
159
230
|
};
|
|
@@ -5,12 +5,26 @@ type ModelsDevApi = Record<string, ModelsDevProvider>;
|
|
|
5
5
|
type ModelsDevProvider = {
|
|
6
6
|
id: string;
|
|
7
7
|
name: string;
|
|
8
|
+
env?: string[];
|
|
9
|
+
npm?: string;
|
|
10
|
+
api?: string;
|
|
11
|
+
doc?: string;
|
|
8
12
|
models: Record<string, ModelsDevModel>;
|
|
9
13
|
};
|
|
10
14
|
type ModelsDevModel = {
|
|
11
15
|
id: string;
|
|
12
16
|
name: string;
|
|
13
17
|
attachment: boolean;
|
|
18
|
+
reasoning?: boolean;
|
|
19
|
+
temperature?: boolean;
|
|
20
|
+
release_date?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
tool_call?: boolean;
|
|
23
|
+
provider?: {
|
|
24
|
+
npm?: string;
|
|
25
|
+
api?: string;
|
|
26
|
+
};
|
|
27
|
+
interleaved?: boolean | Record<string, unknown>;
|
|
14
28
|
limit: {
|
|
15
29
|
context: number;
|
|
16
30
|
input?: number;
|
|
@@ -25,7 +39,13 @@ type ModelsDevModel = {
|
|
|
25
39
|
output: number;
|
|
26
40
|
cache_read?: number;
|
|
27
41
|
cache_write?: number;
|
|
28
|
-
context_over_200k?:
|
|
42
|
+
context_over_200k?: {
|
|
43
|
+
input: number;
|
|
44
|
+
output: number;
|
|
45
|
+
};
|
|
46
|
+
input_audio?: number;
|
|
47
|
+
output_audio?: number;
|
|
48
|
+
reasoning?: number;
|
|
29
49
|
} | undefined;
|
|
30
50
|
};
|
|
31
51
|
export declare function parseModelsDevApi(json: unknown): ModelsDevApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAE5D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACtD,KAAK,iBAAiB,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C,CAAC;AACF,KAAK,cAAc,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,UAAU,CAAC,EACL;QACI,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;QAC3D,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;KAC/D,GACD,SAAS,CAAC;IAChB,IAAI,CAAC,EACC;QACI,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,iBAAiB,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAE5D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACtD,KAAK,iBAAiB,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C,CAAC;AACF,KAAK,cAAc,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE;QACP,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,UAAU,CAAC,EACL;QACI,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;QAC3D,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;KAC/D,GACD,SAAS,CAAC;IAChB,IAAI,CAAC,EACC;QACI,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,iBAAiB,CAAC,EAAE;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,GACD,SAAS,CAAC;CACnB,CAAC;AA2CF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CA6J7D;AA6ID,wBAAgB,sCAAsC,CAAC,MAAM,EAAE;IAC3D,YAAY,EAAE,YAAY,CAAC;CAC9B,GAAG,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAuJnC;AAED,wBAAsB,+BAA+B,CAAC,OAAO,CAAC,EAAE;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAoB5C"}
|
|
@@ -32,9 +32,19 @@ function requireNumber(value, label) {
|
|
|
32
32
|
}
|
|
33
33
|
return value;
|
|
34
34
|
}
|
|
35
|
+
function requireBoolean(value, label) {
|
|
36
|
+
if (typeof value !== "boolean") {
|
|
37
|
+
throw new DextoValidationError([makeIssue(`Expected ${label} to be a boolean`)]);
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
35
41
|
function parseModelsDevApi(json) {
|
|
36
42
|
const root = requireRecord(json, "models.dev api.json root");
|
|
37
43
|
const api = {};
|
|
44
|
+
function parseStringArray(value) {
|
|
45
|
+
if (!Array.isArray(value)) return [];
|
|
46
|
+
return value.filter((item) => typeof item === "string");
|
|
47
|
+
}
|
|
38
48
|
function parseModalitiesArray(value) {
|
|
39
49
|
if (!Array.isArray(value)) return [];
|
|
40
50
|
const result = [];
|
|
@@ -55,6 +65,10 @@ function parseModelsDevApi(json) {
|
|
|
55
65
|
provider.name ?? providerId,
|
|
56
66
|
`models.dev provider '${providerId}'.name`
|
|
57
67
|
),
|
|
68
|
+
...Array.isArray(provider.env) ? { env: parseStringArray(provider.env) } : {},
|
|
69
|
+
...typeof provider.npm === "string" ? { npm: provider.npm } : {},
|
|
70
|
+
...typeof provider.api === "string" ? { api: provider.api } : {},
|
|
71
|
+
...typeof provider.doc === "string" ? { doc: provider.doc } : {},
|
|
58
72
|
models: {}
|
|
59
73
|
};
|
|
60
74
|
for (const [modelId, modelValue] of Object.entries(models)) {
|
|
@@ -74,6 +88,20 @@ function parseModelsDevApi(json) {
|
|
|
74
88
|
`models.dev model '${providerId}/${modelId}'.name`
|
|
75
89
|
),
|
|
76
90
|
attachment: Boolean(m.attachment),
|
|
91
|
+
...typeof m.reasoning === "boolean" ? { reasoning: m.reasoning } : {},
|
|
92
|
+
...typeof m.temperature === "boolean" ? { temperature: m.temperature } : {},
|
|
93
|
+
...typeof m.release_date === "string" ? { release_date: m.release_date } : {},
|
|
94
|
+
...typeof m.status === "string" ? { status: m.status } : {},
|
|
95
|
+
...typeof m.tool_call === "boolean" ? { tool_call: m.tool_call } : {},
|
|
96
|
+
...isRecord(m.provider) ? {
|
|
97
|
+
provider: {
|
|
98
|
+
...typeof m.provider.npm === "string" ? { npm: m.provider.npm } : {},
|
|
99
|
+
...typeof m.provider.api === "string" ? { api: m.provider.api } : {}
|
|
100
|
+
}
|
|
101
|
+
} : {},
|
|
102
|
+
...m.interleaved === true || isRecord(m.interleaved) ? {
|
|
103
|
+
interleaved: m.interleaved
|
|
104
|
+
} : {},
|
|
77
105
|
limit: {
|
|
78
106
|
context: requireNumber(
|
|
79
107
|
limit.context,
|
|
@@ -91,7 +119,15 @@ function parseModelsDevApi(json) {
|
|
|
91
119
|
output: m.cost.output,
|
|
92
120
|
...typeof m.cost.cache_read === "number" ? { cache_read: m.cost.cache_read } : {},
|
|
93
121
|
...typeof m.cost.cache_write === "number" ? { cache_write: m.cost.cache_write } : {},
|
|
94
|
-
...m.cost.context_over_200k
|
|
122
|
+
...isRecord(m.cost.context_over_200k) && typeof m.cost.context_over_200k.input === "number" && typeof m.cost.context_over_200k.output === "number" ? {
|
|
123
|
+
context_over_200k: {
|
|
124
|
+
input: m.cost.context_over_200k.input,
|
|
125
|
+
output: m.cost.context_over_200k.output
|
|
126
|
+
}
|
|
127
|
+
} : {},
|
|
128
|
+
...typeof m.cost.input_audio === "number" ? { input_audio: m.cost.input_audio } : {},
|
|
129
|
+
...typeof m.cost.output_audio === "number" ? { output_audio: m.cost.output_audio } : {},
|
|
130
|
+
...typeof m.cost.reasoning === "number" ? { reasoning: m.cost.reasoning } : {}
|
|
95
131
|
} : void 0
|
|
96
132
|
};
|
|
97
133
|
parsedProvider.models[modelId] = parsedModel;
|
|
@@ -118,17 +154,52 @@ function getPricing(model) {
|
|
|
118
154
|
outputPerM: model.cost.output,
|
|
119
155
|
...typeof model.cost.cache_read === "number" ? { cacheReadPerM: model.cost.cache_read } : {},
|
|
120
156
|
...typeof model.cost.cache_write === "number" ? { cacheWritePerM: model.cost.cache_write } : {},
|
|
157
|
+
...typeof model.cost.reasoning === "number" ? { reasoningPerM: model.cost.reasoning } : {},
|
|
158
|
+
...typeof model.cost.input_audio === "number" ? { inputAudioPerM: model.cost.input_audio } : {},
|
|
159
|
+
...typeof model.cost.output_audio === "number" ? { outputAudioPerM: model.cost.output_audio } : {},
|
|
160
|
+
...model.cost.context_over_200k ? {
|
|
161
|
+
contextOver200kPerM: {
|
|
162
|
+
inputPerM: model.cost.context_over_200k.input,
|
|
163
|
+
outputPerM: model.cost.context_over_200k.output
|
|
164
|
+
}
|
|
165
|
+
} : {},
|
|
121
166
|
currency: "USD",
|
|
122
167
|
unit: "per_million_tokens"
|
|
123
168
|
};
|
|
124
169
|
}
|
|
125
170
|
function modelToModelInfo(provider, model, options) {
|
|
126
171
|
const pricing = getPricing(model);
|
|
172
|
+
const supportsInterleaved = model.interleaved === true || isRecord(model.interleaved);
|
|
173
|
+
const interleaved = model.interleaved === true ? true : isRecord(model.interleaved) ? {
|
|
174
|
+
...model.interleaved,
|
|
175
|
+
...typeof model.interleaved.field === "string" ? { field: model.interleaved.field } : {}
|
|
176
|
+
} : void 0;
|
|
127
177
|
return {
|
|
128
178
|
name: model.id,
|
|
129
179
|
displayName: model.name,
|
|
130
180
|
maxInputTokens: model.limit.input ?? model.limit.context,
|
|
131
181
|
supportedFileTypes: getSupportedFileTypesFromModel(provider, model),
|
|
182
|
+
reasoning: requireBoolean(
|
|
183
|
+
model.reasoning,
|
|
184
|
+
`models.dev model '${provider}/${model.id}'.reasoning`
|
|
185
|
+
),
|
|
186
|
+
supportsTemperature: requireBoolean(
|
|
187
|
+
model.temperature,
|
|
188
|
+
`models.dev model '${provider}/${model.id}'.temperature`
|
|
189
|
+
),
|
|
190
|
+
supportsToolCall: requireBoolean(
|
|
191
|
+
model.tool_call,
|
|
192
|
+
`models.dev model '${provider}/${model.id}'.tool_call`
|
|
193
|
+
),
|
|
194
|
+
releaseDate: requireString(
|
|
195
|
+
model.release_date,
|
|
196
|
+
`models.dev model '${provider}/${model.id}'.release_date`
|
|
197
|
+
),
|
|
198
|
+
modalities: model.modalities ?? { input: [], output: [] },
|
|
199
|
+
...model.status ? { status: model.status } : {},
|
|
200
|
+
...model.provider ? { providerMetadata: model.provider } : {},
|
|
201
|
+
...supportsInterleaved ? { supportsInterleaved } : {},
|
|
202
|
+
...interleaved ? { interleaved } : {},
|
|
132
203
|
...pricing ? { pricing } : {},
|
|
133
204
|
...options.defaultModelId === model.id ? { default: true } : {}
|
|
134
205
|
};
|
package/dist/llm/resolver.cjs
CHANGED
|
@@ -152,6 +152,16 @@ async function resolveLLMConfig(previous, updates, logger) {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
const didProviderOrModelChange = provider !== previous.provider || model !== previous.model;
|
|
156
|
+
const nextReasoning = (() => {
|
|
157
|
+
if (!Object.prototype.hasOwnProperty.call(updates, "reasoning")) {
|
|
158
|
+
return didProviderOrModelChange ? void 0 : previous.reasoning;
|
|
159
|
+
}
|
|
160
|
+
const updateReasoning = updates.reasoning;
|
|
161
|
+
if (updateReasoning === null) return void 0;
|
|
162
|
+
if (updateReasoning === void 0) return previous.reasoning;
|
|
163
|
+
return updateReasoning;
|
|
164
|
+
})();
|
|
155
165
|
return {
|
|
156
166
|
candidate: {
|
|
157
167
|
provider,
|
|
@@ -161,7 +171,9 @@ async function resolveLLMConfig(previous, updates, logger) {
|
|
|
161
171
|
maxIterations: updates.maxIterations ?? previous.maxIterations,
|
|
162
172
|
maxInputTokens: updates.maxInputTokens,
|
|
163
173
|
maxOutputTokens: updates.maxOutputTokens ?? previous.maxOutputTokens,
|
|
164
|
-
temperature: updates.temperature ?? previous.temperature
|
|
174
|
+
temperature: updates.temperature ?? previous.temperature,
|
|
175
|
+
reasoning: nextReasoning,
|
|
176
|
+
allowedMediaTypes: updates.allowedMediaTypes ?? previous.allowedMediaTypes
|
|
165
177
|
},
|
|
166
178
|
warnings
|
|
167
179
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/llm/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiD,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAyB,MAAM,oBAAoB,CAAC;AAGlE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAMpD;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAUvD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/llm/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiD,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAyB,MAAM,oBAAoB,CAAC;AAGlE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAMpD;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAUvD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAAE,CAAC,CAyMxE;AAGD,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,EACnC,MAAM,EAAE,MAAM,GACf,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAuC9C"}
|
package/dist/llm/resolver.js
CHANGED
|
@@ -140,6 +140,16 @@ async function resolveLLMConfig(previous, updates, logger) {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
const didProviderOrModelChange = provider !== previous.provider || model !== previous.model;
|
|
144
|
+
const nextReasoning = (() => {
|
|
145
|
+
if (!Object.prototype.hasOwnProperty.call(updates, "reasoning")) {
|
|
146
|
+
return didProviderOrModelChange ? void 0 : previous.reasoning;
|
|
147
|
+
}
|
|
148
|
+
const updateReasoning = updates.reasoning;
|
|
149
|
+
if (updateReasoning === null) return void 0;
|
|
150
|
+
if (updateReasoning === void 0) return previous.reasoning;
|
|
151
|
+
return updateReasoning;
|
|
152
|
+
})();
|
|
143
153
|
return {
|
|
144
154
|
candidate: {
|
|
145
155
|
provider,
|
|
@@ -149,7 +159,9 @@ async function resolveLLMConfig(previous, updates, logger) {
|
|
|
149
159
|
maxIterations: updates.maxIterations ?? previous.maxIterations,
|
|
150
160
|
maxInputTokens: updates.maxInputTokens,
|
|
151
161
|
maxOutputTokens: updates.maxOutputTokens ?? previous.maxOutputTokens,
|
|
152
|
-
temperature: updates.temperature ?? previous.temperature
|
|
162
|
+
temperature: updates.temperature ?? previous.temperature,
|
|
163
|
+
reasoning: nextReasoning,
|
|
164
|
+
allowedMediaTypes: updates.allowedMediaTypes ?? previous.allowedMediaTypes
|
|
153
165
|
},
|
|
154
166
|
warnings
|
|
155
167
|
};
|
package/dist/llm/schemas.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var import_result = require("../utils/result.js");
|
|
|
30
30
|
var import_zod = require("zod");
|
|
31
31
|
var import_registry = require("./registry/index.js");
|
|
32
32
|
var import_types2 = require("./types.js");
|
|
33
|
+
var import_profile = require("./reasoning/profile.js");
|
|
33
34
|
const LLMConfigFields = {
|
|
34
35
|
provider: import_zod.z.enum(import_types2.LLM_PROVIDERS).describe("LLM provider (e.g., 'openai', 'anthropic', 'google', 'groq')"),
|
|
35
36
|
model: import_result.NonEmptyTrimmed.describe("Specific model name for the selected provider"),
|
|
@@ -47,18 +48,15 @@ const LLMConfigFields = {
|
|
|
47
48
|
'MIME type patterns for media expansion (e.g., "image/*", "application/pdf"). If omitted, uses model capabilities from registry. Supports wildcards.'
|
|
48
49
|
),
|
|
49
50
|
// Provider-specific options
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
reasoningEffort: import_zod.z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional().describe(
|
|
61
|
-
"OpenAI reasoning effort level for reasoning models (o1, o3, codex). Options: 'none', 'minimal', 'low', 'medium' (recommended), 'high', 'xhigh'"
|
|
51
|
+
reasoning: import_zod.z.object({
|
|
52
|
+
variant: import_result.NonEmptyTrimmed.describe(
|
|
53
|
+
"Model/provider-native reasoning variant (resolved by reasoning profile for the selected model)."
|
|
54
|
+
),
|
|
55
|
+
budgetTokens: import_zod.z.coerce.number().int().positive().optional().describe(
|
|
56
|
+
"Advanced escape hatch for budget-based providers (e.g., Anthropic/Gemini/Bedrock/OpenRouter)."
|
|
57
|
+
)
|
|
58
|
+
}).strict().optional().describe(
|
|
59
|
+
"Reasoning configuration using model/provider-native variants (tuning only; display is controlled separately)."
|
|
62
60
|
)
|
|
63
61
|
};
|
|
64
62
|
const LLMConfigBaseSchema = import_zod.z.object({
|
|
@@ -73,7 +71,7 @@ const LLMConfigBaseSchema = import_zod.z.object({
|
|
|
73
71
|
temperature: LLMConfigFields.temperature,
|
|
74
72
|
allowedMediaTypes: LLMConfigFields.allowedMediaTypes,
|
|
75
73
|
// Provider-specific options
|
|
76
|
-
|
|
74
|
+
reasoning: LLMConfigFields.reasoning
|
|
77
75
|
}).strict();
|
|
78
76
|
const LLMConfigSchema = LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
79
77
|
const baseURLIsSet = data.baseURL != null && data.baseURL.trim() !== "";
|
|
@@ -163,8 +161,42 @@ const LLMConfigSchema = LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
163
|
}
|
|
164
|
+
if (data.reasoning) {
|
|
165
|
+
const profile = (0, import_profile.getReasoningProfile)(data.provider, data.model);
|
|
166
|
+
const variant = data.reasoning.variant;
|
|
167
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
168
|
+
if (!(0, import_profile.supportsReasoningVariant)(profile, variant)) {
|
|
169
|
+
ctx.addIssue({
|
|
170
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
171
|
+
path: ["reasoning", "variant"],
|
|
172
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
173
|
+
params: {
|
|
174
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
175
|
+
scope: import_types.ErrorScope.LLM,
|
|
176
|
+
type: import_types.ErrorType.USER
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
181
|
+
ctx.addIssue({
|
|
182
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
183
|
+
path: ["reasoning", "budgetTokens"],
|
|
184
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
185
|
+
params: {
|
|
186
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
187
|
+
scope: import_types.ErrorScope.LLM,
|
|
188
|
+
type: import_types.ErrorType.USER
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
166
193
|
});
|
|
167
|
-
const LLMUpdatesSchema = import_zod.z.object({
|
|
194
|
+
const LLMUpdatesSchema = import_zod.z.object({
|
|
195
|
+
...LLMConfigFields,
|
|
196
|
+
// Special-case: allow `null` as an explicit "clear reasoning config" sentinel for switch flows.
|
|
197
|
+
// Full configs (LLMConfigSchema) still require `reasoning` to be an object when present.
|
|
198
|
+
reasoning: LLMConfigFields.reasoning.nullable()
|
|
199
|
+
}).partial().superRefine((data, ctx) => {
|
|
168
200
|
if (!data.model && !data.provider) {
|
|
169
201
|
ctx.addIssue({
|
|
170
202
|
code: import_zod.z.ZodIssueCode.custom,
|
|
@@ -172,6 +204,35 @@ const LLMUpdatesSchema = import_zod.z.object({ ...LLMConfigFields }).partial().s
|
|
|
172
204
|
path: []
|
|
173
205
|
});
|
|
174
206
|
}
|
|
207
|
+
if (data.reasoning && data.reasoning !== null && typeof data.provider === "string" && typeof data.model === "string") {
|
|
208
|
+
const profile = (0, import_profile.getReasoningProfile)(data.provider, data.model);
|
|
209
|
+
const variant = data.reasoning.variant;
|
|
210
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
211
|
+
if (!(0, import_profile.supportsReasoningVariant)(profile, variant)) {
|
|
212
|
+
ctx.addIssue({
|
|
213
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
214
|
+
path: ["reasoning", "variant"],
|
|
215
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
216
|
+
params: {
|
|
217
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
218
|
+
scope: import_types.ErrorScope.LLM,
|
|
219
|
+
type: import_types.ErrorType.USER
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
224
|
+
ctx.addIssue({
|
|
225
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
226
|
+
path: ["reasoning", "budgetTokens"],
|
|
227
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
228
|
+
params: {
|
|
229
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
230
|
+
scope: import_types.ErrorScope.LLM,
|
|
231
|
+
type: import_types.ErrorType.USER
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
175
236
|
});
|
|
176
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
177
238
|
0 && (module.exports = {
|