@dexto/core 1.9.7 → 1.9.8
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/llm/executor/provider-error.cjs +15 -1
- package/dist/llm/executor/provider-error.d.ts.map +1 -1
- package/dist/llm/executor/provider-error.js +16 -2
- package/dist/llm/executor/provider-options.cjs +4 -4
- package/dist/llm/executor/provider-options.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.js +4 -4
- package/dist/llm/services/factory.cjs +6 -5
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +6 -5
- package/package.json +2 -2
|
@@ -97,7 +97,9 @@ function providerMessage(details, fallback) {
|
|
|
97
97
|
return details.openRouterProviderRawMessage ?? details.openRouterErrorMessage ?? details.responseBody ?? fallback;
|
|
98
98
|
}
|
|
99
99
|
function messageFromUnknown(value) {
|
|
100
|
-
|
|
100
|
+
if (value instanceof Error) return value.message;
|
|
101
|
+
if (isRecord(value)) return readString(value.message) ?? String(value);
|
|
102
|
+
return String(value);
|
|
101
103
|
}
|
|
102
104
|
function isInvalidSchemaMessage(message) {
|
|
103
105
|
return message.includes("Invalid schema for function") || message.includes("invalid_function_parameters") || message.includes("schema must have type");
|
|
@@ -175,6 +177,18 @@ function mapProviderError(input) {
|
|
|
175
177
|
if (input.error instanceof import_DextoRuntimeError.DextoRuntimeError) return input.error;
|
|
176
178
|
if (!import_ai.APICallError.isInstance?.(input.error)) {
|
|
177
179
|
const message2 = messageFromUnknown(input.error);
|
|
180
|
+
if (import_ai.UnsupportedFunctionalityError.isInstance(input.error)) {
|
|
181
|
+
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
182
|
+
import_error_codes.LLMErrorCode.GENERATION_FAILED,
|
|
183
|
+
import_types.ErrorScope.LLM,
|
|
184
|
+
import_types.ErrorType.THIRD_PARTY,
|
|
185
|
+
message2,
|
|
186
|
+
buildContext(input, extractProviderErrorDetails(input)),
|
|
187
|
+
void 0,
|
|
188
|
+
void 0,
|
|
189
|
+
"non_retryable"
|
|
190
|
+
);
|
|
191
|
+
}
|
|
178
192
|
if (isInvalidSchemaMessage(message2)) {
|
|
179
193
|
return new import_DextoRuntimeError.DextoRuntimeError(
|
|
180
194
|
import_error_codes.LLMErrorCode.REQUEST_INVALID_SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-error.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-error.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5C,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider-error.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-error.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5C,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAmLF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,qBAAqB,GAAG,uBAAuB,CAuBjG;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,KAAK,CA4EpE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../chunk-C6A6W6XS.js";
|
|
2
|
-
import { APICallError } from "ai";
|
|
2
|
+
import { APICallError, UnsupportedFunctionalityError } from "ai";
|
|
3
3
|
import { DextoRuntimeError } from "../../errors/DextoRuntimeError.js";
|
|
4
4
|
import { ErrorScope, ErrorType } from "../../errors/types.js";
|
|
5
5
|
import { LLMErrorCode } from "../error-codes.js";
|
|
@@ -74,7 +74,9 @@ function providerMessage(details, fallback) {
|
|
|
74
74
|
return details.openRouterProviderRawMessage ?? details.openRouterErrorMessage ?? details.responseBody ?? fallback;
|
|
75
75
|
}
|
|
76
76
|
function messageFromUnknown(value) {
|
|
77
|
-
|
|
77
|
+
if (value instanceof Error) return value.message;
|
|
78
|
+
if (isRecord(value)) return readString(value.message) ?? String(value);
|
|
79
|
+
return String(value);
|
|
78
80
|
}
|
|
79
81
|
function isInvalidSchemaMessage(message) {
|
|
80
82
|
return message.includes("Invalid schema for function") || message.includes("invalid_function_parameters") || message.includes("schema must have type");
|
|
@@ -152,6 +154,18 @@ function mapProviderError(input) {
|
|
|
152
154
|
if (input.error instanceof DextoRuntimeError) return input.error;
|
|
153
155
|
if (!APICallError.isInstance?.(input.error)) {
|
|
154
156
|
const message2 = messageFromUnknown(input.error);
|
|
157
|
+
if (UnsupportedFunctionalityError.isInstance(input.error)) {
|
|
158
|
+
return new DextoRuntimeError(
|
|
159
|
+
LLMErrorCode.GENERATION_FAILED,
|
|
160
|
+
ErrorScope.LLM,
|
|
161
|
+
ErrorType.THIRD_PARTY,
|
|
162
|
+
message2,
|
|
163
|
+
buildContext(input, extractProviderErrorDetails(input)),
|
|
164
|
+
void 0,
|
|
165
|
+
void 0,
|
|
166
|
+
"non_retryable"
|
|
167
|
+
);
|
|
168
|
+
}
|
|
155
169
|
if (isInvalidSchemaMessage(message2)) {
|
|
156
170
|
return new DextoRuntimeError(
|
|
157
171
|
LLMErrorCode.REQUEST_INVALID_SCHEMA,
|
|
@@ -118,11 +118,11 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
118
118
|
return void 0;
|
|
119
119
|
}
|
|
120
120
|
if (reasoningVariant === "disabled") {
|
|
121
|
-
return {
|
|
121
|
+
return { openrouter: { include_reasoning: false } };
|
|
122
122
|
}
|
|
123
123
|
if (budgetTokens !== void 0) {
|
|
124
124
|
return {
|
|
125
|
-
|
|
125
|
+
openrouter: {
|
|
126
126
|
include_reasoning: true,
|
|
127
127
|
reasoning: { enabled: true, max_tokens: budgetTokens }
|
|
128
128
|
}
|
|
@@ -131,7 +131,7 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
131
131
|
if (profile.paradigm === "budget") {
|
|
132
132
|
if (reasoningVariant === void 0 || reasoningVariant === "enabled") {
|
|
133
133
|
return {
|
|
134
|
-
|
|
134
|
+
openrouter: {
|
|
135
135
|
include_reasoning: true
|
|
136
136
|
}
|
|
137
137
|
};
|
|
@@ -140,7 +140,7 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
140
140
|
}
|
|
141
141
|
const effort = toOpenAIReasoningEffort(reasoningVariant);
|
|
142
142
|
return {
|
|
143
|
-
|
|
143
|
+
openrouter: {
|
|
144
144
|
include_reasoning: true,
|
|
145
145
|
...effort !== void 0 ? { reasoning: { enabled: true, effort } } : {}
|
|
146
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-options.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAelE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAC9C;
|
|
1
|
+
{"version":3,"file":"provider-options.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAelE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAC9C;AA8LD,wBAAgB,iCAAiC,CAC7C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GACrE,MAAM,GAAG,SAAS,CA6BpB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,qBAAqB,GAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CA4IrD"}
|
|
@@ -106,11 +106,11 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
106
106
|
return void 0;
|
|
107
107
|
}
|
|
108
108
|
if (reasoningVariant === "disabled") {
|
|
109
|
-
return {
|
|
109
|
+
return { openrouter: { include_reasoning: false } };
|
|
110
110
|
}
|
|
111
111
|
if (budgetTokens !== void 0) {
|
|
112
112
|
return {
|
|
113
|
-
|
|
113
|
+
openrouter: {
|
|
114
114
|
include_reasoning: true,
|
|
115
115
|
reasoning: { enabled: true, max_tokens: budgetTokens }
|
|
116
116
|
}
|
|
@@ -119,7 +119,7 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
119
119
|
if (profile.paradigm === "budget") {
|
|
120
120
|
if (reasoningVariant === void 0 || reasoningVariant === "enabled") {
|
|
121
121
|
return {
|
|
122
|
-
|
|
122
|
+
openrouter: {
|
|
123
123
|
include_reasoning: true
|
|
124
124
|
}
|
|
125
125
|
};
|
|
@@ -128,7 +128,7 @@ function buildOpenRouterProviderOptions(config) {
|
|
|
128
128
|
}
|
|
129
129
|
const effort = toOpenAIReasoningEffort(reasoningVariant);
|
|
130
130
|
return {
|
|
131
|
-
|
|
131
|
+
openrouter: {
|
|
132
132
|
include_reasoning: true,
|
|
133
133
|
...effort !== void 0 ? { reasoning: { enabled: true, effort } } : {}
|
|
134
134
|
}
|
|
@@ -239,14 +239,15 @@ async function createVercelModel(llmConfig, context) {
|
|
|
239
239
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
240
240
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
241
241
|
}
|
|
242
|
-
const {
|
|
243
|
-
const provider2 =
|
|
244
|
-
name: "dexto-nova",
|
|
242
|
+
const { createOpenRouter } = await import("@openrouter/ai-sdk-provider");
|
|
243
|
+
const provider2 = createOpenRouter({
|
|
245
244
|
baseURL: dextoBaseURL,
|
|
245
|
+
compatibility: "strict",
|
|
246
246
|
headers,
|
|
247
|
-
...apiKey?.trim() ? { apiKey } : {}
|
|
247
|
+
...apiKey?.trim() ? { apiKey } : {},
|
|
248
|
+
...runtimeFetch ? { fetch: runtimeFetch } : {}
|
|
248
249
|
});
|
|
249
|
-
const chatModel = provider2.
|
|
250
|
+
const chatModel = provider2.chat(model);
|
|
250
251
|
if (!isLanguageModel(chatModel)) {
|
|
251
252
|
throw import_errors.LLMError.generationFailed(
|
|
252
253
|
"Dexto gateway provider returned an invalid language model instance",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACR,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAoHpB;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACR,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAoHpB;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,OAAO,CAAC,aAAa,CAAC,CAkUxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,EAChC,oBAAoB,CAAC,EAAE,oBAAoB,GAC5C,OAAO,CAAC,gBAAgB,CAAC,CAwC3B"}
|
|
@@ -211,14 +211,15 @@ async function createVercelModel(llmConfig, context) {
|
|
|
211
211
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
212
212
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
213
213
|
}
|
|
214
|
-
const {
|
|
215
|
-
const provider2 =
|
|
216
|
-
name: "dexto-nova",
|
|
214
|
+
const { createOpenRouter } = await import("@openrouter/ai-sdk-provider");
|
|
215
|
+
const provider2 = createOpenRouter({
|
|
217
216
|
baseURL: dextoBaseURL,
|
|
217
|
+
compatibility: "strict",
|
|
218
218
|
headers,
|
|
219
|
-
...apiKey?.trim() ? { apiKey } : {}
|
|
219
|
+
...apiKey?.trim() ? { apiKey } : {},
|
|
220
|
+
...runtimeFetch ? { fetch: runtimeFetch } : {}
|
|
220
221
|
});
|
|
221
|
-
const chatModel = provider2.
|
|
222
|
+
const chatModel = provider2.chat(model);
|
|
222
223
|
if (!isLanguageModel(chatModel)) {
|
|
223
224
|
throw LLMError.generationFailed(
|
|
224
225
|
"Dexto gateway provider returned an invalid language model instance",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"nanoid": "^5.1.6",
|
|
163
163
|
"winston": "^3.17.0",
|
|
164
164
|
"yaml": "^2.8.3",
|
|
165
|
-
"@dexto/llm": "1.9.
|
|
165
|
+
"@dexto/llm": "1.9.8"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
168
|
"@opentelemetry/context-async-hooks": "^1.28.0",
|