@convex-dev/agent 0.3.2 → 0.6.0-alpha.0

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.
Files changed (99) hide show
  1. package/dist/UIMessages.d.ts +3 -2
  2. package/dist/UIMessages.d.ts.map +1 -1
  3. package/dist/UIMessages.js +100 -19
  4. package/dist/UIMessages.js.map +1 -1
  5. package/dist/client/createTool.d.ts +129 -25
  6. package/dist/client/createTool.d.ts.map +1 -1
  7. package/dist/client/createTool.js +65 -8
  8. package/dist/client/createTool.js.map +1 -1
  9. package/dist/client/definePlaygroundAPI.d.ts +560 -35
  10. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  11. package/dist/client/files.d.ts.map +1 -1
  12. package/dist/client/files.js +4 -2
  13. package/dist/client/files.js.map +1 -1
  14. package/dist/client/index.d.ts +462 -37
  15. package/dist/client/index.d.ts.map +1 -1
  16. package/dist/client/index.js +26 -7
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/messages.d.ts +114 -9
  19. package/dist/client/messages.d.ts.map +1 -1
  20. package/dist/client/mockModel.d.ts +17 -17
  21. package/dist/client/mockModel.d.ts.map +1 -1
  22. package/dist/client/mockModel.js +8 -6
  23. package/dist/client/mockModel.js.map +1 -1
  24. package/dist/client/saveInputMessages.d.ts +1 -1
  25. package/dist/client/saveInputMessages.d.ts.map +1 -1
  26. package/dist/client/saveInputMessages.js +1 -1
  27. package/dist/client/saveInputMessages.js.map +1 -1
  28. package/dist/client/search.d.ts +132 -14
  29. package/dist/client/search.d.ts.map +1 -1
  30. package/dist/client/search.js +66 -19
  31. package/dist/client/search.js.map +1 -1
  32. package/dist/client/streamText.d.ts +4 -4
  33. package/dist/client/streamText.d.ts.map +1 -1
  34. package/dist/client/streamText.js.map +1 -1
  35. package/dist/client/streaming.d.ts +1491 -87
  36. package/dist/client/streaming.d.ts.map +1 -1
  37. package/dist/client/types.d.ts +26 -6
  38. package/dist/client/types.d.ts.map +1 -1
  39. package/dist/component/_generated/component.d.ts +862 -19
  40. package/dist/component/_generated/component.d.ts.map +1 -1
  41. package/dist/component/files.d.ts +12 -6
  42. package/dist/component/files.d.ts.map +1 -1
  43. package/dist/component/files.js +10 -2
  44. package/dist/component/files.js.map +1 -1
  45. package/dist/component/messages.d.ts +1247 -92
  46. package/dist/component/messages.d.ts.map +1 -1
  47. package/dist/component/schema.d.ts +2823 -217
  48. package/dist/component/schema.d.ts.map +1 -1
  49. package/dist/component/schema.js +3 -1
  50. package/dist/component/schema.js.map +1 -1
  51. package/dist/component/streams.js +1 -1
  52. package/dist/component/streams.js.map +1 -1
  53. package/dist/component/threads.d.ts +10 -10
  54. package/dist/component/vector/index.d.ts +1 -1
  55. package/dist/deltas.d.ts.map +1 -1
  56. package/dist/deltas.js +40 -5
  57. package/dist/deltas.js.map +1 -1
  58. package/dist/mapping.d.ts.map +1 -1
  59. package/dist/mapping.js +117 -25
  60. package/dist/mapping.js.map +1 -1
  61. package/dist/react/useThreadMessages.d.ts.map +1 -1
  62. package/dist/react/useThreadMessages.js +17 -9
  63. package/dist/react/useThreadMessages.js.map +1 -1
  64. package/dist/shared.d.ts +2 -2
  65. package/dist/shared.d.ts.map +1 -1
  66. package/dist/shared.js.map +1 -1
  67. package/dist/validators.d.ts +12196 -624
  68. package/dist/validators.d.ts.map +1 -1
  69. package/dist/validators.js +152 -9
  70. package/dist/validators.js.map +1 -1
  71. package/package.json +24 -22
  72. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  73. package/src/UIMessages.ts +184 -66
  74. package/src/client/createTool.ts +291 -67
  75. package/src/client/files.ts +4 -2
  76. package/src/client/index.test.ts +1 -0
  77. package/src/client/index.ts +46 -25
  78. package/src/client/mockModel.ts +36 -34
  79. package/src/client/saveInputMessages.ts +2 -2
  80. package/src/client/search.test.ts +166 -0
  81. package/src/client/search.ts +121 -38
  82. package/src/client/streamText.ts +5 -5
  83. package/src/client/types.ts +31 -18
  84. package/src/component/_generated/component.ts +2329 -338
  85. package/src/component/files.ts +11 -2
  86. package/src/component/messages.test.ts +7 -7
  87. package/src/component/schema.ts +3 -1
  88. package/src/component/setup.test.ts +7 -0
  89. package/src/component/streams.ts +1 -1
  90. package/src/deltas.test.ts +90 -0
  91. package/src/deltas.ts +47 -8
  92. package/src/fromUIMessages.test.ts +32 -27
  93. package/src/mapping.test.ts +48 -0
  94. package/src/mapping.ts +234 -142
  95. package/src/react/useThreadMessages.ts +21 -9
  96. package/src/shared.ts +2 -0
  97. package/src/toUIMessages.test.ts +539 -1
  98. package/src/validators.ts +179 -20
  99. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
@@ -8,7 +8,7 @@ import { type VectorDimension } from "../component/vector/tables.js";
8
8
  import { type Message, type MessageDoc, type MessageStatus, type MessageWithMetadata, type ProviderMetadata, type StreamArgs, type ThreadDoc } from "../validators.js";
9
9
  import { type SaveMessageArgs, type SaveMessagesArgs } from "./messages.js";
10
10
  import { type StreamingOptions } from "./streaming.js";
11
- import type { ActionCtx, AgentComponent, Config, ContextOptions, GenerateObjectArgs, GenerationOutputMetadata, MaybeCustomCtx, ObjectMode, Options, RawRequestResponseHandler, MutationCtx, StorageOptions, StreamingTextArgs, StreamObjectArgs, SyncStreamsReturnValue, TextArgs, Thread, UsageHandler, QueryCtx, AgentPrompt } from "./types.js";
11
+ import type { ActionCtx, AgentComponent, Config, ContextOptions, GenerateObjectArgs, GenerationOutputMetadata, MaybeCustomCtx, ObjectMode, Options, RawRequestResponseHandler, MutationCtx, StorageOptions, StreamingTextArgs, StreamObjectArgs, SyncStreamsReturnValue, TextArgs, Thread, UsageHandler, QueryCtx, AgentPrompt, Output } from "./types.js";
12
12
  export { stepCountIs } from "ai";
13
13
  export { docsToModelMessages, toModelMessage, toModelMessage as deserializeMessage, guessMimeType, serializeDataOrUrl, serializeMessage, toUIFilePart, } from "../mapping.js";
14
14
  export { extractText, isTool, sorted } from "../shared.js";
@@ -111,6 +111,11 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
111
111
  */
112
112
  stopWhen?: StopCondition<NoInfer<AgentTools>> | Array<StopCondition<NoInfer<AgentTools>>>;
113
113
  });
114
+ /**
115
+ * Get the embedding model, prioritizing embeddingModel over textEmbeddingModel.
116
+ * @private
117
+ */
118
+ private getEmbeddingModel;
114
119
  /**
115
120
  * Start a new thread with the agent. This will have a fresh history, though if
116
121
  * you pass in a userId you can have it search across other threads for relevant
@@ -248,7 +253,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
248
253
  * @param options Extra controls for the {@link ContextOptions} and {@link StorageOptions}.
249
254
  * @returns The result of the generateText function.
250
255
  */
251
- generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
256
+ generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
252
257
  userId?: string | null;
253
258
  threadId?: string;
254
259
  },
@@ -256,7 +261,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
256
261
  * The arguments to the generateText function, similar to the ai sdk's
257
262
  * {@link generateText} function, along with Agent prompt options.
258
263
  */
259
- generateTextArgs: AgentPrompt & TextArgs<AgentTools, TOOLS, OUTPUT, OUTPUT_PARTIAL>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
264
+ generateTextArgs: AgentPrompt & TextArgs<AgentTools, TOOLS, OUTPUT>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
260
265
  /**
261
266
  * This behaves like {@link streamText} from the "ai" package except that
262
267
  * it add context based on the userId and threadId and saves the input and
@@ -264,7 +269,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
264
269
  * Use {@link continueThread} to get a version of this function already scoped
265
270
  * to a thread (and optionally userId).
266
271
  */
267
- streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, PARTIAL_OUTPUT = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
272
+ streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
268
273
  userId?: string | null;
269
274
  threadId?: string;
270
275
  },
@@ -272,7 +277,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
272
277
  * The arguments to the streamText function, similar to the ai sdk's
273
278
  * {@link streamText} function, along with Agent prompt options.
274
279
  */
275
- streamTextArgs: AgentPrompt & StreamingTextArgs<AgentTools, TOOLS, OUTPUT, PARTIAL_OUTPUT>,
280
+ streamTextArgs: AgentPrompt & StreamingTextArgs<AgentTools, TOOLS, OUTPUT>,
276
281
  /**
277
282
  * The {@link ContextOptions} and {@link StorageOptions}
278
283
  * options to use for fetching contextual messages and saving input/output messages.
@@ -289,7 +294,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
289
294
  * iterating over the text, streaming it over HTTP, etc.
290
295
  */
291
296
  saveStreamDeltas?: boolean | StreamingOptions;
292
- }): Promise<StreamTextResult<TOOLS extends undefined ? AgentTools : TOOLS, PARTIAL_OUTPUT> & GenerationOutputMetadata>;
297
+ }): Promise<StreamTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
293
298
  /**
294
299
  * This behaves like {@link generateObject} from the "ai" package except that
295
300
  * it add context based on the userId and threadId and saves the input and
@@ -369,15 +374,17 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
369
374
  text: string;
370
375
  } | {
371
376
  providerOptions?: Record<string, Record<string, any>> | undefined;
377
+ mediaType?: string | undefined;
372
378
  mimeType?: string | undefined;
373
379
  type: "image";
374
380
  image: string | ArrayBuffer;
375
381
  } | {
376
382
  providerOptions?: Record<string, Record<string, any>> | undefined;
377
383
  providerMetadata?: Record<string, Record<string, any>> | undefined;
384
+ mediaType?: string | undefined;
385
+ mimeType?: string | undefined;
378
386
  filename?: string | undefined;
379
387
  type: "file";
380
- mimeType: string;
381
388
  data: string | ArrayBuffer;
382
389
  })[];
383
390
  } | {
@@ -391,9 +398,10 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
391
398
  } | {
392
399
  providerOptions?: Record<string, Record<string, any>> | undefined;
393
400
  providerMetadata?: Record<string, Record<string, any>> | undefined;
401
+ mediaType?: string | undefined;
402
+ mimeType?: string | undefined;
394
403
  filename?: string | undefined;
395
404
  type: "file";
396
- mimeType: string;
397
405
  data: string | ArrayBuffer;
398
406
  } | {
399
407
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -409,6 +417,16 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
409
417
  } | {
410
418
  providerOptions?: Record<string, Record<string, any>> | undefined;
411
419
  providerMetadata?: Record<string, Record<string, any>> | undefined;
420
+ args?: any;
421
+ providerExecuted?: boolean | undefined;
422
+ type: "tool-call";
423
+ toolCallId: string;
424
+ toolName: string;
425
+ input: any;
426
+ } | {
427
+ providerOptions?: Record<string, Record<string, any>> | undefined;
428
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
429
+ input?: any;
412
430
  providerExecuted?: boolean | undefined;
413
431
  type: "tool-call";
414
432
  toolCallId: string;
@@ -420,26 +438,65 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
420
438
  args?: any;
421
439
  providerExecuted?: boolean | undefined;
422
440
  output?: {
441
+ providerOptions?: Record<string, Record<string, any>> | undefined;
423
442
  type: "text";
424
443
  value: string;
425
444
  } | {
445
+ providerOptions?: Record<string, Record<string, any>> | undefined;
426
446
  type: "json";
427
447
  value: any;
428
448
  } | {
449
+ providerOptions?: Record<string, Record<string, any>> | undefined;
429
450
  type: "error-text";
430
451
  value: string;
431
452
  } | {
453
+ providerOptions?: Record<string, Record<string, any>> | undefined;
432
454
  type: "error-json";
433
455
  value: any;
456
+ } | {
457
+ providerOptions?: Record<string, Record<string, any>> | undefined;
458
+ reason?: string | undefined;
459
+ type: "execution-denied";
434
460
  } | {
435
461
  type: "content";
436
462
  value: ({
463
+ providerOptions?: Record<string, Record<string, any>> | undefined;
437
464
  type: "text";
438
465
  text: string;
439
466
  } | {
440
467
  type: "media";
468
+ mediaType: string;
441
469
  data: string;
470
+ } | {
471
+ providerOptions?: Record<string, Record<string, any>> | undefined;
472
+ filename?: string | undefined;
473
+ type: "file-data";
442
474
  mediaType: string;
475
+ data: string;
476
+ } | {
477
+ providerOptions?: Record<string, Record<string, any>> | undefined;
478
+ type: "file-url";
479
+ url: string;
480
+ } | {
481
+ providerOptions?: Record<string, Record<string, any>> | undefined;
482
+ type: "file-id";
483
+ fileId: string | Record<string, string>;
484
+ } | {
485
+ providerOptions?: Record<string, Record<string, any>> | undefined;
486
+ type: "image-data";
487
+ mediaType: string;
488
+ data: string;
489
+ } | {
490
+ providerOptions?: Record<string, Record<string, any>> | undefined;
491
+ type: "image-url";
492
+ url: string;
493
+ } | {
494
+ providerOptions?: Record<string, Record<string, any>> | undefined;
495
+ type: "image-file-id";
496
+ fileId: string | Record<string, string>;
497
+ } | {
498
+ providerOptions?: Record<string, Record<string, any>> | undefined;
499
+ type: "custom";
443
500
  })[];
444
501
  } | undefined;
445
502
  result?: any;
@@ -461,8 +518,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
461
518
  providerMetadata?: Record<string, Record<string, any>> | undefined;
462
519
  id: string;
463
520
  type: "source";
464
- sourceType: "url";
465
521
  url: string;
522
+ sourceType: "url";
466
523
  } | {
467
524
  providerOptions?: Record<string, Record<string, any>> | undefined;
468
525
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -472,36 +529,81 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
472
529
  type: "source";
473
530
  mediaType: string;
474
531
  sourceType: "document";
532
+ } | {
533
+ providerOptions?: Record<string, Record<string, any>> | undefined;
534
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
535
+ type: "tool-approval-request";
536
+ toolCallId: string;
537
+ approvalId: string;
475
538
  })[];
476
539
  } | {
477
540
  providerOptions?: Record<string, Record<string, any>> | undefined;
478
541
  role: "tool";
479
- content: {
542
+ content: ({
480
543
  providerOptions?: Record<string, Record<string, any>> | undefined;
481
544
  providerMetadata?: Record<string, Record<string, any>> | undefined;
482
545
  args?: any;
483
546
  providerExecuted?: boolean | undefined;
484
547
  output?: {
548
+ providerOptions?: Record<string, Record<string, any>> | undefined;
485
549
  type: "text";
486
550
  value: string;
487
551
  } | {
552
+ providerOptions?: Record<string, Record<string, any>> | undefined;
488
553
  type: "json";
489
554
  value: any;
490
555
  } | {
556
+ providerOptions?: Record<string, Record<string, any>> | undefined;
491
557
  type: "error-text";
492
558
  value: string;
493
559
  } | {
560
+ providerOptions?: Record<string, Record<string, any>> | undefined;
494
561
  type: "error-json";
495
562
  value: any;
563
+ } | {
564
+ providerOptions?: Record<string, Record<string, any>> | undefined;
565
+ reason?: string | undefined;
566
+ type: "execution-denied";
496
567
  } | {
497
568
  type: "content";
498
569
  value: ({
570
+ providerOptions?: Record<string, Record<string, any>> | undefined;
499
571
  type: "text";
500
572
  text: string;
501
573
  } | {
502
574
  type: "media";
575
+ mediaType: string;
503
576
  data: string;
577
+ } | {
578
+ providerOptions?: Record<string, Record<string, any>> | undefined;
579
+ filename?: string | undefined;
580
+ type: "file-data";
504
581
  mediaType: string;
582
+ data: string;
583
+ } | {
584
+ providerOptions?: Record<string, Record<string, any>> | undefined;
585
+ type: "file-url";
586
+ url: string;
587
+ } | {
588
+ providerOptions?: Record<string, Record<string, any>> | undefined;
589
+ type: "file-id";
590
+ fileId: string | Record<string, string>;
591
+ } | {
592
+ providerOptions?: Record<string, Record<string, any>> | undefined;
593
+ type: "image-data";
594
+ mediaType: string;
595
+ data: string;
596
+ } | {
597
+ providerOptions?: Record<string, Record<string, any>> | undefined;
598
+ type: "image-url";
599
+ url: string;
600
+ } | {
601
+ providerOptions?: Record<string, Record<string, any>> | undefined;
602
+ type: "image-file-id";
603
+ fileId: string | Record<string, string>;
604
+ } | {
605
+ providerOptions?: Record<string, Record<string, any>> | undefined;
606
+ type: "custom";
505
607
  })[];
506
608
  } | undefined;
507
609
  result?: any;
@@ -517,7 +619,15 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
517
619
  type: "tool-result";
518
620
  toolCallId: string;
519
621
  toolName: string;
520
- }[];
622
+ } | {
623
+ providerOptions?: Record<string, Record<string, any>> | undefined;
624
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
625
+ providerExecuted?: boolean | undefined;
626
+ reason?: string | undefined;
627
+ type: "tool-approval-response";
628
+ approvalId: string;
629
+ approved: boolean;
630
+ })[];
521
631
  } | {
522
632
  providerOptions?: Record<string, Record<string, any>> | undefined;
523
633
  role: "system";
@@ -539,8 +649,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
539
649
  providerOptions?: Record<string, Record<string, any>> | undefined;
540
650
  providerMetadata?: Record<string, Record<string, any>> | undefined;
541
651
  id: string;
542
- sourceType: "url";
543
652
  url: string;
653
+ sourceType: "url";
544
654
  } | {
545
655
  providerOptions?: Record<string, Record<string, any>> | undefined;
546
656
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -563,7 +673,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
563
673
  type: "other";
564
674
  message: string;
565
675
  })[] | undefined;
566
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
676
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
567
677
  reasoningDetails?: ({
568
678
  providerOptions?: Record<string, Record<string, any>> | undefined;
569
679
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -578,13 +688,13 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
578
688
  type: "redacted";
579
689
  data: string;
580
690
  })[] | undefined;
581
- _id: string;
582
- _creationTime: number;
583
691
  status: "pending" | "success" | "failed";
584
692
  order: number;
693
+ _creationTime: number;
585
694
  threadId: string;
586
695
  stepOrder: number;
587
696
  tool: boolean;
697
+ _id: string;
588
698
  };
589
699
  }>;
590
700
  /**
@@ -952,15 +1062,17 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
952
1062
  text: string;
953
1063
  } | {
954
1064
  providerOptions?: Record<string, Record<string, any>> | undefined;
1065
+ mediaType?: string | undefined;
955
1066
  mimeType?: string | undefined;
956
1067
  type: "image";
957
1068
  image: string | ArrayBuffer;
958
1069
  } | {
959
1070
  providerOptions?: Record<string, Record<string, any>> | undefined;
960
1071
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1072
+ mediaType?: string | undefined;
1073
+ mimeType?: string | undefined;
961
1074
  filename?: string | undefined;
962
1075
  type: "file";
963
- mimeType: string;
964
1076
  data: string | ArrayBuffer;
965
1077
  })[];
966
1078
  } | {
@@ -974,9 +1086,10 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
974
1086
  } | {
975
1087
  providerOptions?: Record<string, Record<string, any>> | undefined;
976
1088
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1089
+ mediaType?: string | undefined;
1090
+ mimeType?: string | undefined;
977
1091
  filename?: string | undefined;
978
1092
  type: "file";
979
- mimeType: string;
980
1093
  data: string | ArrayBuffer;
981
1094
  } | {
982
1095
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -992,6 +1105,16 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
992
1105
  } | {
993
1106
  providerOptions?: Record<string, Record<string, any>> | undefined;
994
1107
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1108
+ args?: any;
1109
+ providerExecuted?: boolean | undefined;
1110
+ type: "tool-call";
1111
+ toolCallId: string;
1112
+ toolName: string;
1113
+ input: any;
1114
+ } | {
1115
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1116
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1117
+ input?: any;
995
1118
  providerExecuted?: boolean | undefined;
996
1119
  type: "tool-call";
997
1120
  toolCallId: string;
@@ -1003,26 +1126,65 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1003
1126
  args?: any;
1004
1127
  providerExecuted?: boolean | undefined;
1005
1128
  output?: {
1129
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1006
1130
  type: "text";
1007
1131
  value: string;
1008
1132
  } | {
1133
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1009
1134
  type: "json";
1010
1135
  value: any;
1011
1136
  } | {
1137
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1012
1138
  type: "error-text";
1013
1139
  value: string;
1014
1140
  } | {
1141
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1015
1142
  type: "error-json";
1016
1143
  value: any;
1144
+ } | {
1145
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1146
+ reason?: string | undefined;
1147
+ type: "execution-denied";
1017
1148
  } | {
1018
1149
  type: "content";
1019
1150
  value: ({
1151
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1020
1152
  type: "text";
1021
1153
  text: string;
1022
1154
  } | {
1023
1155
  type: "media";
1156
+ mediaType: string;
1024
1157
  data: string;
1158
+ } | {
1159
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1160
+ filename?: string | undefined;
1161
+ type: "file-data";
1025
1162
  mediaType: string;
1163
+ data: string;
1164
+ } | {
1165
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1166
+ type: "file-url";
1167
+ url: string;
1168
+ } | {
1169
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1170
+ type: "file-id";
1171
+ fileId: string | Record<string, string>;
1172
+ } | {
1173
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1174
+ type: "image-data";
1175
+ mediaType: string;
1176
+ data: string;
1177
+ } | {
1178
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1179
+ type: "image-url";
1180
+ url: string;
1181
+ } | {
1182
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1183
+ type: "image-file-id";
1184
+ fileId: string | Record<string, string>;
1185
+ } | {
1186
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1187
+ type: "custom";
1026
1188
  })[];
1027
1189
  } | undefined;
1028
1190
  result?: any;
@@ -1044,8 +1206,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1044
1206
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1045
1207
  id: string;
1046
1208
  type: "source";
1047
- sourceType: "url";
1048
1209
  url: string;
1210
+ sourceType: "url";
1049
1211
  } | {
1050
1212
  providerOptions?: Record<string, Record<string, any>> | undefined;
1051
1213
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1055,36 +1217,81 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1055
1217
  type: "source";
1056
1218
  mediaType: string;
1057
1219
  sourceType: "document";
1220
+ } | {
1221
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1222
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1223
+ type: "tool-approval-request";
1224
+ toolCallId: string;
1225
+ approvalId: string;
1058
1226
  })[];
1059
1227
  } | {
1060
1228
  providerOptions?: Record<string, Record<string, any>> | undefined;
1061
1229
  role: "tool";
1062
- content: {
1230
+ content: ({
1063
1231
  providerOptions?: Record<string, Record<string, any>> | undefined;
1064
1232
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1065
1233
  args?: any;
1066
1234
  providerExecuted?: boolean | undefined;
1067
1235
  output?: {
1236
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1068
1237
  type: "text";
1069
1238
  value: string;
1070
1239
  } | {
1240
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1071
1241
  type: "json";
1072
1242
  value: any;
1073
1243
  } | {
1244
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1074
1245
  type: "error-text";
1075
1246
  value: string;
1076
1247
  } | {
1248
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1077
1249
  type: "error-json";
1078
1250
  value: any;
1251
+ } | {
1252
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1253
+ reason?: string | undefined;
1254
+ type: "execution-denied";
1079
1255
  } | {
1080
1256
  type: "content";
1081
1257
  value: ({
1258
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1082
1259
  type: "text";
1083
1260
  text: string;
1084
1261
  } | {
1085
1262
  type: "media";
1263
+ mediaType: string;
1086
1264
  data: string;
1265
+ } | {
1266
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1267
+ filename?: string | undefined;
1268
+ type: "file-data";
1087
1269
  mediaType: string;
1270
+ data: string;
1271
+ } | {
1272
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1273
+ type: "file-url";
1274
+ url: string;
1275
+ } | {
1276
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1277
+ type: "file-id";
1278
+ fileId: string | Record<string, string>;
1279
+ } | {
1280
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1281
+ type: "image-data";
1282
+ mediaType: string;
1283
+ data: string;
1284
+ } | {
1285
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1286
+ type: "image-url";
1287
+ url: string;
1288
+ } | {
1289
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1290
+ type: "image-file-id";
1291
+ fileId: string | Record<string, string>;
1292
+ } | {
1293
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1294
+ type: "custom";
1088
1295
  })[];
1089
1296
  } | undefined;
1090
1297
  result?: any;
@@ -1100,7 +1307,15 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1100
1307
  type: "tool-result";
1101
1308
  toolCallId: string;
1102
1309
  toolName: string;
1103
- }[];
1310
+ } | {
1311
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1312
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1313
+ providerExecuted?: boolean | undefined;
1314
+ reason?: string | undefined;
1315
+ type: "tool-approval-response";
1316
+ approvalId: string;
1317
+ approved: boolean;
1318
+ })[];
1104
1319
  } | {
1105
1320
  providerOptions?: Record<string, Record<string, any>> | undefined;
1106
1321
  role: "system";
@@ -1149,8 +1364,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1149
1364
  text: string;
1150
1365
  promptMessageId: string | undefined;
1151
1366
  order: number | undefined;
1152
- finishReason: import("@ai-sdk/provider").LanguageModelV2FinishReason;
1153
- warnings: import("@ai-sdk/provider").LanguageModelV2CallWarning[] | undefined;
1367
+ finishReason: import("ai").FinishReason;
1368
+ warnings: import("@ai-sdk/provider").SharedV3Warning[] | undefined;
1154
1369
  savedMessageIds: string[];
1155
1370
  }>>;
1156
1371
  /**
@@ -1175,15 +1390,17 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1175
1390
  text: string;
1176
1391
  } | {
1177
1392
  providerOptions?: Record<string, Record<string, any>> | undefined;
1393
+ mediaType?: string | undefined;
1178
1394
  mimeType?: string | undefined;
1179
1395
  type: "image";
1180
1396
  image: string | ArrayBuffer;
1181
1397
  } | {
1182
1398
  providerOptions?: Record<string, Record<string, any>> | undefined;
1183
1399
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1400
+ mediaType?: string | undefined;
1401
+ mimeType?: string | undefined;
1184
1402
  filename?: string | undefined;
1185
1403
  type: "file";
1186
- mimeType: string;
1187
1404
  data: string | ArrayBuffer;
1188
1405
  })[];
1189
1406
  } | {
@@ -1197,9 +1414,10 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1197
1414
  } | {
1198
1415
  providerOptions?: Record<string, Record<string, any>> | undefined;
1199
1416
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1417
+ mediaType?: string | undefined;
1418
+ mimeType?: string | undefined;
1200
1419
  filename?: string | undefined;
1201
1420
  type: "file";
1202
- mimeType: string;
1203
1421
  data: string | ArrayBuffer;
1204
1422
  } | {
1205
1423
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -1215,6 +1433,16 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1215
1433
  } | {
1216
1434
  providerOptions?: Record<string, Record<string, any>> | undefined;
1217
1435
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1436
+ args?: any;
1437
+ providerExecuted?: boolean | undefined;
1438
+ type: "tool-call";
1439
+ toolCallId: string;
1440
+ toolName: string;
1441
+ input: any;
1442
+ } | {
1443
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1444
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1445
+ input?: any;
1218
1446
  providerExecuted?: boolean | undefined;
1219
1447
  type: "tool-call";
1220
1448
  toolCallId: string;
@@ -1226,26 +1454,65 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1226
1454
  args?: any;
1227
1455
  providerExecuted?: boolean | undefined;
1228
1456
  output?: {
1457
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1229
1458
  type: "text";
1230
1459
  value: string;
1231
1460
  } | {
1461
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1232
1462
  type: "json";
1233
1463
  value: any;
1234
1464
  } | {
1465
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1235
1466
  type: "error-text";
1236
1467
  value: string;
1237
1468
  } | {
1469
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1238
1470
  type: "error-json";
1239
1471
  value: any;
1472
+ } | {
1473
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1474
+ reason?: string | undefined;
1475
+ type: "execution-denied";
1240
1476
  } | {
1241
1477
  type: "content";
1242
1478
  value: ({
1479
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1243
1480
  type: "text";
1244
1481
  text: string;
1245
1482
  } | {
1246
1483
  type: "media";
1484
+ mediaType: string;
1247
1485
  data: string;
1486
+ } | {
1487
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1488
+ filename?: string | undefined;
1489
+ type: "file-data";
1248
1490
  mediaType: string;
1491
+ data: string;
1492
+ } | {
1493
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1494
+ type: "file-url";
1495
+ url: string;
1496
+ } | {
1497
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1498
+ type: "file-id";
1499
+ fileId: string | Record<string, string>;
1500
+ } | {
1501
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1502
+ type: "image-data";
1503
+ mediaType: string;
1504
+ data: string;
1505
+ } | {
1506
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1507
+ type: "image-url";
1508
+ url: string;
1509
+ } | {
1510
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1511
+ type: "image-file-id";
1512
+ fileId: string | Record<string, string>;
1513
+ } | {
1514
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1515
+ type: "custom";
1249
1516
  })[];
1250
1517
  } | undefined;
1251
1518
  result?: any;
@@ -1267,8 +1534,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1267
1534
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1268
1535
  id: string;
1269
1536
  type: "source";
1270
- sourceType: "url";
1271
1537
  url: string;
1538
+ sourceType: "url";
1272
1539
  } | {
1273
1540
  providerOptions?: Record<string, Record<string, any>> | undefined;
1274
1541
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1278,36 +1545,81 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1278
1545
  type: "source";
1279
1546
  mediaType: string;
1280
1547
  sourceType: "document";
1548
+ } | {
1549
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1550
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1551
+ type: "tool-approval-request";
1552
+ toolCallId: string;
1553
+ approvalId: string;
1281
1554
  })[];
1282
1555
  } | {
1283
1556
  providerOptions?: Record<string, Record<string, any>> | undefined;
1284
1557
  role: "tool";
1285
- content: {
1558
+ content: ({
1286
1559
  providerOptions?: Record<string, Record<string, any>> | undefined;
1287
1560
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1288
1561
  args?: any;
1289
1562
  providerExecuted?: boolean | undefined;
1290
1563
  output?: {
1564
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1291
1565
  type: "text";
1292
1566
  value: string;
1293
1567
  } | {
1568
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1294
1569
  type: "json";
1295
1570
  value: any;
1296
1571
  } | {
1572
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1297
1573
  type: "error-text";
1298
1574
  value: string;
1299
1575
  } | {
1576
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1300
1577
  type: "error-json";
1301
1578
  value: any;
1579
+ } | {
1580
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1581
+ reason?: string | undefined;
1582
+ type: "execution-denied";
1302
1583
  } | {
1303
1584
  type: "content";
1304
1585
  value: ({
1586
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1305
1587
  type: "text";
1306
1588
  text: string;
1307
1589
  } | {
1308
1590
  type: "media";
1591
+ mediaType: string;
1309
1592
  data: string;
1593
+ } | {
1594
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1595
+ filename?: string | undefined;
1596
+ type: "file-data";
1310
1597
  mediaType: string;
1598
+ data: string;
1599
+ } | {
1600
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1601
+ type: "file-url";
1602
+ url: string;
1603
+ } | {
1604
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1605
+ type: "file-id";
1606
+ fileId: string | Record<string, string>;
1607
+ } | {
1608
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1609
+ type: "image-data";
1610
+ mediaType: string;
1611
+ data: string;
1612
+ } | {
1613
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1614
+ type: "image-url";
1615
+ url: string;
1616
+ } | {
1617
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1618
+ type: "image-file-id";
1619
+ fileId: string | Record<string, string>;
1620
+ } | {
1621
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1622
+ type: "custom";
1311
1623
  })[];
1312
1624
  } | undefined;
1313
1625
  result?: any;
@@ -1323,7 +1635,15 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1323
1635
  type: "tool-result";
1324
1636
  toolCallId: string;
1325
1637
  toolName: string;
1326
- }[];
1638
+ } | {
1639
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1640
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1641
+ providerExecuted?: boolean | undefined;
1642
+ reason?: string | undefined;
1643
+ type: "tool-approval-response";
1644
+ approvalId: string;
1645
+ approved: boolean;
1646
+ })[];
1327
1647
  } | {
1328
1648
  providerOptions?: Record<string, Record<string, any>> | undefined;
1329
1649
  role: "system";
@@ -1365,8 +1685,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1365
1685
  object: T;
1366
1686
  promptMessageId: string | undefined;
1367
1687
  order: number | undefined;
1368
- finishReason: import("@ai-sdk/provider").LanguageModelV2FinishReason;
1369
- warnings: import("@ai-sdk/provider").LanguageModelV2CallWarning[] | undefined;
1688
+ finishReason: import("ai").FinishReason;
1689
+ warnings: import("@ai-sdk/provider").SharedV3Warning[] | undefined;
1370
1690
  savedMessageIds: string[];
1371
1691
  }>>;
1372
1692
  /**
@@ -1403,8 +1723,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1403
1723
  providerOptions?: Record<string, Record<string, any>> | undefined;
1404
1724
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1405
1725
  id: string;
1406
- sourceType: "url";
1407
1726
  url: string;
1727
+ sourceType: "url";
1408
1728
  } | {
1409
1729
  providerOptions?: Record<string, Record<string, any>> | undefined;
1410
1730
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1427,7 +1747,7 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1427
1747
  type: "other";
1428
1748
  message: string;
1429
1749
  })[] | undefined;
1430
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1750
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1431
1751
  reasoningDetails?: ({
1432
1752
  providerOptions?: Record<string, Record<string, any>> | undefined;
1433
1753
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1452,15 +1772,17 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1452
1772
  text: string;
1453
1773
  } | {
1454
1774
  providerOptions?: Record<string, Record<string, any>> | undefined;
1775
+ mediaType?: string | undefined;
1455
1776
  mimeType?: string | undefined;
1456
1777
  type: "image";
1457
1778
  image: string | ArrayBuffer;
1458
1779
  } | {
1459
1780
  providerOptions?: Record<string, Record<string, any>> | undefined;
1460
1781
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1782
+ mediaType?: string | undefined;
1783
+ mimeType?: string | undefined;
1461
1784
  filename?: string | undefined;
1462
1785
  type: "file";
1463
- mimeType: string;
1464
1786
  data: string | ArrayBuffer;
1465
1787
  })[];
1466
1788
  } | {
@@ -1474,9 +1796,10 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1474
1796
  } | {
1475
1797
  providerOptions?: Record<string, Record<string, any>> | undefined;
1476
1798
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1799
+ mediaType?: string | undefined;
1800
+ mimeType?: string | undefined;
1477
1801
  filename?: string | undefined;
1478
1802
  type: "file";
1479
- mimeType: string;
1480
1803
  data: string | ArrayBuffer;
1481
1804
  } | {
1482
1805
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -1492,6 +1815,16 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1492
1815
  } | {
1493
1816
  providerOptions?: Record<string, Record<string, any>> | undefined;
1494
1817
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1818
+ args?: any;
1819
+ providerExecuted?: boolean | undefined;
1820
+ type: "tool-call";
1821
+ toolCallId: string;
1822
+ toolName: string;
1823
+ input: any;
1824
+ } | {
1825
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1826
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1827
+ input?: any;
1495
1828
  providerExecuted?: boolean | undefined;
1496
1829
  type: "tool-call";
1497
1830
  toolCallId: string;
@@ -1503,26 +1836,65 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1503
1836
  args?: any;
1504
1837
  providerExecuted?: boolean | undefined;
1505
1838
  output?: {
1839
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1506
1840
  type: "text";
1507
1841
  value: string;
1508
1842
  } | {
1843
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1509
1844
  type: "json";
1510
1845
  value: any;
1511
1846
  } | {
1847
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1512
1848
  type: "error-text";
1513
1849
  value: string;
1514
1850
  } | {
1851
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1515
1852
  type: "error-json";
1516
1853
  value: any;
1854
+ } | {
1855
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1856
+ reason?: string | undefined;
1857
+ type: "execution-denied";
1517
1858
  } | {
1518
1859
  type: "content";
1519
1860
  value: ({
1861
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1520
1862
  type: "text";
1521
1863
  text: string;
1522
1864
  } | {
1523
1865
  type: "media";
1866
+ mediaType: string;
1524
1867
  data: string;
1868
+ } | {
1869
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1870
+ filename?: string | undefined;
1871
+ type: "file-data";
1525
1872
  mediaType: string;
1873
+ data: string;
1874
+ } | {
1875
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1876
+ type: "file-url";
1877
+ url: string;
1878
+ } | {
1879
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1880
+ type: "file-id";
1881
+ fileId: string | Record<string, string>;
1882
+ } | {
1883
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1884
+ type: "image-data";
1885
+ mediaType: string;
1886
+ data: string;
1887
+ } | {
1888
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1889
+ type: "image-url";
1890
+ url: string;
1891
+ } | {
1892
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1893
+ type: "image-file-id";
1894
+ fileId: string | Record<string, string>;
1895
+ } | {
1896
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1897
+ type: "custom";
1526
1898
  })[];
1527
1899
  } | undefined;
1528
1900
  result?: any;
@@ -1544,8 +1916,8 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1544
1916
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1545
1917
  id: string;
1546
1918
  type: "source";
1547
- sourceType: "url";
1548
1919
  url: string;
1920
+ sourceType: "url";
1549
1921
  } | {
1550
1922
  providerOptions?: Record<string, Record<string, any>> | undefined;
1551
1923
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1555,36 +1927,81 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1555
1927
  type: "source";
1556
1928
  mediaType: string;
1557
1929
  sourceType: "document";
1930
+ } | {
1931
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1932
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1933
+ type: "tool-approval-request";
1934
+ toolCallId: string;
1935
+ approvalId: string;
1558
1936
  })[];
1559
1937
  } | {
1560
1938
  providerOptions?: Record<string, Record<string, any>> | undefined;
1561
1939
  role: "tool";
1562
- content: {
1940
+ content: ({
1563
1941
  providerOptions?: Record<string, Record<string, any>> | undefined;
1564
1942
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1565
1943
  args?: any;
1566
1944
  providerExecuted?: boolean | undefined;
1567
1945
  output?: {
1946
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1568
1947
  type: "text";
1569
1948
  value: string;
1570
1949
  } | {
1950
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1571
1951
  type: "json";
1572
1952
  value: any;
1573
1953
  } | {
1954
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1574
1955
  type: "error-text";
1575
1956
  value: string;
1576
1957
  } | {
1958
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1577
1959
  type: "error-json";
1578
1960
  value: any;
1961
+ } | {
1962
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1963
+ reason?: string | undefined;
1964
+ type: "execution-denied";
1579
1965
  } | {
1580
1966
  type: "content";
1581
1967
  value: ({
1968
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1582
1969
  type: "text";
1583
1970
  text: string;
1584
1971
  } | {
1585
1972
  type: "media";
1973
+ mediaType: string;
1974
+ data: string;
1975
+ } | {
1976
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1977
+ filename?: string | undefined;
1978
+ type: "file-data";
1979
+ mediaType: string;
1586
1980
  data: string;
1981
+ } | {
1982
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1983
+ type: "file-url";
1984
+ url: string;
1985
+ } | {
1986
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1987
+ type: "file-id";
1988
+ fileId: string | Record<string, string>;
1989
+ } | {
1990
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1991
+ type: "image-data";
1587
1992
  mediaType: string;
1993
+ data: string;
1994
+ } | {
1995
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1996
+ type: "image-url";
1997
+ url: string;
1998
+ } | {
1999
+ providerOptions?: Record<string, Record<string, any>> | undefined;
2000
+ type: "image-file-id";
2001
+ fileId: string | Record<string, string>;
2002
+ } | {
2003
+ providerOptions?: Record<string, Record<string, any>> | undefined;
2004
+ type: "custom";
1588
2005
  })[];
1589
2006
  } | undefined;
1590
2007
  result?: any;
@@ -1600,7 +2017,15 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1600
2017
  type: "tool-result";
1601
2018
  toolCallId: string;
1602
2019
  toolName: string;
1603
- }[];
2020
+ } | {
2021
+ providerOptions?: Record<string, Record<string, any>> | undefined;
2022
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
2023
+ providerExecuted?: boolean | undefined;
2024
+ reason?: string | undefined;
2025
+ type: "tool-approval-response";
2026
+ approvalId: string;
2027
+ approved: boolean;
2028
+ })[];
1604
2029
  } | {
1605
2030
  providerOptions?: Record<string, Record<string, any>> | undefined;
1606
2031
  role: "system";
@@ -1610,9 +2035,9 @@ CustomCtx extends object = object, AgentTools extends ToolSet = any> {
1610
2035
  }, Promise<{
1611
2036
  lastMessageId: string;
1612
2037
  messages: {
1613
- _id: string;
1614
2038
  order: number;
1615
2039
  stepOrder: number;
2040
+ _id: string;
1616
2041
  }[];
1617
2042
  }>>;
1618
2043
  }