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.mjs CHANGED
@@ -104,6 +104,7 @@ import {
104
104
  InvalidResponseDataError,
105
105
  JSONParseError,
106
106
  LoadAPIKeyError,
107
+ LoadSettingError,
107
108
  NoContentGeneratedError,
108
109
  NoSuchModelError,
109
110
  TooManyEmbeddingValuesForCallError,
@@ -774,7 +775,7 @@ import {
774
775
  } from "@ai-sdk/provider-utils";
775
776
 
776
777
  // src/version.ts
777
- var VERSION = true ? "6.0.0-beta.48" : "0.0.0-test";
778
+ var VERSION = true ? "6.0.0-beta.50" : "0.0.0-test";
778
779
 
779
780
  // src/util/download/download.ts
780
781
  var download = async ({ url }) => {
@@ -1397,6 +1398,10 @@ var outputSchema = z4.discriminatedUnion("type", [
1397
1398
  type: z4.literal("json"),
1398
1399
  value: jsonValueSchema
1399
1400
  }),
1401
+ z4.object({
1402
+ type: z4.literal("execution-denied"),
1403
+ reason: z4.string().optional()
1404
+ }),
1400
1405
  z4.object({
1401
1406
  type: z4.literal("error-text"),
1402
1407
  value: z4.string()
@@ -2182,6 +2187,9 @@ async function parseToolCall({
2182
2187
  }) {
2183
2188
  try {
2184
2189
  if (tools == null) {
2190
+ if (toolCall.providerExecuted && toolCall.dynamic) {
2191
+ return await parseProviderExecutedDynamicToolCall(toolCall);
2192
+ }
2185
2193
  throw new NoSuchToolError({ toolName: toolCall.toolName });
2186
2194
  }
2187
2195
  try {
@@ -2228,6 +2236,25 @@ async function parseToolCall({
2228
2236
  };
2229
2237
  }
2230
2238
  }
2239
+ async function parseProviderExecutedDynamicToolCall(toolCall) {
2240
+ const parseResult = toolCall.input.trim() === "" ? { success: true, value: {} } : await safeParseJSON({ text: toolCall.input });
2241
+ if (parseResult.success === false) {
2242
+ throw new InvalidToolInputError({
2243
+ toolName: toolCall.toolName,
2244
+ toolInput: toolCall.input,
2245
+ cause: parseResult.error
2246
+ });
2247
+ }
2248
+ return {
2249
+ type: "tool-call",
2250
+ toolCallId: toolCall.toolCallId,
2251
+ toolName: toolCall.toolName,
2252
+ input: parseResult.value,
2253
+ providerExecuted: true,
2254
+ dynamic: true,
2255
+ providerMetadata: toolCall.providerMetadata
2256
+ };
2257
+ }
2231
2258
  async function doParseToolCall({
2232
2259
  toolCall,
2233
2260
  tools
@@ -2235,6 +2262,9 @@ async function doParseToolCall({
2235
2262
  const toolName = toolCall.toolName;
2236
2263
  const tool3 = tools[toolName];
2237
2264
  if (tool3 == null) {
2265
+ if (toolCall.providerExecuted && toolCall.dynamic) {
2266
+ return await parseProviderExecutedDynamicToolCall(toolCall);
2267
+ }
2238
2268
  throw new NoSuchToolError({
2239
2269
  toolName: toolCall.toolName,
2240
2270
  availableTools: Object.keys(tools)
@@ -2709,7 +2739,10 @@ async function generateText({
2709
2739
  if (toolCall.invalid) {
2710
2740
  continue;
2711
2741
  }
2712
- const tool3 = tools[toolCall.toolName];
2742
+ const tool3 = tools == null ? void 0 : tools[toolCall.toolName];
2743
+ if (tool3 == null) {
2744
+ continue;
2745
+ }
2713
2746
  if ((tool3 == null ? void 0 : tool3.onInputAvailable) != null) {
2714
2747
  await tool3.onInputAvailable({
2715
2748
  input: toolCall.input,
@@ -3195,9 +3228,7 @@ function getResponseUIMessageId({
3195
3228
  }
3196
3229
 
3197
3230
  // src/ui/process-ui-message-stream.ts
3198
- import {
3199
- validateTypes
3200
- } from "@ai-sdk/provider-utils";
3231
+ import { validateTypes } from "@ai-sdk/provider-utils";
3201
3232
 
3202
3233
  // src/ui-message-stream/ui-message-chunks.ts
3203
3234
  import { z as z7 } from "zod/v4";
@@ -3774,27 +3805,15 @@ function processUIMessageStream({
3774
3805
  await runUpdateMessageJob(async ({ state, write }) => {
3775
3806
  var _a17, _b, _c, _d;
3776
3807
  function getToolInvocation(toolCallId) {
3777
- const toolInvocations = state.message.parts.filter(isToolUIPart);
3778
- const toolInvocation = toolInvocations.find(
3779
- (invocation) => invocation.toolCallId === toolCallId
3780
- );
3781
- if (toolInvocation == null) {
3782
- throw new Error(
3783
- "tool-output-error must be preceded by a tool-input-available"
3784
- );
3785
- }
3786
- return toolInvocation;
3787
- }
3788
- function getDynamicToolInvocation(toolCallId) {
3789
3808
  const toolInvocations = state.message.parts.filter(
3790
- (part) => part.type === "dynamic-tool"
3809
+ isToolOrDynamicToolUIPart
3791
3810
  );
3792
3811
  const toolInvocation = toolInvocations.find(
3793
3812
  (invocation) => invocation.toolCallId === toolCallId
3794
3813
  );
3795
3814
  if (toolInvocation == null) {
3796
3815
  throw new Error(
3797
- "tool-output-error must be preceded by a tool-input-available"
3816
+ `no tool invocation found for tool call ${toolCallId}`
3798
3817
  );
3799
3818
  }
3800
3819
  return toolInvocation;
@@ -3833,7 +3852,7 @@ function processUIMessageStream({
3833
3852
  }
3834
3853
  }
3835
3854
  function updateDynamicToolPart(options) {
3836
- var _a18;
3855
+ var _a18, _b2;
3837
3856
  const part = state.message.parts.find(
3838
3857
  (part2) => part2.type === "dynamic-tool" && part2.toolCallId === options.toolCallId
3839
3858
  );
@@ -3847,6 +3866,7 @@ function processUIMessageStream({
3847
3866
  anyPart.errorText = anyOptions.errorText;
3848
3867
  anyPart.rawInput = (_a18 = anyOptions.rawInput) != null ? _a18 : anyPart.rawInput;
3849
3868
  anyPart.preliminary = anyOptions.preliminary;
3869
+ anyPart.providerExecuted = (_b2 = anyOptions.providerExecuted) != null ? _b2 : part.providerExecuted;
3850
3870
  if (anyOptions.providerMetadata != null && part.state === "input-available") {
3851
3871
  part.callProviderMetadata = anyOptions.providerMetadata;
3852
3872
  }
@@ -3860,6 +3880,7 @@ function processUIMessageStream({
3860
3880
  output: anyOptions.output,
3861
3881
  errorText: anyOptions.errorText,
3862
3882
  preliminary: anyOptions.preliminary,
3883
+ providerExecuted: anyOptions.providerExecuted,
3863
3884
  ...anyOptions.providerMetadata != null ? { callProviderMetadata: anyOptions.providerMetadata } : {}
3864
3885
  });
3865
3886
  }
@@ -3976,7 +3997,8 @@ function processUIMessageStream({
3976
3997
  toolCallId: chunk.toolCallId,
3977
3998
  toolName: chunk.toolName,
3978
3999
  state: "input-streaming",
3979
- input: void 0
4000
+ input: void 0,
4001
+ providerExecuted: chunk.providerExecuted
3980
4002
  });
3981
4003
  } else {
3982
4004
  updateToolPart({
@@ -4021,6 +4043,7 @@ function processUIMessageStream({
4021
4043
  toolName: chunk.toolName,
4022
4044
  state: "input-available",
4023
4045
  input: chunk.input,
4046
+ providerExecuted: chunk.providerExecuted,
4024
4047
  providerMetadata: chunk.providerMetadata
4025
4048
  });
4026
4049
  } else {
@@ -4049,6 +4072,7 @@ function processUIMessageStream({
4049
4072
  state: "output-error",
4050
4073
  input: chunk.input,
4051
4074
  errorText: chunk.errorText,
4075
+ providerExecuted: chunk.providerExecuted,
4052
4076
  providerMetadata: chunk.providerMetadata
4053
4077
  });
4054
4078
  } else {
@@ -4069,9 +4093,7 @@ function processUIMessageStream({
4069
4093
  case "tool-approval-request": {
4070
4094
  const toolInvocation = getToolInvocation(chunk.toolCallId);
4071
4095
  toolInvocation.state = "approval-requested";
4072
- toolInvocation.approval = {
4073
- id: chunk.approvalId
4074
- };
4096
+ toolInvocation.approval = { id: chunk.approvalId };
4075
4097
  write();
4076
4098
  break;
4077
4099
  }
@@ -4082,20 +4104,18 @@ function processUIMessageStream({
4082
4104
  break;
4083
4105
  }
4084
4106
  case "tool-output-available": {
4085
- if (chunk.dynamic) {
4086
- const toolInvocation = getDynamicToolInvocation(
4087
- chunk.toolCallId
4088
- );
4107
+ const toolInvocation = getToolInvocation(chunk.toolCallId);
4108
+ if (toolInvocation.type === "dynamic-tool") {
4089
4109
  updateDynamicToolPart({
4090
4110
  toolCallId: chunk.toolCallId,
4091
4111
  toolName: toolInvocation.toolName,
4092
4112
  state: "output-available",
4093
4113
  input: toolInvocation.input,
4094
4114
  output: chunk.output,
4095
- preliminary: chunk.preliminary
4115
+ preliminary: chunk.preliminary,
4116
+ providerExecuted: chunk.providerExecuted
4096
4117
  });
4097
4118
  } else {
4098
- const toolInvocation = getToolInvocation(chunk.toolCallId);
4099
4119
  updateToolPart({
4100
4120
  toolCallId: chunk.toolCallId,
4101
4121
  toolName: getToolName(toolInvocation),
@@ -4110,26 +4130,25 @@ function processUIMessageStream({
4110
4130
  break;
4111
4131
  }
4112
4132
  case "tool-output-error": {
4113
- if (chunk.dynamic) {
4114
- const toolInvocation = getDynamicToolInvocation(
4115
- chunk.toolCallId
4116
- );
4133
+ const toolInvocation = getToolInvocation(chunk.toolCallId);
4134
+ if (toolInvocation.type === "dynamic-tool") {
4117
4135
  updateDynamicToolPart({
4118
4136
  toolCallId: chunk.toolCallId,
4119
4137
  toolName: toolInvocation.toolName,
4120
4138
  state: "output-error",
4121
4139
  input: toolInvocation.input,
4122
- errorText: chunk.errorText
4140
+ errorText: chunk.errorText,
4141
+ providerExecuted: chunk.providerExecuted
4123
4142
  });
4124
4143
  } else {
4125
- const toolInvocation = getToolInvocation(chunk.toolCallId);
4126
4144
  updateToolPart({
4127
4145
  toolCallId: chunk.toolCallId,
4128
4146
  toolName: getToolName(toolInvocation),
4129
4147
  state: "output-error",
4130
4148
  input: toolInvocation.input,
4131
4149
  rawInput: toolInvocation.rawInput,
4132
- errorText: chunk.errorText
4150
+ errorText: chunk.errorText,
4151
+ providerExecuted: chunk.providerExecuted
4133
4152
  });
4134
4153
  }
4135
4154
  write();
@@ -4625,7 +4644,10 @@ function runToolsTransformation({
4625
4644
  });
4626
4645
  break;
4627
4646
  }
4628
- const tool3 = tools[toolCall.toolName];
4647
+ const tool3 = tools == null ? void 0 : tools[toolCall.toolName];
4648
+ if (tool3 == null) {
4649
+ break;
4650
+ }
4629
4651
  if (tool3.onInputAvailable != null) {
4630
4652
  await tool3.onInputAvailable({
4631
4653
  input: toolCall.input,
@@ -4683,7 +4705,8 @@ function runToolsTransformation({
4683
4705
  toolName,
4684
4706
  input: toolInputs.get(chunk.toolCallId),
4685
4707
  providerExecuted: chunk.providerExecuted,
4686
- error: chunk.result
4708
+ error: chunk.result,
4709
+ dynamic: chunk.dynamic
4687
4710
  });
4688
4711
  } else {
4689
4712
  controller.enqueue({
@@ -4692,7 +4715,8 @@ function runToolsTransformation({
4692
4715
  toolName,
4693
4716
  input: toolInputs.get(chunk.toolCallId),
4694
4717
  output: chunk.result,
4695
- providerExecuted: chunk.providerExecuted
4718
+ providerExecuted: chunk.providerExecuted,
4719
+ dynamic: chunk.dynamic
4696
4720
  });
4697
4721
  }
4698
4722
  break;
@@ -5416,7 +5440,7 @@ var DefaultStreamTextResult = class {
5416
5440
  streamWithToolResults.pipeThrough(
5417
5441
  new TransformStream({
5418
5442
  async transform(chunk, controller) {
5419
- var _a18, _b2, _c2, _d2;
5443
+ var _a18, _b2, _c2, _d2, _e2;
5420
5444
  if (chunk.type === "stream-start") {
5421
5445
  warnings = chunk.warnings;
5422
5446
  return;
@@ -5528,7 +5552,7 @@ var DefaultStreamTextResult = class {
5528
5552
  }
5529
5553
  controller.enqueue({
5530
5554
  ...chunk,
5531
- dynamic: (tool3 == null ? void 0 : tool3.type) === "dynamic"
5555
+ dynamic: (_e2 = chunk.dynamic) != null ? _e2 : (tool3 == null ? void 0 : tool3.type) === "dynamic"
5532
5556
  });
5533
5557
  break;
5534
5558
  }
@@ -5832,12 +5856,13 @@ var DefaultStreamTextResult = class {
5832
5856
  originalMessages,
5833
5857
  responseMessageId: generateMessageId
5834
5858
  }) : void 0;
5835
- const toolNamesByCallId = {};
5836
- const isDynamic = (toolCallId) => {
5837
- var _a17, _b;
5838
- const toolName = toolNamesByCallId[toolCallId];
5839
- const dynamic = ((_b = (_a17 = this.tools) == null ? void 0 : _a17[toolName]) == null ? void 0 : _b.type) === "dynamic";
5840
- return dynamic ? true : void 0;
5859
+ const isDynamic = (part) => {
5860
+ var _a17;
5861
+ const tool3 = (_a17 = this.tools) == null ? void 0 : _a17[part.toolName];
5862
+ if (tool3 == null) {
5863
+ return part.dynamic;
5864
+ }
5865
+ return (tool3 == null ? void 0 : tool3.type) === "dynamic" ? true : void 0;
5841
5866
  };
5842
5867
  const baseStream = this.fullStream.pipeThrough(
5843
5868
  new TransformStream({
@@ -5928,8 +5953,7 @@ var DefaultStreamTextResult = class {
5928
5953
  break;
5929
5954
  }
5930
5955
  case "tool-input-start": {
5931
- toolNamesByCallId[part.id] = part.toolName;
5932
- const dynamic = isDynamic(part.id);
5956
+ const dynamic = isDynamic(part);
5933
5957
  controller.enqueue({
5934
5958
  type: "tool-input-start",
5935
5959
  toolCallId: part.id,
@@ -5948,8 +5972,7 @@ var DefaultStreamTextResult = class {
5948
5972
  break;
5949
5973
  }
5950
5974
  case "tool-call": {
5951
- toolNamesByCallId[part.toolCallId] = part.toolName;
5952
- const dynamic = isDynamic(part.toolCallId);
5975
+ const dynamic = isDynamic(part);
5953
5976
  if (part.invalid) {
5954
5977
  controller.enqueue({
5955
5978
  type: "tool-input-error",
@@ -5983,7 +6006,7 @@ var DefaultStreamTextResult = class {
5983
6006
  break;
5984
6007
  }
5985
6008
  case "tool-result": {
5986
- const dynamic = isDynamic(part.toolCallId);
6009
+ const dynamic = isDynamic(part);
5987
6010
  controller.enqueue({
5988
6011
  type: "tool-output-available",
5989
6012
  toolCallId: part.toolCallId,
@@ -5995,7 +6018,7 @@ var DefaultStreamTextResult = class {
5995
6018
  break;
5996
6019
  }
5997
6020
  case "tool-error": {
5998
- const dynamic = isDynamic(part.toolCallId);
6021
+ const dynamic = isDynamic(part);
5999
6022
  controller.enqueue({
6000
6023
  type: "tool-output-error",
6001
6024
  toolCallId: part.toolCallId,
@@ -6234,25 +6257,14 @@ function convertToModelMessages(messages, options) {
6234
6257
  text: part.text,
6235
6258
  providerOptions: part.providerMetadata
6236
6259
  });
6237
- } else if (part.type === "dynamic-tool") {
6238
- const toolName = part.toolName;
6239
- if (part.state !== "input-streaming") {
6240
- content.push({
6241
- type: "tool-call",
6242
- toolCallId: part.toolCallId,
6243
- toolName,
6244
- input: part.input,
6245
- ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
6246
- });
6247
- }
6248
- } else if (isToolUIPart(part)) {
6249
- const toolName = getToolName(part);
6260
+ } else if (isToolOrDynamicToolUIPart(part)) {
6261
+ const toolName = getToolOrDynamicToolName(part);
6250
6262
  if (part.state !== "input-streaming") {
6251
6263
  content.push({
6252
6264
  type: "tool-call",
6253
6265
  toolCallId: part.toolCallId,
6254
6266
  toolName,
6255
- input: part.state === "output-error" ? (_a17 = part.input) != null ? _a17 : part.rawInput : part.input,
6267
+ input: part.state === "output-error" ? (_a17 = part.input) != null ? _a17 : "rawInput" in part ? part.rawInput : void 0 : part.input,
6256
6268
  providerExecuted: part.providerExecuted,
6257
6269
  ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
6258
6270
  });
@@ -6286,7 +6298,7 @@ function convertToModelMessages(messages, options) {
6286
6298
  content
6287
6299
  });
6288
6300
  const toolParts = block.filter(
6289
- (part) => isToolUIPart(part) && part.providerExecuted !== true || part.type === "dynamic-tool"
6301
+ (part) => isToolOrDynamicToolUIPart(part) && part.providerExecuted !== true
6290
6302
  );
6291
6303
  if (toolParts.length > 0) {
6292
6304
  modelMessages.push({
@@ -6295,7 +6307,7 @@ function convertToModelMessages(messages, options) {
6295
6307
  (toolPart) => {
6296
6308
  var _a18, _b2, _c;
6297
6309
  const outputs = [];
6298
- if (toolPart.type !== "dynamic-tool" && ((_a18 = toolPart.approval) == null ? void 0 : _a18.approved) != null) {
6310
+ if (((_a18 = toolPart.approval) == null ? void 0 : _a18.approved) != null) {
6299
6311
  outputs.push({
6300
6312
  type: "tool-approval-response",
6301
6313
  approvalId: toolPart.approval.id,
@@ -6308,7 +6320,7 @@ function convertToModelMessages(messages, options) {
6308
6320
  outputs.push({
6309
6321
  type: "tool-result",
6310
6322
  toolCallId: toolPart.toolCallId,
6311
- toolName: getToolName(toolPart),
6323
+ toolName: getToolOrDynamicToolName(toolPart),
6312
6324
  output: {
6313
6325
  type: "error-text",
6314
6326
  value: (_b2 = toolPart.approval.reason) != null ? _b2 : "Tool execution denied."
@@ -6318,7 +6330,7 @@ function convertToModelMessages(messages, options) {
6318
6330
  }
6319
6331
  case "output-error":
6320
6332
  case "output-available": {
6321
- const toolName = toolPart.type === "dynamic-tool" ? toolPart.toolName : getToolName(toolPart);
6333
+ const toolName = getToolOrDynamicToolName(toolPart);
6322
6334
  outputs.push({
6323
6335
  type: "tool-result",
6324
6336
  toolCallId: toolPart.toolCallId,
@@ -6342,7 +6354,7 @@ function convertToModelMessages(messages, options) {
6342
6354
  var processBlock = processBlock2;
6343
6355
  let block = [];
6344
6356
  for (const part of message.parts) {
6345
- if (part.type === "text" || part.type === "reasoning" || part.type === "file" || part.type === "dynamic-tool" || isToolUIPart(part)) {
6357
+ if (part.type === "text" || part.type === "reasoning" || part.type === "file" || isToolOrDynamicToolUIPart(part)) {
6346
6358
  block.push(part);
6347
6359
  } else if (part.type === "step-start") {
6348
6360
  processBlock2();
@@ -10254,7 +10266,7 @@ var AbstractChat = class {
10254
10266
  var _a17, _b;
10255
10267
  const messages = this.state.messages;
10256
10268
  const lastMessage = messages[messages.length - 1];
10257
- const updatePart = (part) => isToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
10269
+ const updatePart = (part) => isToolOrDynamicToolUIPart(part) && part.state === "approval-requested" && part.approval.id === id ? {
10258
10270
  ...part,
10259
10271
  state: "approval-responded",
10260
10272
  approval: { id, approved, reason }
@@ -10625,8 +10637,10 @@ var uiMessagesSchema = lazySchema2(
10625
10637
  toolCallId: z10.string(),
10626
10638
  state: z10.literal("input-streaming"),
10627
10639
  input: z10.unknown().optional(),
10640
+ providerExecuted: z10.boolean().optional(),
10628
10641
  output: z10.never().optional(),
10629
- errorText: z10.never().optional()
10642
+ errorText: z10.never().optional(),
10643
+ approval: z10.never().optional()
10630
10644
  }),
10631
10645
  z10.object({
10632
10646
  type: z10.literal("dynamic-tool"),
@@ -10634,9 +10648,43 @@ var uiMessagesSchema = lazySchema2(
10634
10648
  toolCallId: z10.string(),
10635
10649
  state: z10.literal("input-available"),
10636
10650
  input: z10.unknown(),
10651
+ providerExecuted: z10.boolean().optional(),
10637
10652
  output: z10.never().optional(),
10638
10653
  errorText: z10.never().optional(),
10639
- callProviderMetadata: providerMetadataSchema.optional()
10654
+ callProviderMetadata: providerMetadataSchema.optional(),
10655
+ approval: z10.never().optional()
10656
+ }),
10657
+ z10.object({
10658
+ type: z10.literal("dynamic-tool"),
10659
+ toolName: z10.string(),
10660
+ toolCallId: z10.string(),
10661
+ state: z10.literal("approval-requested"),
10662
+ input: z10.unknown(),
10663
+ providerExecuted: z10.boolean().optional(),
10664
+ output: z10.never().optional(),
10665
+ errorText: z10.never().optional(),
10666
+ callProviderMetadata: providerMetadataSchema.optional(),
10667
+ approval: z10.object({
10668
+ id: z10.string(),
10669
+ approved: z10.never().optional(),
10670
+ reason: z10.never().optional()
10671
+ })
10672
+ }),
10673
+ z10.object({
10674
+ type: z10.literal("dynamic-tool"),
10675
+ toolName: z10.string(),
10676
+ toolCallId: z10.string(),
10677
+ state: z10.literal("approval-responded"),
10678
+ input: z10.unknown(),
10679
+ providerExecuted: z10.boolean().optional(),
10680
+ output: z10.never().optional(),
10681
+ errorText: z10.never().optional(),
10682
+ callProviderMetadata: providerMetadataSchema.optional(),
10683
+ approval: z10.object({
10684
+ id: z10.string(),
10685
+ approved: z10.boolean(),
10686
+ reason: z10.string().optional()
10687
+ })
10640
10688
  }),
10641
10689
  z10.object({
10642
10690
  type: z10.literal("dynamic-tool"),
@@ -10644,10 +10692,16 @@ var uiMessagesSchema = lazySchema2(
10644
10692
  toolCallId: z10.string(),
10645
10693
  state: z10.literal("output-available"),
10646
10694
  input: z10.unknown(),
10695
+ providerExecuted: z10.boolean().optional(),
10647
10696
  output: z10.unknown(),
10648
10697
  errorText: z10.never().optional(),
10649
10698
  callProviderMetadata: providerMetadataSchema.optional(),
10650
- preliminary: z10.boolean().optional()
10699
+ preliminary: z10.boolean().optional(),
10700
+ approval: z10.object({
10701
+ id: z10.string(),
10702
+ approved: z10.literal(true),
10703
+ reason: z10.string().optional()
10704
+ }).optional()
10651
10705
  }),
10652
10706
  z10.object({
10653
10707
  type: z10.literal("dynamic-tool"),
@@ -10655,9 +10709,31 @@ var uiMessagesSchema = lazySchema2(
10655
10709
  toolCallId: z10.string(),
10656
10710
  state: z10.literal("output-error"),
10657
10711
  input: z10.unknown(),
10712
+ providerExecuted: z10.boolean().optional(),
10658
10713
  output: z10.never().optional(),
10659
10714
  errorText: z10.string(),
10660
- callProviderMetadata: providerMetadataSchema.optional()
10715
+ callProviderMetadata: providerMetadataSchema.optional(),
10716
+ approval: z10.object({
10717
+ id: z10.string(),
10718
+ approved: z10.literal(true),
10719
+ reason: z10.string().optional()
10720
+ }).optional()
10721
+ }),
10722
+ z10.object({
10723
+ type: z10.literal("dynamic-tool"),
10724
+ toolName: z10.string(),
10725
+ toolCallId: z10.string(),
10726
+ state: z10.literal("output-denied"),
10727
+ input: z10.unknown(),
10728
+ providerExecuted: z10.boolean().optional(),
10729
+ output: z10.never().optional(),
10730
+ errorText: z10.never().optional(),
10731
+ callProviderMetadata: providerMetadataSchema.optional(),
10732
+ approval: z10.object({
10733
+ id: z10.string(),
10734
+ approved: z10.literal(false),
10735
+ reason: z10.string().optional()
10736
+ })
10661
10737
  }),
10662
10738
  z10.object({
10663
10739
  type: z10.string().startsWith("tool-"),
@@ -11032,6 +11108,7 @@ export {
11032
11108
  JSONParseError,
11033
11109
  JsonToSseTransformStream,
11034
11110
  LoadAPIKeyError,
11111
+ LoadSettingError,
11035
11112
  MCPClientError,
11036
11113
  MessageConversionError,
11037
11114
  NoContentGeneratedError,