@fatagnus/convex-feedback 0.2.6 → 0.2.7

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.
@@ -0,0 +1,2922 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type * as agents_bugReportAgent from "../agents/bugReportAgent.js";
12
+ import type * as agents_feedbackAgent from "../agents/feedbackAgent.js";
13
+ import type * as agents_feedbackInterviewAgent from "../agents/feedbackInterviewAgent.js";
14
+ import type * as agents_index from "../agents/index.js";
15
+ import type * as bugReports from "../bugReports.js";
16
+ import type * as emails_bugReportEmails from "../emails/bugReportEmails.js";
17
+ import type * as emails_feedbackEmails from "../emails/feedbackEmails.js";
18
+ import type * as feedback from "../feedback.js";
19
+ import type * as index from "../index.js";
20
+ import type * as inputRequests from "../inputRequests.js";
21
+ import type * as supportTeams from "../supportTeams.js";
22
+
23
+ import type {
24
+ ApiFromModules,
25
+ FilterApi,
26
+ FunctionReference,
27
+ } from "convex/server";
28
+ import { anyApi, componentsGeneric } from "convex/server";
29
+
30
+ const fullApi: ApiFromModules<{
31
+ "agents/bugReportAgent": typeof agents_bugReportAgent;
32
+ "agents/feedbackAgent": typeof agents_feedbackAgent;
33
+ "agents/feedbackInterviewAgent": typeof agents_feedbackInterviewAgent;
34
+ "agents/index": typeof agents_index;
35
+ bugReports: typeof bugReports;
36
+ "emails/bugReportEmails": typeof emails_bugReportEmails;
37
+ "emails/feedbackEmails": typeof emails_feedbackEmails;
38
+ feedback: typeof feedback;
39
+ index: typeof index;
40
+ inputRequests: typeof inputRequests;
41
+ supportTeams: typeof supportTeams;
42
+ }> = anyApi as any;
43
+
44
+ /**
45
+ * A utility for referencing Convex functions in your app's public API.
46
+ *
47
+ * Usage:
48
+ * ```js
49
+ * const myFunctionReference = api.myModule.myFunction;
50
+ * ```
51
+ */
52
+ export const api: FilterApi<
53
+ typeof fullApi,
54
+ FunctionReference<any, "public">
55
+ > = anyApi as any;
56
+
57
+ /**
58
+ * A utility for referencing Convex functions in your app's internal API.
59
+ *
60
+ * Usage:
61
+ * ```js
62
+ * const myFunctionReference = internal.myModule.myFunction;
63
+ * ```
64
+ */
65
+ export const internal: FilterApi<
66
+ typeof fullApi,
67
+ FunctionReference<any, "internal">
68
+ > = anyApi as any;
69
+
70
+ export const components = componentsGeneric() as unknown as {
71
+ agent: {
72
+ apiKeys: {
73
+ destroy: FunctionReference<
74
+ "mutation",
75
+ "internal",
76
+ { apiKey?: string; name?: string },
77
+ | "missing"
78
+ | "deleted"
79
+ | "name mismatch"
80
+ | "must provide either apiKey or name"
81
+ >;
82
+ issue: FunctionReference<
83
+ "mutation",
84
+ "internal",
85
+ { name?: string },
86
+ string
87
+ >;
88
+ validate: FunctionReference<
89
+ "query",
90
+ "internal",
91
+ { apiKey: string },
92
+ boolean
93
+ >;
94
+ };
95
+ files: {
96
+ addFile: FunctionReference<
97
+ "mutation",
98
+ "internal",
99
+ {
100
+ filename?: string;
101
+ hash: string;
102
+ mimeType: string;
103
+ storageId: string;
104
+ },
105
+ { fileId: string; storageId: string }
106
+ >;
107
+ copyFile: FunctionReference<
108
+ "mutation",
109
+ "internal",
110
+ { fileId: string },
111
+ null
112
+ >;
113
+ deleteFiles: FunctionReference<
114
+ "mutation",
115
+ "internal",
116
+ { fileIds: Array<string>; force?: boolean },
117
+ Array<string>
118
+ >;
119
+ get: FunctionReference<
120
+ "query",
121
+ "internal",
122
+ { fileId: string },
123
+ null | {
124
+ _creationTime: number;
125
+ _id: string;
126
+ filename?: string;
127
+ hash: string;
128
+ lastTouchedAt: number;
129
+ mimeType: string;
130
+ refcount: number;
131
+ storageId: string;
132
+ }
133
+ >;
134
+ getFilesToDelete: FunctionReference<
135
+ "query",
136
+ "internal",
137
+ {
138
+ paginationOpts: {
139
+ cursor: string | null;
140
+ endCursor?: string | null;
141
+ id?: number;
142
+ maximumBytesRead?: number;
143
+ maximumRowsRead?: number;
144
+ numItems: number;
145
+ };
146
+ },
147
+ {
148
+ continueCursor: string;
149
+ isDone: boolean;
150
+ page: Array<{
151
+ _creationTime: number;
152
+ _id: string;
153
+ filename?: string;
154
+ hash: string;
155
+ lastTouchedAt: number;
156
+ mimeType: string;
157
+ refcount: number;
158
+ storageId: string;
159
+ }>;
160
+ }
161
+ >;
162
+ useExistingFile: FunctionReference<
163
+ "mutation",
164
+ "internal",
165
+ { filename?: string; hash: string },
166
+ null | { fileId: string; storageId: string }
167
+ >;
168
+ };
169
+ messages: {
170
+ addMessages: FunctionReference<
171
+ "mutation",
172
+ "internal",
173
+ {
174
+ agentName?: string;
175
+ embeddings?: {
176
+ dimension:
177
+ | 128
178
+ | 256
179
+ | 512
180
+ | 768
181
+ | 1024
182
+ | 1408
183
+ | 1536
184
+ | 2048
185
+ | 3072
186
+ | 4096;
187
+ model: string;
188
+ vectors: Array<Array<number> | null>;
189
+ };
190
+ failPendingSteps?: boolean;
191
+ hideFromUserIdSearch?: boolean;
192
+ messages: Array<{
193
+ error?: string;
194
+ fileIds?: Array<string>;
195
+ finishReason?:
196
+ | "stop"
197
+ | "length"
198
+ | "content-filter"
199
+ | "tool-calls"
200
+ | "error"
201
+ | "other"
202
+ | "unknown";
203
+ message:
204
+ | {
205
+ content:
206
+ | string
207
+ | Array<
208
+ | {
209
+ providerMetadata?: Record<
210
+ string,
211
+ Record<string, any>
212
+ >;
213
+ providerOptions?: Record<
214
+ string,
215
+ Record<string, any>
216
+ >;
217
+ text: string;
218
+ type: "text";
219
+ }
220
+ | {
221
+ image: string | ArrayBuffer;
222
+ mimeType?: string;
223
+ providerOptions?: Record<
224
+ string,
225
+ Record<string, any>
226
+ >;
227
+ type: "image";
228
+ }
229
+ | {
230
+ data: string | ArrayBuffer;
231
+ filename?: string;
232
+ mimeType: string;
233
+ providerMetadata?: Record<
234
+ string,
235
+ Record<string, any>
236
+ >;
237
+ providerOptions?: Record<
238
+ string,
239
+ Record<string, any>
240
+ >;
241
+ type: "file";
242
+ }
243
+ >;
244
+ providerOptions?: Record<string, Record<string, any>>;
245
+ role: "user";
246
+ }
247
+ | {
248
+ content:
249
+ | string
250
+ | Array<
251
+ | {
252
+ providerMetadata?: Record<
253
+ string,
254
+ Record<string, any>
255
+ >;
256
+ providerOptions?: Record<
257
+ string,
258
+ Record<string, any>
259
+ >;
260
+ text: string;
261
+ type: "text";
262
+ }
263
+ | {
264
+ data: string | ArrayBuffer;
265
+ filename?: string;
266
+ mimeType: string;
267
+ providerMetadata?: Record<
268
+ string,
269
+ Record<string, any>
270
+ >;
271
+ providerOptions?: Record<
272
+ string,
273
+ Record<string, any>
274
+ >;
275
+ type: "file";
276
+ }
277
+ | {
278
+ providerMetadata?: Record<
279
+ string,
280
+ Record<string, any>
281
+ >;
282
+ providerOptions?: Record<
283
+ string,
284
+ Record<string, any>
285
+ >;
286
+ signature?: string;
287
+ text: string;
288
+ type: "reasoning";
289
+ }
290
+ | {
291
+ data: string;
292
+ providerMetadata?: Record<
293
+ string,
294
+ Record<string, any>
295
+ >;
296
+ providerOptions?: Record<
297
+ string,
298
+ Record<string, any>
299
+ >;
300
+ type: "redacted-reasoning";
301
+ }
302
+ | {
303
+ args: any;
304
+ providerExecuted?: boolean;
305
+ providerMetadata?: Record<
306
+ string,
307
+ Record<string, any>
308
+ >;
309
+ providerOptions?: Record<
310
+ string,
311
+ Record<string, any>
312
+ >;
313
+ toolCallId: string;
314
+ toolName: string;
315
+ type: "tool-call";
316
+ }
317
+ | {
318
+ args?: any;
319
+ experimental_content?: Array<
320
+ | { text: string; type: "text" }
321
+ | {
322
+ data: string;
323
+ mimeType?: string;
324
+ type: "image";
325
+ }
326
+ >;
327
+ isError?: boolean;
328
+ output?:
329
+ | { type: "text"; value: string }
330
+ | { type: "json"; value: any }
331
+ | { type: "error-text"; value: string }
332
+ | { type: "error-json"; value: any }
333
+ | {
334
+ type: "content";
335
+ value: Array<
336
+ | { text: string; type: "text" }
337
+ | {
338
+ data: string;
339
+ mediaType: string;
340
+ type: "media";
341
+ }
342
+ >;
343
+ };
344
+ providerExecuted?: boolean;
345
+ providerMetadata?: Record<
346
+ string,
347
+ Record<string, any>
348
+ >;
349
+ providerOptions?: Record<
350
+ string,
351
+ Record<string, any>
352
+ >;
353
+ result?: any;
354
+ toolCallId: string;
355
+ toolName: string;
356
+ type: "tool-result";
357
+ }
358
+ | {
359
+ id: string;
360
+ providerMetadata?: Record<
361
+ string,
362
+ Record<string, any>
363
+ >;
364
+ providerOptions?: Record<
365
+ string,
366
+ Record<string, any>
367
+ >;
368
+ sourceType: "url";
369
+ title?: string;
370
+ type: "source";
371
+ url: string;
372
+ }
373
+ | {
374
+ filename?: string;
375
+ id: string;
376
+ mediaType: string;
377
+ providerMetadata?: Record<
378
+ string,
379
+ Record<string, any>
380
+ >;
381
+ providerOptions?: Record<
382
+ string,
383
+ Record<string, any>
384
+ >;
385
+ sourceType: "document";
386
+ title: string;
387
+ type: "source";
388
+ }
389
+ >;
390
+ providerOptions?: Record<string, Record<string, any>>;
391
+ role: "assistant";
392
+ }
393
+ | {
394
+ content: Array<{
395
+ args?: any;
396
+ experimental_content?: Array<
397
+ | { text: string; type: "text" }
398
+ | { data: string; mimeType?: string; type: "image" }
399
+ >;
400
+ isError?: boolean;
401
+ output?:
402
+ | { type: "text"; value: string }
403
+ | { type: "json"; value: any }
404
+ | { type: "error-text"; value: string }
405
+ | { type: "error-json"; value: any }
406
+ | {
407
+ type: "content";
408
+ value: Array<
409
+ | { text: string; type: "text" }
410
+ | { data: string; mediaType: string; type: "media" }
411
+ >;
412
+ };
413
+ providerExecuted?: boolean;
414
+ providerMetadata?: Record<string, Record<string, any>>;
415
+ providerOptions?: Record<string, Record<string, any>>;
416
+ result?: any;
417
+ toolCallId: string;
418
+ toolName: string;
419
+ type: "tool-result";
420
+ }>;
421
+ providerOptions?: Record<string, Record<string, any>>;
422
+ role: "tool";
423
+ }
424
+ | {
425
+ content: string;
426
+ providerOptions?: Record<string, Record<string, any>>;
427
+ role: "system";
428
+ };
429
+ model?: string;
430
+ provider?: string;
431
+ providerMetadata?: Record<string, Record<string, any>>;
432
+ reasoning?: string;
433
+ reasoningDetails?: Array<
434
+ | {
435
+ providerMetadata?: Record<string, Record<string, any>>;
436
+ providerOptions?: Record<string, Record<string, any>>;
437
+ signature?: string;
438
+ text: string;
439
+ type: "reasoning";
440
+ }
441
+ | { signature?: string; text: string; type: "text" }
442
+ | { data: string; type: "redacted" }
443
+ >;
444
+ sources?: Array<
445
+ | {
446
+ id: string;
447
+ providerMetadata?: Record<string, Record<string, any>>;
448
+ providerOptions?: Record<string, Record<string, any>>;
449
+ sourceType: "url";
450
+ title?: string;
451
+ type?: "source";
452
+ url: string;
453
+ }
454
+ | {
455
+ filename?: string;
456
+ id: string;
457
+ mediaType: string;
458
+ providerMetadata?: Record<string, Record<string, any>>;
459
+ providerOptions?: Record<string, Record<string, any>>;
460
+ sourceType: "document";
461
+ title: string;
462
+ type: "source";
463
+ }
464
+ >;
465
+ status?: "pending" | "success" | "failed";
466
+ text?: string;
467
+ usage?: {
468
+ cachedInputTokens?: number;
469
+ completionTokens: number;
470
+ promptTokens: number;
471
+ reasoningTokens?: number;
472
+ totalTokens: number;
473
+ };
474
+ warnings?: Array<
475
+ | {
476
+ details?: string;
477
+ setting: string;
478
+ type: "unsupported-setting";
479
+ }
480
+ | { details?: string; tool: any; type: "unsupported-tool" }
481
+ | { message: string; type: "other" }
482
+ >;
483
+ }>;
484
+ pendingMessageId?: string;
485
+ promptMessageId?: string;
486
+ threadId: string;
487
+ userId?: string;
488
+ },
489
+ {
490
+ messages: Array<{
491
+ _creationTime: number;
492
+ _id: string;
493
+ agentName?: string;
494
+ embeddingId?: string;
495
+ error?: string;
496
+ fileIds?: Array<string>;
497
+ finishReason?:
498
+ | "stop"
499
+ | "length"
500
+ | "content-filter"
501
+ | "tool-calls"
502
+ | "error"
503
+ | "other"
504
+ | "unknown";
505
+ id?: string;
506
+ message?:
507
+ | {
508
+ content:
509
+ | string
510
+ | Array<
511
+ | {
512
+ providerMetadata?: Record<
513
+ string,
514
+ Record<string, any>
515
+ >;
516
+ providerOptions?: Record<
517
+ string,
518
+ Record<string, any>
519
+ >;
520
+ text: string;
521
+ type: "text";
522
+ }
523
+ | {
524
+ image: string | ArrayBuffer;
525
+ mimeType?: string;
526
+ providerOptions?: Record<
527
+ string,
528
+ Record<string, any>
529
+ >;
530
+ type: "image";
531
+ }
532
+ | {
533
+ data: string | ArrayBuffer;
534
+ filename?: string;
535
+ mimeType: string;
536
+ providerMetadata?: Record<
537
+ string,
538
+ Record<string, any>
539
+ >;
540
+ providerOptions?: Record<
541
+ string,
542
+ Record<string, any>
543
+ >;
544
+ type: "file";
545
+ }
546
+ >;
547
+ providerOptions?: Record<string, Record<string, any>>;
548
+ role: "user";
549
+ }
550
+ | {
551
+ content:
552
+ | string
553
+ | Array<
554
+ | {
555
+ providerMetadata?: Record<
556
+ string,
557
+ Record<string, any>
558
+ >;
559
+ providerOptions?: Record<
560
+ string,
561
+ Record<string, any>
562
+ >;
563
+ text: string;
564
+ type: "text";
565
+ }
566
+ | {
567
+ data: string | ArrayBuffer;
568
+ filename?: string;
569
+ mimeType: string;
570
+ providerMetadata?: Record<
571
+ string,
572
+ Record<string, any>
573
+ >;
574
+ providerOptions?: Record<
575
+ string,
576
+ Record<string, any>
577
+ >;
578
+ type: "file";
579
+ }
580
+ | {
581
+ providerMetadata?: Record<
582
+ string,
583
+ Record<string, any>
584
+ >;
585
+ providerOptions?: Record<
586
+ string,
587
+ Record<string, any>
588
+ >;
589
+ signature?: string;
590
+ text: string;
591
+ type: "reasoning";
592
+ }
593
+ | {
594
+ data: string;
595
+ providerMetadata?: Record<
596
+ string,
597
+ Record<string, any>
598
+ >;
599
+ providerOptions?: Record<
600
+ string,
601
+ Record<string, any>
602
+ >;
603
+ type: "redacted-reasoning";
604
+ }
605
+ | {
606
+ args: any;
607
+ providerExecuted?: boolean;
608
+ providerMetadata?: Record<
609
+ string,
610
+ Record<string, any>
611
+ >;
612
+ providerOptions?: Record<
613
+ string,
614
+ Record<string, any>
615
+ >;
616
+ toolCallId: string;
617
+ toolName: string;
618
+ type: "tool-call";
619
+ }
620
+ | {
621
+ args?: any;
622
+ experimental_content?: Array<
623
+ | { text: string; type: "text" }
624
+ | {
625
+ data: string;
626
+ mimeType?: string;
627
+ type: "image";
628
+ }
629
+ >;
630
+ isError?: boolean;
631
+ output?:
632
+ | { type: "text"; value: string }
633
+ | { type: "json"; value: any }
634
+ | { type: "error-text"; value: string }
635
+ | { type: "error-json"; value: any }
636
+ | {
637
+ type: "content";
638
+ value: Array<
639
+ | { text: string; type: "text" }
640
+ | {
641
+ data: string;
642
+ mediaType: string;
643
+ type: "media";
644
+ }
645
+ >;
646
+ };
647
+ providerExecuted?: boolean;
648
+ providerMetadata?: Record<
649
+ string,
650
+ Record<string, any>
651
+ >;
652
+ providerOptions?: Record<
653
+ string,
654
+ Record<string, any>
655
+ >;
656
+ result?: any;
657
+ toolCallId: string;
658
+ toolName: string;
659
+ type: "tool-result";
660
+ }
661
+ | {
662
+ id: string;
663
+ providerMetadata?: Record<
664
+ string,
665
+ Record<string, any>
666
+ >;
667
+ providerOptions?: Record<
668
+ string,
669
+ Record<string, any>
670
+ >;
671
+ sourceType: "url";
672
+ title?: string;
673
+ type: "source";
674
+ url: string;
675
+ }
676
+ | {
677
+ filename?: string;
678
+ id: string;
679
+ mediaType: string;
680
+ providerMetadata?: Record<
681
+ string,
682
+ Record<string, any>
683
+ >;
684
+ providerOptions?: Record<
685
+ string,
686
+ Record<string, any>
687
+ >;
688
+ sourceType: "document";
689
+ title: string;
690
+ type: "source";
691
+ }
692
+ >;
693
+ providerOptions?: Record<string, Record<string, any>>;
694
+ role: "assistant";
695
+ }
696
+ | {
697
+ content: Array<{
698
+ args?: any;
699
+ experimental_content?: Array<
700
+ | { text: string; type: "text" }
701
+ | { data: string; mimeType?: string; type: "image" }
702
+ >;
703
+ isError?: boolean;
704
+ output?:
705
+ | { type: "text"; value: string }
706
+ | { type: "json"; value: any }
707
+ | { type: "error-text"; value: string }
708
+ | { type: "error-json"; value: any }
709
+ | {
710
+ type: "content";
711
+ value: Array<
712
+ | { text: string; type: "text" }
713
+ | { data: string; mediaType: string; type: "media" }
714
+ >;
715
+ };
716
+ providerExecuted?: boolean;
717
+ providerMetadata?: Record<string, Record<string, any>>;
718
+ providerOptions?: Record<string, Record<string, any>>;
719
+ result?: any;
720
+ toolCallId: string;
721
+ toolName: string;
722
+ type: "tool-result";
723
+ }>;
724
+ providerOptions?: Record<string, Record<string, any>>;
725
+ role: "tool";
726
+ }
727
+ | {
728
+ content: string;
729
+ providerOptions?: Record<string, Record<string, any>>;
730
+ role: "system";
731
+ };
732
+ model?: string;
733
+ order: number;
734
+ provider?: string;
735
+ providerMetadata?: Record<string, Record<string, any>>;
736
+ providerOptions?: Record<string, Record<string, any>>;
737
+ reasoning?: string;
738
+ reasoningDetails?: Array<
739
+ | {
740
+ providerMetadata?: Record<string, Record<string, any>>;
741
+ providerOptions?: Record<string, Record<string, any>>;
742
+ signature?: string;
743
+ text: string;
744
+ type: "reasoning";
745
+ }
746
+ | { signature?: string; text: string; type: "text" }
747
+ | { data: string; type: "redacted" }
748
+ >;
749
+ sources?: Array<
750
+ | {
751
+ id: string;
752
+ providerMetadata?: Record<string, Record<string, any>>;
753
+ providerOptions?: Record<string, Record<string, any>>;
754
+ sourceType: "url";
755
+ title?: string;
756
+ type?: "source";
757
+ url: string;
758
+ }
759
+ | {
760
+ filename?: string;
761
+ id: string;
762
+ mediaType: string;
763
+ providerMetadata?: Record<string, Record<string, any>>;
764
+ providerOptions?: Record<string, Record<string, any>>;
765
+ sourceType: "document";
766
+ title: string;
767
+ type: "source";
768
+ }
769
+ >;
770
+ status: "pending" | "success" | "failed";
771
+ stepOrder: number;
772
+ text?: string;
773
+ threadId: string;
774
+ tool: boolean;
775
+ usage?: {
776
+ cachedInputTokens?: number;
777
+ completionTokens: number;
778
+ promptTokens: number;
779
+ reasoningTokens?: number;
780
+ totalTokens: number;
781
+ };
782
+ userId?: string;
783
+ warnings?: Array<
784
+ | {
785
+ details?: string;
786
+ setting: string;
787
+ type: "unsupported-setting";
788
+ }
789
+ | { details?: string; tool: any; type: "unsupported-tool" }
790
+ | { message: string; type: "other" }
791
+ >;
792
+ }>;
793
+ }
794
+ >;
795
+ cloneThread: FunctionReference<
796
+ "action",
797
+ "internal",
798
+ {
799
+ batchSize?: number;
800
+ copyUserIdForVectorSearch?: boolean;
801
+ excludeToolMessages?: boolean;
802
+ insertAtOrder?: number;
803
+ limit?: number;
804
+ sourceThreadId: string;
805
+ statuses?: Array<"pending" | "success" | "failed">;
806
+ targetThreadId: string;
807
+ upToAndIncludingMessageId?: string;
808
+ },
809
+ number
810
+ >;
811
+ deleteByIds: FunctionReference<
812
+ "mutation",
813
+ "internal",
814
+ { messageIds: Array<string> },
815
+ Array<string>
816
+ >;
817
+ deleteByOrder: FunctionReference<
818
+ "mutation",
819
+ "internal",
820
+ {
821
+ endOrder: number;
822
+ endStepOrder?: number;
823
+ startOrder: number;
824
+ startStepOrder?: number;
825
+ threadId: string;
826
+ },
827
+ { isDone: boolean; lastOrder?: number; lastStepOrder?: number }
828
+ >;
829
+ finalizeMessage: FunctionReference<
830
+ "mutation",
831
+ "internal",
832
+ {
833
+ messageId: string;
834
+ result: { status: "success" } | { error: string; status: "failed" };
835
+ },
836
+ null
837
+ >;
838
+ getMessagesByIds: FunctionReference<
839
+ "query",
840
+ "internal",
841
+ { messageIds: Array<string> },
842
+ Array<null | {
843
+ _creationTime: number;
844
+ _id: string;
845
+ agentName?: string;
846
+ embeddingId?: string;
847
+ error?: string;
848
+ fileIds?: Array<string>;
849
+ finishReason?:
850
+ | "stop"
851
+ | "length"
852
+ | "content-filter"
853
+ | "tool-calls"
854
+ | "error"
855
+ | "other"
856
+ | "unknown";
857
+ id?: string;
858
+ message?:
859
+ | {
860
+ content:
861
+ | string
862
+ | Array<
863
+ | {
864
+ providerMetadata?: Record<
865
+ string,
866
+ Record<string, any>
867
+ >;
868
+ providerOptions?: Record<string, Record<string, any>>;
869
+ text: string;
870
+ type: "text";
871
+ }
872
+ | {
873
+ image: string | ArrayBuffer;
874
+ mimeType?: string;
875
+ providerOptions?: Record<string, Record<string, any>>;
876
+ type: "image";
877
+ }
878
+ | {
879
+ data: string | ArrayBuffer;
880
+ filename?: string;
881
+ mimeType: string;
882
+ providerMetadata?: Record<
883
+ string,
884
+ Record<string, any>
885
+ >;
886
+ providerOptions?: Record<string, Record<string, any>>;
887
+ type: "file";
888
+ }
889
+ >;
890
+ providerOptions?: Record<string, Record<string, any>>;
891
+ role: "user";
892
+ }
893
+ | {
894
+ content:
895
+ | string
896
+ | Array<
897
+ | {
898
+ providerMetadata?: Record<
899
+ string,
900
+ Record<string, any>
901
+ >;
902
+ providerOptions?: Record<string, Record<string, any>>;
903
+ text: string;
904
+ type: "text";
905
+ }
906
+ | {
907
+ data: string | ArrayBuffer;
908
+ filename?: string;
909
+ mimeType: string;
910
+ providerMetadata?: Record<
911
+ string,
912
+ Record<string, any>
913
+ >;
914
+ providerOptions?: Record<string, Record<string, any>>;
915
+ type: "file";
916
+ }
917
+ | {
918
+ providerMetadata?: Record<
919
+ string,
920
+ Record<string, any>
921
+ >;
922
+ providerOptions?: Record<string, Record<string, any>>;
923
+ signature?: string;
924
+ text: string;
925
+ type: "reasoning";
926
+ }
927
+ | {
928
+ data: string;
929
+ providerMetadata?: Record<
930
+ string,
931
+ Record<string, any>
932
+ >;
933
+ providerOptions?: Record<string, Record<string, any>>;
934
+ type: "redacted-reasoning";
935
+ }
936
+ | {
937
+ args: any;
938
+ providerExecuted?: boolean;
939
+ providerMetadata?: Record<
940
+ string,
941
+ Record<string, any>
942
+ >;
943
+ providerOptions?: Record<string, Record<string, any>>;
944
+ toolCallId: string;
945
+ toolName: string;
946
+ type: "tool-call";
947
+ }
948
+ | {
949
+ args?: any;
950
+ experimental_content?: Array<
951
+ | { text: string; type: "text" }
952
+ | { data: string; mimeType?: string; type: "image" }
953
+ >;
954
+ isError?: boolean;
955
+ output?:
956
+ | { type: "text"; value: string }
957
+ | { type: "json"; value: any }
958
+ | { type: "error-text"; value: string }
959
+ | { type: "error-json"; value: any }
960
+ | {
961
+ type: "content";
962
+ value: Array<
963
+ | { text: string; type: "text" }
964
+ | {
965
+ data: string;
966
+ mediaType: string;
967
+ type: "media";
968
+ }
969
+ >;
970
+ };
971
+ providerExecuted?: boolean;
972
+ providerMetadata?: Record<
973
+ string,
974
+ Record<string, any>
975
+ >;
976
+ providerOptions?: Record<string, Record<string, any>>;
977
+ result?: any;
978
+ toolCallId: string;
979
+ toolName: string;
980
+ type: "tool-result";
981
+ }
982
+ | {
983
+ id: string;
984
+ providerMetadata?: Record<
985
+ string,
986
+ Record<string, any>
987
+ >;
988
+ providerOptions?: Record<string, Record<string, any>>;
989
+ sourceType: "url";
990
+ title?: string;
991
+ type: "source";
992
+ url: string;
993
+ }
994
+ | {
995
+ filename?: string;
996
+ id: string;
997
+ mediaType: string;
998
+ providerMetadata?: Record<
999
+ string,
1000
+ Record<string, any>
1001
+ >;
1002
+ providerOptions?: Record<string, Record<string, any>>;
1003
+ sourceType: "document";
1004
+ title: string;
1005
+ type: "source";
1006
+ }
1007
+ >;
1008
+ providerOptions?: Record<string, Record<string, any>>;
1009
+ role: "assistant";
1010
+ }
1011
+ | {
1012
+ content: Array<{
1013
+ args?: any;
1014
+ experimental_content?: Array<
1015
+ | { text: string; type: "text" }
1016
+ | { data: string; mimeType?: string; type: "image" }
1017
+ >;
1018
+ isError?: boolean;
1019
+ output?:
1020
+ | { type: "text"; value: string }
1021
+ | { type: "json"; value: any }
1022
+ | { type: "error-text"; value: string }
1023
+ | { type: "error-json"; value: any }
1024
+ | {
1025
+ type: "content";
1026
+ value: Array<
1027
+ | { text: string; type: "text" }
1028
+ | { data: string; mediaType: string; type: "media" }
1029
+ >;
1030
+ };
1031
+ providerExecuted?: boolean;
1032
+ providerMetadata?: Record<string, Record<string, any>>;
1033
+ providerOptions?: Record<string, Record<string, any>>;
1034
+ result?: any;
1035
+ toolCallId: string;
1036
+ toolName: string;
1037
+ type: "tool-result";
1038
+ }>;
1039
+ providerOptions?: Record<string, Record<string, any>>;
1040
+ role: "tool";
1041
+ }
1042
+ | {
1043
+ content: string;
1044
+ providerOptions?: Record<string, Record<string, any>>;
1045
+ role: "system";
1046
+ };
1047
+ model?: string;
1048
+ order: number;
1049
+ provider?: string;
1050
+ providerMetadata?: Record<string, Record<string, any>>;
1051
+ providerOptions?: Record<string, Record<string, any>>;
1052
+ reasoning?: string;
1053
+ reasoningDetails?: Array<
1054
+ | {
1055
+ providerMetadata?: Record<string, Record<string, any>>;
1056
+ providerOptions?: Record<string, Record<string, any>>;
1057
+ signature?: string;
1058
+ text: string;
1059
+ type: "reasoning";
1060
+ }
1061
+ | { signature?: string; text: string; type: "text" }
1062
+ | { data: string; type: "redacted" }
1063
+ >;
1064
+ sources?: Array<
1065
+ | {
1066
+ id: string;
1067
+ providerMetadata?: Record<string, Record<string, any>>;
1068
+ providerOptions?: Record<string, Record<string, any>>;
1069
+ sourceType: "url";
1070
+ title?: string;
1071
+ type?: "source";
1072
+ url: string;
1073
+ }
1074
+ | {
1075
+ filename?: string;
1076
+ id: string;
1077
+ mediaType: string;
1078
+ providerMetadata?: Record<string, Record<string, any>>;
1079
+ providerOptions?: Record<string, Record<string, any>>;
1080
+ sourceType: "document";
1081
+ title: string;
1082
+ type: "source";
1083
+ }
1084
+ >;
1085
+ status: "pending" | "success" | "failed";
1086
+ stepOrder: number;
1087
+ text?: string;
1088
+ threadId: string;
1089
+ tool: boolean;
1090
+ usage?: {
1091
+ cachedInputTokens?: number;
1092
+ completionTokens: number;
1093
+ promptTokens: number;
1094
+ reasoningTokens?: number;
1095
+ totalTokens: number;
1096
+ };
1097
+ userId?: string;
1098
+ warnings?: Array<
1099
+ | { details?: string; setting: string; type: "unsupported-setting" }
1100
+ | { details?: string; tool: any; type: "unsupported-tool" }
1101
+ | { message: string; type: "other" }
1102
+ >;
1103
+ }>
1104
+ >;
1105
+ getMessageSearchFields: FunctionReference<
1106
+ "query",
1107
+ "internal",
1108
+ { messageId: string },
1109
+ { embedding?: Array<number>; embeddingModel?: string; text?: string }
1110
+ >;
1111
+ listMessagesByThreadId: FunctionReference<
1112
+ "query",
1113
+ "internal",
1114
+ {
1115
+ excludeToolMessages?: boolean;
1116
+ order: "asc" | "desc";
1117
+ paginationOpts?: {
1118
+ cursor: string | null;
1119
+ endCursor?: string | null;
1120
+ id?: number;
1121
+ maximumBytesRead?: number;
1122
+ maximumRowsRead?: number;
1123
+ numItems: number;
1124
+ };
1125
+ statuses?: Array<"pending" | "success" | "failed">;
1126
+ threadId: string;
1127
+ upToAndIncludingMessageId?: string;
1128
+ },
1129
+ {
1130
+ continueCursor: string;
1131
+ isDone: boolean;
1132
+ page: Array<{
1133
+ _creationTime: number;
1134
+ _id: string;
1135
+ agentName?: string;
1136
+ embeddingId?: string;
1137
+ error?: string;
1138
+ fileIds?: Array<string>;
1139
+ finishReason?:
1140
+ | "stop"
1141
+ | "length"
1142
+ | "content-filter"
1143
+ | "tool-calls"
1144
+ | "error"
1145
+ | "other"
1146
+ | "unknown";
1147
+ id?: string;
1148
+ message?:
1149
+ | {
1150
+ content:
1151
+ | string
1152
+ | Array<
1153
+ | {
1154
+ providerMetadata?: Record<
1155
+ string,
1156
+ Record<string, any>
1157
+ >;
1158
+ providerOptions?: Record<
1159
+ string,
1160
+ Record<string, any>
1161
+ >;
1162
+ text: string;
1163
+ type: "text";
1164
+ }
1165
+ | {
1166
+ image: string | ArrayBuffer;
1167
+ mimeType?: string;
1168
+ providerOptions?: Record<
1169
+ string,
1170
+ Record<string, any>
1171
+ >;
1172
+ type: "image";
1173
+ }
1174
+ | {
1175
+ data: string | ArrayBuffer;
1176
+ filename?: string;
1177
+ mimeType: string;
1178
+ providerMetadata?: Record<
1179
+ string,
1180
+ Record<string, any>
1181
+ >;
1182
+ providerOptions?: Record<
1183
+ string,
1184
+ Record<string, any>
1185
+ >;
1186
+ type: "file";
1187
+ }
1188
+ >;
1189
+ providerOptions?: Record<string, Record<string, any>>;
1190
+ role: "user";
1191
+ }
1192
+ | {
1193
+ content:
1194
+ | string
1195
+ | Array<
1196
+ | {
1197
+ providerMetadata?: Record<
1198
+ string,
1199
+ Record<string, any>
1200
+ >;
1201
+ providerOptions?: Record<
1202
+ string,
1203
+ Record<string, any>
1204
+ >;
1205
+ text: string;
1206
+ type: "text";
1207
+ }
1208
+ | {
1209
+ data: string | ArrayBuffer;
1210
+ filename?: string;
1211
+ mimeType: string;
1212
+ providerMetadata?: Record<
1213
+ string,
1214
+ Record<string, any>
1215
+ >;
1216
+ providerOptions?: Record<
1217
+ string,
1218
+ Record<string, any>
1219
+ >;
1220
+ type: "file";
1221
+ }
1222
+ | {
1223
+ providerMetadata?: Record<
1224
+ string,
1225
+ Record<string, any>
1226
+ >;
1227
+ providerOptions?: Record<
1228
+ string,
1229
+ Record<string, any>
1230
+ >;
1231
+ signature?: string;
1232
+ text: string;
1233
+ type: "reasoning";
1234
+ }
1235
+ | {
1236
+ data: string;
1237
+ providerMetadata?: Record<
1238
+ string,
1239
+ Record<string, any>
1240
+ >;
1241
+ providerOptions?: Record<
1242
+ string,
1243
+ Record<string, any>
1244
+ >;
1245
+ type: "redacted-reasoning";
1246
+ }
1247
+ | {
1248
+ args: any;
1249
+ providerExecuted?: boolean;
1250
+ providerMetadata?: Record<
1251
+ string,
1252
+ Record<string, any>
1253
+ >;
1254
+ providerOptions?: Record<
1255
+ string,
1256
+ Record<string, any>
1257
+ >;
1258
+ toolCallId: string;
1259
+ toolName: string;
1260
+ type: "tool-call";
1261
+ }
1262
+ | {
1263
+ args?: any;
1264
+ experimental_content?: Array<
1265
+ | { text: string; type: "text" }
1266
+ | {
1267
+ data: string;
1268
+ mimeType?: string;
1269
+ type: "image";
1270
+ }
1271
+ >;
1272
+ isError?: boolean;
1273
+ output?:
1274
+ | { type: "text"; value: string }
1275
+ | { type: "json"; value: any }
1276
+ | { type: "error-text"; value: string }
1277
+ | { type: "error-json"; value: any }
1278
+ | {
1279
+ type: "content";
1280
+ value: Array<
1281
+ | { text: string; type: "text" }
1282
+ | {
1283
+ data: string;
1284
+ mediaType: string;
1285
+ type: "media";
1286
+ }
1287
+ >;
1288
+ };
1289
+ providerExecuted?: boolean;
1290
+ providerMetadata?: Record<
1291
+ string,
1292
+ Record<string, any>
1293
+ >;
1294
+ providerOptions?: Record<
1295
+ string,
1296
+ Record<string, any>
1297
+ >;
1298
+ result?: any;
1299
+ toolCallId: string;
1300
+ toolName: string;
1301
+ type: "tool-result";
1302
+ }
1303
+ | {
1304
+ id: string;
1305
+ providerMetadata?: Record<
1306
+ string,
1307
+ Record<string, any>
1308
+ >;
1309
+ providerOptions?: Record<
1310
+ string,
1311
+ Record<string, any>
1312
+ >;
1313
+ sourceType: "url";
1314
+ title?: string;
1315
+ type: "source";
1316
+ url: string;
1317
+ }
1318
+ | {
1319
+ filename?: string;
1320
+ id: string;
1321
+ mediaType: string;
1322
+ providerMetadata?: Record<
1323
+ string,
1324
+ Record<string, any>
1325
+ >;
1326
+ providerOptions?: Record<
1327
+ string,
1328
+ Record<string, any>
1329
+ >;
1330
+ sourceType: "document";
1331
+ title: string;
1332
+ type: "source";
1333
+ }
1334
+ >;
1335
+ providerOptions?: Record<string, Record<string, any>>;
1336
+ role: "assistant";
1337
+ }
1338
+ | {
1339
+ content: Array<{
1340
+ args?: any;
1341
+ experimental_content?: Array<
1342
+ | { text: string; type: "text" }
1343
+ | { data: string; mimeType?: string; type: "image" }
1344
+ >;
1345
+ isError?: boolean;
1346
+ output?:
1347
+ | { type: "text"; value: string }
1348
+ | { type: "json"; value: any }
1349
+ | { type: "error-text"; value: string }
1350
+ | { type: "error-json"; value: any }
1351
+ | {
1352
+ type: "content";
1353
+ value: Array<
1354
+ | { text: string; type: "text" }
1355
+ | { data: string; mediaType: string; type: "media" }
1356
+ >;
1357
+ };
1358
+ providerExecuted?: boolean;
1359
+ providerMetadata?: Record<string, Record<string, any>>;
1360
+ providerOptions?: Record<string, Record<string, any>>;
1361
+ result?: any;
1362
+ toolCallId: string;
1363
+ toolName: string;
1364
+ type: "tool-result";
1365
+ }>;
1366
+ providerOptions?: Record<string, Record<string, any>>;
1367
+ role: "tool";
1368
+ }
1369
+ | {
1370
+ content: string;
1371
+ providerOptions?: Record<string, Record<string, any>>;
1372
+ role: "system";
1373
+ };
1374
+ model?: string;
1375
+ order: number;
1376
+ provider?: string;
1377
+ providerMetadata?: Record<string, Record<string, any>>;
1378
+ providerOptions?: Record<string, Record<string, any>>;
1379
+ reasoning?: string;
1380
+ reasoningDetails?: Array<
1381
+ | {
1382
+ providerMetadata?: Record<string, Record<string, any>>;
1383
+ providerOptions?: Record<string, Record<string, any>>;
1384
+ signature?: string;
1385
+ text: string;
1386
+ type: "reasoning";
1387
+ }
1388
+ | { signature?: string; text: string; type: "text" }
1389
+ | { data: string; type: "redacted" }
1390
+ >;
1391
+ sources?: Array<
1392
+ | {
1393
+ id: string;
1394
+ providerMetadata?: Record<string, Record<string, any>>;
1395
+ providerOptions?: Record<string, Record<string, any>>;
1396
+ sourceType: "url";
1397
+ title?: string;
1398
+ type?: "source";
1399
+ url: string;
1400
+ }
1401
+ | {
1402
+ filename?: string;
1403
+ id: string;
1404
+ mediaType: string;
1405
+ providerMetadata?: Record<string, Record<string, any>>;
1406
+ providerOptions?: Record<string, Record<string, any>>;
1407
+ sourceType: "document";
1408
+ title: string;
1409
+ type: "source";
1410
+ }
1411
+ >;
1412
+ status: "pending" | "success" | "failed";
1413
+ stepOrder: number;
1414
+ text?: string;
1415
+ threadId: string;
1416
+ tool: boolean;
1417
+ usage?: {
1418
+ cachedInputTokens?: number;
1419
+ completionTokens: number;
1420
+ promptTokens: number;
1421
+ reasoningTokens?: number;
1422
+ totalTokens: number;
1423
+ };
1424
+ userId?: string;
1425
+ warnings?: Array<
1426
+ | {
1427
+ details?: string;
1428
+ setting: string;
1429
+ type: "unsupported-setting";
1430
+ }
1431
+ | { details?: string; tool: any; type: "unsupported-tool" }
1432
+ | { message: string; type: "other" }
1433
+ >;
1434
+ }>;
1435
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
1436
+ splitCursor?: string | null;
1437
+ }
1438
+ >;
1439
+ searchMessages: FunctionReference<
1440
+ "action",
1441
+ "internal",
1442
+ {
1443
+ embedding?: Array<number>;
1444
+ embeddingModel?: string;
1445
+ limit: number;
1446
+ messageRange?: { after: number; before: number };
1447
+ searchAllMessagesForUserId?: string;
1448
+ targetMessageId?: string;
1449
+ text?: string;
1450
+ textSearch?: boolean;
1451
+ threadId?: string;
1452
+ vectorScoreThreshold?: number;
1453
+ vectorSearch?: boolean;
1454
+ },
1455
+ Array<{
1456
+ _creationTime: number;
1457
+ _id: string;
1458
+ agentName?: string;
1459
+ embeddingId?: string;
1460
+ error?: string;
1461
+ fileIds?: Array<string>;
1462
+ finishReason?:
1463
+ | "stop"
1464
+ | "length"
1465
+ | "content-filter"
1466
+ | "tool-calls"
1467
+ | "error"
1468
+ | "other"
1469
+ | "unknown";
1470
+ id?: string;
1471
+ message?:
1472
+ | {
1473
+ content:
1474
+ | string
1475
+ | Array<
1476
+ | {
1477
+ providerMetadata?: Record<
1478
+ string,
1479
+ Record<string, any>
1480
+ >;
1481
+ providerOptions?: Record<string, Record<string, any>>;
1482
+ text: string;
1483
+ type: "text";
1484
+ }
1485
+ | {
1486
+ image: string | ArrayBuffer;
1487
+ mimeType?: string;
1488
+ providerOptions?: Record<string, Record<string, any>>;
1489
+ type: "image";
1490
+ }
1491
+ | {
1492
+ data: string | ArrayBuffer;
1493
+ filename?: string;
1494
+ mimeType: string;
1495
+ providerMetadata?: Record<
1496
+ string,
1497
+ Record<string, any>
1498
+ >;
1499
+ providerOptions?: Record<string, Record<string, any>>;
1500
+ type: "file";
1501
+ }
1502
+ >;
1503
+ providerOptions?: Record<string, Record<string, any>>;
1504
+ role: "user";
1505
+ }
1506
+ | {
1507
+ content:
1508
+ | string
1509
+ | Array<
1510
+ | {
1511
+ providerMetadata?: Record<
1512
+ string,
1513
+ Record<string, any>
1514
+ >;
1515
+ providerOptions?: Record<string, Record<string, any>>;
1516
+ text: string;
1517
+ type: "text";
1518
+ }
1519
+ | {
1520
+ data: string | ArrayBuffer;
1521
+ filename?: string;
1522
+ mimeType: string;
1523
+ providerMetadata?: Record<
1524
+ string,
1525
+ Record<string, any>
1526
+ >;
1527
+ providerOptions?: Record<string, Record<string, any>>;
1528
+ type: "file";
1529
+ }
1530
+ | {
1531
+ providerMetadata?: Record<
1532
+ string,
1533
+ Record<string, any>
1534
+ >;
1535
+ providerOptions?: Record<string, Record<string, any>>;
1536
+ signature?: string;
1537
+ text: string;
1538
+ type: "reasoning";
1539
+ }
1540
+ | {
1541
+ data: string;
1542
+ providerMetadata?: Record<
1543
+ string,
1544
+ Record<string, any>
1545
+ >;
1546
+ providerOptions?: Record<string, Record<string, any>>;
1547
+ type: "redacted-reasoning";
1548
+ }
1549
+ | {
1550
+ args: any;
1551
+ providerExecuted?: boolean;
1552
+ providerMetadata?: Record<
1553
+ string,
1554
+ Record<string, any>
1555
+ >;
1556
+ providerOptions?: Record<string, Record<string, any>>;
1557
+ toolCallId: string;
1558
+ toolName: string;
1559
+ type: "tool-call";
1560
+ }
1561
+ | {
1562
+ args?: any;
1563
+ experimental_content?: Array<
1564
+ | { text: string; type: "text" }
1565
+ | { data: string; mimeType?: string; type: "image" }
1566
+ >;
1567
+ isError?: boolean;
1568
+ output?:
1569
+ | { type: "text"; value: string }
1570
+ | { type: "json"; value: any }
1571
+ | { type: "error-text"; value: string }
1572
+ | { type: "error-json"; value: any }
1573
+ | {
1574
+ type: "content";
1575
+ value: Array<
1576
+ | { text: string; type: "text" }
1577
+ | {
1578
+ data: string;
1579
+ mediaType: string;
1580
+ type: "media";
1581
+ }
1582
+ >;
1583
+ };
1584
+ providerExecuted?: boolean;
1585
+ providerMetadata?: Record<
1586
+ string,
1587
+ Record<string, any>
1588
+ >;
1589
+ providerOptions?: Record<string, Record<string, any>>;
1590
+ result?: any;
1591
+ toolCallId: string;
1592
+ toolName: string;
1593
+ type: "tool-result";
1594
+ }
1595
+ | {
1596
+ id: string;
1597
+ providerMetadata?: Record<
1598
+ string,
1599
+ Record<string, any>
1600
+ >;
1601
+ providerOptions?: Record<string, Record<string, any>>;
1602
+ sourceType: "url";
1603
+ title?: string;
1604
+ type: "source";
1605
+ url: string;
1606
+ }
1607
+ | {
1608
+ filename?: string;
1609
+ id: string;
1610
+ mediaType: string;
1611
+ providerMetadata?: Record<
1612
+ string,
1613
+ Record<string, any>
1614
+ >;
1615
+ providerOptions?: Record<string, Record<string, any>>;
1616
+ sourceType: "document";
1617
+ title: string;
1618
+ type: "source";
1619
+ }
1620
+ >;
1621
+ providerOptions?: Record<string, Record<string, any>>;
1622
+ role: "assistant";
1623
+ }
1624
+ | {
1625
+ content: Array<{
1626
+ args?: any;
1627
+ experimental_content?: Array<
1628
+ | { text: string; type: "text" }
1629
+ | { data: string; mimeType?: string; type: "image" }
1630
+ >;
1631
+ isError?: boolean;
1632
+ output?:
1633
+ | { type: "text"; value: string }
1634
+ | { type: "json"; value: any }
1635
+ | { type: "error-text"; value: string }
1636
+ | { type: "error-json"; value: any }
1637
+ | {
1638
+ type: "content";
1639
+ value: Array<
1640
+ | { text: string; type: "text" }
1641
+ | { data: string; mediaType: string; type: "media" }
1642
+ >;
1643
+ };
1644
+ providerExecuted?: boolean;
1645
+ providerMetadata?: Record<string, Record<string, any>>;
1646
+ providerOptions?: Record<string, Record<string, any>>;
1647
+ result?: any;
1648
+ toolCallId: string;
1649
+ toolName: string;
1650
+ type: "tool-result";
1651
+ }>;
1652
+ providerOptions?: Record<string, Record<string, any>>;
1653
+ role: "tool";
1654
+ }
1655
+ | {
1656
+ content: string;
1657
+ providerOptions?: Record<string, Record<string, any>>;
1658
+ role: "system";
1659
+ };
1660
+ model?: string;
1661
+ order: number;
1662
+ provider?: string;
1663
+ providerMetadata?: Record<string, Record<string, any>>;
1664
+ providerOptions?: Record<string, Record<string, any>>;
1665
+ reasoning?: string;
1666
+ reasoningDetails?: Array<
1667
+ | {
1668
+ providerMetadata?: Record<string, Record<string, any>>;
1669
+ providerOptions?: Record<string, Record<string, any>>;
1670
+ signature?: string;
1671
+ text: string;
1672
+ type: "reasoning";
1673
+ }
1674
+ | { signature?: string; text: string; type: "text" }
1675
+ | { data: string; type: "redacted" }
1676
+ >;
1677
+ sources?: Array<
1678
+ | {
1679
+ id: string;
1680
+ providerMetadata?: Record<string, Record<string, any>>;
1681
+ providerOptions?: Record<string, Record<string, any>>;
1682
+ sourceType: "url";
1683
+ title?: string;
1684
+ type?: "source";
1685
+ url: string;
1686
+ }
1687
+ | {
1688
+ filename?: string;
1689
+ id: string;
1690
+ mediaType: string;
1691
+ providerMetadata?: Record<string, Record<string, any>>;
1692
+ providerOptions?: Record<string, Record<string, any>>;
1693
+ sourceType: "document";
1694
+ title: string;
1695
+ type: "source";
1696
+ }
1697
+ >;
1698
+ status: "pending" | "success" | "failed";
1699
+ stepOrder: number;
1700
+ text?: string;
1701
+ threadId: string;
1702
+ tool: boolean;
1703
+ usage?: {
1704
+ cachedInputTokens?: number;
1705
+ completionTokens: number;
1706
+ promptTokens: number;
1707
+ reasoningTokens?: number;
1708
+ totalTokens: number;
1709
+ };
1710
+ userId?: string;
1711
+ warnings?: Array<
1712
+ | { details?: string; setting: string; type: "unsupported-setting" }
1713
+ | { details?: string; tool: any; type: "unsupported-tool" }
1714
+ | { message: string; type: "other" }
1715
+ >;
1716
+ }>
1717
+ >;
1718
+ textSearch: FunctionReference<
1719
+ "query",
1720
+ "internal",
1721
+ {
1722
+ limit: number;
1723
+ searchAllMessagesForUserId?: string;
1724
+ targetMessageId?: string;
1725
+ text?: string;
1726
+ threadId?: string;
1727
+ },
1728
+ Array<{
1729
+ _creationTime: number;
1730
+ _id: string;
1731
+ agentName?: string;
1732
+ embeddingId?: string;
1733
+ error?: string;
1734
+ fileIds?: Array<string>;
1735
+ finishReason?:
1736
+ | "stop"
1737
+ | "length"
1738
+ | "content-filter"
1739
+ | "tool-calls"
1740
+ | "error"
1741
+ | "other"
1742
+ | "unknown";
1743
+ id?: string;
1744
+ message?:
1745
+ | {
1746
+ content:
1747
+ | string
1748
+ | Array<
1749
+ | {
1750
+ providerMetadata?: Record<
1751
+ string,
1752
+ Record<string, any>
1753
+ >;
1754
+ providerOptions?: Record<string, Record<string, any>>;
1755
+ text: string;
1756
+ type: "text";
1757
+ }
1758
+ | {
1759
+ image: string | ArrayBuffer;
1760
+ mimeType?: string;
1761
+ providerOptions?: Record<string, Record<string, any>>;
1762
+ type: "image";
1763
+ }
1764
+ | {
1765
+ data: string | ArrayBuffer;
1766
+ filename?: string;
1767
+ mimeType: string;
1768
+ providerMetadata?: Record<
1769
+ string,
1770
+ Record<string, any>
1771
+ >;
1772
+ providerOptions?: Record<string, Record<string, any>>;
1773
+ type: "file";
1774
+ }
1775
+ >;
1776
+ providerOptions?: Record<string, Record<string, any>>;
1777
+ role: "user";
1778
+ }
1779
+ | {
1780
+ content:
1781
+ | string
1782
+ | Array<
1783
+ | {
1784
+ providerMetadata?: Record<
1785
+ string,
1786
+ Record<string, any>
1787
+ >;
1788
+ providerOptions?: Record<string, Record<string, any>>;
1789
+ text: string;
1790
+ type: "text";
1791
+ }
1792
+ | {
1793
+ data: string | ArrayBuffer;
1794
+ filename?: string;
1795
+ mimeType: string;
1796
+ providerMetadata?: Record<
1797
+ string,
1798
+ Record<string, any>
1799
+ >;
1800
+ providerOptions?: Record<string, Record<string, any>>;
1801
+ type: "file";
1802
+ }
1803
+ | {
1804
+ providerMetadata?: Record<
1805
+ string,
1806
+ Record<string, any>
1807
+ >;
1808
+ providerOptions?: Record<string, Record<string, any>>;
1809
+ signature?: string;
1810
+ text: string;
1811
+ type: "reasoning";
1812
+ }
1813
+ | {
1814
+ data: string;
1815
+ providerMetadata?: Record<
1816
+ string,
1817
+ Record<string, any>
1818
+ >;
1819
+ providerOptions?: Record<string, Record<string, any>>;
1820
+ type: "redacted-reasoning";
1821
+ }
1822
+ | {
1823
+ args: any;
1824
+ providerExecuted?: boolean;
1825
+ providerMetadata?: Record<
1826
+ string,
1827
+ Record<string, any>
1828
+ >;
1829
+ providerOptions?: Record<string, Record<string, any>>;
1830
+ toolCallId: string;
1831
+ toolName: string;
1832
+ type: "tool-call";
1833
+ }
1834
+ | {
1835
+ args?: any;
1836
+ experimental_content?: Array<
1837
+ | { text: string; type: "text" }
1838
+ | { data: string; mimeType?: string; type: "image" }
1839
+ >;
1840
+ isError?: boolean;
1841
+ output?:
1842
+ | { type: "text"; value: string }
1843
+ | { type: "json"; value: any }
1844
+ | { type: "error-text"; value: string }
1845
+ | { type: "error-json"; value: any }
1846
+ | {
1847
+ type: "content";
1848
+ value: Array<
1849
+ | { text: string; type: "text" }
1850
+ | {
1851
+ data: string;
1852
+ mediaType: string;
1853
+ type: "media";
1854
+ }
1855
+ >;
1856
+ };
1857
+ providerExecuted?: boolean;
1858
+ providerMetadata?: Record<
1859
+ string,
1860
+ Record<string, any>
1861
+ >;
1862
+ providerOptions?: Record<string, Record<string, any>>;
1863
+ result?: any;
1864
+ toolCallId: string;
1865
+ toolName: string;
1866
+ type: "tool-result";
1867
+ }
1868
+ | {
1869
+ id: string;
1870
+ providerMetadata?: Record<
1871
+ string,
1872
+ Record<string, any>
1873
+ >;
1874
+ providerOptions?: Record<string, Record<string, any>>;
1875
+ sourceType: "url";
1876
+ title?: string;
1877
+ type: "source";
1878
+ url: string;
1879
+ }
1880
+ | {
1881
+ filename?: string;
1882
+ id: string;
1883
+ mediaType: string;
1884
+ providerMetadata?: Record<
1885
+ string,
1886
+ Record<string, any>
1887
+ >;
1888
+ providerOptions?: Record<string, Record<string, any>>;
1889
+ sourceType: "document";
1890
+ title: string;
1891
+ type: "source";
1892
+ }
1893
+ >;
1894
+ providerOptions?: Record<string, Record<string, any>>;
1895
+ role: "assistant";
1896
+ }
1897
+ | {
1898
+ content: Array<{
1899
+ args?: any;
1900
+ experimental_content?: Array<
1901
+ | { text: string; type: "text" }
1902
+ | { data: string; mimeType?: string; type: "image" }
1903
+ >;
1904
+ isError?: boolean;
1905
+ output?:
1906
+ | { type: "text"; value: string }
1907
+ | { type: "json"; value: any }
1908
+ | { type: "error-text"; value: string }
1909
+ | { type: "error-json"; value: any }
1910
+ | {
1911
+ type: "content";
1912
+ value: Array<
1913
+ | { text: string; type: "text" }
1914
+ | { data: string; mediaType: string; type: "media" }
1915
+ >;
1916
+ };
1917
+ providerExecuted?: boolean;
1918
+ providerMetadata?: Record<string, Record<string, any>>;
1919
+ providerOptions?: Record<string, Record<string, any>>;
1920
+ result?: any;
1921
+ toolCallId: string;
1922
+ toolName: string;
1923
+ type: "tool-result";
1924
+ }>;
1925
+ providerOptions?: Record<string, Record<string, any>>;
1926
+ role: "tool";
1927
+ }
1928
+ | {
1929
+ content: string;
1930
+ providerOptions?: Record<string, Record<string, any>>;
1931
+ role: "system";
1932
+ };
1933
+ model?: string;
1934
+ order: number;
1935
+ provider?: string;
1936
+ providerMetadata?: Record<string, Record<string, any>>;
1937
+ providerOptions?: Record<string, Record<string, any>>;
1938
+ reasoning?: string;
1939
+ reasoningDetails?: Array<
1940
+ | {
1941
+ providerMetadata?: Record<string, Record<string, any>>;
1942
+ providerOptions?: Record<string, Record<string, any>>;
1943
+ signature?: string;
1944
+ text: string;
1945
+ type: "reasoning";
1946
+ }
1947
+ | { signature?: string; text: string; type: "text" }
1948
+ | { data: string; type: "redacted" }
1949
+ >;
1950
+ sources?: Array<
1951
+ | {
1952
+ id: string;
1953
+ providerMetadata?: Record<string, Record<string, any>>;
1954
+ providerOptions?: Record<string, Record<string, any>>;
1955
+ sourceType: "url";
1956
+ title?: string;
1957
+ type?: "source";
1958
+ url: string;
1959
+ }
1960
+ | {
1961
+ filename?: string;
1962
+ id: string;
1963
+ mediaType: string;
1964
+ providerMetadata?: Record<string, Record<string, any>>;
1965
+ providerOptions?: Record<string, Record<string, any>>;
1966
+ sourceType: "document";
1967
+ title: string;
1968
+ type: "source";
1969
+ }
1970
+ >;
1971
+ status: "pending" | "success" | "failed";
1972
+ stepOrder: number;
1973
+ text?: string;
1974
+ threadId: string;
1975
+ tool: boolean;
1976
+ usage?: {
1977
+ cachedInputTokens?: number;
1978
+ completionTokens: number;
1979
+ promptTokens: number;
1980
+ reasoningTokens?: number;
1981
+ totalTokens: number;
1982
+ };
1983
+ userId?: string;
1984
+ warnings?: Array<
1985
+ | { details?: string; setting: string; type: "unsupported-setting" }
1986
+ | { details?: string; tool: any; type: "unsupported-tool" }
1987
+ | { message: string; type: "other" }
1988
+ >;
1989
+ }>
1990
+ >;
1991
+ updateMessage: FunctionReference<
1992
+ "mutation",
1993
+ "internal",
1994
+ {
1995
+ messageId: string;
1996
+ patch: {
1997
+ error?: string;
1998
+ fileIds?: Array<string>;
1999
+ finishReason?:
2000
+ | "stop"
2001
+ | "length"
2002
+ | "content-filter"
2003
+ | "tool-calls"
2004
+ | "error"
2005
+ | "other"
2006
+ | "unknown";
2007
+ message?:
2008
+ | {
2009
+ content:
2010
+ | string
2011
+ | Array<
2012
+ | {
2013
+ providerMetadata?: Record<
2014
+ string,
2015
+ Record<string, any>
2016
+ >;
2017
+ providerOptions?: Record<
2018
+ string,
2019
+ Record<string, any>
2020
+ >;
2021
+ text: string;
2022
+ type: "text";
2023
+ }
2024
+ | {
2025
+ image: string | ArrayBuffer;
2026
+ mimeType?: string;
2027
+ providerOptions?: Record<
2028
+ string,
2029
+ Record<string, any>
2030
+ >;
2031
+ type: "image";
2032
+ }
2033
+ | {
2034
+ data: string | ArrayBuffer;
2035
+ filename?: string;
2036
+ mimeType: string;
2037
+ providerMetadata?: Record<
2038
+ string,
2039
+ Record<string, any>
2040
+ >;
2041
+ providerOptions?: Record<
2042
+ string,
2043
+ Record<string, any>
2044
+ >;
2045
+ type: "file";
2046
+ }
2047
+ >;
2048
+ providerOptions?: Record<string, Record<string, any>>;
2049
+ role: "user";
2050
+ }
2051
+ | {
2052
+ content:
2053
+ | string
2054
+ | Array<
2055
+ | {
2056
+ providerMetadata?: Record<
2057
+ string,
2058
+ Record<string, any>
2059
+ >;
2060
+ providerOptions?: Record<
2061
+ string,
2062
+ Record<string, any>
2063
+ >;
2064
+ text: string;
2065
+ type: "text";
2066
+ }
2067
+ | {
2068
+ data: string | ArrayBuffer;
2069
+ filename?: string;
2070
+ mimeType: string;
2071
+ providerMetadata?: Record<
2072
+ string,
2073
+ Record<string, any>
2074
+ >;
2075
+ providerOptions?: Record<
2076
+ string,
2077
+ Record<string, any>
2078
+ >;
2079
+ type: "file";
2080
+ }
2081
+ | {
2082
+ providerMetadata?: Record<
2083
+ string,
2084
+ Record<string, any>
2085
+ >;
2086
+ providerOptions?: Record<
2087
+ string,
2088
+ Record<string, any>
2089
+ >;
2090
+ signature?: string;
2091
+ text: string;
2092
+ type: "reasoning";
2093
+ }
2094
+ | {
2095
+ data: string;
2096
+ providerMetadata?: Record<
2097
+ string,
2098
+ Record<string, any>
2099
+ >;
2100
+ providerOptions?: Record<
2101
+ string,
2102
+ Record<string, any>
2103
+ >;
2104
+ type: "redacted-reasoning";
2105
+ }
2106
+ | {
2107
+ args: any;
2108
+ providerExecuted?: boolean;
2109
+ providerMetadata?: Record<
2110
+ string,
2111
+ Record<string, any>
2112
+ >;
2113
+ providerOptions?: Record<
2114
+ string,
2115
+ Record<string, any>
2116
+ >;
2117
+ toolCallId: string;
2118
+ toolName: string;
2119
+ type: "tool-call";
2120
+ }
2121
+ | {
2122
+ args?: any;
2123
+ experimental_content?: Array<
2124
+ | { text: string; type: "text" }
2125
+ | {
2126
+ data: string;
2127
+ mimeType?: string;
2128
+ type: "image";
2129
+ }
2130
+ >;
2131
+ isError?: boolean;
2132
+ output?:
2133
+ | { type: "text"; value: string }
2134
+ | { type: "json"; value: any }
2135
+ | { type: "error-text"; value: string }
2136
+ | { type: "error-json"; value: any }
2137
+ | {
2138
+ type: "content";
2139
+ value: Array<
2140
+ | { text: string; type: "text" }
2141
+ | {
2142
+ data: string;
2143
+ mediaType: string;
2144
+ type: "media";
2145
+ }
2146
+ >;
2147
+ };
2148
+ providerExecuted?: boolean;
2149
+ providerMetadata?: Record<
2150
+ string,
2151
+ Record<string, any>
2152
+ >;
2153
+ providerOptions?: Record<
2154
+ string,
2155
+ Record<string, any>
2156
+ >;
2157
+ result?: any;
2158
+ toolCallId: string;
2159
+ toolName: string;
2160
+ type: "tool-result";
2161
+ }
2162
+ | {
2163
+ id: string;
2164
+ providerMetadata?: Record<
2165
+ string,
2166
+ Record<string, any>
2167
+ >;
2168
+ providerOptions?: Record<
2169
+ string,
2170
+ Record<string, any>
2171
+ >;
2172
+ sourceType: "url";
2173
+ title?: string;
2174
+ type: "source";
2175
+ url: string;
2176
+ }
2177
+ | {
2178
+ filename?: string;
2179
+ id: string;
2180
+ mediaType: string;
2181
+ providerMetadata?: Record<
2182
+ string,
2183
+ Record<string, any>
2184
+ >;
2185
+ providerOptions?: Record<
2186
+ string,
2187
+ Record<string, any>
2188
+ >;
2189
+ sourceType: "document";
2190
+ title: string;
2191
+ type: "source";
2192
+ }
2193
+ >;
2194
+ providerOptions?: Record<string, Record<string, any>>;
2195
+ role: "assistant";
2196
+ }
2197
+ | {
2198
+ content: Array<{
2199
+ args?: any;
2200
+ experimental_content?: Array<
2201
+ | { text: string; type: "text" }
2202
+ | { data: string; mimeType?: string; type: "image" }
2203
+ >;
2204
+ isError?: boolean;
2205
+ output?:
2206
+ | { type: "text"; value: string }
2207
+ | { type: "json"; value: any }
2208
+ | { type: "error-text"; value: string }
2209
+ | { type: "error-json"; value: any }
2210
+ | {
2211
+ type: "content";
2212
+ value: Array<
2213
+ | { text: string; type: "text" }
2214
+ | { data: string; mediaType: string; type: "media" }
2215
+ >;
2216
+ };
2217
+ providerExecuted?: boolean;
2218
+ providerMetadata?: Record<string, Record<string, any>>;
2219
+ providerOptions?: Record<string, Record<string, any>>;
2220
+ result?: any;
2221
+ toolCallId: string;
2222
+ toolName: string;
2223
+ type: "tool-result";
2224
+ }>;
2225
+ providerOptions?: Record<string, Record<string, any>>;
2226
+ role: "tool";
2227
+ }
2228
+ | {
2229
+ content: string;
2230
+ providerOptions?: Record<string, Record<string, any>>;
2231
+ role: "system";
2232
+ };
2233
+ model?: string;
2234
+ provider?: string;
2235
+ providerOptions?: Record<string, Record<string, any>>;
2236
+ status?: "pending" | "success" | "failed";
2237
+ };
2238
+ },
2239
+ {
2240
+ _creationTime: number;
2241
+ _id: string;
2242
+ agentName?: string;
2243
+ embeddingId?: string;
2244
+ error?: string;
2245
+ fileIds?: Array<string>;
2246
+ finishReason?:
2247
+ | "stop"
2248
+ | "length"
2249
+ | "content-filter"
2250
+ | "tool-calls"
2251
+ | "error"
2252
+ | "other"
2253
+ | "unknown";
2254
+ id?: string;
2255
+ message?:
2256
+ | {
2257
+ content:
2258
+ | string
2259
+ | Array<
2260
+ | {
2261
+ providerMetadata?: Record<
2262
+ string,
2263
+ Record<string, any>
2264
+ >;
2265
+ providerOptions?: Record<string, Record<string, any>>;
2266
+ text: string;
2267
+ type: "text";
2268
+ }
2269
+ | {
2270
+ image: string | ArrayBuffer;
2271
+ mimeType?: string;
2272
+ providerOptions?: Record<string, Record<string, any>>;
2273
+ type: "image";
2274
+ }
2275
+ | {
2276
+ data: string | ArrayBuffer;
2277
+ filename?: string;
2278
+ mimeType: string;
2279
+ providerMetadata?: Record<
2280
+ string,
2281
+ Record<string, any>
2282
+ >;
2283
+ providerOptions?: Record<string, Record<string, any>>;
2284
+ type: "file";
2285
+ }
2286
+ >;
2287
+ providerOptions?: Record<string, Record<string, any>>;
2288
+ role: "user";
2289
+ }
2290
+ | {
2291
+ content:
2292
+ | string
2293
+ | Array<
2294
+ | {
2295
+ providerMetadata?: Record<
2296
+ string,
2297
+ Record<string, any>
2298
+ >;
2299
+ providerOptions?: Record<string, Record<string, any>>;
2300
+ text: string;
2301
+ type: "text";
2302
+ }
2303
+ | {
2304
+ data: string | ArrayBuffer;
2305
+ filename?: string;
2306
+ mimeType: string;
2307
+ providerMetadata?: Record<
2308
+ string,
2309
+ Record<string, any>
2310
+ >;
2311
+ providerOptions?: Record<string, Record<string, any>>;
2312
+ type: "file";
2313
+ }
2314
+ | {
2315
+ providerMetadata?: Record<
2316
+ string,
2317
+ Record<string, any>
2318
+ >;
2319
+ providerOptions?: Record<string, Record<string, any>>;
2320
+ signature?: string;
2321
+ text: string;
2322
+ type: "reasoning";
2323
+ }
2324
+ | {
2325
+ data: string;
2326
+ providerMetadata?: Record<
2327
+ string,
2328
+ Record<string, any>
2329
+ >;
2330
+ providerOptions?: Record<string, Record<string, any>>;
2331
+ type: "redacted-reasoning";
2332
+ }
2333
+ | {
2334
+ args: any;
2335
+ providerExecuted?: boolean;
2336
+ providerMetadata?: Record<
2337
+ string,
2338
+ Record<string, any>
2339
+ >;
2340
+ providerOptions?: Record<string, Record<string, any>>;
2341
+ toolCallId: string;
2342
+ toolName: string;
2343
+ type: "tool-call";
2344
+ }
2345
+ | {
2346
+ args?: any;
2347
+ experimental_content?: Array<
2348
+ | { text: string; type: "text" }
2349
+ | { data: string; mimeType?: string; type: "image" }
2350
+ >;
2351
+ isError?: boolean;
2352
+ output?:
2353
+ | { type: "text"; value: string }
2354
+ | { type: "json"; value: any }
2355
+ | { type: "error-text"; value: string }
2356
+ | { type: "error-json"; value: any }
2357
+ | {
2358
+ type: "content";
2359
+ value: Array<
2360
+ | { text: string; type: "text" }
2361
+ | {
2362
+ data: string;
2363
+ mediaType: string;
2364
+ type: "media";
2365
+ }
2366
+ >;
2367
+ };
2368
+ providerExecuted?: boolean;
2369
+ providerMetadata?: Record<
2370
+ string,
2371
+ Record<string, any>
2372
+ >;
2373
+ providerOptions?: Record<string, Record<string, any>>;
2374
+ result?: any;
2375
+ toolCallId: string;
2376
+ toolName: string;
2377
+ type: "tool-result";
2378
+ }
2379
+ | {
2380
+ id: string;
2381
+ providerMetadata?: Record<
2382
+ string,
2383
+ Record<string, any>
2384
+ >;
2385
+ providerOptions?: Record<string, Record<string, any>>;
2386
+ sourceType: "url";
2387
+ title?: string;
2388
+ type: "source";
2389
+ url: string;
2390
+ }
2391
+ | {
2392
+ filename?: string;
2393
+ id: string;
2394
+ mediaType: string;
2395
+ providerMetadata?: Record<
2396
+ string,
2397
+ Record<string, any>
2398
+ >;
2399
+ providerOptions?: Record<string, Record<string, any>>;
2400
+ sourceType: "document";
2401
+ title: string;
2402
+ type: "source";
2403
+ }
2404
+ >;
2405
+ providerOptions?: Record<string, Record<string, any>>;
2406
+ role: "assistant";
2407
+ }
2408
+ | {
2409
+ content: Array<{
2410
+ args?: any;
2411
+ experimental_content?: Array<
2412
+ | { text: string; type: "text" }
2413
+ | { data: string; mimeType?: string; type: "image" }
2414
+ >;
2415
+ isError?: boolean;
2416
+ output?:
2417
+ | { type: "text"; value: string }
2418
+ | { type: "json"; value: any }
2419
+ | { type: "error-text"; value: string }
2420
+ | { type: "error-json"; value: any }
2421
+ | {
2422
+ type: "content";
2423
+ value: Array<
2424
+ | { text: string; type: "text" }
2425
+ | { data: string; mediaType: string; type: "media" }
2426
+ >;
2427
+ };
2428
+ providerExecuted?: boolean;
2429
+ providerMetadata?: Record<string, Record<string, any>>;
2430
+ providerOptions?: Record<string, Record<string, any>>;
2431
+ result?: any;
2432
+ toolCallId: string;
2433
+ toolName: string;
2434
+ type: "tool-result";
2435
+ }>;
2436
+ providerOptions?: Record<string, Record<string, any>>;
2437
+ role: "tool";
2438
+ }
2439
+ | {
2440
+ content: string;
2441
+ providerOptions?: Record<string, Record<string, any>>;
2442
+ role: "system";
2443
+ };
2444
+ model?: string;
2445
+ order: number;
2446
+ provider?: string;
2447
+ providerMetadata?: Record<string, Record<string, any>>;
2448
+ providerOptions?: Record<string, Record<string, any>>;
2449
+ reasoning?: string;
2450
+ reasoningDetails?: Array<
2451
+ | {
2452
+ providerMetadata?: Record<string, Record<string, any>>;
2453
+ providerOptions?: Record<string, Record<string, any>>;
2454
+ signature?: string;
2455
+ text: string;
2456
+ type: "reasoning";
2457
+ }
2458
+ | { signature?: string; text: string; type: "text" }
2459
+ | { data: string; type: "redacted" }
2460
+ >;
2461
+ sources?: Array<
2462
+ | {
2463
+ id: string;
2464
+ providerMetadata?: Record<string, Record<string, any>>;
2465
+ providerOptions?: Record<string, Record<string, any>>;
2466
+ sourceType: "url";
2467
+ title?: string;
2468
+ type?: "source";
2469
+ url: string;
2470
+ }
2471
+ | {
2472
+ filename?: string;
2473
+ id: string;
2474
+ mediaType: string;
2475
+ providerMetadata?: Record<string, Record<string, any>>;
2476
+ providerOptions?: Record<string, Record<string, any>>;
2477
+ sourceType: "document";
2478
+ title: string;
2479
+ type: "source";
2480
+ }
2481
+ >;
2482
+ status: "pending" | "success" | "failed";
2483
+ stepOrder: number;
2484
+ text?: string;
2485
+ threadId: string;
2486
+ tool: boolean;
2487
+ usage?: {
2488
+ cachedInputTokens?: number;
2489
+ completionTokens: number;
2490
+ promptTokens: number;
2491
+ reasoningTokens?: number;
2492
+ totalTokens: number;
2493
+ };
2494
+ userId?: string;
2495
+ warnings?: Array<
2496
+ | { details?: string; setting: string; type: "unsupported-setting" }
2497
+ | { details?: string; tool: any; type: "unsupported-tool" }
2498
+ | { message: string; type: "other" }
2499
+ >;
2500
+ }
2501
+ >;
2502
+ };
2503
+ streams: {
2504
+ abort: FunctionReference<
2505
+ "mutation",
2506
+ "internal",
2507
+ {
2508
+ finalDelta?: {
2509
+ end: number;
2510
+ parts: Array<any>;
2511
+ start: number;
2512
+ streamId: string;
2513
+ };
2514
+ reason: string;
2515
+ streamId: string;
2516
+ },
2517
+ boolean
2518
+ >;
2519
+ abortByOrder: FunctionReference<
2520
+ "mutation",
2521
+ "internal",
2522
+ { order: number; reason: string; threadId: string },
2523
+ boolean
2524
+ >;
2525
+ addDelta: FunctionReference<
2526
+ "mutation",
2527
+ "internal",
2528
+ { end: number; parts: Array<any>; start: number; streamId: string },
2529
+ boolean
2530
+ >;
2531
+ create: FunctionReference<
2532
+ "mutation",
2533
+ "internal",
2534
+ {
2535
+ agentName?: string;
2536
+ format?: "UIMessageChunk" | "TextStreamPart";
2537
+ model?: string;
2538
+ order: number;
2539
+ provider?: string;
2540
+ providerOptions?: Record<string, Record<string, any>>;
2541
+ stepOrder: number;
2542
+ threadId: string;
2543
+ userId?: string;
2544
+ },
2545
+ string
2546
+ >;
2547
+ deleteAllStreamsForThreadIdAsync: FunctionReference<
2548
+ "mutation",
2549
+ "internal",
2550
+ { deltaCursor?: string; streamOrder?: number; threadId: string },
2551
+ { deltaCursor?: string; isDone: boolean; streamOrder?: number }
2552
+ >;
2553
+ deleteAllStreamsForThreadIdSync: FunctionReference<
2554
+ "action",
2555
+ "internal",
2556
+ { threadId: string },
2557
+ null
2558
+ >;
2559
+ deleteStreamAsync: FunctionReference<
2560
+ "mutation",
2561
+ "internal",
2562
+ { cursor?: string; streamId: string },
2563
+ null
2564
+ >;
2565
+ deleteStreamSync: FunctionReference<
2566
+ "mutation",
2567
+ "internal",
2568
+ { streamId: string },
2569
+ null
2570
+ >;
2571
+ finish: FunctionReference<
2572
+ "mutation",
2573
+ "internal",
2574
+ {
2575
+ finalDelta?: {
2576
+ end: number;
2577
+ parts: Array<any>;
2578
+ start: number;
2579
+ streamId: string;
2580
+ };
2581
+ streamId: string;
2582
+ },
2583
+ null
2584
+ >;
2585
+ heartbeat: FunctionReference<
2586
+ "mutation",
2587
+ "internal",
2588
+ { streamId: string },
2589
+ null
2590
+ >;
2591
+ list: FunctionReference<
2592
+ "query",
2593
+ "internal",
2594
+ {
2595
+ startOrder?: number;
2596
+ statuses?: Array<"streaming" | "finished" | "aborted">;
2597
+ threadId: string;
2598
+ },
2599
+ Array<{
2600
+ agentName?: string;
2601
+ format?: "UIMessageChunk" | "TextStreamPart";
2602
+ model?: string;
2603
+ order: number;
2604
+ provider?: string;
2605
+ providerOptions?: Record<string, Record<string, any>>;
2606
+ status: "streaming" | "finished" | "aborted";
2607
+ stepOrder: number;
2608
+ streamId: string;
2609
+ userId?: string;
2610
+ }>
2611
+ >;
2612
+ listDeltas: FunctionReference<
2613
+ "query",
2614
+ "internal",
2615
+ {
2616
+ cursors: Array<{ cursor: number; streamId: string }>;
2617
+ threadId: string;
2618
+ },
2619
+ Array<{
2620
+ end: number;
2621
+ parts: Array<any>;
2622
+ start: number;
2623
+ streamId: string;
2624
+ }>
2625
+ >;
2626
+ };
2627
+ threads: {
2628
+ createThread: FunctionReference<
2629
+ "mutation",
2630
+ "internal",
2631
+ {
2632
+ defaultSystemPrompt?: string;
2633
+ parentThreadIds?: Array<string>;
2634
+ summary?: string;
2635
+ title?: string;
2636
+ userId?: string;
2637
+ },
2638
+ {
2639
+ _creationTime: number;
2640
+ _id: string;
2641
+ status: "active" | "archived";
2642
+ summary?: string;
2643
+ title?: string;
2644
+ userId?: string;
2645
+ }
2646
+ >;
2647
+ deleteAllForThreadIdAsync: FunctionReference<
2648
+ "mutation",
2649
+ "internal",
2650
+ {
2651
+ cursor?: string;
2652
+ deltaCursor?: string;
2653
+ limit?: number;
2654
+ messagesDone?: boolean;
2655
+ streamOrder?: number;
2656
+ streamsDone?: boolean;
2657
+ threadId: string;
2658
+ },
2659
+ { isDone: boolean }
2660
+ >;
2661
+ deleteAllForThreadIdSync: FunctionReference<
2662
+ "action",
2663
+ "internal",
2664
+ { limit?: number; threadId: string },
2665
+ null
2666
+ >;
2667
+ getThread: FunctionReference<
2668
+ "query",
2669
+ "internal",
2670
+ { threadId: string },
2671
+ {
2672
+ _creationTime: number;
2673
+ _id: string;
2674
+ status: "active" | "archived";
2675
+ summary?: string;
2676
+ title?: string;
2677
+ userId?: string;
2678
+ } | null
2679
+ >;
2680
+ listThreadsByUserId: FunctionReference<
2681
+ "query",
2682
+ "internal",
2683
+ {
2684
+ order?: "asc" | "desc";
2685
+ paginationOpts?: {
2686
+ cursor: string | null;
2687
+ endCursor?: string | null;
2688
+ id?: number;
2689
+ maximumBytesRead?: number;
2690
+ maximumRowsRead?: number;
2691
+ numItems: number;
2692
+ };
2693
+ userId?: string;
2694
+ },
2695
+ {
2696
+ continueCursor: string;
2697
+ isDone: boolean;
2698
+ page: Array<{
2699
+ _creationTime: number;
2700
+ _id: string;
2701
+ status: "active" | "archived";
2702
+ summary?: string;
2703
+ title?: string;
2704
+ userId?: string;
2705
+ }>;
2706
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
2707
+ splitCursor?: string | null;
2708
+ }
2709
+ >;
2710
+ searchThreadTitles: FunctionReference<
2711
+ "query",
2712
+ "internal",
2713
+ { limit: number; query: string; userId?: string | null },
2714
+ Array<{
2715
+ _creationTime: number;
2716
+ _id: string;
2717
+ status: "active" | "archived";
2718
+ summary?: string;
2719
+ title?: string;
2720
+ userId?: string;
2721
+ }>
2722
+ >;
2723
+ updateThread: FunctionReference<
2724
+ "mutation",
2725
+ "internal",
2726
+ {
2727
+ patch: {
2728
+ status?: "active" | "archived";
2729
+ summary?: string;
2730
+ title?: string;
2731
+ userId?: string;
2732
+ };
2733
+ threadId: string;
2734
+ },
2735
+ {
2736
+ _creationTime: number;
2737
+ _id: string;
2738
+ status: "active" | "archived";
2739
+ summary?: string;
2740
+ title?: string;
2741
+ userId?: string;
2742
+ }
2743
+ >;
2744
+ };
2745
+ users: {
2746
+ deleteAllForUserId: FunctionReference<
2747
+ "action",
2748
+ "internal",
2749
+ { userId: string },
2750
+ null
2751
+ >;
2752
+ deleteAllForUserIdAsync: FunctionReference<
2753
+ "mutation",
2754
+ "internal",
2755
+ { userId: string },
2756
+ boolean
2757
+ >;
2758
+ listUsersWithThreads: FunctionReference<
2759
+ "query",
2760
+ "internal",
2761
+ {
2762
+ paginationOpts: {
2763
+ cursor: string | null;
2764
+ endCursor?: string | null;
2765
+ id?: number;
2766
+ maximumBytesRead?: number;
2767
+ maximumRowsRead?: number;
2768
+ numItems: number;
2769
+ };
2770
+ },
2771
+ {
2772
+ continueCursor: string;
2773
+ isDone: boolean;
2774
+ page: Array<string>;
2775
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
2776
+ splitCursor?: string | null;
2777
+ }
2778
+ >;
2779
+ };
2780
+ vector: {
2781
+ index: {
2782
+ deleteBatch: FunctionReference<
2783
+ "mutation",
2784
+ "internal",
2785
+ {
2786
+ ids: Array<
2787
+ | string
2788
+ | string
2789
+ | string
2790
+ | string
2791
+ | string
2792
+ | string
2793
+ | string
2794
+ | string
2795
+ | string
2796
+ | string
2797
+ >;
2798
+ },
2799
+ null
2800
+ >;
2801
+ deleteBatchForThread: FunctionReference<
2802
+ "mutation",
2803
+ "internal",
2804
+ {
2805
+ cursor?: string;
2806
+ limit: number;
2807
+ model: string;
2808
+ threadId: string;
2809
+ vectorDimension:
2810
+ | 128
2811
+ | 256
2812
+ | 512
2813
+ | 768
2814
+ | 1024
2815
+ | 1408
2816
+ | 1536
2817
+ | 2048
2818
+ | 3072
2819
+ | 4096;
2820
+ },
2821
+ { continueCursor: string; isDone: boolean }
2822
+ >;
2823
+ insertBatch: FunctionReference<
2824
+ "mutation",
2825
+ "internal",
2826
+ {
2827
+ vectorDimension:
2828
+ | 128
2829
+ | 256
2830
+ | 512
2831
+ | 768
2832
+ | 1024
2833
+ | 1408
2834
+ | 1536
2835
+ | 2048
2836
+ | 3072
2837
+ | 4096;
2838
+ vectors: Array<{
2839
+ messageId?: string;
2840
+ model: string;
2841
+ table: string;
2842
+ threadId?: string;
2843
+ userId?: string;
2844
+ vector: Array<number>;
2845
+ }>;
2846
+ },
2847
+ Array<
2848
+ | string
2849
+ | string
2850
+ | string
2851
+ | string
2852
+ | string
2853
+ | string
2854
+ | string
2855
+ | string
2856
+ | string
2857
+ | string
2858
+ >
2859
+ >;
2860
+ paginate: FunctionReference<
2861
+ "query",
2862
+ "internal",
2863
+ {
2864
+ cursor?: string;
2865
+ limit: number;
2866
+ table?: string;
2867
+ targetModel: string;
2868
+ vectorDimension:
2869
+ | 128
2870
+ | 256
2871
+ | 512
2872
+ | 768
2873
+ | 1024
2874
+ | 1408
2875
+ | 1536
2876
+ | 2048
2877
+ | 3072
2878
+ | 4096;
2879
+ },
2880
+ {
2881
+ continueCursor: string;
2882
+ ids: Array<
2883
+ | string
2884
+ | string
2885
+ | string
2886
+ | string
2887
+ | string
2888
+ | string
2889
+ | string
2890
+ | string
2891
+ | string
2892
+ | string
2893
+ >;
2894
+ isDone: boolean;
2895
+ }
2896
+ >;
2897
+ updateBatch: FunctionReference<
2898
+ "mutation",
2899
+ "internal",
2900
+ {
2901
+ vectors: Array<{
2902
+ id:
2903
+ | string
2904
+ | string
2905
+ | string
2906
+ | string
2907
+ | string
2908
+ | string
2909
+ | string
2910
+ | string
2911
+ | string
2912
+ | string;
2913
+ model: string;
2914
+ vector: Array<number>;
2915
+ }>;
2916
+ },
2917
+ null
2918
+ >;
2919
+ };
2920
+ };
2921
+ };
2922
+ };