@fatagnus/convex-feedback 0.2.6 → 0.2.8

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