@xyd-js/ask-ai-edge 0.0.0-build-52f9bb2-20251012023142 → 0.0.0-build-2bb31f3-20251012215032
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/index.js +1775 -1456
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __export = (target, all) => {
|
|
|
27
27
|
};
|
|
28
28
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
29
29
|
|
|
30
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
30
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-context.js
|
|
31
31
|
var require_get_context = __commonJS((exports, module) => {
|
|
32
32
|
var __defProp2 = Object.defineProperty;
|
|
33
33
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -59,7 +59,7 @@ var require_get_context = __commonJS((exports, module) => {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
62
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/token-error.js
|
|
63
63
|
var require_token_error = __commonJS((exports, module) => {
|
|
64
64
|
var __defProp2 = Object.defineProperty;
|
|
65
65
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -99,7 +99,7 @@ var require_token_error = __commonJS((exports, module) => {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
102
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/token-io.js
|
|
103
103
|
var require_token_io = __commonJS((exports, module) => {
|
|
104
104
|
var __create2 = Object.create;
|
|
105
105
|
var __defProp2 = Object.defineProperty;
|
|
@@ -166,7 +166,7 @@ var require_token_io = __commonJS((exports, module) => {
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
169
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/token-util.js
|
|
170
170
|
var require_token_util = __commonJS((exports, module) => {
|
|
171
171
|
var __create2 = Object.create;
|
|
172
172
|
var __defProp2 = Object.defineProperty;
|
|
@@ -322,7 +322,7 @@ var require_token_util = __commonJS((exports, module) => {
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
325
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/token.js
|
|
326
326
|
var require_token = __commonJS((exports, module) => {
|
|
327
327
|
var __defProp2 = Object.defineProperty;
|
|
328
328
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -370,7 +370,7 @@ var require_token = __commonJS((exports, module) => {
|
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
373
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
|
|
374
374
|
var require_get_vercel_oidc_token = __commonJS((exports, module) => {
|
|
375
375
|
var __defProp2 = Object.defineProperty;
|
|
376
376
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -432,7 +432,7 @@ ${error40.message}`;
|
|
|
432
432
|
}
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
435
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/index.js
|
|
436
436
|
var require_dist = __commonJS((exports, module) => {
|
|
437
437
|
var __defProp2 = Object.defineProperty;
|
|
438
438
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -13293,12 +13293,6 @@ function date4(params) {
|
|
|
13293
13293
|
|
|
13294
13294
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
|
|
13295
13295
|
config(en_default());
|
|
13296
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/index.js
|
|
13297
|
-
var classic_default = exports_external;
|
|
13298
|
-
|
|
13299
|
-
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/index.js
|
|
13300
|
-
var v4_default = classic_default;
|
|
13301
|
-
|
|
13302
13296
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
13303
13297
|
var util;
|
|
13304
13298
|
(function(util2) {
|
|
@@ -17109,7 +17103,7 @@ var optionalType = ZodOptional2.create;
|
|
|
17109
17103
|
var nullableType = ZodNullable2.create;
|
|
17110
17104
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
17111
17105
|
var pipelineType = ZodPipeline.create;
|
|
17112
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.
|
|
17106
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.12_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
17113
17107
|
function combineHeaders(...headers) {
|
|
17114
17108
|
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
17115
17109
|
...combinedHeaders,
|
|
@@ -17147,32 +17141,6 @@ function createAbortError() {
|
|
|
17147
17141
|
function extractResponseHeaders(response) {
|
|
17148
17142
|
return Object.fromEntries([...response.headers]);
|
|
17149
17143
|
}
|
|
17150
|
-
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
17151
|
-
var _a15, _b, _c;
|
|
17152
|
-
if (globalThisAny.window) {
|
|
17153
|
-
return `runtime/browser`;
|
|
17154
|
-
}
|
|
17155
|
-
if ((_a15 = globalThisAny.navigator) == null ? undefined : _a15.userAgent) {
|
|
17156
|
-
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
17157
|
-
}
|
|
17158
|
-
if ((_c = (_b = globalThisAny.process) == null ? undefined : _b.versions) == null ? undefined : _c.node) {
|
|
17159
|
-
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
17160
|
-
}
|
|
17161
|
-
if (globalThisAny.EdgeRuntime) {
|
|
17162
|
-
return `runtime/vercel-edge`;
|
|
17163
|
-
}
|
|
17164
|
-
return "runtime/unknown";
|
|
17165
|
-
}
|
|
17166
|
-
function removeUndefinedEntries(record2) {
|
|
17167
|
-
return Object.fromEntries(Object.entries(record2).filter(([_key, value]) => value != null));
|
|
17168
|
-
}
|
|
17169
|
-
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
17170
|
-
const cleanedHeaders = removeUndefinedEntries(headers != null ? headers : {});
|
|
17171
|
-
const normalizedHeaders = new Headers(cleanedHeaders);
|
|
17172
|
-
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
17173
|
-
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
17174
|
-
return Object.fromEntries(normalizedHeaders);
|
|
17175
|
-
}
|
|
17176
17144
|
var createIdGenerator = ({
|
|
17177
17145
|
prefix,
|
|
17178
17146
|
size = 16,
|
|
@@ -17237,7 +17205,33 @@ function handleFetchError({
|
|
|
17237
17205
|
}
|
|
17238
17206
|
return error40;
|
|
17239
17207
|
}
|
|
17240
|
-
|
|
17208
|
+
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
17209
|
+
var _a15, _b, _c;
|
|
17210
|
+
if (globalThisAny.window) {
|
|
17211
|
+
return `runtime/browser`;
|
|
17212
|
+
}
|
|
17213
|
+
if ((_a15 = globalThisAny.navigator) == null ? undefined : _a15.userAgent) {
|
|
17214
|
+
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
17215
|
+
}
|
|
17216
|
+
if ((_c = (_b = globalThisAny.process) == null ? undefined : _b.versions) == null ? undefined : _c.node) {
|
|
17217
|
+
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
17218
|
+
}
|
|
17219
|
+
if (globalThisAny.EdgeRuntime) {
|
|
17220
|
+
return `runtime/vercel-edge`;
|
|
17221
|
+
}
|
|
17222
|
+
return "runtime/unknown";
|
|
17223
|
+
}
|
|
17224
|
+
function removeUndefinedEntries(record2) {
|
|
17225
|
+
return Object.fromEntries(Object.entries(record2).filter(([_key, value]) => value != null));
|
|
17226
|
+
}
|
|
17227
|
+
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
17228
|
+
const cleanedHeaders = removeUndefinedEntries(headers != null ? headers : {});
|
|
17229
|
+
const normalizedHeaders = new Headers(cleanedHeaders);
|
|
17230
|
+
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
17231
|
+
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
17232
|
+
return Object.fromEntries(normalizedHeaders);
|
|
17233
|
+
}
|
|
17234
|
+
var VERSION = "3.0.12";
|
|
17241
17235
|
var getOriginalFetch = () => globalThis.fetch;
|
|
17242
17236
|
var getFromApi = async ({
|
|
17243
17237
|
url: url2,
|
|
@@ -17423,8 +17417,17 @@ function validator(validate) {
|
|
|
17423
17417
|
function isValidator(value) {
|
|
17424
17418
|
return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
|
|
17425
17419
|
}
|
|
17420
|
+
function lazyValidator(createValidator) {
|
|
17421
|
+
let validator2;
|
|
17422
|
+
return () => {
|
|
17423
|
+
if (validator2 == null) {
|
|
17424
|
+
validator2 = createValidator();
|
|
17425
|
+
}
|
|
17426
|
+
return validator2;
|
|
17427
|
+
};
|
|
17428
|
+
}
|
|
17426
17429
|
function asValidator(value) {
|
|
17427
|
-
return isValidator(value) ? value : standardSchemaValidator(value);
|
|
17430
|
+
return isValidator(value) ? value : typeof value === "function" ? value() : standardSchemaValidator(value);
|
|
17428
17431
|
}
|
|
17429
17432
|
function standardSchemaValidator(standardSchema) {
|
|
17430
17433
|
return validator(async (value) => {
|
|
@@ -18844,7 +18847,7 @@ var zod_to_json_schema_default = zodToJsonSchema;
|
|
|
18844
18847
|
function zod3Schema(zodSchema2, options) {
|
|
18845
18848
|
var _a15;
|
|
18846
18849
|
const useReferences = (_a15 = options == null ? undefined : options.useReferences) != null ? _a15 : false;
|
|
18847
|
-
return jsonSchema(zod_to_json_schema_default(zodSchema2, {
|
|
18850
|
+
return jsonSchema(() => zod_to_json_schema_default(zodSchema2, {
|
|
18848
18851
|
$refStrategy: useReferences ? "root" : "none"
|
|
18849
18852
|
}), {
|
|
18850
18853
|
validate: async (value) => {
|
|
@@ -18856,12 +18859,11 @@ function zod3Schema(zodSchema2, options) {
|
|
|
18856
18859
|
function zod4Schema(zodSchema2, options) {
|
|
18857
18860
|
var _a15;
|
|
18858
18861
|
const useReferences = (_a15 = options == null ? undefined : options.useReferences) != null ? _a15 : false;
|
|
18859
|
-
|
|
18862
|
+
return jsonSchema(() => toJSONSchema(zodSchema2, {
|
|
18860
18863
|
target: "draft-7",
|
|
18861
18864
|
io: "output",
|
|
18862
18865
|
reused: useReferences ? "ref" : "inline"
|
|
18863
|
-
})
|
|
18864
|
-
return jsonSchema(z4JSONSchema, {
|
|
18866
|
+
}), {
|
|
18865
18867
|
validate: async (value) => {
|
|
18866
18868
|
const result = await safeParseAsync2(zodSchema2, value);
|
|
18867
18869
|
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
@@ -18879,6 +18881,15 @@ function zodSchema(zodSchema2, options) {
|
|
|
18879
18881
|
}
|
|
18880
18882
|
}
|
|
18881
18883
|
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
|
18884
|
+
function lazySchema(createSchema) {
|
|
18885
|
+
let schema;
|
|
18886
|
+
return () => {
|
|
18887
|
+
if (schema == null) {
|
|
18888
|
+
schema = createSchema();
|
|
18889
|
+
}
|
|
18890
|
+
return schema;
|
|
18891
|
+
};
|
|
18892
|
+
}
|
|
18882
18893
|
function jsonSchema(jsonSchema2, {
|
|
18883
18894
|
validate
|
|
18884
18895
|
} = {}) {
|
|
@@ -18886,7 +18897,12 @@ function jsonSchema(jsonSchema2, {
|
|
|
18886
18897
|
[schemaSymbol]: true,
|
|
18887
18898
|
_type: undefined,
|
|
18888
18899
|
[validatorSymbol]: true,
|
|
18889
|
-
jsonSchema
|
|
18900
|
+
get jsonSchema() {
|
|
18901
|
+
if (typeof jsonSchema2 === "function") {
|
|
18902
|
+
jsonSchema2 = jsonSchema2();
|
|
18903
|
+
}
|
|
18904
|
+
return jsonSchema2;
|
|
18905
|
+
},
|
|
18890
18906
|
validate
|
|
18891
18907
|
};
|
|
18892
18908
|
}
|
|
@@ -18897,7 +18913,7 @@ function asSchema(schema) {
|
|
|
18897
18913
|
return schema == null ? jsonSchema({
|
|
18898
18914
|
properties: {},
|
|
18899
18915
|
additionalProperties: false
|
|
18900
|
-
}) : isSchema(schema) ? schema : zodSchema(schema);
|
|
18916
|
+
}) : isSchema(schema) ? schema : typeof schema === "function" ? schema() : zodSchema(schema);
|
|
18901
18917
|
}
|
|
18902
18918
|
var { btoa: btoa2, atob: atob2 } = globalThis;
|
|
18903
18919
|
function convertBase64ToUint8Array(base64String) {
|
|
@@ -18939,7 +18955,7 @@ async function* executeTool({
|
|
|
18939
18955
|
}
|
|
18940
18956
|
}
|
|
18941
18957
|
|
|
18942
|
-
// ../../node_modules/.pnpm/@ai-sdk+gateway@1.0.
|
|
18958
|
+
// ../../node_modules/.pnpm/@ai-sdk+gateway@1.0.39_zod@3.25.76/node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
18943
18959
|
var import_oidc = __toESM(require_dist(), 1);
|
|
18944
18960
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
18945
18961
|
var marker15 = "vercel.ai.gateway.error";
|
|
@@ -19072,9 +19088,9 @@ var GatewayRateLimitError = class extends (_b4 = GatewayError, _a42 = symbol42,
|
|
|
19072
19088
|
var name42 = "GatewayModelNotFoundError";
|
|
19073
19089
|
var marker52 = `vercel.ai.gateway.error.${name42}`;
|
|
19074
19090
|
var symbol52 = Symbol.for(marker52);
|
|
19075
|
-
var modelNotFoundParamSchema = exports_external.object({
|
|
19091
|
+
var modelNotFoundParamSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
19076
19092
|
modelId: exports_external.string()
|
|
19077
|
-
});
|
|
19093
|
+
})));
|
|
19078
19094
|
var _a52;
|
|
19079
19095
|
var _b5;
|
|
19080
19096
|
var GatewayModelNotFoundError = class extends (_b5 = GatewayError, _a52 = symbol52, _b5) {
|
|
@@ -19138,14 +19154,17 @@ var GatewayResponseError = class extends (_b7 = GatewayError, _a72 = symbol72, _
|
|
|
19138
19154
|
return GatewayError.hasMarker(error40) && symbol72 in error40;
|
|
19139
19155
|
}
|
|
19140
19156
|
};
|
|
19141
|
-
function createGatewayErrorFromResponse({
|
|
19157
|
+
async function createGatewayErrorFromResponse({
|
|
19142
19158
|
response,
|
|
19143
19159
|
statusCode,
|
|
19144
19160
|
defaultMessage = "Gateway request failed",
|
|
19145
19161
|
cause,
|
|
19146
19162
|
authMethod
|
|
19147
19163
|
}) {
|
|
19148
|
-
const parseResult =
|
|
19164
|
+
const parseResult = await safeValidateTypes({
|
|
19165
|
+
value: response,
|
|
19166
|
+
schema: gatewayErrorResponseSchema
|
|
19167
|
+
});
|
|
19149
19168
|
if (!parseResult.success) {
|
|
19150
19169
|
return new GatewayResponseError({
|
|
19151
19170
|
message: `Invalid error response format: ${defaultMessage}`,
|
|
@@ -19155,7 +19174,7 @@ function createGatewayErrorFromResponse({
|
|
|
19155
19174
|
cause
|
|
19156
19175
|
});
|
|
19157
19176
|
}
|
|
19158
|
-
const validatedResponse = parseResult.
|
|
19177
|
+
const validatedResponse = parseResult.value;
|
|
19159
19178
|
const errorType = validatedResponse.error.type;
|
|
19160
19179
|
const message = validatedResponse.error.message;
|
|
19161
19180
|
switch (errorType) {
|
|
@@ -19171,11 +19190,14 @@ function createGatewayErrorFromResponse({
|
|
|
19171
19190
|
case "rate_limit_exceeded":
|
|
19172
19191
|
return new GatewayRateLimitError({ message, statusCode, cause });
|
|
19173
19192
|
case "model_not_found": {
|
|
19174
|
-
const modelResult =
|
|
19193
|
+
const modelResult = await safeValidateTypes({
|
|
19194
|
+
value: validatedResponse.error.param,
|
|
19195
|
+
schema: modelNotFoundParamSchema
|
|
19196
|
+
});
|
|
19175
19197
|
return new GatewayModelNotFoundError({
|
|
19176
19198
|
message,
|
|
19177
19199
|
statusCode,
|
|
19178
|
-
modelId: modelResult.success ? modelResult.
|
|
19200
|
+
modelId: modelResult.success ? modelResult.value.modelId : undefined,
|
|
19179
19201
|
cause
|
|
19180
19202
|
});
|
|
19181
19203
|
}
|
|
@@ -19185,14 +19207,14 @@ function createGatewayErrorFromResponse({
|
|
|
19185
19207
|
return new GatewayInternalServerError({ message, statusCode, cause });
|
|
19186
19208
|
}
|
|
19187
19209
|
}
|
|
19188
|
-
var gatewayErrorResponseSchema = exports_external.object({
|
|
19210
|
+
var gatewayErrorResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
19189
19211
|
error: exports_external.object({
|
|
19190
19212
|
message: exports_external.string(),
|
|
19191
19213
|
type: exports_external.string().nullish(),
|
|
19192
19214
|
param: exports_external.unknown().nullish(),
|
|
19193
19215
|
code: exports_external.union([exports_external.string(), exports_external.number()]).nullish()
|
|
19194
19216
|
})
|
|
19195
|
-
});
|
|
19217
|
+
})));
|
|
19196
19218
|
function asGatewayError(error40, authMethod) {
|
|
19197
19219
|
var _a82;
|
|
19198
19220
|
if (GatewayError.isInstance(error40)) {
|
|
@@ -19229,14 +19251,14 @@ function extractApiCallResponse(error40) {
|
|
|
19229
19251
|
return {};
|
|
19230
19252
|
}
|
|
19231
19253
|
var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
|
|
19232
|
-
function parseAuthMethod(headers) {
|
|
19233
|
-
const result =
|
|
19234
|
-
|
|
19254
|
+
async function parseAuthMethod(headers) {
|
|
19255
|
+
const result = await safeValidateTypes({
|
|
19256
|
+
value: headers[GATEWAY_AUTH_METHOD_HEADER],
|
|
19257
|
+
schema: gatewayAuthMethodSchema
|
|
19258
|
+
});
|
|
19259
|
+
return result.success ? result.value : undefined;
|
|
19235
19260
|
}
|
|
19236
|
-
var gatewayAuthMethodSchema = exports_external.union([
|
|
19237
|
-
exports_external.literal("api-key"),
|
|
19238
|
-
exports_external.literal("oidc")
|
|
19239
|
-
]);
|
|
19261
|
+
var gatewayAuthMethodSchema = lazyValidator(() => zodSchema(exports_external.union([exports_external.literal("api-key"), exports_external.literal("oidc")])));
|
|
19240
19262
|
var GatewayFetchMetadata = class {
|
|
19241
19263
|
constructor(config2) {
|
|
19242
19264
|
this.config = config2;
|
|
@@ -19246,7 +19268,7 @@ var GatewayFetchMetadata = class {
|
|
|
19246
19268
|
const { value } = await getFromApi({
|
|
19247
19269
|
url: `${this.config.baseURL}/config`,
|
|
19248
19270
|
headers: await resolve(this.config.headers()),
|
|
19249
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
19271
|
+
successfulResponseHandler: createJsonResponseHandler(gatewayAvailableModelsResponseSchema),
|
|
19250
19272
|
failedResponseHandler: createJsonErrorResponseHandler({
|
|
19251
19273
|
errorSchema: exports_external.any(),
|
|
19252
19274
|
errorToMessage: (data) => data
|
|
@@ -19255,7 +19277,7 @@ var GatewayFetchMetadata = class {
|
|
|
19255
19277
|
});
|
|
19256
19278
|
return value;
|
|
19257
19279
|
} catch (error40) {
|
|
19258
|
-
throw asGatewayError(error40);
|
|
19280
|
+
throw await asGatewayError(error40);
|
|
19259
19281
|
}
|
|
19260
19282
|
}
|
|
19261
19283
|
async getCredits() {
|
|
@@ -19264,7 +19286,7 @@ var GatewayFetchMetadata = class {
|
|
|
19264
19286
|
const { value } = await getFromApi({
|
|
19265
19287
|
url: `${baseUrl.origin}/v1/credits`,
|
|
19266
19288
|
headers: await resolve(this.config.headers()),
|
|
19267
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
19289
|
+
successfulResponseHandler: createJsonResponseHandler(gatewayCreditsResponseSchema),
|
|
19268
19290
|
failedResponseHandler: createJsonErrorResponseHandler({
|
|
19269
19291
|
errorSchema: exports_external.any(),
|
|
19270
19292
|
errorToMessage: (data) => data
|
|
@@ -19273,44 +19295,41 @@ var GatewayFetchMetadata = class {
|
|
|
19273
19295
|
});
|
|
19274
19296
|
return value;
|
|
19275
19297
|
} catch (error40) {
|
|
19276
|
-
throw asGatewayError(error40);
|
|
19298
|
+
throw await asGatewayError(error40);
|
|
19277
19299
|
}
|
|
19278
19300
|
}
|
|
19279
19301
|
};
|
|
19280
|
-
var
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
}).transform(({ input, output, input_cache_read, input_cache_write }) => ({
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
}))
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
});
|
|
19304
|
-
var
|
|
19305
|
-
models: exports_external.array(gatewayLanguageModelEntrySchema)
|
|
19306
|
-
});
|
|
19307
|
-
var gatewayCreditsSchema = exports_external.object({
|
|
19302
|
+
var gatewayAvailableModelsResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
19303
|
+
models: exports_external.array(exports_external.object({
|
|
19304
|
+
id: exports_external.string(),
|
|
19305
|
+
name: exports_external.string(),
|
|
19306
|
+
description: exports_external.string().nullish(),
|
|
19307
|
+
pricing: exports_external.object({
|
|
19308
|
+
input: exports_external.string(),
|
|
19309
|
+
output: exports_external.string(),
|
|
19310
|
+
input_cache_read: exports_external.string().nullish(),
|
|
19311
|
+
input_cache_write: exports_external.string().nullish()
|
|
19312
|
+
}).transform(({ input, output, input_cache_read, input_cache_write }) => ({
|
|
19313
|
+
input,
|
|
19314
|
+
output,
|
|
19315
|
+
...input_cache_read ? { cachedInputTokens: input_cache_read } : {},
|
|
19316
|
+
...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
|
|
19317
|
+
})).nullish(),
|
|
19318
|
+
specification: exports_external.object({
|
|
19319
|
+
specificationVersion: exports_external.literal("v2"),
|
|
19320
|
+
provider: exports_external.string(),
|
|
19321
|
+
modelId: exports_external.string()
|
|
19322
|
+
}),
|
|
19323
|
+
modelType: exports_external.enum(["language", "embedding", "image"]).nullish()
|
|
19324
|
+
}))
|
|
19325
|
+
})));
|
|
19326
|
+
var gatewayCreditsResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
19308
19327
|
balance: exports_external.string(),
|
|
19309
19328
|
total_used: exports_external.string()
|
|
19310
19329
|
}).transform(({ balance, total_used }) => ({
|
|
19311
19330
|
balance,
|
|
19312
19331
|
totalUsed: total_used
|
|
19313
|
-
}));
|
|
19332
|
+
}))));
|
|
19314
19333
|
var GatewayLanguageModel = class {
|
|
19315
19334
|
constructor(modelId, config2) {
|
|
19316
19335
|
this.modelId = modelId;
|
|
@@ -19356,7 +19375,7 @@ var GatewayLanguageModel = class {
|
|
|
19356
19375
|
warnings
|
|
19357
19376
|
};
|
|
19358
19377
|
} catch (error40) {
|
|
19359
|
-
throw asGatewayError(error40, parseAuthMethod(resolvedHeaders));
|
|
19378
|
+
throw await asGatewayError(error40, await parseAuthMethod(resolvedHeaders));
|
|
19360
19379
|
}
|
|
19361
19380
|
}
|
|
19362
19381
|
async doStream(options) {
|
|
@@ -19402,7 +19421,7 @@ var GatewayLanguageModel = class {
|
|
|
19402
19421
|
response: { headers: responseHeaders }
|
|
19403
19422
|
};
|
|
19404
19423
|
} catch (error40) {
|
|
19405
|
-
throw asGatewayError(error40, parseAuthMethod(resolvedHeaders));
|
|
19424
|
+
throw await asGatewayError(error40, await parseAuthMethod(resolvedHeaders));
|
|
19406
19425
|
}
|
|
19407
19426
|
}
|
|
19408
19427
|
isFilePart(part) {
|
|
@@ -19480,7 +19499,7 @@ var GatewayEmbeddingModel = class {
|
|
|
19480
19499
|
response: { headers: responseHeaders, body: rawValue }
|
|
19481
19500
|
};
|
|
19482
19501
|
} catch (error40) {
|
|
19483
|
-
throw asGatewayError(error40, parseAuthMethod(resolvedHeaders));
|
|
19502
|
+
throw await asGatewayError(error40, await parseAuthMethod(resolvedHeaders));
|
|
19484
19503
|
}
|
|
19485
19504
|
}
|
|
19486
19505
|
getUrl() {
|
|
@@ -19493,16 +19512,16 @@ var GatewayEmbeddingModel = class {
|
|
|
19493
19512
|
};
|
|
19494
19513
|
}
|
|
19495
19514
|
};
|
|
19496
|
-
var gatewayEmbeddingResponseSchema = exports_external.object({
|
|
19515
|
+
var gatewayEmbeddingResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
19497
19516
|
embeddings: exports_external.array(exports_external.array(exports_external.number())),
|
|
19498
19517
|
usage: exports_external.object({ tokens: exports_external.number() }).nullish(),
|
|
19499
19518
|
providerMetadata: exports_external.record(exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())).optional()
|
|
19500
|
-
});
|
|
19519
|
+
})));
|
|
19501
19520
|
async function getVercelRequestId() {
|
|
19502
19521
|
var _a82;
|
|
19503
19522
|
return (_a82 = import_oidc.getContext().headers) == null ? undefined : _a82["x-vercel-id"];
|
|
19504
19523
|
}
|
|
19505
|
-
var VERSION2 = "1.0.
|
|
19524
|
+
var VERSION2 = "1.0.39";
|
|
19506
19525
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
19507
19526
|
function createGatewayProvider(options = {}) {
|
|
19508
19527
|
var _a82, _b8;
|
|
@@ -19572,7 +19591,7 @@ function createGatewayProvider(options = {}) {
|
|
|
19572
19591
|
metadataCache = metadata;
|
|
19573
19592
|
return metadata;
|
|
19574
19593
|
}).catch(async (error40) => {
|
|
19575
|
-
throw asGatewayError(error40, parseAuthMethod(await getHeaders()));
|
|
19594
|
+
throw await asGatewayError(error40, await parseAuthMethod(await getHeaders()));
|
|
19576
19595
|
});
|
|
19577
19596
|
}
|
|
19578
19597
|
return metadataCache ? Promise.resolve(metadataCache) : pendingMetadata;
|
|
@@ -19583,7 +19602,7 @@ function createGatewayProvider(options = {}) {
|
|
|
19583
19602
|
headers: getHeaders,
|
|
19584
19603
|
fetch: options.fetch
|
|
19585
19604
|
}).getCredits().catch(async (error40) => {
|
|
19586
|
-
throw asGatewayError(error40, parseAuthMethod(await getHeaders()));
|
|
19605
|
+
throw await asGatewayError(error40, await parseAuthMethod(await getHeaders()));
|
|
19587
19606
|
});
|
|
19588
19607
|
};
|
|
19589
19608
|
const provider = function(modelId) {
|
|
@@ -19632,7 +19651,7 @@ async function getGatewayAuthToken(options) {
|
|
|
19632
19651
|
}
|
|
19633
19652
|
}
|
|
19634
19653
|
|
|
19635
|
-
// ../../node_modules/.pnpm/ai@5.0.
|
|
19654
|
+
// ../../node_modules/.pnpm/ai@5.0.68_zod@3.25.76/node_modules/ai/dist/index.mjs
|
|
19636
19655
|
var import_api2 = __toESM(require_src(), 1);
|
|
19637
19656
|
var import_api3 = __toESM(require_src(), 1);
|
|
19638
19657
|
var __defProp2 = Object.defineProperty;
|
|
@@ -19759,10 +19778,14 @@ var MCPClientError = class extends AISDKError {
|
|
|
19759
19778
|
constructor({
|
|
19760
19779
|
name: name17 = "MCPClientError",
|
|
19761
19780
|
message,
|
|
19762
|
-
cause
|
|
19781
|
+
cause,
|
|
19782
|
+
data,
|
|
19783
|
+
code
|
|
19763
19784
|
}) {
|
|
19764
19785
|
super({ name: name17, message, cause });
|
|
19765
19786
|
this[_a53] = true;
|
|
19787
|
+
this.data = data;
|
|
19788
|
+
this.code = code;
|
|
19766
19789
|
}
|
|
19767
19790
|
static isInstance(error40) {
|
|
19768
19791
|
return AISDKError.hasMarker(error40, marker53);
|
|
@@ -20054,7 +20077,7 @@ function detectMediaType({
|
|
|
20054
20077
|
}
|
|
20055
20078
|
return;
|
|
20056
20079
|
}
|
|
20057
|
-
var VERSION3 = "5.0.
|
|
20080
|
+
var VERSION3 = "5.0.68";
|
|
20058
20081
|
var download = async ({ url: url2 }) => {
|
|
20059
20082
|
var _a172;
|
|
20060
20083
|
const urlText = url2.toString();
|
|
@@ -21375,7 +21398,7 @@ function getResponseUIMessageId({
|
|
|
21375
21398
|
const lastMessage = originalMessages[originalMessages.length - 1];
|
|
21376
21399
|
return (lastMessage == null ? undefined : lastMessage.role) === "assistant" ? lastMessage.id : typeof responseMessageId === "function" ? responseMessageId() : responseMessageId;
|
|
21377
21400
|
}
|
|
21378
|
-
var uiMessageChunkSchema = exports_external.union([
|
|
21401
|
+
var uiMessageChunkSchema = lazyValidator(() => zodSchema(exports_external.union([
|
|
21379
21402
|
exports_external.strictObject({
|
|
21380
21403
|
type: exports_external.literal("text-start"),
|
|
21381
21404
|
id: exports_external.string(),
|
|
@@ -21507,7 +21530,7 @@ var uiMessageChunkSchema = exports_external.union([
|
|
|
21507
21530
|
type: exports_external.literal("message-metadata"),
|
|
21508
21531
|
messageMetadata: exports_external.unknown()
|
|
21509
21532
|
})
|
|
21510
|
-
]);
|
|
21533
|
+
])));
|
|
21511
21534
|
function isDataUIMessageChunk(chunk) {
|
|
21512
21535
|
return chunk.type.startsWith("data-");
|
|
21513
21536
|
}
|
|
@@ -23296,15 +23319,15 @@ var DefaultStreamTextResult = class {
|
|
|
23296
23319
|
stepNumber: recordedSteps.length,
|
|
23297
23320
|
messages: stepInputMessages
|
|
23298
23321
|
}));
|
|
23322
|
+
const stepModel = resolveLanguageModel((_a172 = prepareStepResult == null ? undefined : prepareStepResult.model) != null ? _a172 : model);
|
|
23299
23323
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
23300
23324
|
prompt: {
|
|
23301
|
-
system: (
|
|
23302
|
-
messages: (
|
|
23325
|
+
system: (_b8 = prepareStepResult == null ? undefined : prepareStepResult.system) != null ? _b8 : initialPrompt.system,
|
|
23326
|
+
messages: (_c = prepareStepResult == null ? undefined : prepareStepResult.messages) != null ? _c : stepInputMessages
|
|
23303
23327
|
},
|
|
23304
|
-
supportedUrls: await
|
|
23328
|
+
supportedUrls: await stepModel.supportedUrls,
|
|
23305
23329
|
download: download2
|
|
23306
23330
|
});
|
|
23307
|
-
const stepModel = resolveLanguageModel((_c = prepareStepResult == null ? undefined : prepareStepResult.model) != null ? _c : model);
|
|
23308
23331
|
const { toolChoice: stepToolChoice, tools: stepTools } = prepareToolsAndToolChoice({
|
|
23309
23332
|
tools,
|
|
23310
23333
|
toolChoice: (_d = prepareStepResult == null ? undefined : prepareStepResult.toolChoice) != null ? _d : toolChoice,
|
|
@@ -24659,152 +24682,198 @@ var DefaultMCPClient = class {
|
|
|
24659
24682
|
this.responseHandlers.delete(messageId);
|
|
24660
24683
|
handler("result" in response ? response : new MCPClientError({
|
|
24661
24684
|
message: response.error.message,
|
|
24685
|
+
code: response.error.code,
|
|
24686
|
+
data: response.error.data,
|
|
24662
24687
|
cause: response.error
|
|
24663
24688
|
}));
|
|
24664
24689
|
}
|
|
24665
24690
|
};
|
|
24666
|
-
var
|
|
24667
|
-
type: exports_external.literal("text"),
|
|
24668
|
-
text: exports_external.string(),
|
|
24669
|
-
state: exports_external.enum(["streaming", "done"]).optional(),
|
|
24670
|
-
providerMetadata: providerMetadataSchema.optional()
|
|
24671
|
-
});
|
|
24672
|
-
var reasoningUIPartSchema = exports_external.object({
|
|
24673
|
-
type: exports_external.literal("reasoning"),
|
|
24674
|
-
text: exports_external.string(),
|
|
24675
|
-
state: exports_external.enum(["streaming", "done"]).optional(),
|
|
24676
|
-
providerMetadata: providerMetadataSchema.optional()
|
|
24677
|
-
});
|
|
24678
|
-
var sourceUrlUIPartSchema = exports_external.object({
|
|
24679
|
-
type: exports_external.literal("source-url"),
|
|
24680
|
-
sourceId: exports_external.string(),
|
|
24681
|
-
url: exports_external.string(),
|
|
24682
|
-
title: exports_external.string().optional(),
|
|
24683
|
-
providerMetadata: providerMetadataSchema.optional()
|
|
24684
|
-
});
|
|
24685
|
-
var sourceDocumentUIPartSchema = exports_external.object({
|
|
24686
|
-
type: exports_external.literal("source-document"),
|
|
24687
|
-
sourceId: exports_external.string(),
|
|
24688
|
-
mediaType: exports_external.string(),
|
|
24689
|
-
title: exports_external.string(),
|
|
24690
|
-
filename: exports_external.string().optional(),
|
|
24691
|
-
providerMetadata: providerMetadataSchema.optional()
|
|
24692
|
-
});
|
|
24693
|
-
var fileUIPartSchema = exports_external.object({
|
|
24694
|
-
type: exports_external.literal("file"),
|
|
24695
|
-
mediaType: exports_external.string(),
|
|
24696
|
-
filename: exports_external.string().optional(),
|
|
24697
|
-
url: exports_external.string(),
|
|
24698
|
-
providerMetadata: providerMetadataSchema.optional()
|
|
24699
|
-
});
|
|
24700
|
-
var stepStartUIPartSchema = exports_external.object({
|
|
24701
|
-
type: exports_external.literal("step-start")
|
|
24702
|
-
});
|
|
24703
|
-
var dataUIPartSchema = exports_external.object({
|
|
24704
|
-
type: exports_external.string().startsWith("data-"),
|
|
24705
|
-
id: exports_external.string().optional(),
|
|
24706
|
-
data: exports_external.unknown()
|
|
24707
|
-
});
|
|
24708
|
-
var dynamicToolUIPartSchemas = [
|
|
24709
|
-
exports_external.object({
|
|
24710
|
-
type: exports_external.literal("dynamic-tool"),
|
|
24711
|
-
toolName: exports_external.string(),
|
|
24712
|
-
toolCallId: exports_external.string(),
|
|
24713
|
-
state: exports_external.literal("input-streaming"),
|
|
24714
|
-
input: exports_external.unknown().optional(),
|
|
24715
|
-
output: exports_external.never().optional(),
|
|
24716
|
-
errorText: exports_external.never().optional()
|
|
24717
|
-
}),
|
|
24718
|
-
exports_external.object({
|
|
24719
|
-
type: exports_external.literal("dynamic-tool"),
|
|
24720
|
-
toolName: exports_external.string(),
|
|
24721
|
-
toolCallId: exports_external.string(),
|
|
24722
|
-
state: exports_external.literal("input-available"),
|
|
24723
|
-
input: exports_external.unknown(),
|
|
24724
|
-
output: exports_external.never().optional(),
|
|
24725
|
-
errorText: exports_external.never().optional(),
|
|
24726
|
-
callProviderMetadata: providerMetadataSchema.optional()
|
|
24727
|
-
}),
|
|
24728
|
-
exports_external.object({
|
|
24729
|
-
type: exports_external.literal("dynamic-tool"),
|
|
24730
|
-
toolName: exports_external.string(),
|
|
24731
|
-
toolCallId: exports_external.string(),
|
|
24732
|
-
state: exports_external.literal("output-available"),
|
|
24733
|
-
input: exports_external.unknown(),
|
|
24734
|
-
output: exports_external.unknown(),
|
|
24735
|
-
errorText: exports_external.never().optional(),
|
|
24736
|
-
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24737
|
-
preliminary: exports_external.boolean().optional()
|
|
24738
|
-
}),
|
|
24739
|
-
exports_external.object({
|
|
24740
|
-
type: exports_external.literal("dynamic-tool"),
|
|
24741
|
-
toolName: exports_external.string(),
|
|
24742
|
-
toolCallId: exports_external.string(),
|
|
24743
|
-
state: exports_external.literal("output-error"),
|
|
24744
|
-
input: exports_external.unknown(),
|
|
24745
|
-
output: exports_external.never().optional(),
|
|
24746
|
-
errorText: exports_external.string(),
|
|
24747
|
-
callProviderMetadata: providerMetadataSchema.optional()
|
|
24748
|
-
})
|
|
24749
|
-
];
|
|
24750
|
-
var toolUIPartSchemas = [
|
|
24751
|
-
exports_external.object({
|
|
24752
|
-
type: exports_external.string().startsWith("tool-"),
|
|
24753
|
-
toolCallId: exports_external.string(),
|
|
24754
|
-
state: exports_external.literal("input-streaming"),
|
|
24755
|
-
providerExecuted: exports_external.boolean().optional(),
|
|
24756
|
-
input: exports_external.unknown().optional(),
|
|
24757
|
-
output: exports_external.never().optional(),
|
|
24758
|
-
errorText: exports_external.never().optional()
|
|
24759
|
-
}),
|
|
24760
|
-
exports_external.object({
|
|
24761
|
-
type: exports_external.string().startsWith("tool-"),
|
|
24762
|
-
toolCallId: exports_external.string(),
|
|
24763
|
-
state: exports_external.literal("input-available"),
|
|
24764
|
-
providerExecuted: exports_external.boolean().optional(),
|
|
24765
|
-
input: exports_external.unknown(),
|
|
24766
|
-
output: exports_external.never().optional(),
|
|
24767
|
-
errorText: exports_external.never().optional(),
|
|
24768
|
-
callProviderMetadata: providerMetadataSchema.optional()
|
|
24769
|
-
}),
|
|
24770
|
-
exports_external.object({
|
|
24771
|
-
type: exports_external.string().startsWith("tool-"),
|
|
24772
|
-
toolCallId: exports_external.string(),
|
|
24773
|
-
state: exports_external.literal("output-available"),
|
|
24774
|
-
providerExecuted: exports_external.boolean().optional(),
|
|
24775
|
-
input: exports_external.unknown(),
|
|
24776
|
-
output: exports_external.unknown(),
|
|
24777
|
-
errorText: exports_external.never().optional(),
|
|
24778
|
-
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24779
|
-
preliminary: exports_external.boolean().optional()
|
|
24780
|
-
}),
|
|
24781
|
-
exports_external.object({
|
|
24782
|
-
type: exports_external.string().startsWith("tool-"),
|
|
24783
|
-
toolCallId: exports_external.string(),
|
|
24784
|
-
state: exports_external.literal("output-error"),
|
|
24785
|
-
providerExecuted: exports_external.boolean().optional(),
|
|
24786
|
-
input: exports_external.unknown(),
|
|
24787
|
-
output: exports_external.never().optional(),
|
|
24788
|
-
errorText: exports_external.string(),
|
|
24789
|
-
callProviderMetadata: providerMetadataSchema.optional()
|
|
24790
|
-
})
|
|
24791
|
-
];
|
|
24792
|
-
var uiMessageSchema = exports_external.object({
|
|
24691
|
+
var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(exports_external.object({
|
|
24793
24692
|
id: exports_external.string(),
|
|
24794
24693
|
role: exports_external.enum(["system", "user", "assistant"]),
|
|
24795
24694
|
metadata: exports_external.unknown().optional(),
|
|
24796
24695
|
parts: exports_external.array(exports_external.union([
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
|
|
24805
|
-
|
|
24696
|
+
exports_external.object({
|
|
24697
|
+
type: exports_external.literal("text"),
|
|
24698
|
+
text: exports_external.string(),
|
|
24699
|
+
state: exports_external.enum(["streaming", "done"]).optional(),
|
|
24700
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
24701
|
+
}),
|
|
24702
|
+
exports_external.object({
|
|
24703
|
+
type: exports_external.literal("reasoning"),
|
|
24704
|
+
text: exports_external.string(),
|
|
24705
|
+
state: exports_external.enum(["streaming", "done"]).optional(),
|
|
24706
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
24707
|
+
}),
|
|
24708
|
+
exports_external.object({
|
|
24709
|
+
type: exports_external.literal("source-url"),
|
|
24710
|
+
sourceId: exports_external.string(),
|
|
24711
|
+
url: exports_external.string(),
|
|
24712
|
+
title: exports_external.string().optional(),
|
|
24713
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
24714
|
+
}),
|
|
24715
|
+
exports_external.object({
|
|
24716
|
+
type: exports_external.literal("source-document"),
|
|
24717
|
+
sourceId: exports_external.string(),
|
|
24718
|
+
mediaType: exports_external.string(),
|
|
24719
|
+
title: exports_external.string(),
|
|
24720
|
+
filename: exports_external.string().optional(),
|
|
24721
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
24722
|
+
}),
|
|
24723
|
+
exports_external.object({
|
|
24724
|
+
type: exports_external.literal("file"),
|
|
24725
|
+
mediaType: exports_external.string(),
|
|
24726
|
+
filename: exports_external.string().optional(),
|
|
24727
|
+
url: exports_external.string(),
|
|
24728
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
24729
|
+
}),
|
|
24730
|
+
exports_external.object({
|
|
24731
|
+
type: exports_external.literal("step-start")
|
|
24732
|
+
}),
|
|
24733
|
+
exports_external.object({
|
|
24734
|
+
type: exports_external.string().startsWith("data-"),
|
|
24735
|
+
id: exports_external.string().optional(),
|
|
24736
|
+
data: exports_external.unknown()
|
|
24737
|
+
}),
|
|
24738
|
+
exports_external.object({
|
|
24739
|
+
type: exports_external.literal("dynamic-tool"),
|
|
24740
|
+
toolName: exports_external.string(),
|
|
24741
|
+
toolCallId: exports_external.string(),
|
|
24742
|
+
state: exports_external.literal("input-streaming"),
|
|
24743
|
+
input: exports_external.unknown().optional(),
|
|
24744
|
+
output: exports_external.never().optional(),
|
|
24745
|
+
errorText: exports_external.never().optional()
|
|
24746
|
+
}),
|
|
24747
|
+
exports_external.object({
|
|
24748
|
+
type: exports_external.literal("dynamic-tool"),
|
|
24749
|
+
toolName: exports_external.string(),
|
|
24750
|
+
toolCallId: exports_external.string(),
|
|
24751
|
+
state: exports_external.literal("input-available"),
|
|
24752
|
+
input: exports_external.unknown(),
|
|
24753
|
+
output: exports_external.never().optional(),
|
|
24754
|
+
errorText: exports_external.never().optional(),
|
|
24755
|
+
callProviderMetadata: providerMetadataSchema.optional()
|
|
24756
|
+
}),
|
|
24757
|
+
exports_external.object({
|
|
24758
|
+
type: exports_external.literal("dynamic-tool"),
|
|
24759
|
+
toolName: exports_external.string(),
|
|
24760
|
+
toolCallId: exports_external.string(),
|
|
24761
|
+
state: exports_external.literal("output-available"),
|
|
24762
|
+
input: exports_external.unknown(),
|
|
24763
|
+
output: exports_external.unknown(),
|
|
24764
|
+
errorText: exports_external.never().optional(),
|
|
24765
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24766
|
+
preliminary: exports_external.boolean().optional()
|
|
24767
|
+
}),
|
|
24768
|
+
exports_external.object({
|
|
24769
|
+
type: exports_external.literal("dynamic-tool"),
|
|
24770
|
+
toolName: exports_external.string(),
|
|
24771
|
+
toolCallId: exports_external.string(),
|
|
24772
|
+
state: exports_external.literal("output-error"),
|
|
24773
|
+
input: exports_external.unknown(),
|
|
24774
|
+
output: exports_external.never().optional(),
|
|
24775
|
+
errorText: exports_external.string(),
|
|
24776
|
+
callProviderMetadata: providerMetadataSchema.optional()
|
|
24777
|
+
}),
|
|
24778
|
+
exports_external.object({
|
|
24779
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24780
|
+
toolCallId: exports_external.string(),
|
|
24781
|
+
state: exports_external.literal("input-streaming"),
|
|
24782
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24783
|
+
input: exports_external.unknown().optional(),
|
|
24784
|
+
output: exports_external.never().optional(),
|
|
24785
|
+
errorText: exports_external.never().optional(),
|
|
24786
|
+
approval: exports_external.never().optional()
|
|
24787
|
+
}),
|
|
24788
|
+
exports_external.object({
|
|
24789
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24790
|
+
toolCallId: exports_external.string(),
|
|
24791
|
+
state: exports_external.literal("input-available"),
|
|
24792
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24793
|
+
input: exports_external.unknown(),
|
|
24794
|
+
output: exports_external.never().optional(),
|
|
24795
|
+
errorText: exports_external.never().optional(),
|
|
24796
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24797
|
+
approval: exports_external.never().optional()
|
|
24798
|
+
}),
|
|
24799
|
+
exports_external.object({
|
|
24800
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24801
|
+
toolCallId: exports_external.string(),
|
|
24802
|
+
state: exports_external.literal("approval-requested"),
|
|
24803
|
+
input: exports_external.unknown(),
|
|
24804
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24805
|
+
output: exports_external.never().optional(),
|
|
24806
|
+
errorText: exports_external.never().optional(),
|
|
24807
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24808
|
+
approval: exports_external.object({
|
|
24809
|
+
id: exports_external.string(),
|
|
24810
|
+
approved: exports_external.never().optional(),
|
|
24811
|
+
reason: exports_external.never().optional()
|
|
24812
|
+
})
|
|
24813
|
+
}),
|
|
24814
|
+
exports_external.object({
|
|
24815
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24816
|
+
toolCallId: exports_external.string(),
|
|
24817
|
+
state: exports_external.literal("approval-responded"),
|
|
24818
|
+
input: exports_external.unknown(),
|
|
24819
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24820
|
+
output: exports_external.never().optional(),
|
|
24821
|
+
errorText: exports_external.never().optional(),
|
|
24822
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24823
|
+
approval: exports_external.object({
|
|
24824
|
+
id: exports_external.string(),
|
|
24825
|
+
approved: exports_external.boolean(),
|
|
24826
|
+
reason: exports_external.string().optional()
|
|
24827
|
+
})
|
|
24828
|
+
}),
|
|
24829
|
+
exports_external.object({
|
|
24830
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24831
|
+
toolCallId: exports_external.string(),
|
|
24832
|
+
state: exports_external.literal("output-available"),
|
|
24833
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24834
|
+
input: exports_external.unknown(),
|
|
24835
|
+
output: exports_external.unknown(),
|
|
24836
|
+
errorText: exports_external.never().optional(),
|
|
24837
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24838
|
+
preliminary: exports_external.boolean().optional(),
|
|
24839
|
+
approval: exports_external.object({
|
|
24840
|
+
id: exports_external.string(),
|
|
24841
|
+
approved: exports_external.literal(true),
|
|
24842
|
+
reason: exports_external.string().optional()
|
|
24843
|
+
}).optional()
|
|
24844
|
+
}),
|
|
24845
|
+
exports_external.object({
|
|
24846
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24847
|
+
toolCallId: exports_external.string(),
|
|
24848
|
+
state: exports_external.literal("output-error"),
|
|
24849
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24850
|
+
input: exports_external.unknown(),
|
|
24851
|
+
output: exports_external.never().optional(),
|
|
24852
|
+
errorText: exports_external.string(),
|
|
24853
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24854
|
+
approval: exports_external.object({
|
|
24855
|
+
id: exports_external.string(),
|
|
24856
|
+
approved: exports_external.literal(true),
|
|
24857
|
+
reason: exports_external.string().optional()
|
|
24858
|
+
}).optional()
|
|
24859
|
+
}),
|
|
24860
|
+
exports_external.object({
|
|
24861
|
+
type: exports_external.string().startsWith("tool-"),
|
|
24862
|
+
toolCallId: exports_external.string(),
|
|
24863
|
+
state: exports_external.literal("output-denied"),
|
|
24864
|
+
providerExecuted: exports_external.boolean().optional(),
|
|
24865
|
+
input: exports_external.unknown(),
|
|
24866
|
+
output: exports_external.never().optional(),
|
|
24867
|
+
errorText: exports_external.never().optional(),
|
|
24868
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
24869
|
+
approval: exports_external.object({
|
|
24870
|
+
id: exports_external.string(),
|
|
24871
|
+
approved: exports_external.literal(false),
|
|
24872
|
+
reason: exports_external.string().optional()
|
|
24873
|
+
})
|
|
24874
|
+
})
|
|
24806
24875
|
]))
|
|
24807
|
-
});
|
|
24876
|
+
}))));
|
|
24808
24877
|
|
|
24809
24878
|
// ../xyd-ask-ai/dist/_rollupPluginBabelHelpers-B0vHBMb8.js
|
|
24810
24879
|
function t(t2, r) {
|
|
@@ -25167,19 +25236,325 @@ async function pkceChallenge(length) {
|
|
|
25167
25236
|
};
|
|
25168
25237
|
}
|
|
25169
25238
|
|
|
25170
|
-
// ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.
|
|
25171
|
-
var VERSION4 = "2.0.
|
|
25172
|
-
var anthropicErrorDataSchema = exports_external.object({
|
|
25239
|
+
// ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.27_zod@3.25.76/node_modules/@ai-sdk/anthropic/dist/index.mjs
|
|
25240
|
+
var VERSION4 = "2.0.27";
|
|
25241
|
+
var anthropicErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25173
25242
|
type: exports_external.literal("error"),
|
|
25174
25243
|
error: exports_external.object({
|
|
25175
25244
|
type: exports_external.string(),
|
|
25176
25245
|
message: exports_external.string()
|
|
25177
25246
|
})
|
|
25178
|
-
});
|
|
25247
|
+
})));
|
|
25179
25248
|
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
25180
25249
|
errorSchema: anthropicErrorDataSchema,
|
|
25181
25250
|
errorToMessage: (data) => data.error.message
|
|
25182
25251
|
});
|
|
25252
|
+
var anthropicMessagesResponseSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25253
|
+
type: exports_external.literal("message"),
|
|
25254
|
+
id: exports_external.string().nullish(),
|
|
25255
|
+
model: exports_external.string().nullish(),
|
|
25256
|
+
content: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
25257
|
+
exports_external.object({
|
|
25258
|
+
type: exports_external.literal("text"),
|
|
25259
|
+
text: exports_external.string(),
|
|
25260
|
+
citations: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
25261
|
+
exports_external.object({
|
|
25262
|
+
type: exports_external.literal("web_search_result_location"),
|
|
25263
|
+
cited_text: exports_external.string(),
|
|
25264
|
+
url: exports_external.string(),
|
|
25265
|
+
title: exports_external.string(),
|
|
25266
|
+
encrypted_index: exports_external.string()
|
|
25267
|
+
}),
|
|
25268
|
+
exports_external.object({
|
|
25269
|
+
type: exports_external.literal("page_location"),
|
|
25270
|
+
cited_text: exports_external.string(),
|
|
25271
|
+
document_index: exports_external.number(),
|
|
25272
|
+
document_title: exports_external.string().nullable(),
|
|
25273
|
+
start_page_number: exports_external.number(),
|
|
25274
|
+
end_page_number: exports_external.number()
|
|
25275
|
+
}),
|
|
25276
|
+
exports_external.object({
|
|
25277
|
+
type: exports_external.literal("char_location"),
|
|
25278
|
+
cited_text: exports_external.string(),
|
|
25279
|
+
document_index: exports_external.number(),
|
|
25280
|
+
document_title: exports_external.string().nullable(),
|
|
25281
|
+
start_char_index: exports_external.number(),
|
|
25282
|
+
end_char_index: exports_external.number()
|
|
25283
|
+
})
|
|
25284
|
+
])).optional()
|
|
25285
|
+
}),
|
|
25286
|
+
exports_external.object({
|
|
25287
|
+
type: exports_external.literal("thinking"),
|
|
25288
|
+
thinking: exports_external.string(),
|
|
25289
|
+
signature: exports_external.string()
|
|
25290
|
+
}),
|
|
25291
|
+
exports_external.object({
|
|
25292
|
+
type: exports_external.literal("redacted_thinking"),
|
|
25293
|
+
data: exports_external.string()
|
|
25294
|
+
}),
|
|
25295
|
+
exports_external.object({
|
|
25296
|
+
type: exports_external.literal("tool_use"),
|
|
25297
|
+
id: exports_external.string(),
|
|
25298
|
+
name: exports_external.string(),
|
|
25299
|
+
input: exports_external.unknown()
|
|
25300
|
+
}),
|
|
25301
|
+
exports_external.object({
|
|
25302
|
+
type: exports_external.literal("server_tool_use"),
|
|
25303
|
+
id: exports_external.string(),
|
|
25304
|
+
name: exports_external.string(),
|
|
25305
|
+
input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish()
|
|
25306
|
+
}),
|
|
25307
|
+
exports_external.object({
|
|
25308
|
+
type: exports_external.literal("web_fetch_tool_result"),
|
|
25309
|
+
tool_use_id: exports_external.string(),
|
|
25310
|
+
content: exports_external.union([
|
|
25311
|
+
exports_external.object({
|
|
25312
|
+
type: exports_external.literal("web_fetch_result"),
|
|
25313
|
+
url: exports_external.string(),
|
|
25314
|
+
retrieved_at: exports_external.string(),
|
|
25315
|
+
content: exports_external.object({
|
|
25316
|
+
type: exports_external.literal("document"),
|
|
25317
|
+
title: exports_external.string().nullable(),
|
|
25318
|
+
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
25319
|
+
source: exports_external.object({
|
|
25320
|
+
type: exports_external.literal("text"),
|
|
25321
|
+
media_type: exports_external.string(),
|
|
25322
|
+
data: exports_external.string()
|
|
25323
|
+
})
|
|
25324
|
+
})
|
|
25325
|
+
}),
|
|
25326
|
+
exports_external.object({
|
|
25327
|
+
type: exports_external.literal("web_fetch_tool_result_error"),
|
|
25328
|
+
error_code: exports_external.string()
|
|
25329
|
+
})
|
|
25330
|
+
])
|
|
25331
|
+
}),
|
|
25332
|
+
exports_external.object({
|
|
25333
|
+
type: exports_external.literal("web_search_tool_result"),
|
|
25334
|
+
tool_use_id: exports_external.string(),
|
|
25335
|
+
content: exports_external.union([
|
|
25336
|
+
exports_external.array(exports_external.object({
|
|
25337
|
+
type: exports_external.literal("web_search_result"),
|
|
25338
|
+
url: exports_external.string(),
|
|
25339
|
+
title: exports_external.string(),
|
|
25340
|
+
encrypted_content: exports_external.string(),
|
|
25341
|
+
page_age: exports_external.string().nullish()
|
|
25342
|
+
})),
|
|
25343
|
+
exports_external.object({
|
|
25344
|
+
type: exports_external.literal("web_search_tool_result_error"),
|
|
25345
|
+
error_code: exports_external.string()
|
|
25346
|
+
})
|
|
25347
|
+
])
|
|
25348
|
+
}),
|
|
25349
|
+
exports_external.object({
|
|
25350
|
+
type: exports_external.literal("code_execution_tool_result"),
|
|
25351
|
+
tool_use_id: exports_external.string(),
|
|
25352
|
+
content: exports_external.union([
|
|
25353
|
+
exports_external.object({
|
|
25354
|
+
type: exports_external.literal("code_execution_result"),
|
|
25355
|
+
stdout: exports_external.string(),
|
|
25356
|
+
stderr: exports_external.string(),
|
|
25357
|
+
return_code: exports_external.number()
|
|
25358
|
+
}),
|
|
25359
|
+
exports_external.object({
|
|
25360
|
+
type: exports_external.literal("code_execution_tool_result_error"),
|
|
25361
|
+
error_code: exports_external.string()
|
|
25362
|
+
})
|
|
25363
|
+
])
|
|
25364
|
+
})
|
|
25365
|
+
])),
|
|
25366
|
+
stop_reason: exports_external.string().nullish(),
|
|
25367
|
+
stop_sequence: exports_external.string().nullish(),
|
|
25368
|
+
usage: exports_external.looseObject({
|
|
25369
|
+
input_tokens: exports_external.number(),
|
|
25370
|
+
output_tokens: exports_external.number(),
|
|
25371
|
+
cache_creation_input_tokens: exports_external.number().nullish(),
|
|
25372
|
+
cache_read_input_tokens: exports_external.number().nullish()
|
|
25373
|
+
})
|
|
25374
|
+
})));
|
|
25375
|
+
var anthropicMessagesChunkSchema = lazySchema(() => zodSchema(exports_external.discriminatedUnion("type", [
|
|
25376
|
+
exports_external.object({
|
|
25377
|
+
type: exports_external.literal("message_start"),
|
|
25378
|
+
message: exports_external.object({
|
|
25379
|
+
id: exports_external.string().nullish(),
|
|
25380
|
+
model: exports_external.string().nullish(),
|
|
25381
|
+
usage: exports_external.looseObject({
|
|
25382
|
+
input_tokens: exports_external.number(),
|
|
25383
|
+
cache_creation_input_tokens: exports_external.number().nullish(),
|
|
25384
|
+
cache_read_input_tokens: exports_external.number().nullish()
|
|
25385
|
+
})
|
|
25386
|
+
})
|
|
25387
|
+
}),
|
|
25388
|
+
exports_external.object({
|
|
25389
|
+
type: exports_external.literal("content_block_start"),
|
|
25390
|
+
index: exports_external.number(),
|
|
25391
|
+
content_block: exports_external.discriminatedUnion("type", [
|
|
25392
|
+
exports_external.object({
|
|
25393
|
+
type: exports_external.literal("text"),
|
|
25394
|
+
text: exports_external.string()
|
|
25395
|
+
}),
|
|
25396
|
+
exports_external.object({
|
|
25397
|
+
type: exports_external.literal("thinking"),
|
|
25398
|
+
thinking: exports_external.string()
|
|
25399
|
+
}),
|
|
25400
|
+
exports_external.object({
|
|
25401
|
+
type: exports_external.literal("tool_use"),
|
|
25402
|
+
id: exports_external.string(),
|
|
25403
|
+
name: exports_external.string()
|
|
25404
|
+
}),
|
|
25405
|
+
exports_external.object({
|
|
25406
|
+
type: exports_external.literal("redacted_thinking"),
|
|
25407
|
+
data: exports_external.string()
|
|
25408
|
+
}),
|
|
25409
|
+
exports_external.object({
|
|
25410
|
+
type: exports_external.literal("server_tool_use"),
|
|
25411
|
+
id: exports_external.string(),
|
|
25412
|
+
name: exports_external.string(),
|
|
25413
|
+
input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish()
|
|
25414
|
+
}),
|
|
25415
|
+
exports_external.object({
|
|
25416
|
+
type: exports_external.literal("web_fetch_tool_result"),
|
|
25417
|
+
tool_use_id: exports_external.string(),
|
|
25418
|
+
content: exports_external.union([
|
|
25419
|
+
exports_external.object({
|
|
25420
|
+
type: exports_external.literal("web_fetch_result"),
|
|
25421
|
+
url: exports_external.string(),
|
|
25422
|
+
retrieved_at: exports_external.string(),
|
|
25423
|
+
content: exports_external.object({
|
|
25424
|
+
type: exports_external.literal("document"),
|
|
25425
|
+
title: exports_external.string().nullable(),
|
|
25426
|
+
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
25427
|
+
source: exports_external.object({
|
|
25428
|
+
type: exports_external.literal("text"),
|
|
25429
|
+
media_type: exports_external.string(),
|
|
25430
|
+
data: exports_external.string()
|
|
25431
|
+
})
|
|
25432
|
+
})
|
|
25433
|
+
}),
|
|
25434
|
+
exports_external.object({
|
|
25435
|
+
type: exports_external.literal("web_fetch_tool_result_error"),
|
|
25436
|
+
error_code: exports_external.string()
|
|
25437
|
+
})
|
|
25438
|
+
])
|
|
25439
|
+
}),
|
|
25440
|
+
exports_external.object({
|
|
25441
|
+
type: exports_external.literal("web_search_tool_result"),
|
|
25442
|
+
tool_use_id: exports_external.string(),
|
|
25443
|
+
content: exports_external.union([
|
|
25444
|
+
exports_external.array(exports_external.object({
|
|
25445
|
+
type: exports_external.literal("web_search_result"),
|
|
25446
|
+
url: exports_external.string(),
|
|
25447
|
+
title: exports_external.string(),
|
|
25448
|
+
encrypted_content: exports_external.string(),
|
|
25449
|
+
page_age: exports_external.string().nullish()
|
|
25450
|
+
})),
|
|
25451
|
+
exports_external.object({
|
|
25452
|
+
type: exports_external.literal("web_search_tool_result_error"),
|
|
25453
|
+
error_code: exports_external.string()
|
|
25454
|
+
})
|
|
25455
|
+
])
|
|
25456
|
+
}),
|
|
25457
|
+
exports_external.object({
|
|
25458
|
+
type: exports_external.literal("code_execution_tool_result"),
|
|
25459
|
+
tool_use_id: exports_external.string(),
|
|
25460
|
+
content: exports_external.union([
|
|
25461
|
+
exports_external.object({
|
|
25462
|
+
type: exports_external.literal("code_execution_result"),
|
|
25463
|
+
stdout: exports_external.string(),
|
|
25464
|
+
stderr: exports_external.string(),
|
|
25465
|
+
return_code: exports_external.number()
|
|
25466
|
+
}),
|
|
25467
|
+
exports_external.object({
|
|
25468
|
+
type: exports_external.literal("code_execution_tool_result_error"),
|
|
25469
|
+
error_code: exports_external.string()
|
|
25470
|
+
})
|
|
25471
|
+
])
|
|
25472
|
+
})
|
|
25473
|
+
])
|
|
25474
|
+
}),
|
|
25475
|
+
exports_external.object({
|
|
25476
|
+
type: exports_external.literal("content_block_delta"),
|
|
25477
|
+
index: exports_external.number(),
|
|
25478
|
+
delta: exports_external.discriminatedUnion("type", [
|
|
25479
|
+
exports_external.object({
|
|
25480
|
+
type: exports_external.literal("input_json_delta"),
|
|
25481
|
+
partial_json: exports_external.string()
|
|
25482
|
+
}),
|
|
25483
|
+
exports_external.object({
|
|
25484
|
+
type: exports_external.literal("text_delta"),
|
|
25485
|
+
text: exports_external.string()
|
|
25486
|
+
}),
|
|
25487
|
+
exports_external.object({
|
|
25488
|
+
type: exports_external.literal("thinking_delta"),
|
|
25489
|
+
thinking: exports_external.string()
|
|
25490
|
+
}),
|
|
25491
|
+
exports_external.object({
|
|
25492
|
+
type: exports_external.literal("signature_delta"),
|
|
25493
|
+
signature: exports_external.string()
|
|
25494
|
+
}),
|
|
25495
|
+
exports_external.object({
|
|
25496
|
+
type: exports_external.literal("citations_delta"),
|
|
25497
|
+
citation: exports_external.discriminatedUnion("type", [
|
|
25498
|
+
exports_external.object({
|
|
25499
|
+
type: exports_external.literal("web_search_result_location"),
|
|
25500
|
+
cited_text: exports_external.string(),
|
|
25501
|
+
url: exports_external.string(),
|
|
25502
|
+
title: exports_external.string(),
|
|
25503
|
+
encrypted_index: exports_external.string()
|
|
25504
|
+
}),
|
|
25505
|
+
exports_external.object({
|
|
25506
|
+
type: exports_external.literal("page_location"),
|
|
25507
|
+
cited_text: exports_external.string(),
|
|
25508
|
+
document_index: exports_external.number(),
|
|
25509
|
+
document_title: exports_external.string().nullable(),
|
|
25510
|
+
start_page_number: exports_external.number(),
|
|
25511
|
+
end_page_number: exports_external.number()
|
|
25512
|
+
}),
|
|
25513
|
+
exports_external.object({
|
|
25514
|
+
type: exports_external.literal("char_location"),
|
|
25515
|
+
cited_text: exports_external.string(),
|
|
25516
|
+
document_index: exports_external.number(),
|
|
25517
|
+
document_title: exports_external.string().nullable(),
|
|
25518
|
+
start_char_index: exports_external.number(),
|
|
25519
|
+
end_char_index: exports_external.number()
|
|
25520
|
+
})
|
|
25521
|
+
])
|
|
25522
|
+
})
|
|
25523
|
+
])
|
|
25524
|
+
}),
|
|
25525
|
+
exports_external.object({
|
|
25526
|
+
type: exports_external.literal("content_block_stop"),
|
|
25527
|
+
index: exports_external.number()
|
|
25528
|
+
}),
|
|
25529
|
+
exports_external.object({
|
|
25530
|
+
type: exports_external.literal("error"),
|
|
25531
|
+
error: exports_external.object({
|
|
25532
|
+
type: exports_external.string(),
|
|
25533
|
+
message: exports_external.string()
|
|
25534
|
+
})
|
|
25535
|
+
}),
|
|
25536
|
+
exports_external.object({
|
|
25537
|
+
type: exports_external.literal("message_delta"),
|
|
25538
|
+
delta: exports_external.object({
|
|
25539
|
+
stop_reason: exports_external.string().nullish(),
|
|
25540
|
+
stop_sequence: exports_external.string().nullish()
|
|
25541
|
+
}),
|
|
25542
|
+
usage: exports_external.looseObject({
|
|
25543
|
+
output_tokens: exports_external.number(),
|
|
25544
|
+
cache_creation_input_tokens: exports_external.number().nullish()
|
|
25545
|
+
})
|
|
25546
|
+
}),
|
|
25547
|
+
exports_external.object({
|
|
25548
|
+
type: exports_external.literal("message_stop")
|
|
25549
|
+
}),
|
|
25550
|
+
exports_external.object({
|
|
25551
|
+
type: exports_external.literal("ping")
|
|
25552
|
+
})
|
|
25553
|
+
])));
|
|
25554
|
+
var anthropicReasoningMetadataSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25555
|
+
signature: exports_external.string().optional(),
|
|
25556
|
+
redactedData: exports_external.string().optional()
|
|
25557
|
+
})));
|
|
25183
25558
|
var anthropicFilePartProviderOptions = exports_external.object({
|
|
25184
25559
|
citations: exports_external.object({
|
|
25185
25560
|
enabled: exports_external.boolean()
|
|
@@ -25205,26 +25580,27 @@ function getCacheControl(providerMetadata) {
|
|
|
25205
25580
|
const cacheControlValue = (_a18 = anthropic2 == null ? undefined : anthropic2.cacheControl) != null ? _a18 : anthropic2 == null ? undefined : anthropic2.cache_control;
|
|
25206
25581
|
return cacheControlValue;
|
|
25207
25582
|
}
|
|
25208
|
-
var textEditor_20250728ArgsSchema = exports_external.object({
|
|
25583
|
+
var textEditor_20250728ArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25209
25584
|
maxCharacters: exports_external.number().optional()
|
|
25210
|
-
});
|
|
25585
|
+
})));
|
|
25586
|
+
var textEditor_20250728InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25587
|
+
command: exports_external.enum(["view", "create", "str_replace", "insert"]),
|
|
25588
|
+
path: exports_external.string(),
|
|
25589
|
+
file_text: exports_external.string().optional(),
|
|
25590
|
+
insert_line: exports_external.number().int().optional(),
|
|
25591
|
+
new_str: exports_external.string().optional(),
|
|
25592
|
+
old_str: exports_external.string().optional(),
|
|
25593
|
+
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
25594
|
+
})));
|
|
25211
25595
|
var factory = createProviderDefinedToolFactory({
|
|
25212
25596
|
id: "anthropic.text_editor_20250728",
|
|
25213
25597
|
name: "str_replace_based_edit_tool",
|
|
25214
|
-
inputSchema:
|
|
25215
|
-
command: exports_external.enum(["view", "create", "str_replace", "insert"]),
|
|
25216
|
-
path: exports_external.string(),
|
|
25217
|
-
file_text: exports_external.string().optional(),
|
|
25218
|
-
insert_line: exports_external.number().int().optional(),
|
|
25219
|
-
new_str: exports_external.string().optional(),
|
|
25220
|
-
old_str: exports_external.string().optional(),
|
|
25221
|
-
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
25222
|
-
})
|
|
25598
|
+
inputSchema: textEditor_20250728InputSchema
|
|
25223
25599
|
});
|
|
25224
25600
|
var textEditor_20250728 = (args = {}) => {
|
|
25225
25601
|
return factory(args);
|
|
25226
25602
|
};
|
|
25227
|
-
var webSearch_20250305ArgsSchema = exports_external.object({
|
|
25603
|
+
var webSearch_20250305ArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25228
25604
|
maxUses: exports_external.number().optional(),
|
|
25229
25605
|
allowedDomains: exports_external.array(exports_external.string()).optional(),
|
|
25230
25606
|
blockedDomains: exports_external.array(exports_external.string()).optional(),
|
|
@@ -25235,33 +25611,34 @@ var webSearch_20250305ArgsSchema = exports_external.object({
|
|
|
25235
25611
|
country: exports_external.string().optional(),
|
|
25236
25612
|
timezone: exports_external.string().optional()
|
|
25237
25613
|
}).optional()
|
|
25238
|
-
});
|
|
25239
|
-
var webSearch_20250305OutputSchema = exports_external.array(exports_external.object({
|
|
25614
|
+
})));
|
|
25615
|
+
var webSearch_20250305OutputSchema = lazySchema(() => zodSchema(exports_external.array(exports_external.object({
|
|
25240
25616
|
url: exports_external.string(),
|
|
25241
25617
|
title: exports_external.string(),
|
|
25242
25618
|
pageAge: exports_external.string().nullable(),
|
|
25243
25619
|
encryptedContent: exports_external.string(),
|
|
25244
25620
|
type: exports_external.literal("web_search_result")
|
|
25245
|
-
}));
|
|
25621
|
+
}))));
|
|
25622
|
+
var webSearch_20250305InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25623
|
+
query: exports_external.string()
|
|
25624
|
+
})));
|
|
25246
25625
|
var factory2 = createProviderDefinedToolFactoryWithOutputSchema({
|
|
25247
25626
|
id: "anthropic.web_search_20250305",
|
|
25248
25627
|
name: "web_search",
|
|
25249
|
-
inputSchema:
|
|
25250
|
-
query: exports_external.string()
|
|
25251
|
-
}),
|
|
25628
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
25252
25629
|
outputSchema: webSearch_20250305OutputSchema
|
|
25253
25630
|
});
|
|
25254
25631
|
var webSearch_20250305 = (args = {}) => {
|
|
25255
25632
|
return factory2(args);
|
|
25256
25633
|
};
|
|
25257
|
-
var webFetch_20250910ArgsSchema = exports_external.object({
|
|
25634
|
+
var webFetch_20250910ArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25258
25635
|
maxUses: exports_external.number().optional(),
|
|
25259
25636
|
allowedDomains: exports_external.array(exports_external.string()).optional(),
|
|
25260
25637
|
blockedDomains: exports_external.array(exports_external.string()).optional(),
|
|
25261
25638
|
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
25262
25639
|
maxContentTokens: exports_external.number().optional()
|
|
25263
|
-
});
|
|
25264
|
-
var webFetch_20250910OutputSchema = exports_external.object({
|
|
25640
|
+
})));
|
|
25641
|
+
var webFetch_20250910OutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25265
25642
|
type: exports_external.literal("web_fetch_result"),
|
|
25266
25643
|
url: exports_external.string(),
|
|
25267
25644
|
content: exports_external.object({
|
|
@@ -25282,19 +25659,20 @@ var webFetch_20250910OutputSchema = exports_external.object({
|
|
|
25282
25659
|
])
|
|
25283
25660
|
}),
|
|
25284
25661
|
retrievedAt: exports_external.string().nullable()
|
|
25285
|
-
});
|
|
25662
|
+
})));
|
|
25663
|
+
var webFetch_20250910InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25664
|
+
url: exports_external.string()
|
|
25665
|
+
})));
|
|
25286
25666
|
var factory3 = createProviderDefinedToolFactoryWithOutputSchema({
|
|
25287
25667
|
id: "anthropic.web_fetch_20250910",
|
|
25288
25668
|
name: "web_fetch",
|
|
25289
|
-
inputSchema:
|
|
25290
|
-
url: exports_external.string()
|
|
25291
|
-
}),
|
|
25669
|
+
inputSchema: webFetch_20250910InputSchema,
|
|
25292
25670
|
outputSchema: webFetch_20250910OutputSchema
|
|
25293
25671
|
});
|
|
25294
25672
|
var webFetch_20250910 = (args = {}) => {
|
|
25295
25673
|
return factory3(args);
|
|
25296
25674
|
};
|
|
25297
|
-
function prepareTools({
|
|
25675
|
+
async function prepareTools({
|
|
25298
25676
|
tools,
|
|
25299
25677
|
toolChoice,
|
|
25300
25678
|
disableParallelToolUse
|
|
@@ -25375,7 +25753,10 @@ function prepareTools({
|
|
|
25375
25753
|
break;
|
|
25376
25754
|
}
|
|
25377
25755
|
case "anthropic.text_editor_20250728": {
|
|
25378
|
-
const args =
|
|
25756
|
+
const args = await validateTypes({
|
|
25757
|
+
value: tool2.args,
|
|
25758
|
+
schema: textEditor_20250728ArgsSchema
|
|
25759
|
+
});
|
|
25379
25760
|
anthropicTools2.push({
|
|
25380
25761
|
name: "str_replace_based_edit_tool",
|
|
25381
25762
|
type: "text_editor_20250728",
|
|
@@ -25401,7 +25782,10 @@ function prepareTools({
|
|
|
25401
25782
|
}
|
|
25402
25783
|
case "anthropic.web_fetch_20250910": {
|
|
25403
25784
|
betas.add("web-fetch-2025-09-10");
|
|
25404
|
-
const args =
|
|
25785
|
+
const args = await validateTypes({
|
|
25786
|
+
value: tool2.args,
|
|
25787
|
+
schema: webFetch_20250910ArgsSchema
|
|
25788
|
+
});
|
|
25405
25789
|
anthropicTools2.push({
|
|
25406
25790
|
type: "web_fetch_20250910",
|
|
25407
25791
|
name: "web_fetch",
|
|
@@ -25414,7 +25798,10 @@ function prepareTools({
|
|
|
25414
25798
|
break;
|
|
25415
25799
|
}
|
|
25416
25800
|
case "anthropic.web_search_20250305": {
|
|
25417
|
-
const args =
|
|
25801
|
+
const args = await validateTypes({
|
|
25802
|
+
value: tool2.args,
|
|
25803
|
+
schema: webSearch_20250305ArgsSchema
|
|
25804
|
+
});
|
|
25418
25805
|
anthropicTools2.push({
|
|
25419
25806
|
type: "web_search_20250305",
|
|
25420
25807
|
name: "web_search",
|
|
@@ -25489,18 +25876,19 @@ function prepareTools({
|
|
|
25489
25876
|
}
|
|
25490
25877
|
}
|
|
25491
25878
|
}
|
|
25492
|
-
var codeExecution_20250522OutputSchema = exports_external.object({
|
|
25879
|
+
var codeExecution_20250522OutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25493
25880
|
type: exports_external.literal("code_execution_result"),
|
|
25494
25881
|
stdout: exports_external.string(),
|
|
25495
25882
|
stderr: exports_external.string(),
|
|
25496
25883
|
return_code: exports_external.number()
|
|
25497
|
-
});
|
|
25884
|
+
})));
|
|
25885
|
+
var codeExecution_20250522InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
25886
|
+
code: exports_external.string()
|
|
25887
|
+
})));
|
|
25498
25888
|
var factory4 = createProviderDefinedToolFactoryWithOutputSchema({
|
|
25499
25889
|
id: "anthropic.code_execution_20250522",
|
|
25500
25890
|
name: "code_execution",
|
|
25501
|
-
inputSchema:
|
|
25502
|
-
code: exports_external.string()
|
|
25503
|
-
}),
|
|
25891
|
+
inputSchema: codeExecution_20250522InputSchema,
|
|
25504
25892
|
outputSchema: codeExecution_20250522OutputSchema
|
|
25505
25893
|
});
|
|
25506
25894
|
var codeExecution_20250522 = (args = {}) => {
|
|
@@ -25684,6 +26072,18 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
25684
26072
|
cache_control: undefined
|
|
25685
26073
|
};
|
|
25686
26074
|
}
|
|
26075
|
+
if (contentPart.mediaType === "application/pdf") {
|
|
26076
|
+
betas.add("pdfs-2024-09-25");
|
|
26077
|
+
return {
|
|
26078
|
+
type: "document",
|
|
26079
|
+
source: {
|
|
26080
|
+
type: "base64",
|
|
26081
|
+
media_type: contentPart.mediaType,
|
|
26082
|
+
data: contentPart.data
|
|
26083
|
+
},
|
|
26084
|
+
cache_control: undefined
|
|
26085
|
+
};
|
|
26086
|
+
}
|
|
25687
26087
|
throw new UnsupportedFunctionalityError({
|
|
25688
26088
|
functionality: `media type: ${contentPart.mediaType}`
|
|
25689
26089
|
});
|
|
@@ -25817,7 +26217,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
25817
26217
|
});
|
|
25818
26218
|
break;
|
|
25819
26219
|
}
|
|
25820
|
-
const codeExecutionOutput =
|
|
26220
|
+
const codeExecutionOutput = await validateTypes({
|
|
26221
|
+
value: output.value,
|
|
26222
|
+
schema: codeExecution_20250522OutputSchema
|
|
26223
|
+
});
|
|
25821
26224
|
anthropicContent.push({
|
|
25822
26225
|
type: "code_execution_tool_result",
|
|
25823
26226
|
tool_use_id: part.toolCallId,
|
|
@@ -25840,7 +26243,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
25840
26243
|
});
|
|
25841
26244
|
break;
|
|
25842
26245
|
}
|
|
25843
|
-
const webFetchOutput =
|
|
26246
|
+
const webFetchOutput = await validateTypes({
|
|
26247
|
+
value: output.value,
|
|
26248
|
+
schema: webFetch_20250910OutputSchema
|
|
26249
|
+
});
|
|
25844
26250
|
anthropicContent.push({
|
|
25845
26251
|
type: "web_fetch_tool_result",
|
|
25846
26252
|
tool_use_id: part.toolCallId,
|
|
@@ -25872,7 +26278,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
25872
26278
|
});
|
|
25873
26279
|
break;
|
|
25874
26280
|
}
|
|
25875
|
-
const webSearchOutput =
|
|
26281
|
+
const webSearchOutput = await validateTypes({
|
|
26282
|
+
value: output.value,
|
|
26283
|
+
schema: webSearch_20250305OutputSchema
|
|
26284
|
+
});
|
|
25876
26285
|
anthropicContent.push({
|
|
25877
26286
|
type: "web_search_tool_result",
|
|
25878
26287
|
tool_use_id: part.toolCallId,
|
|
@@ -25975,63 +26384,15 @@ function mapAnthropicStopReason({
|
|
|
25975
26384
|
return "unknown";
|
|
25976
26385
|
}
|
|
25977
26386
|
}
|
|
25978
|
-
var citationSchemas = {
|
|
25979
|
-
webSearchResult: exports_external.object({
|
|
25980
|
-
type: exports_external.literal("web_search_result_location"),
|
|
25981
|
-
cited_text: exports_external.string(),
|
|
25982
|
-
url: exports_external.string(),
|
|
25983
|
-
title: exports_external.string(),
|
|
25984
|
-
encrypted_index: exports_external.string()
|
|
25985
|
-
}),
|
|
25986
|
-
pageLocation: exports_external.object({
|
|
25987
|
-
type: exports_external.literal("page_location"),
|
|
25988
|
-
cited_text: exports_external.string(),
|
|
25989
|
-
document_index: exports_external.number(),
|
|
25990
|
-
document_title: exports_external.string().nullable(),
|
|
25991
|
-
start_page_number: exports_external.number(),
|
|
25992
|
-
end_page_number: exports_external.number()
|
|
25993
|
-
}),
|
|
25994
|
-
charLocation: exports_external.object({
|
|
25995
|
-
type: exports_external.literal("char_location"),
|
|
25996
|
-
cited_text: exports_external.string(),
|
|
25997
|
-
document_index: exports_external.number(),
|
|
25998
|
-
document_title: exports_external.string().nullable(),
|
|
25999
|
-
start_char_index: exports_external.number(),
|
|
26000
|
-
end_char_index: exports_external.number()
|
|
26001
|
-
})
|
|
26002
|
-
};
|
|
26003
|
-
var citationSchema = exports_external.discriminatedUnion("type", [
|
|
26004
|
-
citationSchemas.webSearchResult,
|
|
26005
|
-
citationSchemas.pageLocation,
|
|
26006
|
-
citationSchemas.charLocation
|
|
26007
|
-
]);
|
|
26008
|
-
var documentCitationSchema = exports_external.discriminatedUnion("type", [
|
|
26009
|
-
citationSchemas.pageLocation,
|
|
26010
|
-
citationSchemas.charLocation
|
|
26011
|
-
]);
|
|
26012
|
-
function processCitation(citation, citationDocuments, generateId3, onSource) {
|
|
26013
|
-
if (citation.type === "page_location" || citation.type === "char_location") {
|
|
26014
|
-
const source = createCitationSource(citation, citationDocuments, generateId3);
|
|
26015
|
-
if (source) {
|
|
26016
|
-
onSource(source);
|
|
26017
|
-
}
|
|
26018
|
-
}
|
|
26019
|
-
}
|
|
26020
26387
|
function createCitationSource(citation, citationDocuments, generateId3) {
|
|
26021
26388
|
var _a18;
|
|
26389
|
+
if (citation.type !== "page_location" && citation.type !== "char_location") {
|
|
26390
|
+
return;
|
|
26391
|
+
}
|
|
26022
26392
|
const documentInfo = citationDocuments[citation.document_index];
|
|
26023
26393
|
if (!documentInfo) {
|
|
26024
|
-
return
|
|
26394
|
+
return;
|
|
26025
26395
|
}
|
|
26026
|
-
const providerMetadata = citation.type === "page_location" ? {
|
|
26027
|
-
citedText: citation.cited_text,
|
|
26028
|
-
startPageNumber: citation.start_page_number,
|
|
26029
|
-
endPageNumber: citation.end_page_number
|
|
26030
|
-
} : {
|
|
26031
|
-
citedText: citation.cited_text,
|
|
26032
|
-
startCharIndex: citation.start_char_index,
|
|
26033
|
-
endCharIndex: citation.end_char_index
|
|
26034
|
-
};
|
|
26035
26396
|
return {
|
|
26036
26397
|
type: "source",
|
|
26037
26398
|
sourceType: "document",
|
|
@@ -26040,7 +26401,15 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
26040
26401
|
title: (_a18 = citation.document_title) != null ? _a18 : documentInfo.title,
|
|
26041
26402
|
filename: documentInfo.filename,
|
|
26042
26403
|
providerMetadata: {
|
|
26043
|
-
anthropic:
|
|
26404
|
+
anthropic: citation.type === "page_location" ? {
|
|
26405
|
+
citedText: citation.cited_text,
|
|
26406
|
+
startPageNumber: citation.start_page_number,
|
|
26407
|
+
endPageNumber: citation.end_page_number
|
|
26408
|
+
} : {
|
|
26409
|
+
citedText: citation.cited_text,
|
|
26410
|
+
startCharIndex: citation.start_char_index,
|
|
26411
|
+
endCharIndex: citation.end_char_index
|
|
26412
|
+
}
|
|
26044
26413
|
}
|
|
26045
26414
|
};
|
|
26046
26415
|
}
|
|
@@ -26180,7 +26549,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
26180
26549
|
toolChoice: anthropicToolChoice,
|
|
26181
26550
|
toolWarnings,
|
|
26182
26551
|
betas: toolsBetas
|
|
26183
|
-
} = prepareTools(jsonResponseTool != null ? {
|
|
26552
|
+
} = await prepareTools(jsonResponseTool != null ? {
|
|
26184
26553
|
tools: [jsonResponseTool],
|
|
26185
26554
|
toolChoice: { type: "tool", toolName: jsonResponseTool.name },
|
|
26186
26555
|
disableParallelToolUse: true
|
|
@@ -26262,7 +26631,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
26262
26631
|
content.push({ type: "text", text: part.text });
|
|
26263
26632
|
if (part.citations) {
|
|
26264
26633
|
for (const citation of part.citations) {
|
|
26265
|
-
|
|
26634
|
+
const source = createCitationSource(citation, citationDocuments, this.generateId);
|
|
26635
|
+
if (source) {
|
|
26636
|
+
content.push(source);
|
|
26637
|
+
}
|
|
26266
26638
|
}
|
|
26267
26639
|
}
|
|
26268
26640
|
}
|
|
@@ -26789,7 +27161,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
26789
27161
|
}
|
|
26790
27162
|
case "citations_delta": {
|
|
26791
27163
|
const citation = value.delta.citation;
|
|
26792
|
-
|
|
27164
|
+
const source = createCitationSource(citation, citationDocuments, generateId3);
|
|
27165
|
+
if (source) {
|
|
27166
|
+
controller.enqueue(source);
|
|
27167
|
+
}
|
|
26793
27168
|
return;
|
|
26794
27169
|
}
|
|
26795
27170
|
default: {
|
|
@@ -26857,368 +27232,117 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
26857
27232
|
};
|
|
26858
27233
|
}
|
|
26859
27234
|
};
|
|
26860
|
-
var
|
|
26861
|
-
|
|
26862
|
-
|
|
26863
|
-
|
|
26864
|
-
content: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
26865
|
-
exports_external.object({
|
|
26866
|
-
type: exports_external.literal("text"),
|
|
26867
|
-
text: exports_external.string(),
|
|
26868
|
-
citations: exports_external.array(citationSchema).optional()
|
|
26869
|
-
}),
|
|
26870
|
-
exports_external.object({
|
|
26871
|
-
type: exports_external.literal("thinking"),
|
|
26872
|
-
thinking: exports_external.string(),
|
|
26873
|
-
signature: exports_external.string()
|
|
26874
|
-
}),
|
|
26875
|
-
exports_external.object({
|
|
26876
|
-
type: exports_external.literal("redacted_thinking"),
|
|
26877
|
-
data: exports_external.string()
|
|
26878
|
-
}),
|
|
26879
|
-
exports_external.object({
|
|
26880
|
-
type: exports_external.literal("tool_use"),
|
|
26881
|
-
id: exports_external.string(),
|
|
26882
|
-
name: exports_external.string(),
|
|
26883
|
-
input: exports_external.unknown()
|
|
26884
|
-
}),
|
|
26885
|
-
exports_external.object({
|
|
26886
|
-
type: exports_external.literal("server_tool_use"),
|
|
26887
|
-
id: exports_external.string(),
|
|
26888
|
-
name: exports_external.string(),
|
|
26889
|
-
input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish()
|
|
26890
|
-
}),
|
|
26891
|
-
exports_external.object({
|
|
26892
|
-
type: exports_external.literal("web_fetch_tool_result"),
|
|
26893
|
-
tool_use_id: exports_external.string(),
|
|
26894
|
-
content: exports_external.union([
|
|
26895
|
-
exports_external.object({
|
|
26896
|
-
type: exports_external.literal("web_fetch_result"),
|
|
26897
|
-
url: exports_external.string(),
|
|
26898
|
-
retrieved_at: exports_external.string(),
|
|
26899
|
-
content: exports_external.object({
|
|
26900
|
-
type: exports_external.literal("document"),
|
|
26901
|
-
title: exports_external.string().nullable(),
|
|
26902
|
-
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
26903
|
-
source: exports_external.object({
|
|
26904
|
-
type: exports_external.literal("text"),
|
|
26905
|
-
media_type: exports_external.string(),
|
|
26906
|
-
data: exports_external.string()
|
|
26907
|
-
})
|
|
26908
|
-
})
|
|
26909
|
-
}),
|
|
26910
|
-
exports_external.object({
|
|
26911
|
-
type: exports_external.literal("web_fetch_tool_result_error"),
|
|
26912
|
-
error_code: exports_external.string()
|
|
26913
|
-
})
|
|
26914
|
-
])
|
|
26915
|
-
}),
|
|
26916
|
-
exports_external.object({
|
|
26917
|
-
type: exports_external.literal("web_search_tool_result"),
|
|
26918
|
-
tool_use_id: exports_external.string(),
|
|
26919
|
-
content: exports_external.union([
|
|
26920
|
-
exports_external.array(exports_external.object({
|
|
26921
|
-
type: exports_external.literal("web_search_result"),
|
|
26922
|
-
url: exports_external.string(),
|
|
26923
|
-
title: exports_external.string(),
|
|
26924
|
-
encrypted_content: exports_external.string(),
|
|
26925
|
-
page_age: exports_external.string().nullish()
|
|
26926
|
-
})),
|
|
26927
|
-
exports_external.object({
|
|
26928
|
-
type: exports_external.literal("web_search_tool_result_error"),
|
|
26929
|
-
error_code: exports_external.string()
|
|
26930
|
-
})
|
|
26931
|
-
])
|
|
26932
|
-
}),
|
|
26933
|
-
exports_external.object({
|
|
26934
|
-
type: exports_external.literal("code_execution_tool_result"),
|
|
26935
|
-
tool_use_id: exports_external.string(),
|
|
26936
|
-
content: exports_external.union([
|
|
26937
|
-
exports_external.object({
|
|
26938
|
-
type: exports_external.literal("code_execution_result"),
|
|
26939
|
-
stdout: exports_external.string(),
|
|
26940
|
-
stderr: exports_external.string(),
|
|
26941
|
-
return_code: exports_external.number()
|
|
26942
|
-
}),
|
|
26943
|
-
exports_external.object({
|
|
26944
|
-
type: exports_external.literal("code_execution_tool_result_error"),
|
|
26945
|
-
error_code: exports_external.string()
|
|
26946
|
-
})
|
|
26947
|
-
])
|
|
26948
|
-
})
|
|
26949
|
-
])),
|
|
26950
|
-
stop_reason: exports_external.string().nullish(),
|
|
26951
|
-
stop_sequence: exports_external.string().nullish(),
|
|
26952
|
-
usage: exports_external.looseObject({
|
|
26953
|
-
input_tokens: exports_external.number(),
|
|
26954
|
-
output_tokens: exports_external.number(),
|
|
26955
|
-
cache_creation_input_tokens: exports_external.number().nullish(),
|
|
26956
|
-
cache_read_input_tokens: exports_external.number().nullish()
|
|
26957
|
-
})
|
|
26958
|
-
});
|
|
26959
|
-
var anthropicMessagesChunkSchema = exports_external.discriminatedUnion("type", [
|
|
26960
|
-
exports_external.object({
|
|
26961
|
-
type: exports_external.literal("message_start"),
|
|
26962
|
-
message: exports_external.object({
|
|
26963
|
-
id: exports_external.string().nullish(),
|
|
26964
|
-
model: exports_external.string().nullish(),
|
|
26965
|
-
usage: exports_external.looseObject({
|
|
26966
|
-
input_tokens: exports_external.number(),
|
|
26967
|
-
cache_creation_input_tokens: exports_external.number().nullish(),
|
|
26968
|
-
cache_read_input_tokens: exports_external.number().nullish()
|
|
26969
|
-
})
|
|
26970
|
-
})
|
|
26971
|
-
}),
|
|
26972
|
-
exports_external.object({
|
|
26973
|
-
type: exports_external.literal("content_block_start"),
|
|
26974
|
-
index: exports_external.number(),
|
|
26975
|
-
content_block: exports_external.discriminatedUnion("type", [
|
|
26976
|
-
exports_external.object({
|
|
26977
|
-
type: exports_external.literal("text"),
|
|
26978
|
-
text: exports_external.string()
|
|
26979
|
-
}),
|
|
26980
|
-
exports_external.object({
|
|
26981
|
-
type: exports_external.literal("thinking"),
|
|
26982
|
-
thinking: exports_external.string()
|
|
26983
|
-
}),
|
|
26984
|
-
exports_external.object({
|
|
26985
|
-
type: exports_external.literal("tool_use"),
|
|
26986
|
-
id: exports_external.string(),
|
|
26987
|
-
name: exports_external.string()
|
|
26988
|
-
}),
|
|
26989
|
-
exports_external.object({
|
|
26990
|
-
type: exports_external.literal("redacted_thinking"),
|
|
26991
|
-
data: exports_external.string()
|
|
26992
|
-
}),
|
|
26993
|
-
exports_external.object({
|
|
26994
|
-
type: exports_external.literal("server_tool_use"),
|
|
26995
|
-
id: exports_external.string(),
|
|
26996
|
-
name: exports_external.string(),
|
|
26997
|
-
input: exports_external.record(exports_external.string(), exports_external.unknown()).nullish()
|
|
26998
|
-
}),
|
|
26999
|
-
exports_external.object({
|
|
27000
|
-
type: exports_external.literal("web_fetch_tool_result"),
|
|
27001
|
-
tool_use_id: exports_external.string(),
|
|
27002
|
-
content: exports_external.union([
|
|
27003
|
-
exports_external.object({
|
|
27004
|
-
type: exports_external.literal("web_fetch_result"),
|
|
27005
|
-
url: exports_external.string(),
|
|
27006
|
-
retrieved_at: exports_external.string(),
|
|
27007
|
-
content: exports_external.object({
|
|
27008
|
-
type: exports_external.literal("document"),
|
|
27009
|
-
title: exports_external.string().nullable(),
|
|
27010
|
-
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
27011
|
-
source: exports_external.object({
|
|
27012
|
-
type: exports_external.literal("text"),
|
|
27013
|
-
media_type: exports_external.string(),
|
|
27014
|
-
data: exports_external.string()
|
|
27015
|
-
})
|
|
27016
|
-
})
|
|
27017
|
-
}),
|
|
27018
|
-
exports_external.object({
|
|
27019
|
-
type: exports_external.literal("web_fetch_tool_result_error"),
|
|
27020
|
-
error_code: exports_external.string()
|
|
27021
|
-
})
|
|
27022
|
-
])
|
|
27023
|
-
}),
|
|
27024
|
-
exports_external.object({
|
|
27025
|
-
type: exports_external.literal("web_search_tool_result"),
|
|
27026
|
-
tool_use_id: exports_external.string(),
|
|
27027
|
-
content: exports_external.union([
|
|
27028
|
-
exports_external.array(exports_external.object({
|
|
27029
|
-
type: exports_external.literal("web_search_result"),
|
|
27030
|
-
url: exports_external.string(),
|
|
27031
|
-
title: exports_external.string(),
|
|
27032
|
-
encrypted_content: exports_external.string(),
|
|
27033
|
-
page_age: exports_external.string().nullish()
|
|
27034
|
-
})),
|
|
27035
|
-
exports_external.object({
|
|
27036
|
-
type: exports_external.literal("web_search_tool_result_error"),
|
|
27037
|
-
error_code: exports_external.string()
|
|
27038
|
-
})
|
|
27039
|
-
])
|
|
27040
|
-
}),
|
|
27041
|
-
exports_external.object({
|
|
27042
|
-
type: exports_external.literal("code_execution_tool_result"),
|
|
27043
|
-
tool_use_id: exports_external.string(),
|
|
27044
|
-
content: exports_external.union([
|
|
27045
|
-
exports_external.object({
|
|
27046
|
-
type: exports_external.literal("code_execution_result"),
|
|
27047
|
-
stdout: exports_external.string(),
|
|
27048
|
-
stderr: exports_external.string(),
|
|
27049
|
-
return_code: exports_external.number()
|
|
27050
|
-
}),
|
|
27051
|
-
exports_external.object({
|
|
27052
|
-
type: exports_external.literal("code_execution_tool_result_error"),
|
|
27053
|
-
error_code: exports_external.string()
|
|
27054
|
-
})
|
|
27055
|
-
])
|
|
27056
|
-
})
|
|
27057
|
-
])
|
|
27058
|
-
}),
|
|
27059
|
-
exports_external.object({
|
|
27060
|
-
type: exports_external.literal("content_block_delta"),
|
|
27061
|
-
index: exports_external.number(),
|
|
27062
|
-
delta: exports_external.discriminatedUnion("type", [
|
|
27063
|
-
exports_external.object({
|
|
27064
|
-
type: exports_external.literal("input_json_delta"),
|
|
27065
|
-
partial_json: exports_external.string()
|
|
27066
|
-
}),
|
|
27067
|
-
exports_external.object({
|
|
27068
|
-
type: exports_external.literal("text_delta"),
|
|
27069
|
-
text: exports_external.string()
|
|
27070
|
-
}),
|
|
27071
|
-
exports_external.object({
|
|
27072
|
-
type: exports_external.literal("thinking_delta"),
|
|
27073
|
-
thinking: exports_external.string()
|
|
27074
|
-
}),
|
|
27075
|
-
exports_external.object({
|
|
27076
|
-
type: exports_external.literal("signature_delta"),
|
|
27077
|
-
signature: exports_external.string()
|
|
27078
|
-
}),
|
|
27079
|
-
exports_external.object({
|
|
27080
|
-
type: exports_external.literal("citations_delta"),
|
|
27081
|
-
citation: citationSchema
|
|
27082
|
-
})
|
|
27083
|
-
])
|
|
27084
|
-
}),
|
|
27085
|
-
exports_external.object({
|
|
27086
|
-
type: exports_external.literal("content_block_stop"),
|
|
27087
|
-
index: exports_external.number()
|
|
27088
|
-
}),
|
|
27089
|
-
exports_external.object({
|
|
27090
|
-
type: exports_external.literal("error"),
|
|
27091
|
-
error: exports_external.object({
|
|
27092
|
-
type: exports_external.string(),
|
|
27093
|
-
message: exports_external.string()
|
|
27094
|
-
})
|
|
27095
|
-
}),
|
|
27096
|
-
exports_external.object({
|
|
27097
|
-
type: exports_external.literal("message_delta"),
|
|
27098
|
-
delta: exports_external.object({
|
|
27099
|
-
stop_reason: exports_external.string().nullish(),
|
|
27100
|
-
stop_sequence: exports_external.string().nullish()
|
|
27101
|
-
}),
|
|
27102
|
-
usage: exports_external.looseObject({
|
|
27103
|
-
output_tokens: exports_external.number(),
|
|
27104
|
-
cache_creation_input_tokens: exports_external.number().nullish()
|
|
27105
|
-
})
|
|
27106
|
-
}),
|
|
27107
|
-
exports_external.object({
|
|
27108
|
-
type: exports_external.literal("message_stop")
|
|
27109
|
-
}),
|
|
27110
|
-
exports_external.object({
|
|
27111
|
-
type: exports_external.literal("ping")
|
|
27112
|
-
})
|
|
27113
|
-
]);
|
|
27114
|
-
var anthropicReasoningMetadataSchema = exports_external.object({
|
|
27115
|
-
signature: exports_external.string().optional(),
|
|
27116
|
-
redactedData: exports_external.string().optional()
|
|
27117
|
-
});
|
|
27235
|
+
var bash_20241022InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27236
|
+
command: exports_external.string(),
|
|
27237
|
+
restart: exports_external.boolean().optional()
|
|
27238
|
+
})));
|
|
27118
27239
|
var bash_20241022 = createProviderDefinedToolFactory({
|
|
27119
27240
|
id: "anthropic.bash_20241022",
|
|
27120
27241
|
name: "bash",
|
|
27121
|
-
inputSchema:
|
|
27122
|
-
command: v4_default.string(),
|
|
27123
|
-
restart: v4_default.boolean().optional()
|
|
27124
|
-
})
|
|
27242
|
+
inputSchema: bash_20241022InputSchema
|
|
27125
27243
|
});
|
|
27244
|
+
var bash_20250124InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27245
|
+
command: exports_external.string(),
|
|
27246
|
+
restart: exports_external.boolean().optional()
|
|
27247
|
+
})));
|
|
27126
27248
|
var bash_20250124 = createProviderDefinedToolFactory({
|
|
27127
27249
|
id: "anthropic.bash_20250124",
|
|
27128
27250
|
name: "bash",
|
|
27129
|
-
inputSchema:
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27251
|
+
inputSchema: bash_20250124InputSchema
|
|
27252
|
+
});
|
|
27253
|
+
var computer_20241022InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27254
|
+
action: exports_external.enum([
|
|
27255
|
+
"key",
|
|
27256
|
+
"type",
|
|
27257
|
+
"mouse_move",
|
|
27258
|
+
"left_click",
|
|
27259
|
+
"left_click_drag",
|
|
27260
|
+
"right_click",
|
|
27261
|
+
"middle_click",
|
|
27262
|
+
"double_click",
|
|
27263
|
+
"screenshot",
|
|
27264
|
+
"cursor_position"
|
|
27265
|
+
]),
|
|
27266
|
+
coordinate: exports_external.array(exports_external.number().int()).optional(),
|
|
27267
|
+
text: exports_external.string().optional()
|
|
27268
|
+
})));
|
|
27134
27269
|
var computer_20241022 = createProviderDefinedToolFactory({
|
|
27135
27270
|
id: "anthropic.computer_20241022",
|
|
27136
27271
|
name: "computer",
|
|
27137
|
-
inputSchema:
|
|
27138
|
-
|
|
27139
|
-
|
|
27140
|
-
|
|
27141
|
-
|
|
27142
|
-
|
|
27143
|
-
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
27272
|
+
inputSchema: computer_20241022InputSchema
|
|
27273
|
+
});
|
|
27274
|
+
var computer_20250124InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27275
|
+
action: exports_external.enum([
|
|
27276
|
+
"key",
|
|
27277
|
+
"hold_key",
|
|
27278
|
+
"type",
|
|
27279
|
+
"cursor_position",
|
|
27280
|
+
"mouse_move",
|
|
27281
|
+
"left_mouse_down",
|
|
27282
|
+
"left_mouse_up",
|
|
27283
|
+
"left_click",
|
|
27284
|
+
"left_click_drag",
|
|
27285
|
+
"right_click",
|
|
27286
|
+
"middle_click",
|
|
27287
|
+
"double_click",
|
|
27288
|
+
"triple_click",
|
|
27289
|
+
"scroll",
|
|
27290
|
+
"wait",
|
|
27291
|
+
"screenshot"
|
|
27292
|
+
]),
|
|
27293
|
+
coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(),
|
|
27294
|
+
duration: exports_external.number().optional(),
|
|
27295
|
+
scroll_amount: exports_external.number().optional(),
|
|
27296
|
+
scroll_direction: exports_external.enum(["up", "down", "left", "right"]).optional(),
|
|
27297
|
+
start_coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(),
|
|
27298
|
+
text: exports_external.string().optional()
|
|
27299
|
+
})));
|
|
27154
27300
|
var computer_20250124 = createProviderDefinedToolFactory({
|
|
27155
27301
|
id: "anthropic.computer_20250124",
|
|
27156
27302
|
name: "computer",
|
|
27157
|
-
inputSchema:
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27161
|
-
|
|
27162
|
-
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
"right_click",
|
|
27169
|
-
"middle_click",
|
|
27170
|
-
"double_click",
|
|
27171
|
-
"triple_click",
|
|
27172
|
-
"scroll",
|
|
27173
|
-
"wait",
|
|
27174
|
-
"screenshot"
|
|
27175
|
-
]),
|
|
27176
|
-
coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(),
|
|
27177
|
-
duration: exports_external.number().optional(),
|
|
27178
|
-
scroll_amount: exports_external.number().optional(),
|
|
27179
|
-
scroll_direction: exports_external.enum(["up", "down", "left", "right"]).optional(),
|
|
27180
|
-
start_coordinate: exports_external.tuple([exports_external.number().int(), exports_external.number().int()]).optional(),
|
|
27181
|
-
text: exports_external.string().optional()
|
|
27182
|
-
})
|
|
27183
|
-
});
|
|
27303
|
+
inputSchema: computer_20250124InputSchema
|
|
27304
|
+
});
|
|
27305
|
+
var textEditor_20241022InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27306
|
+
command: exports_external.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
27307
|
+
path: exports_external.string(),
|
|
27308
|
+
file_text: exports_external.string().optional(),
|
|
27309
|
+
insert_line: exports_external.number().int().optional(),
|
|
27310
|
+
new_str: exports_external.string().optional(),
|
|
27311
|
+
old_str: exports_external.string().optional(),
|
|
27312
|
+
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
27313
|
+
})));
|
|
27184
27314
|
var textEditor_20241022 = createProviderDefinedToolFactory({
|
|
27185
27315
|
id: "anthropic.text_editor_20241022",
|
|
27186
27316
|
name: "str_replace_editor",
|
|
27187
|
-
inputSchema:
|
|
27188
|
-
|
|
27189
|
-
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
|
|
27194
|
-
|
|
27195
|
-
|
|
27196
|
-
|
|
27317
|
+
inputSchema: textEditor_20241022InputSchema
|
|
27318
|
+
});
|
|
27319
|
+
var textEditor_20250124InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27320
|
+
command: exports_external.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
27321
|
+
path: exports_external.string(),
|
|
27322
|
+
file_text: exports_external.string().optional(),
|
|
27323
|
+
insert_line: exports_external.number().int().optional(),
|
|
27324
|
+
new_str: exports_external.string().optional(),
|
|
27325
|
+
old_str: exports_external.string().optional(),
|
|
27326
|
+
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
27327
|
+
})));
|
|
27197
27328
|
var textEditor_20250124 = createProviderDefinedToolFactory({
|
|
27198
27329
|
id: "anthropic.text_editor_20250124",
|
|
27199
27330
|
name: "str_replace_editor",
|
|
27200
|
-
inputSchema:
|
|
27201
|
-
|
|
27202
|
-
|
|
27203
|
-
|
|
27204
|
-
|
|
27205
|
-
|
|
27206
|
-
|
|
27207
|
-
|
|
27208
|
-
|
|
27209
|
-
|
|
27331
|
+
inputSchema: textEditor_20250124InputSchema
|
|
27332
|
+
});
|
|
27333
|
+
var textEditor_20250429InputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
27334
|
+
command: exports_external.enum(["view", "create", "str_replace", "insert"]),
|
|
27335
|
+
path: exports_external.string(),
|
|
27336
|
+
file_text: exports_external.string().optional(),
|
|
27337
|
+
insert_line: exports_external.number().int().optional(),
|
|
27338
|
+
new_str: exports_external.string().optional(),
|
|
27339
|
+
old_str: exports_external.string().optional(),
|
|
27340
|
+
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
27341
|
+
})));
|
|
27210
27342
|
var textEditor_20250429 = createProviderDefinedToolFactory({
|
|
27211
27343
|
id: "anthropic.text_editor_20250429",
|
|
27212
27344
|
name: "str_replace_based_edit_tool",
|
|
27213
|
-
inputSchema:
|
|
27214
|
-
command: exports_external.enum(["view", "create", "str_replace", "insert"]),
|
|
27215
|
-
path: exports_external.string(),
|
|
27216
|
-
file_text: exports_external.string().optional(),
|
|
27217
|
-
insert_line: exports_external.number().int().optional(),
|
|
27218
|
-
new_str: exports_external.string().optional(),
|
|
27219
|
-
old_str: exports_external.string().optional(),
|
|
27220
|
-
view_range: exports_external.array(exports_external.number().int()).optional()
|
|
27221
|
-
})
|
|
27345
|
+
inputSchema: textEditor_20250429InputSchema
|
|
27222
27346
|
});
|
|
27223
27347
|
var anthropicTools = {
|
|
27224
27348
|
bash_20241022,
|
|
@@ -27278,7 +27402,7 @@ function createAnthropic(options = {}) {
|
|
|
27278
27402
|
}
|
|
27279
27403
|
var anthropic = createAnthropic();
|
|
27280
27404
|
|
|
27281
|
-
// ../../node_modules/.pnpm/@ai-sdk+openai@2.0.
|
|
27405
|
+
// ../../node_modules/.pnpm/@ai-sdk+openai@2.0.50_zod@3.25.76/node_modules/@ai-sdk/openai/dist/index.mjs
|
|
27282
27406
|
var openaiErrorDataSchema = exports_external.object({
|
|
27283
27407
|
error: exports_external.object({
|
|
27284
27408
|
message: exports_external.string(),
|
|
@@ -27488,7 +27612,113 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
27488
27612
|
return "unknown";
|
|
27489
27613
|
}
|
|
27490
27614
|
}
|
|
27491
|
-
var
|
|
27615
|
+
var openaiChatResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
27616
|
+
id: exports_external.string().nullish(),
|
|
27617
|
+
created: exports_external.number().nullish(),
|
|
27618
|
+
model: exports_external.string().nullish(),
|
|
27619
|
+
choices: exports_external.array(exports_external.object({
|
|
27620
|
+
message: exports_external.object({
|
|
27621
|
+
role: exports_external.literal("assistant").nullish(),
|
|
27622
|
+
content: exports_external.string().nullish(),
|
|
27623
|
+
tool_calls: exports_external.array(exports_external.object({
|
|
27624
|
+
id: exports_external.string().nullish(),
|
|
27625
|
+
type: exports_external.literal("function"),
|
|
27626
|
+
function: exports_external.object({
|
|
27627
|
+
name: exports_external.string(),
|
|
27628
|
+
arguments: exports_external.string()
|
|
27629
|
+
})
|
|
27630
|
+
})).nullish(),
|
|
27631
|
+
annotations: exports_external.array(exports_external.object({
|
|
27632
|
+
type: exports_external.literal("url_citation"),
|
|
27633
|
+
start_index: exports_external.number(),
|
|
27634
|
+
end_index: exports_external.number(),
|
|
27635
|
+
url: exports_external.string(),
|
|
27636
|
+
title: exports_external.string()
|
|
27637
|
+
})).nullish()
|
|
27638
|
+
}),
|
|
27639
|
+
index: exports_external.number(),
|
|
27640
|
+
logprobs: exports_external.object({
|
|
27641
|
+
content: exports_external.array(exports_external.object({
|
|
27642
|
+
token: exports_external.string(),
|
|
27643
|
+
logprob: exports_external.number(),
|
|
27644
|
+
top_logprobs: exports_external.array(exports_external.object({
|
|
27645
|
+
token: exports_external.string(),
|
|
27646
|
+
logprob: exports_external.number()
|
|
27647
|
+
}))
|
|
27648
|
+
})).nullish()
|
|
27649
|
+
}).nullish(),
|
|
27650
|
+
finish_reason: exports_external.string().nullish()
|
|
27651
|
+
})),
|
|
27652
|
+
usage: exports_external.object({
|
|
27653
|
+
prompt_tokens: exports_external.number().nullish(),
|
|
27654
|
+
completion_tokens: exports_external.number().nullish(),
|
|
27655
|
+
total_tokens: exports_external.number().nullish(),
|
|
27656
|
+
prompt_tokens_details: exports_external.object({
|
|
27657
|
+
cached_tokens: exports_external.number().nullish()
|
|
27658
|
+
}).nullish(),
|
|
27659
|
+
completion_tokens_details: exports_external.object({
|
|
27660
|
+
reasoning_tokens: exports_external.number().nullish(),
|
|
27661
|
+
accepted_prediction_tokens: exports_external.number().nullish(),
|
|
27662
|
+
rejected_prediction_tokens: exports_external.number().nullish()
|
|
27663
|
+
}).nullish()
|
|
27664
|
+
}).nullish()
|
|
27665
|
+
})));
|
|
27666
|
+
var openaiChatChunkSchema = lazyValidator(() => zodSchema(exports_external.union([
|
|
27667
|
+
exports_external.object({
|
|
27668
|
+
id: exports_external.string().nullish(),
|
|
27669
|
+
created: exports_external.number().nullish(),
|
|
27670
|
+
model: exports_external.string().nullish(),
|
|
27671
|
+
choices: exports_external.array(exports_external.object({
|
|
27672
|
+
delta: exports_external.object({
|
|
27673
|
+
role: exports_external.enum(["assistant"]).nullish(),
|
|
27674
|
+
content: exports_external.string().nullish(),
|
|
27675
|
+
tool_calls: exports_external.array(exports_external.object({
|
|
27676
|
+
index: exports_external.number(),
|
|
27677
|
+
id: exports_external.string().nullish(),
|
|
27678
|
+
type: exports_external.literal("function").nullish(),
|
|
27679
|
+
function: exports_external.object({
|
|
27680
|
+
name: exports_external.string().nullish(),
|
|
27681
|
+
arguments: exports_external.string().nullish()
|
|
27682
|
+
})
|
|
27683
|
+
})).nullish(),
|
|
27684
|
+
annotations: exports_external.array(exports_external.object({
|
|
27685
|
+
type: exports_external.literal("url_citation"),
|
|
27686
|
+
start_index: exports_external.number(),
|
|
27687
|
+
end_index: exports_external.number(),
|
|
27688
|
+
url: exports_external.string(),
|
|
27689
|
+
title: exports_external.string()
|
|
27690
|
+
})).nullish()
|
|
27691
|
+
}).nullish(),
|
|
27692
|
+
logprobs: exports_external.object({
|
|
27693
|
+
content: exports_external.array(exports_external.object({
|
|
27694
|
+
token: exports_external.string(),
|
|
27695
|
+
logprob: exports_external.number(),
|
|
27696
|
+
top_logprobs: exports_external.array(exports_external.object({
|
|
27697
|
+
token: exports_external.string(),
|
|
27698
|
+
logprob: exports_external.number()
|
|
27699
|
+
}))
|
|
27700
|
+
})).nullish()
|
|
27701
|
+
}).nullish(),
|
|
27702
|
+
finish_reason: exports_external.string().nullish(),
|
|
27703
|
+
index: exports_external.number()
|
|
27704
|
+
})),
|
|
27705
|
+
usage: exports_external.object({
|
|
27706
|
+
prompt_tokens: exports_external.number().nullish(),
|
|
27707
|
+
completion_tokens: exports_external.number().nullish(),
|
|
27708
|
+
total_tokens: exports_external.number().nullish(),
|
|
27709
|
+
prompt_tokens_details: exports_external.object({
|
|
27710
|
+
cached_tokens: exports_external.number().nullish()
|
|
27711
|
+
}).nullish(),
|
|
27712
|
+
completion_tokens_details: exports_external.object({
|
|
27713
|
+
reasoning_tokens: exports_external.number().nullish(),
|
|
27714
|
+
accepted_prediction_tokens: exports_external.number().nullish(),
|
|
27715
|
+
rejected_prediction_tokens: exports_external.number().nullish()
|
|
27716
|
+
}).nullish()
|
|
27717
|
+
}).nullish()
|
|
27718
|
+
}),
|
|
27719
|
+
openaiErrorDataSchema
|
|
27720
|
+
])));
|
|
27721
|
+
var openaiChatLanguageModelOptions = lazyValidator(() => zodSchema(exports_external.object({
|
|
27492
27722
|
logitBias: exports_external.record(exports_external.coerce.number(), exports_external.number()).optional(),
|
|
27493
27723
|
logprobs: exports_external.union([exports_external.boolean(), exports_external.number()]).optional(),
|
|
27494
27724
|
parallelToolCalls: exports_external.boolean().optional(),
|
|
@@ -27499,12 +27729,12 @@ var openaiChatLanguageModelOptions = exports_external.object({
|
|
|
27499
27729
|
metadata: exports_external.record(exports_external.string().max(64), exports_external.string().max(512)).optional(),
|
|
27500
27730
|
prediction: exports_external.record(exports_external.string(), exports_external.any()).optional(),
|
|
27501
27731
|
structuredOutputs: exports_external.boolean().optional(),
|
|
27502
|
-
serviceTier: exports_external.enum(["auto", "flex", "priority"]).optional(),
|
|
27732
|
+
serviceTier: exports_external.enum(["auto", "flex", "priority", "default"]).optional(),
|
|
27503
27733
|
strictJsonSchema: exports_external.boolean().optional(),
|
|
27504
27734
|
textVerbosity: exports_external.enum(["low", "medium", "high"]).optional(),
|
|
27505
27735
|
promptCacheKey: exports_external.string().optional(),
|
|
27506
27736
|
safetyIdentifier: exports_external.string().optional()
|
|
27507
|
-
});
|
|
27737
|
+
})));
|
|
27508
27738
|
function prepareChatTools({
|
|
27509
27739
|
tools,
|
|
27510
27740
|
toolChoice,
|
|
@@ -28041,101 +28271,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
28041
28271
|
};
|
|
28042
28272
|
}
|
|
28043
28273
|
};
|
|
28044
|
-
var openaiTokenUsageSchema = exports_external.object({
|
|
28045
|
-
prompt_tokens: exports_external.number().nullish(),
|
|
28046
|
-
completion_tokens: exports_external.number().nullish(),
|
|
28047
|
-
total_tokens: exports_external.number().nullish(),
|
|
28048
|
-
prompt_tokens_details: exports_external.object({
|
|
28049
|
-
cached_tokens: exports_external.number().nullish()
|
|
28050
|
-
}).nullish(),
|
|
28051
|
-
completion_tokens_details: exports_external.object({
|
|
28052
|
-
reasoning_tokens: exports_external.number().nullish(),
|
|
28053
|
-
accepted_prediction_tokens: exports_external.number().nullish(),
|
|
28054
|
-
rejected_prediction_tokens: exports_external.number().nullish()
|
|
28055
|
-
}).nullish()
|
|
28056
|
-
}).nullish();
|
|
28057
|
-
var openaiChatResponseSchema = exports_external.object({
|
|
28058
|
-
id: exports_external.string().nullish(),
|
|
28059
|
-
created: exports_external.number().nullish(),
|
|
28060
|
-
model: exports_external.string().nullish(),
|
|
28061
|
-
choices: exports_external.array(exports_external.object({
|
|
28062
|
-
message: exports_external.object({
|
|
28063
|
-
role: exports_external.literal("assistant").nullish(),
|
|
28064
|
-
content: exports_external.string().nullish(),
|
|
28065
|
-
tool_calls: exports_external.array(exports_external.object({
|
|
28066
|
-
id: exports_external.string().nullish(),
|
|
28067
|
-
type: exports_external.literal("function"),
|
|
28068
|
-
function: exports_external.object({
|
|
28069
|
-
name: exports_external.string(),
|
|
28070
|
-
arguments: exports_external.string()
|
|
28071
|
-
})
|
|
28072
|
-
})).nullish(),
|
|
28073
|
-
annotations: exports_external.array(exports_external.object({
|
|
28074
|
-
type: exports_external.literal("url_citation"),
|
|
28075
|
-
start_index: exports_external.number(),
|
|
28076
|
-
end_index: exports_external.number(),
|
|
28077
|
-
url: exports_external.string(),
|
|
28078
|
-
title: exports_external.string()
|
|
28079
|
-
})).nullish()
|
|
28080
|
-
}),
|
|
28081
|
-
index: exports_external.number(),
|
|
28082
|
-
logprobs: exports_external.object({
|
|
28083
|
-
content: exports_external.array(exports_external.object({
|
|
28084
|
-
token: exports_external.string(),
|
|
28085
|
-
logprob: exports_external.number(),
|
|
28086
|
-
top_logprobs: exports_external.array(exports_external.object({
|
|
28087
|
-
token: exports_external.string(),
|
|
28088
|
-
logprob: exports_external.number()
|
|
28089
|
-
}))
|
|
28090
|
-
})).nullish()
|
|
28091
|
-
}).nullish(),
|
|
28092
|
-
finish_reason: exports_external.string().nullish()
|
|
28093
|
-
})),
|
|
28094
|
-
usage: openaiTokenUsageSchema
|
|
28095
|
-
});
|
|
28096
|
-
var openaiChatChunkSchema = exports_external.union([
|
|
28097
|
-
exports_external.object({
|
|
28098
|
-
id: exports_external.string().nullish(),
|
|
28099
|
-
created: exports_external.number().nullish(),
|
|
28100
|
-
model: exports_external.string().nullish(),
|
|
28101
|
-
choices: exports_external.array(exports_external.object({
|
|
28102
|
-
delta: exports_external.object({
|
|
28103
|
-
role: exports_external.enum(["assistant"]).nullish(),
|
|
28104
|
-
content: exports_external.string().nullish(),
|
|
28105
|
-
tool_calls: exports_external.array(exports_external.object({
|
|
28106
|
-
index: exports_external.number(),
|
|
28107
|
-
id: exports_external.string().nullish(),
|
|
28108
|
-
type: exports_external.literal("function").nullish(),
|
|
28109
|
-
function: exports_external.object({
|
|
28110
|
-
name: exports_external.string().nullish(),
|
|
28111
|
-
arguments: exports_external.string().nullish()
|
|
28112
|
-
})
|
|
28113
|
-
})).nullish(),
|
|
28114
|
-
annotations: exports_external.array(exports_external.object({
|
|
28115
|
-
type: exports_external.literal("url_citation"),
|
|
28116
|
-
start_index: exports_external.number(),
|
|
28117
|
-
end_index: exports_external.number(),
|
|
28118
|
-
url: exports_external.string(),
|
|
28119
|
-
title: exports_external.string()
|
|
28120
|
-
})).nullish()
|
|
28121
|
-
}).nullish(),
|
|
28122
|
-
logprobs: exports_external.object({
|
|
28123
|
-
content: exports_external.array(exports_external.object({
|
|
28124
|
-
token: exports_external.string(),
|
|
28125
|
-
logprob: exports_external.number(),
|
|
28126
|
-
top_logprobs: exports_external.array(exports_external.object({
|
|
28127
|
-
token: exports_external.string(),
|
|
28128
|
-
logprob: exports_external.number()
|
|
28129
|
-
}))
|
|
28130
|
-
})).nullish()
|
|
28131
|
-
}).nullish(),
|
|
28132
|
-
finish_reason: exports_external.string().nullish(),
|
|
28133
|
-
index: exports_external.number()
|
|
28134
|
-
})),
|
|
28135
|
-
usage: openaiTokenUsageSchema
|
|
28136
|
-
}),
|
|
28137
|
-
openaiErrorDataSchema
|
|
28138
|
-
]);
|
|
28139
28274
|
function isReasoningModel(modelId) {
|
|
28140
28275
|
return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
|
|
28141
28276
|
}
|
|
@@ -28282,13 +28417,55 @@ function mapOpenAIFinishReason2(finishReason) {
|
|
|
28282
28417
|
return "unknown";
|
|
28283
28418
|
}
|
|
28284
28419
|
}
|
|
28285
|
-
var
|
|
28420
|
+
var openaiCompletionResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
28421
|
+
id: exports_external.string().nullish(),
|
|
28422
|
+
created: exports_external.number().nullish(),
|
|
28423
|
+
model: exports_external.string().nullish(),
|
|
28424
|
+
choices: exports_external.array(exports_external.object({
|
|
28425
|
+
text: exports_external.string(),
|
|
28426
|
+
finish_reason: exports_external.string(),
|
|
28427
|
+
logprobs: exports_external.object({
|
|
28428
|
+
tokens: exports_external.array(exports_external.string()),
|
|
28429
|
+
token_logprobs: exports_external.array(exports_external.number()),
|
|
28430
|
+
top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish()
|
|
28431
|
+
}).nullish()
|
|
28432
|
+
})),
|
|
28433
|
+
usage: exports_external.object({
|
|
28434
|
+
prompt_tokens: exports_external.number(),
|
|
28435
|
+
completion_tokens: exports_external.number(),
|
|
28436
|
+
total_tokens: exports_external.number()
|
|
28437
|
+
}).nullish()
|
|
28438
|
+
})));
|
|
28439
|
+
var openaiCompletionChunkSchema = lazyValidator(() => zodSchema(exports_external.union([
|
|
28440
|
+
exports_external.object({
|
|
28441
|
+
id: exports_external.string().nullish(),
|
|
28442
|
+
created: exports_external.number().nullish(),
|
|
28443
|
+
model: exports_external.string().nullish(),
|
|
28444
|
+
choices: exports_external.array(exports_external.object({
|
|
28445
|
+
text: exports_external.string(),
|
|
28446
|
+
finish_reason: exports_external.string().nullish(),
|
|
28447
|
+
index: exports_external.number(),
|
|
28448
|
+
logprobs: exports_external.object({
|
|
28449
|
+
tokens: exports_external.array(exports_external.string()),
|
|
28450
|
+
token_logprobs: exports_external.array(exports_external.number()),
|
|
28451
|
+
top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish()
|
|
28452
|
+
}).nullish()
|
|
28453
|
+
})),
|
|
28454
|
+
usage: exports_external.object({
|
|
28455
|
+
prompt_tokens: exports_external.number(),
|
|
28456
|
+
completion_tokens: exports_external.number(),
|
|
28457
|
+
total_tokens: exports_external.number()
|
|
28458
|
+
}).nullish()
|
|
28459
|
+
}),
|
|
28460
|
+
openaiErrorDataSchema
|
|
28461
|
+
])));
|
|
28462
|
+
var openaiCompletionProviderOptions = lazyValidator(() => zodSchema(exports_external.object({
|
|
28286
28463
|
echo: exports_external.boolean().optional(),
|
|
28287
28464
|
logitBias: exports_external.record(exports_external.string(), exports_external.number()).optional(),
|
|
28288
28465
|
suffix: exports_external.string().optional(),
|
|
28289
28466
|
user: exports_external.string().optional(),
|
|
28290
28467
|
logprobs: exports_external.union([exports_external.boolean(), exports_external.number()]).optional()
|
|
28291
|
-
});
|
|
28468
|
+
})));
|
|
28292
28469
|
var OpenAICompletionLanguageModel = class {
|
|
28293
28470
|
constructor(modelId, config2) {
|
|
28294
28471
|
this.specificationVersion = "v2";
|
|
@@ -28504,49 +28681,14 @@ var OpenAICompletionLanguageModel = class {
|
|
|
28504
28681
|
};
|
|
28505
28682
|
}
|
|
28506
28683
|
};
|
|
28507
|
-
var
|
|
28508
|
-
prompt_tokens: exports_external.number(),
|
|
28509
|
-
completion_tokens: exports_external.number(),
|
|
28510
|
-
total_tokens: exports_external.number()
|
|
28511
|
-
});
|
|
28512
|
-
var openaiCompletionResponseSchema = exports_external.object({
|
|
28513
|
-
id: exports_external.string().nullish(),
|
|
28514
|
-
created: exports_external.number().nullish(),
|
|
28515
|
-
model: exports_external.string().nullish(),
|
|
28516
|
-
choices: exports_external.array(exports_external.object({
|
|
28517
|
-
text: exports_external.string(),
|
|
28518
|
-
finish_reason: exports_external.string(),
|
|
28519
|
-
logprobs: exports_external.object({
|
|
28520
|
-
tokens: exports_external.array(exports_external.string()),
|
|
28521
|
-
token_logprobs: exports_external.array(exports_external.number()),
|
|
28522
|
-
top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish()
|
|
28523
|
-
}).nullish()
|
|
28524
|
-
})),
|
|
28525
|
-
usage: usageSchema.nullish()
|
|
28526
|
-
});
|
|
28527
|
-
var openaiCompletionChunkSchema = exports_external.union([
|
|
28528
|
-
exports_external.object({
|
|
28529
|
-
id: exports_external.string().nullish(),
|
|
28530
|
-
created: exports_external.number().nullish(),
|
|
28531
|
-
model: exports_external.string().nullish(),
|
|
28532
|
-
choices: exports_external.array(exports_external.object({
|
|
28533
|
-
text: exports_external.string(),
|
|
28534
|
-
finish_reason: exports_external.string().nullish(),
|
|
28535
|
-
index: exports_external.number(),
|
|
28536
|
-
logprobs: exports_external.object({
|
|
28537
|
-
tokens: exports_external.array(exports_external.string()),
|
|
28538
|
-
token_logprobs: exports_external.array(exports_external.number()),
|
|
28539
|
-
top_logprobs: exports_external.array(exports_external.record(exports_external.string(), exports_external.number())).nullish()
|
|
28540
|
-
}).nullish()
|
|
28541
|
-
})),
|
|
28542
|
-
usage: usageSchema.nullish()
|
|
28543
|
-
}),
|
|
28544
|
-
openaiErrorDataSchema
|
|
28545
|
-
]);
|
|
28546
|
-
var openaiEmbeddingProviderOptions = exports_external.object({
|
|
28684
|
+
var openaiEmbeddingProviderOptions = lazyValidator(() => zodSchema(exports_external.object({
|
|
28547
28685
|
dimensions: exports_external.number().optional(),
|
|
28548
28686
|
user: exports_external.string().optional()
|
|
28549
|
-
});
|
|
28687
|
+
})));
|
|
28688
|
+
var openaiTextEmbeddingResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
28689
|
+
data: exports_external.array(exports_external.object({ embedding: exports_external.array(exports_external.number()) })),
|
|
28690
|
+
usage: exports_external.object({ prompt_tokens: exports_external.number() }).nullish()
|
|
28691
|
+
})));
|
|
28550
28692
|
var OpenAIEmbeddingModel = class {
|
|
28551
28693
|
constructor(modelId, config2) {
|
|
28552
28694
|
this.specificationVersion = "v2";
|
|
@@ -28607,16 +28749,22 @@ var OpenAIEmbeddingModel = class {
|
|
|
28607
28749
|
};
|
|
28608
28750
|
}
|
|
28609
28751
|
};
|
|
28610
|
-
var
|
|
28611
|
-
data: exports_external.array(exports_external.object({
|
|
28612
|
-
|
|
28613
|
-
|
|
28752
|
+
var openaiImageResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
28753
|
+
data: exports_external.array(exports_external.object({
|
|
28754
|
+
b64_json: exports_external.string(),
|
|
28755
|
+
revised_prompt: exports_external.string().optional()
|
|
28756
|
+
}))
|
|
28757
|
+
})));
|
|
28614
28758
|
var modelMaxImagesPerCall = {
|
|
28615
28759
|
"dall-e-3": 1,
|
|
28616
28760
|
"dall-e-2": 10,
|
|
28617
|
-
"gpt-image-1": 10
|
|
28761
|
+
"gpt-image-1": 10,
|
|
28762
|
+
"gpt-image-1-mini": 10
|
|
28618
28763
|
};
|
|
28619
|
-
var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
28764
|
+
var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
|
|
28765
|
+
"gpt-image-1",
|
|
28766
|
+
"gpt-image-1-mini"
|
|
28767
|
+
]);
|
|
28620
28768
|
var OpenAIImageModel = class {
|
|
28621
28769
|
constructor(modelId, config2) {
|
|
28622
28770
|
this.modelId = modelId;
|
|
@@ -28690,27 +28838,24 @@ var OpenAIImageModel = class {
|
|
|
28690
28838
|
};
|
|
28691
28839
|
}
|
|
28692
28840
|
};
|
|
28693
|
-
var
|
|
28694
|
-
data: exports_external.array(exports_external.object({ b64_json: exports_external.string(), revised_prompt: exports_external.string().optional() }))
|
|
28695
|
-
});
|
|
28696
|
-
var codeInterpreterInputSchema = exports_external.object({
|
|
28841
|
+
var codeInterpreterInputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28697
28842
|
code: exports_external.string().nullish(),
|
|
28698
28843
|
containerId: exports_external.string()
|
|
28699
|
-
});
|
|
28700
|
-
var codeInterpreterOutputSchema = exports_external.object({
|
|
28844
|
+
})));
|
|
28845
|
+
var codeInterpreterOutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28701
28846
|
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
28702
28847
|
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
28703
28848
|
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
28704
28849
|
])).nullish()
|
|
28705
|
-
});
|
|
28706
|
-
var codeInterpreterArgsSchema = exports_external.object({
|
|
28850
|
+
})));
|
|
28851
|
+
var codeInterpreterArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28707
28852
|
container: exports_external.union([
|
|
28708
28853
|
exports_external.string(),
|
|
28709
28854
|
exports_external.object({
|
|
28710
28855
|
fileIds: exports_external.array(exports_external.string()).optional()
|
|
28711
28856
|
})
|
|
28712
28857
|
]).optional()
|
|
28713
|
-
});
|
|
28858
|
+
})));
|
|
28714
28859
|
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
|
|
28715
28860
|
id: "openai.code_interpreter",
|
|
28716
28861
|
name: "code_interpreter",
|
|
@@ -28729,7 +28874,7 @@ var compoundFilterSchema = exports_external.object({
|
|
|
28729
28874
|
type: exports_external.enum(["and", "or"]),
|
|
28730
28875
|
filters: exports_external.array(exports_external.union([comparisonFilterSchema, exports_external.lazy(() => compoundFilterSchema)]))
|
|
28731
28876
|
});
|
|
28732
|
-
var fileSearchArgsSchema = exports_external.object({
|
|
28877
|
+
var fileSearchArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28733
28878
|
vectorStoreIds: exports_external.array(exports_external.string()),
|
|
28734
28879
|
maxNumResults: exports_external.number().optional(),
|
|
28735
28880
|
ranking: exports_external.object({
|
|
@@ -28737,8 +28882,8 @@ var fileSearchArgsSchema = exports_external.object({
|
|
|
28737
28882
|
scoreThreshold: exports_external.number().optional()
|
|
28738
28883
|
}).optional(),
|
|
28739
28884
|
filters: exports_external.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
28740
|
-
});
|
|
28741
|
-
var fileSearchOutputSchema = exports_external.object({
|
|
28885
|
+
})));
|
|
28886
|
+
var fileSearchOutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28742
28887
|
queries: exports_external.array(exports_external.string()),
|
|
28743
28888
|
results: exports_external.array(exports_external.object({
|
|
28744
28889
|
attributes: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
@@ -28747,14 +28892,14 @@ var fileSearchOutputSchema = exports_external.object({
|
|
|
28747
28892
|
score: exports_external.number(),
|
|
28748
28893
|
text: exports_external.string()
|
|
28749
28894
|
})).nullable()
|
|
28750
|
-
});
|
|
28895
|
+
})));
|
|
28751
28896
|
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema({
|
|
28752
28897
|
id: "openai.file_search",
|
|
28753
28898
|
name: "file_search",
|
|
28754
28899
|
inputSchema: exports_external.object({}),
|
|
28755
28900
|
outputSchema: fileSearchOutputSchema
|
|
28756
28901
|
});
|
|
28757
|
-
var imageGenerationArgsSchema = exports_external.object({
|
|
28902
|
+
var imageGenerationArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28758
28903
|
background: exports_external.enum(["auto", "opaque", "transparent"]).optional(),
|
|
28759
28904
|
inputFidelity: exports_external.enum(["low", "high"]).optional(),
|
|
28760
28905
|
inputImageMask: exports_external.object({
|
|
@@ -28765,22 +28910,22 @@ var imageGenerationArgsSchema = exports_external.object({
|
|
|
28765
28910
|
moderation: exports_external.enum(["auto"]).optional(),
|
|
28766
28911
|
outputCompression: exports_external.number().int().min(0).max(100).optional(),
|
|
28767
28912
|
outputFormat: exports_external.enum(["png", "jpeg", "webp"]).optional(),
|
|
28913
|
+
partialImages: exports_external.number().int().min(0).max(3).optional(),
|
|
28768
28914
|
quality: exports_external.enum(["auto", "low", "medium", "high"]).optional(),
|
|
28769
28915
|
size: exports_external.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
28770
|
-
}).strict();
|
|
28771
|
-
var
|
|
28772
|
-
|
|
28773
|
-
});
|
|
28916
|
+
}).strict()));
|
|
28917
|
+
var imageGenerationInputSchema = lazySchema(() => zodSchema(exports_external.object({})));
|
|
28918
|
+
var imageGenerationOutputSchema = lazySchema(() => zodSchema(exports_external.object({ result: exports_external.string() })));
|
|
28774
28919
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
|
|
28775
28920
|
id: "openai.image_generation",
|
|
28776
28921
|
name: "image_generation",
|
|
28777
|
-
inputSchema:
|
|
28922
|
+
inputSchema: imageGenerationInputSchema,
|
|
28778
28923
|
outputSchema: imageGenerationOutputSchema
|
|
28779
28924
|
});
|
|
28780
28925
|
var imageGeneration = (args = {}) => {
|
|
28781
28926
|
return imageGenerationToolFactory(args);
|
|
28782
28927
|
};
|
|
28783
|
-
var localShellInputSchema = exports_external.object({
|
|
28928
|
+
var localShellInputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28784
28929
|
action: exports_external.object({
|
|
28785
28930
|
type: exports_external.literal("exec"),
|
|
28786
28931
|
command: exports_external.array(exports_external.string()),
|
|
@@ -28789,17 +28934,15 @@ var localShellInputSchema = exports_external.object({
|
|
|
28789
28934
|
workingDirectory: exports_external.string().optional(),
|
|
28790
28935
|
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
28791
28936
|
})
|
|
28792
|
-
});
|
|
28793
|
-
var localShellOutputSchema = exports_external.object({
|
|
28794
|
-
output: exports_external.string()
|
|
28795
|
-
});
|
|
28937
|
+
})));
|
|
28938
|
+
var localShellOutputSchema = lazySchema(() => zodSchema(exports_external.object({ output: exports_external.string() })));
|
|
28796
28939
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
28797
28940
|
id: "openai.local_shell",
|
|
28798
28941
|
name: "local_shell",
|
|
28799
28942
|
inputSchema: localShellInputSchema,
|
|
28800
28943
|
outputSchema: localShellOutputSchema
|
|
28801
28944
|
});
|
|
28802
|
-
var webSearchArgsSchema = exports_external.object({
|
|
28945
|
+
var webSearchArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28803
28946
|
filters: exports_external.object({
|
|
28804
28947
|
allowedDomains: exports_external.array(exports_external.string()).optional()
|
|
28805
28948
|
}).optional(),
|
|
@@ -28811,32 +28954,33 @@ var webSearchArgsSchema = exports_external.object({
|
|
|
28811
28954
|
region: exports_external.string().optional(),
|
|
28812
28955
|
timezone: exports_external.string().optional()
|
|
28813
28956
|
}).optional()
|
|
28814
|
-
});
|
|
28957
|
+
})));
|
|
28958
|
+
var webSearchInputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28959
|
+
action: exports_external.discriminatedUnion("type", [
|
|
28960
|
+
exports_external.object({
|
|
28961
|
+
type: exports_external.literal("search"),
|
|
28962
|
+
query: exports_external.string().nullish()
|
|
28963
|
+
}),
|
|
28964
|
+
exports_external.object({
|
|
28965
|
+
type: exports_external.literal("open_page"),
|
|
28966
|
+
url: exports_external.string()
|
|
28967
|
+
}),
|
|
28968
|
+
exports_external.object({
|
|
28969
|
+
type: exports_external.literal("find"),
|
|
28970
|
+
url: exports_external.string(),
|
|
28971
|
+
pattern: exports_external.string()
|
|
28972
|
+
})
|
|
28973
|
+
]).nullish()
|
|
28974
|
+
})));
|
|
28815
28975
|
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
28816
28976
|
id: "openai.web_search",
|
|
28817
28977
|
name: "web_search",
|
|
28818
|
-
inputSchema:
|
|
28819
|
-
action: exports_external.discriminatedUnion("type", [
|
|
28820
|
-
exports_external.object({
|
|
28821
|
-
type: exports_external.literal("search"),
|
|
28822
|
-
query: exports_external.string().nullish()
|
|
28823
|
-
}),
|
|
28824
|
-
exports_external.object({
|
|
28825
|
-
type: exports_external.literal("open_page"),
|
|
28826
|
-
url: exports_external.string()
|
|
28827
|
-
}),
|
|
28828
|
-
exports_external.object({
|
|
28829
|
-
type: exports_external.literal("find"),
|
|
28830
|
-
url: exports_external.string(),
|
|
28831
|
-
pattern: exports_external.string()
|
|
28832
|
-
})
|
|
28833
|
-
]).nullish()
|
|
28834
|
-
})
|
|
28978
|
+
inputSchema: webSearchInputSchema
|
|
28835
28979
|
});
|
|
28836
28980
|
var webSearch = (args = {}) => {
|
|
28837
28981
|
return webSearchToolFactory(args);
|
|
28838
28982
|
};
|
|
28839
|
-
var webSearchPreviewArgsSchema = exports_external.object({
|
|
28983
|
+
var webSearchPreviewArgsSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28840
28984
|
searchContextSize: exports_external.enum(["low", "medium", "high"]).optional(),
|
|
28841
28985
|
userLocation: exports_external.object({
|
|
28842
28986
|
type: exports_external.literal("approximate"),
|
|
@@ -28845,27 +28989,28 @@ var webSearchPreviewArgsSchema = exports_external.object({
|
|
|
28845
28989
|
region: exports_external.string().optional(),
|
|
28846
28990
|
timezone: exports_external.string().optional()
|
|
28847
28991
|
}).optional()
|
|
28848
|
-
});
|
|
28992
|
+
})));
|
|
28993
|
+
var webSearchPreviewInputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
28994
|
+
action: exports_external.discriminatedUnion("type", [
|
|
28995
|
+
exports_external.object({
|
|
28996
|
+
type: exports_external.literal("search"),
|
|
28997
|
+
query: exports_external.string().nullish()
|
|
28998
|
+
}),
|
|
28999
|
+
exports_external.object({
|
|
29000
|
+
type: exports_external.literal("open_page"),
|
|
29001
|
+
url: exports_external.string()
|
|
29002
|
+
}),
|
|
29003
|
+
exports_external.object({
|
|
29004
|
+
type: exports_external.literal("find"),
|
|
29005
|
+
url: exports_external.string(),
|
|
29006
|
+
pattern: exports_external.string()
|
|
29007
|
+
})
|
|
29008
|
+
]).nullish()
|
|
29009
|
+
})));
|
|
28849
29010
|
var webSearchPreview = createProviderDefinedToolFactory({
|
|
28850
29011
|
id: "openai.web_search_preview",
|
|
28851
29012
|
name: "web_search_preview",
|
|
28852
|
-
inputSchema:
|
|
28853
|
-
action: exports_external.discriminatedUnion("type", [
|
|
28854
|
-
exports_external.object({
|
|
28855
|
-
type: exports_external.literal("search"),
|
|
28856
|
-
query: exports_external.string().nullish()
|
|
28857
|
-
}),
|
|
28858
|
-
exports_external.object({
|
|
28859
|
-
type: exports_external.literal("open_page"),
|
|
28860
|
-
url: exports_external.string()
|
|
28861
|
-
}),
|
|
28862
|
-
exports_external.object({
|
|
28863
|
-
type: exports_external.literal("find"),
|
|
28864
|
-
url: exports_external.string(),
|
|
28865
|
-
pattern: exports_external.string()
|
|
28866
|
-
})
|
|
28867
|
-
]).nullish()
|
|
28868
|
-
})
|
|
29013
|
+
inputSchema: webSearchPreviewInputSchema
|
|
28869
29014
|
});
|
|
28870
29015
|
var openaiTools = {
|
|
28871
29016
|
codeInterpreter,
|
|
@@ -28887,7 +29032,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
28887
29032
|
store,
|
|
28888
29033
|
hasLocalShellTool = false
|
|
28889
29034
|
}) {
|
|
28890
|
-
var _a18, _b8, _c, _d
|
|
29035
|
+
var _a18, _b8, _c, _d;
|
|
28891
29036
|
const input = [];
|
|
28892
29037
|
const warnings = [];
|
|
28893
29038
|
for (const { role, content } of prompt) {
|
|
@@ -28966,10 +29111,15 @@ async function convertToOpenAIResponsesInput({
|
|
|
28966
29111
|
for (const part of content) {
|
|
28967
29112
|
switch (part.type) {
|
|
28968
29113
|
case "text": {
|
|
29114
|
+
const id = (_b8 = (_a18 = part.providerOptions) == null ? undefined : _a18.openai) == null ? undefined : _b8.itemId;
|
|
29115
|
+
if (store && id != null) {
|
|
29116
|
+
input.push({ type: "item_reference", id });
|
|
29117
|
+
break;
|
|
29118
|
+
}
|
|
28969
29119
|
input.push({
|
|
28970
29120
|
role: "assistant",
|
|
28971
29121
|
content: [{ type: "output_text", text: part.text }],
|
|
28972
|
-
id
|
|
29122
|
+
id
|
|
28973
29123
|
});
|
|
28974
29124
|
break;
|
|
28975
29125
|
}
|
|
@@ -28978,12 +29128,20 @@ async function convertToOpenAIResponsesInput({
|
|
|
28978
29128
|
if (part.providerExecuted) {
|
|
28979
29129
|
break;
|
|
28980
29130
|
}
|
|
29131
|
+
const id = (_d = (_c = part.providerOptions) == null ? undefined : _c.openai) == null ? undefined : _d.itemId;
|
|
29132
|
+
if (store && id != null) {
|
|
29133
|
+
input.push({ type: "item_reference", id });
|
|
29134
|
+
break;
|
|
29135
|
+
}
|
|
28981
29136
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
28982
|
-
const parsedInput =
|
|
29137
|
+
const parsedInput = await validateTypes({
|
|
29138
|
+
value: part.input,
|
|
29139
|
+
schema: localShellInputSchema
|
|
29140
|
+
});
|
|
28983
29141
|
input.push({
|
|
28984
29142
|
type: "local_shell_call",
|
|
28985
29143
|
call_id: part.toolCallId,
|
|
28986
|
-
id
|
|
29144
|
+
id,
|
|
28987
29145
|
action: {
|
|
28988
29146
|
type: "exec",
|
|
28989
29147
|
command: parsedInput.action.command,
|
|
@@ -29000,7 +29158,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
29000
29158
|
call_id: part.toolCallId,
|
|
29001
29159
|
name: part.toolName,
|
|
29002
29160
|
arguments: JSON.stringify(part.input),
|
|
29003
|
-
id
|
|
29161
|
+
id
|
|
29004
29162
|
});
|
|
29005
29163
|
break;
|
|
29006
29164
|
}
|
|
@@ -29074,10 +29232,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
29074
29232
|
for (const part of content) {
|
|
29075
29233
|
const output = part.output;
|
|
29076
29234
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
29235
|
+
const parsedOutput = await validateTypes({
|
|
29236
|
+
value: output.value,
|
|
29237
|
+
schema: localShellOutputSchema
|
|
29238
|
+
});
|
|
29077
29239
|
input.push({
|
|
29078
29240
|
type: "local_shell_call_output",
|
|
29079
29241
|
call_id: part.toolCallId,
|
|
29080
|
-
output:
|
|
29242
|
+
output: parsedOutput.output
|
|
29081
29243
|
});
|
|
29082
29244
|
break;
|
|
29083
29245
|
}
|
|
@@ -29087,11 +29249,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
29087
29249
|
case "error-text":
|
|
29088
29250
|
contentValue = output.value;
|
|
29089
29251
|
break;
|
|
29090
|
-
case "content":
|
|
29091
29252
|
case "json":
|
|
29092
29253
|
case "error-json":
|
|
29093
29254
|
contentValue = JSON.stringify(output.value);
|
|
29094
29255
|
break;
|
|
29256
|
+
case "content":
|
|
29257
|
+
contentValue = output.value.map((item) => {
|
|
29258
|
+
switch (item.type) {
|
|
29259
|
+
case "text": {
|
|
29260
|
+
return { type: "input_text", text: item.text };
|
|
29261
|
+
}
|
|
29262
|
+
case "media": {
|
|
29263
|
+
return item.mediaType.startsWith("image/") ? {
|
|
29264
|
+
type: "input_image",
|
|
29265
|
+
image_url: `data:${item.mediaType};base64,${item.data}`
|
|
29266
|
+
} : {
|
|
29267
|
+
type: "input_file",
|
|
29268
|
+
filename: "data",
|
|
29269
|
+
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
29270
|
+
};
|
|
29271
|
+
}
|
|
29272
|
+
}
|
|
29273
|
+
});
|
|
29274
|
+
break;
|
|
29095
29275
|
}
|
|
29096
29276
|
input.push({
|
|
29097
29277
|
type: "function_call_output",
|
|
@@ -29129,7 +29309,470 @@ function mapOpenAIResponseFinishReason({
|
|
|
29129
29309
|
return hasFunctionCall ? "tool-calls" : "unknown";
|
|
29130
29310
|
}
|
|
29131
29311
|
}
|
|
29132
|
-
|
|
29312
|
+
var openaiResponsesChunkSchema = lazyValidator(() => zodSchema(exports_external.union([
|
|
29313
|
+
exports_external.object({
|
|
29314
|
+
type: exports_external.literal("response.output_text.delta"),
|
|
29315
|
+
item_id: exports_external.string(),
|
|
29316
|
+
delta: exports_external.string(),
|
|
29317
|
+
logprobs: exports_external.array(exports_external.object({
|
|
29318
|
+
token: exports_external.string(),
|
|
29319
|
+
logprob: exports_external.number(),
|
|
29320
|
+
top_logprobs: exports_external.array(exports_external.object({
|
|
29321
|
+
token: exports_external.string(),
|
|
29322
|
+
logprob: exports_external.number()
|
|
29323
|
+
}))
|
|
29324
|
+
})).nullish()
|
|
29325
|
+
}),
|
|
29326
|
+
exports_external.object({
|
|
29327
|
+
type: exports_external.enum(["response.completed", "response.incomplete"]),
|
|
29328
|
+
response: exports_external.object({
|
|
29329
|
+
incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(),
|
|
29330
|
+
usage: exports_external.object({
|
|
29331
|
+
input_tokens: exports_external.number(),
|
|
29332
|
+
input_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(),
|
|
29333
|
+
output_tokens: exports_external.number(),
|
|
29334
|
+
output_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish() }).nullish()
|
|
29335
|
+
}),
|
|
29336
|
+
service_tier: exports_external.string().nullish()
|
|
29337
|
+
})
|
|
29338
|
+
}),
|
|
29339
|
+
exports_external.object({
|
|
29340
|
+
type: exports_external.literal("response.created"),
|
|
29341
|
+
response: exports_external.object({
|
|
29342
|
+
id: exports_external.string(),
|
|
29343
|
+
created_at: exports_external.number(),
|
|
29344
|
+
model: exports_external.string(),
|
|
29345
|
+
service_tier: exports_external.string().nullish()
|
|
29346
|
+
})
|
|
29347
|
+
}),
|
|
29348
|
+
exports_external.object({
|
|
29349
|
+
type: exports_external.literal("response.output_item.added"),
|
|
29350
|
+
output_index: exports_external.number(),
|
|
29351
|
+
item: exports_external.discriminatedUnion("type", [
|
|
29352
|
+
exports_external.object({
|
|
29353
|
+
type: exports_external.literal("message"),
|
|
29354
|
+
id: exports_external.string()
|
|
29355
|
+
}),
|
|
29356
|
+
exports_external.object({
|
|
29357
|
+
type: exports_external.literal("reasoning"),
|
|
29358
|
+
id: exports_external.string(),
|
|
29359
|
+
encrypted_content: exports_external.string().nullish()
|
|
29360
|
+
}),
|
|
29361
|
+
exports_external.object({
|
|
29362
|
+
type: exports_external.literal("function_call"),
|
|
29363
|
+
id: exports_external.string(),
|
|
29364
|
+
call_id: exports_external.string(),
|
|
29365
|
+
name: exports_external.string(),
|
|
29366
|
+
arguments: exports_external.string()
|
|
29367
|
+
}),
|
|
29368
|
+
exports_external.object({
|
|
29369
|
+
type: exports_external.literal("web_search_call"),
|
|
29370
|
+
id: exports_external.string(),
|
|
29371
|
+
status: exports_external.string(),
|
|
29372
|
+
action: exports_external.object({
|
|
29373
|
+
type: exports_external.literal("search"),
|
|
29374
|
+
query: exports_external.string().optional()
|
|
29375
|
+
}).nullish()
|
|
29376
|
+
}),
|
|
29377
|
+
exports_external.object({
|
|
29378
|
+
type: exports_external.literal("computer_call"),
|
|
29379
|
+
id: exports_external.string(),
|
|
29380
|
+
status: exports_external.string()
|
|
29381
|
+
}),
|
|
29382
|
+
exports_external.object({
|
|
29383
|
+
type: exports_external.literal("file_search_call"),
|
|
29384
|
+
id: exports_external.string()
|
|
29385
|
+
}),
|
|
29386
|
+
exports_external.object({
|
|
29387
|
+
type: exports_external.literal("image_generation_call"),
|
|
29388
|
+
id: exports_external.string()
|
|
29389
|
+
}),
|
|
29390
|
+
exports_external.object({
|
|
29391
|
+
type: exports_external.literal("code_interpreter_call"),
|
|
29392
|
+
id: exports_external.string(),
|
|
29393
|
+
container_id: exports_external.string(),
|
|
29394
|
+
code: exports_external.string().nullable(),
|
|
29395
|
+
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29396
|
+
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
29397
|
+
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
29398
|
+
])).nullable(),
|
|
29399
|
+
status: exports_external.string()
|
|
29400
|
+
})
|
|
29401
|
+
])
|
|
29402
|
+
}),
|
|
29403
|
+
exports_external.object({
|
|
29404
|
+
type: exports_external.literal("response.output_item.done"),
|
|
29405
|
+
output_index: exports_external.number(),
|
|
29406
|
+
item: exports_external.discriminatedUnion("type", [
|
|
29407
|
+
exports_external.object({
|
|
29408
|
+
type: exports_external.literal("message"),
|
|
29409
|
+
id: exports_external.string()
|
|
29410
|
+
}),
|
|
29411
|
+
exports_external.object({
|
|
29412
|
+
type: exports_external.literal("reasoning"),
|
|
29413
|
+
id: exports_external.string(),
|
|
29414
|
+
encrypted_content: exports_external.string().nullish()
|
|
29415
|
+
}),
|
|
29416
|
+
exports_external.object({
|
|
29417
|
+
type: exports_external.literal("function_call"),
|
|
29418
|
+
id: exports_external.string(),
|
|
29419
|
+
call_id: exports_external.string(),
|
|
29420
|
+
name: exports_external.string(),
|
|
29421
|
+
arguments: exports_external.string(),
|
|
29422
|
+
status: exports_external.literal("completed")
|
|
29423
|
+
}),
|
|
29424
|
+
exports_external.object({
|
|
29425
|
+
type: exports_external.literal("code_interpreter_call"),
|
|
29426
|
+
id: exports_external.string(),
|
|
29427
|
+
code: exports_external.string().nullable(),
|
|
29428
|
+
container_id: exports_external.string(),
|
|
29429
|
+
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29430
|
+
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
29431
|
+
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
29432
|
+
])).nullable()
|
|
29433
|
+
}),
|
|
29434
|
+
exports_external.object({
|
|
29435
|
+
type: exports_external.literal("image_generation_call"),
|
|
29436
|
+
id: exports_external.string(),
|
|
29437
|
+
result: exports_external.string()
|
|
29438
|
+
}),
|
|
29439
|
+
exports_external.object({
|
|
29440
|
+
type: exports_external.literal("web_search_call"),
|
|
29441
|
+
id: exports_external.string(),
|
|
29442
|
+
status: exports_external.string(),
|
|
29443
|
+
action: exports_external.discriminatedUnion("type", [
|
|
29444
|
+
exports_external.object({
|
|
29445
|
+
type: exports_external.literal("search"),
|
|
29446
|
+
query: exports_external.string().nullish()
|
|
29447
|
+
}),
|
|
29448
|
+
exports_external.object({
|
|
29449
|
+
type: exports_external.literal("open_page"),
|
|
29450
|
+
url: exports_external.string()
|
|
29451
|
+
}),
|
|
29452
|
+
exports_external.object({
|
|
29453
|
+
type: exports_external.literal("find"),
|
|
29454
|
+
url: exports_external.string(),
|
|
29455
|
+
pattern: exports_external.string()
|
|
29456
|
+
})
|
|
29457
|
+
]).nullish()
|
|
29458
|
+
}),
|
|
29459
|
+
exports_external.object({
|
|
29460
|
+
type: exports_external.literal("file_search_call"),
|
|
29461
|
+
id: exports_external.string(),
|
|
29462
|
+
queries: exports_external.array(exports_external.string()),
|
|
29463
|
+
results: exports_external.array(exports_external.object({
|
|
29464
|
+
attributes: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
29465
|
+
file_id: exports_external.string(),
|
|
29466
|
+
filename: exports_external.string(),
|
|
29467
|
+
score: exports_external.number(),
|
|
29468
|
+
text: exports_external.string()
|
|
29469
|
+
})).nullish()
|
|
29470
|
+
}),
|
|
29471
|
+
exports_external.object({
|
|
29472
|
+
type: exports_external.literal("local_shell_call"),
|
|
29473
|
+
id: exports_external.string(),
|
|
29474
|
+
call_id: exports_external.string(),
|
|
29475
|
+
action: exports_external.object({
|
|
29476
|
+
type: exports_external.literal("exec"),
|
|
29477
|
+
command: exports_external.array(exports_external.string()),
|
|
29478
|
+
timeout_ms: exports_external.number().optional(),
|
|
29479
|
+
user: exports_external.string().optional(),
|
|
29480
|
+
working_directory: exports_external.string().optional(),
|
|
29481
|
+
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
29482
|
+
})
|
|
29483
|
+
}),
|
|
29484
|
+
exports_external.object({
|
|
29485
|
+
type: exports_external.literal("computer_call"),
|
|
29486
|
+
id: exports_external.string(),
|
|
29487
|
+
status: exports_external.literal("completed")
|
|
29488
|
+
})
|
|
29489
|
+
])
|
|
29490
|
+
}),
|
|
29491
|
+
exports_external.object({
|
|
29492
|
+
type: exports_external.literal("response.function_call_arguments.delta"),
|
|
29493
|
+
item_id: exports_external.string(),
|
|
29494
|
+
output_index: exports_external.number(),
|
|
29495
|
+
delta: exports_external.string()
|
|
29496
|
+
}),
|
|
29497
|
+
exports_external.object({
|
|
29498
|
+
type: exports_external.literal("response.image_generation_call.partial_image"),
|
|
29499
|
+
item_id: exports_external.string(),
|
|
29500
|
+
output_index: exports_external.number(),
|
|
29501
|
+
partial_image_b64: exports_external.string()
|
|
29502
|
+
}),
|
|
29503
|
+
exports_external.object({
|
|
29504
|
+
type: exports_external.literal("response.code_interpreter_call_code.delta"),
|
|
29505
|
+
item_id: exports_external.string(),
|
|
29506
|
+
output_index: exports_external.number(),
|
|
29507
|
+
delta: exports_external.string()
|
|
29508
|
+
}),
|
|
29509
|
+
exports_external.object({
|
|
29510
|
+
type: exports_external.literal("response.code_interpreter_call_code.done"),
|
|
29511
|
+
item_id: exports_external.string(),
|
|
29512
|
+
output_index: exports_external.number(),
|
|
29513
|
+
code: exports_external.string()
|
|
29514
|
+
}),
|
|
29515
|
+
exports_external.object({
|
|
29516
|
+
type: exports_external.literal("response.output_text.annotation.added"),
|
|
29517
|
+
annotation: exports_external.discriminatedUnion("type", [
|
|
29518
|
+
exports_external.object({
|
|
29519
|
+
type: exports_external.literal("url_citation"),
|
|
29520
|
+
url: exports_external.string(),
|
|
29521
|
+
title: exports_external.string()
|
|
29522
|
+
}),
|
|
29523
|
+
exports_external.object({
|
|
29524
|
+
type: exports_external.literal("file_citation"),
|
|
29525
|
+
file_id: exports_external.string(),
|
|
29526
|
+
filename: exports_external.string().nullish(),
|
|
29527
|
+
index: exports_external.number().nullish(),
|
|
29528
|
+
start_index: exports_external.number().nullish(),
|
|
29529
|
+
end_index: exports_external.number().nullish(),
|
|
29530
|
+
quote: exports_external.string().nullish()
|
|
29531
|
+
})
|
|
29532
|
+
])
|
|
29533
|
+
}),
|
|
29534
|
+
exports_external.object({
|
|
29535
|
+
type: exports_external.literal("response.reasoning_summary_part.added"),
|
|
29536
|
+
item_id: exports_external.string(),
|
|
29537
|
+
summary_index: exports_external.number()
|
|
29538
|
+
}),
|
|
29539
|
+
exports_external.object({
|
|
29540
|
+
type: exports_external.literal("response.reasoning_summary_text.delta"),
|
|
29541
|
+
item_id: exports_external.string(),
|
|
29542
|
+
summary_index: exports_external.number(),
|
|
29543
|
+
delta: exports_external.string()
|
|
29544
|
+
}),
|
|
29545
|
+
exports_external.object({
|
|
29546
|
+
type: exports_external.literal("error"),
|
|
29547
|
+
code: exports_external.string(),
|
|
29548
|
+
message: exports_external.string(),
|
|
29549
|
+
param: exports_external.string().nullish(),
|
|
29550
|
+
sequence_number: exports_external.number()
|
|
29551
|
+
}),
|
|
29552
|
+
exports_external.object({ type: exports_external.string() }).loose().transform((value) => ({
|
|
29553
|
+
type: "unknown_chunk",
|
|
29554
|
+
message: value.type
|
|
29555
|
+
}))
|
|
29556
|
+
])));
|
|
29557
|
+
var openaiResponsesResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
29558
|
+
id: exports_external.string(),
|
|
29559
|
+
created_at: exports_external.number(),
|
|
29560
|
+
error: exports_external.object({
|
|
29561
|
+
code: exports_external.string(),
|
|
29562
|
+
message: exports_external.string()
|
|
29563
|
+
}).nullish(),
|
|
29564
|
+
model: exports_external.string(),
|
|
29565
|
+
output: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29566
|
+
exports_external.object({
|
|
29567
|
+
type: exports_external.literal("message"),
|
|
29568
|
+
role: exports_external.literal("assistant"),
|
|
29569
|
+
id: exports_external.string(),
|
|
29570
|
+
content: exports_external.array(exports_external.object({
|
|
29571
|
+
type: exports_external.literal("output_text"),
|
|
29572
|
+
text: exports_external.string(),
|
|
29573
|
+
logprobs: exports_external.array(exports_external.object({
|
|
29574
|
+
token: exports_external.string(),
|
|
29575
|
+
logprob: exports_external.number(),
|
|
29576
|
+
top_logprobs: exports_external.array(exports_external.object({
|
|
29577
|
+
token: exports_external.string(),
|
|
29578
|
+
logprob: exports_external.number()
|
|
29579
|
+
}))
|
|
29580
|
+
})).nullish(),
|
|
29581
|
+
annotations: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29582
|
+
exports_external.object({
|
|
29583
|
+
type: exports_external.literal("url_citation"),
|
|
29584
|
+
start_index: exports_external.number(),
|
|
29585
|
+
end_index: exports_external.number(),
|
|
29586
|
+
url: exports_external.string(),
|
|
29587
|
+
title: exports_external.string()
|
|
29588
|
+
}),
|
|
29589
|
+
exports_external.object({
|
|
29590
|
+
type: exports_external.literal("file_citation"),
|
|
29591
|
+
file_id: exports_external.string(),
|
|
29592
|
+
filename: exports_external.string().nullish(),
|
|
29593
|
+
index: exports_external.number().nullish(),
|
|
29594
|
+
start_index: exports_external.number().nullish(),
|
|
29595
|
+
end_index: exports_external.number().nullish(),
|
|
29596
|
+
quote: exports_external.string().nullish()
|
|
29597
|
+
}),
|
|
29598
|
+
exports_external.object({
|
|
29599
|
+
type: exports_external.literal("container_file_citation")
|
|
29600
|
+
})
|
|
29601
|
+
]))
|
|
29602
|
+
}))
|
|
29603
|
+
}),
|
|
29604
|
+
exports_external.object({
|
|
29605
|
+
type: exports_external.literal("web_search_call"),
|
|
29606
|
+
id: exports_external.string(),
|
|
29607
|
+
status: exports_external.string(),
|
|
29608
|
+
action: exports_external.discriminatedUnion("type", [
|
|
29609
|
+
exports_external.object({
|
|
29610
|
+
type: exports_external.literal("search"),
|
|
29611
|
+
query: exports_external.string().nullish()
|
|
29612
|
+
}),
|
|
29613
|
+
exports_external.object({
|
|
29614
|
+
type: exports_external.literal("open_page"),
|
|
29615
|
+
url: exports_external.string()
|
|
29616
|
+
}),
|
|
29617
|
+
exports_external.object({
|
|
29618
|
+
type: exports_external.literal("find"),
|
|
29619
|
+
url: exports_external.string(),
|
|
29620
|
+
pattern: exports_external.string()
|
|
29621
|
+
})
|
|
29622
|
+
]).nullish()
|
|
29623
|
+
}),
|
|
29624
|
+
exports_external.object({
|
|
29625
|
+
type: exports_external.literal("file_search_call"),
|
|
29626
|
+
id: exports_external.string(),
|
|
29627
|
+
queries: exports_external.array(exports_external.string()),
|
|
29628
|
+
results: exports_external.array(exports_external.object({
|
|
29629
|
+
attributes: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
29630
|
+
file_id: exports_external.string(),
|
|
29631
|
+
filename: exports_external.string(),
|
|
29632
|
+
score: exports_external.number(),
|
|
29633
|
+
text: exports_external.string()
|
|
29634
|
+
})).nullish()
|
|
29635
|
+
}),
|
|
29636
|
+
exports_external.object({
|
|
29637
|
+
type: exports_external.literal("code_interpreter_call"),
|
|
29638
|
+
id: exports_external.string(),
|
|
29639
|
+
code: exports_external.string().nullable(),
|
|
29640
|
+
container_id: exports_external.string(),
|
|
29641
|
+
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29642
|
+
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
29643
|
+
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
29644
|
+
])).nullable()
|
|
29645
|
+
}),
|
|
29646
|
+
exports_external.object({
|
|
29647
|
+
type: exports_external.literal("image_generation_call"),
|
|
29648
|
+
id: exports_external.string(),
|
|
29649
|
+
result: exports_external.string()
|
|
29650
|
+
}),
|
|
29651
|
+
exports_external.object({
|
|
29652
|
+
type: exports_external.literal("local_shell_call"),
|
|
29653
|
+
id: exports_external.string(),
|
|
29654
|
+
call_id: exports_external.string(),
|
|
29655
|
+
action: exports_external.object({
|
|
29656
|
+
type: exports_external.literal("exec"),
|
|
29657
|
+
command: exports_external.array(exports_external.string()),
|
|
29658
|
+
timeout_ms: exports_external.number().optional(),
|
|
29659
|
+
user: exports_external.string().optional(),
|
|
29660
|
+
working_directory: exports_external.string().optional(),
|
|
29661
|
+
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
29662
|
+
})
|
|
29663
|
+
}),
|
|
29664
|
+
exports_external.object({
|
|
29665
|
+
type: exports_external.literal("function_call"),
|
|
29666
|
+
call_id: exports_external.string(),
|
|
29667
|
+
name: exports_external.string(),
|
|
29668
|
+
arguments: exports_external.string(),
|
|
29669
|
+
id: exports_external.string()
|
|
29670
|
+
}),
|
|
29671
|
+
exports_external.object({
|
|
29672
|
+
type: exports_external.literal("computer_call"),
|
|
29673
|
+
id: exports_external.string(),
|
|
29674
|
+
status: exports_external.string().optional()
|
|
29675
|
+
}),
|
|
29676
|
+
exports_external.object({
|
|
29677
|
+
type: exports_external.literal("reasoning"),
|
|
29678
|
+
id: exports_external.string(),
|
|
29679
|
+
encrypted_content: exports_external.string().nullish(),
|
|
29680
|
+
summary: exports_external.array(exports_external.object({
|
|
29681
|
+
type: exports_external.literal("summary_text"),
|
|
29682
|
+
text: exports_external.string()
|
|
29683
|
+
}))
|
|
29684
|
+
})
|
|
29685
|
+
])),
|
|
29686
|
+
service_tier: exports_external.string().nullish(),
|
|
29687
|
+
incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(),
|
|
29688
|
+
usage: exports_external.object({
|
|
29689
|
+
input_tokens: exports_external.number(),
|
|
29690
|
+
input_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(),
|
|
29691
|
+
output_tokens: exports_external.number(),
|
|
29692
|
+
output_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish() }).nullish()
|
|
29693
|
+
})
|
|
29694
|
+
})));
|
|
29695
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
29696
|
+
var openaiResponsesReasoningModelIds = [
|
|
29697
|
+
"o1",
|
|
29698
|
+
"o1-2024-12-17",
|
|
29699
|
+
"o3-mini",
|
|
29700
|
+
"o3-mini-2025-01-31",
|
|
29701
|
+
"o3",
|
|
29702
|
+
"o3-2025-04-16",
|
|
29703
|
+
"o4-mini",
|
|
29704
|
+
"o4-mini-2025-04-16",
|
|
29705
|
+
"codex-mini-latest",
|
|
29706
|
+
"computer-use-preview",
|
|
29707
|
+
"gpt-5",
|
|
29708
|
+
"gpt-5-2025-08-07",
|
|
29709
|
+
"gpt-5-codex",
|
|
29710
|
+
"gpt-5-mini",
|
|
29711
|
+
"gpt-5-mini-2025-08-07",
|
|
29712
|
+
"gpt-5-nano",
|
|
29713
|
+
"gpt-5-nano-2025-08-07",
|
|
29714
|
+
"gpt-5-pro",
|
|
29715
|
+
"gpt-5-pro-2025-10-06"
|
|
29716
|
+
];
|
|
29717
|
+
var openaiResponsesModelIds = [
|
|
29718
|
+
"gpt-4.1",
|
|
29719
|
+
"gpt-4.1-2025-04-14",
|
|
29720
|
+
"gpt-4.1-mini",
|
|
29721
|
+
"gpt-4.1-mini-2025-04-14",
|
|
29722
|
+
"gpt-4.1-nano",
|
|
29723
|
+
"gpt-4.1-nano-2025-04-14",
|
|
29724
|
+
"gpt-4o",
|
|
29725
|
+
"gpt-4o-2024-05-13",
|
|
29726
|
+
"gpt-4o-2024-08-06",
|
|
29727
|
+
"gpt-4o-2024-11-20",
|
|
29728
|
+
"gpt-4o-audio-preview",
|
|
29729
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
29730
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
29731
|
+
"gpt-4o-search-preview",
|
|
29732
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
29733
|
+
"gpt-4o-mini-search-preview",
|
|
29734
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
29735
|
+
"gpt-4o-mini",
|
|
29736
|
+
"gpt-4o-mini-2024-07-18",
|
|
29737
|
+
"gpt-4-turbo",
|
|
29738
|
+
"gpt-4-turbo-2024-04-09",
|
|
29739
|
+
"gpt-4-turbo-preview",
|
|
29740
|
+
"gpt-4-0125-preview",
|
|
29741
|
+
"gpt-4-1106-preview",
|
|
29742
|
+
"gpt-4",
|
|
29743
|
+
"gpt-4-0613",
|
|
29744
|
+
"gpt-4.5-preview",
|
|
29745
|
+
"gpt-4.5-preview-2025-02-27",
|
|
29746
|
+
"gpt-3.5-turbo-0125",
|
|
29747
|
+
"gpt-3.5-turbo",
|
|
29748
|
+
"gpt-3.5-turbo-1106",
|
|
29749
|
+
"chatgpt-4o-latest",
|
|
29750
|
+
"gpt-5-chat-latest",
|
|
29751
|
+
...openaiResponsesReasoningModelIds
|
|
29752
|
+
];
|
|
29753
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
29754
|
+
include: exports_external.array(exports_external.enum([
|
|
29755
|
+
"reasoning.encrypted_content",
|
|
29756
|
+
"file_search_call.results",
|
|
29757
|
+
"message.output_text.logprobs"
|
|
29758
|
+
])).nullish(),
|
|
29759
|
+
instructions: exports_external.string().nullish(),
|
|
29760
|
+
logprobs: exports_external.union([exports_external.boolean(), exports_external.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
29761
|
+
maxToolCalls: exports_external.number().nullish(),
|
|
29762
|
+
metadata: exports_external.any().nullish(),
|
|
29763
|
+
parallelToolCalls: exports_external.boolean().nullish(),
|
|
29764
|
+
previousResponseId: exports_external.string().nullish(),
|
|
29765
|
+
promptCacheKey: exports_external.string().nullish(),
|
|
29766
|
+
reasoningEffort: exports_external.string().nullish(),
|
|
29767
|
+
reasoningSummary: exports_external.string().nullish(),
|
|
29768
|
+
safetyIdentifier: exports_external.string().nullish(),
|
|
29769
|
+
serviceTier: exports_external.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
29770
|
+
store: exports_external.boolean().nullish(),
|
|
29771
|
+
strictJsonSchema: exports_external.boolean().nullish(),
|
|
29772
|
+
textVerbosity: exports_external.enum(["low", "medium", "high"]).nullish(),
|
|
29773
|
+
user: exports_external.string().nullish()
|
|
29774
|
+
})));
|
|
29775
|
+
async function prepareResponsesTools({
|
|
29133
29776
|
tools,
|
|
29134
29777
|
toolChoice,
|
|
29135
29778
|
strictJsonSchema
|
|
@@ -29154,7 +29797,10 @@ function prepareResponsesTools({
|
|
|
29154
29797
|
case "provider-defined": {
|
|
29155
29798
|
switch (tool2.id) {
|
|
29156
29799
|
case "openai.file_search": {
|
|
29157
|
-
const args =
|
|
29800
|
+
const args = await validateTypes({
|
|
29801
|
+
value: tool2.args,
|
|
29802
|
+
schema: fileSearchArgsSchema
|
|
29803
|
+
});
|
|
29158
29804
|
openaiTools2.push({
|
|
29159
29805
|
type: "file_search",
|
|
29160
29806
|
vector_store_ids: args.vectorStoreIds,
|
|
@@ -29174,7 +29820,10 @@ function prepareResponsesTools({
|
|
|
29174
29820
|
break;
|
|
29175
29821
|
}
|
|
29176
29822
|
case "openai.web_search_preview": {
|
|
29177
|
-
const args =
|
|
29823
|
+
const args = await validateTypes({
|
|
29824
|
+
value: tool2.args,
|
|
29825
|
+
schema: webSearchPreviewArgsSchema
|
|
29826
|
+
});
|
|
29178
29827
|
openaiTools2.push({
|
|
29179
29828
|
type: "web_search_preview",
|
|
29180
29829
|
search_context_size: args.searchContextSize,
|
|
@@ -29183,7 +29832,10 @@ function prepareResponsesTools({
|
|
|
29183
29832
|
break;
|
|
29184
29833
|
}
|
|
29185
29834
|
case "openai.web_search": {
|
|
29186
|
-
const args =
|
|
29835
|
+
const args = await validateTypes({
|
|
29836
|
+
value: tool2.args,
|
|
29837
|
+
schema: webSearchArgsSchema
|
|
29838
|
+
});
|
|
29187
29839
|
openaiTools2.push({
|
|
29188
29840
|
type: "web_search",
|
|
29189
29841
|
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : undefined,
|
|
@@ -29193,7 +29845,10 @@ function prepareResponsesTools({
|
|
|
29193
29845
|
break;
|
|
29194
29846
|
}
|
|
29195
29847
|
case "openai.code_interpreter": {
|
|
29196
|
-
const args =
|
|
29848
|
+
const args = await validateTypes({
|
|
29849
|
+
value: tool2.args,
|
|
29850
|
+
schema: codeInterpreterArgsSchema
|
|
29851
|
+
});
|
|
29197
29852
|
openaiTools2.push({
|
|
29198
29853
|
type: "code_interpreter",
|
|
29199
29854
|
container: args.container == null ? { type: "auto", file_ids: undefined } : typeof args.container === "string" ? args.container : { type: "auto", file_ids: args.container.fileIds }
|
|
@@ -29201,7 +29856,10 @@ function prepareResponsesTools({
|
|
|
29201
29856
|
break;
|
|
29202
29857
|
}
|
|
29203
29858
|
case "openai.image_generation": {
|
|
29204
|
-
const args =
|
|
29859
|
+
const args = await validateTypes({
|
|
29860
|
+
value: tool2.args,
|
|
29861
|
+
schema: imageGenerationArgsSchema
|
|
29862
|
+
});
|
|
29205
29863
|
openaiTools2.push({
|
|
29206
29864
|
type: "image_generation",
|
|
29207
29865
|
background: args.background,
|
|
@@ -29250,75 +29908,6 @@ function prepareResponsesTools({
|
|
|
29250
29908
|
}
|
|
29251
29909
|
}
|
|
29252
29910
|
}
|
|
29253
|
-
var webSearchCallItem = exports_external.object({
|
|
29254
|
-
type: exports_external.literal("web_search_call"),
|
|
29255
|
-
id: exports_external.string(),
|
|
29256
|
-
status: exports_external.string(),
|
|
29257
|
-
action: exports_external.discriminatedUnion("type", [
|
|
29258
|
-
exports_external.object({
|
|
29259
|
-
type: exports_external.literal("search"),
|
|
29260
|
-
query: exports_external.string().nullish()
|
|
29261
|
-
}),
|
|
29262
|
-
exports_external.object({
|
|
29263
|
-
type: exports_external.literal("open_page"),
|
|
29264
|
-
url: exports_external.string()
|
|
29265
|
-
}),
|
|
29266
|
-
exports_external.object({
|
|
29267
|
-
type: exports_external.literal("find"),
|
|
29268
|
-
url: exports_external.string(),
|
|
29269
|
-
pattern: exports_external.string()
|
|
29270
|
-
})
|
|
29271
|
-
]).nullish()
|
|
29272
|
-
});
|
|
29273
|
-
var fileSearchCallItem = exports_external.object({
|
|
29274
|
-
type: exports_external.literal("file_search_call"),
|
|
29275
|
-
id: exports_external.string(),
|
|
29276
|
-
queries: exports_external.array(exports_external.string()),
|
|
29277
|
-
results: exports_external.array(exports_external.object({
|
|
29278
|
-
attributes: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
29279
|
-
file_id: exports_external.string(),
|
|
29280
|
-
filename: exports_external.string(),
|
|
29281
|
-
score: exports_external.number(),
|
|
29282
|
-
text: exports_external.string()
|
|
29283
|
-
})).nullish()
|
|
29284
|
-
});
|
|
29285
|
-
var codeInterpreterCallItem = exports_external.object({
|
|
29286
|
-
type: exports_external.literal("code_interpreter_call"),
|
|
29287
|
-
id: exports_external.string(),
|
|
29288
|
-
code: exports_external.string().nullable(),
|
|
29289
|
-
container_id: exports_external.string(),
|
|
29290
|
-
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29291
|
-
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
29292
|
-
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
29293
|
-
])).nullable()
|
|
29294
|
-
});
|
|
29295
|
-
var localShellCallItem = exports_external.object({
|
|
29296
|
-
type: exports_external.literal("local_shell_call"),
|
|
29297
|
-
id: exports_external.string(),
|
|
29298
|
-
call_id: exports_external.string(),
|
|
29299
|
-
action: exports_external.object({
|
|
29300
|
-
type: exports_external.literal("exec"),
|
|
29301
|
-
command: exports_external.array(exports_external.string()),
|
|
29302
|
-
timeout_ms: exports_external.number().optional(),
|
|
29303
|
-
user: exports_external.string().optional(),
|
|
29304
|
-
working_directory: exports_external.string().optional(),
|
|
29305
|
-
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
29306
|
-
})
|
|
29307
|
-
});
|
|
29308
|
-
var imageGenerationCallItem = exports_external.object({
|
|
29309
|
-
type: exports_external.literal("image_generation_call"),
|
|
29310
|
-
id: exports_external.string(),
|
|
29311
|
-
result: exports_external.string()
|
|
29312
|
-
});
|
|
29313
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
29314
|
-
var LOGPROBS_SCHEMA = exports_external.array(exports_external.object({
|
|
29315
|
-
token: exports_external.string(),
|
|
29316
|
-
logprob: exports_external.number(),
|
|
29317
|
-
top_logprobs: exports_external.array(exports_external.object({
|
|
29318
|
-
token: exports_external.string(),
|
|
29319
|
-
logprob: exports_external.number()
|
|
29320
|
-
}))
|
|
29321
|
-
}));
|
|
29322
29911
|
var OpenAIResponsesLanguageModel = class {
|
|
29323
29912
|
constructor(modelId, config2) {
|
|
29324
29913
|
this.specificationVersion = "v2";
|
|
@@ -29387,7 +29976,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29387
29976
|
const strictJsonSchema = (_b8 = openaiOptions == null ? undefined : openaiOptions.strictJsonSchema) != null ? _b8 : false;
|
|
29388
29977
|
let include = openaiOptions == null ? undefined : openaiOptions.include;
|
|
29389
29978
|
function addInclude(key) {
|
|
29390
|
-
|
|
29979
|
+
if (include == null) {
|
|
29980
|
+
include = [key];
|
|
29981
|
+
} else if (!include.includes(key)) {
|
|
29982
|
+
include = [...include, key];
|
|
29983
|
+
}
|
|
29391
29984
|
}
|
|
29392
29985
|
function hasOpenAITool(id) {
|
|
29393
29986
|
return (tools == null ? undefined : tools.find((tool2) => tool2.type === "provider-defined" && tool2.id === id)) != null;
|
|
@@ -29403,6 +29996,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29403
29996
|
if (hasOpenAITool("openai.code_interpreter")) {
|
|
29404
29997
|
addInclude("code_interpreter_call.outputs");
|
|
29405
29998
|
}
|
|
29999
|
+
const store = openaiOptions == null ? undefined : openaiOptions.store;
|
|
30000
|
+
if (store === false && modelConfig.isReasoningModel) {
|
|
30001
|
+
addInclude("reasoning.encrypted_content");
|
|
30002
|
+
}
|
|
29406
30003
|
const baseArgs = {
|
|
29407
30004
|
model: this.modelId,
|
|
29408
30005
|
input,
|
|
@@ -29429,7 +30026,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29429
30026
|
metadata: openaiOptions == null ? undefined : openaiOptions.metadata,
|
|
29430
30027
|
parallel_tool_calls: openaiOptions == null ? undefined : openaiOptions.parallelToolCalls,
|
|
29431
30028
|
previous_response_id: openaiOptions == null ? undefined : openaiOptions.previousResponseId,
|
|
29432
|
-
store
|
|
30029
|
+
store,
|
|
29433
30030
|
user: openaiOptions == null ? undefined : openaiOptions.user,
|
|
29434
30031
|
instructions: openaiOptions == null ? undefined : openaiOptions.instructions,
|
|
29435
30032
|
service_tier: openaiOptions == null ? undefined : openaiOptions.serviceTier,
|
|
@@ -29504,7 +30101,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29504
30101
|
tools: openaiTools2,
|
|
29505
30102
|
toolChoice: openaiToolChoice,
|
|
29506
30103
|
toolWarnings
|
|
29507
|
-
} = prepareResponsesTools({
|
|
30104
|
+
} = await prepareResponsesTools({
|
|
29508
30105
|
tools,
|
|
29509
30106
|
toolChoice,
|
|
29510
30107
|
strictJsonSchema
|
|
@@ -29539,77 +30136,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29539
30136
|
headers: combineHeaders(this.config.headers(), options.headers),
|
|
29540
30137
|
body,
|
|
29541
30138
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
29542
|
-
successfulResponseHandler: createJsonResponseHandler(
|
|
29543
|
-
id: exports_external.string(),
|
|
29544
|
-
created_at: exports_external.number(),
|
|
29545
|
-
error: exports_external.object({
|
|
29546
|
-
code: exports_external.string(),
|
|
29547
|
-
message: exports_external.string()
|
|
29548
|
-
}).nullish(),
|
|
29549
|
-
model: exports_external.string(),
|
|
29550
|
-
output: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29551
|
-
exports_external.object({
|
|
29552
|
-
type: exports_external.literal("message"),
|
|
29553
|
-
role: exports_external.literal("assistant"),
|
|
29554
|
-
id: exports_external.string(),
|
|
29555
|
-
content: exports_external.array(exports_external.object({
|
|
29556
|
-
type: exports_external.literal("output_text"),
|
|
29557
|
-
text: exports_external.string(),
|
|
29558
|
-
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
29559
|
-
annotations: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
29560
|
-
exports_external.object({
|
|
29561
|
-
type: exports_external.literal("url_citation"),
|
|
29562
|
-
start_index: exports_external.number(),
|
|
29563
|
-
end_index: exports_external.number(),
|
|
29564
|
-
url: exports_external.string(),
|
|
29565
|
-
title: exports_external.string()
|
|
29566
|
-
}),
|
|
29567
|
-
exports_external.object({
|
|
29568
|
-
type: exports_external.literal("file_citation"),
|
|
29569
|
-
file_id: exports_external.string(),
|
|
29570
|
-
filename: exports_external.string().nullish(),
|
|
29571
|
-
index: exports_external.number().nullish(),
|
|
29572
|
-
start_index: exports_external.number().nullish(),
|
|
29573
|
-
end_index: exports_external.number().nullish(),
|
|
29574
|
-
quote: exports_external.string().nullish()
|
|
29575
|
-
}),
|
|
29576
|
-
exports_external.object({
|
|
29577
|
-
type: exports_external.literal("container_file_citation")
|
|
29578
|
-
})
|
|
29579
|
-
]))
|
|
29580
|
-
}))
|
|
29581
|
-
}),
|
|
29582
|
-
webSearchCallItem,
|
|
29583
|
-
fileSearchCallItem,
|
|
29584
|
-
codeInterpreterCallItem,
|
|
29585
|
-
imageGenerationCallItem,
|
|
29586
|
-
localShellCallItem,
|
|
29587
|
-
exports_external.object({
|
|
29588
|
-
type: exports_external.literal("function_call"),
|
|
29589
|
-
call_id: exports_external.string(),
|
|
29590
|
-
name: exports_external.string(),
|
|
29591
|
-
arguments: exports_external.string(),
|
|
29592
|
-
id: exports_external.string()
|
|
29593
|
-
}),
|
|
29594
|
-
exports_external.object({
|
|
29595
|
-
type: exports_external.literal("computer_call"),
|
|
29596
|
-
id: exports_external.string(),
|
|
29597
|
-
status: exports_external.string().optional()
|
|
29598
|
-
}),
|
|
29599
|
-
exports_external.object({
|
|
29600
|
-
type: exports_external.literal("reasoning"),
|
|
29601
|
-
id: exports_external.string(),
|
|
29602
|
-
encrypted_content: exports_external.string().nullish(),
|
|
29603
|
-
summary: exports_external.array(exports_external.object({
|
|
29604
|
-
type: exports_external.literal("summary_text"),
|
|
29605
|
-
text: exports_external.string()
|
|
29606
|
-
}))
|
|
29607
|
-
})
|
|
29608
|
-
])),
|
|
29609
|
-
service_tier: exports_external.string().nullish(),
|
|
29610
|
-
incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(),
|
|
29611
|
-
usage: usageSchema2
|
|
29612
|
-
})),
|
|
30139
|
+
successfulResponseHandler: createJsonResponseHandler(openaiResponsesResponseSchema),
|
|
29613
30140
|
abortSignal: options.abortSignal,
|
|
29614
30141
|
fetch: this.config.fetch
|
|
29615
30142
|
});
|
|
@@ -29671,7 +30198,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29671
30198
|
type: "tool-call",
|
|
29672
30199
|
toolCallId: part.call_id,
|
|
29673
30200
|
toolName: "local_shell",
|
|
29674
|
-
input: JSON.stringify({
|
|
30201
|
+
input: JSON.stringify({
|
|
30202
|
+
action: part.action
|
|
30203
|
+
}),
|
|
29675
30204
|
providerMetadata: {
|
|
29676
30205
|
openai: {
|
|
29677
30206
|
itemId: part.id
|
|
@@ -29922,7 +30451,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29922
30451
|
controller.enqueue({
|
|
29923
30452
|
type: "tool-input-start",
|
|
29924
30453
|
id: value.item.id,
|
|
29925
|
-
toolName: webSearchToolName != null ? webSearchToolName : "web_search"
|
|
30454
|
+
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
30455
|
+
providerExecuted: true
|
|
29926
30456
|
});
|
|
29927
30457
|
} else if (value.item.type === "computer_call") {
|
|
29928
30458
|
ongoingToolCalls[value.output_index] = {
|
|
@@ -29932,7 +30462,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29932
30462
|
controller.enqueue({
|
|
29933
30463
|
type: "tool-input-start",
|
|
29934
30464
|
id: value.item.id,
|
|
29935
|
-
toolName: "computer_use"
|
|
30465
|
+
toolName: "computer_use",
|
|
30466
|
+
providerExecuted: true
|
|
29936
30467
|
});
|
|
29937
30468
|
} else if (value.item.type === "code_interpreter_call") {
|
|
29938
30469
|
ongoingToolCalls[value.output_index] = {
|
|
@@ -29945,7 +30476,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
29945
30476
|
controller.enqueue({
|
|
29946
30477
|
type: "tool-input-start",
|
|
29947
30478
|
id: value.item.id,
|
|
29948
|
-
toolName: "code_interpreter"
|
|
30479
|
+
toolName: "code_interpreter",
|
|
30480
|
+
providerExecuted: true
|
|
29949
30481
|
});
|
|
29950
30482
|
controller.enqueue({
|
|
29951
30483
|
type: "tool-input-delta",
|
|
@@ -30280,193 +30812,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
30280
30812
|
};
|
|
30281
30813
|
}
|
|
30282
30814
|
};
|
|
30283
|
-
var usageSchema2 = exports_external.object({
|
|
30284
|
-
input_tokens: exports_external.number(),
|
|
30285
|
-
input_tokens_details: exports_external.object({ cached_tokens: exports_external.number().nullish() }).nullish(),
|
|
30286
|
-
output_tokens: exports_external.number(),
|
|
30287
|
-
output_tokens_details: exports_external.object({ reasoning_tokens: exports_external.number().nullish() }).nullish()
|
|
30288
|
-
});
|
|
30289
|
-
var textDeltaChunkSchema = exports_external.object({
|
|
30290
|
-
type: exports_external.literal("response.output_text.delta"),
|
|
30291
|
-
item_id: exports_external.string(),
|
|
30292
|
-
delta: exports_external.string(),
|
|
30293
|
-
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
30294
|
-
});
|
|
30295
|
-
var errorChunkSchema = exports_external.object({
|
|
30296
|
-
type: exports_external.literal("error"),
|
|
30297
|
-
code: exports_external.string(),
|
|
30298
|
-
message: exports_external.string(),
|
|
30299
|
-
param: exports_external.string().nullish(),
|
|
30300
|
-
sequence_number: exports_external.number()
|
|
30301
|
-
});
|
|
30302
|
-
var responseFinishedChunkSchema = exports_external.object({
|
|
30303
|
-
type: exports_external.enum(["response.completed", "response.incomplete"]),
|
|
30304
|
-
response: exports_external.object({
|
|
30305
|
-
incomplete_details: exports_external.object({ reason: exports_external.string() }).nullish(),
|
|
30306
|
-
usage: usageSchema2,
|
|
30307
|
-
service_tier: exports_external.string().nullish()
|
|
30308
|
-
})
|
|
30309
|
-
});
|
|
30310
|
-
var responseCreatedChunkSchema = exports_external.object({
|
|
30311
|
-
type: exports_external.literal("response.created"),
|
|
30312
|
-
response: exports_external.object({
|
|
30313
|
-
id: exports_external.string(),
|
|
30314
|
-
created_at: exports_external.number(),
|
|
30315
|
-
model: exports_external.string(),
|
|
30316
|
-
service_tier: exports_external.string().nullish()
|
|
30317
|
-
})
|
|
30318
|
-
});
|
|
30319
|
-
var responseOutputItemAddedSchema = exports_external.object({
|
|
30320
|
-
type: exports_external.literal("response.output_item.added"),
|
|
30321
|
-
output_index: exports_external.number(),
|
|
30322
|
-
item: exports_external.discriminatedUnion("type", [
|
|
30323
|
-
exports_external.object({
|
|
30324
|
-
type: exports_external.literal("message"),
|
|
30325
|
-
id: exports_external.string()
|
|
30326
|
-
}),
|
|
30327
|
-
exports_external.object({
|
|
30328
|
-
type: exports_external.literal("reasoning"),
|
|
30329
|
-
id: exports_external.string(),
|
|
30330
|
-
encrypted_content: exports_external.string().nullish()
|
|
30331
|
-
}),
|
|
30332
|
-
exports_external.object({
|
|
30333
|
-
type: exports_external.literal("function_call"),
|
|
30334
|
-
id: exports_external.string(),
|
|
30335
|
-
call_id: exports_external.string(),
|
|
30336
|
-
name: exports_external.string(),
|
|
30337
|
-
arguments: exports_external.string()
|
|
30338
|
-
}),
|
|
30339
|
-
exports_external.object({
|
|
30340
|
-
type: exports_external.literal("web_search_call"),
|
|
30341
|
-
id: exports_external.string(),
|
|
30342
|
-
status: exports_external.string(),
|
|
30343
|
-
action: exports_external.object({
|
|
30344
|
-
type: exports_external.literal("search"),
|
|
30345
|
-
query: exports_external.string().optional()
|
|
30346
|
-
}).nullish()
|
|
30347
|
-
}),
|
|
30348
|
-
exports_external.object({
|
|
30349
|
-
type: exports_external.literal("computer_call"),
|
|
30350
|
-
id: exports_external.string(),
|
|
30351
|
-
status: exports_external.string()
|
|
30352
|
-
}),
|
|
30353
|
-
exports_external.object({
|
|
30354
|
-
type: exports_external.literal("file_search_call"),
|
|
30355
|
-
id: exports_external.string()
|
|
30356
|
-
}),
|
|
30357
|
-
exports_external.object({
|
|
30358
|
-
type: exports_external.literal("image_generation_call"),
|
|
30359
|
-
id: exports_external.string()
|
|
30360
|
-
}),
|
|
30361
|
-
exports_external.object({
|
|
30362
|
-
type: exports_external.literal("code_interpreter_call"),
|
|
30363
|
-
id: exports_external.string(),
|
|
30364
|
-
container_id: exports_external.string(),
|
|
30365
|
-
code: exports_external.string().nullable(),
|
|
30366
|
-
outputs: exports_external.array(exports_external.discriminatedUnion("type", [
|
|
30367
|
-
exports_external.object({ type: exports_external.literal("logs"), logs: exports_external.string() }),
|
|
30368
|
-
exports_external.object({ type: exports_external.literal("image"), url: exports_external.string() })
|
|
30369
|
-
])).nullable(),
|
|
30370
|
-
status: exports_external.string()
|
|
30371
|
-
})
|
|
30372
|
-
])
|
|
30373
|
-
});
|
|
30374
|
-
var responseOutputItemDoneSchema = exports_external.object({
|
|
30375
|
-
type: exports_external.literal("response.output_item.done"),
|
|
30376
|
-
output_index: exports_external.number(),
|
|
30377
|
-
item: exports_external.discriminatedUnion("type", [
|
|
30378
|
-
exports_external.object({
|
|
30379
|
-
type: exports_external.literal("message"),
|
|
30380
|
-
id: exports_external.string()
|
|
30381
|
-
}),
|
|
30382
|
-
exports_external.object({
|
|
30383
|
-
type: exports_external.literal("reasoning"),
|
|
30384
|
-
id: exports_external.string(),
|
|
30385
|
-
encrypted_content: exports_external.string().nullish()
|
|
30386
|
-
}),
|
|
30387
|
-
exports_external.object({
|
|
30388
|
-
type: exports_external.literal("function_call"),
|
|
30389
|
-
id: exports_external.string(),
|
|
30390
|
-
call_id: exports_external.string(),
|
|
30391
|
-
name: exports_external.string(),
|
|
30392
|
-
arguments: exports_external.string(),
|
|
30393
|
-
status: exports_external.literal("completed")
|
|
30394
|
-
}),
|
|
30395
|
-
codeInterpreterCallItem,
|
|
30396
|
-
imageGenerationCallItem,
|
|
30397
|
-
webSearchCallItem,
|
|
30398
|
-
fileSearchCallItem,
|
|
30399
|
-
localShellCallItem,
|
|
30400
|
-
exports_external.object({
|
|
30401
|
-
type: exports_external.literal("computer_call"),
|
|
30402
|
-
id: exports_external.string(),
|
|
30403
|
-
status: exports_external.literal("completed")
|
|
30404
|
-
})
|
|
30405
|
-
])
|
|
30406
|
-
});
|
|
30407
|
-
var responseFunctionCallArgumentsDeltaSchema = exports_external.object({
|
|
30408
|
-
type: exports_external.literal("response.function_call_arguments.delta"),
|
|
30409
|
-
item_id: exports_external.string(),
|
|
30410
|
-
output_index: exports_external.number(),
|
|
30411
|
-
delta: exports_external.string()
|
|
30412
|
-
});
|
|
30413
|
-
var responseCodeInterpreterCallCodeDeltaSchema = exports_external.object({
|
|
30414
|
-
type: exports_external.literal("response.code_interpreter_call_code.delta"),
|
|
30415
|
-
item_id: exports_external.string(),
|
|
30416
|
-
output_index: exports_external.number(),
|
|
30417
|
-
delta: exports_external.string()
|
|
30418
|
-
});
|
|
30419
|
-
var responseCodeInterpreterCallCodeDoneSchema = exports_external.object({
|
|
30420
|
-
type: exports_external.literal("response.code_interpreter_call_code.done"),
|
|
30421
|
-
item_id: exports_external.string(),
|
|
30422
|
-
output_index: exports_external.number(),
|
|
30423
|
-
code: exports_external.string()
|
|
30424
|
-
});
|
|
30425
|
-
var responseAnnotationAddedSchema = exports_external.object({
|
|
30426
|
-
type: exports_external.literal("response.output_text.annotation.added"),
|
|
30427
|
-
annotation: exports_external.discriminatedUnion("type", [
|
|
30428
|
-
exports_external.object({
|
|
30429
|
-
type: exports_external.literal("url_citation"),
|
|
30430
|
-
url: exports_external.string(),
|
|
30431
|
-
title: exports_external.string()
|
|
30432
|
-
}),
|
|
30433
|
-
exports_external.object({
|
|
30434
|
-
type: exports_external.literal("file_citation"),
|
|
30435
|
-
file_id: exports_external.string(),
|
|
30436
|
-
filename: exports_external.string().nullish(),
|
|
30437
|
-
index: exports_external.number().nullish(),
|
|
30438
|
-
start_index: exports_external.number().nullish(),
|
|
30439
|
-
end_index: exports_external.number().nullish(),
|
|
30440
|
-
quote: exports_external.string().nullish()
|
|
30441
|
-
})
|
|
30442
|
-
])
|
|
30443
|
-
});
|
|
30444
|
-
var responseReasoningSummaryPartAddedSchema = exports_external.object({
|
|
30445
|
-
type: exports_external.literal("response.reasoning_summary_part.added"),
|
|
30446
|
-
item_id: exports_external.string(),
|
|
30447
|
-
summary_index: exports_external.number()
|
|
30448
|
-
});
|
|
30449
|
-
var responseReasoningSummaryTextDeltaSchema = exports_external.object({
|
|
30450
|
-
type: exports_external.literal("response.reasoning_summary_text.delta"),
|
|
30451
|
-
item_id: exports_external.string(),
|
|
30452
|
-
summary_index: exports_external.number(),
|
|
30453
|
-
delta: exports_external.string()
|
|
30454
|
-
});
|
|
30455
|
-
var openaiResponsesChunkSchema = exports_external.union([
|
|
30456
|
-
textDeltaChunkSchema,
|
|
30457
|
-
responseFinishedChunkSchema,
|
|
30458
|
-
responseCreatedChunkSchema,
|
|
30459
|
-
responseOutputItemAddedSchema,
|
|
30460
|
-
responseOutputItemDoneSchema,
|
|
30461
|
-
responseFunctionCallArgumentsDeltaSchema,
|
|
30462
|
-
responseCodeInterpreterCallCodeDeltaSchema,
|
|
30463
|
-
responseCodeInterpreterCallCodeDoneSchema,
|
|
30464
|
-
responseAnnotationAddedSchema,
|
|
30465
|
-
responseReasoningSummaryPartAddedSchema,
|
|
30466
|
-
responseReasoningSummaryTextDeltaSchema,
|
|
30467
|
-
errorChunkSchema,
|
|
30468
|
-
exports_external.object({ type: exports_external.string() }).loose()
|
|
30469
|
-
]);
|
|
30470
30815
|
function isTextDeltaChunk(chunk) {
|
|
30471
30816
|
return chunk.type === "response.output_text.delta";
|
|
30472
30817
|
}
|
|
@@ -30543,32 +30888,10 @@ function getResponsesModelConfig(modelId) {
|
|
|
30543
30888
|
isReasoningModel: false
|
|
30544
30889
|
};
|
|
30545
30890
|
}
|
|
30546
|
-
var
|
|
30547
|
-
include: exports_external.array(exports_external.enum([
|
|
30548
|
-
"reasoning.encrypted_content",
|
|
30549
|
-
"file_search_call.results",
|
|
30550
|
-
"message.output_text.logprobs"
|
|
30551
|
-
])).nullish(),
|
|
30552
|
-
instructions: exports_external.string().nullish(),
|
|
30553
|
-
logprobs: exports_external.union([exports_external.boolean(), exports_external.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
30554
|
-
maxToolCalls: exports_external.number().nullish(),
|
|
30555
|
-
metadata: exports_external.any().nullish(),
|
|
30556
|
-
parallelToolCalls: exports_external.boolean().nullish(),
|
|
30557
|
-
previousResponseId: exports_external.string().nullish(),
|
|
30558
|
-
promptCacheKey: exports_external.string().nullish(),
|
|
30559
|
-
reasoningEffort: exports_external.string().nullish(),
|
|
30560
|
-
reasoningSummary: exports_external.string().nullish(),
|
|
30561
|
-
safetyIdentifier: exports_external.string().nullish(),
|
|
30562
|
-
serviceTier: exports_external.enum(["auto", "flex", "priority"]).nullish(),
|
|
30563
|
-
store: exports_external.boolean().nullish(),
|
|
30564
|
-
strictJsonSchema: exports_external.boolean().nullish(),
|
|
30565
|
-
textVerbosity: exports_external.enum(["low", "medium", "high"]).nullish(),
|
|
30566
|
-
user: exports_external.string().nullish()
|
|
30567
|
-
});
|
|
30568
|
-
var OpenAIProviderOptionsSchema = exports_external.object({
|
|
30891
|
+
var openaiSpeechProviderOptionsSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
30569
30892
|
instructions: exports_external.string().nullish(),
|
|
30570
30893
|
speed: exports_external.number().min(0.25).max(4).default(1).nullish()
|
|
30571
|
-
});
|
|
30894
|
+
})));
|
|
30572
30895
|
var OpenAISpeechModel = class {
|
|
30573
30896
|
constructor(modelId, config2) {
|
|
30574
30897
|
this.modelId = modelId;
|
|
@@ -30591,7 +30914,7 @@ var OpenAISpeechModel = class {
|
|
|
30591
30914
|
const openAIOptions = await parseProviderOptions({
|
|
30592
30915
|
provider: "openai",
|
|
30593
30916
|
providerOptions,
|
|
30594
|
-
schema:
|
|
30917
|
+
schema: openaiSpeechProviderOptionsSchema
|
|
30595
30918
|
});
|
|
30596
30919
|
const requestBody = {
|
|
30597
30920
|
model: this.modelId,
|
|
@@ -30668,13 +30991,35 @@ var OpenAISpeechModel = class {
|
|
|
30668
30991
|
};
|
|
30669
30992
|
}
|
|
30670
30993
|
};
|
|
30671
|
-
var
|
|
30994
|
+
var openaiTranscriptionResponseSchema = lazyValidator(() => zodSchema(exports_external.object({
|
|
30995
|
+
text: exports_external.string(),
|
|
30996
|
+
language: exports_external.string().nullish(),
|
|
30997
|
+
duration: exports_external.number().nullish(),
|
|
30998
|
+
words: exports_external.array(exports_external.object({
|
|
30999
|
+
word: exports_external.string(),
|
|
31000
|
+
start: exports_external.number(),
|
|
31001
|
+
end: exports_external.number()
|
|
31002
|
+
})).nullish(),
|
|
31003
|
+
segments: exports_external.array(exports_external.object({
|
|
31004
|
+
id: exports_external.number(),
|
|
31005
|
+
seek: exports_external.number(),
|
|
31006
|
+
start: exports_external.number(),
|
|
31007
|
+
end: exports_external.number(),
|
|
31008
|
+
text: exports_external.string(),
|
|
31009
|
+
tokens: exports_external.array(exports_external.number()),
|
|
31010
|
+
temperature: exports_external.number(),
|
|
31011
|
+
avg_logprob: exports_external.number(),
|
|
31012
|
+
compression_ratio: exports_external.number(),
|
|
31013
|
+
no_speech_prob: exports_external.number()
|
|
31014
|
+
})).nullish()
|
|
31015
|
+
})));
|
|
31016
|
+
var openAITranscriptionProviderOptions = lazyValidator(() => zodSchema(exports_external.object({
|
|
30672
31017
|
include: exports_external.array(exports_external.string()).optional(),
|
|
30673
31018
|
language: exports_external.string().optional(),
|
|
30674
31019
|
prompt: exports_external.string().optional(),
|
|
30675
31020
|
temperature: exports_external.number().min(0).max(1).default(0).optional(),
|
|
30676
31021
|
timestampGranularities: exports_external.array(exports_external.enum(["word", "segment"])).default(["segment"]).optional()
|
|
30677
|
-
});
|
|
31022
|
+
})));
|
|
30678
31023
|
var languageMap = {
|
|
30679
31024
|
afrikaans: "af",
|
|
30680
31025
|
arabic: "ar",
|
|
@@ -30832,29 +31177,7 @@ var OpenAITranscriptionModel = class {
|
|
|
30832
31177
|
};
|
|
30833
31178
|
}
|
|
30834
31179
|
};
|
|
30835
|
-
var
|
|
30836
|
-
text: exports_external.string(),
|
|
30837
|
-
language: exports_external.string().nullish(),
|
|
30838
|
-
duration: exports_external.number().nullish(),
|
|
30839
|
-
words: exports_external.array(exports_external.object({
|
|
30840
|
-
word: exports_external.string(),
|
|
30841
|
-
start: exports_external.number(),
|
|
30842
|
-
end: exports_external.number()
|
|
30843
|
-
})).nullish(),
|
|
30844
|
-
segments: exports_external.array(exports_external.object({
|
|
30845
|
-
id: exports_external.number(),
|
|
30846
|
-
seek: exports_external.number(),
|
|
30847
|
-
start: exports_external.number(),
|
|
30848
|
-
end: exports_external.number(),
|
|
30849
|
-
text: exports_external.string(),
|
|
30850
|
-
tokens: exports_external.array(exports_external.number()),
|
|
30851
|
-
temperature: exports_external.number(),
|
|
30852
|
-
avg_logprob: exports_external.number(),
|
|
30853
|
-
compression_ratio: exports_external.number(),
|
|
30854
|
-
no_speech_prob: exports_external.number()
|
|
30855
|
-
})).nullish()
|
|
30856
|
-
});
|
|
30857
|
-
var VERSION5 = "2.0.42";
|
|
31180
|
+
var VERSION5 = "2.0.50";
|
|
30858
31181
|
function createOpenAI(options = {}) {
|
|
30859
31182
|
var _a18, _b8;
|
|
30860
31183
|
const baseURL = (_a18 = withoutTrailingSlash(loadOptionalSetting({
|
|
@@ -33509,11 +33832,13 @@ var Sr = function(e3) {
|
|
|
33509
33832
|
}
|
|
33510
33833
|
return l(t2, e3), u(t2);
|
|
33511
33834
|
}(g(Error));
|
|
33512
|
-
|
|
33835
|
+
var Er = "code";
|
|
33836
|
+
var Ir = "S256";
|
|
33837
|
+
function Zr(e3, t2) {
|
|
33513
33838
|
var n2 = e3.client_secret !== undefined;
|
|
33514
33839
|
return t2.length === 0 ? n2 ? "client_secret_post" : "none" : n2 && t2.includes("client_secret_basic") ? "client_secret_basic" : n2 && t2.includes("client_secret_post") ? "client_secret_post" : t2.includes("none") ? "none" : n2 ? "client_secret_post" : "none";
|
|
33515
33840
|
}
|
|
33516
|
-
function
|
|
33841
|
+
function jr(e3, t2, n2, r2) {
|
|
33517
33842
|
var { client_id: a2, client_secret: i2 } = t2;
|
|
33518
33843
|
switch (e3) {
|
|
33519
33844
|
case "client_secret_basic":
|
|
@@ -33535,11 +33860,11 @@ function Ir(e3, t2, n2, r2) {
|
|
|
33535
33860
|
throw new Error("Unsupported client authentication method: ".concat(e3));
|
|
33536
33861
|
}
|
|
33537
33862
|
}
|
|
33538
|
-
function
|
|
33539
|
-
return
|
|
33863
|
+
function Pr(e3) {
|
|
33864
|
+
return Nr.apply(this, arguments);
|
|
33540
33865
|
}
|
|
33541
|
-
function
|
|
33542
|
-
return (
|
|
33866
|
+
function Nr() {
|
|
33867
|
+
return (Nr = e(b().m(function e(t2) {
|
|
33543
33868
|
var n2, r2, a2, i2, s2, o2, u2, c2, d2, l2;
|
|
33544
33869
|
return b().w(function(e3) {
|
|
33545
33870
|
for (;; )
|
|
@@ -33563,17 +33888,17 @@ function jr() {
|
|
|
33563
33888
|
}, e, null, [[4, 5]]);
|
|
33564
33889
|
}))).apply(this, arguments);
|
|
33565
33890
|
}
|
|
33566
|
-
function
|
|
33567
|
-
return
|
|
33891
|
+
function Ur(e3, t2) {
|
|
33892
|
+
return Mr.apply(this, arguments);
|
|
33568
33893
|
}
|
|
33569
|
-
function
|
|
33570
|
-
return (
|
|
33894
|
+
function Mr() {
|
|
33895
|
+
return (Mr = e(b().m(function e(t2, n2) {
|
|
33571
33896
|
var r2, a2, i2;
|
|
33572
33897
|
return b().w(function(e3) {
|
|
33573
33898
|
for (;; )
|
|
33574
33899
|
switch (e3.p = e3.n) {
|
|
33575
33900
|
case 0:
|
|
33576
|
-
return e3.p = 0, e3.n = 1,
|
|
33901
|
+
return e3.p = 0, e3.n = 1, Lr(t2, n2);
|
|
33577
33902
|
case 1:
|
|
33578
33903
|
case 4:
|
|
33579
33904
|
case 7:
|
|
@@ -33585,7 +33910,7 @@ function Nr() {
|
|
|
33585
33910
|
}
|
|
33586
33911
|
return e3.n = 3, (r2 = t2.invalidateCredentials) === null || r2 === undefined ? undefined : r2.call(t2, "all");
|
|
33587
33912
|
case 3:
|
|
33588
|
-
return e3.n = 4,
|
|
33913
|
+
return e3.n = 4, Lr(t2, n2);
|
|
33589
33914
|
case 5:
|
|
33590
33915
|
if (!(i2 instanceof pr)) {
|
|
33591
33916
|
e3.n = 8;
|
|
@@ -33593,7 +33918,7 @@ function Nr() {
|
|
|
33593
33918
|
}
|
|
33594
33919
|
return e3.n = 6, (a2 = t2.invalidateCredentials) === null || a2 === undefined ? undefined : a2.call(t2, "tokens");
|
|
33595
33920
|
case 6:
|
|
33596
|
-
return e3.n = 7,
|
|
33921
|
+
return e3.n = 7, Lr(t2, n2);
|
|
33597
33922
|
case 8:
|
|
33598
33923
|
throw i2;
|
|
33599
33924
|
case 9:
|
|
@@ -33602,26 +33927,26 @@ function Nr() {
|
|
|
33602
33927
|
}, e, null, [[0, 2]]);
|
|
33603
33928
|
}))).apply(this, arguments);
|
|
33604
33929
|
}
|
|
33605
|
-
function
|
|
33606
|
-
return
|
|
33930
|
+
function Lr(e3, t2) {
|
|
33931
|
+
return Fr.apply(this, arguments);
|
|
33607
33932
|
}
|
|
33608
|
-
function
|
|
33609
|
-
return (
|
|
33933
|
+
function Fr() {
|
|
33934
|
+
return (Fr = e(b().m(function e(t2, n2) {
|
|
33610
33935
|
var r2, a2, i2, s2, o2, u2, c2, d2, l2, h2, f2, v2, m2, y2, _, g2, k2, w3, b3, x2, T2;
|
|
33611
33936
|
return b().w(function(e3) {
|
|
33612
33937
|
for (;; )
|
|
33613
33938
|
switch (e3.p = e3.n) {
|
|
33614
33939
|
case 0:
|
|
33615
|
-
return r2 = n2.serverUrl, a2 = n2.authorizationCode, i2 = n2.scope, s2 = n2.resourceMetadataUrl, o2 = n2.fetchFn, e3.p = 1, e3.n = 2,
|
|
33940
|
+
return r2 = n2.serverUrl, a2 = n2.authorizationCode, i2 = n2.scope, s2 = n2.resourceMetadataUrl, o2 = n2.fetchFn, e3.p = 1, e3.n = 2, qr(r2, { resourceMetadataUrl: s2 }, o2);
|
|
33616
33941
|
case 2:
|
|
33617
33942
|
(u2 = e3.v).authorization_servers && u2.authorization_servers.length > 0 && (c2 = u2.authorization_servers[0]), e3.n = 4;
|
|
33618
33943
|
break;
|
|
33619
33944
|
case 3:
|
|
33620
33945
|
e3.p = 3, e3.v;
|
|
33621
33946
|
case 4:
|
|
33622
|
-
return c2 || (c2 = r2), e3.n = 5,
|
|
33947
|
+
return c2 || (c2 = r2), e3.n = 5, zr(r2, t2, u2);
|
|
33623
33948
|
case 5:
|
|
33624
|
-
return d2 = e3.v, e3.n = 6,
|
|
33949
|
+
return d2 = e3.v, e3.n = 6, ea(c2, { fetchFn: o2 });
|
|
33625
33950
|
case 6:
|
|
33626
33951
|
return l2 = e3.v, e3.n = 7, Promise.resolve(t2.clientInformation());
|
|
33627
33952
|
case 7:
|
|
@@ -33641,7 +33966,7 @@ function Mr() {
|
|
|
33641
33966
|
}
|
|
33642
33967
|
throw new Error("OAuth client information must be saveable for dynamic registration");
|
|
33643
33968
|
case 9:
|
|
33644
|
-
return e3.n = 10,
|
|
33969
|
+
return e3.n = 10, ua(c2, { metadata: l2, clientMetadata: t2.clientMetadata, fetchFn: o2 });
|
|
33645
33970
|
case 10:
|
|
33646
33971
|
return f2 = e3.v, e3.n = 11, t2.saveClientInformation(f2);
|
|
33647
33972
|
case 11:
|
|
@@ -33653,7 +33978,7 @@ function Mr() {
|
|
|
33653
33978
|
}
|
|
33654
33979
|
return e3.n = 13, t2.codeVerifier();
|
|
33655
33980
|
case 13:
|
|
33656
|
-
return v2 = e3.v, e3.n = 14,
|
|
33981
|
+
return v2 = e3.v, e3.n = 14, aa(c2, { metadata: l2, clientInformation: h2, authorizationCode: a2, codeVerifier: v2, redirectUri: t2.redirectUrl, resource: d2, addClientAuthentication: t2.addClientAuthentication, fetchFn: o2 });
|
|
33657
33982
|
case 14:
|
|
33658
33983
|
return m2 = e3.v, e3.n = 15, t2.saveTokens(m2);
|
|
33659
33984
|
case 15:
|
|
@@ -33665,7 +33990,7 @@ function Mr() {
|
|
|
33665
33990
|
e3.n = 23;
|
|
33666
33991
|
break;
|
|
33667
33992
|
}
|
|
33668
|
-
return e3.p = 18, e3.n = 19,
|
|
33993
|
+
return e3.p = 18, e3.n = 19, sa(c2, { metadata: l2, clientInformation: h2, refreshToken: y2.refresh_token, resource: d2, addClientAuthentication: t2.addClientAuthentication, fetchFn: o2 });
|
|
33669
33994
|
case 19:
|
|
33670
33995
|
return _ = e3.v, e3.n = 20, t2.saveTokens(_);
|
|
33671
33996
|
case 20:
|
|
@@ -33691,7 +34016,7 @@ function Mr() {
|
|
|
33691
34016
|
case 25:
|
|
33692
34017
|
T2 = undefined;
|
|
33693
34018
|
case 26:
|
|
33694
|
-
return g2 = T2, e3.n = 27,
|
|
34019
|
+
return g2 = T2, e3.n = 27, na(c2, { metadata: l2, clientInformation: h2, state: g2, redirectUrl: t2.redirectUrl, scope: i2 || t2.clientMetadata.scope, resource: d2 });
|
|
33695
34020
|
case 27:
|
|
33696
34021
|
return k2 = e3.v, w3 = k2.authorizationUrl, b3 = k2.codeVerifier, e3.n = 28, t2.saveCodeVerifier(b3);
|
|
33697
34022
|
case 28:
|
|
@@ -33702,11 +34027,11 @@ function Mr() {
|
|
|
33702
34027
|
}, e, null, [[18, 21], [1, 3]]);
|
|
33703
34028
|
}))).apply(this, arguments);
|
|
33704
34029
|
}
|
|
33705
|
-
function
|
|
33706
|
-
return
|
|
34030
|
+
function zr(e3, t2, n2) {
|
|
34031
|
+
return Dr.apply(this, arguments);
|
|
33707
34032
|
}
|
|
33708
|
-
function
|
|
33709
|
-
return (
|
|
34033
|
+
function Dr() {
|
|
34034
|
+
return (Dr = e(b().m(function e(t2, n2, r2) {
|
|
33710
34035
|
var a2;
|
|
33711
34036
|
return b().w(function(e3) {
|
|
33712
34037
|
for (;; )
|
|
@@ -33737,7 +34062,7 @@ function Fr() {
|
|
|
33737
34062
|
}, e);
|
|
33738
34063
|
}))).apply(this, arguments);
|
|
33739
34064
|
}
|
|
33740
|
-
function
|
|
34065
|
+
function Vr(e3) {
|
|
33741
34066
|
var t2 = e3.headers.get("WWW-Authenticate");
|
|
33742
34067
|
if (t2) {
|
|
33743
34068
|
var n2 = t2.split(" "), r2 = h(n2, 2), a2 = r2[0], i2 = r2[1];
|
|
@@ -33752,17 +34077,17 @@ function zr(e3) {
|
|
|
33752
34077
|
}
|
|
33753
34078
|
}
|
|
33754
34079
|
}
|
|
33755
|
-
function
|
|
33756
|
-
return
|
|
34080
|
+
function qr(e3, t2) {
|
|
34081
|
+
return Hr.apply(this, arguments);
|
|
33757
34082
|
}
|
|
33758
|
-
function
|
|
33759
|
-
return
|
|
34083
|
+
function Hr() {
|
|
34084
|
+
return Hr = e(b().m(function e(t2, n2) {
|
|
33760
34085
|
var r2, a2, i2, s2 = arguments;
|
|
33761
34086
|
return b().w(function(e3) {
|
|
33762
34087
|
for (;; )
|
|
33763
34088
|
switch (e3.n) {
|
|
33764
34089
|
case 0:
|
|
33765
|
-
return r2 = s2.length > 2 && s2[2] !== undefined ? s2[2] : fetch, e3.n = 1,
|
|
34090
|
+
return r2 = s2.length > 2 && s2[2] !== undefined ? s2[2] : fetch, e3.n = 1, Yr(t2, "oauth-protected-resource", r2, { protocolVersion: n2 == null ? undefined : n2.protocolVersion, metadataUrl: n2 == null ? undefined : n2.resourceMetadataUrl });
|
|
33766
34091
|
case 1:
|
|
33767
34092
|
if ((a2 = e3.v) && a2.status !== 404) {
|
|
33768
34093
|
e3.n = 2;
|
|
@@ -33781,13 +34106,13 @@ function Vr() {
|
|
|
33781
34106
|
return e3.a(2, i2.parse.call(i2, e3.v));
|
|
33782
34107
|
}
|
|
33783
34108
|
}, e);
|
|
33784
|
-
})),
|
|
34109
|
+
})), Hr.apply(this, arguments);
|
|
33785
34110
|
}
|
|
33786
|
-
function
|
|
33787
|
-
return
|
|
34111
|
+
function Wr(e3, t2) {
|
|
34112
|
+
return Kr.apply(this, arguments);
|
|
33788
34113
|
}
|
|
33789
|
-
function
|
|
33790
|
-
return
|
|
34114
|
+
function Kr() {
|
|
34115
|
+
return Kr = e(b().m(function e(t2, n2) {
|
|
33791
34116
|
var r2, a2, i2 = arguments;
|
|
33792
34117
|
return b().w(function(e3) {
|
|
33793
34118
|
for (;; )
|
|
@@ -33805,7 +34130,7 @@ function Hr() {
|
|
|
33805
34130
|
e3.n = 4;
|
|
33806
34131
|
break;
|
|
33807
34132
|
}
|
|
33808
|
-
return e3.a(2,
|
|
34133
|
+
return e3.a(2, Wr(t2, undefined, r2));
|
|
33809
34134
|
case 4:
|
|
33810
34135
|
return e3.a(2, undefined);
|
|
33811
34136
|
case 5:
|
|
@@ -33814,49 +34139,49 @@ function Hr() {
|
|
|
33814
34139
|
return e3.a(2);
|
|
33815
34140
|
}
|
|
33816
34141
|
}, e, null, [[1, 3]]);
|
|
33817
|
-
})),
|
|
34142
|
+
})), Kr.apply(this, arguments);
|
|
33818
34143
|
}
|
|
33819
|
-
function
|
|
34144
|
+
function Br(e3) {
|
|
33820
34145
|
var t2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "", n2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
33821
34146
|
return t2.endsWith("/") && (t2 = t2.slice(0, -1)), n2.prependPathname ? "".concat(t2, "/.well-known/").concat(e3) : "/.well-known/".concat(e3).concat(t2);
|
|
33822
34147
|
}
|
|
33823
|
-
function
|
|
33824
|
-
return
|
|
34148
|
+
function $r(e3, t2) {
|
|
34149
|
+
return Jr.apply(this, arguments);
|
|
33825
34150
|
}
|
|
33826
|
-
function
|
|
33827
|
-
return
|
|
34151
|
+
function Jr() {
|
|
34152
|
+
return Jr = e(b().m(function e(t2, n2) {
|
|
33828
34153
|
var r2, a2, i2 = arguments;
|
|
33829
34154
|
return b().w(function(e3) {
|
|
33830
34155
|
for (;; )
|
|
33831
34156
|
switch (e3.n) {
|
|
33832
34157
|
case 0:
|
|
33833
|
-
return r2 = i2.length > 2 && i2[2] !== undefined ? i2[2] : fetch, a2 = { "MCP-Protocol-Version": n2 }, e3.n = 1,
|
|
34158
|
+
return r2 = i2.length > 2 && i2[2] !== undefined ? i2[2] : fetch, a2 = { "MCP-Protocol-Version": n2 }, e3.n = 1, Wr(t2, a2, r2);
|
|
33834
34159
|
case 1:
|
|
33835
34160
|
return e3.a(2, e3.v);
|
|
33836
34161
|
}
|
|
33837
34162
|
}, e);
|
|
33838
|
-
})),
|
|
34163
|
+
})), Jr.apply(this, arguments);
|
|
33839
34164
|
}
|
|
33840
|
-
function
|
|
34165
|
+
function Gr(e3, t2) {
|
|
33841
34166
|
return !e3 || e3.status >= 400 && e3.status < 500 && t2 !== "/";
|
|
33842
34167
|
}
|
|
33843
|
-
function
|
|
33844
|
-
return
|
|
34168
|
+
function Yr(e3, t2, n2, r2) {
|
|
34169
|
+
return Xr.apply(this, arguments);
|
|
33845
34170
|
}
|
|
33846
|
-
function
|
|
33847
|
-
return (
|
|
34171
|
+
function Xr() {
|
|
34172
|
+
return (Xr = e(b().m(function e(t2, n2, r2, a2) {
|
|
33848
34173
|
var i2, s2, o2, u2, c2, d2, l2, h2;
|
|
33849
34174
|
return b().w(function(e3) {
|
|
33850
34175
|
for (;; )
|
|
33851
34176
|
switch (e3.n) {
|
|
33852
34177
|
case 0:
|
|
33853
|
-
return o2 = new URL(t2), u2 = (i2 = a2 == null ? undefined : a2.protocolVersion) !== null && i2 !== undefined ? i2 : mt, (a2 == null ? undefined : a2.metadataUrl) ? c2 = new URL(a2.metadataUrl) : (d2 =
|
|
34178
|
+
return o2 = new URL(t2), u2 = (i2 = a2 == null ? undefined : a2.protocolVersion) !== null && i2 !== undefined ? i2 : mt, (a2 == null ? undefined : a2.metadataUrl) ? c2 = new URL(a2.metadataUrl) : (d2 = Br(n2, o2.pathname), (c2 = new URL(d2, (s2 = a2 == null ? undefined : a2.metadataServerUrl) !== null && s2 !== undefined ? s2 : o2)).search = o2.search), e3.n = 1, $r(c2, u2, r2);
|
|
33854
34179
|
case 1:
|
|
33855
|
-
if (l2 = e3.v, (a2 == null ? undefined : a2.metadataUrl) ||
|
|
34180
|
+
if (l2 = e3.v, (a2 == null ? undefined : a2.metadataUrl) || !Gr(l2, o2.pathname)) {
|
|
33856
34181
|
e3.n = 3;
|
|
33857
34182
|
break;
|
|
33858
34183
|
}
|
|
33859
|
-
return h2 = new URL("/.well-known/".concat(n2), o2), e3.n = 2,
|
|
34184
|
+
return h2 = new URL("/.well-known/".concat(n2), o2), e3.n = 2, $r(h2, u2, r2);
|
|
33860
34185
|
case 2:
|
|
33861
34186
|
l2 = e3.v;
|
|
33862
34187
|
case 3:
|
|
@@ -33865,125 +34190,119 @@ function Gr() {
|
|
|
33865
34190
|
}, e);
|
|
33866
34191
|
}))).apply(this, arguments);
|
|
33867
34192
|
}
|
|
33868
|
-
function
|
|
34193
|
+
function Qr(e3) {
|
|
33869
34194
|
var t2 = typeof e3 == "string" ? new URL(e3) : e3, n2 = [];
|
|
33870
34195
|
if (!(t2.pathname !== "/"))
|
|
33871
34196
|
return n2.push({ url: new URL("/.well-known/oauth-authorization-server", t2.origin), type: "oauth" }), n2.push({ url: new URL("/.well-known/openid-configuration", t2.origin), type: "oidc" }), n2;
|
|
33872
34197
|
var r2 = t2.pathname;
|
|
33873
34198
|
return r2.endsWith("/") && (r2 = r2.slice(0, -1)), n2.push({ url: new URL("/.well-known/oauth-authorization-server".concat(r2), t2.origin), type: "oauth" }), n2.push({ url: new URL("/.well-known/oauth-authorization-server", t2.origin), type: "oauth" }), n2.push({ url: new URL("/.well-known/openid-configuration".concat(r2), t2.origin), type: "oidc" }), n2.push({ url: new URL("".concat(r2, "/.well-known/openid-configuration"), t2.origin), type: "oidc" }), n2;
|
|
33874
34199
|
}
|
|
33875
|
-
function
|
|
33876
|
-
return
|
|
34200
|
+
function ea(e3) {
|
|
34201
|
+
return ta.apply(this, arguments);
|
|
33877
34202
|
}
|
|
33878
|
-
function
|
|
33879
|
-
return
|
|
33880
|
-
var n2, r2, a2, s2, o2, u2, c2, d2, l2, h2, f2, v2, m2, y2, _, g2
|
|
34203
|
+
function ta() {
|
|
34204
|
+
return ta = e(b().m(function e(t2) {
|
|
34205
|
+
var n2, r2, a2, s2, o2, u2, c2, d2, l2, h2, f2, v2, m2, y2, _, g2 = arguments;
|
|
33881
34206
|
return b().w(function(e3) {
|
|
33882
34207
|
for (;; )
|
|
33883
34208
|
switch (e3.p = e3.n) {
|
|
33884
34209
|
case 0:
|
|
33885
|
-
r2 = (n2 =
|
|
34210
|
+
r2 = (n2 = g2.length > 1 && g2[1] !== undefined ? g2[1] : {}).fetchFn, a2 = r2 === undefined ? fetch : r2, s2 = n2.protocolVersion, o2 = { "MCP-Protocol-Version": s2 === undefined ? mt : s2 }, u2 = Qr(t2), c2 = c(u2), e3.p = 1, c2.s();
|
|
33886
34211
|
case 2:
|
|
33887
|
-
if ((
|
|
33888
|
-
e3.n =
|
|
34212
|
+
if ((d2 = c2.n()).done) {
|
|
34213
|
+
e3.n = 11;
|
|
33889
34214
|
break;
|
|
33890
34215
|
}
|
|
33891
|
-
return
|
|
34216
|
+
return l2 = d2.value, h2 = l2.url, f2 = l2.type, e3.n = 3, Wr(h2, o2, a2);
|
|
33892
34217
|
case 3:
|
|
33893
|
-
if (
|
|
34218
|
+
if (v2 = e3.v) {
|
|
33894
34219
|
e3.n = 4;
|
|
33895
34220
|
break;
|
|
33896
34221
|
}
|
|
33897
|
-
return e3.a(3,
|
|
34222
|
+
return e3.a(3, 10);
|
|
33898
34223
|
case 4:
|
|
33899
|
-
if (
|
|
34224
|
+
if (v2.ok) {
|
|
33900
34225
|
e3.n = 6;
|
|
33901
34226
|
break;
|
|
33902
34227
|
}
|
|
33903
|
-
if (!(
|
|
34228
|
+
if (!(v2.status >= 400 && v2.status < 500)) {
|
|
33904
34229
|
e3.n = 5;
|
|
33905
34230
|
break;
|
|
33906
34231
|
}
|
|
33907
|
-
return e3.a(3,
|
|
34232
|
+
return e3.a(3, 10);
|
|
33908
34233
|
case 5:
|
|
33909
|
-
throw new Error("HTTP ".concat(
|
|
34234
|
+
throw new Error("HTTP ".concat(v2.status, " trying to load ").concat(f2 === "oauth" ? "OAuth" : "OpenID provider", " metadata from ").concat(h2));
|
|
33910
34235
|
case 6:
|
|
33911
|
-
if (
|
|
34236
|
+
if (f2 !== "oauth") {
|
|
33912
34237
|
e3.n = 8;
|
|
33913
34238
|
break;
|
|
33914
34239
|
}
|
|
33915
|
-
return
|
|
34240
|
+
return m2 = nr, e3.n = 7, v2.json();
|
|
33916
34241
|
case 7:
|
|
33917
|
-
return e3.a(2,
|
|
34242
|
+
return e3.a(2, m2.parse.call(m2, e3.v));
|
|
33918
34243
|
case 8:
|
|
33919
|
-
return
|
|
34244
|
+
return y2 = rr, e3.n = 9, v2.json();
|
|
33920
34245
|
case 9:
|
|
33921
|
-
|
|
33922
|
-
e3.n = 10;
|
|
33923
|
-
break;
|
|
33924
|
-
}
|
|
33925
|
-
throw new Error("Incompatible OIDC provider at ".concat(f2, ": does not support S256 code challenge method required by MCP specification"));
|
|
34246
|
+
return e3.a(2, y2.parse.call(y2, e3.v));
|
|
33926
34247
|
case 10:
|
|
33927
|
-
return e3.a(2, y2);
|
|
33928
|
-
case 11:
|
|
33929
34248
|
e3.n = 2;
|
|
33930
34249
|
break;
|
|
33931
|
-
case
|
|
33932
|
-
e3.n =
|
|
34250
|
+
case 11:
|
|
34251
|
+
e3.n = 13;
|
|
33933
34252
|
break;
|
|
34253
|
+
case 12:
|
|
34254
|
+
e3.p = 12, _ = e3.v, c2.e(_);
|
|
33934
34255
|
case 13:
|
|
33935
|
-
e3.p = 13,
|
|
34256
|
+
return e3.p = 13, c2.f(), e3.f(13);
|
|
33936
34257
|
case 14:
|
|
33937
|
-
return e3.p = 14, d2.f(), e3.f(14);
|
|
33938
|
-
case 15:
|
|
33939
34258
|
return e3.a(2, undefined);
|
|
33940
34259
|
}
|
|
33941
|
-
}, e, null, [[1, 13, 14
|
|
33942
|
-
})),
|
|
34260
|
+
}, e, null, [[1, 12, 13, 14]]);
|
|
34261
|
+
})), ta.apply(this, arguments);
|
|
33943
34262
|
}
|
|
33944
|
-
function
|
|
33945
|
-
return
|
|
34263
|
+
function na(e3, t2) {
|
|
34264
|
+
return ra.apply(this, arguments);
|
|
33946
34265
|
}
|
|
33947
|
-
function
|
|
33948
|
-
return (
|
|
33949
|
-
var r2, a2, i2, s2, o2, u2, c2, d2, l2, h2
|
|
34266
|
+
function ra() {
|
|
34267
|
+
return (ra = e(b().m(function e(t2, n2) {
|
|
34268
|
+
var r2, a2, i2, s2, o2, u2, c2, d2, l2, h2;
|
|
33950
34269
|
return b().w(function(e3) {
|
|
33951
34270
|
for (;; )
|
|
33952
34271
|
switch (e3.n) {
|
|
33953
34272
|
case 0:
|
|
33954
|
-
if (r2 = n2.metadata, a2 = n2.clientInformation, i2 = n2.redirectUrl, s2 = n2.scope, o2 = n2.state, u2 = n2.resource,
|
|
34273
|
+
if (r2 = n2.metadata, a2 = n2.clientInformation, i2 = n2.redirectUrl, s2 = n2.scope, o2 = n2.state, u2 = n2.resource, !r2) {
|
|
33955
34274
|
e3.n = 3;
|
|
33956
34275
|
break;
|
|
33957
34276
|
}
|
|
33958
|
-
if (
|
|
34277
|
+
if (c2 = new URL(r2.authorization_endpoint), r2.response_types_supported.includes(Er)) {
|
|
33959
34278
|
e3.n = 1;
|
|
33960
34279
|
break;
|
|
33961
34280
|
}
|
|
33962
|
-
throw new Error("Incompatible auth server: does not support response type ".concat(
|
|
34281
|
+
throw new Error("Incompatible auth server: does not support response type ".concat(Er));
|
|
33963
34282
|
case 1:
|
|
33964
|
-
if (r2.code_challenge_methods_supported
|
|
34283
|
+
if (!r2.code_challenge_methods_supported || r2.code_challenge_methods_supported.includes(Ir)) {
|
|
33965
34284
|
e3.n = 2;
|
|
33966
34285
|
break;
|
|
33967
34286
|
}
|
|
33968
|
-
throw new Error("Incompatible auth server: does not support code challenge method ".concat(
|
|
34287
|
+
throw new Error("Incompatible auth server: does not support code challenge method ".concat(Ir));
|
|
33969
34288
|
case 2:
|
|
33970
34289
|
e3.n = 4;
|
|
33971
34290
|
break;
|
|
33972
34291
|
case 3:
|
|
33973
|
-
|
|
34292
|
+
c2 = new URL("/authorize", t2);
|
|
33974
34293
|
case 4:
|
|
33975
34294
|
return e3.n = 5, pkceChallenge();
|
|
33976
34295
|
case 5:
|
|
33977
|
-
return
|
|
34296
|
+
return d2 = e3.v, l2 = d2.code_verifier, h2 = d2.code_challenge, c2.searchParams.set("response_type", Er), c2.searchParams.set("client_id", a2.client_id), c2.searchParams.set("code_challenge", h2), c2.searchParams.set("code_challenge_method", Ir), c2.searchParams.set("redirect_uri", String(i2)), o2 && c2.searchParams.set("state", o2), s2 && c2.searchParams.set("scope", s2), (s2 == null ? undefined : s2.includes("offline_access")) && c2.searchParams.append("prompt", "consent"), u2 && c2.searchParams.set("resource", u2.href), e3.a(2, { authorizationUrl: c2, codeVerifier: l2 });
|
|
33978
34297
|
}
|
|
33979
34298
|
}, e);
|
|
33980
34299
|
}))).apply(this, arguments);
|
|
33981
34300
|
}
|
|
33982
|
-
function
|
|
33983
|
-
return
|
|
34301
|
+
function aa(e3, t2) {
|
|
34302
|
+
return ia.apply(this, arguments);
|
|
33984
34303
|
}
|
|
33985
|
-
function
|
|
33986
|
-
return (
|
|
34304
|
+
function ia() {
|
|
34305
|
+
return (ia = e(b().m(function e(t2, n2) {
|
|
33987
34306
|
var r2, a2, i2, s2, o2, u2, c2, d2, l2, h2, f2, v2, m2, y2, _, g2;
|
|
33988
34307
|
return b().w(function(e3) {
|
|
33989
34308
|
for (;; )
|
|
@@ -33995,13 +34314,13 @@ function ra() {
|
|
|
33995
34314
|
}
|
|
33996
34315
|
throw new Error("Incompatible auth server: does not support grant type ".concat(h2));
|
|
33997
34316
|
case 1:
|
|
33998
|
-
return v2 = new Headers({ "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" }), m2 = new URLSearchParams({ grant_type: h2, code: i2, code_verifier: s2, redirect_uri: String(o2) }), c2 ? c2(v2, m2, t2, r2) : (y2 = (l2 = r2 == null ? undefined : r2.token_endpoint_auth_methods_supported) !== null && l2 !== undefined ? l2 : [],
|
|
34317
|
+
return v2 = new Headers({ "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" }), m2 = new URLSearchParams({ grant_type: h2, code: i2, code_verifier: s2, redirect_uri: String(o2) }), c2 ? c2(v2, m2, t2, r2) : (y2 = (l2 = r2 == null ? undefined : r2.token_endpoint_auth_methods_supported) !== null && l2 !== undefined ? l2 : [], jr(Zr(a2, y2), a2, v2, m2)), u2 && m2.set("resource", u2.href), e3.n = 2, (d2 != null ? d2 : fetch)(f2, { method: "POST", headers: v2, body: m2 });
|
|
33999
34318
|
case 2:
|
|
34000
34319
|
if ((_ = e3.v).ok) {
|
|
34001
34320
|
e3.n = 4;
|
|
34002
34321
|
break;
|
|
34003
34322
|
}
|
|
34004
|
-
return e3.n = 3,
|
|
34323
|
+
return e3.n = 3, Pr(_);
|
|
34005
34324
|
case 3:
|
|
34006
34325
|
throw e3.v;
|
|
34007
34326
|
case 4:
|
|
@@ -34012,11 +34331,11 @@ function ra() {
|
|
|
34012
34331
|
}, e);
|
|
34013
34332
|
}))).apply(this, arguments);
|
|
34014
34333
|
}
|
|
34015
|
-
function
|
|
34016
|
-
return
|
|
34334
|
+
function sa(e3, t2) {
|
|
34335
|
+
return oa.apply(this, arguments);
|
|
34017
34336
|
}
|
|
34018
|
-
function
|
|
34019
|
-
return (
|
|
34337
|
+
function oa() {
|
|
34338
|
+
return (oa = e(b().m(function e(t2, n2) {
|
|
34020
34339
|
var r2, a2, i2, o2, u2, c2, d2, l2, h2, f2, v2, m2, y2, _, g2, k2;
|
|
34021
34340
|
return b().w(function(e3) {
|
|
34022
34341
|
for (;; )
|
|
@@ -34037,13 +34356,13 @@ function ia() {
|
|
|
34037
34356
|
case 2:
|
|
34038
34357
|
h2 = new URL("/token", t2);
|
|
34039
34358
|
case 3:
|
|
34040
|
-
return f2 = new Headers({ "Content-Type": "application/x-www-form-urlencoded" }), v2 = new URLSearchParams({ grant_type: l2, refresh_token: i2 }), u2 ? u2(f2, v2, t2, r2) : (m2 = (d2 = r2 == null ? undefined : r2.token_endpoint_auth_methods_supported) !== null && d2 !== undefined ? d2 : [],
|
|
34359
|
+
return f2 = new Headers({ "Content-Type": "application/x-www-form-urlencoded" }), v2 = new URLSearchParams({ grant_type: l2, refresh_token: i2 }), u2 ? u2(f2, v2, t2, r2) : (m2 = (d2 = r2 == null ? undefined : r2.token_endpoint_auth_methods_supported) !== null && d2 !== undefined ? d2 : [], jr(Zr(a2, m2), a2, f2, v2)), o2 && v2.set("resource", o2.href), e3.n = 4, (c2 != null ? c2 : fetch)(h2, { method: "POST", headers: f2, body: v2 });
|
|
34041
34360
|
case 4:
|
|
34042
34361
|
if ((y2 = e3.v).ok) {
|
|
34043
34362
|
e3.n = 6;
|
|
34044
34363
|
break;
|
|
34045
34364
|
}
|
|
34046
|
-
return e3.n = 5,
|
|
34365
|
+
return e3.n = 5, Pr(y2);
|
|
34047
34366
|
case 5:
|
|
34048
34367
|
throw e3.v;
|
|
34049
34368
|
case 6:
|
|
@@ -34054,11 +34373,11 @@ function ia() {
|
|
|
34054
34373
|
}, e);
|
|
34055
34374
|
}))).apply(this, arguments);
|
|
34056
34375
|
}
|
|
34057
|
-
function
|
|
34058
|
-
return
|
|
34376
|
+
function ua(e3, t2) {
|
|
34377
|
+
return ca.apply(this, arguments);
|
|
34059
34378
|
}
|
|
34060
|
-
function
|
|
34061
|
-
return (
|
|
34379
|
+
function ca() {
|
|
34380
|
+
return (ca = e(b().m(function e(t2, n2) {
|
|
34062
34381
|
var r2, a2, i2, s2, o2, u2;
|
|
34063
34382
|
return b().w(function(e3) {
|
|
34064
34383
|
for (;; )
|
|
@@ -34085,7 +34404,7 @@ function oa() {
|
|
|
34085
34404
|
e3.n = 6;
|
|
34086
34405
|
break;
|
|
34087
34406
|
}
|
|
34088
|
-
return e3.n = 5,
|
|
34407
|
+
return e3.n = 5, Pr(o2);
|
|
34089
34408
|
case 5:
|
|
34090
34409
|
throw e3.v;
|
|
34091
34410
|
case 6:
|
|
@@ -34096,18 +34415,18 @@ function oa() {
|
|
|
34096
34415
|
}, e);
|
|
34097
34416
|
}))).apply(this, arguments);
|
|
34098
34417
|
}
|
|
34099
|
-
var
|
|
34418
|
+
var da = function(e3) {
|
|
34100
34419
|
function t2(e4, n2) {
|
|
34101
34420
|
var r2;
|
|
34102
34421
|
return o(this, t2), (r2 = n(this, t2, [e4])).name = "ParseError", r2.type = n2.type, r2.field = n2.field, r2.value = n2.value, r2.line = n2.line, r2;
|
|
34103
34422
|
}
|
|
34104
34423
|
return l(t2, e3), u(t2);
|
|
34105
34424
|
}(g(Error));
|
|
34106
|
-
function
|
|
34107
|
-
function
|
|
34425
|
+
function la(e3) {}
|
|
34426
|
+
function ha(e3) {
|
|
34108
34427
|
if (typeof e3 == "function")
|
|
34109
34428
|
throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
|
|
34110
|
-
var t2, n2 = e3.onEvent, r2 = n2 === undefined ?
|
|
34429
|
+
var t2, n2 = e3.onEvent, r2 = n2 === undefined ? la : n2, a2 = e3.onError, s2 = a2 === undefined ? la : a2, o2 = e3.onRetry, u2 = o2 === undefined ? la : o2, c2 = e3.onComment, d2 = "", l2 = true, h2 = "", f2 = "";
|
|
34111
34430
|
function p2(e4) {
|
|
34112
34431
|
if (e4 === "")
|
|
34113
34432
|
return h2.length > 0 && r2({ id: t2, event: f2 || undefined, data: h2.endsWith(`
|
|
@@ -34137,10 +34456,10 @@ function da(e3) {
|
|
|
34137
34456
|
t2 = n3.includes("\x00") ? undefined : n3;
|
|
34138
34457
|
break;
|
|
34139
34458
|
case "retry":
|
|
34140
|
-
/^\d+$/.test(n3) ? u2(parseInt(n3, 10)) : s2(new
|
|
34459
|
+
/^\d+$/.test(n3) ? u2(parseInt(n3, 10)) : s2(new da('Invalid `retry` value: "'.concat(n3, '"'), { type: "invalid-retry", value: n3, line: r3 }));
|
|
34141
34460
|
break;
|
|
34142
34461
|
default:
|
|
34143
|
-
s2(new
|
|
34462
|
+
s2(new da('Unknown field "'.concat(e4.length > 20 ? "".concat(e4.slice(0, 20), "…") : e4, '"'), { type: "unknown-field", field: e4, value: n3, line: r3 }));
|
|
34144
34463
|
}
|
|
34145
34464
|
}
|
|
34146
34465
|
return { feed: function(e4) {
|
|
@@ -34172,11 +34491,11 @@ function da(e3) {
|
|
|
34172
34491
|
d2 && (arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}).consume && p2(d2), l2 = true, t2 = undefined, h2 = "", f2 = "", d2 = "";
|
|
34173
34492
|
} };
|
|
34174
34493
|
}
|
|
34175
|
-
var
|
|
34494
|
+
var fa = function(e3) {
|
|
34176
34495
|
function t2() {
|
|
34177
34496
|
var e4, n2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, r2 = n2.onError, a2 = n2.onRetry, i2 = n2.onComment;
|
|
34178
34497
|
return o(this, t2), n(this, t2, [{ start: function(t3) {
|
|
34179
|
-
e4 =
|
|
34498
|
+
e4 = ha({ onEvent: function(e5) {
|
|
34180
34499
|
t3.enqueue(e5);
|
|
34181
34500
|
}, onError: function(e5) {
|
|
34182
34501
|
r2 === "terminate" ? t3.error(e5) : typeof r2 == "function" && r2(e5);
|
|
@@ -34187,18 +34506,18 @@ var la = function(e3) {
|
|
|
34187
34506
|
}
|
|
34188
34507
|
return l(t2, e3), u(t2);
|
|
34189
34508
|
}(g(TransformStream));
|
|
34190
|
-
var
|
|
34191
|
-
var
|
|
34509
|
+
var pa = { initialReconnectionDelay: 1000, maxReconnectionDelay: 30000, reconnectionDelayGrowFactor: 1.5, maxRetries: 2 };
|
|
34510
|
+
var va = function(e3) {
|
|
34192
34511
|
function t2(e4, n2) {
|
|
34193
34512
|
var r2;
|
|
34194
34513
|
return o(this, t2), (r2 = n(this, t2, ["Streamable HTTP error: ".concat(n2)])).code = e4, r2;
|
|
34195
34514
|
}
|
|
34196
34515
|
return l(t2, e3), u(t2);
|
|
34197
34516
|
}(g(Error));
|
|
34198
|
-
var
|
|
34517
|
+
var ma = function() {
|
|
34199
34518
|
return u(function e(t3, n3) {
|
|
34200
34519
|
var r3;
|
|
34201
|
-
o(this, e), this._hasCompletedAuthFlow = false, this._url = t3, this._resourceMetadataUrl = undefined, this._requestInit = n3 == null ? undefined : n3.requestInit, this._authProvider = n3 == null ? undefined : n3.authProvider, this._fetch = n3 == null ? undefined : n3.fetch, this._sessionId = n3 == null ? undefined : n3.sessionId, this._reconnectionOptions = (r3 = n3 == null ? undefined : n3.reconnectionOptions) !== null && r3 !== undefined ? r3 :
|
|
34520
|
+
o(this, e), this._hasCompletedAuthFlow = false, this._url = t3, this._resourceMetadataUrl = undefined, this._requestInit = n3 == null ? undefined : n3.requestInit, this._authProvider = n3 == null ? undefined : n3.authProvider, this._fetch = n3 == null ? undefined : n3.fetch, this._sessionId = n3 == null ? undefined : n3.sessionId, this._reconnectionOptions = (r3 = n3 == null ? undefined : n3.reconnectionOptions) !== null && r3 !== undefined ? r3 : pa;
|
|
34202
34521
|
}, [{ key: "_authThenStart", value: (l2 = e(b().m(function e() {
|
|
34203
34522
|
var t3, n3, r3;
|
|
34204
34523
|
return b().w(function(e4) {
|
|
@@ -34211,7 +34530,7 @@ var pa = function() {
|
|
|
34211
34530
|
}
|
|
34212
34531
|
throw new Sr("No auth provider");
|
|
34213
34532
|
case 1:
|
|
34214
|
-
return e4.p = 1, e4.n = 2,
|
|
34533
|
+
return e4.p = 1, e4.n = 2, Ur(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
34215
34534
|
case 2:
|
|
34216
34535
|
n3 = e4.v, e4.n = 4;
|
|
34217
34536
|
break;
|
|
@@ -34278,7 +34597,7 @@ var pa = function() {
|
|
|
34278
34597
|
}
|
|
34279
34598
|
return e4.a(2);
|
|
34280
34599
|
case 6:
|
|
34281
|
-
throw new
|
|
34600
|
+
throw new va(o3.status, "Failed to open SSE stream: ".concat(o3.statusText));
|
|
34282
34601
|
case 7:
|
|
34283
34602
|
this._handleSseStream(o3.body, t3, true), e4.n = 9;
|
|
34284
34603
|
break;
|
|
@@ -34318,7 +34637,7 @@ var pa = function() {
|
|
|
34318
34637
|
for (;; )
|
|
34319
34638
|
switch (t5.p = t5.n) {
|
|
34320
34639
|
case 0:
|
|
34321
|
-
t5.p = 0, l3 = e4.pipeThrough(new TextDecoderStream).pipeThrough(new
|
|
34640
|
+
t5.p = 0, l3 = e4.pipeThrough(new TextDecoderStream).pipeThrough(new fa).getReader();
|
|
34322
34641
|
case 1:
|
|
34323
34642
|
return t5.n = 2, l3.read();
|
|
34324
34643
|
case 2:
|
|
@@ -34386,7 +34705,7 @@ var pa = function() {
|
|
|
34386
34705
|
}
|
|
34387
34706
|
throw new Sr("No auth provider");
|
|
34388
34707
|
case 1:
|
|
34389
|
-
return e4.n = 2,
|
|
34708
|
+
return e4.n = 2, Ur(this._authProvider, { serverUrl: this._url, authorizationCode: t3, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
34390
34709
|
case 2:
|
|
34391
34710
|
if (e4.v === "AUTHORIZED") {
|
|
34392
34711
|
e4.n = 3;
|
|
@@ -34443,9 +34762,9 @@ var pa = function() {
|
|
|
34443
34762
|
e4.n = 4;
|
|
34444
34763
|
break;
|
|
34445
34764
|
}
|
|
34446
|
-
throw new
|
|
34765
|
+
throw new va(401, "Server returned 401 after successful authentication");
|
|
34447
34766
|
case 4:
|
|
34448
|
-
return this._resourceMetadataUrl =
|
|
34767
|
+
return this._resourceMetadataUrl = Vr(v2), e4.n = 5, Ur(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
34449
34768
|
case 5:
|
|
34450
34769
|
if (e4.v === "AUTHORIZED") {
|
|
34451
34770
|
e4.n = 6;
|
|
@@ -34503,7 +34822,7 @@ var pa = function() {
|
|
|
34503
34822
|
e4.n = 14;
|
|
34504
34823
|
break;
|
|
34505
34824
|
case 13:
|
|
34506
|
-
throw new
|
|
34825
|
+
throw new va(-1, "Unexpected content type: ".concat(k2));
|
|
34507
34826
|
case 14:
|
|
34508
34827
|
e4.n = 16;
|
|
34509
34828
|
break;
|
|
@@ -34537,7 +34856,7 @@ var pa = function() {
|
|
|
34537
34856
|
e4.n = 4;
|
|
34538
34857
|
break;
|
|
34539
34858
|
}
|
|
34540
|
-
throw new
|
|
34859
|
+
throw new va(o3.status, "Failed to terminate session: ".concat(o3.statusText));
|
|
34541
34860
|
case 4:
|
|
34542
34861
|
this._sessionId = undefined, e4.n = 6;
|
|
34543
34862
|
break;
|
|
@@ -34556,36 +34875,36 @@ var pa = function() {
|
|
|
34556
34875
|
} }]);
|
|
34557
34876
|
var e3, t2, n2, r2, a2, o2, c2, l2;
|
|
34558
34877
|
}();
|
|
34559
|
-
var va;
|
|
34560
|
-
var ma;
|
|
34561
34878
|
var ya;
|
|
34562
|
-
|
|
34879
|
+
var _a18;
|
|
34880
|
+
var ga;
|
|
34881
|
+
async function ka(e3, a2, i2, s2, o2) {
|
|
34563
34882
|
try {
|
|
34564
|
-
if (!
|
|
34565
|
-
const n2 = new
|
|
34566
|
-
|
|
34883
|
+
if (!ya) {
|
|
34884
|
+
const n2 = new ma(new URL(e3 || "http://localhost:3000/mcp"));
|
|
34885
|
+
ya = await createMCPClient({ transport: n2 });
|
|
34567
34886
|
}
|
|
34568
|
-
if (!
|
|
34887
|
+
if (!_a18)
|
|
34569
34888
|
switch (a2) {
|
|
34570
34889
|
case "openai":
|
|
34571
34890
|
const e4 = createOpenAI({ apiKey: s2 });
|
|
34572
|
-
|
|
34891
|
+
_a18 = e4(i2);
|
|
34573
34892
|
break;
|
|
34574
34893
|
case "anthropic":
|
|
34575
34894
|
const t2 = createAnthropic({ apiKey: s2 });
|
|
34576
|
-
|
|
34895
|
+
_a18 = t2(i2);
|
|
34577
34896
|
break;
|
|
34578
34897
|
default:
|
|
34579
34898
|
throw new Error("Invalid AI provider");
|
|
34580
34899
|
}
|
|
34581
|
-
|
|
34582
|
-
return (await streamText({ model:
|
|
34900
|
+
ga || (ga = await ya.tools());
|
|
34901
|
+
return (await streamText({ model: _a18, tools: ga, stopWhen: stepCountIs(5), messages: [{ role: "user", content: [{ type: "text", text: o2 }] }] })).textStream;
|
|
34583
34902
|
} catch (e4) {
|
|
34584
34903
|
throw console.error(e4), e4;
|
|
34585
34904
|
}
|
|
34586
34905
|
}
|
|
34587
34906
|
|
|
34588
|
-
class
|
|
34907
|
+
class wa {
|
|
34589
34908
|
constructor(e3) {
|
|
34590
34909
|
this.config = e3, this.corsHeaders = e3.corsHeaders || { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Content-Type", "Access-Control-Allow-Methods": "POST, OPTIONS" };
|
|
34591
34910
|
}
|
|
@@ -34593,7 +34912,7 @@ class ga {
|
|
|
34593
34912
|
return { mcpUrl: e2.MCP_URL || "", aiProvider: e2.AI_PROVIDER || "", aiModel: e2.AI_MODEL || "", aiToken: e2.AI_TOKEN || "" };
|
|
34594
34913
|
}
|
|
34595
34914
|
static New(e3) {
|
|
34596
|
-
const t2 = new
|
|
34915
|
+
const t2 = new wa(e3);
|
|
34597
34916
|
return (e4) => t2.handle(e4);
|
|
34598
34917
|
}
|
|
34599
34918
|
async handle(t2) {
|
|
@@ -34605,16 +34924,16 @@ class ga {
|
|
|
34605
34924
|
const n2 = (await t2.json()).prompt;
|
|
34606
34925
|
if (!n2)
|
|
34607
34926
|
return this.error(400, "Missing prompt");
|
|
34608
|
-
const r2 =
|
|
34927
|
+
const r2 = [this.config.mcpUrl || e2.MCP_URL || "", this.config.aiProvider || e2.AI_PROVIDER || "", this.config.aiModel || e2.AI_MODEL || "", this.config.aiToken || e2.AI_TOKEN || "", n2], a2 = await ka(r2[0], r2[1], r2[2], r2[3], r2[4]), i2 = new TextEncoder, s2 = new ReadableStream({ async start(e3) {
|
|
34609
34928
|
try {
|
|
34610
|
-
for await (const t3 of
|
|
34611
|
-
e3.enqueue(
|
|
34929
|
+
for await (const t3 of a2)
|
|
34930
|
+
e3.enqueue(i2.encode(t3));
|
|
34612
34931
|
e3.close();
|
|
34613
34932
|
} catch (t3) {
|
|
34614
34933
|
e3.error(t3);
|
|
34615
34934
|
}
|
|
34616
34935
|
} });
|
|
34617
|
-
return new Response(
|
|
34936
|
+
return new Response(s2, { headers: { ...this.corsHeaders, "Content-Type": "text/plain; charset=utf-8", "Transfer-Encoding": "chunked" } });
|
|
34618
34937
|
} catch (e3) {
|
|
34619
34938
|
const t3 = e3;
|
|
34620
34939
|
return console.error("Catch error:", t3), this.error(500, t3.message);
|
|
@@ -34624,12 +34943,12 @@ class ga {
|
|
|
34624
34943
|
return console.error("Error:", { status: e3, message: t2 }), new Response(JSON.stringify({ error: t2 }), { status: e3, headers: { ...this.corsHeaders, "Content-Type": "application/json" } });
|
|
34625
34944
|
}
|
|
34626
34945
|
}
|
|
34627
|
-
async function
|
|
34946
|
+
async function ba(e3) {
|
|
34628
34947
|
if (e3 instanceof Request) {
|
|
34629
|
-
return (await
|
|
34948
|
+
return (await wa.New({ ...wa.defaultConfig() }))(e3);
|
|
34630
34949
|
}
|
|
34631
|
-
return
|
|
34950
|
+
return wa.New(e3);
|
|
34632
34951
|
}
|
|
34633
34952
|
export {
|
|
34634
|
-
|
|
34953
|
+
ba as handler
|
|
34635
34954
|
};
|