ai 6.0.0-beta.48 → 6.0.0-beta.50

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 CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  JSONParseError: () => import_provider18.JSONParseError,
40
40
  JsonToSseTransformStream: () => JsonToSseTransformStream,
41
41
  LoadAPIKeyError: () => import_provider18.LoadAPIKeyError,
42
+ LoadSettingError: () => import_provider18.LoadSettingError,
42
43
  MCPClientError: () => MCPClientError,
43
44
  MessageConversionError: () => MessageConversionError,
44
45
  NoContentGeneratedError: () => import_provider18.NoContentGeneratedError,
@@ -868,7 +869,7 @@ function detectMediaType({
868
869
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
869
870
 
870
871
  // src/version.ts
871
- var VERSION = true ? "6.0.0-beta.48" : "0.0.0-test";
872
+ var VERSION = true ? "6.0.0-beta.50" : "0.0.0-test";
872
873
 
873
874
  // src/util/download/download.ts
874
875
  var download = async ({ url }) => {
@@ -1486,6 +1487,10 @@ var outputSchema = import_v44.z.discriminatedUnion("type", [
1486
1487
  type: import_v44.z.literal("json"),
1487
1488
  value: jsonValueSchema
1488
1489
  }),
1490
+ import_v44.z.object({
1491
+ type: import_v44.z.literal("execution-denied"),
1492
+ reason: import_v44.z.string().optional()
1493
+ }),
1489
1494
  import_v44.z.object({
1490
1495
  type: import_v44.z.literal("error-text"),
1491
1496
  value: import_v44.z.string()
@@ -2261,6 +2266,9 @@ async function parseToolCall({
2261
2266
  }) {
2262
2267
  try {
2263
2268
  if (tools == null) {
2269
+ if (toolCall.providerExecuted && toolCall.dynamic) {
2270
+ return await parseProviderExecutedDynamicToolCall(toolCall);
2271
+ }
2264
2272
  throw new NoSuchToolError({ toolName: toolCall.toolName });
2265
2273
  }
2266
2274
  try {
@@ -2307,6 +2315,25 @@ async function parseToolCall({
2307
2315
  };
2308
2316
  }
2309
2317
  }
2318
+ async function parseProviderExecutedDynamicToolCall(toolCall) {
2319
+ const parseResult = toolCall.input.trim() === "" ? { success: true, value: {} } : await (0, import_provider_utils10.safeParseJSON)({ text: toolCall.input });
2320
+ if (parseResult.success === false) {
2321
+ throw new InvalidToolInputError({
2322
+ toolName: toolCall.toolName,
2323
+ toolInput: toolCall.input,
2324
+ cause: parseResult.error
2325
+ });
2326
+ }
2327
+ return {
2328
+ type: "tool-call",
2329
+ toolCallId: toolCall.toolCallId,
2330
+ toolName: toolCall.toolName,
2331
+ input: parseResult.value,
2332
+ providerExecuted: true,
2333
+ dynamic: true,
2334
+ providerMetadata: toolCall.providerMetadata
2335
+ };
2336
+ }
2310
2337
  async function doParseToolCall({
2311
2338
  toolCall,
2312
2339
  tools
@@ -2314,6 +2341,9 @@ async function doParseToolCall({
2314
2341
  const toolName = toolCall.toolName;
2315
2342
  const tool3 = tools[toolName];
2316
2343
  if (tool3 == null) {
2344
+ if (toolCall.providerExecuted && toolCall.dynamic) {
2345
+ return await parseProviderExecutedDynamicToolCall(toolCall);
2346
+ }
2317
2347
  throw new NoSuchToolError({
2318
2348
  toolName: toolCall.toolName,
2319
2349
  availableTools: Object.keys(tools)
@@ -2788,7 +2818,10 @@ async function generateText({
2788
2818
  if (toolCall.invalid) {
2789
2819
  continue;
2790
2820
  }
2791
- const tool3 = tools[toolCall.toolName];
2821
+ const tool3 = tools == null ? void 0 : tools[toolCall.toolName];
2822
+ if (tool3 == null) {
2823
+ continue;
2824
+ }
2792
2825
  if ((tool3 == null ? void 0 : tool3.onInputAvailable) != null) {
2793
2826
  await tool3.onInputAvailable({
2794
2827
  input: toolCall.input,
@@ -3846,27 +3879,15 @@ function processUIMessageStream({
3846
3879
  await runUpdateMessageJob(async ({ state, write }) => {
3847
3880
  var _a17, _b, _c, _d;
3848
3881
  function getToolInvocation(toolCallId) {
3849
- const toolInvocations = state.message.parts.filter(isToolUIPart);
3850
- const toolInvocation = toolInvocations.find(
3851
- (invocation) => invocation.toolCallId === toolCallId
3852
- );
3853
- if (toolInvocation == null) {
3854
- throw new Error(
3855
- "tool-output-error must be preceded by a tool-input-available"
3856
- );
3857
- }
3858
- return toolInvocation;
3859
- }
3860
- function getDynamicToolInvocation(toolCallId) {
3861
3882
  const toolInvocations = state.message.parts.filter(
3862
- (part) => part.type === "dynamic-tool"
3883
+ isToolOrDynamicToolUIPart
3863
3884
  );
3864
3885
  const toolInvocation = toolInvocations.find(
3865
3886
  (invocation) => invocation.toolCallId === toolCallId
3866
3887
  );
3867
3888
  if (toolInvocation == null) {
3868
3889
  throw new Error(
3869
- "tool-output-error must be preceded by a tool-input-available"
3890
+ `no tool invocation found for tool call ${toolCallId}`
3870
3891
  );
3871
3892
  }
3872
3893
  return toolInvocation;
@@ -3905,7 +3926,7 @@ function processUIMessageStream({
3905
3926
  }
3906
3927
  }
3907
3928
  function updateDynamicToolPart(options) {
3908
- var _a18;
3929
+ var _a18, _b2;
3909
3930
  const part = state.message.parts.find(
3910
3931
  (part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId
3911
3932
  );
@@ -3919,6 +3940,7 @@ function processUIMessageStream({
3919
3940
  anyPart.errorText = anyOptions.errorText;
3920
3941
  anyPart.rawInput = (_a18 = anyOptions.rawInput) != null ? _a18 : anyPart.rawInput;
3921
3942
  anyPart.preliminary = anyOptions.preliminary;
3943
+ anyPart.providerExecuted = (_b2 = anyOptions.providerExecuted) != null ? _b2 : part.providerExecuted;
3922
3944
  if (anyOptions.providerMetadata != null && part.state === "input-available") {
3923
3945
  part.callProviderMetadata = anyOptions.providerMetadata;
3924
3946
  }
@@ -3932,6 +3954,7 @@ function processUIMessageStream({
3932
3954
  output: anyOptions.output,
3933
3955
  errorText: anyOptions.errorText,
3934
3956
  preliminary: anyOptions.preliminary,
3957
+ providerExecuted: anyOptions.providerExecuted,
3935
3958
  ...anyOptions.providerMetadata != null ? { callProviderMetadata: anyOptions.providerMetadata } : {}
3936
3959
  });
3937
3960
  }
@@ -4048,7 +4071,8 @@ function processUIMessageStream({
4048
4071
  toolCallId: chunk.toolCallId,
4049
4072
  toolName: chunk.toolName,
4050
4073
  state: "input-streaming",
4051
- input: void 0
4074
+ input: void 0,
4075
+ providerExecuted: chunk.providerExecuted
4052
4076
  });
4053
4077
  } else {
4054
4078
  updateToolPart({
@@ -4093,6 +4117,7 @@ function processUIMessageStream({
4093
4117
  toolName: chunk.toolName,
4094
4118
  state: "input-available",
4095
4119
  input: chunk.input,
4120
+ providerExecuted: chunk.providerExecuted,
4096
4121
  providerMetadata: chunk.providerMetadata
4097
4122
  });
4098
4123
  } else {
@@ -4121,6 +4146,7 @@ function processUIMessageStream({
4121
4146
  state: "output-error",
4122
4147
  input: chunk.input,
4123
4148
  errorText: chunk.errorText,
4149
+ providerExecuted: chunk.providerExecuted,
4124
4150
  providerMetadata: chunk.providerMetadata
4125
4151
  });
4126
4152
  } else {
@@ -4141,9 +4167,7 @@ function processUIMessageStream({
4141
4167
  case "tool-approval-request": {
4142
4168
  const toolInvocation = getToolInvocation(chunk.toolCallId);
4143
4169
  toolInvocation.state = "approval-requested";
4144
- toolInvocation.approval = {
4145
- id: chunk.approvalId
4146
- };
4170
+ toolInvocation.approval = { id: chunk.approvalId };
4147
4171
  write();
4148
4172
  break;
4149
4173
  }
@@ -4154,20 +4178,18 @@ function processUIMessageStream({
4154
4178
  break;
4155
4179
  }
4156
4180
  case "tool-output-available": {
4157
- if (chunk.dynamic) {
4158
- const toolInvocation = getDynamicToolInvocation(
4159
- chunk.toolCallId
4160
- );
4181
+ const toolInvocation = getToolInvocation(chunk.toolCallId);
4182
+ if (toolInvocation.type === "dynamic-tool") {
4161
4183
  updateDynamicToolPart({
4162
4184
  toolCallId: chunk.toolCallId,
4163
4185
  toolName: toolInvocation.toolName,
4164
4186
  state: "output-available",
4165
4187
  input: toolInvocation.input,
4166
4188
  output: chunk.output,
4167
- preliminary: chunk.preliminary
4189
+ preliminary: chunk.preliminary,
4190
+ providerExecuted: chunk.providerExecuted
4168
4191
  });
4169
4192
  } else {
4170
- const toolInvocation = getToolInvocation(chunk.toolCallId);
4171
4193
  updateToolPart({
4172
4194
  toolCallId: chunk.toolCallId,
4173
4195
  toolName: getToolName(toolInvocation),
@@ -4182,26 +4204,25 @@ function processUIMessageStream({
4182
4204
  break;
4183
4205
  }
4184
4206
  case "tool-output-error": {
4185
- if (chunk.dynamic) {
4186
- const toolInvocation = getDynamicToolInvocation(
4187
- chunk.toolCallId
4188
- );
4207
+ const toolInvocation = getToolInvocation(chunk.toolCallId);
4208
+ if (toolInvocation.type === "dynamic-tool") {
4189
4209
  updateDynamicToolPart({
4190
4210
  toolCallId: chunk.toolCallId,
4191
4211
  toolName: toolInvocation.toolName,
4192
4212
  state: "output-error",
4193
4213
  input: toolInvocation.input,
4194
- errorText: chunk.errorText
4214
+ errorText: chunk.errorText,
4215
+ providerExecuted: chunk.providerExecuted
4195
4216
  });
4196
4217
  } else {
4197
- const toolInvocation = getToolInvocation(chunk.toolCallId);
4198
4218
  updateToolPart({
4199
4219
  toolCallId: chunk.toolCallId,
4200
4220
  toolName: getToolName(toolInvocation),
4201
4221
  state: "output-error",
4202
4222
  input: toolInvocation.input,
4203
4223
  rawInput: toolInvocation.rawInput,
4204
- errorText: chunk.errorText
4224
+ errorText: chunk.errorText,
4225
+ providerExecuted: chunk.providerExecuted
4205
4226
  });
4206
4227
  }
4207
4228
  write();
@@ -4695,7 +4716,10 @@ function runToolsTransformation({
4695
4716
  });
4696
4717
  break;
4697
4718
  }
4698
- const tool3 = tools[toolCall.toolName];
4719
+ const tool3 = tools == null ? void 0 : tools[toolCall.toolName];
4720
+ if (tool3 == null) {
4721
+ break;
4722
+ }
4699
4723
  if (tool3.onInputAvailable != null) {
4700
4724
  await tool3.onInputAvailable({
4701
4725
  input: toolCall.input,
@@ -4753,7 +4777,8 @@ function runToolsTransformation({
4753
4777
  toolName,
4754
4778
  input: toolInputs.get(chunk.toolCallId),
4755
4779
  providerExecuted: chunk.providerExecuted,
4756
- error: chunk.result
4780
+ error: chunk.result,
4781
+ dynamic: chunk.dynamic
4757
4782
  });
4758
4783
  } else {
4759
4784
  controller.enqueue({
@@ -4762,7 +4787,8 @@ function runToolsTransformation({
4762
4787
  toolName,
4763
4788
  input: toolInputs.get(chunk.toolCallId),
4764
4789
  output: chunk.result,
4765
- providerExecuted: chunk.providerExecuted
4790
+ providerExecuted: chunk.providerExecuted,
4791
+ dynamic: chunk.dynamic
4766
4792
  });
4767
4793
  }
4768
4794
  break;
@@ -5486,7 +5512,7 @@ var DefaultStreamTextResult = class {
5486
5512
  streamWithToolResults.pipeThrough(
5487
5513
  new TransformStream({
5488
5514
  async transform(chunk, controller) {
5489
- var _a18, _b2, _c2, _d2;
5515
+ var _a18, _b2, _c2, _d2, _e2;
5490
5516
  if (chunk.type === "stream-start") {
5491
5517
  warnings = chunk.warnings;
5492
5518
  return;
@@ -5598,7 +5624,7 @@ var DefaultStreamTextResult = class {
5598
5624
  }
5599
5625
  controller.enqueue({
5600
5626
  ...chunk,
5601
- dynamic: (tool3 == null ? void 0 : tool3.type) === "dynamic"
5627
+ dynamic: (_e2 = chunk.dynamic) != null ? _e2 : (tool3 == null ? void 0 : tool3.type) === "dynamic"
5602
5628
  });
5603
5629
  break;
5604
5630
  }
@@ -5902,12 +5928,13 @@ var DefaultStreamTextResult = class {
5902
5928
  originalMessages,
5903
5929
  responseMessageId: generateMessageId
5904
5930
  }) : void 0;
5905
- const toolNamesByCallId = {};
5906
- const isDynamic = (toolCallId) => {
5907
- var _a17, _b;
5908
- const toolName = toolNamesByCallId[toolCallId];
5909
- const dynamic = ((_b = (_a17 = this.tools) == null ? void 0 : _a17[toolName]) == null ? void 0 : _b.type) === "dynamic";
5910
- return dynamic ? true : void 0;
5931
+ const isDynamic = (part) => {
5932
+ var _a17;
5933
+ const tool3 = (_a17 = this.tools) == null ? void 0 : _a17[part.toolName];
5934
+ if (tool3 == null) {
5935
+ return part.dynamic;
5936
+ }
5937
+ return (tool3 == null ? void 0 : tool3.type) === "dynamic" ? true : void 0;
5911
5938
  };
5912
5939
  const baseStream = this.fullStream.pipeThrough(
5913
5940
  new TransformStream({
@@ -5998,8 +6025,7 @@ var DefaultStreamTextResult = class {
5998
6025
  break;
5999
6026
  }
6000
6027
  case "tool-input-start": {
6001
- toolNamesByCallId[part.id] = part.toolName;
6002
- const dynamic = isDynamic(part.id);
6028
+ const dynamic = isDynamic(part);
6003
6029
  controller.enqueue({
6004
6030
  type: "tool-input-start",
6005
6031
  toolCallId: part.id,
@@ -6018,8 +6044,7 @@ var DefaultStreamTextResult = class {
6018
6044
  break;
6019
6045
  }
6020
6046
  case "tool-call": {
6021
- toolNamesByCallId[part.toolCallId] = part.toolName;
6022
- const dynamic = isDynamic(part.toolCallId);
6047
+ const dynamic = isDynamic(part);
6023
6048
  if (part.invalid) {
6024
6049
  controller.enqueue({
6025
6050
  type: "tool-input-error",
@@ -6053,7 +6078,7 @@ var DefaultStreamTextResult = class {
6053
6078
  break;
6054
6079
  }
6055
6080
  case "tool-result": {
6056
- const dynamic = isDynamic(part.toolCallId);
6081
+ const dynamic = isDynamic(part);
6057
6082
  controller.enqueue({
6058
6083
  type: "tool-output-available",
6059
6084
  toolCallId: part.toolCallId,
@@ -6065,7 +6090,7 @@ var DefaultStreamTextResult = class {
6065
6090
  break;
6066
6091
  }
6067
6092
  case "tool-error": {
6068
- const dynamic = isDynamic(part.toolCallId);
6093
+ const dynamic = isDynamic(part);
6069
6094
  controller.enqueue({
6070
6095
  type: "tool-output-error",
6071
6096
  toolCallId: part.toolCallId,
@@ -6304,25 +6329,14 @@ function convertToModelMessages(messages, options) {
6304
6329
  text: part.text,
6305
6330
  providerOptions: part.providerMetadata
6306
6331
  });
6307
- } else if (part.type === "dynamic-tool") {
6308
- const toolName = part.toolName;
6309
- if (part.state !== "input-streaming") {
6310
- content.push({
6311
- type: "tool-call",
6312
- toolCallId: part.toolCallId,
6313
- toolName,
6314
- input: part.input,
6315
- ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
6316
- });
6317
- }
6318
- } else if (isToolUIPart(part)) {
6319
- const toolName = getToolName(part);
6332
+ } else if (isToolOrDynamicToolUIPart(part)) {
6333
+ const toolName = getToolOrDynamicToolName(part);
6320
6334
  if (part.state !== "input-streaming") {
6321
6335
  content.push({
6322
6336
  type: "tool-call",
6323
6337
  toolCallId: part.toolCallId,
6324
6338
  toolName,
6325
- input: part.state === "output-error" ? (_a17 = part.input) != null ? _a17 : part.rawInput : part.input,
6339
+ input: part.state === "output-error" ? (_a17 = part.input) != null ? _a17 : "rawInput" in part ? part.rawInput : void 0 : part.input,
6326
6340
  providerExecuted: part.providerExecuted,
6327
6341
  ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
6328
6342
  });
@@ -6356,7 +6370,7 @@ function convertToModelMessages(messages, options) {
6356
6370
  content
6357
6371
  });
6358
6372
  const toolParts = block.filter(
6359
- (part) => isToolUIPart(part) && part.providerExecuted !== true || part.type === "dynamic-tool"
6373
+ (part) => isToolOrDynamicToolUIPart(part) && part.providerExecuted !== true
6360
6374
  );
6361
6375
  if (toolParts.length > 0) {
6362
6376
  modelMessages.push({
@@ -6365,7 +6379,7 @@ function convertToModelMessages(messages, options) {
6365
6379
  (toolPart) => {
6366
6380
  var _a18, _b2, _c;
6367
6381
  const outputs = [];
6368
- if (toolPart.type !== "dynamic-tool" && ((_a18 = toolPart.approval) == null ? void 0 : _a18.approved) != null) {
6382
+ if (((_a18 = toolPart.approval) == null ? void 0 : _a18.approved) != null) {
6369
6383
  outputs.push({
6370
6384
  type: "tool-approval-response",
6371
6385
  approvalId: toolPart.approval.id,
@@ -6378,7 +6392,7 @@ function convertToModelMessages(messages, options) {
6378
6392
  outputs.push({
6379
6393
  type: "tool-result",
6380
6394
  toolCallId: toolPart.toolCallId,
6381
- toolName: getToolName(toolPart),
6395
+ toolName: getToolOrDynamicToolName(toolPart),
6382
6396
  output: {
6383
6397
  type: "error-text",
6384
6398
  value: (_b2 = toolPart.approval.reason) != null ? _b2 : "Tool execution denied."
@@ -6388,7 +6402,7 @@ function convertToModelMessages(messages, options) {
6388
6402
  }
6389
6403
  case "output-error":
6390
6404
  case "output-available": {
6391
- const toolName = toolPart.type === "dynamic-tool" ? toolPart.toolName : getToolName(toolPart);
6405
+ const toolName = getToolOrDynamicToolName(toolPart);
6392
6406
  outputs.push({
6393
6407
  type: "tool-result",
6394
6408
  toolCallId: toolPart.toolCallId,
@@ -6412,7 +6426,7 @@ function convertToModelMessages(messages, options) {
6412
6426
  var processBlock = processBlock2;
6413
6427
  let block = [];
6414
6428
  for (const part of message.parts) {
6415
- if (part.type === "text" || part.type === "reasoning" || part.type === "file" || part.type === "dynamic-tool" || isToolUIPart(part)) {
6429
+ if (part.type === "text" || part.type === "reasoning" || part.type === "file" || isToolOrDynamicToolUIPart(part)) {
6416
6430
  block.push(part);
6417
6431
  } else if (part.type === "step-start") {
6418
6432
  processBlock2();
@@ -10284,7 +10298,7 @@ var AbstractChat = class {
10284
10298
  var _a17, _b;
10285
10299
  const messages = this.state.messages;
10286
10300
  const lastMessage = messages[messages.length - 1];
10287
- const updatePart = (part) => isToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
10301
+ const updatePart = (part) => isToolOrDynamicToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
10288
10302
  ...part,
10289
10303
  state: "approval-responded",
10290
10304
  approval: { id, approved, reason }
@@ -10651,8 +10665,10 @@ var uiMessagesSchema = (0, import_provider_utils35.lazySchema)(
10651
10665
  toolCallId: import_v410.z.string(),
10652
10666
  state: import_v410.z.literal("input-streaming"),
10653
10667
  input: import_v410.z.unknown().optional(),
10668
+ providerExecuted: import_v410.z.boolean().optional(),
10654
10669
  output: import_v410.z.never().optional(),
10655
- errorText: import_v410.z.never().optional()
10670
+ errorText: import_v410.z.never().optional(),
10671
+ approval: import_v410.z.never().optional()
10656
10672
  }),
10657
10673
  import_v410.z.object({
10658
10674
  type: import_v410.z.literal("dynamic-tool"),
@@ -10660,9 +10676,43 @@ var uiMessagesSchema = (0, import_provider_utils35.lazySchema)(
10660
10676
  toolCallId: import_v410.z.string(),
10661
10677
  state: import_v410.z.literal("input-available"),
10662
10678
  input: import_v410.z.unknown(),
10679
+ providerExecuted: import_v410.z.boolean().optional(),
10663
10680
  output: import_v410.z.never().optional(),
10664
10681
  errorText: import_v410.z.never().optional(),
10665
- callProviderMetadata: providerMetadataSchema.optional()
10682
+ callProviderMetadata: providerMetadataSchema.optional(),
10683
+ approval: import_v410.z.never().optional()
10684
+ }),
10685
+ import_v410.z.object({
10686
+ type: import_v410.z.literal("dynamic-tool"),
10687
+ toolName: import_v410.z.string(),
10688
+ toolCallId: import_v410.z.string(),
10689
+ state: import_v410.z.literal("approval-requested"),
10690
+ input: import_v410.z.unknown(),
10691
+ providerExecuted: import_v410.z.boolean().optional(),
10692
+ output: import_v410.z.never().optional(),
10693
+ errorText: import_v410.z.never().optional(),
10694
+ callProviderMetadata: providerMetadataSchema.optional(),
10695
+ approval: import_v410.z.object({
10696
+ id: import_v410.z.string(),
10697
+ approved: import_v410.z.never().optional(),
10698
+ reason: import_v410.z.never().optional()
10699
+ })
10700
+ }),
10701
+ import_v410.z.object({
10702
+ type: import_v410.z.literal("dynamic-tool"),
10703
+ toolName: import_v410.z.string(),
10704
+ toolCallId: import_v410.z.string(),
10705
+ state: import_v410.z.literal("approval-responded"),
10706
+ input: import_v410.z.unknown(),
10707
+ providerExecuted: import_v410.z.boolean().optional(),
10708
+ output: import_v410.z.never().optional(),
10709
+ errorText: import_v410.z.never().optional(),
10710
+ callProviderMetadata: providerMetadataSchema.optional(),
10711
+ approval: import_v410.z.object({
10712
+ id: import_v410.z.string(),
10713
+ approved: import_v410.z.boolean(),
10714
+ reason: import_v410.z.string().optional()
10715
+ })
10666
10716
  }),
10667
10717
  import_v410.z.object({
10668
10718
  type: import_v410.z.literal("dynamic-tool"),
@@ -10670,10 +10720,16 @@ var uiMessagesSchema = (0, import_provider_utils35.lazySchema)(
10670
10720
  toolCallId: import_v410.z.string(),
10671
10721
  state: import_v410.z.literal("output-available"),
10672
10722
  input: import_v410.z.unknown(),
10723
+ providerExecuted: import_v410.z.boolean().optional(),
10673
10724
  output: import_v410.z.unknown(),
10674
10725
  errorText: import_v410.z.never().optional(),
10675
10726
  callProviderMetadata: providerMetadataSchema.optional(),
10676
- preliminary: import_v410.z.boolean().optional()
10727
+ preliminary: import_v410.z.boolean().optional(),
10728
+ approval: import_v410.z.object({
10729
+ id: import_v410.z.string(),
10730
+ approved: import_v410.z.literal(true),
10731
+ reason: import_v410.z.string().optional()
10732
+ }).optional()
10677
10733
  }),
10678
10734
  import_v410.z.object({
10679
10735
  type: import_v410.z.literal("dynamic-tool"),
@@ -10681,9 +10737,31 @@ var uiMessagesSchema = (0, import_provider_utils35.lazySchema)(
10681
10737
  toolCallId: import_v410.z.string(),
10682
10738
  state: import_v410.z.literal("output-error"),
10683
10739
  input: import_v410.z.unknown(),
10740
+ providerExecuted: import_v410.z.boolean().optional(),
10684
10741
  output: import_v410.z.never().optional(),
10685
10742
  errorText: import_v410.z.string(),
10686
- callProviderMetadata: providerMetadataSchema.optional()
10743
+ callProviderMetadata: providerMetadataSchema.optional(),
10744
+ approval: import_v410.z.object({
10745
+ id: import_v410.z.string(),
10746
+ approved: import_v410.z.literal(true),
10747
+ reason: import_v410.z.string().optional()
10748
+ }).optional()
10749
+ }),
10750
+ import_v410.z.object({
10751
+ type: import_v410.z.literal("dynamic-tool"),
10752
+ toolName: import_v410.z.string(),
10753
+ toolCallId: import_v410.z.string(),
10754
+ state: import_v410.z.literal("output-denied"),
10755
+ input: import_v410.z.unknown(),
10756
+ providerExecuted: import_v410.z.boolean().optional(),
10757
+ output: import_v410.z.never().optional(),
10758
+ errorText: import_v410.z.never().optional(),
10759
+ callProviderMetadata: providerMetadataSchema.optional(),
10760
+ approval: import_v410.z.object({
10761
+ id: import_v410.z.string(),
10762
+ approved: import_v410.z.literal(false),
10763
+ reason: import_v410.z.string().optional()
10764
+ })
10687
10765
  }),
10688
10766
  import_v410.z.object({
10689
10767
  type: import_v410.z.string().startsWith("tool-"),
@@ -11056,6 +11134,7 @@ function readUIMessageStream({
11056
11134
  JSONParseError,
11057
11135
  JsonToSseTransformStream,
11058
11136
  LoadAPIKeyError,
11137
+ LoadSettingError,
11059
11138
  MCPClientError,
11060
11139
  MessageConversionError,
11061
11140
  NoContentGeneratedError,