@convex-dev/agent 0.1.18 → 0.2.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 (122) hide show
  1. package/dist/client/createTool.d.ts +30 -11
  2. package/dist/client/createTool.d.ts.map +1 -1
  3. package/dist/client/createTool.js +24 -10
  4. package/dist/client/createTool.js.map +1 -1
  5. package/dist/client/defaultComponent.d.ts +11 -0
  6. package/dist/client/defaultComponent.d.ts.map +1 -0
  7. package/dist/client/defaultComponent.js +7 -0
  8. package/dist/client/defaultComponent.js.map +1 -0
  9. package/dist/client/definePlaygroundAPI.d.ts +68 -23
  10. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  11. package/dist/client/definePlaygroundAPI.js +7 -20
  12. package/dist/client/definePlaygroundAPI.js.map +1 -1
  13. package/dist/client/files.d.ts +14 -4
  14. package/dist/client/files.d.ts.map +1 -1
  15. package/dist/client/files.js +66 -11
  16. package/dist/client/files.js.map +1 -1
  17. package/dist/client/index.d.ts +323 -780
  18. package/dist/client/index.d.ts.map +1 -1
  19. package/dist/client/index.js +445 -543
  20. package/dist/client/index.js.map +1 -1
  21. package/dist/client/messages.d.ts +256 -0
  22. package/dist/client/messages.d.ts.map +1 -0
  23. package/dist/client/messages.js +97 -0
  24. package/dist/client/messages.js.map +1 -0
  25. package/dist/client/search.d.ts +35 -12
  26. package/dist/client/search.d.ts.map +1 -1
  27. package/dist/client/search.js +21 -4
  28. package/dist/client/search.js.map +1 -1
  29. package/dist/client/streaming.d.ts +21 -21
  30. package/dist/client/streaming.d.ts.map +1 -1
  31. package/dist/client/streaming.js +35 -40
  32. package/dist/client/streaming.js.map +1 -1
  33. package/dist/client/threads.d.ts +46 -0
  34. package/dist/client/threads.d.ts.map +1 -0
  35. package/dist/client/threads.js +49 -0
  36. package/dist/client/threads.js.map +1 -0
  37. package/dist/client/types.d.ts +159 -75
  38. package/dist/client/types.d.ts.map +1 -1
  39. package/dist/component/_generated/api.d.ts +261 -209
  40. package/dist/component/messages.d.ts +314 -105
  41. package/dist/component/messages.d.ts.map +1 -1
  42. package/dist/component/messages.js +141 -83
  43. package/dist/component/messages.js.map +1 -1
  44. package/dist/component/schema.d.ts +631 -870
  45. package/dist/component/schema.d.ts.map +1 -1
  46. package/dist/component/schema.js +11 -16
  47. package/dist/component/schema.js.map +1 -1
  48. package/dist/component/streams.d.ts +29 -149
  49. package/dist/component/streams.d.ts.map +1 -1
  50. package/dist/component/streams.js +104 -60
  51. package/dist/component/streams.js.map +1 -1
  52. package/dist/component/threads.d.ts +4 -4
  53. package/dist/component/users.d.ts +3 -3
  54. package/dist/mapping.d.ts +15 -16
  55. package/dist/mapping.d.ts.map +1 -1
  56. package/dist/mapping.js +208 -62
  57. package/dist/mapping.js.map +1 -1
  58. package/dist/parts.d.ts +3 -0
  59. package/dist/parts.d.ts.map +1 -0
  60. package/dist/parts.js +34 -0
  61. package/dist/parts.js.map +1 -0
  62. package/dist/react/SmoothText.d.ts +5 -0
  63. package/dist/react/SmoothText.d.ts.map +1 -0
  64. package/dist/react/SmoothText.js +6 -0
  65. package/dist/react/SmoothText.js.map +1 -0
  66. package/dist/react/deltas.d.ts +3 -5
  67. package/dist/react/deltas.d.ts.map +1 -1
  68. package/dist/react/deltas.js +89 -53
  69. package/dist/react/deltas.js.map +1 -1
  70. package/dist/react/index.d.ts +1 -0
  71. package/dist/react/index.d.ts.map +1 -1
  72. package/dist/react/index.js +31 -11
  73. package/dist/react/index.js.map +1 -1
  74. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  75. package/dist/react/optimisticallySendMessage.js +2 -8
  76. package/dist/react/optimisticallySendMessage.js.map +1 -1
  77. package/dist/react/toUIMessages.d.ts +5 -4
  78. package/dist/react/toUIMessages.d.ts.map +1 -1
  79. package/dist/react/toUIMessages.js +103 -40
  80. package/dist/react/toUIMessages.js.map +1 -1
  81. package/dist/react/useSmoothText.d.ts +13 -12
  82. package/dist/react/useSmoothText.d.ts.map +1 -1
  83. package/dist/react/useSmoothText.js +1 -1
  84. package/dist/react/useSmoothText.js.map +1 -1
  85. package/dist/validators.d.ts +751 -1464
  86. package/dist/validators.d.ts.map +1 -1
  87. package/dist/validators.js +39 -80
  88. package/dist/validators.js.map +1 -1
  89. package/package.json +34 -30
  90. package/src/client/createTool.ts +66 -40
  91. package/src/client/defaultComponent.ts +17 -0
  92. package/src/client/definePlaygroundAPI.ts +17 -31
  93. package/src/client/files.ts +94 -17
  94. package/src/client/index.test.ts +28 -38
  95. package/src/client/index.ts +785 -977
  96. package/src/client/messages.ts +205 -0
  97. package/src/client/search.ts +37 -10
  98. package/src/client/streaming.ts +53 -56
  99. package/src/client/threads.ts +78 -0
  100. package/src/client/types.ts +239 -131
  101. package/src/component/_generated/api.d.ts +261 -209
  102. package/src/component/messages.test.ts +182 -40
  103. package/src/component/messages.ts +165 -108
  104. package/src/component/schema.ts +11 -17
  105. package/src/component/streams.ts +180 -69
  106. package/src/mapping.ts +253 -96
  107. package/src/parts.ts +39 -0
  108. package/src/react/SmoothText.tsx +9 -0
  109. package/src/react/deltas.test.ts +38 -42
  110. package/src/react/deltas.ts +116 -65
  111. package/src/react/index.ts +35 -13
  112. package/src/react/optimisticallySendMessage.ts +2 -8
  113. package/src/react/toUIMessages.test.ts +154 -36
  114. package/src/react/toUIMessages.ts +136 -57
  115. package/src/react/useSmoothText.ts +14 -15
  116. package/src/validators.test.ts +1 -117
  117. package/src/validators.ts +57 -107
  118. package/dist/client/listMessages.d.ts +0 -22
  119. package/dist/client/listMessages.d.ts.map +0 -1
  120. package/dist/client/listMessages.js +0 -25
  121. package/dist/client/listMessages.js.map +0 -1
  122. package/src/client/listMessages.ts +0 -38
@@ -152,7 +152,6 @@ export type Mounts = {
152
152
  | "error"
153
153
  | "other"
154
154
  | "unknown";
155
- id?: string;
156
155
  message:
157
156
  | {
158
157
  content:
@@ -199,6 +198,7 @@ export type Mounts = {
199
198
  | {
200
199
  providerOptions?: Record<string, Record<string, any>>;
201
200
  signature?: string;
201
+ state?: "streaming" | "done";
202
202
  text: string;
203
203
  type: "reasoning";
204
204
  }
@@ -209,6 +209,7 @@ export type Mounts = {
209
209
  }
210
210
  | {
211
211
  args: any;
212
+ providerExecuted?: boolean;
212
213
  providerOptions?: Record<string, Record<string, any>>;
213
214
  toolCallId: string;
214
215
  toolName: string;
@@ -226,6 +227,7 @@ export type Mounts = {
226
227
  | { data: string; mimeType?: string; type: "image" }
227
228
  >;
228
229
  isError?: boolean;
230
+ providerExecuted?: boolean;
229
231
  providerOptions?: Record<string, Record<string, any>>;
230
232
  result: any;
231
233
  toolCallId: string;
@@ -245,20 +247,42 @@ export type Mounts = {
245
247
  providerMetadata?: Record<string, Record<string, any>>;
246
248
  reasoning?: string;
247
249
  reasoningDetails?: Array<
250
+ | {
251
+ providerOptions?: Record<string, Record<string, any>>;
252
+ signature?: string;
253
+ state?: "streaming" | "done";
254
+ text: string;
255
+ type: "reasoning";
256
+ }
248
257
  | { signature?: string; text: string; type: "text" }
249
258
  | { data: string; type: "redacted" }
250
259
  >;
251
- sources?: Array<{
252
- id: string;
253
- providerOptions?: Record<string, Record<string, any>>;
254
- sourceType: "url";
255
- title?: string;
256
- url: string;
257
- }>;
260
+ sources?: Array<
261
+ | {
262
+ id: string;
263
+ providerOptions?: Record<string, Record<string, any>>;
264
+ sourceType: "url";
265
+ title?: string;
266
+ type?: "source";
267
+ url: string;
268
+ }
269
+ | {
270
+ filename?: string;
271
+ id: string;
272
+ mediaType: string;
273
+ providerMetadata?: Record<string, Record<string, any>>;
274
+ sourceType: "document";
275
+ title: string;
276
+ type: "source";
277
+ }
278
+ >;
279
+ status?: "pending" | "success" | "failed";
258
280
  text?: string;
259
281
  usage?: {
282
+ cachedInputTokens?: number;
260
283
  completionTokens: number;
261
284
  promptTokens: number;
285
+ reasoningTokens?: number;
262
286
  totalTokens: number;
263
287
  };
264
288
  warnings?: Array<
@@ -267,7 +291,7 @@ export type Mounts = {
267
291
  | { message: string; type: "other" }
268
292
  >;
269
293
  }>;
270
- pending?: boolean;
294
+ pendingMessageId?: string;
271
295
  promptMessageId?: string;
272
296
  threadId: string;
273
297
  userId?: string;
@@ -335,6 +359,7 @@ export type Mounts = {
335
359
  | {
336
360
  providerOptions?: Record<string, Record<string, any>>;
337
361
  signature?: string;
362
+ state?: "streaming" | "done";
338
363
  text: string;
339
364
  type: "reasoning";
340
365
  }
@@ -345,6 +370,7 @@ export type Mounts = {
345
370
  }
346
371
  | {
347
372
  args: any;
373
+ providerExecuted?: boolean;
348
374
  providerOptions?: Record<string, Record<string, any>>;
349
375
  toolCallId: string;
350
376
  toolName: string;
@@ -362,6 +388,7 @@ export type Mounts = {
362
388
  | { data: string; mimeType?: string; type: "image" }
363
389
  >;
364
390
  isError?: boolean;
391
+ providerExecuted?: boolean;
365
392
  providerOptions?: Record<string, Record<string, any>>;
366
393
  result: any;
367
394
  toolCallId: string;
@@ -383,24 +410,45 @@ export type Mounts = {
383
410
  providerOptions?: Record<string, Record<string, any>>;
384
411
  reasoning?: string;
385
412
  reasoningDetails?: Array<
413
+ | {
414
+ providerOptions?: Record<string, Record<string, any>>;
415
+ signature?: string;
416
+ state?: "streaming" | "done";
417
+ text: string;
418
+ type: "reasoning";
419
+ }
386
420
  | { signature?: string; text: string; type: "text" }
387
421
  | { data: string; type: "redacted" }
388
422
  >;
389
- sources?: Array<{
390
- id: string;
391
- providerOptions?: Record<string, Record<string, any>>;
392
- sourceType: "url";
393
- title?: string;
394
- url: string;
395
- }>;
423
+ sources?: Array<
424
+ | {
425
+ id: string;
426
+ providerOptions?: Record<string, Record<string, any>>;
427
+ sourceType: "url";
428
+ title?: string;
429
+ type?: "source";
430
+ url: string;
431
+ }
432
+ | {
433
+ filename?: string;
434
+ id: string;
435
+ mediaType: string;
436
+ providerMetadata?: Record<string, Record<string, any>>;
437
+ sourceType: "document";
438
+ title: string;
439
+ type: "source";
440
+ }
441
+ >;
396
442
  status: "pending" | "success" | "failed";
397
443
  stepOrder: number;
398
444
  text?: string;
399
445
  threadId: string;
400
446
  tool: boolean;
401
447
  usage?: {
448
+ cachedInputTokens?: number;
402
449
  completionTokens: number;
403
450
  promptTokens: number;
451
+ reasoningTokens?: number;
404
452
  totalTokens: number;
405
453
  };
406
454
  userId?: string;
@@ -412,12 +460,6 @@ export type Mounts = {
412
460
  }>;
413
461
  }
414
462
  >;
415
- commitMessage: FunctionReference<
416
- "mutation",
417
- "public",
418
- { messageId: string },
419
- null
420
- >;
421
463
  deleteByIds: FunctionReference<
422
464
  "mutation",
423
465
  "public",
@@ -436,6 +478,15 @@ export type Mounts = {
436
478
  },
437
479
  { isDone: boolean; lastOrder?: number; lastStepOrder?: number }
438
480
  >;
481
+ finalizeMessage: FunctionReference<
482
+ "mutation",
483
+ "public",
484
+ {
485
+ messageId: string;
486
+ result: { status: "success" } | { error: string; status: "failed" };
487
+ },
488
+ null
489
+ >;
439
490
  getMessagesByIds: FunctionReference<
440
491
  "query",
441
492
  "public",
@@ -502,6 +553,7 @@ export type Mounts = {
502
553
  | {
503
554
  providerOptions?: Record<string, Record<string, any>>;
504
555
  signature?: string;
556
+ state?: "streaming" | "done";
505
557
  text: string;
506
558
  type: "reasoning";
507
559
  }
@@ -512,6 +564,7 @@ export type Mounts = {
512
564
  }
513
565
  | {
514
566
  args: any;
567
+ providerExecuted?: boolean;
515
568
  providerOptions?: Record<string, Record<string, any>>;
516
569
  toolCallId: string;
517
570
  toolName: string;
@@ -529,6 +582,7 @@ export type Mounts = {
529
582
  | { data: string; mimeType?: string; type: "image" }
530
583
  >;
531
584
  isError?: boolean;
585
+ providerExecuted?: boolean;
532
586
  providerOptions?: Record<string, Record<string, any>>;
533
587
  result: any;
534
588
  toolCallId: string;
@@ -550,24 +604,45 @@ export type Mounts = {
550
604
  providerOptions?: Record<string, Record<string, any>>;
551
605
  reasoning?: string;
552
606
  reasoningDetails?: Array<
607
+ | {
608
+ providerOptions?: Record<string, Record<string, any>>;
609
+ signature?: string;
610
+ state?: "streaming" | "done";
611
+ text: string;
612
+ type: "reasoning";
613
+ }
553
614
  | { signature?: string; text: string; type: "text" }
554
615
  | { data: string; type: "redacted" }
555
616
  >;
556
- sources?: Array<{
557
- id: string;
558
- providerOptions?: Record<string, Record<string, any>>;
559
- sourceType: "url";
560
- title?: string;
561
- url: string;
562
- }>;
617
+ sources?: Array<
618
+ | {
619
+ id: string;
620
+ providerOptions?: Record<string, Record<string, any>>;
621
+ sourceType: "url";
622
+ title?: string;
623
+ type?: "source";
624
+ url: string;
625
+ }
626
+ | {
627
+ filename?: string;
628
+ id: string;
629
+ mediaType: string;
630
+ providerMetadata?: Record<string, Record<string, any>>;
631
+ sourceType: "document";
632
+ title: string;
633
+ type: "source";
634
+ }
635
+ >;
563
636
  status: "pending" | "success" | "failed";
564
637
  stepOrder: number;
565
638
  text?: string;
566
639
  threadId: string;
567
640
  tool: boolean;
568
641
  usage?: {
642
+ cachedInputTokens?: number;
569
643
  completionTokens: number;
570
644
  promptTokens: number;
645
+ reasoningTokens?: number;
571
646
  totalTokens: number;
572
647
  };
573
648
  userId?: string;
@@ -661,6 +736,7 @@ export type Mounts = {
661
736
  | {
662
737
  providerOptions?: Record<string, Record<string, any>>;
663
738
  signature?: string;
739
+ state?: "streaming" | "done";
664
740
  text: string;
665
741
  type: "reasoning";
666
742
  }
@@ -671,6 +747,7 @@ export type Mounts = {
671
747
  }
672
748
  | {
673
749
  args: any;
750
+ providerExecuted?: boolean;
674
751
  providerOptions?: Record<string, Record<string, any>>;
675
752
  toolCallId: string;
676
753
  toolName: string;
@@ -688,6 +765,7 @@ export type Mounts = {
688
765
  | { data: string; mimeType?: string; type: "image" }
689
766
  >;
690
767
  isError?: boolean;
768
+ providerExecuted?: boolean;
691
769
  providerOptions?: Record<string, Record<string, any>>;
692
770
  result: any;
693
771
  toolCallId: string;
@@ -709,24 +787,45 @@ export type Mounts = {
709
787
  providerOptions?: Record<string, Record<string, any>>;
710
788
  reasoning?: string;
711
789
  reasoningDetails?: Array<
790
+ | {
791
+ providerOptions?: Record<string, Record<string, any>>;
792
+ signature?: string;
793
+ state?: "streaming" | "done";
794
+ text: string;
795
+ type: "reasoning";
796
+ }
712
797
  | { signature?: string; text: string; type: "text" }
713
798
  | { data: string; type: "redacted" }
714
799
  >;
715
- sources?: Array<{
716
- id: string;
717
- providerOptions?: Record<string, Record<string, any>>;
718
- sourceType: "url";
719
- title?: string;
720
- url: string;
721
- }>;
800
+ sources?: Array<
801
+ | {
802
+ id: string;
803
+ providerOptions?: Record<string, Record<string, any>>;
804
+ sourceType: "url";
805
+ title?: string;
806
+ type?: "source";
807
+ url: string;
808
+ }
809
+ | {
810
+ filename?: string;
811
+ id: string;
812
+ mediaType: string;
813
+ providerMetadata?: Record<string, Record<string, any>>;
814
+ sourceType: "document";
815
+ title: string;
816
+ type: "source";
817
+ }
818
+ >;
722
819
  status: "pending" | "success" | "failed";
723
820
  stepOrder: number;
724
821
  text?: string;
725
822
  threadId: string;
726
823
  tool: boolean;
727
824
  usage?: {
825
+ cachedInputTokens?: number;
728
826
  completionTokens: number;
729
827
  promptTokens: number;
828
+ reasoningTokens?: number;
730
829
  totalTokens: number;
731
830
  };
732
831
  userId?: string;
@@ -740,12 +839,6 @@ export type Mounts = {
740
839
  splitCursor?: string | null;
741
840
  }
742
841
  >;
743
- rollbackMessage: FunctionReference<
744
- "mutation",
745
- "public",
746
- { error?: string; messageId: string },
747
- null
748
- >;
749
842
  searchMessages: FunctionReference<
750
843
  "action",
751
844
  "public",
@@ -822,6 +915,7 @@ export type Mounts = {
822
915
  | {
823
916
  providerOptions?: Record<string, Record<string, any>>;
824
917
  signature?: string;
918
+ state?: "streaming" | "done";
825
919
  text: string;
826
920
  type: "reasoning";
827
921
  }
@@ -832,6 +926,7 @@ export type Mounts = {
832
926
  }
833
927
  | {
834
928
  args: any;
929
+ providerExecuted?: boolean;
835
930
  providerOptions?: Record<string, Record<string, any>>;
836
931
  toolCallId: string;
837
932
  toolName: string;
@@ -849,6 +944,7 @@ export type Mounts = {
849
944
  | { data: string; mimeType?: string; type: "image" }
850
945
  >;
851
946
  isError?: boolean;
947
+ providerExecuted?: boolean;
852
948
  providerOptions?: Record<string, Record<string, any>>;
853
949
  result: any;
854
950
  toolCallId: string;
@@ -870,24 +966,45 @@ export type Mounts = {
870
966
  providerOptions?: Record<string, Record<string, any>>;
871
967
  reasoning?: string;
872
968
  reasoningDetails?: Array<
969
+ | {
970
+ providerOptions?: Record<string, Record<string, any>>;
971
+ signature?: string;
972
+ state?: "streaming" | "done";
973
+ text: string;
974
+ type: "reasoning";
975
+ }
873
976
  | { signature?: string; text: string; type: "text" }
874
977
  | { data: string; type: "redacted" }
875
978
  >;
876
- sources?: Array<{
877
- id: string;
878
- providerOptions?: Record<string, Record<string, any>>;
879
- sourceType: "url";
880
- title?: string;
881
- url: string;
882
- }>;
979
+ sources?: Array<
980
+ | {
981
+ id: string;
982
+ providerOptions?: Record<string, Record<string, any>>;
983
+ sourceType: "url";
984
+ title?: string;
985
+ type?: "source";
986
+ url: string;
987
+ }
988
+ | {
989
+ filename?: string;
990
+ id: string;
991
+ mediaType: string;
992
+ providerMetadata?: Record<string, Record<string, any>>;
993
+ sourceType: "document";
994
+ title: string;
995
+ type: "source";
996
+ }
997
+ >;
883
998
  status: "pending" | "success" | "failed";
884
999
  stepOrder: number;
885
1000
  text?: string;
886
1001
  threadId: string;
887
1002
  tool: boolean;
888
1003
  usage?: {
1004
+ cachedInputTokens?: number;
889
1005
  completionTokens: number;
890
1006
  promptTokens: number;
1007
+ reasoningTokens?: number;
891
1008
  totalTokens: number;
892
1009
  };
893
1010
  userId?: string;
@@ -970,6 +1087,7 @@ export type Mounts = {
970
1087
  | {
971
1088
  providerOptions?: Record<string, Record<string, any>>;
972
1089
  signature?: string;
1090
+ state?: "streaming" | "done";
973
1091
  text: string;
974
1092
  type: "reasoning";
975
1093
  }
@@ -980,6 +1098,7 @@ export type Mounts = {
980
1098
  }
981
1099
  | {
982
1100
  args: any;
1101
+ providerExecuted?: boolean;
983
1102
  providerOptions?: Record<string, Record<string, any>>;
984
1103
  toolCallId: string;
985
1104
  toolName: string;
@@ -997,6 +1116,7 @@ export type Mounts = {
997
1116
  | { data: string; mimeType?: string; type: "image" }
998
1117
  >;
999
1118
  isError?: boolean;
1119
+ providerExecuted?: boolean;
1000
1120
  providerOptions?: Record<string, Record<string, any>>;
1001
1121
  result: any;
1002
1122
  toolCallId: string;
@@ -1018,24 +1138,45 @@ export type Mounts = {
1018
1138
  providerOptions?: Record<string, Record<string, any>>;
1019
1139
  reasoning?: string;
1020
1140
  reasoningDetails?: Array<
1141
+ | {
1142
+ providerOptions?: Record<string, Record<string, any>>;
1143
+ signature?: string;
1144
+ state?: "streaming" | "done";
1145
+ text: string;
1146
+ type: "reasoning";
1147
+ }
1021
1148
  | { signature?: string; text: string; type: "text" }
1022
1149
  | { data: string; type: "redacted" }
1023
1150
  >;
1024
- sources?: Array<{
1025
- id: string;
1026
- providerOptions?: Record<string, Record<string, any>>;
1027
- sourceType: "url";
1028
- title?: string;
1029
- url: string;
1030
- }>;
1151
+ sources?: Array<
1152
+ | {
1153
+ id: string;
1154
+ providerOptions?: Record<string, Record<string, any>>;
1155
+ sourceType: "url";
1156
+ title?: string;
1157
+ type?: "source";
1158
+ url: string;
1159
+ }
1160
+ | {
1161
+ filename?: string;
1162
+ id: string;
1163
+ mediaType: string;
1164
+ providerMetadata?: Record<string, Record<string, any>>;
1165
+ sourceType: "document";
1166
+ title: string;
1167
+ type: "source";
1168
+ }
1169
+ >;
1031
1170
  status: "pending" | "success" | "failed";
1032
1171
  stepOrder: number;
1033
1172
  text?: string;
1034
1173
  threadId: string;
1035
1174
  tool: boolean;
1036
1175
  usage?: {
1176
+ cachedInputTokens?: number;
1037
1177
  completionTokens: number;
1038
1178
  promptTokens: number;
1179
+ reasoningTokens?: number;
1039
1180
  totalTokens: number;
1040
1181
  };
1041
1182
  userId?: string;
@@ -1054,6 +1195,14 @@ export type Mounts = {
1054
1195
  patch: {
1055
1196
  error?: string;
1056
1197
  fileIds?: Array<string>;
1198
+ finishReason?:
1199
+ | "stop"
1200
+ | "length"
1201
+ | "content-filter"
1202
+ | "tool-calls"
1203
+ | "error"
1204
+ | "other"
1205
+ | "unknown";
1057
1206
  message?:
1058
1207
  | {
1059
1208
  content:
@@ -1100,6 +1249,7 @@ export type Mounts = {
1100
1249
  | {
1101
1250
  providerOptions?: Record<string, Record<string, any>>;
1102
1251
  signature?: string;
1252
+ state?: "streaming" | "done";
1103
1253
  text: string;
1104
1254
  type: "reasoning";
1105
1255
  }
@@ -1110,6 +1260,7 @@ export type Mounts = {
1110
1260
  }
1111
1261
  | {
1112
1262
  args: any;
1263
+ providerExecuted?: boolean;
1113
1264
  providerOptions?: Record<string, Record<string, any>>;
1114
1265
  toolCallId: string;
1115
1266
  toolName: string;
@@ -1127,6 +1278,7 @@ export type Mounts = {
1127
1278
  | { data: string; mimeType?: string; type: "image" }
1128
1279
  >;
1129
1280
  isError?: boolean;
1281
+ providerExecuted?: boolean;
1130
1282
  providerOptions?: Record<string, Record<string, any>>;
1131
1283
  result: any;
1132
1284
  toolCallId: string;
@@ -1141,6 +1293,9 @@ export type Mounts = {
1141
1293
  providerOptions?: Record<string, Record<string, any>>;
1142
1294
  role: "system";
1143
1295
  };
1296
+ model?: string;
1297
+ provider?: string;
1298
+ providerOptions?: Record<string, Record<string, any>>;
1144
1299
  status?: "pending" | "success" | "failed";
1145
1300
  };
1146
1301
  },
@@ -1206,6 +1361,7 @@ export type Mounts = {
1206
1361
  | {
1207
1362
  providerOptions?: Record<string, Record<string, any>>;
1208
1363
  signature?: string;
1364
+ state?: "streaming" | "done";
1209
1365
  text: string;
1210
1366
  type: "reasoning";
1211
1367
  }
@@ -1216,6 +1372,7 @@ export type Mounts = {
1216
1372
  }
1217
1373
  | {
1218
1374
  args: any;
1375
+ providerExecuted?: boolean;
1219
1376
  providerOptions?: Record<string, Record<string, any>>;
1220
1377
  toolCallId: string;
1221
1378
  toolName: string;
@@ -1233,6 +1390,7 @@ export type Mounts = {
1233
1390
  | { data: string; mimeType?: string; type: "image" }
1234
1391
  >;
1235
1392
  isError?: boolean;
1393
+ providerExecuted?: boolean;
1236
1394
  providerOptions?: Record<string, Record<string, any>>;
1237
1395
  result: any;
1238
1396
  toolCallId: string;
@@ -1254,24 +1412,45 @@ export type Mounts = {
1254
1412
  providerOptions?: Record<string, Record<string, any>>;
1255
1413
  reasoning?: string;
1256
1414
  reasoningDetails?: Array<
1415
+ | {
1416
+ providerOptions?: Record<string, Record<string, any>>;
1417
+ signature?: string;
1418
+ state?: "streaming" | "done";
1419
+ text: string;
1420
+ type: "reasoning";
1421
+ }
1257
1422
  | { signature?: string; text: string; type: "text" }
1258
1423
  | { data: string; type: "redacted" }
1259
1424
  >;
1260
- sources?: Array<{
1261
- id: string;
1262
- providerOptions?: Record<string, Record<string, any>>;
1263
- sourceType: "url";
1264
- title?: string;
1265
- url: string;
1266
- }>;
1425
+ sources?: Array<
1426
+ | {
1427
+ id: string;
1428
+ providerOptions?: Record<string, Record<string, any>>;
1429
+ sourceType: "url";
1430
+ title?: string;
1431
+ type?: "source";
1432
+ url: string;
1433
+ }
1434
+ | {
1435
+ filename?: string;
1436
+ id: string;
1437
+ mediaType: string;
1438
+ providerMetadata?: Record<string, Record<string, any>>;
1439
+ sourceType: "document";
1440
+ title: string;
1441
+ type: "source";
1442
+ }
1443
+ >;
1267
1444
  status: "pending" | "success" | "failed";
1268
1445
  stepOrder: number;
1269
1446
  text?: string;
1270
1447
  threadId: string;
1271
1448
  tool: boolean;
1272
1449
  usage?: {
1450
+ cachedInputTokens?: number;
1273
1451
  completionTokens: number;
1274
1452
  promptTokens: number;
1453
+ reasoningTokens?: number;
1275
1454
  totalTokens: number;
1276
1455
  };
1277
1456
  userId?: string;
@@ -1287,7 +1466,16 @@ export type Mounts = {
1287
1466
  abort: FunctionReference<
1288
1467
  "mutation",
1289
1468
  "public",
1290
- { reason: string; streamId: string },
1469
+ {
1470
+ finalDelta?: {
1471
+ end: number;
1472
+ parts: Array<any>;
1473
+ start: number;
1474
+ streamId: string;
1475
+ };
1476
+ reason: string;
1477
+ streamId: string;
1478
+ },
1291
1479
  boolean
1292
1480
  >;
1293
1481
  abortByOrder: FunctionReference<
@@ -1299,56 +1487,7 @@ export type Mounts = {
1299
1487
  addDelta: FunctionReference<
1300
1488
  "mutation",
1301
1489
  "public",
1302
- {
1303
- end: number;
1304
- parts: Array<
1305
- | { textDelta: string; type: "text-delta" }
1306
- | { textDelta: string; type: "reasoning" }
1307
- | {
1308
- source: {
1309
- id: string;
1310
- providerOptions?: Record<string, Record<string, any>>;
1311
- sourceType: "url";
1312
- title?: string;
1313
- url: string;
1314
- };
1315
- type: "source";
1316
- }
1317
- | {
1318
- args: any;
1319
- providerOptions?: Record<string, Record<string, any>>;
1320
- toolCallId: string;
1321
- toolName: string;
1322
- type: "tool-call";
1323
- }
1324
- | {
1325
- toolCallId: string;
1326
- toolName: string;
1327
- type: "tool-call-streaming-start";
1328
- }
1329
- | {
1330
- argsTextDelta: string;
1331
- toolCallId: string;
1332
- toolName: string;
1333
- type: "tool-call-delta";
1334
- }
1335
- | {
1336
- args?: any;
1337
- experimental_content?: Array<
1338
- | { text: string; type: "text" }
1339
- | { data: string; mimeType?: string; type: "image" }
1340
- >;
1341
- isError?: boolean;
1342
- providerOptions?: Record<string, Record<string, any>>;
1343
- result: any;
1344
- toolCallId: string;
1345
- toolName: string;
1346
- type: "tool-result";
1347
- }
1348
- >;
1349
- start: number;
1350
- streamId: string;
1351
- },
1490
+ { end: number; parts: Array<any>; start: number; streamId: string },
1352
1491
  boolean
1353
1492
  >;
1354
1493
  create: FunctionReference<
@@ -1396,51 +1535,7 @@ export type Mounts = {
1396
1535
  {
1397
1536
  finalDelta?: {
1398
1537
  end: number;
1399
- parts: Array<
1400
- | { textDelta: string; type: "text-delta" }
1401
- | { textDelta: string; type: "reasoning" }
1402
- | {
1403
- source: {
1404
- id: string;
1405
- providerOptions?: Record<string, Record<string, any>>;
1406
- sourceType: "url";
1407
- title?: string;
1408
- url: string;
1409
- };
1410
- type: "source";
1411
- }
1412
- | {
1413
- args: any;
1414
- providerOptions?: Record<string, Record<string, any>>;
1415
- toolCallId: string;
1416
- toolName: string;
1417
- type: "tool-call";
1418
- }
1419
- | {
1420
- toolCallId: string;
1421
- toolName: string;
1422
- type: "tool-call-streaming-start";
1423
- }
1424
- | {
1425
- argsTextDelta: string;
1426
- toolCallId: string;
1427
- toolName: string;
1428
- type: "tool-call-delta";
1429
- }
1430
- | {
1431
- args?: any;
1432
- experimental_content?: Array<
1433
- | { text: string; type: "text" }
1434
- | { data: string; mimeType?: string; type: "image" }
1435
- >;
1436
- isError?: boolean;
1437
- providerOptions?: Record<string, Record<string, any>>;
1438
- result: any;
1439
- toolCallId: string;
1440
- toolName: string;
1441
- type: "tool-result";
1442
- }
1443
- >;
1538
+ parts: Array<any>;
1444
1539
  start: number;
1445
1540
  streamId: string;
1446
1541
  };
@@ -1448,6 +1543,12 @@ export type Mounts = {
1448
1543
  },
1449
1544
  null
1450
1545
  >;
1546
+ heartbeat: FunctionReference<
1547
+ "mutation",
1548
+ "public",
1549
+ { streamId: string },
1550
+ null
1551
+ >;
1451
1552
  list: FunctionReference<
1452
1553
  "query",
1453
1554
  "public",
@@ -1475,56 +1576,7 @@ export type Mounts = {
1475
1576
  cursors: Array<{ cursor: number; streamId: string }>;
1476
1577
  threadId: string;
1477
1578
  },
1478
- Array<{
1479
- end: number;
1480
- parts: Array<
1481
- | { textDelta: string; type: "text-delta" }
1482
- | { textDelta: string; type: "reasoning" }
1483
- | {
1484
- source: {
1485
- id: string;
1486
- providerOptions?: Record<string, Record<string, any>>;
1487
- sourceType: "url";
1488
- title?: string;
1489
- url: string;
1490
- };
1491
- type: "source";
1492
- }
1493
- | {
1494
- args: any;
1495
- providerOptions?: Record<string, Record<string, any>>;
1496
- toolCallId: string;
1497
- toolName: string;
1498
- type: "tool-call";
1499
- }
1500
- | {
1501
- toolCallId: string;
1502
- toolName: string;
1503
- type: "tool-call-streaming-start";
1504
- }
1505
- | {
1506
- argsTextDelta: string;
1507
- toolCallId: string;
1508
- toolName: string;
1509
- type: "tool-call-delta";
1510
- }
1511
- | {
1512
- args?: any;
1513
- experimental_content?: Array<
1514
- | { text: string; type: "text" }
1515
- | { data: string; mimeType?: string; type: "image" }
1516
- >;
1517
- isError?: boolean;
1518
- providerOptions?: Record<string, Record<string, any>>;
1519
- result: any;
1520
- toolCallId: string;
1521
- toolName: string;
1522
- type: "tool-result";
1523
- }
1524
- >;
1525
- start: number;
1526
- streamId: string;
1527
- }>
1579
+ Array<{ end: number; parts: Array<any>; start: number; streamId: string }>
1528
1580
  >;
1529
1581
  };
1530
1582
  threads: {