@dexto/core 1.10.2 → 1.10.4
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/README.md +7 -7
- package/dist/agent/DextoAgent.cjs +29 -13
- package/dist/agent/DextoAgent.d.ts +3 -2
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +37 -19
- package/dist/agent/agent-options.d.ts +5 -0
- package/dist/agent/agent-options.d.ts.map +1 -1
- package/dist/approval/schemas.d.ts +8 -8
- package/dist/context/manager.cjs +9 -4
- package/dist/context/manager.d.ts +3 -1
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +8 -3
- package/dist/context/types.d.ts +3 -1
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +20 -6
- package/dist/context/utils.d.ts +5 -2
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +24 -7
- package/dist/events/index.d.ts +0 -4
- package/dist/events/index.d.ts.map +1 -1
- package/dist/index.browser.cjs +12 -9
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -0
- package/dist/llm/curation.cjs +4 -5
- package/dist/llm/curation.d.ts +3 -3
- package/dist/llm/curation.d.ts.map +1 -1
- package/dist/llm/curation.js +5 -6
- package/dist/llm/executor/provider-options.cjs +14 -8
- package/dist/llm/executor/provider-options.d.ts +2 -1
- package/dist/llm/executor/provider-options.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.js +14 -8
- package/dist/llm/executor/stream-processor.cjs +16 -4
- package/dist/llm/executor/stream-processor.d.ts +1 -0
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +16 -4
- package/dist/llm/executor/turn-executor.cjs +9 -2
- package/dist/llm/executor/turn-executor.d.ts +2 -1
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +9 -2
- package/dist/llm/formatters/vercel.cjs +10 -2
- package/dist/llm/formatters/vercel.d.ts +3 -2
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +10 -2
- package/dist/llm/registry/auto-update.cjs +19 -4
- package/dist/llm/registry/auto-update.d.ts.map +1 -1
- package/dist/llm/registry/auto-update.js +20 -5
- package/dist/llm/registry/index.cjs +40 -15
- package/dist/llm/registry/index.d.ts +7 -7
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/registry/index.js +42 -21
- package/dist/llm/resolver.cjs +16 -15
- package/dist/llm/resolver.d.ts +4 -3
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +18 -23
- package/dist/llm/schemas.cjs +137 -124
- package/dist/llm/schemas.d.ts +69 -1
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +136 -130
- package/dist/llm/services/factory.cjs +3 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +3 -1
- package/dist/llm/services/types.d.ts +4 -0
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +15 -6
- package/dist/llm/services/vercel.d.ts +3 -1
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +15 -6
- package/dist/llm/usage-metadata.cjs +2 -2
- package/dist/llm/usage-metadata.d.ts +2 -1
- package/dist/llm/usage-metadata.d.ts.map +1 -1
- package/dist/llm/usage-metadata.js +6 -3
- package/dist/llm/validation.cjs +7 -7
- package/dist/llm/validation.d.ts +3 -2
- package/dist/llm/validation.d.ts.map +1 -1
- package/dist/llm/validation.js +12 -8
- package/dist/session/chat-session.cjs +5 -2
- package/dist/session/chat-session.d.ts +2 -0
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +5 -2
- package/dist/session/session-manager.cjs +2 -0
- package/dist/session/session-manager.d.ts +2 -0
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +2 -0
- package/dist/storage/index.cjs +9 -2
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +9 -1
- package/dist/storage/tool-executions/types.cjs +16 -0
- package/dist/storage/tool-executions/types.d.ts +19 -4
- package/dist/storage/tool-executions/types.d.ts.map +1 -1
- package/dist/storage/tool-executions/types.js +16 -0
- package/dist/tools/display-types.cjs +41 -0
- package/dist/tools/display-types.d.ts +54 -3
- package/dist/tools/display-types.d.ts.map +1 -1
- package/dist/tools/display-types.js +36 -0
- package/dist/tools/presentation/tool-presentation.cjs +47 -0
- package/dist/tools/presentation/tool-presentation.d.ts +10 -1
- package/dist/tools/presentation/tool-presentation.d.ts.map +1 -1
- package/dist/tools/presentation/tool-presentation.js +47 -0
- package/dist/tools/presentation-schema.d.ts +2 -2
- package/dist/tools/presentation.d.ts +1 -0
- package/dist/tools/presentation.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.cjs +17 -3
- package/dist/tools/tool-call-metadata.d.ts +4 -1
- package/dist/tools/tool-call-metadata.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.js +17 -3
- package/dist/tools/tool-manager.cjs +14 -5
- package/dist/tools/tool-manager.d.ts +0 -1
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +14 -5
- package/dist/tools/types.d.ts +21 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/service-initializer.cjs +3 -2
- package/dist/utils/service-initializer.d.ts +2 -1
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +3 -2
- package/package.json +2 -2
package/dist/llm/schemas.cjs
CHANGED
|
@@ -20,16 +20,17 @@ var schemas_exports = {};
|
|
|
20
20
|
__export(schemas_exports, {
|
|
21
21
|
LLMConfigBaseSchema: () => LLMConfigBaseSchema,
|
|
22
22
|
LLMConfigSchema: () => LLMConfigSchema,
|
|
23
|
-
LLMUpdatesSchema: () => LLMUpdatesSchema
|
|
23
|
+
LLMUpdatesSchema: () => LLMUpdatesSchema,
|
|
24
|
+
LLMUpdatesShapeSchema: () => LLMUpdatesShapeSchema,
|
|
25
|
+
createLLMConfigSchema: () => createLLMConfigSchema,
|
|
26
|
+
createLLMUpdatesSchema: () => createLLMUpdatesSchema
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(schemas_exports);
|
|
26
29
|
var import_error_codes = require("./error-codes.js");
|
|
27
30
|
var import_types = require("../errors/types.js");
|
|
28
|
-
var import_errors = require("../errors/index.js");
|
|
29
31
|
var import_result = require("../utils/result.js");
|
|
30
32
|
var import_zod = require("zod");
|
|
31
33
|
var import_llm = require("@dexto/llm");
|
|
32
|
-
var import_registry = require("./registry/index.js");
|
|
33
34
|
var import_llm2 = require("@dexto/llm");
|
|
34
35
|
const LLMConfigFields = {
|
|
35
36
|
provider: import_zod.z.enum(import_llm2.LLM_PROVIDERS).describe("LLM provider (e.g., 'openai', 'anthropic', 'google', 'groq')"),
|
|
@@ -73,130 +74,134 @@ const LLMConfigBaseSchema = import_zod.z.object({
|
|
|
73
74
|
// Provider-specific options
|
|
74
75
|
reasoning: LLMConfigFields.reasoning
|
|
75
76
|
}).strict();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
code: import_zod.z.ZodIssueCode.custom,
|
|
82
|
-
path: ["model"],
|
|
83
|
-
message: `Provider '${data.provider}' requires OpenRouter-format model IDs (e.g. 'openai/gpt-5-mini' or 'anthropic/claude-sonnet-4.5'). You provided '${data.model}'.`,
|
|
84
|
-
params: {
|
|
85
|
-
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
86
|
-
scope: import_types.ErrorScope.LLM,
|
|
87
|
-
type: import_types.ErrorType.USER
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (baseURLIsSet) {
|
|
92
|
-
if (!(0, import_llm.supportsBaseURL)(data.provider)) {
|
|
77
|
+
function createLLMConfigSchema(registry = import_llm.DEFAULT_MODEL_REGISTRY) {
|
|
78
|
+
return LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
79
|
+
const baseURLIsSet = data.baseURL != null && data.baseURL.trim() !== "";
|
|
80
|
+
const maxInputTokensIsSet = data.maxInputTokens != null;
|
|
81
|
+
if (registry.hasAllRegistryModelsSupport(data.provider) && !data.model.includes("/")) {
|
|
93
82
|
ctx.addIssue({
|
|
94
83
|
code: import_zod.z.ZodIssueCode.custom,
|
|
95
|
-
path: ["
|
|
96
|
-
message: `Provider '${data.provider}'
|
|
84
|
+
path: ["model"],
|
|
85
|
+
message: `Provider '${data.provider}' requires OpenRouter-format model IDs (e.g. 'openai/gpt-5-mini' or 'anthropic/claude-sonnet-4.5'). You provided '${data.model}'.`,
|
|
97
86
|
params: {
|
|
98
|
-
code: import_error_codes.LLMErrorCode.
|
|
87
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
99
88
|
scope: import_types.ErrorScope.LLM,
|
|
100
89
|
type: import_types.ErrorType.USER
|
|
101
90
|
}
|
|
102
91
|
});
|
|
103
92
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!(0, import_llm.acceptsAnyModel)(data.provider) && !(0, import_llm.supportsCustomModels)(data.provider)) {
|
|
107
|
-
const supportedModelsList = (0, import_llm.getSupportedModels)(data.provider);
|
|
108
|
-
if (!(0, import_llm.isValidProviderModel)(data.provider, data.model)) {
|
|
93
|
+
if (baseURLIsSet) {
|
|
94
|
+
if (!registry.supportsBaseURL(data.provider)) {
|
|
109
95
|
ctx.addIssue({
|
|
110
96
|
code: import_zod.z.ZodIssueCode.custom,
|
|
111
|
-
path: ["
|
|
112
|
-
message: `
|
|
97
|
+
path: ["provider"],
|
|
98
|
+
message: `Provider '${data.provider}' does not support baseURL. Use an 'openai-compatible' provider if you need a custom base URL.`,
|
|
113
99
|
params: {
|
|
114
|
-
code: import_error_codes.LLMErrorCode.
|
|
100
|
+
code: import_error_codes.LLMErrorCode.BASE_URL_INVALID,
|
|
115
101
|
scope: import_types.ErrorScope.LLM,
|
|
116
102
|
type: import_types.ErrorType.USER
|
|
117
103
|
}
|
|
118
104
|
});
|
|
119
105
|
}
|
|
120
106
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
if (data.
|
|
125
|
-
ctx.addIssue({
|
|
126
|
-
code: import_zod.z.ZodIssueCode.custom,
|
|
127
|
-
path: ["maxInputTokens"],
|
|
128
|
-
message: `Max input tokens for model '${data.model}' is ${cap}. You provided ${data.maxInputTokens}`,
|
|
129
|
-
params: {
|
|
130
|
-
code: import_error_codes.LLMErrorCode.TOKENS_EXCEEDED,
|
|
131
|
-
scope: import_types.ErrorScope.LLM,
|
|
132
|
-
type: import_types.ErrorType.USER
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
} catch (error) {
|
|
137
|
-
if (error instanceof import_errors.DextoRuntimeError && error.code === import_error_codes.LLMErrorCode.MODEL_UNKNOWN) {
|
|
107
|
+
if (!baseURLIsSet || registry.supportsBaseURL(data.provider)) {
|
|
108
|
+
if (!registry.acceptsAnyModel(data.provider) && !registry.supportsCustomModels(data.provider)) {
|
|
109
|
+
const supportedModelsList = registry.getSupportedModels(data.provider);
|
|
110
|
+
if (!registry.isValidProviderModel(data.provider, data.model)) {
|
|
138
111
|
ctx.addIssue({
|
|
139
112
|
code: import_zod.z.ZodIssueCode.custom,
|
|
140
113
|
path: ["model"],
|
|
141
|
-
message:
|
|
114
|
+
message: `Model '${data.model}' is not supported for provider '${data.provider}'. Supported: ${supportedModelsList.join(", ")}`,
|
|
142
115
|
params: {
|
|
143
|
-
code:
|
|
144
|
-
scope: error.scope,
|
|
145
|
-
type: error.type
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
} else {
|
|
149
|
-
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
150
|
-
ctx.addIssue({
|
|
151
|
-
code: import_zod.z.ZodIssueCode.custom,
|
|
152
|
-
path: ["model"],
|
|
153
|
-
message,
|
|
154
|
-
params: {
|
|
155
|
-
code: import_error_codes.LLMErrorCode.REQUEST_INVALID_SCHEMA,
|
|
116
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
156
117
|
scope: import_types.ErrorScope.LLM,
|
|
157
|
-
type: import_types.ErrorType.
|
|
118
|
+
type: import_types.ErrorType.USER
|
|
158
119
|
}
|
|
159
120
|
});
|
|
160
121
|
}
|
|
161
122
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
123
|
+
if (maxInputTokensIsSet && !registry.acceptsAnyModel(data.provider) && !registry.supportsCustomModels(data.provider)) {
|
|
124
|
+
try {
|
|
125
|
+
const cap = registry.getMaxInputTokensForModel(data.provider, data.model);
|
|
126
|
+
if (data.maxInputTokens > cap) {
|
|
127
|
+
ctx.addIssue({
|
|
128
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
129
|
+
path: ["maxInputTokens"],
|
|
130
|
+
message: `Max input tokens for model '${data.model}' is ${cap}. You provided ${data.maxInputTokens}`,
|
|
131
|
+
params: {
|
|
132
|
+
code: import_error_codes.LLMErrorCode.TOKENS_EXCEEDED,
|
|
133
|
+
scope: import_types.ErrorScope.LLM,
|
|
134
|
+
type: import_types.ErrorType.USER
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (error instanceof import_llm.LlmCatalogError && error.code === "MODEL_UNKNOWN") {
|
|
140
|
+
ctx.addIssue({
|
|
141
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
142
|
+
path: ["model"],
|
|
143
|
+
message: error.message,
|
|
144
|
+
params: {
|
|
145
|
+
code: import_error_codes.LLMErrorCode.MODEL_UNKNOWN,
|
|
146
|
+
scope: import_types.ErrorScope.LLM,
|
|
147
|
+
type: import_types.ErrorType.USER
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} else {
|
|
151
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
152
|
+
ctx.addIssue({
|
|
153
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
154
|
+
path: ["model"],
|
|
155
|
+
message,
|
|
156
|
+
params: {
|
|
157
|
+
code: import_error_codes.LLMErrorCode.REQUEST_INVALID_SCHEMA,
|
|
158
|
+
scope: import_types.ErrorScope.LLM,
|
|
159
|
+
type: import_types.ErrorType.SYSTEM
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
177
163
|
}
|
|
178
|
-
}
|
|
164
|
+
}
|
|
179
165
|
}
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
code:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
166
|
+
if (data.reasoning) {
|
|
167
|
+
const profile = (0, import_llm.getReasoningProfile)(data.provider, data.model, registry);
|
|
168
|
+
const variant = data.reasoning.variant;
|
|
169
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
170
|
+
if (!(0, import_llm.supportsReasoningVariant)(profile, variant)) {
|
|
171
|
+
ctx.addIssue({
|
|
172
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
173
|
+
path: ["reasoning", "variant"],
|
|
174
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
175
|
+
params: {
|
|
176
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
177
|
+
scope: import_types.ErrorScope.LLM,
|
|
178
|
+
type: import_types.ErrorType.USER
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
183
|
+
ctx.addIssue({
|
|
184
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
185
|
+
path: ["reasoning", "budgetTokens"],
|
|
186
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
187
|
+
params: {
|
|
188
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
189
|
+
scope: import_types.ErrorScope.LLM,
|
|
190
|
+
type: import_types.ErrorType.USER
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
191
194
|
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const LLMConfigSchema = createLLMConfigSchema();
|
|
198
|
+
const LLMUpdatesBaseSchema = import_zod.z.object({
|
|
195
199
|
...LLMConfigFields,
|
|
196
200
|
// Special-case: allow `null` as an explicit "clear reasoning config" sentinel for switch flows.
|
|
197
201
|
// Full configs (LLMConfigSchema) still require `reasoning` to be an object when present.
|
|
198
202
|
reasoning: LLMConfigFields.reasoning.nullable()
|
|
199
|
-
}).partial().
|
|
203
|
+
}).partial().strict();
|
|
204
|
+
const LLMUpdatesShapeSchema = LLMUpdatesBaseSchema.superRefine((data, ctx) => {
|
|
200
205
|
if (!data.model && !data.provider) {
|
|
201
206
|
ctx.addIssue({
|
|
202
207
|
code: import_zod.z.ZodIssueCode.custom,
|
|
@@ -204,39 +209,47 @@ const LLMUpdatesSchema = import_zod.z.object({
|
|
|
204
209
|
path: []
|
|
205
210
|
});
|
|
206
211
|
}
|
|
207
|
-
if (data.reasoning && data.reasoning !== null && typeof data.provider === "string" && typeof data.model === "string") {
|
|
208
|
-
const profile = (0, import_llm.getReasoningProfile)(data.provider, data.model);
|
|
209
|
-
const variant = data.reasoning.variant;
|
|
210
|
-
const budgetTokens = data.reasoning.budgetTokens;
|
|
211
|
-
if (!(0, import_llm.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
|
-
}
|
|
236
212
|
});
|
|
213
|
+
function createLLMUpdatesSchema(registry = import_llm.DEFAULT_MODEL_REGISTRY) {
|
|
214
|
+
return LLMUpdatesShapeSchema.superRefine((data, ctx) => {
|
|
215
|
+
if (data.reasoning && data.reasoning !== null && typeof data.provider === "string" && typeof data.model === "string") {
|
|
216
|
+
const profile = (0, import_llm.getReasoningProfile)(data.provider, data.model, registry);
|
|
217
|
+
const variant = data.reasoning.variant;
|
|
218
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
219
|
+
if (!(0, import_llm.supportsReasoningVariant)(profile, variant)) {
|
|
220
|
+
ctx.addIssue({
|
|
221
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
222
|
+
path: ["reasoning", "variant"],
|
|
223
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
224
|
+
params: {
|
|
225
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
226
|
+
scope: import_types.ErrorScope.LLM,
|
|
227
|
+
type: import_types.ErrorType.USER
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
232
|
+
ctx.addIssue({
|
|
233
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
234
|
+
path: ["reasoning", "budgetTokens"],
|
|
235
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
236
|
+
params: {
|
|
237
|
+
code: import_error_codes.LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
238
|
+
scope: import_types.ErrorScope.LLM,
|
|
239
|
+
type: import_types.ErrorType.USER
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const LLMUpdatesSchema = createLLMUpdatesSchema();
|
|
237
247
|
// Annotate the CommonJS export names for ESM import in node:
|
|
238
248
|
0 && (module.exports = {
|
|
239
249
|
LLMConfigBaseSchema,
|
|
240
250
|
LLMConfigSchema,
|
|
241
|
-
LLMUpdatesSchema
|
|
251
|
+
LLMUpdatesSchema,
|
|
252
|
+
LLMUpdatesShapeSchema,
|
|
253
|
+
createLLMConfigSchema,
|
|
254
|
+
createLLMUpdatesSchema
|
|
242
255
|
});
|
package/dist/llm/schemas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type ModelRegistry } from '@dexto/llm';
|
|
2
3
|
/** Business rules + compatibility checks */
|
|
3
4
|
export declare const LLMConfigBaseSchema: z.ZodObject<{
|
|
4
5
|
provider: z.ZodEnum<{
|
|
@@ -40,6 +41,7 @@ export declare const LLMConfigBaseSchema: z.ZodObject<{
|
|
|
40
41
|
* - API keys and base URLs are validated at runtime (when creating a provider client), not at parse time.
|
|
41
42
|
* - This keeps programmatic construction (code-first DI) ergonomic: you can omit credentials and rely on env.
|
|
42
43
|
*/
|
|
44
|
+
export declare function createLLMConfigSchema(registry?: ModelRegistry): typeof LLMConfigBaseSchema;
|
|
43
45
|
export declare const LLMConfigSchema: z.ZodObject<{
|
|
44
46
|
provider: z.ZodEnum<{
|
|
45
47
|
local: "local";
|
|
@@ -75,6 +77,72 @@ export declare const LLMConfigSchema: z.ZodObject<{
|
|
|
75
77
|
}, z.core.$strict>;
|
|
76
78
|
export type LLMConfig = z.input<typeof LLMConfigSchema>;
|
|
77
79
|
export type ValidatedLLMConfig = z.output<typeof LLMConfigSchema>;
|
|
80
|
+
export declare const LLMUpdatesShapeSchema: z.ZodObject<{
|
|
81
|
+
reasoning: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
82
|
+
variant: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
83
|
+
budgetTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
84
|
+
}, z.core.$strict>>>>;
|
|
85
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
local: "local";
|
|
87
|
+
openai: "openai";
|
|
88
|
+
"openai-compatible": "openai-compatible";
|
|
89
|
+
anthropic: "anthropic";
|
|
90
|
+
google: "google";
|
|
91
|
+
groq: "groq";
|
|
92
|
+
xai: "xai";
|
|
93
|
+
cohere: "cohere";
|
|
94
|
+
minimax: "minimax";
|
|
95
|
+
glm: "glm";
|
|
96
|
+
openrouter: "openrouter";
|
|
97
|
+
litellm: "litellm";
|
|
98
|
+
glama: "glama";
|
|
99
|
+
vertex: "vertex";
|
|
100
|
+
bedrock: "bedrock";
|
|
101
|
+
ollama: "ollama";
|
|
102
|
+
"dexto-nova": "dexto-nova";
|
|
103
|
+
}>>;
|
|
104
|
+
model: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
105
|
+
apiKey: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
106
|
+
maxIterations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
107
|
+
baseURL: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>>;
|
|
108
|
+
maxInputTokens: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
109
|
+
maxOutputTokens: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
110
|
+
temperature: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
111
|
+
allowedMediaTypes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
export declare function createLLMUpdatesSchema(registry?: ModelRegistry): z.ZodObject<{
|
|
114
|
+
reasoning: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
115
|
+
variant: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
116
|
+
budgetTokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
117
|
+
}, z.core.$strict>>>>;
|
|
118
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
local: "local";
|
|
120
|
+
openai: "openai";
|
|
121
|
+
"openai-compatible": "openai-compatible";
|
|
122
|
+
anthropic: "anthropic";
|
|
123
|
+
google: "google";
|
|
124
|
+
groq: "groq";
|
|
125
|
+
xai: "xai";
|
|
126
|
+
cohere: "cohere";
|
|
127
|
+
minimax: "minimax";
|
|
128
|
+
glm: "glm";
|
|
129
|
+
openrouter: "openrouter";
|
|
130
|
+
litellm: "litellm";
|
|
131
|
+
glama: "glama";
|
|
132
|
+
vertex: "vertex";
|
|
133
|
+
bedrock: "bedrock";
|
|
134
|
+
ollama: "ollama";
|
|
135
|
+
"dexto-nova": "dexto-nova";
|
|
136
|
+
}>>;
|
|
137
|
+
model: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
138
|
+
apiKey: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
139
|
+
maxIterations: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
140
|
+
baseURL: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>>;
|
|
141
|
+
maxInputTokens: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
142
|
+
maxOutputTokens: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
143
|
+
temperature: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
144
|
+
allowedMediaTypes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
145
|
+
}, z.core.$strict>;
|
|
78
146
|
export declare const LLMUpdatesSchema: z.ZodObject<{
|
|
79
147
|
reasoning: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
80
148
|
variant: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -107,7 +175,7 @@ export declare const LLMUpdatesSchema: z.ZodObject<{
|
|
|
107
175
|
maxOutputTokens: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
108
176
|
temperature: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
109
177
|
allowedMediaTypes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
110
|
-
}, z.core.$
|
|
178
|
+
}, z.core.$strict>;
|
|
111
179
|
export type LLMUpdates = z.input<typeof LLMUpdatesSchema>;
|
|
112
180
|
export type { LLMUpdateContext } from '@dexto/llm';
|
|
113
181
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEH,KAAK,aAAa,EAIrB,MAAM,YAAY,CAAC;AA6EpB,4CAA4C;AAG5C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBnB,CAAC;AAEd;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,QAAQ,GAAE,aAAsC,GACjD,OAAO,mBAAmB,CA2J5B;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA0B,CAAC;AAGvD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAalE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQhC,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,QAAQ,GAAE,aAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA6CtF;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA2B,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|