@cossistant/types 0.0.31 → 0.0.33
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.
- package/api/ai-agent.d.ts +127 -1
- package/api/ai-agent.d.ts.map +1 -1
- package/api/ai-agent.js +125 -1
- package/api/ai-agent.js.map +1 -1
- package/api/common.d.ts.map +1 -1
- package/api/conversation.d.ts +381 -0
- package/api/conversation.d.ts.map +1 -1
- package/api/conversation.js +1 -0
- package/api/conversation.js.map +1 -1
- package/api/feedback.d.ts +98 -0
- package/api/feedback.d.ts.map +1 -0
- package/api/feedback.js +68 -0
- package/api/feedback.js.map +1 -0
- package/api/index.d.ts +4 -3
- package/api/index.js +3 -2
- package/api/timeline-item.d.ts +481 -1
- package/api/timeline-item.d.ts.map +1 -1
- package/api/timeline-item.js +17 -3
- package/api/timeline-item.js.map +1 -1
- package/enums.d.ts +1 -0
- package/enums.d.ts.map +1 -1
- package/enums.js +2 -1
- package/enums.js.map +1 -1
- package/index.d.ts +5 -3
- package/index.d.ts.map +1 -1
- package/index.js +4 -2
- package/package.json +1 -1
- package/realtime-events.d.ts +246 -0
- package/realtime-events.d.ts.map +1 -1
- package/realtime-events.js +22 -4
- package/realtime-events.js.map +1 -1
- package/schemas.d.ts +76 -0
- package/schemas.d.ts.map +1 -1
- package/tool-timeline-policy.d.ts +13 -0
- package/tool-timeline-policy.d.ts.map +1 -0
- package/tool-timeline-policy.js +24 -0
- package/tool-timeline-policy.js.map +1 -0
- package/trpc/conversation.d.ts +304 -0
- package/trpc/conversation.d.ts.map +1 -1
package/realtime-events.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ declare const realtimeSchema: {
|
|
|
95
95
|
message: "message";
|
|
96
96
|
event: "event";
|
|
97
97
|
identification: "identification";
|
|
98
|
+
tool: "tool";
|
|
98
99
|
}>;
|
|
99
100
|
text: z.ZodNullable<z.ZodString>;
|
|
100
101
|
parts: z.ZodArray<z.ZodUnknown>;
|
|
@@ -140,6 +141,7 @@ declare const realtimeSchema: {
|
|
|
140
141
|
message: "message";
|
|
141
142
|
event: "event";
|
|
142
143
|
identification: "identification";
|
|
144
|
+
tool: "tool";
|
|
143
145
|
}>;
|
|
144
146
|
text: z.ZodNullable<z.ZodString>;
|
|
145
147
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -165,6 +167,19 @@ declare const realtimeSchema: {
|
|
|
165
167
|
}>>;
|
|
166
168
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
167
169
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
170
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
logType: z.ZodEnum<{
|
|
172
|
+
customer_facing: "customer_facing";
|
|
173
|
+
log: "log";
|
|
174
|
+
decision: "decision";
|
|
175
|
+
}>;
|
|
176
|
+
triggerMessageId: z.ZodString;
|
|
177
|
+
workflowRunId: z.ZodString;
|
|
178
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
179
|
+
public: "public";
|
|
180
|
+
private: "private";
|
|
181
|
+
}>>;
|
|
182
|
+
}, z.core.$strip>>;
|
|
168
183
|
}, z.core.$strip>>;
|
|
169
184
|
}, z.core.$loose>>;
|
|
170
185
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -179,6 +194,29 @@ declare const realtimeSchema: {
|
|
|
179
194
|
result: "result";
|
|
180
195
|
}>;
|
|
181
196
|
errorText: z.ZodOptional<z.ZodString>;
|
|
197
|
+
callProviderMetadata: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
cossistant: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
200
|
+
public: "public";
|
|
201
|
+
private: "private";
|
|
202
|
+
}>>;
|
|
203
|
+
progressMessage: z.ZodOptional<z.ZodString>;
|
|
204
|
+
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
205
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
logType: z.ZodEnum<{
|
|
207
|
+
customer_facing: "customer_facing";
|
|
208
|
+
log: "log";
|
|
209
|
+
decision: "decision";
|
|
210
|
+
}>;
|
|
211
|
+
triggerMessageId: z.ZodString;
|
|
212
|
+
workflowRunId: z.ZodString;
|
|
213
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
214
|
+
public: "public";
|
|
215
|
+
private: "private";
|
|
216
|
+
}>>;
|
|
217
|
+
}, z.core.$strip>>;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
}, z.core.$loose>>;
|
|
182
220
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
183
221
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
184
222
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
@@ -187,6 +225,19 @@ declare const realtimeSchema: {
|
|
|
187
225
|
}>>;
|
|
188
226
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
189
227
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
228
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
logType: z.ZodEnum<{
|
|
230
|
+
customer_facing: "customer_facing";
|
|
231
|
+
log: "log";
|
|
232
|
+
decision: "decision";
|
|
233
|
+
}>;
|
|
234
|
+
triggerMessageId: z.ZodString;
|
|
235
|
+
workflowRunId: z.ZodString;
|
|
236
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
237
|
+
public: "public";
|
|
238
|
+
private: "private";
|
|
239
|
+
}>>;
|
|
240
|
+
}, z.core.$strip>>;
|
|
190
241
|
}, z.core.$strip>>;
|
|
191
242
|
}, z.core.$loose>>;
|
|
192
243
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -202,6 +253,19 @@ declare const realtimeSchema: {
|
|
|
202
253
|
}>>;
|
|
203
254
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
204
255
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
256
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
logType: z.ZodEnum<{
|
|
258
|
+
customer_facing: "customer_facing";
|
|
259
|
+
log: "log";
|
|
260
|
+
decision: "decision";
|
|
261
|
+
}>;
|
|
262
|
+
triggerMessageId: z.ZodString;
|
|
263
|
+
workflowRunId: z.ZodString;
|
|
264
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
265
|
+
public: "public";
|
|
266
|
+
private: "private";
|
|
267
|
+
}>>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
205
269
|
}, z.core.$strip>>;
|
|
206
270
|
}, z.core.$loose>>;
|
|
207
271
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -218,6 +282,19 @@ declare const realtimeSchema: {
|
|
|
218
282
|
}>>;
|
|
219
283
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
220
284
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
285
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
logType: z.ZodEnum<{
|
|
287
|
+
customer_facing: "customer_facing";
|
|
288
|
+
log: "log";
|
|
289
|
+
decision: "decision";
|
|
290
|
+
}>;
|
|
291
|
+
triggerMessageId: z.ZodString;
|
|
292
|
+
workflowRunId: z.ZodString;
|
|
293
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
294
|
+
public: "public";
|
|
295
|
+
private: "private";
|
|
296
|
+
}>>;
|
|
297
|
+
}, z.core.$strip>>;
|
|
221
298
|
}, z.core.$strip>>;
|
|
222
299
|
}, z.core.$loose>>;
|
|
223
300
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -337,6 +414,7 @@ declare const realtimeSchema: {
|
|
|
337
414
|
message: "message";
|
|
338
415
|
event: "event";
|
|
339
416
|
identification: "identification";
|
|
417
|
+
tool: "tool";
|
|
340
418
|
}>;
|
|
341
419
|
text: z.ZodNullable<z.ZodString>;
|
|
342
420
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -362,6 +440,19 @@ declare const realtimeSchema: {
|
|
|
362
440
|
}>>;
|
|
363
441
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
364
442
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
443
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
logType: z.ZodEnum<{
|
|
445
|
+
customer_facing: "customer_facing";
|
|
446
|
+
log: "log";
|
|
447
|
+
decision: "decision";
|
|
448
|
+
}>;
|
|
449
|
+
triggerMessageId: z.ZodString;
|
|
450
|
+
workflowRunId: z.ZodString;
|
|
451
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
452
|
+
public: "public";
|
|
453
|
+
private: "private";
|
|
454
|
+
}>>;
|
|
455
|
+
}, z.core.$strip>>;
|
|
365
456
|
}, z.core.$strip>>;
|
|
366
457
|
}, z.core.$loose>>;
|
|
367
458
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -376,6 +467,29 @@ declare const realtimeSchema: {
|
|
|
376
467
|
result: "result";
|
|
377
468
|
}>;
|
|
378
469
|
errorText: z.ZodOptional<z.ZodString>;
|
|
470
|
+
callProviderMetadata: z.ZodOptional<z.ZodObject<{
|
|
471
|
+
cossistant: z.ZodOptional<z.ZodObject<{
|
|
472
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
473
|
+
public: "public";
|
|
474
|
+
private: "private";
|
|
475
|
+
}>>;
|
|
476
|
+
progressMessage: z.ZodOptional<z.ZodString>;
|
|
477
|
+
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
478
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
479
|
+
logType: z.ZodEnum<{
|
|
480
|
+
customer_facing: "customer_facing";
|
|
481
|
+
log: "log";
|
|
482
|
+
decision: "decision";
|
|
483
|
+
}>;
|
|
484
|
+
triggerMessageId: z.ZodString;
|
|
485
|
+
workflowRunId: z.ZodString;
|
|
486
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
487
|
+
public: "public";
|
|
488
|
+
private: "private";
|
|
489
|
+
}>>;
|
|
490
|
+
}, z.core.$strip>>;
|
|
491
|
+
}, z.core.$strip>>;
|
|
492
|
+
}, z.core.$loose>>;
|
|
379
493
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
380
494
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
381
495
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
@@ -384,6 +498,19 @@ declare const realtimeSchema: {
|
|
|
384
498
|
}>>;
|
|
385
499
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
386
500
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
501
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
502
|
+
logType: z.ZodEnum<{
|
|
503
|
+
customer_facing: "customer_facing";
|
|
504
|
+
log: "log";
|
|
505
|
+
decision: "decision";
|
|
506
|
+
}>;
|
|
507
|
+
triggerMessageId: z.ZodString;
|
|
508
|
+
workflowRunId: z.ZodString;
|
|
509
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
510
|
+
public: "public";
|
|
511
|
+
private: "private";
|
|
512
|
+
}>>;
|
|
513
|
+
}, z.core.$strip>>;
|
|
387
514
|
}, z.core.$strip>>;
|
|
388
515
|
}, z.core.$loose>>;
|
|
389
516
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -399,6 +526,19 @@ declare const realtimeSchema: {
|
|
|
399
526
|
}>>;
|
|
400
527
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
401
528
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
529
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
530
|
+
logType: z.ZodEnum<{
|
|
531
|
+
customer_facing: "customer_facing";
|
|
532
|
+
log: "log";
|
|
533
|
+
decision: "decision";
|
|
534
|
+
}>;
|
|
535
|
+
triggerMessageId: z.ZodString;
|
|
536
|
+
workflowRunId: z.ZodString;
|
|
537
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
538
|
+
public: "public";
|
|
539
|
+
private: "private";
|
|
540
|
+
}>>;
|
|
541
|
+
}, z.core.$strip>>;
|
|
402
542
|
}, z.core.$strip>>;
|
|
403
543
|
}, z.core.$loose>>;
|
|
404
544
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -415,6 +555,19 @@ declare const realtimeSchema: {
|
|
|
415
555
|
}>>;
|
|
416
556
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
417
557
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
558
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
559
|
+
logType: z.ZodEnum<{
|
|
560
|
+
customer_facing: "customer_facing";
|
|
561
|
+
log: "log";
|
|
562
|
+
decision: "decision";
|
|
563
|
+
}>;
|
|
564
|
+
triggerMessageId: z.ZodString;
|
|
565
|
+
workflowRunId: z.ZodString;
|
|
566
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
567
|
+
public: "public";
|
|
568
|
+
private: "private";
|
|
569
|
+
}>>;
|
|
570
|
+
}, z.core.$strip>>;
|
|
418
571
|
}, z.core.$strip>>;
|
|
419
572
|
}, z.core.$loose>>;
|
|
420
573
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -482,6 +635,7 @@ declare const realtimeSchema: {
|
|
|
482
635
|
message: "message";
|
|
483
636
|
event: "event";
|
|
484
637
|
identification: "identification";
|
|
638
|
+
tool: "tool";
|
|
485
639
|
}>;
|
|
486
640
|
text: z.ZodNullable<z.ZodString>;
|
|
487
641
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -507,6 +661,19 @@ declare const realtimeSchema: {
|
|
|
507
661
|
}>>;
|
|
508
662
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
509
663
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
664
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
665
|
+
logType: z.ZodEnum<{
|
|
666
|
+
customer_facing: "customer_facing";
|
|
667
|
+
log: "log";
|
|
668
|
+
decision: "decision";
|
|
669
|
+
}>;
|
|
670
|
+
triggerMessageId: z.ZodString;
|
|
671
|
+
workflowRunId: z.ZodString;
|
|
672
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
673
|
+
public: "public";
|
|
674
|
+
private: "private";
|
|
675
|
+
}>>;
|
|
676
|
+
}, z.core.$strip>>;
|
|
510
677
|
}, z.core.$strip>>;
|
|
511
678
|
}, z.core.$loose>>;
|
|
512
679
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -521,6 +688,29 @@ declare const realtimeSchema: {
|
|
|
521
688
|
result: "result";
|
|
522
689
|
}>;
|
|
523
690
|
errorText: z.ZodOptional<z.ZodString>;
|
|
691
|
+
callProviderMetadata: z.ZodOptional<z.ZodObject<{
|
|
692
|
+
cossistant: z.ZodOptional<z.ZodObject<{
|
|
693
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
694
|
+
public: "public";
|
|
695
|
+
private: "private";
|
|
696
|
+
}>>;
|
|
697
|
+
progressMessage: z.ZodOptional<z.ZodString>;
|
|
698
|
+
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
699
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
700
|
+
logType: z.ZodEnum<{
|
|
701
|
+
customer_facing: "customer_facing";
|
|
702
|
+
log: "log";
|
|
703
|
+
decision: "decision";
|
|
704
|
+
}>;
|
|
705
|
+
triggerMessageId: z.ZodString;
|
|
706
|
+
workflowRunId: z.ZodString;
|
|
707
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
708
|
+
public: "public";
|
|
709
|
+
private: "private";
|
|
710
|
+
}>>;
|
|
711
|
+
}, z.core.$strip>>;
|
|
712
|
+
}, z.core.$strip>>;
|
|
713
|
+
}, z.core.$loose>>;
|
|
524
714
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
525
715
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
526
716
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
@@ -529,6 +719,19 @@ declare const realtimeSchema: {
|
|
|
529
719
|
}>>;
|
|
530
720
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
531
721
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
722
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
723
|
+
logType: z.ZodEnum<{
|
|
724
|
+
customer_facing: "customer_facing";
|
|
725
|
+
log: "log";
|
|
726
|
+
decision: "decision";
|
|
727
|
+
}>;
|
|
728
|
+
triggerMessageId: z.ZodString;
|
|
729
|
+
workflowRunId: z.ZodString;
|
|
730
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
731
|
+
public: "public";
|
|
732
|
+
private: "private";
|
|
733
|
+
}>>;
|
|
734
|
+
}, z.core.$strip>>;
|
|
532
735
|
}, z.core.$strip>>;
|
|
533
736
|
}, z.core.$loose>>;
|
|
534
737
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -544,6 +747,19 @@ declare const realtimeSchema: {
|
|
|
544
747
|
}>>;
|
|
545
748
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
546
749
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
750
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
751
|
+
logType: z.ZodEnum<{
|
|
752
|
+
customer_facing: "customer_facing";
|
|
753
|
+
log: "log";
|
|
754
|
+
decision: "decision";
|
|
755
|
+
}>;
|
|
756
|
+
triggerMessageId: z.ZodString;
|
|
757
|
+
workflowRunId: z.ZodString;
|
|
758
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
759
|
+
public: "public";
|
|
760
|
+
private: "private";
|
|
761
|
+
}>>;
|
|
762
|
+
}, z.core.$strip>>;
|
|
547
763
|
}, z.core.$strip>>;
|
|
548
764
|
}, z.core.$loose>>;
|
|
549
765
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -560,6 +776,19 @@ declare const realtimeSchema: {
|
|
|
560
776
|
}>>;
|
|
561
777
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
562
778
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
779
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
780
|
+
logType: z.ZodEnum<{
|
|
781
|
+
customer_facing: "customer_facing";
|
|
782
|
+
log: "log";
|
|
783
|
+
decision: "decision";
|
|
784
|
+
}>;
|
|
785
|
+
triggerMessageId: z.ZodString;
|
|
786
|
+
workflowRunId: z.ZodString;
|
|
787
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
788
|
+
public: "public";
|
|
789
|
+
private: "private";
|
|
790
|
+
}>>;
|
|
791
|
+
}, z.core.$strip>>;
|
|
563
792
|
}, z.core.$strip>>;
|
|
564
793
|
}, z.core.$loose>>;
|
|
565
794
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -731,6 +960,22 @@ declare const realtimeSchema: {
|
|
|
731
960
|
sentimentConfidence: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
732
961
|
escalatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
733
962
|
escalationReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
963
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
964
|
+
open: "open";
|
|
965
|
+
resolved: "resolved";
|
|
966
|
+
spam: "spam";
|
|
967
|
+
}>>;
|
|
968
|
+
priority: z.ZodOptional<z.ZodEnum<{
|
|
969
|
+
low: "low";
|
|
970
|
+
normal: "normal";
|
|
971
|
+
high: "high";
|
|
972
|
+
urgent: "urgent";
|
|
973
|
+
}>>;
|
|
974
|
+
resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
975
|
+
resolvedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
976
|
+
resolvedByAiAgentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
977
|
+
resolutionTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
978
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
734
979
|
}, z.core.$strip>;
|
|
735
980
|
aiAgentId: z.ZodNullable<z.ZodString>;
|
|
736
981
|
}, z.core.$strip>;
|
|
@@ -832,6 +1077,7 @@ declare const realtimeSchema: {
|
|
|
832
1077
|
message: "message";
|
|
833
1078
|
event: "event";
|
|
834
1079
|
identification: "identification";
|
|
1080
|
+
tool: "tool";
|
|
835
1081
|
}>;
|
|
836
1082
|
text: z.ZodNullable<z.ZodString>;
|
|
837
1083
|
parts: z.ZodArray<z.ZodUnknown>;
|
package/realtime-events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-events.d.ts","names":[],"sources":["../src/realtime-events.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"realtime-events.d.ts","names":[],"sources":["../src/realtime-events.ts"],"sourcesContent":[],"mappings":";;;cAWa,mBAAiB,CAAA,CAAA;;EAAjB,cAAA,aAKX;;;;;;;;AAL4B,cAWjB,cAXiB,EAAA;EAAA,SAAA,aAAA,aAAA,CAAA;IAWjB,SAAA,aA2WH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EJ,qBAAqB;;;;iBAQR,gBAAA,yBAAyC;iBAIzC,0BAA0B,0BAClC,cAAc,KACnB,qBAAqB"}
|
package/realtime-events.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConversationEventType, ConversationTimelineType, TimelineItemVisibility } from "./enums.js";
|
|
1
|
+
import { ConversationEventType, ConversationStatus, ConversationTimelineType, TimelineItemVisibility } from "./enums.js";
|
|
2
2
|
import { conversationSchema } from "./schemas.js";
|
|
3
3
|
import { visitorResponseSchema } from "./api/visitor.js";
|
|
4
4
|
import { conversationHeaderSchema } from "./trpc/conversation.js";
|
|
@@ -62,7 +62,8 @@ const realtimeSchema = {
|
|
|
62
62
|
type: z.enum([
|
|
63
63
|
ConversationTimelineType.MESSAGE,
|
|
64
64
|
ConversationTimelineType.EVENT,
|
|
65
|
-
ConversationTimelineType.IDENTIFICATION
|
|
65
|
+
ConversationTimelineType.IDENTIFICATION,
|
|
66
|
+
ConversationTimelineType.TOOL
|
|
66
67
|
]),
|
|
67
68
|
text: z.string().nullable(),
|
|
68
69
|
parts: z.array(z.unknown()),
|
|
@@ -128,7 +129,23 @@ const realtimeSchema = {
|
|
|
128
129
|
]).nullable().optional(),
|
|
129
130
|
sentimentConfidence: z.number().nullable().optional(),
|
|
130
131
|
escalatedAt: z.string().nullable().optional(),
|
|
131
|
-
escalationReason: z.string().nullable().optional()
|
|
132
|
+
escalationReason: z.string().nullable().optional(),
|
|
133
|
+
status: z.enum([
|
|
134
|
+
ConversationStatus.OPEN,
|
|
135
|
+
ConversationStatus.RESOLVED,
|
|
136
|
+
ConversationStatus.SPAM
|
|
137
|
+
]).optional(),
|
|
138
|
+
priority: z.enum([
|
|
139
|
+
"low",
|
|
140
|
+
"normal",
|
|
141
|
+
"high",
|
|
142
|
+
"urgent"
|
|
143
|
+
]).optional(),
|
|
144
|
+
resolvedAt: z.string().nullable().optional(),
|
|
145
|
+
resolvedByUserId: z.string().nullable().optional(),
|
|
146
|
+
resolvedByAiAgentId: z.string().nullable().optional(),
|
|
147
|
+
resolutionTime: z.number().nullable().optional(),
|
|
148
|
+
deletedAt: z.string().nullable().optional()
|
|
132
149
|
}),
|
|
133
150
|
aiAgentId: z.string().nullable()
|
|
134
151
|
}),
|
|
@@ -194,7 +211,8 @@ const realtimeSchema = {
|
|
|
194
211
|
type: z.enum([
|
|
195
212
|
ConversationTimelineType.MESSAGE,
|
|
196
213
|
ConversationTimelineType.EVENT,
|
|
197
|
-
ConversationTimelineType.IDENTIFICATION
|
|
214
|
+
ConversationTimelineType.IDENTIFICATION,
|
|
215
|
+
ConversationTimelineType.TOOL
|
|
198
216
|
]),
|
|
199
217
|
text: z.string().nullable(),
|
|
200
218
|
parts: z.array(z.unknown()),
|
package/realtime-events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-events.js","names":[],"sources":["../src/realtime-events.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { visitorResponseSchema } from \"./api/visitor\";\nimport {\n\tConversationEventType,\n\tConversationTimelineType,\n\tTimelineItemVisibility,\n} from \"./enums\";\nimport { conversationSchema } from \"./schemas\";\nimport { conversationHeaderSchema } from \"./trpc/conversation\";\n\nexport const baseRealtimeEvent = z.object({\n\twebsiteId: z.string(),\n\torganizationId: z.string(),\n\tvisitorId: z.string().nullable(),\n\tuserId: z.string().nullable(),\n});\n\n/**\n * Central event system for real-time communication\n * All WebSocket and Redis Pub/Sub events are defined here\n */\nexport const realtimeSchema = {\n\tuserConnected: baseRealtimeEvent.extend({\n\t\tconnectionId: z.string(),\n\t}),\n\tuserDisconnected: baseRealtimeEvent.extend({\n\t\tconnectionId: z.string(),\n\t}),\n\tvisitorConnected: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tconnectionId: z.string(),\n\t}),\n\tvisitorDisconnected: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tconnectionId: z.string(),\n\t}),\n\tuserPresenceUpdate: baseRealtimeEvent.extend({\n\t\tuserId: z.string(),\n\t\tstatus: z.enum([\"online\", \"away\", \"offline\"]),\n\t\tlastSeen: z.string(),\n\t}),\n\tconversationSeen: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tlastSeenAt: z.string(),\n\t\t/** The type of actor who marked the conversation as seen */\n\t\tactorType: z.enum([\"visitor\", \"user\", \"ai_agent\"]),\n\t\t/** The actor's ID (matches one of userId, visitorId, or aiAgentId based on actorType) */\n\t\tactorId: z.string(),\n\t}),\n\tconversationTyping: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tisTyping: z.boolean(),\n\t\tvisitorPreview: z.string().max(2000).nullable().optional(),\n\t}),\n\ttimelineItemCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\titem: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\tvisibility: z.enum([\n\t\t\t\tTimelineItemVisibility.PUBLIC,\n\t\t\t\tTimelineItemVisibility.PRIVATE,\n\t\t\t]),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationTimelineType.MESSAGE,\n\t\t\t\tConversationTimelineType.EVENT,\n\t\t\t\tConversationTimelineType.IDENTIFICATION,\n\t\t\t]),\n\t\t\ttext: z.string().nullable(),\n\t\t\tparts: z.array(z.unknown()),\n\t\t\tuserId: z.string().nullable(),\n\t\t\tvisitorId: z.string().nullable(),\n\t\t\taiAgentId: z.string().nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t\ttool: z.string().nullable().optional(),\n\t\t}),\n\t}),\n\tconversationCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\tconversation: conversationSchema,\n\t\theader: conversationHeaderSchema,\n\t}),\n\tvisitorIdentified: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tvisitor: visitorResponseSchema,\n\t}),\n\tconversationEventCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tevent: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationEventType.ASSIGNED,\n\t\t\t\tConversationEventType.UNASSIGNED,\n\t\t\t\tConversationEventType.PARTICIPANT_REQUESTED,\n\t\t\t\tConversationEventType.PARTICIPANT_JOINED,\n\t\t\t\tConversationEventType.PARTICIPANT_LEFT,\n\t\t\t\tConversationEventType.STATUS_CHANGED,\n\t\t\t\tConversationEventType.PRIORITY_CHANGED,\n\t\t\t\tConversationEventType.TAG_ADDED,\n\t\t\t\tConversationEventType.TAG_REMOVED,\n\t\t\t\tConversationEventType.RESOLVED,\n\t\t\t\tConversationEventType.REOPENED,\n\t\t\t\tConversationEventType.VISITOR_BLOCKED,\n\t\t\t\tConversationEventType.VISITOR_UNBLOCKED,\n\t\t\t\tConversationEventType.VISITOR_IDENTIFIED,\n\t\t\t]),\n\t\t\tactorUserId: z.string().nullable(),\n\t\t\tactorAiAgentId: z.string().nullable(),\n\t\t\ttargetUserId: z.string().nullable(),\n\t\t\ttargetAiAgentId: z.string().nullable(),\n\t\t\tmessage: z.string().nullable(),\n\t\t\tmetadata: z.record(z.string(), z.unknown()).nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tupdatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t}),\n\t}),\n\t// Conversation updated (title, sentiment, escalation status changes)\n\tconversationUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\tupdates: z.object({\n\t\t\ttitle: z.string().nullable().optional(),\n\t\t\tsentiment: z\n\t\t\t\t.enum([\"positive\", \"negative\", \"neutral\"])\n\t\t\t\t.nullable()\n\t\t\t\t.optional(),\n\t\t\tsentimentConfidence: z.number().nullable().optional(),\n\t\t\tescalatedAt: z.string().nullable().optional(),\n\t\t\tescalationReason: z.string().nullable().optional(),\n\t\t}),\n\t\taiAgentId: z.string().nullable(),\n\t}),\n\n\t// =========================================================================\n\t// AI AGENT PROCESSING EVENTS\n\t// For progressive UI updates during AI agent responses\n\t//\n\t// AUDIENCE FIELD:\n\t// - 'all': Send to both dashboard and widget\n\t// - 'dashboard': Send only to dashboard (human agents)\n\t//\n\t// Widget (visitor) connections only receive events with audience='all'\n\t// =========================================================================\n\n\t// Emitted when AI agent starts processing a message\n\taiAgentProcessingStarted: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** ID of the trigger message that started this workflow */\n\t\ttriggerMessageId: z.string(),\n\t\t/** Initial phase of processing */\n\t\tphase: z.string().optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"dashboard\"),\n\t}),\n\n\t// Emitted when AI agent makes a decision about whether to act\n\taiAgentDecisionMade: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Whether the AI decided to take action */\n\t\tshouldAct: z.boolean(),\n\t\t/** Human-readable reason for the decision */\n\t\treason: z.string(),\n\t\t/** Response mode: how the AI is responding */\n\t\tmode: z.enum([\n\t\t\t\"respond_to_visitor\",\n\t\t\t\"respond_to_command\",\n\t\t\t\"background_only\",\n\t\t]),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]),\n\t}),\n\n\t// Emitted for progress updates during AI agent processing\n\taiAgentProcessingProgress: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Current phase: 'thinking', 'searching', 'tool-executing', 'generating', etc. */\n\t\tphase: z.string(),\n\t\t/** Human-readable message for display (widget sees this) */\n\t\tmessage: z.string().nullable(),\n\t\t/** Tool information when phase is tool-related */\n\t\ttool: z\n\t\t\t.object({\n\t\t\t\ttoolCallId: z.string(),\n\t\t\t\ttoolName: z.string(),\n\t\t\t\t/** Tool state: partial (executing), result (success), error (failed) */\n\t\t\t\tstate: z.enum([\"partial\", \"result\", \"error\"]),\n\t\t\t})\n\t\t\t.optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"all\"),\n\t}),\n\n\t// Emitted when AI agent finishes processing\n\taiAgentProcessingCompleted: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Whether processing completed successfully, was skipped, cancelled, or errored */\n\t\tstatus: z.enum([\"success\", \"skipped\", \"cancelled\", \"error\"]),\n\t\t/** Action taken (if status is 'success') */\n\t\taction: z.string().nullable().optional(),\n\t\t/** Reason for skip/cancel/error */\n\t\treason: z.string().nullable().optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"all\"),\n\t}),\n\n\t// =========================================================================\n\t// TIMELINE ITEM UPDATE EVENTS\n\t// For updating timeline items with new parts or state changes\n\t// =========================================================================\n\n\t// Emitted when an entire timeline item is updated (e.g., parts added)\n\ttimelineItemUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\titem: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\tvisibility: z.enum([\n\t\t\t\tTimelineItemVisibility.PUBLIC,\n\t\t\t\tTimelineItemVisibility.PRIVATE,\n\t\t\t]),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationTimelineType.MESSAGE,\n\t\t\t\tConversationTimelineType.EVENT,\n\t\t\t\tConversationTimelineType.IDENTIFICATION,\n\t\t\t]),\n\t\t\ttext: z.string().nullable(),\n\t\t\tparts: z.array(z.unknown()),\n\t\t\tuserId: z.string().nullable(),\n\t\t\tvisitorId: z.string().nullable(),\n\t\t\taiAgentId: z.string().nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t\ttool: z.string().nullable().optional(),\n\t\t}),\n\t}),\n\n\t// Emitted for granular part updates (e.g., tool state changes)\n\ttimelineItemPartUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\ttimelineItemId: z.string(),\n\t\t/** Index of the part in the parts array */\n\t\tpartIndex: z.number(),\n\t\t/** The updated part data */\n\t\tpart: z.unknown(),\n\t}),\n\t// Web crawling events\n\tcrawlStarted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tdiscoveredPages: z.array(\n\t\t\tz.object({\n\t\t\t\turl: z.string(),\n\t\t\t\ttitle: z.string().nullable(),\n\t\t\t\tdepth: z.number(),\n\t\t\t})\n\t\t),\n\t\ttotalPagesCount: z.number(),\n\t}),\n\tcrawlProgress: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tpage: z.object({\n\t\t\turl: z.string(),\n\t\t\ttitle: z.string().nullable(),\n\t\t\tstatus: z.enum([\"pending\", \"crawling\", \"completed\", \"failed\"]),\n\t\t\tsizeBytes: z.number().optional(),\n\t\t\terror: z.string().nullable().optional(),\n\t\t}),\n\t\tcompletedCount: z.number(),\n\t\ttotalCount: z.number(),\n\t}),\n\tcrawlCompleted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tcrawledPagesCount: z.number(),\n\t\ttotalSizeBytes: z.number(),\n\t\tfailedPagesCount: z.number(),\n\t}),\n\tcrawlFailed: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\terror: z.string(),\n\t}),\n\t// Link source updated (for status changes, etc.)\n\tlinkSourceUpdated: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tstatus: z.enum([\"pending\", \"mapping\", \"crawling\", \"completed\", \"failed\"]),\n\t\tdiscoveredPagesCount: z.number().optional(),\n\t\tcrawledPagesCount: z.number().optional(),\n\t\ttotalSizeBytes: z.number().optional(),\n\t\terrorMessage: z.string().nullable().optional(),\n\t}),\n\t// Emitted after map phase with all discovered URLs (for real-time tree display)\n\tcrawlPagesDiscovered: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tpages: z.array(\n\t\t\tz.object({\n\t\t\t\turl: z.string(),\n\t\t\t\tpath: z.string(),\n\t\t\t\tdepth: z.number(),\n\t\t\t})\n\t\t),\n\t}),\n\t// Emitted when each page completes scraping (for real-time updates)\n\tcrawlPageCompleted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tpage: z.object({\n\t\t\turl: z.string(),\n\t\t\ttitle: z.string().nullable(),\n\t\t\tsizeBytes: z.number(),\n\t\t\tknowledgeId: z.string(),\n\t\t}),\n\t}),\n\n\t// =========================================================================\n\t// AI TRAINING EVENTS\n\t// For knowledge base embedding generation and progress tracking\n\t// =========================================================================\n\n\t// Emitted when AI training starts\n\ttrainingStarted: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\ttotalItems: z.number(),\n\t}),\n\n\t// Emitted for progress updates during AI training\n\ttrainingProgress: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\tprocessedItems: z.number(),\n\t\ttotalItems: z.number(),\n\t\tcurrentItem: z\n\t\t\t.object({\n\t\t\t\tid: z.string(),\n\t\t\t\ttitle: z.string().nullable(),\n\t\t\t\ttype: z.enum([\"url\", \"faq\", \"article\"]),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpercentage: z.number(),\n\t}),\n\n\t// Emitted when AI training completes successfully\n\ttrainingCompleted: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\ttotalItems: z.number(),\n\t\ttotalChunks: z.number(),\n\t\tduration: z.number(), // milliseconds\n\t}),\n\n\t// Emitted when AI training fails\n\ttrainingFailed: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\terror: z.string(),\n\t}),\n} as const;\n\nexport type RealtimeEventType = keyof typeof realtimeSchema;\n\nexport type RealtimeEventPayload<T extends RealtimeEventType> = z.infer<\n\t(typeof realtimeSchema)[T]\n>;\n\nexport type RealtimeEvent<T extends RealtimeEventType> = {\n\ttype: T;\n\tpayload: RealtimeEventPayload<T>;\n};\n\nexport type AnyRealtimeEvent = {\n\t[K in RealtimeEventType]: RealtimeEvent<K>;\n}[RealtimeEventType];\n\nexport type RealtimeEventData<T extends RealtimeEventType> =\n\tRealtimeEventPayload<T>;\n\n/**\n * Validates an event against its schema\n */\nexport function validateRealtimeEvent<T extends RealtimeEventType>(\n\ttype: T,\n\tdata: unknown\n): RealtimeEventPayload<T> {\n\tconst schema = realtimeSchema[type];\n\treturn schema.parse(data) as RealtimeEventPayload<T>;\n}\n\n/**\n * Type guard to check if a string is a valid event type\n */\nexport function isValidEventType(type: unknown): type is RealtimeEventType {\n\treturn typeof type === \"string\" && type in realtimeSchema;\n}\n\nexport function getEventPayload<T extends RealtimeEventType>(\n\tevent: RealtimeEvent<T>\n): RealtimeEventPayload<T> {\n\treturn event.payload;\n}\n"],"mappings":";;;;;;;AAUA,MAAa,oBAAoB,EAAE,OAAO;CACzC,WAAW,EAAE,QAAQ;CACrB,gBAAgB,EAAE,QAAQ;CAC1B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;;;;;AAMF,MAAa,iBAAiB;CAC7B,eAAe,kBAAkB,OAAO,EACvC,cAAc,EAAE,QAAQ,EACxB,CAAC;CACF,kBAAkB,kBAAkB,OAAO,EAC1C,cAAc,EAAE,QAAQ,EACxB,CAAC;CACF,kBAAkB,kBAAkB,OAAO;EAC1C,WAAW,EAAE,QAAQ;EACrB,cAAc,EAAE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AE,QAAQ;GAChB,OAAO,EAAE,QAAQ;GACjB,CAAC,CACF;EACD,CAAC;CAEF,oBAAoB,kBAAkB,OAAO;EAC5C,cAAc,EAAE,QAAQ;EACxB,MAAM,EAAE,OAAO;GACd,KAAK,EAAE,QAAQ;GACf,OAAO,EAAE,QAAQ,CAAC,UAAU;GAC5B,WAAW,EAAE,QAAQ;GACrB,aAAa,EAAE,QAAQ;GACvB,CAAC;EACF,CAAC;CAQF,iBAAiB,kBAAkB,OAAO;EACzC,WAAW,EAAE,QAAQ;EACrB,YAAY,EAAE,QAAQ;EACtB,CAAC;CAGF,kBAAkB,kBAAkB,OAAO;EAC1C,WAAW,EAAE,QAAQ;EACrB,gBAAgB,EAAE,QAAQ;EAC1B,YAAY,EAAE,QAAQ;EACtB,aAAa,EACX,OAAO;GACP,IAAI,EAAE,QAAQ;GACd,OAAO,EAAE,QAAQ,CAAC,UAAU;GAC5B,MAAM,EAAE,KAAK;IAAC;IAAO;IAAO;IAAU,CAAC;GACvC,CAAC,CACD,UAAU;EACZ,YAAY,EAAE,QAAQ;EACtB,CAAC;CAGF,mBAAmB,kBAAkB,OAAO;EAC3C,WAAW,EAAE,QAAQ;EACrB,YAAY,EAAE,QAAQ;EACtB,aAAa,EAAE,QAAQ;EACvB,UAAU,EAAE,QAAQ;EACpB,CAAC;CAGF,gBAAgB,kBAAkB,OAAO;EACxC,WAAW,EAAE,QAAQ;EACrB,OAAO,EAAE,QAAQ;EACjB,CAAC;CACF;;;;AAuBD,SAAgB,sBACf,MACA,MAC0B;AAE1B,QADe,eAAe,MAChB,MAAM,KAAK;;;;;AAM1B,SAAgB,iBAAiB,MAA0C;AAC1E,QAAO,OAAO,SAAS,YAAY,QAAQ;;AAG5C,SAAgB,gBACf,OAC0B;AAC1B,QAAO,MAAM"}
|
|
1
|
+
{"version":3,"file":"realtime-events.js","names":[],"sources":["../src/realtime-events.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { visitorResponseSchema } from \"./api/visitor\";\nimport {\n\tConversationEventType,\n\tConversationStatus,\n\tConversationTimelineType,\n\tTimelineItemVisibility,\n} from \"./enums\";\nimport { conversationSchema } from \"./schemas\";\nimport { conversationHeaderSchema } from \"./trpc/conversation\";\n\nexport const baseRealtimeEvent = z.object({\n\twebsiteId: z.string(),\n\torganizationId: z.string(),\n\tvisitorId: z.string().nullable(),\n\tuserId: z.string().nullable(),\n});\n\n/**\n * Central event system for real-time communication\n * All WebSocket and Redis Pub/Sub events are defined here\n */\nexport const realtimeSchema = {\n\tuserConnected: baseRealtimeEvent.extend({\n\t\tconnectionId: z.string(),\n\t}),\n\tuserDisconnected: baseRealtimeEvent.extend({\n\t\tconnectionId: z.string(),\n\t}),\n\tvisitorConnected: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tconnectionId: z.string(),\n\t}),\n\tvisitorDisconnected: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tconnectionId: z.string(),\n\t}),\n\tuserPresenceUpdate: baseRealtimeEvent.extend({\n\t\tuserId: z.string(),\n\t\tstatus: z.enum([\"online\", \"away\", \"offline\"]),\n\t\tlastSeen: z.string(),\n\t}),\n\tconversationSeen: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tlastSeenAt: z.string(),\n\t\t/** The type of actor who marked the conversation as seen */\n\t\tactorType: z.enum([\"visitor\", \"user\", \"ai_agent\"]),\n\t\t/** The actor's ID (matches one of userId, visitorId, or aiAgentId based on actorType) */\n\t\tactorId: z.string(),\n\t}),\n\tconversationTyping: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tisTyping: z.boolean(),\n\t\tvisitorPreview: z.string().max(2000).nullable().optional(),\n\t}),\n\ttimelineItemCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\titem: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\tvisibility: z.enum([\n\t\t\t\tTimelineItemVisibility.PUBLIC,\n\t\t\t\tTimelineItemVisibility.PRIVATE,\n\t\t\t]),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationTimelineType.MESSAGE,\n\t\t\t\tConversationTimelineType.EVENT,\n\t\t\t\tConversationTimelineType.IDENTIFICATION,\n\t\t\t\tConversationTimelineType.TOOL,\n\t\t\t]),\n\t\t\ttext: z.string().nullable(),\n\t\t\tparts: z.array(z.unknown()),\n\t\t\tuserId: z.string().nullable(),\n\t\t\tvisitorId: z.string().nullable(),\n\t\t\taiAgentId: z.string().nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t\ttool: z.string().nullable().optional(),\n\t\t}),\n\t}),\n\tconversationCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\tconversation: conversationSchema,\n\t\theader: conversationHeaderSchema,\n\t}),\n\tvisitorIdentified: baseRealtimeEvent.extend({\n\t\tvisitorId: z.string(),\n\t\tvisitor: visitorResponseSchema,\n\t}),\n\tconversationEventCreated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string().nullable(),\n\t\tevent: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationEventType.ASSIGNED,\n\t\t\t\tConversationEventType.UNASSIGNED,\n\t\t\t\tConversationEventType.PARTICIPANT_REQUESTED,\n\t\t\t\tConversationEventType.PARTICIPANT_JOINED,\n\t\t\t\tConversationEventType.PARTICIPANT_LEFT,\n\t\t\t\tConversationEventType.STATUS_CHANGED,\n\t\t\t\tConversationEventType.PRIORITY_CHANGED,\n\t\t\t\tConversationEventType.TAG_ADDED,\n\t\t\t\tConversationEventType.TAG_REMOVED,\n\t\t\t\tConversationEventType.RESOLVED,\n\t\t\t\tConversationEventType.REOPENED,\n\t\t\t\tConversationEventType.VISITOR_BLOCKED,\n\t\t\t\tConversationEventType.VISITOR_UNBLOCKED,\n\t\t\t\tConversationEventType.VISITOR_IDENTIFIED,\n\t\t\t]),\n\t\t\tactorUserId: z.string().nullable(),\n\t\t\tactorAiAgentId: z.string().nullable(),\n\t\t\ttargetUserId: z.string().nullable(),\n\t\t\ttargetAiAgentId: z.string().nullable(),\n\t\t\tmessage: z.string().nullable(),\n\t\t\tmetadata: z.record(z.string(), z.unknown()).nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tupdatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t}),\n\t}),\n\t// Conversation updated (title, sentiment, escalation status changes, status changes)\n\tconversationUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\tupdates: z.object({\n\t\t\ttitle: z.string().nullable().optional(),\n\t\t\tsentiment: z\n\t\t\t\t.enum([\"positive\", \"negative\", \"neutral\"])\n\t\t\t\t.nullable()\n\t\t\t\t.optional(),\n\t\t\tsentimentConfidence: z.number().nullable().optional(),\n\t\t\tescalatedAt: z.string().nullable().optional(),\n\t\t\tescalationReason: z.string().nullable().optional(),\n\t\t\tstatus: z\n\t\t\t\t.enum([\n\t\t\t\t\tConversationStatus.OPEN,\n\t\t\t\t\tConversationStatus.RESOLVED,\n\t\t\t\t\tConversationStatus.SPAM,\n\t\t\t\t])\n\t\t\t\t.optional(),\n\t\t\tpriority: z.enum([\"low\", \"normal\", \"high\", \"urgent\"]).optional(),\n\t\t\tresolvedAt: z.string().nullable().optional(),\n\t\t\tresolvedByUserId: z.string().nullable().optional(),\n\t\t\tresolvedByAiAgentId: z.string().nullable().optional(),\n\t\t\tresolutionTime: z.number().nullable().optional(),\n\t\t\tdeletedAt: z.string().nullable().optional(),\n\t\t}),\n\t\taiAgentId: z.string().nullable(),\n\t}),\n\n\t// =========================================================================\n\t// AI AGENT PROCESSING EVENTS\n\t// For progressive UI updates during AI agent responses\n\t//\n\t// AUDIENCE FIELD:\n\t// - 'all': Send to both dashboard and widget\n\t// - 'dashboard': Send only to dashboard (human agents)\n\t//\n\t// Widget (visitor) connections only receive events with audience='all'\n\t// =========================================================================\n\n\t// Emitted when AI agent starts processing a message\n\taiAgentProcessingStarted: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** ID of the trigger message that started this workflow */\n\t\ttriggerMessageId: z.string(),\n\t\t/** Initial phase of processing */\n\t\tphase: z.string().optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"dashboard\"),\n\t}),\n\n\t// Emitted when AI agent makes a decision about whether to act\n\taiAgentDecisionMade: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Whether the AI decided to take action */\n\t\tshouldAct: z.boolean(),\n\t\t/** Human-readable reason for the decision */\n\t\treason: z.string(),\n\t\t/** Response mode: how the AI is responding */\n\t\tmode: z.enum([\n\t\t\t\"respond_to_visitor\",\n\t\t\t\"respond_to_command\",\n\t\t\t\"background_only\",\n\t\t]),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]),\n\t}),\n\n\t// Emitted for progress updates during AI agent processing\n\taiAgentProcessingProgress: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Current phase: 'thinking', 'searching', 'tool-executing', 'generating', etc. */\n\t\tphase: z.string(),\n\t\t/** Human-readable message for display (widget sees this) */\n\t\tmessage: z.string().nullable(),\n\t\t/** Tool information when phase is tool-related */\n\t\ttool: z\n\t\t\t.object({\n\t\t\t\ttoolCallId: z.string(),\n\t\t\t\ttoolName: z.string(),\n\t\t\t\t/** Tool state: partial (executing), result (success), error (failed) */\n\t\t\t\tstate: z.enum([\"partial\", \"result\", \"error\"]),\n\t\t\t})\n\t\t\t.optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"all\"),\n\t}),\n\n\t// Emitted when AI agent finishes processing\n\taiAgentProcessingCompleted: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\taiAgentId: z.string(),\n\t\tworkflowRunId: z.string(),\n\t\t/** Whether processing completed successfully, was skipped, cancelled, or errored */\n\t\tstatus: z.enum([\"success\", \"skipped\", \"cancelled\", \"error\"]),\n\t\t/** Action taken (if status is 'success') */\n\t\taction: z.string().nullable().optional(),\n\t\t/** Reason for skip/cancel/error */\n\t\treason: z.string().nullable().optional(),\n\t\t/** Audience: 'all' = everyone, 'dashboard' = team only */\n\t\taudience: z.enum([\"all\", \"dashboard\"]).default(\"all\"),\n\t}),\n\n\t// =========================================================================\n\t// TIMELINE ITEM UPDATE EVENTS\n\t// For updating timeline items with new parts or state changes\n\t// =========================================================================\n\n\t// Emitted when an entire timeline item is updated (e.g., parts added)\n\ttimelineItemUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\titem: z.object({\n\t\t\tid: z.string(),\n\t\t\tconversationId: z.string(),\n\t\t\torganizationId: z.string(),\n\t\t\tvisibility: z.enum([\n\t\t\t\tTimelineItemVisibility.PUBLIC,\n\t\t\t\tTimelineItemVisibility.PRIVATE,\n\t\t\t]),\n\t\t\ttype: z.enum([\n\t\t\t\tConversationTimelineType.MESSAGE,\n\t\t\t\tConversationTimelineType.EVENT,\n\t\t\t\tConversationTimelineType.IDENTIFICATION,\n\t\t\t\tConversationTimelineType.TOOL,\n\t\t\t]),\n\t\t\ttext: z.string().nullable(),\n\t\t\tparts: z.array(z.unknown()),\n\t\t\tuserId: z.string().nullable(),\n\t\t\tvisitorId: z.string().nullable(),\n\t\t\taiAgentId: z.string().nullable(),\n\t\t\tcreatedAt: z.string(),\n\t\t\tdeletedAt: z.string().nullable(),\n\t\t\ttool: z.string().nullable().optional(),\n\t\t}),\n\t}),\n\n\t// Emitted for granular part updates (e.g., tool state changes)\n\ttimelineItemPartUpdated: baseRealtimeEvent.extend({\n\t\tconversationId: z.string(),\n\t\ttimelineItemId: z.string(),\n\t\t/** Index of the part in the parts array */\n\t\tpartIndex: z.number(),\n\t\t/** The updated part data */\n\t\tpart: z.unknown(),\n\t}),\n\t// Web crawling events\n\tcrawlStarted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tdiscoveredPages: z.array(\n\t\t\tz.object({\n\t\t\t\turl: z.string(),\n\t\t\t\ttitle: z.string().nullable(),\n\t\t\t\tdepth: z.number(),\n\t\t\t})\n\t\t),\n\t\ttotalPagesCount: z.number(),\n\t}),\n\tcrawlProgress: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tpage: z.object({\n\t\t\turl: z.string(),\n\t\t\ttitle: z.string().nullable(),\n\t\t\tstatus: z.enum([\"pending\", \"crawling\", \"completed\", \"failed\"]),\n\t\t\tsizeBytes: z.number().optional(),\n\t\t\terror: z.string().nullable().optional(),\n\t\t}),\n\t\tcompletedCount: z.number(),\n\t\ttotalCount: z.number(),\n\t}),\n\tcrawlCompleted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\tcrawledPagesCount: z.number(),\n\t\ttotalSizeBytes: z.number(),\n\t\tfailedPagesCount: z.number(),\n\t}),\n\tcrawlFailed: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\turl: z.string(),\n\t\terror: z.string(),\n\t}),\n\t// Link source updated (for status changes, etc.)\n\tlinkSourceUpdated: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tstatus: z.enum([\"pending\", \"mapping\", \"crawling\", \"completed\", \"failed\"]),\n\t\tdiscoveredPagesCount: z.number().optional(),\n\t\tcrawledPagesCount: z.number().optional(),\n\t\ttotalSizeBytes: z.number().optional(),\n\t\terrorMessage: z.string().nullable().optional(),\n\t}),\n\t// Emitted after map phase with all discovered URLs (for real-time tree display)\n\tcrawlPagesDiscovered: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tpages: z.array(\n\t\t\tz.object({\n\t\t\t\turl: z.string(),\n\t\t\t\tpath: z.string(),\n\t\t\t\tdepth: z.number(),\n\t\t\t})\n\t\t),\n\t}),\n\t// Emitted when each page completes scraping (for real-time updates)\n\tcrawlPageCompleted: baseRealtimeEvent.extend({\n\t\tlinkSourceId: z.string(),\n\t\tpage: z.object({\n\t\t\turl: z.string(),\n\t\t\ttitle: z.string().nullable(),\n\t\t\tsizeBytes: z.number(),\n\t\t\tknowledgeId: z.string(),\n\t\t}),\n\t}),\n\n\t// =========================================================================\n\t// AI TRAINING EVENTS\n\t// For knowledge base embedding generation and progress tracking\n\t// =========================================================================\n\n\t// Emitted when AI training starts\n\ttrainingStarted: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\ttotalItems: z.number(),\n\t}),\n\n\t// Emitted for progress updates during AI training\n\ttrainingProgress: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\tprocessedItems: z.number(),\n\t\ttotalItems: z.number(),\n\t\tcurrentItem: z\n\t\t\t.object({\n\t\t\t\tid: z.string(),\n\t\t\t\ttitle: z.string().nullable(),\n\t\t\t\ttype: z.enum([\"url\", \"faq\", \"article\"]),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpercentage: z.number(),\n\t}),\n\n\t// Emitted when AI training completes successfully\n\ttrainingCompleted: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\ttotalItems: z.number(),\n\t\ttotalChunks: z.number(),\n\t\tduration: z.number(), // milliseconds\n\t}),\n\n\t// Emitted when AI training fails\n\ttrainingFailed: baseRealtimeEvent.extend({\n\t\taiAgentId: z.string(),\n\t\terror: z.string(),\n\t}),\n} as const;\n\nexport type RealtimeEventType = keyof typeof realtimeSchema;\n\nexport type RealtimeEventPayload<T extends RealtimeEventType> = z.infer<\n\t(typeof realtimeSchema)[T]\n>;\n\nexport type RealtimeEvent<T extends RealtimeEventType> = {\n\ttype: T;\n\tpayload: RealtimeEventPayload<T>;\n};\n\nexport type AnyRealtimeEvent = {\n\t[K in RealtimeEventType]: RealtimeEvent<K>;\n}[RealtimeEventType];\n\nexport type RealtimeEventData<T extends RealtimeEventType> =\n\tRealtimeEventPayload<T>;\n\n/**\n * Validates an event against its schema\n */\nexport function validateRealtimeEvent<T extends RealtimeEventType>(\n\ttype: T,\n\tdata: unknown\n): RealtimeEventPayload<T> {\n\tconst schema = realtimeSchema[type];\n\treturn schema.parse(data) as RealtimeEventPayload<T>;\n}\n\n/**\n * Type guard to check if a string is a valid event type\n */\nexport function isValidEventType(type: unknown): type is RealtimeEventType {\n\treturn typeof type === \"string\" && type in realtimeSchema;\n}\n\nexport function getEventPayload<T extends RealtimeEventType>(\n\tevent: RealtimeEvent<T>\n): RealtimeEventPayload<T> {\n\treturn event.payload;\n}\n"],"mappings":";;;;;;;AAWA,MAAa,oBAAoB,EAAE,OAAO;CACzC,WAAW,EAAE,QAAQ;CACrB,gBAAgB,EAAE,QAAQ;CAC1B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;;;;;AAMF,MAAa,iBAAiB;CAC7B,eAAe,kBAAkB,OAAO,EACvC,cAAc,EAAE,QAAQ,EACxB,CAAC;CACF,kBAAkB,kBAAkB,OAAO,EAC1C,cAAc,EAAE,QAAQ,EACxB,CAAC;CACF,kBAAkB,kBAAkB,OAAO;EAC1C,WAAW,EAAE,QAAQ;EACrB,cAAc,EAAE,QAAQ;EACxB,CAAC;CACF,qBAAqB,kBAAkB,OAAO;EAC7C,WAAW,EAAE,QAAQ;EACrB,cAAc,EAAE,QAAQ;EACxB,CAAC;CACF,oBAAoB,kBAAkB,OAAO;EAC5C,QAAQ,EAAE,QAA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C0B;AAE1B,QADe,eAAe,MAChB,MAAM,KAAK;;;;;AAM1B,SAAgB,iBAAiB,MAA0C;AAC1E,QAAO,OAAO,SAAS,YAAY,QAAQ;;AAG5C,SAAgB,gBACf,OAC0B;AAC1B,QAAO,MAAM"}
|
package/schemas.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
41
41
|
message: "message";
|
|
42
42
|
event: "event";
|
|
43
43
|
identification: "identification";
|
|
44
|
+
tool: "tool";
|
|
44
45
|
}>;
|
|
45
46
|
text: z.ZodNullable<z.ZodString>;
|
|
46
47
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -66,6 +67,19 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
66
67
|
}>>;
|
|
67
68
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
68
69
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
logType: z.ZodEnum<{
|
|
72
|
+
customer_facing: "customer_facing";
|
|
73
|
+
log: "log";
|
|
74
|
+
decision: "decision";
|
|
75
|
+
}>;
|
|
76
|
+
triggerMessageId: z.ZodString;
|
|
77
|
+
workflowRunId: z.ZodString;
|
|
78
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
public: "public";
|
|
80
|
+
private: "private";
|
|
81
|
+
}>>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
69
83
|
}, z.core.$strip>>;
|
|
70
84
|
}, z.core.$loose>>;
|
|
71
85
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -80,6 +94,29 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
80
94
|
result: "result";
|
|
81
95
|
}>;
|
|
82
96
|
errorText: z.ZodOptional<z.ZodString>;
|
|
97
|
+
callProviderMetadata: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
cossistant: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
public: "public";
|
|
101
|
+
private: "private";
|
|
102
|
+
}>>;
|
|
103
|
+
progressMessage: z.ZodOptional<z.ZodString>;
|
|
104
|
+
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
logType: z.ZodEnum<{
|
|
107
|
+
customer_facing: "customer_facing";
|
|
108
|
+
log: "log";
|
|
109
|
+
decision: "decision";
|
|
110
|
+
}>;
|
|
111
|
+
triggerMessageId: z.ZodString;
|
|
112
|
+
workflowRunId: z.ZodString;
|
|
113
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
public: "public";
|
|
115
|
+
private: "private";
|
|
116
|
+
}>>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$loose>>;
|
|
83
120
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
84
121
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
85
122
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
@@ -88,6 +125,19 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
88
125
|
}>>;
|
|
89
126
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
90
127
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
128
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
logType: z.ZodEnum<{
|
|
130
|
+
customer_facing: "customer_facing";
|
|
131
|
+
log: "log";
|
|
132
|
+
decision: "decision";
|
|
133
|
+
}>;
|
|
134
|
+
triggerMessageId: z.ZodString;
|
|
135
|
+
workflowRunId: z.ZodString;
|
|
136
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
137
|
+
public: "public";
|
|
138
|
+
private: "private";
|
|
139
|
+
}>>;
|
|
140
|
+
}, z.core.$strip>>;
|
|
91
141
|
}, z.core.$strip>>;
|
|
92
142
|
}, z.core.$loose>>;
|
|
93
143
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -103,6 +153,19 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
103
153
|
}>>;
|
|
104
154
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
105
155
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
logType: z.ZodEnum<{
|
|
158
|
+
customer_facing: "customer_facing";
|
|
159
|
+
log: "log";
|
|
160
|
+
decision: "decision";
|
|
161
|
+
}>;
|
|
162
|
+
triggerMessageId: z.ZodString;
|
|
163
|
+
workflowRunId: z.ZodString;
|
|
164
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
165
|
+
public: "public";
|
|
166
|
+
private: "private";
|
|
167
|
+
}>>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
106
169
|
}, z.core.$strip>>;
|
|
107
170
|
}, z.core.$loose>>;
|
|
108
171
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -119,6 +182,19 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
119
182
|
}>>;
|
|
120
183
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
121
184
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
185
|
+
toolTimeline: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
logType: z.ZodEnum<{
|
|
187
|
+
customer_facing: "customer_facing";
|
|
188
|
+
log: "log";
|
|
189
|
+
decision: "decision";
|
|
190
|
+
}>;
|
|
191
|
+
triggerMessageId: z.ZodString;
|
|
192
|
+
workflowRunId: z.ZodString;
|
|
193
|
+
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
public: "public";
|
|
195
|
+
private: "private";
|
|
196
|
+
}>>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
122
198
|
}, z.core.$strip>>;
|
|
123
199
|
}, z.core.$loose>>;
|
|
124
200
|
}, z.core.$strip>, z.ZodObject<{
|