@cossistant/types 0.0.30 → 0.0.32
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 +147 -1
- package/api/ai-agent.d.ts.map +1 -1
- package/api/ai-agent.js +133 -1
- package/api/ai-agent.js.map +1 -1
- package/api/common.d.ts.map +1 -1
- package/api/conversation.d.ts +32 -9
- package/api/conversation.d.ts.map +1 -1
- package/api/conversation.js +14 -1
- 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 +4 -3
- package/api/timeline-item.d.ts +9 -6
- package/api/timeline-item.d.ts.map +1 -1
- package/api/timeline-item.js +3 -2
- 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 -4
- package/index.d.ts.map +1 -1
- package/index.js +5 -4
- package/package.json +1 -1
- package/realtime-events.d.ts +31 -6
- 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 +5 -2
- package/schemas.d.ts.map +1 -1
- package/schemas.js +2 -0
- package/schemas.js.map +1 -1
- package/trpc/conversation.d.ts +59 -10
- package/trpc/conversation.d.ts.map +1 -1
- package/trpc/conversation.js +32 -1
- package/trpc/conversation.js.map +1 -1
- package/trpc/visitor.d.ts +3 -1
- package/trpc/visitor.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>;
|
|
@@ -120,10 +121,12 @@ declare const realtimeSchema: {
|
|
|
120
121
|
visitorId: z.ZodString;
|
|
121
122
|
websiteId: z.ZodString;
|
|
122
123
|
status: z.ZodDefault<z.ZodEnum<{
|
|
123
|
-
resolved: "resolved";
|
|
124
124
|
open: "open";
|
|
125
|
+
resolved: "resolved";
|
|
125
126
|
spam: "spam";
|
|
126
127
|
}>>;
|
|
128
|
+
visitorRating: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
129
|
+
visitorRatingAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
130
|
deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
128
131
|
visitorLastSeenAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
132
|
lastTimelineItem: z.ZodOptional<z.ZodObject<{
|
|
@@ -138,6 +141,7 @@ declare const realtimeSchema: {
|
|
|
138
141
|
message: "message";
|
|
139
142
|
event: "event";
|
|
140
143
|
identification: "identification";
|
|
144
|
+
tool: "tool";
|
|
141
145
|
}>;
|
|
142
146
|
text: z.ZodNullable<z.ZodString>;
|
|
143
147
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -237,6 +241,7 @@ declare const realtimeSchema: {
|
|
|
237
241
|
}, z.core.$strip>, z.ZodObject<{
|
|
238
242
|
type: z.ZodLiteral<"event">;
|
|
239
243
|
eventType: z.ZodEnum<{
|
|
244
|
+
resolved: "resolved";
|
|
240
245
|
assigned: "assigned";
|
|
241
246
|
unassigned: "unassigned";
|
|
242
247
|
participant_requested: "participant_requested";
|
|
@@ -246,7 +251,6 @@ declare const realtimeSchema: {
|
|
|
246
251
|
priority_changed: "priority_changed";
|
|
247
252
|
tag_added: "tag_added";
|
|
248
253
|
tag_removed: "tag_removed";
|
|
249
|
-
resolved: "resolved";
|
|
250
254
|
reopened: "reopened";
|
|
251
255
|
visitor_blocked: "visitor_blocked";
|
|
252
256
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -275,8 +279,8 @@ declare const realtimeSchema: {
|
|
|
275
279
|
header: z.ZodObject<{
|
|
276
280
|
id: z.ZodString;
|
|
277
281
|
status: z.ZodEnum<{
|
|
278
|
-
resolved: "resolved";
|
|
279
282
|
open: "open";
|
|
283
|
+
resolved: "resolved";
|
|
280
284
|
spam: "spam";
|
|
281
285
|
}>;
|
|
282
286
|
priority: z.ZodEnum<{
|
|
@@ -305,6 +309,8 @@ declare const realtimeSchema: {
|
|
|
305
309
|
channel: z.ZodString;
|
|
306
310
|
title: z.ZodNullable<z.ZodString>;
|
|
307
311
|
resolutionTime: z.ZodNullable<z.ZodNumber>;
|
|
312
|
+
visitorRating: z.ZodNullable<z.ZodNumber>;
|
|
313
|
+
visitorRatingAt: z.ZodNullable<z.ZodString>;
|
|
308
314
|
startedAt: z.ZodNullable<z.ZodString>;
|
|
309
315
|
firstResponseAt: z.ZodNullable<z.ZodString>;
|
|
310
316
|
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -333,6 +339,7 @@ declare const realtimeSchema: {
|
|
|
333
339
|
message: "message";
|
|
334
340
|
event: "event";
|
|
335
341
|
identification: "identification";
|
|
342
|
+
tool: "tool";
|
|
336
343
|
}>;
|
|
337
344
|
text: z.ZodNullable<z.ZodString>;
|
|
338
345
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -432,6 +439,7 @@ declare const realtimeSchema: {
|
|
|
432
439
|
}, z.core.$strip>, z.ZodObject<{
|
|
433
440
|
type: z.ZodLiteral<"event">;
|
|
434
441
|
eventType: z.ZodEnum<{
|
|
442
|
+
resolved: "resolved";
|
|
435
443
|
assigned: "assigned";
|
|
436
444
|
unassigned: "unassigned";
|
|
437
445
|
participant_requested: "participant_requested";
|
|
@@ -441,7 +449,6 @@ declare const realtimeSchema: {
|
|
|
441
449
|
priority_changed: "priority_changed";
|
|
442
450
|
tag_added: "tag_added";
|
|
443
451
|
tag_removed: "tag_removed";
|
|
444
|
-
resolved: "resolved";
|
|
445
452
|
reopened: "reopened";
|
|
446
453
|
visitor_blocked: "visitor_blocked";
|
|
447
454
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -478,6 +485,7 @@ declare const realtimeSchema: {
|
|
|
478
485
|
message: "message";
|
|
479
486
|
event: "event";
|
|
480
487
|
identification: "identification";
|
|
488
|
+
tool: "tool";
|
|
481
489
|
}>;
|
|
482
490
|
text: z.ZodNullable<z.ZodString>;
|
|
483
491
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -577,6 +585,7 @@ declare const realtimeSchema: {
|
|
|
577
585
|
}, z.core.$strip>, z.ZodObject<{
|
|
578
586
|
type: z.ZodLiteral<"event">;
|
|
579
587
|
eventType: z.ZodEnum<{
|
|
588
|
+
resolved: "resolved";
|
|
580
589
|
assigned: "assigned";
|
|
581
590
|
unassigned: "unassigned";
|
|
582
591
|
participant_requested: "participant_requested";
|
|
@@ -586,7 +595,6 @@ declare const realtimeSchema: {
|
|
|
586
595
|
priority_changed: "priority_changed";
|
|
587
596
|
tag_added: "tag_added";
|
|
588
597
|
tag_removed: "tag_removed";
|
|
589
|
-
resolved: "resolved";
|
|
590
598
|
reopened: "reopened";
|
|
591
599
|
visitor_blocked: "visitor_blocked";
|
|
592
600
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -685,6 +693,7 @@ declare const realtimeSchema: {
|
|
|
685
693
|
conversationId: z.ZodString;
|
|
686
694
|
organizationId: z.ZodString;
|
|
687
695
|
type: z.ZodEnum<{
|
|
696
|
+
resolved: "resolved";
|
|
688
697
|
assigned: "assigned";
|
|
689
698
|
unassigned: "unassigned";
|
|
690
699
|
participant_requested: "participant_requested";
|
|
@@ -694,7 +703,6 @@ declare const realtimeSchema: {
|
|
|
694
703
|
priority_changed: "priority_changed";
|
|
695
704
|
tag_added: "tag_added";
|
|
696
705
|
tag_removed: "tag_removed";
|
|
697
|
-
resolved: "resolved";
|
|
698
706
|
reopened: "reopened";
|
|
699
707
|
visitor_blocked: "visitor_blocked";
|
|
700
708
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -727,6 +735,22 @@ declare const realtimeSchema: {
|
|
|
727
735
|
sentimentConfidence: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
728
736
|
escalatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
729
737
|
escalationReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
738
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
739
|
+
open: "open";
|
|
740
|
+
resolved: "resolved";
|
|
741
|
+
spam: "spam";
|
|
742
|
+
}>>;
|
|
743
|
+
priority: z.ZodOptional<z.ZodEnum<{
|
|
744
|
+
low: "low";
|
|
745
|
+
normal: "normal";
|
|
746
|
+
high: "high";
|
|
747
|
+
urgent: "urgent";
|
|
748
|
+
}>>;
|
|
749
|
+
resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
750
|
+
resolvedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
751
|
+
resolvedByAiAgentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
752
|
+
resolutionTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
753
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
730
754
|
}, z.core.$strip>;
|
|
731
755
|
aiAgentId: z.ZodNullable<z.ZodString>;
|
|
732
756
|
}, z.core.$strip>;
|
|
@@ -828,6 +852,7 @@ declare const realtimeSchema: {
|
|
|
828
852
|
message: "message";
|
|
829
853
|
event: "event";
|
|
830
854
|
identification: "identification";
|
|
855
|
+
tool: "tool";
|
|
831
856
|
}>;
|
|
832
857
|
text: z.ZodNullable<z.ZodString>;
|
|
833
858
|
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-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEE,iBAAA,gBAAiC;KAEjC,+BAA+B,qBAAqB,CAAA,CAAE,cACzD,gBAAgB;KAGb,wBAAwB;QAC7B;WACG,qBAAqB;;KAGnB,gBAAA,WACL,oBAAoB,cAAc,KACvC;KAEU,4BAA4B,qBACvC,qBAAqB;;;;iBAKN,gCAAgC,yBACzC,mBAEJ,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\tre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AE,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,QA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AAE,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"}
|
package/schemas.d.ts
CHANGED
|
@@ -21,10 +21,12 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
21
21
|
visitorId: z.ZodString;
|
|
22
22
|
websiteId: z.ZodString;
|
|
23
23
|
status: z.ZodDefault<z.ZodEnum<{
|
|
24
|
-
resolved: "resolved";
|
|
25
24
|
open: "open";
|
|
25
|
+
resolved: "resolved";
|
|
26
26
|
spam: "spam";
|
|
27
27
|
}>>;
|
|
28
|
+
visitorRating: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
|
+
visitorRatingAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
30
|
deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
29
31
|
visitorLastSeenAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
32
|
lastTimelineItem: z.ZodOptional<z.ZodObject<{
|
|
@@ -39,6 +41,7 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
39
41
|
message: "message";
|
|
40
42
|
event: "event";
|
|
41
43
|
identification: "identification";
|
|
44
|
+
tool: "tool";
|
|
42
45
|
}>;
|
|
43
46
|
text: z.ZodNullable<z.ZodString>;
|
|
44
47
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -138,6 +141,7 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
138
141
|
}, z.core.$strip>, z.ZodObject<{
|
|
139
142
|
type: z.ZodLiteral<"event">;
|
|
140
143
|
eventType: z.ZodEnum<{
|
|
144
|
+
resolved: "resolved";
|
|
141
145
|
assigned: "assigned";
|
|
142
146
|
unassigned: "unassigned";
|
|
143
147
|
participant_requested: "participant_requested";
|
|
@@ -147,7 +151,6 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
147
151
|
priority_changed: "priority_changed";
|
|
148
152
|
tag_added: "tag_added";
|
|
149
153
|
tag_removed: "tag_removed";
|
|
150
|
-
resolved: "resolved";
|
|
151
154
|
reopened: "reopened";
|
|
152
155
|
visitor_blocked: "visitor_blocked";
|
|
153
156
|
visitor_unblocked: "visitor_unblocked";
|
package/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","names":[],"sources":["../src/schemas.ts"],"sourcesContent":[],"mappings":";;;cAIa,YAAU,CAAA,CAAA;;EAAV,IAAA,aAUX;;;;;;;;;KAEU,SAAA,GAAY,CAAA,CAAE,aAAa;cAE1B,oBAAkB,CAAA,CAAA;;;;EAdR,SAAA,aAAA;EAAA,SAAA,aAAA;EAYX,SAAA,aAAS;EAER,MAAA,cAAA,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","names":[],"sources":["../src/schemas.ts"],"sourcesContent":[],"mappings":";;;cAIa,YAAU,CAAA,CAAA;;EAAV,IAAA,aAUX;;;;;;;;;KAEU,SAAA,GAAY,CAAA,CAAE,aAAa;cAE1B,oBAAkB,CAAA,CAAA;;;;EAdR,SAAA,aAAA;EAAA,SAAA,aAAA;EAYX,SAAA,aAAS;EAER,MAAA,cAAA,UAmBX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEU,YAAA,GAAe,CAAA,CAAE,aAAa;cAE7B,wBAAsB,CAAA,CAAA;;;;;;;;;;;KAYvB,gBAAA,GAAmB,CAAA,CAAE,aAAa"}
|
package/schemas.js
CHANGED
|
@@ -26,6 +26,8 @@ const conversationSchema = z.object({
|
|
|
26
26
|
ConversationStatus.RESOLVED,
|
|
27
27
|
ConversationStatus.SPAM
|
|
28
28
|
]).default(ConversationStatus.OPEN),
|
|
29
|
+
visitorRating: z.number().int().min(1).max(5).nullable().optional(),
|
|
30
|
+
visitorRatingAt: z.string().nullable().optional(),
|
|
29
31
|
deletedAt: z.string().nullable().default(null),
|
|
30
32
|
visitorLastSeenAt: z.string().nullable().optional(),
|
|
31
33
|
lastTimelineItem: timelineItemSchema.optional()
|
package/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","names":[],"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { timelineItemSchema } from \"./api/timeline-item\";\nimport { ConversationEventType, ConversationStatus } from \"./enums\";\n\nexport const viewSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tdescription: z.string().nullable(),\n\tprompt: z.string().nullable(),\n\torganizationId: z.string(),\n\twebsiteId: z.string(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tdeletedAt: z.string().nullable(),\n});\n\nexport type InboxView = z.infer<typeof viewSchema>;\n\nexport const conversationSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string().optional(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tvisitorId: z.string(),\n\twebsiteId: z.string(),\n\tstatus: z\n\t\t.enum([\n\t\t\tConversationStatus.OPEN,\n\t\t\tConversationStatus.RESOLVED,\n\t\t\tConversationStatus.SPAM,\n\t\t])\n\t\t.default(ConversationStatus.OPEN),\n\tdeletedAt: z.string().nullable().default(null),\n\tvisitorLastSeenAt: z.string().nullable().optional(),\n\tlastTimelineItem: timelineItemSchema.optional(),\n});\n\nexport type Conversation = z.infer<typeof conversationSchema>;\n\nexport const conversationSeenSchema = z.object({\n\tid: z.string(),\n\tconversationId: z.string(),\n\tuserId: z.string().nullable(),\n\tvisitorId: z.string().nullable(),\n\taiAgentId: z.string().nullable(),\n\tlastSeenAt: z.string(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tdeletedAt: z.string().nullable(),\n});\n\nexport type ConversationSeen = z.infer<typeof conversationSeenSchema>;\n"],"mappings":";;;;;AAIA,MAAa,aAAa,EAAE,OAAO;CAClC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ;CAChB,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,gBAAgB,EAAE,QAAQ;CAC1B,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAIF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,IAAI,EAAE,QAAQ;CACd,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,QAAQ,EACN,KAAK;EACL,mBAAmB;EACnB,mBAAmB;EACnB,mBAAmB;EACnB,CAAC,CACD,QAAQ,mBAAmB,KAAK;CAClC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,KAAK;CAC9C,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACnD,kBAAkB,mBAAmB,UAAU;CAC/C,CAAC;AAIF,MAAa,yBAAyB,EAAE,OAAO;CAC9C,IAAI,EAAE,QAAQ;CACd,gBAAgB,EAAE,QAAQ;CAC1B,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAY,EAAE,QAAQ;CACtB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC"}
|
|
1
|
+
{"version":3,"file":"schemas.js","names":[],"sources":["../src/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { timelineItemSchema } from \"./api/timeline-item\";\nimport { ConversationEventType, ConversationStatus } from \"./enums\";\n\nexport const viewSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tdescription: z.string().nullable(),\n\tprompt: z.string().nullable(),\n\torganizationId: z.string(),\n\twebsiteId: z.string(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tdeletedAt: z.string().nullable(),\n});\n\nexport type InboxView = z.infer<typeof viewSchema>;\n\nexport const conversationSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string().optional(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tvisitorId: z.string(),\n\twebsiteId: z.string(),\n\tstatus: z\n\t\t.enum([\n\t\t\tConversationStatus.OPEN,\n\t\t\tConversationStatus.RESOLVED,\n\t\t\tConversationStatus.SPAM,\n\t\t])\n\t\t.default(ConversationStatus.OPEN),\n\tvisitorRating: z.number().int().min(1).max(5).nullable().optional(),\n\tvisitorRatingAt: z.string().nullable().optional(),\n\tdeletedAt: z.string().nullable().default(null),\n\tvisitorLastSeenAt: z.string().nullable().optional(),\n\tlastTimelineItem: timelineItemSchema.optional(),\n});\n\nexport type Conversation = z.infer<typeof conversationSchema>;\n\nexport const conversationSeenSchema = z.object({\n\tid: z.string(),\n\tconversationId: z.string(),\n\tuserId: z.string().nullable(),\n\tvisitorId: z.string().nullable(),\n\taiAgentId: z.string().nullable(),\n\tlastSeenAt: z.string(),\n\tcreatedAt: z.string(),\n\tupdatedAt: z.string(),\n\tdeletedAt: z.string().nullable(),\n});\n\nexport type ConversationSeen = z.infer<typeof conversationSeenSchema>;\n"],"mappings":";;;;;AAIA,MAAa,aAAa,EAAE,OAAO;CAClC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ;CAChB,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,gBAAgB,EAAE,QAAQ;CAC1B,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAIF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,IAAI,EAAE,QAAQ;CACd,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,QAAQ,EACN,KAAK;EACL,mBAAmB;EACnB,mBAAmB;EACnB,mBAAmB;EACnB,CAAC,CACD,QAAQ,mBAAmB,KAAK;CAClC,eAAe,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU;CACnE,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACjD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,KAAK;CAC9C,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACnD,kBAAkB,mBAAmB,UAAU;CAC/C,CAAC;AAIF,MAAa,yBAAyB,EAAE,OAAO;CAC9C,IAAI,EAAE,QAAQ;CACd,gBAAgB,EAAE,QAAQ;CAC1B,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAY,EAAE,QAAQ;CACtB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ;CACrB,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC"}
|
package/trpc/conversation.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region src/trpc/conversation.d.ts
|
|
4
4
|
declare const conversationStatusSchema: z.ZodEnum<{
|
|
5
|
-
resolved: "resolved";
|
|
6
5
|
open: "open";
|
|
6
|
+
resolved: "resolved";
|
|
7
7
|
spam: "spam";
|
|
8
8
|
}>;
|
|
9
9
|
declare const conversationPrioritySchema: z.ZodEnum<{
|
|
@@ -23,8 +23,8 @@ declare const conversationRecordSchema: z.ZodObject<{
|
|
|
23
23
|
visitorId: z.ZodString;
|
|
24
24
|
websiteId: z.ZodString;
|
|
25
25
|
status: z.ZodEnum<{
|
|
26
|
-
resolved: "resolved";
|
|
27
26
|
open: "open";
|
|
27
|
+
resolved: "resolved";
|
|
28
28
|
spam: "spam";
|
|
29
29
|
}>;
|
|
30
30
|
priority: z.ZodEnum<{
|
|
@@ -42,6 +42,8 @@ declare const conversationRecordSchema: z.ZodObject<{
|
|
|
42
42
|
channel: z.ZodString;
|
|
43
43
|
title: z.ZodNullable<z.ZodString>;
|
|
44
44
|
resolutionTime: z.ZodNullable<z.ZodNumber>;
|
|
45
|
+
visitorRating: z.ZodNullable<z.ZodNumber>;
|
|
46
|
+
visitorRatingAt: z.ZodNullable<z.ZodString>;
|
|
45
47
|
startedAt: z.ZodNullable<z.ZodString>;
|
|
46
48
|
firstResponseAt: z.ZodNullable<z.ZodString>;
|
|
47
49
|
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -67,8 +69,8 @@ declare const conversationMutationResponseSchema: z.ZodObject<{
|
|
|
67
69
|
visitorId: z.ZodString;
|
|
68
70
|
websiteId: z.ZodString;
|
|
69
71
|
status: z.ZodEnum<{
|
|
70
|
-
resolved: "resolved";
|
|
71
72
|
open: "open";
|
|
73
|
+
resolved: "resolved";
|
|
72
74
|
spam: "spam";
|
|
73
75
|
}>;
|
|
74
76
|
priority: z.ZodEnum<{
|
|
@@ -86,6 +88,8 @@ declare const conversationMutationResponseSchema: z.ZodObject<{
|
|
|
86
88
|
channel: z.ZodString;
|
|
87
89
|
title: z.ZodNullable<z.ZodString>;
|
|
88
90
|
resolutionTime: z.ZodNullable<z.ZodNumber>;
|
|
91
|
+
visitorRating: z.ZodNullable<z.ZodNumber>;
|
|
92
|
+
visitorRatingAt: z.ZodNullable<z.ZodString>;
|
|
89
93
|
startedAt: z.ZodNullable<z.ZodString>;
|
|
90
94
|
firstResponseAt: z.ZodNullable<z.ZodString>;
|
|
91
95
|
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -107,8 +111,8 @@ declare const conversationMutationResponseSchema: z.ZodObject<{
|
|
|
107
111
|
declare const conversationHeaderSchema: z.ZodObject<{
|
|
108
112
|
id: z.ZodString;
|
|
109
113
|
status: z.ZodEnum<{
|
|
110
|
-
resolved: "resolved";
|
|
111
114
|
open: "open";
|
|
115
|
+
resolved: "resolved";
|
|
112
116
|
spam: "spam";
|
|
113
117
|
}>;
|
|
114
118
|
priority: z.ZodEnum<{
|
|
@@ -137,6 +141,8 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
137
141
|
channel: z.ZodString;
|
|
138
142
|
title: z.ZodNullable<z.ZodString>;
|
|
139
143
|
resolutionTime: z.ZodNullable<z.ZodNumber>;
|
|
144
|
+
visitorRating: z.ZodNullable<z.ZodNumber>;
|
|
145
|
+
visitorRatingAt: z.ZodNullable<z.ZodString>;
|
|
140
146
|
startedAt: z.ZodNullable<z.ZodString>;
|
|
141
147
|
firstResponseAt: z.ZodNullable<z.ZodString>;
|
|
142
148
|
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -165,6 +171,7 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
165
171
|
message: "message";
|
|
166
172
|
event: "event";
|
|
167
173
|
identification: "identification";
|
|
174
|
+
tool: "tool";
|
|
168
175
|
}>;
|
|
169
176
|
text: z.ZodNullable<z.ZodString>;
|
|
170
177
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -264,6 +271,7 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
264
271
|
}, z.core.$strip>, z.ZodObject<{
|
|
265
272
|
type: z.ZodLiteral<"event">;
|
|
266
273
|
eventType: z.ZodEnum<{
|
|
274
|
+
resolved: "resolved";
|
|
267
275
|
assigned: "assigned";
|
|
268
276
|
unassigned: "unassigned";
|
|
269
277
|
participant_requested: "participant_requested";
|
|
@@ -273,7 +281,6 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
273
281
|
priority_changed: "priority_changed";
|
|
274
282
|
tag_added: "tag_added";
|
|
275
283
|
tag_removed: "tag_removed";
|
|
276
|
-
resolved: "resolved";
|
|
277
284
|
reopened: "reopened";
|
|
278
285
|
visitor_blocked: "visitor_blocked";
|
|
279
286
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -310,6 +317,7 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
310
317
|
message: "message";
|
|
311
318
|
event: "event";
|
|
312
319
|
identification: "identification";
|
|
320
|
+
tool: "tool";
|
|
313
321
|
}>;
|
|
314
322
|
text: z.ZodNullable<z.ZodString>;
|
|
315
323
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -409,6 +417,7 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
409
417
|
}, z.core.$strip>, z.ZodObject<{
|
|
410
418
|
type: z.ZodLiteral<"event">;
|
|
411
419
|
eventType: z.ZodEnum<{
|
|
420
|
+
resolved: "resolved";
|
|
412
421
|
assigned: "assigned";
|
|
413
422
|
unassigned: "unassigned";
|
|
414
423
|
participant_requested: "participant_requested";
|
|
@@ -418,7 +427,6 @@ declare const conversationHeaderSchema: z.ZodObject<{
|
|
|
418
427
|
priority_changed: "priority_changed";
|
|
419
428
|
tag_added: "tag_added";
|
|
420
429
|
tag_removed: "tag_removed";
|
|
421
|
-
resolved: "resolved";
|
|
422
430
|
reopened: "reopened";
|
|
423
431
|
visitor_blocked: "visitor_blocked";
|
|
424
432
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -460,8 +468,8 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
460
468
|
items: z.ZodArray<z.ZodObject<{
|
|
461
469
|
id: z.ZodString;
|
|
462
470
|
status: z.ZodEnum<{
|
|
463
|
-
resolved: "resolved";
|
|
464
471
|
open: "open";
|
|
472
|
+
resolved: "resolved";
|
|
465
473
|
spam: "spam";
|
|
466
474
|
}>;
|
|
467
475
|
priority: z.ZodEnum<{
|
|
@@ -490,6 +498,8 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
490
498
|
channel: z.ZodString;
|
|
491
499
|
title: z.ZodNullable<z.ZodString>;
|
|
492
500
|
resolutionTime: z.ZodNullable<z.ZodNumber>;
|
|
501
|
+
visitorRating: z.ZodNullable<z.ZodNumber>;
|
|
502
|
+
visitorRatingAt: z.ZodNullable<z.ZodString>;
|
|
493
503
|
startedAt: z.ZodNullable<z.ZodString>;
|
|
494
504
|
firstResponseAt: z.ZodNullable<z.ZodString>;
|
|
495
505
|
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
@@ -518,6 +528,7 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
518
528
|
message: "message";
|
|
519
529
|
event: "event";
|
|
520
530
|
identification: "identification";
|
|
531
|
+
tool: "tool";
|
|
521
532
|
}>;
|
|
522
533
|
text: z.ZodNullable<z.ZodString>;
|
|
523
534
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -617,6 +628,7 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
617
628
|
}, z.core.$strip>, z.ZodObject<{
|
|
618
629
|
type: z.ZodLiteral<"event">;
|
|
619
630
|
eventType: z.ZodEnum<{
|
|
631
|
+
resolved: "resolved";
|
|
620
632
|
assigned: "assigned";
|
|
621
633
|
unassigned: "unassigned";
|
|
622
634
|
participant_requested: "participant_requested";
|
|
@@ -626,7 +638,6 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
626
638
|
priority_changed: "priority_changed";
|
|
627
639
|
tag_added: "tag_added";
|
|
628
640
|
tag_removed: "tag_removed";
|
|
629
|
-
resolved: "resolved";
|
|
630
641
|
reopened: "reopened";
|
|
631
642
|
visitor_blocked: "visitor_blocked";
|
|
632
643
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -663,6 +674,7 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
663
674
|
message: "message";
|
|
664
675
|
event: "event";
|
|
665
676
|
identification: "identification";
|
|
677
|
+
tool: "tool";
|
|
666
678
|
}>;
|
|
667
679
|
text: z.ZodNullable<z.ZodString>;
|
|
668
680
|
tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -762,6 +774,7 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
762
774
|
}, z.core.$strip>, z.ZodObject<{
|
|
763
775
|
type: z.ZodLiteral<"event">;
|
|
764
776
|
eventType: z.ZodEnum<{
|
|
777
|
+
resolved: "resolved";
|
|
765
778
|
assigned: "assigned";
|
|
766
779
|
unassigned: "unassigned";
|
|
767
780
|
participant_requested: "participant_requested";
|
|
@@ -771,7 +784,6 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
771
784
|
priority_changed: "priority_changed";
|
|
772
785
|
tag_added: "tag_added";
|
|
773
786
|
tag_removed: "tag_removed";
|
|
774
|
-
resolved: "resolved";
|
|
775
787
|
reopened: "reopened";
|
|
776
788
|
visitor_blocked: "visitor_blocked";
|
|
777
789
|
visitor_unblocked: "visitor_unblocked";
|
|
@@ -811,8 +823,45 @@ declare const listConversationHeadersResponseSchema: z.ZodObject<{
|
|
|
811
823
|
}, z.core.$strip>>;
|
|
812
824
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
813
825
|
}, z.core.$strip>;
|
|
826
|
+
declare const inboxAnalyticsRangeSchema: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<14>, z.ZodLiteral<30>]>;
|
|
827
|
+
declare const inboxAnalyticsRequestSchema: z.ZodObject<{
|
|
828
|
+
websiteSlug: z.ZodString;
|
|
829
|
+
rangeDays: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<14>, z.ZodLiteral<30>]>>>;
|
|
830
|
+
}, z.core.$strip>;
|
|
831
|
+
declare const inboxAnalyticsMetricsSchema: z.ZodObject<{
|
|
832
|
+
medianResponseTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
833
|
+
medianResolutionTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
834
|
+
aiHandledRate: z.ZodNullable<z.ZodNumber>;
|
|
835
|
+
satisfactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
836
|
+
uniqueVisitors: z.ZodNumber;
|
|
837
|
+
}, z.core.$strip>;
|
|
838
|
+
declare const inboxAnalyticsResponseSchema: z.ZodObject<{
|
|
839
|
+
range: z.ZodObject<{
|
|
840
|
+
rangeDays: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<14>, z.ZodLiteral<30>]>;
|
|
841
|
+
currentStart: z.ZodString;
|
|
842
|
+
currentEnd: z.ZodString;
|
|
843
|
+
previousStart: z.ZodString;
|
|
844
|
+
previousEnd: z.ZodString;
|
|
845
|
+
}, z.core.$strip>;
|
|
846
|
+
current: z.ZodObject<{
|
|
847
|
+
medianResponseTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
848
|
+
medianResolutionTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
849
|
+
aiHandledRate: z.ZodNullable<z.ZodNumber>;
|
|
850
|
+
satisfactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
851
|
+
uniqueVisitors: z.ZodNumber;
|
|
852
|
+
}, z.core.$strip>;
|
|
853
|
+
previous: z.ZodObject<{
|
|
854
|
+
medianResponseTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
855
|
+
medianResolutionTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
856
|
+
aiHandledRate: z.ZodNullable<z.ZodNumber>;
|
|
857
|
+
satisfactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
858
|
+
uniqueVisitors: z.ZodNumber;
|
|
859
|
+
}, z.core.$strip>;
|
|
860
|
+
}, z.core.$strip>;
|
|
814
861
|
type ConversationMutationResponse = z.infer<typeof conversationMutationResponseSchema>;
|
|
815
862
|
type ConversationHeader = z.infer<typeof conversationHeaderSchema>;
|
|
863
|
+
type InboxAnalyticsRequest = z.infer<typeof inboxAnalyticsRequestSchema>;
|
|
864
|
+
type InboxAnalyticsResponse = z.infer<typeof inboxAnalyticsResponseSchema>;
|
|
816
865
|
//#endregion
|
|
817
|
-
export { ConversationHeader, ConversationMutationResponse, ConversationRecordResponse, conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSentimentSchema, conversationStatusSchema, listConversationHeadersResponseSchema };
|
|
866
|
+
export { ConversationHeader, ConversationMutationResponse, ConversationRecordResponse, InboxAnalyticsRequest, InboxAnalyticsResponse, conversationHeaderSchema, conversationMutationResponseSchema, conversationPrioritySchema, conversationRecordSchema, conversationSentimentSchema, conversationStatusSchema, inboxAnalyticsMetricsSchema, inboxAnalyticsRangeSchema, inboxAnalyticsRequestSchema, inboxAnalyticsResponseSchema, listConversationHeadersResponseSchema };
|
|
818
867
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","names":[],"sources":["../../src/trpc/conversation.ts"],"sourcesContent":[],"mappings":";;;cAUa,0BAAwB,CAAA,CAAA;;EAAxB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","names":[],"sources":["../../src/trpc/conversation.ts"],"sourcesContent":[],"mappings":";;;cAUa,0BAAwB,CAAA,CAAA;;EAAxB,QAAA,EAAA,UAAA;EAMA,IAAA,EAAA,MAAA;AAOb,CAAA,CAAA;AAQa,cAfA,0BA+CX,EA/CqC,CAAA,CAAA,OA+CrC,CAAA;;;;;;cAxCW,6BAA2B,CAAA,CAAA,YAAA,CAAA,CAAA;;;;;cAQ3B,0BAAwB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,SAAA,aAAA;EAAA,SAAA,aAAA;EAkCzB,SAAA,eAAA,YAA0B,CAAA;AAItC,CAAA,eAAa,CAAA;KAJD,0BAAA,GAA6B,CAAA,CAAE,aACnC;cAGK,oCAAkC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAIlC,0BAAwB,CAAA,CAAA;;;;;IAJU,IAAA,EAAA,MAAA;EAAA,CAAA,CAAA;EAIlC,QAAA,WAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqCA,uCAAqC,CAAA,CAAA;;;;;;;;;;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