ai 5.0.61 → 5.0.63
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/CHANGELOG.md +18 -0
- package/dist/index.d.mts +116 -116
- package/dist/index.d.ts +116 -116
- package/dist/index.js +637 -568
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +390 -329
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +101 -91
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +9 -9
- package/dist/internal/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.d.mts +1 -1
- package/dist/mcp-stdio/index.d.ts +1 -1
- package/dist/mcp-stdio/index.js +81 -71
- package/dist/mcp-stdio/index.js.map +1 -1
- package/dist/mcp-stdio/index.mjs +2 -2
- package/dist/mcp-stdio/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
jsonSchema as jsonSchema2,
|
|
15
15
|
parseJsonEventStream as parseJsonEventStream3,
|
|
16
16
|
tool as tool2,
|
|
17
|
-
zodSchema
|
|
17
|
+
zodSchema as zodSchema3
|
|
18
18
|
} from "@ai-sdk/provider-utils";
|
|
19
19
|
|
|
20
20
|
// src/generate-text/generate-text.ts
|
|
@@ -691,7 +691,7 @@ import {
|
|
|
691
691
|
} from "@ai-sdk/provider-utils";
|
|
692
692
|
|
|
693
693
|
// src/version.ts
|
|
694
|
-
var VERSION = true ? "5.0.
|
|
694
|
+
var VERSION = true ? "5.0.63" : "0.0.0-test";
|
|
695
695
|
|
|
696
696
|
// src/util/download/download.ts
|
|
697
697
|
var download = async ({ url }) => {
|
|
@@ -737,7 +737,7 @@ import {
|
|
|
737
737
|
convertBase64ToUint8Array as convertBase64ToUint8Array2,
|
|
738
738
|
convertUint8ArrayToBase64
|
|
739
739
|
} from "@ai-sdk/provider-utils";
|
|
740
|
-
import
|
|
740
|
+
import * as z from "zod/v4";
|
|
741
741
|
|
|
742
742
|
// src/prompt/split-data-url.ts
|
|
743
743
|
function splitDataUrl(dataUrl) {
|
|
@@ -1149,8 +1149,8 @@ function prepareCallSettings({
|
|
|
1149
1149
|
import { asSchema } from "@ai-sdk/provider-utils";
|
|
1150
1150
|
|
|
1151
1151
|
// src/util/is-non-empty-object.ts
|
|
1152
|
-
function isNonEmptyObject(
|
|
1153
|
-
return
|
|
1152
|
+
function isNonEmptyObject(object7) {
|
|
1153
|
+
return object7 != null && Object.keys(object7).length > 0;
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
1156
|
// src/prompt/prepare-tools-and-tool-choice.ts
|
|
@@ -1202,16 +1202,16 @@ function prepareToolsAndToolChoice({
|
|
|
1202
1202
|
// src/prompt/standardize-prompt.ts
|
|
1203
1203
|
import { InvalidPromptError as InvalidPromptError2 } from "@ai-sdk/provider";
|
|
1204
1204
|
import { safeValidateTypes } from "@ai-sdk/provider-utils";
|
|
1205
|
-
import
|
|
1205
|
+
import * as z6 from "zod/v4";
|
|
1206
1206
|
|
|
1207
1207
|
// src/prompt/message.ts
|
|
1208
|
-
import
|
|
1208
|
+
import * as z5 from "zod/v4";
|
|
1209
1209
|
|
|
1210
1210
|
// src/types/provider-metadata.ts
|
|
1211
|
-
import
|
|
1211
|
+
import * as z3 from "zod/v4";
|
|
1212
1212
|
|
|
1213
1213
|
// src/types/json-value.ts
|
|
1214
|
-
import
|
|
1214
|
+
import * as z2 from "zod/v4";
|
|
1215
1215
|
var jsonValueSchema = z2.lazy(
|
|
1216
1216
|
() => z2.union([
|
|
1217
1217
|
z2.null(),
|
|
@@ -1230,7 +1230,7 @@ var providerMetadataSchema = z3.record(
|
|
|
1230
1230
|
);
|
|
1231
1231
|
|
|
1232
1232
|
// src/prompt/content-part.ts
|
|
1233
|
-
import
|
|
1233
|
+
import * as z4 from "zod/v4";
|
|
1234
1234
|
var textPartSchema = z4.object({
|
|
1235
1235
|
type: z4.literal("text"),
|
|
1236
1236
|
text: z4.string(),
|
|
@@ -2229,17 +2229,17 @@ async function generateText({
|
|
|
2229
2229
|
stepNumber: steps.length,
|
|
2230
2230
|
messages: stepInputMessages
|
|
2231
2231
|
}));
|
|
2232
|
+
const stepModel = resolveLanguageModel(
|
|
2233
|
+
(_a17 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a17 : model
|
|
2234
|
+
);
|
|
2232
2235
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
2233
2236
|
prompt: {
|
|
2234
|
-
system: (
|
|
2235
|
-
messages: (
|
|
2237
|
+
system: (_b = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b : initialPrompt.system,
|
|
2238
|
+
messages: (_c = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c : stepInputMessages
|
|
2236
2239
|
},
|
|
2237
|
-
supportedUrls: await
|
|
2240
|
+
supportedUrls: await stepModel.supportedUrls,
|
|
2238
2241
|
download: download2
|
|
2239
2242
|
});
|
|
2240
|
-
const stepModel = resolveLanguageModel(
|
|
2241
|
-
(_c = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _c : model
|
|
2242
|
-
);
|
|
2243
2243
|
const { toolChoice: stepToolChoice, tools: stepTools } = prepareToolsAndToolChoice({
|
|
2244
2244
|
tools,
|
|
2245
2245
|
toolChoice: (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _d : toolChoice,
|
|
@@ -2458,16 +2458,20 @@ async function generateText({
|
|
|
2458
2458
|
})
|
|
2459
2459
|
);
|
|
2460
2460
|
const lastStep = steps[steps.length - 1];
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
resolvedOutput
|
|
2461
|
+
let resolvedOutput;
|
|
2462
|
+
if (lastStep.finishReason === "stop") {
|
|
2463
|
+
resolvedOutput = await (output == null ? void 0 : output.parseOutput(
|
|
2464
2464
|
{ text: lastStep.text },
|
|
2465
2465
|
{
|
|
2466
2466
|
response: lastStep.response,
|
|
2467
2467
|
usage: lastStep.usage,
|
|
2468
2468
|
finishReason: lastStep.finishReason
|
|
2469
2469
|
}
|
|
2470
|
-
))
|
|
2470
|
+
));
|
|
2471
|
+
}
|
|
2472
|
+
return new DefaultGenerateTextResult({
|
|
2473
|
+
steps,
|
|
2474
|
+
resolvedOutput
|
|
2471
2475
|
});
|
|
2472
2476
|
}
|
|
2473
2477
|
});
|
|
@@ -2867,143 +2871,148 @@ import {
|
|
|
2867
2871
|
} from "@ai-sdk/provider-utils";
|
|
2868
2872
|
|
|
2869
2873
|
// src/ui-message-stream/ui-message-chunks.ts
|
|
2870
|
-
import
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
{
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
2874
|
+
import * as z7 from "zod/v4";
|
|
2875
|
+
import { lazyValidator, zodSchema } from "@ai-sdk/provider-utils";
|
|
2876
|
+
var uiMessageChunkSchema = lazyValidator(
|
|
2877
|
+
() => zodSchema(
|
|
2878
|
+
z7.union([
|
|
2879
|
+
z7.strictObject({
|
|
2880
|
+
type: z7.literal("text-start"),
|
|
2881
|
+
id: z7.string(),
|
|
2882
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2883
|
+
}),
|
|
2884
|
+
z7.strictObject({
|
|
2885
|
+
type: z7.literal("text-delta"),
|
|
2886
|
+
id: z7.string(),
|
|
2887
|
+
delta: z7.string(),
|
|
2888
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2889
|
+
}),
|
|
2890
|
+
z7.strictObject({
|
|
2891
|
+
type: z7.literal("text-end"),
|
|
2892
|
+
id: z7.string(),
|
|
2893
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2894
|
+
}),
|
|
2895
|
+
z7.strictObject({
|
|
2896
|
+
type: z7.literal("error"),
|
|
2897
|
+
errorText: z7.string()
|
|
2898
|
+
}),
|
|
2899
|
+
z7.strictObject({
|
|
2900
|
+
type: z7.literal("tool-input-start"),
|
|
2901
|
+
toolCallId: z7.string(),
|
|
2902
|
+
toolName: z7.string(),
|
|
2903
|
+
providerExecuted: z7.boolean().optional(),
|
|
2904
|
+
dynamic: z7.boolean().optional()
|
|
2905
|
+
}),
|
|
2906
|
+
z7.strictObject({
|
|
2907
|
+
type: z7.literal("tool-input-delta"),
|
|
2908
|
+
toolCallId: z7.string(),
|
|
2909
|
+
inputTextDelta: z7.string()
|
|
2910
|
+
}),
|
|
2911
|
+
z7.strictObject({
|
|
2912
|
+
type: z7.literal("tool-input-available"),
|
|
2913
|
+
toolCallId: z7.string(),
|
|
2914
|
+
toolName: z7.string(),
|
|
2915
|
+
input: z7.unknown(),
|
|
2916
|
+
providerExecuted: z7.boolean().optional(),
|
|
2917
|
+
providerMetadata: providerMetadataSchema.optional(),
|
|
2918
|
+
dynamic: z7.boolean().optional()
|
|
2919
|
+
}),
|
|
2920
|
+
z7.strictObject({
|
|
2921
|
+
type: z7.literal("tool-input-error"),
|
|
2922
|
+
toolCallId: z7.string(),
|
|
2923
|
+
toolName: z7.string(),
|
|
2924
|
+
input: z7.unknown(),
|
|
2925
|
+
providerExecuted: z7.boolean().optional(),
|
|
2926
|
+
providerMetadata: providerMetadataSchema.optional(),
|
|
2927
|
+
dynamic: z7.boolean().optional(),
|
|
2928
|
+
errorText: z7.string()
|
|
2929
|
+
}),
|
|
2930
|
+
z7.strictObject({
|
|
2931
|
+
type: z7.literal("tool-output-available"),
|
|
2932
|
+
toolCallId: z7.string(),
|
|
2933
|
+
output: z7.unknown(),
|
|
2934
|
+
providerExecuted: z7.boolean().optional(),
|
|
2935
|
+
dynamic: z7.boolean().optional(),
|
|
2936
|
+
preliminary: z7.boolean().optional()
|
|
2937
|
+
}),
|
|
2938
|
+
z7.strictObject({
|
|
2939
|
+
type: z7.literal("tool-output-error"),
|
|
2940
|
+
toolCallId: z7.string(),
|
|
2941
|
+
errorText: z7.string(),
|
|
2942
|
+
providerExecuted: z7.boolean().optional(),
|
|
2943
|
+
dynamic: z7.boolean().optional()
|
|
2944
|
+
}),
|
|
2945
|
+
z7.strictObject({
|
|
2946
|
+
type: z7.literal("reasoning-start"),
|
|
2947
|
+
id: z7.string(),
|
|
2948
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2949
|
+
}),
|
|
2950
|
+
z7.strictObject({
|
|
2951
|
+
type: z7.literal("reasoning-delta"),
|
|
2952
|
+
id: z7.string(),
|
|
2953
|
+
delta: z7.string(),
|
|
2954
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2955
|
+
}),
|
|
2956
|
+
z7.strictObject({
|
|
2957
|
+
type: z7.literal("reasoning-end"),
|
|
2958
|
+
id: z7.string(),
|
|
2959
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2960
|
+
}),
|
|
2961
|
+
z7.strictObject({
|
|
2962
|
+
type: z7.literal("source-url"),
|
|
2963
|
+
sourceId: z7.string(),
|
|
2964
|
+
url: z7.string(),
|
|
2965
|
+
title: z7.string().optional(),
|
|
2966
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2967
|
+
}),
|
|
2968
|
+
z7.strictObject({
|
|
2969
|
+
type: z7.literal("source-document"),
|
|
2970
|
+
sourceId: z7.string(),
|
|
2971
|
+
mediaType: z7.string(),
|
|
2972
|
+
title: z7.string(),
|
|
2973
|
+
filename: z7.string().optional(),
|
|
2974
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2975
|
+
}),
|
|
2976
|
+
z7.strictObject({
|
|
2977
|
+
type: z7.literal("file"),
|
|
2978
|
+
url: z7.string(),
|
|
2979
|
+
mediaType: z7.string(),
|
|
2980
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2981
|
+
}),
|
|
2982
|
+
z7.strictObject({
|
|
2983
|
+
type: z7.custom(
|
|
2984
|
+
(value) => typeof value === "string" && value.startsWith("data-"),
|
|
2985
|
+
{ message: 'Type must start with "data-"' }
|
|
2986
|
+
),
|
|
2987
|
+
id: z7.string().optional(),
|
|
2988
|
+
data: z7.unknown(),
|
|
2989
|
+
transient: z7.boolean().optional()
|
|
2990
|
+
}),
|
|
2991
|
+
z7.strictObject({
|
|
2992
|
+
type: z7.literal("start-step")
|
|
2993
|
+
}),
|
|
2994
|
+
z7.strictObject({
|
|
2995
|
+
type: z7.literal("finish-step")
|
|
2996
|
+
}),
|
|
2997
|
+
z7.strictObject({
|
|
2998
|
+
type: z7.literal("start"),
|
|
2999
|
+
messageId: z7.string().optional(),
|
|
3000
|
+
messageMetadata: z7.unknown().optional()
|
|
3001
|
+
}),
|
|
3002
|
+
z7.strictObject({
|
|
3003
|
+
type: z7.literal("finish"),
|
|
3004
|
+
messageMetadata: z7.unknown().optional()
|
|
3005
|
+
}),
|
|
3006
|
+
z7.strictObject({
|
|
3007
|
+
type: z7.literal("abort")
|
|
3008
|
+
}),
|
|
3009
|
+
z7.strictObject({
|
|
3010
|
+
type: z7.literal("message-metadata"),
|
|
3011
|
+
messageMetadata: z7.unknown()
|
|
3012
|
+
})
|
|
3013
|
+
])
|
|
3014
|
+
)
|
|
3015
|
+
);
|
|
3007
3016
|
function isDataUIMessageChunk(chunk) {
|
|
3008
3017
|
return chunk.type.startsWith("data-");
|
|
3009
3018
|
}
|
|
@@ -4914,17 +4923,17 @@ var DefaultStreamTextResult = class {
|
|
|
4914
4923
|
stepNumber: recordedSteps.length,
|
|
4915
4924
|
messages: stepInputMessages
|
|
4916
4925
|
}));
|
|
4926
|
+
const stepModel = resolveLanguageModel(
|
|
4927
|
+
(_a17 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a17 : model
|
|
4928
|
+
);
|
|
4917
4929
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
4918
4930
|
prompt: {
|
|
4919
|
-
system: (
|
|
4920
|
-
messages: (
|
|
4931
|
+
system: (_b = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b : initialPrompt.system,
|
|
4932
|
+
messages: (_c = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _c : stepInputMessages
|
|
4921
4933
|
},
|
|
4922
|
-
supportedUrls: await
|
|
4934
|
+
supportedUrls: await stepModel.supportedUrls,
|
|
4923
4935
|
download: download2
|
|
4924
4936
|
});
|
|
4925
|
-
const stepModel = resolveLanguageModel(
|
|
4926
|
-
(_c = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _c : model
|
|
4927
|
-
);
|
|
4928
4937
|
const { toolChoice: stepToolChoice, tools: stepTools } = prepareToolsAndToolChoice({
|
|
4929
4938
|
tools,
|
|
4930
4939
|
toolChoice: (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _d : toolChoice,
|
|
@@ -6081,13 +6090,13 @@ var DefaultEmbedResult = class {
|
|
|
6081
6090
|
import { withUserAgentSuffix as withUserAgentSuffix4 } from "@ai-sdk/provider-utils";
|
|
6082
6091
|
|
|
6083
6092
|
// src/util/split-array.ts
|
|
6084
|
-
function splitArray(
|
|
6093
|
+
function splitArray(array7, chunkSize) {
|
|
6085
6094
|
if (chunkSize <= 0) {
|
|
6086
6095
|
throw new Error("chunkSize must be greater than 0");
|
|
6087
6096
|
}
|
|
6088
6097
|
const result = [];
|
|
6089
|
-
for (let i = 0; i <
|
|
6090
|
-
result.push(
|
|
6098
|
+
for (let i = 0; i < array7.length; i += chunkSize) {
|
|
6099
|
+
result.push(array7.slice(i, i + chunkSize));
|
|
6091
6100
|
}
|
|
6092
6101
|
return result;
|
|
6093
6102
|
}
|
|
@@ -6607,9 +6616,9 @@ var arrayOutputStrategy = (schema) => {
|
|
|
6607
6616
|
transform(chunk, controller) {
|
|
6608
6617
|
switch (chunk.type) {
|
|
6609
6618
|
case "object": {
|
|
6610
|
-
const
|
|
6611
|
-
for (; publishedElements <
|
|
6612
|
-
controller.enqueue(
|
|
6619
|
+
const array7 = chunk.object;
|
|
6620
|
+
for (; publishedElements < array7.length; publishedElements++) {
|
|
6621
|
+
controller.enqueue(array7[publishedElements]);
|
|
6613
6622
|
}
|
|
6614
6623
|
break;
|
|
6615
6624
|
}
|
|
@@ -7098,7 +7107,7 @@ async function generateObject(options) {
|
|
|
7098
7107
|
response = generateResult.responseData;
|
|
7099
7108
|
reasoning = generateResult.reasoning;
|
|
7100
7109
|
logWarnings(warnings);
|
|
7101
|
-
const
|
|
7110
|
+
const object7 = await parseAndValidateObjectResultWithRepair(
|
|
7102
7111
|
result,
|
|
7103
7112
|
outputStrategy,
|
|
7104
7113
|
repairText,
|
|
@@ -7114,7 +7123,7 @@ async function generateObject(options) {
|
|
|
7114
7123
|
attributes: {
|
|
7115
7124
|
"ai.response.finishReason": finishReason,
|
|
7116
7125
|
"ai.response.object": {
|
|
7117
|
-
output: () => JSON.stringify(
|
|
7126
|
+
output: () => JSON.stringify(object7)
|
|
7118
7127
|
},
|
|
7119
7128
|
"ai.response.providerMetadata": JSON.stringify(
|
|
7120
7129
|
resultProviderMetadata
|
|
@@ -7126,7 +7135,7 @@ async function generateObject(options) {
|
|
|
7126
7135
|
})
|
|
7127
7136
|
);
|
|
7128
7137
|
return new DefaultGenerateObjectResult({
|
|
7129
|
-
object:
|
|
7138
|
+
object: object7,
|
|
7130
7139
|
reasoning,
|
|
7131
7140
|
finishReason,
|
|
7132
7141
|
usage,
|
|
@@ -7528,7 +7537,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7528
7537
|
};
|
|
7529
7538
|
let finishReason;
|
|
7530
7539
|
let providerMetadata;
|
|
7531
|
-
let
|
|
7540
|
+
let object7;
|
|
7532
7541
|
let error;
|
|
7533
7542
|
let accumulatedText = "";
|
|
7534
7543
|
let textDelta = "";
|
|
@@ -7622,7 +7631,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7622
7631
|
});
|
|
7623
7632
|
self._finishReason.resolve(finishReason != null ? finishReason : "unknown");
|
|
7624
7633
|
try {
|
|
7625
|
-
|
|
7634
|
+
object7 = await parseAndValidateObjectResultWithRepair(
|
|
7626
7635
|
accumulatedText,
|
|
7627
7636
|
outputStrategy,
|
|
7628
7637
|
repairText,
|
|
@@ -7632,7 +7641,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7632
7641
|
finishReason
|
|
7633
7642
|
}
|
|
7634
7643
|
);
|
|
7635
|
-
self._object.resolve(
|
|
7644
|
+
self._object.resolve(object7);
|
|
7636
7645
|
} catch (e) {
|
|
7637
7646
|
error = e;
|
|
7638
7647
|
self._object.reject(e);
|
|
@@ -7659,7 +7668,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7659
7668
|
attributes: {
|
|
7660
7669
|
"ai.response.finishReason": finishReason,
|
|
7661
7670
|
"ai.response.object": {
|
|
7662
|
-
output: () => JSON.stringify(
|
|
7671
|
+
output: () => JSON.stringify(object7)
|
|
7663
7672
|
},
|
|
7664
7673
|
"ai.response.id": fullResponse.id,
|
|
7665
7674
|
"ai.response.model": fullResponse.modelId,
|
|
@@ -7690,7 +7699,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7690
7699
|
"ai.usage.reasoningTokens": finalUsage.reasoningTokens,
|
|
7691
7700
|
"ai.usage.cachedInputTokens": finalUsage.cachedInputTokens,
|
|
7692
7701
|
"ai.response.object": {
|
|
7693
|
-
output: () => JSON.stringify(
|
|
7702
|
+
output: () => JSON.stringify(object7)
|
|
7694
7703
|
},
|
|
7695
7704
|
"ai.response.providerMetadata": JSON.stringify(providerMetadata)
|
|
7696
7705
|
}
|
|
@@ -7698,7 +7707,7 @@ var DefaultStreamObjectResult = class {
|
|
|
7698
7707
|
);
|
|
7699
7708
|
await (onFinish == null ? void 0 : onFinish({
|
|
7700
7709
|
usage: finalUsage,
|
|
7701
|
-
object:
|
|
7710
|
+
object: object7,
|
|
7702
7711
|
error,
|
|
7703
7712
|
response: {
|
|
7704
7713
|
...fullResponse,
|
|
@@ -7920,7 +7929,7 @@ var DefaultSpeechResult = class {
|
|
|
7920
7929
|
// src/generate-text/output.ts
|
|
7921
7930
|
var output_exports = {};
|
|
7922
7931
|
__export(output_exports, {
|
|
7923
|
-
object: () =>
|
|
7932
|
+
object: () => object3,
|
|
7924
7933
|
text: () => text
|
|
7925
7934
|
});
|
|
7926
7935
|
import {
|
|
@@ -7938,7 +7947,7 @@ var text = () => ({
|
|
|
7938
7947
|
return text2;
|
|
7939
7948
|
}
|
|
7940
7949
|
});
|
|
7941
|
-
var
|
|
7950
|
+
var object3 = ({
|
|
7942
7951
|
schema: inputSchema
|
|
7943
7952
|
}) => {
|
|
7944
7953
|
const schema = asSchema4(inputSchema);
|
|
@@ -8624,10 +8633,10 @@ import {
|
|
|
8624
8633
|
} from "@ai-sdk/provider-utils";
|
|
8625
8634
|
|
|
8626
8635
|
// src/tool/mcp/json-rpc-message.ts
|
|
8627
|
-
import
|
|
8636
|
+
import * as z9 from "zod/v4";
|
|
8628
8637
|
|
|
8629
8638
|
// src/tool/mcp/types.ts
|
|
8630
|
-
import
|
|
8639
|
+
import * as z8 from "zod/v4";
|
|
8631
8640
|
var LATEST_PROTOCOL_VERSION = "2025-06-18";
|
|
8632
8641
|
var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
8633
8642
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -9982,153 +9991,205 @@ var TextStreamChatTransport = class extends HttpChatTransport {
|
|
|
9982
9991
|
// src/ui/validate-ui-messages.ts
|
|
9983
9992
|
import { TypeValidationError as TypeValidationError4 } from "@ai-sdk/provider";
|
|
9984
9993
|
import {
|
|
9985
|
-
|
|
9994
|
+
lazyValidator as lazyValidator2,
|
|
9995
|
+
validateTypes as validateTypes2,
|
|
9996
|
+
zodSchema as zodSchema2
|
|
9986
9997
|
} from "@ai-sdk/provider-utils";
|
|
9987
|
-
import
|
|
9988
|
-
var
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
9998
|
+
import * as z10 from "zod/v4";
|
|
9999
|
+
var uiMessagesSchema = lazyValidator2(
|
|
10000
|
+
() => zodSchema2(
|
|
10001
|
+
z10.array(
|
|
10002
|
+
z10.object({
|
|
10003
|
+
id: z10.string(),
|
|
10004
|
+
role: z10.enum(["system", "user", "assistant"]),
|
|
10005
|
+
metadata: z10.unknown().optional(),
|
|
10006
|
+
parts: z10.array(
|
|
10007
|
+
z10.union([
|
|
10008
|
+
z10.object({
|
|
10009
|
+
type: z10.literal("text"),
|
|
10010
|
+
text: z10.string(),
|
|
10011
|
+
state: z10.enum(["streaming", "done"]).optional(),
|
|
10012
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
10013
|
+
}),
|
|
10014
|
+
z10.object({
|
|
10015
|
+
type: z10.literal("reasoning"),
|
|
10016
|
+
text: z10.string(),
|
|
10017
|
+
state: z10.enum(["streaming", "done"]).optional(),
|
|
10018
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
10019
|
+
}),
|
|
10020
|
+
z10.object({
|
|
10021
|
+
type: z10.literal("source-url"),
|
|
10022
|
+
sourceId: z10.string(),
|
|
10023
|
+
url: z10.string(),
|
|
10024
|
+
title: z10.string().optional(),
|
|
10025
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
10026
|
+
}),
|
|
10027
|
+
z10.object({
|
|
10028
|
+
type: z10.literal("source-document"),
|
|
10029
|
+
sourceId: z10.string(),
|
|
10030
|
+
mediaType: z10.string(),
|
|
10031
|
+
title: z10.string(),
|
|
10032
|
+
filename: z10.string().optional(),
|
|
10033
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
10034
|
+
}),
|
|
10035
|
+
z10.object({
|
|
10036
|
+
type: z10.literal("file"),
|
|
10037
|
+
mediaType: z10.string(),
|
|
10038
|
+
filename: z10.string().optional(),
|
|
10039
|
+
url: z10.string(),
|
|
10040
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
10041
|
+
}),
|
|
10042
|
+
z10.object({
|
|
10043
|
+
type: z10.literal("step-start")
|
|
10044
|
+
}),
|
|
10045
|
+
z10.object({
|
|
10046
|
+
type: z10.string().startsWith("data-"),
|
|
10047
|
+
id: z10.string().optional(),
|
|
10048
|
+
data: z10.unknown()
|
|
10049
|
+
}),
|
|
10050
|
+
z10.object({
|
|
10051
|
+
type: z10.literal("dynamic-tool"),
|
|
10052
|
+
toolName: z10.string(),
|
|
10053
|
+
toolCallId: z10.string(),
|
|
10054
|
+
state: z10.literal("input-streaming"),
|
|
10055
|
+
input: z10.unknown().optional(),
|
|
10056
|
+
output: z10.never().optional(),
|
|
10057
|
+
errorText: z10.never().optional()
|
|
10058
|
+
}),
|
|
10059
|
+
z10.object({
|
|
10060
|
+
type: z10.literal("dynamic-tool"),
|
|
10061
|
+
toolName: z10.string(),
|
|
10062
|
+
toolCallId: z10.string(),
|
|
10063
|
+
state: z10.literal("input-available"),
|
|
10064
|
+
input: z10.unknown(),
|
|
10065
|
+
output: z10.never().optional(),
|
|
10066
|
+
errorText: z10.never().optional(),
|
|
10067
|
+
callProviderMetadata: providerMetadataSchema.optional()
|
|
10068
|
+
}),
|
|
10069
|
+
z10.object({
|
|
10070
|
+
type: z10.literal("dynamic-tool"),
|
|
10071
|
+
toolName: z10.string(),
|
|
10072
|
+
toolCallId: z10.string(),
|
|
10073
|
+
state: z10.literal("output-available"),
|
|
10074
|
+
input: z10.unknown(),
|
|
10075
|
+
output: z10.unknown(),
|
|
10076
|
+
errorText: z10.never().optional(),
|
|
10077
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10078
|
+
preliminary: z10.boolean().optional()
|
|
10079
|
+
}),
|
|
10080
|
+
z10.object({
|
|
10081
|
+
type: z10.literal("dynamic-tool"),
|
|
10082
|
+
toolName: z10.string(),
|
|
10083
|
+
toolCallId: z10.string(),
|
|
10084
|
+
state: z10.literal("output-error"),
|
|
10085
|
+
input: z10.unknown(),
|
|
10086
|
+
output: z10.never().optional(),
|
|
10087
|
+
errorText: z10.string(),
|
|
10088
|
+
callProviderMetadata: providerMetadataSchema.optional()
|
|
10089
|
+
}),
|
|
10090
|
+
z10.object({
|
|
10091
|
+
type: z10.string().startsWith("tool-"),
|
|
10092
|
+
toolCallId: z10.string(),
|
|
10093
|
+
state: z10.literal("input-streaming"),
|
|
10094
|
+
providerExecuted: z10.boolean().optional(),
|
|
10095
|
+
input: z10.unknown().optional(),
|
|
10096
|
+
output: z10.never().optional(),
|
|
10097
|
+
errorText: z10.never().optional(),
|
|
10098
|
+
approval: z10.never().optional()
|
|
10099
|
+
}),
|
|
10100
|
+
z10.object({
|
|
10101
|
+
type: z10.string().startsWith("tool-"),
|
|
10102
|
+
toolCallId: z10.string(),
|
|
10103
|
+
state: z10.literal("input-available"),
|
|
10104
|
+
providerExecuted: z10.boolean().optional(),
|
|
10105
|
+
input: z10.unknown(),
|
|
10106
|
+
output: z10.never().optional(),
|
|
10107
|
+
errorText: z10.never().optional(),
|
|
10108
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10109
|
+
approval: z10.never().optional()
|
|
10110
|
+
}),
|
|
10111
|
+
z10.object({
|
|
10112
|
+
type: z10.string().startsWith("tool-"),
|
|
10113
|
+
toolCallId: z10.string(),
|
|
10114
|
+
state: z10.literal("approval-requested"),
|
|
10115
|
+
input: z10.unknown(),
|
|
10116
|
+
providerExecuted: z10.boolean().optional(),
|
|
10117
|
+
output: z10.never().optional(),
|
|
10118
|
+
errorText: z10.never().optional(),
|
|
10119
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10120
|
+
approval: z10.object({
|
|
10121
|
+
id: z10.string(),
|
|
10122
|
+
approved: z10.never().optional(),
|
|
10123
|
+
reason: z10.never().optional()
|
|
10124
|
+
})
|
|
10125
|
+
}),
|
|
10126
|
+
z10.object({
|
|
10127
|
+
type: z10.string().startsWith("tool-"),
|
|
10128
|
+
toolCallId: z10.string(),
|
|
10129
|
+
state: z10.literal("approval-responded"),
|
|
10130
|
+
input: z10.unknown(),
|
|
10131
|
+
providerExecuted: z10.boolean().optional(),
|
|
10132
|
+
output: z10.never().optional(),
|
|
10133
|
+
errorText: z10.never().optional(),
|
|
10134
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10135
|
+
approval: z10.object({
|
|
10136
|
+
id: z10.string(),
|
|
10137
|
+
approved: z10.boolean(),
|
|
10138
|
+
reason: z10.string().optional()
|
|
10139
|
+
})
|
|
10140
|
+
}),
|
|
10141
|
+
z10.object({
|
|
10142
|
+
type: z10.string().startsWith("tool-"),
|
|
10143
|
+
toolCallId: z10.string(),
|
|
10144
|
+
state: z10.literal("output-available"),
|
|
10145
|
+
providerExecuted: z10.boolean().optional(),
|
|
10146
|
+
input: z10.unknown(),
|
|
10147
|
+
output: z10.unknown(),
|
|
10148
|
+
errorText: z10.never().optional(),
|
|
10149
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10150
|
+
preliminary: z10.boolean().optional(),
|
|
10151
|
+
approval: z10.object({
|
|
10152
|
+
id: z10.string(),
|
|
10153
|
+
approved: z10.literal(true),
|
|
10154
|
+
reason: z10.string().optional()
|
|
10155
|
+
}).optional()
|
|
10156
|
+
}),
|
|
10157
|
+
z10.object({
|
|
10158
|
+
type: z10.string().startsWith("tool-"),
|
|
10159
|
+
toolCallId: z10.string(),
|
|
10160
|
+
state: z10.literal("output-error"),
|
|
10161
|
+
providerExecuted: z10.boolean().optional(),
|
|
10162
|
+
input: z10.unknown(),
|
|
10163
|
+
output: z10.never().optional(),
|
|
10164
|
+
errorText: z10.string(),
|
|
10165
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10166
|
+
approval: z10.object({
|
|
10167
|
+
id: z10.string(),
|
|
10168
|
+
approved: z10.literal(true),
|
|
10169
|
+
reason: z10.string().optional()
|
|
10170
|
+
}).optional()
|
|
10171
|
+
}),
|
|
10172
|
+
z10.object({
|
|
10173
|
+
type: z10.string().startsWith("tool-"),
|
|
10174
|
+
toolCallId: z10.string(),
|
|
10175
|
+
state: z10.literal("output-denied"),
|
|
10176
|
+
providerExecuted: z10.boolean().optional(),
|
|
10177
|
+
input: z10.unknown(),
|
|
10178
|
+
output: z10.never().optional(),
|
|
10179
|
+
errorText: z10.never().optional(),
|
|
10180
|
+
callProviderMetadata: providerMetadataSchema.optional(),
|
|
10181
|
+
approval: z10.object({
|
|
10182
|
+
id: z10.string(),
|
|
10183
|
+
approved: z10.literal(false),
|
|
10184
|
+
reason: z10.string().optional()
|
|
10185
|
+
})
|
|
10186
|
+
})
|
|
10187
|
+
])
|
|
10188
|
+
)
|
|
10189
|
+
})
|
|
10190
|
+
)
|
|
10130
10191
|
)
|
|
10131
|
-
|
|
10192
|
+
);
|
|
10132
10193
|
async function safeValidateUIMessages({
|
|
10133
10194
|
messages,
|
|
10134
10195
|
metadataSchema,
|
|
@@ -10148,7 +10209,7 @@ async function safeValidateUIMessages({
|
|
|
10148
10209
|
}
|
|
10149
10210
|
const validatedMessages = await validateTypes2({
|
|
10150
10211
|
value: messages,
|
|
10151
|
-
schema:
|
|
10212
|
+
schema: uiMessagesSchema
|
|
10152
10213
|
});
|
|
10153
10214
|
if (metadataSchema) {
|
|
10154
10215
|
for (const message of validatedMessages) {
|
|
@@ -10484,6 +10545,6 @@ export {
|
|
|
10484
10545
|
validateUIMessages,
|
|
10485
10546
|
wrapLanguageModel,
|
|
10486
10547
|
wrapProvider,
|
|
10487
|
-
zodSchema
|
|
10548
|
+
zodSchema3 as zodSchema
|
|
10488
10549
|
};
|
|
10489
10550
|
//# sourceMappingURL=index.mjs.map
|