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

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 (66) hide show
  1. package/MIGRATION.md +153 -0
  2. package/dist/client/createTool.d.ts +18 -21
  3. package/dist/client/createTool.d.ts.map +1 -1
  4. package/dist/client/createTool.js +3 -2
  5. package/dist/client/createTool.js.map +1 -1
  6. package/dist/client/definePlaygroundAPI.d.ts +48 -48
  7. package/dist/client/index.d.ts +109 -62
  8. package/dist/client/index.d.ts.map +1 -1
  9. package/dist/client/index.js +92 -1
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/client/messages.d.ts +12 -12
  12. package/dist/client/mockModel.d.ts.map +1 -1
  13. package/dist/client/mockModel.js +9 -2
  14. package/dist/client/mockModel.js.map +1 -1
  15. package/dist/client/search.d.ts +12 -12
  16. package/dist/client/search.d.ts.map +1 -1
  17. package/dist/client/search.js +3 -3
  18. package/dist/client/search.js.map +1 -1
  19. package/dist/client/start.d.ts +1 -1
  20. package/dist/client/start.d.ts.map +1 -1
  21. package/dist/client/start.js +28 -14
  22. package/dist/client/start.js.map +1 -1
  23. package/dist/client/streamText.d.ts.map +1 -1
  24. package/dist/client/streamText.js +27 -3
  25. package/dist/client/streamText.js.map +1 -1
  26. package/dist/client/streaming.d.ts +105 -94
  27. package/dist/client/streaming.d.ts.map +1 -1
  28. package/dist/client/streaming.js +28 -8
  29. package/dist/client/streaming.js.map +1 -1
  30. package/dist/client/types.d.ts +13 -12
  31. package/dist/client/types.d.ts.map +1 -1
  32. package/dist/component/_generated/component.d.ts +1 -0
  33. package/dist/component/_generated/component.d.ts.map +1 -1
  34. package/dist/component/messages.d.ts +143 -142
  35. package/dist/component/messages.d.ts.map +1 -1
  36. package/dist/component/messages.js +13 -3
  37. package/dist/component/messages.js.map +1 -1
  38. package/dist/component/streams.d.ts +5 -5
  39. package/dist/component/threads.d.ts +19 -19
  40. package/dist/component/users.d.ts +3 -3
  41. package/dist/deltas.d.ts.map +1 -1
  42. package/dist/deltas.js +0 -1
  43. package/dist/deltas.js.map +1 -1
  44. package/dist/mapping.d.ts +19 -1
  45. package/dist/mapping.d.ts.map +1 -1
  46. package/dist/mapping.js +57 -6
  47. package/dist/mapping.js.map +1 -1
  48. package/dist/react/useDeltaStreams.d.ts.map +1 -1
  49. package/dist/react/useDeltaStreams.js +5 -0
  50. package/dist/react/useDeltaStreams.js.map +1 -1
  51. package/package.json +4 -2
  52. package/src/client/approval.test.ts +350 -0
  53. package/src/client/createTool.ts +50 -52
  54. package/src/client/index.ts +120 -1
  55. package/src/client/mockModel.ts +9 -2
  56. package/src/client/search.ts +7 -3
  57. package/src/client/start.ts +41 -24
  58. package/src/client/streamText.ts +27 -3
  59. package/src/client/streaming.ts +33 -11
  60. package/src/client/types.ts +14 -12
  61. package/src/component/_generated/component.ts +53 -64
  62. package/src/component/messages.ts +12 -2
  63. package/src/deltas.ts +0 -1
  64. package/src/mapping.test.ts +77 -0
  65. package/src/mapping.ts +62 -6
  66. package/src/react/useDeltaStreams.ts +6 -0
@@ -12,24 +12,25 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
12
12
  provider?: string | undefined;
13
13
  providerOptions?: Record<string, Record<string, any>> | undefined;
14
14
  format?: "UIMessageChunk" | "TextStreamPart" | undefined;
15
- status: "streaming" | "finished" | "aborted";
16
15
  order: number;
17
16
  stepOrder: number;
17
+ status: "aborted" | "streaming" | "finished";
18
18
  streamId: string;
19
19
  }[];
20
20
  kind: "list";
21
21
  } | {
22
- kind: "deltas";
23
22
  deltas: {
24
23
  streamId: string;
25
24
  start: number;
26
25
  end: number;
27
26
  parts: any[];
28
27
  }[];
28
+ kind: "deltas";
29
29
  } | undefined;
30
+ isDone: boolean;
30
31
  page: {
31
- id?: string | undefined;
32
32
  userId?: string | undefined;
33
+ id?: string | undefined;
33
34
  embeddingId?: string | undefined;
34
35
  fileIds?: string[] | undefined;
35
36
  error?: string | undefined;
@@ -186,22 +187,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
186
187
  toolCallId: string;
187
188
  toolName: string;
188
189
  } | {
189
- title?: string | undefined;
190
190
  providerOptions?: Record<string, Record<string, any>> | undefined;
191
191
  providerMetadata?: Record<string, Record<string, any>> | undefined;
192
- id: string;
192
+ title?: string | undefined;
193
193
  type: "source";
194
+ id: string;
194
195
  url: string;
195
196
  sourceType: "url";
196
197
  } | {
197
198
  providerOptions?: Record<string, Record<string, any>> | undefined;
198
199
  providerMetadata?: Record<string, Record<string, any>> | undefined;
199
200
  filename?: string | undefined;
200
- id: string;
201
- title: string;
202
201
  type: "source";
202
+ id: string;
203
203
  mediaType: string;
204
204
  sourceType: "document";
205
+ title: string;
205
206
  } | {
206
207
  providerOptions?: Record<string, Record<string, any>> | undefined;
207
208
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -317,10 +318,10 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
317
318
  totalTokens: number;
318
319
  } | undefined;
319
320
  sources?: ({
320
- title?: string | undefined;
321
321
  type?: "source" | undefined;
322
322
  providerOptions?: Record<string, Record<string, any>> | undefined;
323
323
  providerMetadata?: Record<string, Record<string, any>> | undefined;
324
+ title?: string | undefined;
324
325
  id: string;
325
326
  url: string;
326
327
  sourceType: "url";
@@ -328,11 +329,11 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
328
329
  providerOptions?: Record<string, Record<string, any>> | undefined;
329
330
  providerMetadata?: Record<string, Record<string, any>> | undefined;
330
331
  filename?: string | undefined;
331
- id: string;
332
- title: string;
333
332
  type: "source";
333
+ id: string;
334
334
  mediaType: string;
335
335
  sourceType: "document";
336
+ title: string;
336
337
  })[] | undefined;
337
338
  warnings?: ({
338
339
  details?: string | undefined;
@@ -346,7 +347,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
346
347
  type: "other";
347
348
  message: string;
348
349
  })[] | undefined;
349
- finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
350
+ finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
350
351
  reasoningDetails?: ({
351
352
  providerOptions?: Record<string, Record<string, any>> | undefined;
352
353
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -361,16 +362,15 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
361
362
  type: "redacted";
362
363
  data: string;
363
364
  })[] | undefined;
364
- status: "pending" | "success" | "failed";
365
- order: number;
365
+ _id: string;
366
366
  _creationTime: number;
367
367
  threadId: string;
368
+ order: number;
368
369
  stepOrder: number;
370
+ status: "pending" | "success" | "failed";
369
371
  tool: boolean;
370
- _id: string;
371
372
  }[];
372
373
  continueCursor: string;
373
- isDone: boolean;
374
374
  }, {
375
375
  streams: import("convex/values").VUnion<{
376
376
  messages: {
@@ -380,20 +380,20 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
380
380
  provider?: string | undefined;
381
381
  providerOptions?: Record<string, Record<string, any>> | undefined;
382
382
  format?: "UIMessageChunk" | "TextStreamPart" | undefined;
383
- status: "streaming" | "finished" | "aborted";
384
383
  order: number;
385
384
  stepOrder: number;
385
+ status: "aborted" | "streaming" | "finished";
386
386
  streamId: string;
387
387
  }[];
388
388
  kind: "list";
389
389
  } | {
390
- kind: "deltas";
391
390
  deltas: {
392
391
  streamId: string;
393
392
  start: number;
394
393
  end: number;
395
394
  parts: any[];
396
395
  }[];
396
+ kind: "deltas";
397
397
  } | undefined, [import("convex/values").VObject<{
398
398
  messages: {
399
399
  userId?: string | undefined;
@@ -402,9 +402,9 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
402
402
  provider?: string | undefined;
403
403
  providerOptions?: Record<string, Record<string, any>> | undefined;
404
404
  format?: "UIMessageChunk" | "TextStreamPart" | undefined;
405
- status: "streaming" | "finished" | "aborted";
406
405
  order: number;
407
406
  stepOrder: number;
407
+ status: "aborted" | "streaming" | "finished";
408
408
  streamId: string;
409
409
  }[];
410
410
  kind: "list";
@@ -417,9 +417,9 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
417
417
  provider?: string | undefined;
418
418
  providerOptions?: Record<string, Record<string, any>> | undefined;
419
419
  format?: "UIMessageChunk" | "TextStreamPart" | undefined;
420
- status: "streaming" | "finished" | "aborted";
421
420
  order: number;
422
421
  stepOrder: number;
422
+ status: "aborted" | "streaming" | "finished";
423
423
  streamId: string;
424
424
  }[], import("convex/values").VObject<{
425
425
  userId?: string | undefined;
@@ -428,13 +428,13 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
428
428
  provider?: string | undefined;
429
429
  providerOptions?: Record<string, Record<string, any>> | undefined;
430
430
  format?: "UIMessageChunk" | "TextStreamPart" | undefined;
431
- status: "streaming" | "finished" | "aborted";
432
431
  order: number;
433
432
  stepOrder: number;
433
+ status: "aborted" | "streaming" | "finished";
434
434
  streamId: string;
435
435
  }, {
436
436
  streamId: import("convex/values").VString<string, "required">;
437
- status: import("convex/values").VUnion<"streaming" | "finished" | "aborted", [import("convex/values").VLiteral<"streaming", "required">, import("convex/values").VLiteral<"finished", "required">, import("convex/values").VLiteral<"aborted", "required">], "required", never>;
437
+ status: import("convex/values").VUnion<"aborted" | "streaming" | "finished", [import("convex/values").VLiteral<"streaming", "required">, import("convex/values").VLiteral<"finished", "required">, import("convex/values").VLiteral<"aborted", "required">], "required", never>;
438
438
  format: import("convex/values").VUnion<"UIMessageChunk" | "TextStreamPart" | undefined, [import("convex/values").VLiteral<"UIMessageChunk", "required">, import("convex/values").VLiteral<"TextStreamPart", "required">], "optional", never>;
439
439
  order: import("convex/values").VFloat64<number, "required">;
440
440
  stepOrder: import("convex/values").VFloat64<number, "required">;
@@ -443,15 +443,15 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
443
443
  model: import("convex/values").VString<string | undefined, "optional">;
444
444
  provider: import("convex/values").VString<string | undefined, "optional">;
445
445
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
446
- }, "required", "status" | "userId" | "order" | "stepOrder" | "agentName" | "model" | "provider" | "providerOptions" | `providerOptions.${string}` | "format" | "streamId">, "required">;
446
+ }, "required", "userId" | "order" | "stepOrder" | "status" | "agentName" | "model" | "provider" | "providerOptions" | `providerOptions.${string}` | "streamId" | "format">, "required">;
447
447
  }, "required", "messages" | "kind">, import("convex/values").VObject<{
448
- kind: "deltas";
449
448
  deltas: {
450
449
  streamId: string;
451
450
  start: number;
452
451
  end: number;
453
452
  parts: any[];
454
453
  }[];
454
+ kind: "deltas";
455
455
  }, {
456
456
  kind: import("convex/values").VLiteral<"deltas", "required">;
457
457
  deltas: import("convex/values").VArray<{
@@ -470,10 +470,10 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
470
470
  end: import("convex/values").VFloat64<number, "required">;
471
471
  parts: import("convex/values").VArray<any[], import("convex/values").VAny<any, "required", string>, "required">;
472
472
  }, "required", "streamId" | "start" | "end" | "parts">, "required">;
473
- }, "required", "kind" | "deltas">], "optional", "messages" | "kind" | "deltas">;
473
+ }, "required", "deltas" | "kind">], "optional", "messages" | "deltas" | "kind">;
474
474
  page: import("convex/values").VArray<{
475
- id?: string | undefined;
476
475
  userId?: string | undefined;
476
+ id?: string | undefined;
477
477
  embeddingId?: string | undefined;
478
478
  fileIds?: string[] | undefined;
479
479
  error?: string | undefined;
@@ -630,22 +630,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
630
630
  toolCallId: string;
631
631
  toolName: string;
632
632
  } | {
633
- title?: string | undefined;
634
633
  providerOptions?: Record<string, Record<string, any>> | undefined;
635
634
  providerMetadata?: Record<string, Record<string, any>> | undefined;
636
- id: string;
635
+ title?: string | undefined;
637
636
  type: "source";
637
+ id: string;
638
638
  url: string;
639
639
  sourceType: "url";
640
640
  } | {
641
641
  providerOptions?: Record<string, Record<string, any>> | undefined;
642
642
  providerMetadata?: Record<string, Record<string, any>> | undefined;
643
643
  filename?: string | undefined;
644
- id: string;
645
- title: string;
646
644
  type: "source";
645
+ id: string;
647
646
  mediaType: string;
648
647
  sourceType: "document";
648
+ title: string;
649
649
  } | {
650
650
  providerOptions?: Record<string, Record<string, any>> | undefined;
651
651
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -761,10 +761,10 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
761
761
  totalTokens: number;
762
762
  } | undefined;
763
763
  sources?: ({
764
- title?: string | undefined;
765
764
  type?: "source" | undefined;
766
765
  providerOptions?: Record<string, Record<string, any>> | undefined;
767
766
  providerMetadata?: Record<string, Record<string, any>> | undefined;
767
+ title?: string | undefined;
768
768
  id: string;
769
769
  url: string;
770
770
  sourceType: "url";
@@ -772,11 +772,11 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
772
772
  providerOptions?: Record<string, Record<string, any>> | undefined;
773
773
  providerMetadata?: Record<string, Record<string, any>> | undefined;
774
774
  filename?: string | undefined;
775
- id: string;
776
- title: string;
777
775
  type: "source";
776
+ id: string;
778
777
  mediaType: string;
779
778
  sourceType: "document";
779
+ title: string;
780
780
  })[] | undefined;
781
781
  warnings?: ({
782
782
  details?: string | undefined;
@@ -790,7 +790,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
790
790
  type: "other";
791
791
  message: string;
792
792
  })[] | undefined;
793
- finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
793
+ finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
794
794
  reasoningDetails?: ({
795
795
  providerOptions?: Record<string, Record<string, any>> | undefined;
796
796
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -805,16 +805,16 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
805
805
  type: "redacted";
806
806
  data: string;
807
807
  })[] | undefined;
808
- status: "pending" | "success" | "failed";
809
- order: number;
808
+ _id: string;
810
809
  _creationTime: number;
811
810
  threadId: string;
811
+ order: number;
812
812
  stepOrder: number;
813
+ status: "pending" | "success" | "failed";
813
814
  tool: boolean;
814
- _id: string;
815
815
  }[], import("convex/values").VObject<{
816
- id?: string | undefined;
817
816
  userId?: string | undefined;
817
+ id?: string | undefined;
818
818
  embeddingId?: string | undefined;
819
819
  fileIds?: string[] | undefined;
820
820
  error?: string | undefined;
@@ -971,22 +971,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
971
971
  toolCallId: string;
972
972
  toolName: string;
973
973
  } | {
974
- title?: string | undefined;
975
974
  providerOptions?: Record<string, Record<string, any>> | undefined;
976
975
  providerMetadata?: Record<string, Record<string, any>> | undefined;
977
- id: string;
976
+ title?: string | undefined;
978
977
  type: "source";
978
+ id: string;
979
979
  url: string;
980
980
  sourceType: "url";
981
981
  } | {
982
982
  providerOptions?: Record<string, Record<string, any>> | undefined;
983
983
  providerMetadata?: Record<string, Record<string, any>> | undefined;
984
984
  filename?: string | undefined;
985
- id: string;
986
- title: string;
987
985
  type: "source";
986
+ id: string;
988
987
  mediaType: string;
989
988
  sourceType: "document";
989
+ title: string;
990
990
  } | {
991
991
  providerOptions?: Record<string, Record<string, any>> | undefined;
992
992
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1102,10 +1102,10 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1102
1102
  totalTokens: number;
1103
1103
  } | undefined;
1104
1104
  sources?: ({
1105
- title?: string | undefined;
1106
1105
  type?: "source" | undefined;
1107
1106
  providerOptions?: Record<string, Record<string, any>> | undefined;
1108
1107
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1108
+ title?: string | undefined;
1109
1109
  id: string;
1110
1110
  url: string;
1111
1111
  sourceType: "url";
@@ -1113,11 +1113,11 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1113
1113
  providerOptions?: Record<string, Record<string, any>> | undefined;
1114
1114
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1115
1115
  filename?: string | undefined;
1116
- id: string;
1117
- title: string;
1118
1116
  type: "source";
1117
+ id: string;
1119
1118
  mediaType: string;
1120
1119
  sourceType: "document";
1120
+ title: string;
1121
1121
  })[] | undefined;
1122
1122
  warnings?: ({
1123
1123
  details?: string | undefined;
@@ -1131,7 +1131,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1131
1131
  type: "other";
1132
1132
  message: string;
1133
1133
  })[] | undefined;
1134
- finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1134
+ finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1135
1135
  reasoningDetails?: ({
1136
1136
  providerOptions?: Record<string, Record<string, any>> | undefined;
1137
1137
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1146,13 +1146,13 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1146
1146
  type: "redacted";
1147
1147
  data: string;
1148
1148
  })[] | undefined;
1149
- status: "pending" | "success" | "failed";
1150
- order: number;
1149
+ _id: string;
1151
1150
  _creationTime: number;
1152
1151
  threadId: string;
1152
+ order: number;
1153
1153
  stepOrder: number;
1154
+ status: "pending" | "success" | "failed";
1154
1155
  tool: boolean;
1155
- _id: string;
1156
1156
  }, {
1157
1157
  _id: import("convex/values").VString<string, "required">;
1158
1158
  _creationTime: import("convex/values").VFloat64<number, "required">;
@@ -1317,22 +1317,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1317
1317
  toolCallId: string;
1318
1318
  toolName: string;
1319
1319
  } | {
1320
- title?: string | undefined;
1321
1320
  providerOptions?: Record<string, Record<string, any>> | undefined;
1322
1321
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1323
- id: string;
1322
+ title?: string | undefined;
1324
1323
  type: "source";
1324
+ id: string;
1325
1325
  url: string;
1326
1326
  sourceType: "url";
1327
1327
  } | {
1328
1328
  providerOptions?: Record<string, Record<string, any>> | undefined;
1329
1329
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1330
1330
  filename?: string | undefined;
1331
- id: string;
1332
- title: string;
1333
1331
  type: "source";
1332
+ id: string;
1334
1333
  mediaType: string;
1335
1334
  sourceType: "document";
1335
+ title: string;
1336
1336
  } | {
1337
1337
  providerOptions?: Record<string, Record<string, any>> | undefined;
1338
1338
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1684,22 +1684,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1684
1684
  toolCallId: string;
1685
1685
  toolName: string;
1686
1686
  } | {
1687
- title?: string | undefined;
1688
1687
  providerOptions?: Record<string, Record<string, any>> | undefined;
1689
1688
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1690
- id: string;
1689
+ title?: string | undefined;
1691
1690
  type: "source";
1691
+ id: string;
1692
1692
  url: string;
1693
1693
  sourceType: "url";
1694
1694
  } | {
1695
1695
  providerOptions?: Record<string, Record<string, any>> | undefined;
1696
1696
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1697
1697
  filename?: string | undefined;
1698
- id: string;
1699
- title: string;
1700
1698
  type: "source";
1699
+ id: string;
1701
1700
  mediaType: string;
1702
1701
  sourceType: "document";
1702
+ title: string;
1703
1703
  } | {
1704
1704
  providerOptions?: Record<string, Record<string, any>> | undefined;
1705
1705
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1832,22 +1832,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1832
1832
  toolCallId: string;
1833
1833
  toolName: string;
1834
1834
  } | {
1835
- title?: string | undefined;
1836
1835
  providerOptions?: Record<string, Record<string, any>> | undefined;
1837
1836
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1838
- id: string;
1837
+ title?: string | undefined;
1839
1838
  type: "source";
1839
+ id: string;
1840
1840
  url: string;
1841
1841
  sourceType: "url";
1842
1842
  } | {
1843
1843
  providerOptions?: Record<string, Record<string, any>> | undefined;
1844
1844
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1845
1845
  filename?: string | undefined;
1846
- id: string;
1847
- title: string;
1848
1846
  type: "source";
1847
+ id: string;
1849
1848
  mediaType: string;
1850
1849
  sourceType: "document";
1850
+ title: string;
1851
1851
  } | {
1852
1852
  providerOptions?: Record<string, Record<string, any>> | undefined;
1853
1853
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -1977,22 +1977,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
1977
1977
  toolCallId: string;
1978
1978
  toolName: string;
1979
1979
  } | {
1980
- title?: string | undefined;
1981
1980
  providerOptions?: Record<string, Record<string, any>> | undefined;
1982
1981
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1983
- id: string;
1982
+ title?: string | undefined;
1984
1983
  type: "source";
1984
+ id: string;
1985
1985
  url: string;
1986
1986
  sourceType: "url";
1987
1987
  } | {
1988
1988
  providerOptions?: Record<string, Record<string, any>> | undefined;
1989
1989
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1990
1990
  filename?: string | undefined;
1991
- id: string;
1992
- title: string;
1993
1991
  type: "source";
1992
+ id: string;
1994
1993
  mediaType: string;
1995
1994
  sourceType: "document";
1995
+ title: string;
1996
1996
  } | {
1997
1997
  providerOptions?: Record<string, Record<string, any>> | undefined;
1998
1998
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -2122,22 +2122,22 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
2122
2122
  toolCallId: string;
2123
2123
  toolName: string;
2124
2124
  } | {
2125
- title?: string | undefined;
2126
2125
  providerOptions?: Record<string, Record<string, any>> | undefined;
2127
2126
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2128
- id: string;
2127
+ title?: string | undefined;
2129
2128
  type: "source";
2129
+ id: string;
2130
2130
  url: string;
2131
2131
  sourceType: "url";
2132
2132
  } | {
2133
2133
  providerOptions?: Record<string, Record<string, any>> | undefined;
2134
2134
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2135
2135
  filename?: string | undefined;
2136
- id: string;
2137
- title: string;
2138
2136
  type: "source";
2137
+ id: string;
2139
2138
  mediaType: string;
2140
2139
  sourceType: "document";
2140
+ title: string;
2141
2141
  } | {
2142
2142
  providerOptions?: Record<string, Record<string, any>> | undefined;
2143
2143
  providerMetadata?: Record<string, Record<string, any>> | undefined;
@@ -2664,28 +2664,28 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
2664
2664
  mimeType: import("convex/values").VString<string | undefined, "optional">;
2665
2665
  }, "required", "type" | "mimeType" | "data">], "required", "type" | "text" | "mimeType" | "data">, "optional">;
2666
2666
  }, "required", "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "toolCallId" | "toolName" | "args" | "providerExecuted" | `args.${string}` | "output" | "result" | "isError" | "experimental_content" | "output.type" | "output.providerOptions" | `output.providerOptions.${string}` | "output.value" | `output.value.${string}` | "output.reason" | `result.${string}`>, import("convex/values").VUnion<{
2667
- title?: string | undefined;
2668
2667
  providerOptions?: Record<string, Record<string, any>> | undefined;
2669
2668
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2670
- id: string;
2669
+ title?: string | undefined;
2671
2670
  type: "source";
2671
+ id: string;
2672
2672
  url: string;
2673
2673
  sourceType: "url";
2674
2674
  } | {
2675
2675
  providerOptions?: Record<string, Record<string, any>> | undefined;
2676
2676
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2677
2677
  filename?: string | undefined;
2678
- id: string;
2679
- title: string;
2680
2678
  type: "source";
2679
+ id: string;
2681
2680
  mediaType: string;
2682
2681
  sourceType: "document";
2682
+ title: string;
2683
2683
  }, [import("convex/values").VObject<{
2684
- title?: string | undefined;
2685
2684
  providerOptions?: Record<string, Record<string, any>> | undefined;
2686
2685
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2687
- id: string;
2686
+ title?: string | undefined;
2688
2687
  type: "source";
2688
+ id: string;
2689
2689
  url: string;
2690
2690
  sourceType: "url";
2691
2691
  }, {
@@ -2696,15 +2696,15 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
2696
2696
  title: import("convex/values").VString<string | undefined, "optional">;
2697
2697
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2698
2698
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2699
- }, "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "url" | "sourceType">, import("convex/values").VObject<{
2699
+ }, "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "url" | "sourceType" | "title">, import("convex/values").VObject<{
2700
2700
  providerOptions?: Record<string, Record<string, any>> | undefined;
2701
2701
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2702
2702
  filename?: string | undefined;
2703
- id: string;
2704
- title: string;
2705
2703
  type: "source";
2704
+ id: string;
2706
2705
  mediaType: string;
2707
2706
  sourceType: "document";
2707
+ title: string;
2708
2708
  }, {
2709
2709
  type: import("convex/values").VLiteral<"source", "required">;
2710
2710
  sourceType: import("convex/values").VLiteral<"document", "required">;
@@ -2714,7 +2714,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
2714
2714
  filename: import("convex/values").VString<string | undefined, "optional">;
2715
2715
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2716
2716
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2717
- }, "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "sourceType">], "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "url" | "sourceType">, import("convex/values").VObject<{
2717
+ }, "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "sourceType" | "title">], "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "url" | "sourceType" | "title">, import("convex/values").VObject<{
2718
2718
  providerOptions?: Record<string, Record<string, any>> | undefined;
2719
2719
  providerMetadata?: Record<string, Record<string, any>> | undefined;
2720
2720
  type: "tool-approval-request";
@@ -2726,7 +2726,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
2726
2726
  toolCallId: import("convex/values").VString<string, "required">;
2727
2727
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2728
2728
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2729
- }, "required", "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "toolCallId" | "approvalId">], "required", "id" | "title" | "type" | "providerOptions" | "text" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "mimeType" | "data" | "filename" | "signature" | "toolCallId" | "toolName" | "input" | "args" | "providerExecuted" | `input.${string}` | `args.${string}` | "output" | "url" | "result" | "isError" | "experimental_content" | "output.type" | "output.providerOptions" | `output.providerOptions.${string}` | "output.value" | `output.value.${string}` | "output.reason" | `result.${string}` | "sourceType" | "approvalId">, "required">], "required", never>;
2729
+ }, "required", "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "toolCallId" | "approvalId">], "required", "type" | "id" | "providerOptions" | "text" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "mimeType" | "data" | "filename" | "signature" | "toolCallId" | "toolName" | "input" | "args" | "providerExecuted" | `input.${string}` | `args.${string}` | "output" | "url" | "result" | "isError" | "experimental_content" | "output.type" | "output.providerOptions" | `output.providerOptions.${string}` | "output.value" | `output.value.${string}` | "output.reason" | `result.${string}` | "sourceType" | "title" | "approvalId">, "required">], "required", never>;
2730
2730
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
2731
2731
  }, "required", "providerOptions" | "role" | `providerOptions.${string}` | "content">, import("convex/values").VObject<{
2732
2732
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -3459,10 +3459,10 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3459
3459
  }, "optional", "promptTokens" | "completionTokens" | "totalTokens" | "reasoningTokens" | "cachedInputTokens">;
3460
3460
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
3461
3461
  sources: import("convex/values").VArray<({
3462
- title?: string | undefined;
3463
3462
  type?: "source" | undefined;
3464
3463
  providerOptions?: Record<string, Record<string, any>> | undefined;
3465
3464
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3465
+ title?: string | undefined;
3466
3466
  id: string;
3467
3467
  url: string;
3468
3468
  sourceType: "url";
@@ -3470,16 +3470,16 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3470
3470
  providerOptions?: Record<string, Record<string, any>> | undefined;
3471
3471
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3472
3472
  filename?: string | undefined;
3473
- id: string;
3474
- title: string;
3475
3473
  type: "source";
3474
+ id: string;
3476
3475
  mediaType: string;
3477
3476
  sourceType: "document";
3477
+ title: string;
3478
3478
  })[] | undefined, import("convex/values").VUnion<{
3479
- title?: string | undefined;
3480
3479
  type?: "source" | undefined;
3481
3480
  providerOptions?: Record<string, Record<string, any>> | undefined;
3482
3481
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3482
+ title?: string | undefined;
3483
3483
  id: string;
3484
3484
  url: string;
3485
3485
  sourceType: "url";
@@ -3487,16 +3487,16 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3487
3487
  providerOptions?: Record<string, Record<string, any>> | undefined;
3488
3488
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3489
3489
  filename?: string | undefined;
3490
- id: string;
3491
- title: string;
3492
3490
  type: "source";
3491
+ id: string;
3493
3492
  mediaType: string;
3494
3493
  sourceType: "document";
3494
+ title: string;
3495
3495
  }, [import("convex/values").VObject<{
3496
- title?: string | undefined;
3497
3496
  type?: "source" | undefined;
3498
3497
  providerOptions?: Record<string, Record<string, any>> | undefined;
3499
3498
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3499
+ title?: string | undefined;
3500
3500
  id: string;
3501
3501
  url: string;
3502
3502
  sourceType: "url";
@@ -3508,15 +3508,15 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3508
3508
  title: import("convex/values").VString<string | undefined, "optional">;
3509
3509
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
3510
3510
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
3511
- }, "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "url" | "sourceType">, import("convex/values").VObject<{
3511
+ }, "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "url" | "sourceType" | "title">, import("convex/values").VObject<{
3512
3512
  providerOptions?: Record<string, Record<string, any>> | undefined;
3513
3513
  providerMetadata?: Record<string, Record<string, any>> | undefined;
3514
3514
  filename?: string | undefined;
3515
- id: string;
3516
- title: string;
3517
3515
  type: "source";
3516
+ id: string;
3518
3517
  mediaType: string;
3519
3518
  sourceType: "document";
3519
+ title: string;
3520
3520
  }, {
3521
3521
  type: import("convex/values").VLiteral<"source", "required">;
3522
3522
  sourceType: import("convex/values").VLiteral<"document", "required">;
@@ -3526,7 +3526,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3526
3526
  filename: import("convex/values").VString<string | undefined, "optional">;
3527
3527
  providerOptions: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
3528
3528
  providerMetadata: import("convex/values").VRecord<Record<string, Record<string, any>> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>, "optional", string>;
3529
- }, "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "sourceType">], "required", "id" | "title" | "type" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "url" | "sourceType">, "optional">;
3529
+ }, "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "sourceType" | "title">], "required", "type" | "id" | "providerOptions" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "mediaType" | "filename" | "url" | "sourceType" | "title">, "optional">;
3530
3530
  warnings: import("convex/values").VArray<({
3531
3531
  details?: string | undefined;
3532
3532
  type: "unsupported-setting";
@@ -3572,7 +3572,7 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3572
3572
  type: import("convex/values").VLiteral<"other", "required">;
3573
3573
  message: import("convex/values").VString<string, "required">;
3574
3574
  }, "required", "type" | "message">], "required", "type" | "message" | "tool" | "setting" | "details" | `tool.${string}`>, "optional">;
3575
- finishReason: import("convex/values").VUnion<"error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined, [import("convex/values").VLiteral<"stop", "required">, import("convex/values").VLiteral<"length", "required">, import("convex/values").VLiteral<"content-filter", "required">, import("convex/values").VLiteral<"tool-calls", "required">, import("convex/values").VLiteral<"error", "required">, import("convex/values").VLiteral<"other", "required">, import("convex/values").VLiteral<"unknown", "required">], "optional", never>;
3575
+ finishReason: import("convex/values").VUnion<"length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined, [import("convex/values").VLiteral<"stop", "required">, import("convex/values").VLiteral<"length", "required">, import("convex/values").VLiteral<"content-filter", "required">, import("convex/values").VLiteral<"tool-calls", "required">, import("convex/values").VLiteral<"error", "required">, import("convex/values").VLiteral<"other", "required">, import("convex/values").VLiteral<"unknown", "required">], "optional", never>;
3576
3576
  reasoning: import("convex/values").VString<string | undefined, "optional">;
3577
3577
  reasoningDetails: import("convex/values").VArray<({
3578
3578
  providerOptions?: Record<string, Record<string, any>> | undefined;
@@ -3628,12 +3628,12 @@ export declare const vStreamMessagesReturnValue: import("convex/values").VObject
3628
3628
  data: import("convex/values").VString<string, "required">;
3629
3629
  }, "required", "type" | "data">], "required", "type" | "providerOptions" | "text" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "data" | "signature">, "optional">;
3630
3630
  id: import("convex/values").VString<string | undefined, "optional">;
3631
- }, "required", "id" | "status" | "userId" | "order" | "_creationTime" | "threadId" | "stepOrder" | "embeddingId" | "fileIds" | "error" | "agentName" | "model" | "provider" | "providerOptions" | "message" | "text" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "reasoning" | "tool" | "usage" | "sources" | "warnings" | "finishReason" | "reasoningDetails" | "message.providerOptions" | "message.role" | `message.providerOptions.${string}` | "message.content" | "usage.promptTokens" | "usage.completionTokens" | "usage.totalTokens" | "usage.reasoningTokens" | "usage.cachedInputTokens" | "_id">, "required">;
3631
+ }, "required", "_id" | "_creationTime" | "userId" | "id" | "threadId" | "order" | "stepOrder" | "embeddingId" | "fileIds" | "error" | "status" | "agentName" | "model" | "provider" | "providerOptions" | "message" | "text" | "providerMetadata" | `providerOptions.${string}` | `providerMetadata.${string}` | "reasoning" | "tool" | "usage" | "sources" | "warnings" | "finishReason" | "reasoningDetails" | "message.providerOptions" | "message.role" | `message.providerOptions.${string}` | "message.content" | "usage.promptTokens" | "usage.completionTokens" | "usage.totalTokens" | "usage.reasoningTokens" | "usage.cachedInputTokens">, "required">;
3632
3632
  continueCursor: import("convex/values").VString<string, "required">;
3633
3633
  isDone: import("convex/values").VBoolean<boolean, "required">;
3634
3634
  splitCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
3635
3635
  pageStatus: import("convex/values").VUnion<"SplitRecommended" | "SplitRequired" | null | undefined, [import("convex/values").VLiteral<"SplitRecommended", "required">, import("convex/values").VLiteral<"SplitRequired", "required">, import("convex/values").VNull<null, "required">], "optional", never>;
3636
- }, "required", "page" | "continueCursor" | "isDone" | "splitCursor" | "pageStatus" | "streams" | "streams.messages" | "streams.kind" | "streams.deltas">;
3636
+ }, "required", "isDone" | "page" | "continueCursor" | "splitCursor" | "pageStatus" | "streams" | "streams.messages" | "streams.deltas" | "streams.kind">;
3637
3637
  /**
3638
3638
  * A function that handles fetching stream deltas, used with the React hooks
3639
3639
  * `useThreadMessages` or `useStreamingThreadMessages`.
@@ -3753,9 +3753,20 @@ export declare class DeltaStreamer<T> {
3753
3753
  providerOptions?: ProviderOptions;
3754
3754
  format: "UIMessageChunk" | "TextStreamPart" | undefined;
3755
3755
  });
3756
- getStreamId(): Promise<string | undefined>;
3756
+ getStreamId(): Promise<string>;
3757
3757
  addParts(parts: T[]): Promise<void>;
3758
3758
  consumeStream(stream: AsyncIterableStream<T>): Promise<void>;
3759
+ /**
3760
+ * Mark the stream as being finished externally (e.g., atomically via addMessages).
3761
+ * When called, consumeStream() will skip calling finish() since it will be
3762
+ * handled elsewhere in the same mutation as message saving.
3763
+ */
3764
+ markFinishedExternally(): void;
3765
+ /**
3766
+ * Get the stream ID, waiting for it to be created if necessary.
3767
+ * Useful for passing to addMessages for atomic finish.
3768
+ */
3769
+ getOrCreateStreamId(): Promise<string>;
3759
3770
  finish(): Promise<void>;
3760
3771
  fail(reason: string): Promise<void>;
3761
3772
  }