@cossistant/types 0.1.0 → 0.1.2
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/analytics.d.ts +31 -0
- package/analytics.d.ts.map +1 -0
- package/analytics.js +41 -0
- package/analytics.js.map +1 -0
- package/api/ai-agent-capabilities.d.ts +16 -19
- package/api/ai-agent-capabilities.d.ts.map +1 -1
- package/api/ai-agent-capabilities.js +215 -286
- package/api/ai-agent-capabilities.js.map +1 -1
- package/api/ai-agent-defaults.d.ts +6 -0
- package/api/ai-agent-defaults.d.ts.map +1 -0
- package/api/ai-agent-defaults.js +33 -0
- package/api/ai-agent-defaults.js.map +1 -0
- package/api/ai-agent.d.ts +314 -207
- package/api/ai-agent.d.ts.map +1 -1
- package/api/ai-agent.js +175 -111
- package/api/ai-agent.js.map +1 -1
- package/api/conversation.d.ts +79 -56
- package/api/conversation.d.ts.map +1 -1
- package/api/conversation.js +7 -2
- package/api/conversation.js.map +1 -1
- package/api/feedback.d.ts +5 -0
- package/api/feedback.d.ts.map +1 -1
- package/api/feedback.js +2 -0
- package/api/feedback.js.map +1 -1
- package/api/index.d.ts +7 -6
- package/api/index.js +7 -6
- package/api/link-source.d.ts +4 -4
- package/api/link-source.d.ts.map +1 -1
- package/api/link-source.js +1 -1
- package/api/link-source.js.map +1 -1
- package/api/timeline-item.d.ts +79 -67
- package/api/timeline-item.d.ts.map +1 -1
- package/api/timeline-item.js +3 -1
- package/api/timeline-item.js.map +1 -1
- package/api/user.d.ts +1 -1
- package/api/user.d.ts.map +1 -1
- package/api/user.js +2 -2
- package/api/user.js.map +1 -1
- package/api/visitor.d.ts +225 -1
- package/api/visitor.d.ts.map +1 -1
- package/api/visitor.js +142 -1
- package/api/visitor.js.map +1 -1
- package/api/website.d.ts +16 -7
- package/api/website.d.ts.map +1 -1
- package/api/website.js +16 -2
- package/api/website.js.map +1 -1
- package/enums.d.ts +2 -0
- package/enums.d.ts.map +1 -1
- package/enums.js +3 -1
- package/enums.js.map +1 -1
- package/index.d.ts +10 -8
- package/index.d.ts.map +1 -1
- package/index.js +10 -8
- package/package.json +1 -1
- package/realtime-events.d.ts +106 -36
- package/realtime-events.d.ts.map +1 -1
- package/realtime-events.js +6 -2
- package/realtime-events.js.map +1 -1
- package/schemas.d.ts +13 -11
- package/schemas.d.ts.map +1 -1
- package/tool-timeline-policy.d.ts +19 -2
- package/tool-timeline-policy.d.ts.map +1 -1
- package/tool-timeline-policy.js +29 -6
- package/tool-timeline-policy.js.map +1 -1
- package/trpc/conversation-hard-limit.d.ts +30 -0
- package/trpc/conversation-hard-limit.d.ts.map +1 -0
- package/trpc/conversation-hard-limit.js +43 -0
- package/trpc/conversation-hard-limit.js.map +1 -0
- package/trpc/conversation.d.ts +84 -44
- package/trpc/conversation.d.ts.map +1 -1
- package/trpc/conversation.js +6 -0
- package/trpc/conversation.js.map +1 -1
- package/trpc/visitor.d.ts +73 -15
- package/trpc/visitor.d.ts.map +1 -1
- package/trpc/visitor.js +15 -8
- package/trpc/visitor.js.map +1 -1
package/schemas.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
34
34
|
conversationId: z.ZodString;
|
|
35
35
|
organizationId: z.ZodString;
|
|
36
36
|
visibility: z.ZodEnum<{
|
|
37
|
-
private: "private";
|
|
38
37
|
public: "public";
|
|
38
|
+
private: "private";
|
|
39
39
|
}>;
|
|
40
40
|
type: z.ZodEnum<{
|
|
41
41
|
message: "message";
|
|
@@ -62,8 +62,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
62
62
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
63
63
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
64
64
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
65
|
-
private: "private";
|
|
66
65
|
public: "public";
|
|
66
|
+
private: "private";
|
|
67
67
|
}>>;
|
|
68
68
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
69
69
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
@@ -76,8 +76,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
76
76
|
triggerMessageId: z.ZodString;
|
|
77
77
|
workflowRunId: z.ZodString;
|
|
78
78
|
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
79
|
-
private: "private";
|
|
80
79
|
public: "public";
|
|
80
|
+
private: "private";
|
|
81
81
|
}>>;
|
|
82
82
|
}, z.core.$strip>>;
|
|
83
83
|
}, z.core.$strip>>;
|
|
@@ -97,8 +97,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
97
97
|
callProviderMetadata: z.ZodOptional<z.ZodObject<{
|
|
98
98
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
99
99
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
100
|
-
private: "private";
|
|
101
100
|
public: "public";
|
|
101
|
+
private: "private";
|
|
102
102
|
}>>;
|
|
103
103
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
104
104
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
@@ -111,8 +111,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
111
111
|
triggerMessageId: z.ZodString;
|
|
112
112
|
workflowRunId: z.ZodString;
|
|
113
113
|
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
114
|
-
private: "private";
|
|
115
114
|
public: "public";
|
|
115
|
+
private: "private";
|
|
116
116
|
}>>;
|
|
117
117
|
}, z.core.$strip>>;
|
|
118
118
|
}, z.core.$strip>>;
|
|
@@ -120,8 +120,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
120
120
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
121
121
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
122
122
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
123
|
-
private: "private";
|
|
124
123
|
public: "public";
|
|
124
|
+
private: "private";
|
|
125
125
|
}>>;
|
|
126
126
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
127
127
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
@@ -134,8 +134,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
134
134
|
triggerMessageId: z.ZodString;
|
|
135
135
|
workflowRunId: z.ZodString;
|
|
136
136
|
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
137
|
-
private: "private";
|
|
138
137
|
public: "public";
|
|
138
|
+
private: "private";
|
|
139
139
|
}>>;
|
|
140
140
|
}, z.core.$strip>>;
|
|
141
141
|
}, z.core.$strip>>;
|
|
@@ -148,8 +148,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
148
148
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
149
149
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
150
150
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
151
|
-
private: "private";
|
|
152
151
|
public: "public";
|
|
152
|
+
private: "private";
|
|
153
153
|
}>>;
|
|
154
154
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
155
155
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
@@ -162,8 +162,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
162
162
|
triggerMessageId: z.ZodString;
|
|
163
163
|
workflowRunId: z.ZodString;
|
|
164
164
|
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
165
|
-
private: "private";
|
|
166
165
|
public: "public";
|
|
166
|
+
private: "private";
|
|
167
167
|
}>>;
|
|
168
168
|
}, z.core.$strip>>;
|
|
169
169
|
}, z.core.$strip>>;
|
|
@@ -177,8 +177,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
177
177
|
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
178
178
|
cossistant: z.ZodOptional<z.ZodObject<{
|
|
179
179
|
visibility: z.ZodOptional<z.ZodEnum<{
|
|
180
|
-
private: "private";
|
|
181
180
|
public: "public";
|
|
181
|
+
private: "private";
|
|
182
182
|
}>>;
|
|
183
183
|
progressMessage: z.ZodOptional<z.ZodString>;
|
|
184
184
|
knowledgeId: z.ZodOptional<z.ZodString>;
|
|
@@ -191,8 +191,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
191
191
|
triggerMessageId: z.ZodString;
|
|
192
192
|
workflowRunId: z.ZodString;
|
|
193
193
|
triggerVisibility: z.ZodOptional<z.ZodEnum<{
|
|
194
|
-
private: "private";
|
|
195
194
|
public: "public";
|
|
195
|
+
private: "private";
|
|
196
196
|
}>>;
|
|
197
197
|
}, z.core.$strip>>;
|
|
198
198
|
}, z.core.$strip>>;
|
|
@@ -230,6 +230,8 @@ declare const conversationSchema: z.ZodObject<{
|
|
|
230
230
|
visitor_blocked: "visitor_blocked";
|
|
231
231
|
visitor_unblocked: "visitor_unblocked";
|
|
232
232
|
visitor_identified: "visitor_identified";
|
|
233
|
+
ai_paused: "ai_paused";
|
|
234
|
+
ai_resumed: "ai_resumed";
|
|
233
235
|
}>;
|
|
234
236
|
actorUserId: z.ZodNullable<z.ZodString>;
|
|
235
237
|
actorAiAgentId: z.ZodNullable<z.ZodString>;
|
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,UAmBX,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAnB6B,KAqBnB,YAAA,GAAe,CAAA,CAAE,KArBE,CAAA,OAqBW,kBArBX,CAAA;AAAA,cAuBlB,sBAvBkB,EAuBI,CAAA,CAAA,SAvBJ,CAAA;EAqBnB,EAAA,aAAY;EAEX,cAAA,aAUX;;;;;;;;;KAEU,gBAAA,GAAmB,CAAA,CAAE,aAAa"}
|
|
@@ -5,9 +5,26 @@ declare const TOOL_TIMELINE_LOG_TYPE: {
|
|
|
5
5
|
readonly DECISION: "decision";
|
|
6
6
|
};
|
|
7
7
|
type ToolTimelineLogType = (typeof TOOL_TIMELINE_LOG_TYPE)[keyof typeof TOOL_TIMELINE_LOG_TYPE];
|
|
8
|
-
|
|
8
|
+
type WidgetToolActivityPolicy = {
|
|
9
|
+
timeline: boolean;
|
|
10
|
+
liveStatus: boolean;
|
|
11
|
+
defaultProgressMessage?: string | null;
|
|
12
|
+
};
|
|
13
|
+
declare const TOOL_WIDGET_ACTIVITY_REGISTRY: {
|
|
14
|
+
readonly searchKnowledgeBase: {
|
|
15
|
+
readonly timeline: true;
|
|
16
|
+
readonly liveStatus: true;
|
|
17
|
+
readonly defaultProgressMessage: "Searching knowledge base...";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const TOOL_TIMELINE_CONVERSATION_ALLOWLIST: readonly string[];
|
|
21
|
+
declare function getWidgetToolActivityPolicy(toolName: string): WidgetToolActivityPolicy | null;
|
|
22
|
+
declare function isWidgetVisibleTool(toolName: string): boolean;
|
|
23
|
+
declare function isWidgetTimelineTool(toolName: string): boolean;
|
|
24
|
+
declare function isWidgetLiveStatusTool(toolName: string): boolean;
|
|
25
|
+
declare function getWidgetToolDefaultProgressMessage(toolName: string): string | null;
|
|
9
26
|
declare function isConversationVisibleTool(toolName: string): boolean;
|
|
10
27
|
declare function getToolLogType(toolName: string): ToolTimelineLogType;
|
|
11
28
|
//#endregion
|
|
12
|
-
export { TOOL_TIMELINE_CONVERSATION_ALLOWLIST, TOOL_TIMELINE_LOG_TYPE, ToolTimelineLogType, getToolLogType, isConversationVisibleTool };
|
|
29
|
+
export { TOOL_TIMELINE_CONVERSATION_ALLOWLIST, TOOL_TIMELINE_LOG_TYPE, TOOL_WIDGET_ACTIVITY_REGISTRY, ToolTimelineLogType, WidgetToolActivityPolicy, getToolLogType, getWidgetToolActivityPolicy, getWidgetToolDefaultProgressMessage, isConversationVisibleTool, isWidgetLiveStatusTool, isWidgetTimelineTool, isWidgetVisibleTool };
|
|
13
30
|
//# sourceMappingURL=tool-timeline-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-timeline-policy.d.ts","names":[],"sources":["../src/tool-timeline-policy.ts"],"sourcesContent":[],"mappings":";cAAa;EAAA,SAAA,eAAA,EAIH,iBAAA;EAEE,SAAA,GAAA,EAAA,KAAA;
|
|
1
|
+
{"version":3,"file":"tool-timeline-policy.d.ts","names":[],"sources":["../src/tool-timeline-policy.ts"],"sourcesContent":[],"mappings":";cAAa;EAAA,SAAA,eAAA,EAIH,iBAAA;EAEE,SAAA,GAAA,EAAA,KAAA;EAGA,SAAA,QAAA,EAAA,UAAwB;AAMpC,CAAA;AAmBa,KA5BD,mBAAA,GA4BC,CAAA,OA3BJ,sBA6Ba,CAAA,CAAA,MAAA,OA7BwB,sBA6BxB,CAAA;AAEN,KA7BJ,wBAAA,GA6B+B;EAM3B,QAAA,EAAA,OAAA;EAIA,UAAA,EAAA,OAAA;EAIA,sBAAA,CAAA,EAAsB,MAAA,GAAA,IAAA;AAItC,CAAA;AAMgB,cA/CH,6BA+C4B,EAAA;EAIzB,SAAA,mBAAc,EAAoB;;;;;;cAhCrC;iBAIG,2BAAA,oBAEb;iBAIa,mBAAA;iBAIA,oBAAA;iBAIA,sBAAA;iBAIA,mCAAA;iBAMA,yBAAA;iBAIA,cAAA,oBAAkC"}
|
package/tool-timeline-policy.js
CHANGED
|
@@ -4,14 +4,37 @@ const TOOL_TIMELINE_LOG_TYPE = {
|
|
|
4
4
|
LOG: "log",
|
|
5
5
|
DECISION: "decision"
|
|
6
6
|
};
|
|
7
|
-
const
|
|
7
|
+
const TOOL_WIDGET_ACTIVITY_REGISTRY = { searchKnowledgeBase: {
|
|
8
|
+
timeline: true,
|
|
9
|
+
liveStatus: true,
|
|
10
|
+
defaultProgressMessage: "Searching knowledge base..."
|
|
11
|
+
} };
|
|
12
|
+
const DASHBOARD_CONVERSATION_VISIBLE_TOOL_NAMES = new Set([
|
|
8
13
|
"searchKnowledgeBase",
|
|
9
14
|
"updateConversationTitle",
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
"setConversationTitle",
|
|
16
|
+
"updateSentiment",
|
|
17
|
+
"setPriority"
|
|
18
|
+
]);
|
|
19
|
+
const WIDGET_TOOL_ACTIVITY_POLICIES = TOOL_WIDGET_ACTIVITY_REGISTRY;
|
|
20
|
+
const TOOL_TIMELINE_CONVERSATION_ALLOWLIST = Object.freeze(Object.keys(WIDGET_TOOL_ACTIVITY_POLICIES));
|
|
21
|
+
function getWidgetToolActivityPolicy(toolName) {
|
|
22
|
+
return WIDGET_TOOL_ACTIVITY_POLICIES[toolName] ?? null;
|
|
23
|
+
}
|
|
24
|
+
function isWidgetVisibleTool(toolName) {
|
|
25
|
+
return Boolean(getWidgetToolActivityPolicy(toolName));
|
|
26
|
+
}
|
|
27
|
+
function isWidgetTimelineTool(toolName) {
|
|
28
|
+
return getWidgetToolActivityPolicy(toolName)?.timeline === true;
|
|
29
|
+
}
|
|
30
|
+
function isWidgetLiveStatusTool(toolName) {
|
|
31
|
+
return getWidgetToolActivityPolicy(toolName)?.liveStatus === true;
|
|
32
|
+
}
|
|
33
|
+
function getWidgetToolDefaultProgressMessage(toolName) {
|
|
34
|
+
return getWidgetToolActivityPolicy(toolName)?.defaultProgressMessage ?? null;
|
|
35
|
+
}
|
|
13
36
|
function isConversationVisibleTool(toolName) {
|
|
14
|
-
return
|
|
37
|
+
return DASHBOARD_CONVERSATION_VISIBLE_TOOL_NAMES.has(toolName);
|
|
15
38
|
}
|
|
16
39
|
function getToolLogType(toolName) {
|
|
17
40
|
if (toolName === "aiDecision") return TOOL_TIMELINE_LOG_TYPE.DECISION;
|
|
@@ -20,5 +43,5 @@ function getToolLogType(toolName) {
|
|
|
20
43
|
}
|
|
21
44
|
|
|
22
45
|
//#endregion
|
|
23
|
-
export { TOOL_TIMELINE_CONVERSATION_ALLOWLIST, TOOL_TIMELINE_LOG_TYPE, getToolLogType, isConversationVisibleTool };
|
|
46
|
+
export { TOOL_TIMELINE_CONVERSATION_ALLOWLIST, TOOL_TIMELINE_LOG_TYPE, TOOL_WIDGET_ACTIVITY_REGISTRY, getToolLogType, getWidgetToolActivityPolicy, getWidgetToolDefaultProgressMessage, isConversationVisibleTool, isWidgetLiveStatusTool, isWidgetTimelineTool, isWidgetVisibleTool };
|
|
24
47
|
//# sourceMappingURL=tool-timeline-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-timeline-policy.js","names":[],"sources":["../src/tool-timeline-policy.ts"],"sourcesContent":["export const TOOL_TIMELINE_LOG_TYPE = {\n\tCUSTOMER_FACING: \"customer_facing\",\n\tLOG: \"log\",\n\tDECISION: \"decision\",\n} as const;\n\nexport type ToolTimelineLogType =\n\t(typeof TOOL_TIMELINE_LOG_TYPE)[keyof typeof TOOL_TIMELINE_LOG_TYPE];\n\nexport const
|
|
1
|
+
{"version":3,"file":"tool-timeline-policy.js","names":["WIDGET_TOOL_ACTIVITY_POLICIES: Record<string, WidgetToolActivityPolicy>"],"sources":["../src/tool-timeline-policy.ts"],"sourcesContent":["export const TOOL_TIMELINE_LOG_TYPE = {\n\tCUSTOMER_FACING: \"customer_facing\",\n\tLOG: \"log\",\n\tDECISION: \"decision\",\n} as const;\n\nexport type ToolTimelineLogType =\n\t(typeof TOOL_TIMELINE_LOG_TYPE)[keyof typeof TOOL_TIMELINE_LOG_TYPE];\n\nexport type WidgetToolActivityPolicy = {\n\ttimeline: boolean;\n\tliveStatus: boolean;\n\tdefaultProgressMessage?: string | null;\n};\n\nexport const TOOL_WIDGET_ACTIVITY_REGISTRY = {\n\tsearchKnowledgeBase: {\n\t\ttimeline: true,\n\t\tliveStatus: true,\n\t\tdefaultProgressMessage: \"Searching knowledge base...\",\n\t},\n} as const satisfies Record<string, WidgetToolActivityPolicy>;\n\nconst DASHBOARD_CONVERSATION_VISIBLE_TOOL_NAMES = new Set([\n\t\"searchKnowledgeBase\",\n\t\"updateConversationTitle\",\n\t\"setConversationTitle\",\n\t\"updateSentiment\",\n\t\"setPriority\",\n]);\n\nconst WIDGET_TOOL_ACTIVITY_POLICIES: Record<string, WidgetToolActivityPolicy> =\n\tTOOL_WIDGET_ACTIVITY_REGISTRY;\n\nexport const TOOL_TIMELINE_CONVERSATION_ALLOWLIST = Object.freeze(\n\tObject.keys(WIDGET_TOOL_ACTIVITY_POLICIES)\n) as readonly string[];\n\nexport function getWidgetToolActivityPolicy(\n\ttoolName: string\n): WidgetToolActivityPolicy | null {\n\treturn WIDGET_TOOL_ACTIVITY_POLICIES[toolName] ?? null;\n}\n\nexport function isWidgetVisibleTool(toolName: string): boolean {\n\treturn Boolean(getWidgetToolActivityPolicy(toolName));\n}\n\nexport function isWidgetTimelineTool(toolName: string): boolean {\n\treturn getWidgetToolActivityPolicy(toolName)?.timeline === true;\n}\n\nexport function isWidgetLiveStatusTool(toolName: string): boolean {\n\treturn getWidgetToolActivityPolicy(toolName)?.liveStatus === true;\n}\n\nexport function getWidgetToolDefaultProgressMessage(\n\ttoolName: string\n): string | null {\n\treturn getWidgetToolActivityPolicy(toolName)?.defaultProgressMessage ?? null;\n}\n\nexport function isConversationVisibleTool(toolName: string): boolean {\n\treturn DASHBOARD_CONVERSATION_VISIBLE_TOOL_NAMES.has(toolName);\n}\n\nexport function getToolLogType(toolName: string): ToolTimelineLogType {\n\tif (toolName === \"aiDecision\") {\n\t\treturn TOOL_TIMELINE_LOG_TYPE.DECISION;\n\t}\n\n\tif (isConversationVisibleTool(toolName)) {\n\t\treturn TOOL_TIMELINE_LOG_TYPE.CUSTOMER_FACING;\n\t}\n\n\treturn TOOL_TIMELINE_LOG_TYPE.LOG;\n}\n"],"mappings":";AAAA,MAAa,yBAAyB;CACrC,iBAAiB;CACjB,KAAK;CACL,UAAU;CACV;AAWD,MAAa,gCAAgC,EAC5C,qBAAqB;CACpB,UAAU;CACV,YAAY;CACZ,wBAAwB;CACxB,EACD;AAED,MAAM,4CAA4C,IAAI,IAAI;CACzD;CACA;CACA;CACA;CACA;CACA,CAAC;AAEF,MAAMA,gCACL;AAED,MAAa,uCAAuC,OAAO,OAC1D,OAAO,KAAK,8BAA8B,CAC1C;AAED,SAAgB,4BACf,UACkC;AAClC,QAAO,8BAA8B,aAAa;;AAGnD,SAAgB,oBAAoB,UAA2B;AAC9D,QAAO,QAAQ,4BAA4B,SAAS,CAAC;;AAGtD,SAAgB,qBAAqB,UAA2B;AAC/D,QAAO,4BAA4B,SAAS,EAAE,aAAa;;AAG5D,SAAgB,uBAAuB,UAA2B;AACjE,QAAO,4BAA4B,SAAS,EAAE,eAAe;;AAG9D,SAAgB,oCACf,UACgB;AAChB,QAAO,4BAA4B,SAAS,EAAE,0BAA0B;;AAGzE,SAAgB,0BAA0B,UAA2B;AACpE,QAAO,0CAA0C,IAAI,SAAS;;AAG/D,SAAgB,eAAe,UAAuC;AACrE,KAAI,aAAa,aAChB,QAAO,uBAAuB;AAG/B,KAAI,0BAA0B,SAAS,CACtC,QAAO,uBAAuB;AAG/B,QAAO,uBAAuB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/trpc/conversation-hard-limit.d.ts
|
|
2
|
+
declare const DASHBOARD_CONVERSATION_LOCK_REASON: "conversation_limit";
|
|
3
|
+
type DashboardConversationLockReason = typeof DASHBOARD_CONVERSATION_LOCK_REASON;
|
|
4
|
+
type ConversationHardLimitCutoff = {
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
};
|
|
8
|
+
type DashboardLockableConversation = {
|
|
9
|
+
id: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
title: string | null;
|
|
12
|
+
lastTimelineItem: unknown | null;
|
|
13
|
+
lastMessageTimelineItem: unknown | null;
|
|
14
|
+
lastMessageAt: string | null;
|
|
15
|
+
dashboardLocked?: boolean;
|
|
16
|
+
dashboardLockReason?: DashboardConversationLockReason | null;
|
|
17
|
+
};
|
|
18
|
+
type DashboardLockMetadata = {
|
|
19
|
+
dashboardLocked: boolean;
|
|
20
|
+
dashboardLockReason: DashboardConversationLockReason | null;
|
|
21
|
+
};
|
|
22
|
+
declare function isConversationAfterHardLimitCutoff(value: Pick<DashboardLockableConversation, "createdAt" | "id">, cutoff: ConversationHardLimitCutoff | null): boolean;
|
|
23
|
+
declare function applyDashboardConversationHardLimitLock<T extends DashboardLockableConversation>(params: {
|
|
24
|
+
conversation: T;
|
|
25
|
+
cutoff: ConversationHardLimitCutoff | null;
|
|
26
|
+
}): T & DashboardLockMetadata;
|
|
27
|
+
declare function ensureDashboardConversationLockRedaction<T extends DashboardLockableConversation>(conversation: T): T & DashboardLockMetadata;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ConversationHardLimitCutoff, DASHBOARD_CONVERSATION_LOCK_REASON, DashboardConversationLockReason, DashboardLockableConversation, applyDashboardConversationHardLimitLock, ensureDashboardConversationLockRedaction, isConversationAfterHardLimitCutoff };
|
|
30
|
+
//# sourceMappingURL=conversation-hard-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-hard-limit.d.ts","names":[],"sources":["../../src/trpc/conversation-hard-limit.ts"],"sourcesContent":[],"mappings":";cAAa;AAAA,KAED,+BAAA,GAFmE,OAGvE,kCAHuE;AAEnE,KAGA,2BAAA,GAH+B;EAG/B,EAAA,EAAA,MAAA;EAKA,SAAA,EAAA,MAAA;AASV,CAAA;AAOc,KAhBJ,6BAAA,GAgBsC;EACrC,EAAA,EAAA,MAAA;EAAL,SAAA,EAAA,MAAA;EACC,KAAA,EAAA,MAAA,GAAA,IAAA;EAA2B,gBAAA,EAAA,OAAA,GAAA,IAAA;EAiBpB,uBAAA,EAAA,OAAA,GAAA,IAAA;EACL,aAAA,EAAA,MAAA,GAAA,IAAA;EAEI,eAAA,CAAA,EAAA,OAAA;EACN,mBAAA,CAAA,EA/Bc,+BA+Bd,GAAA,IAAA;CACL;KA7BC,qBAAA,GA6BG;EAAqB,eAAA,EAAA,OAAA;EAsBb,mBAAA,EAjDM,+BAiDkC,GAAA,IAAA;CAC7C;AACK,iBAhDA,kCAAA,CAgDA,KAAA,EA/CR,IA+CQ,CA/CH,6BA+CG,EAAA,WAAA,GAAA,IAAA,CAAA,EAAA,MAAA,EA9CP,2BA8CO,GAAA,IAAA,CAAA,EAAA,OAAA;AAAI,iBA7BJ,uCA6BI,CAAA,UA5BT,6BA4BS,CAAA,CAAA,MAAA,EAAA;EAAI,YAAA,EA1BT,CA0BS;EAAqB,MAAA,EAzBpC,2BAyBoC,GAAA,IAAA;IAxBzC,IAAI;iBAsBQ,mDACL,6CACK,IAAI,IAAI"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/trpc/conversation-hard-limit.ts
|
|
2
|
+
const DASHBOARD_CONVERSATION_LOCK_REASON = "conversation_limit";
|
|
3
|
+
function isConversationAfterHardLimitCutoff(value, cutoff) {
|
|
4
|
+
if (!cutoff) return false;
|
|
5
|
+
if (value.createdAt > cutoff.createdAt) return true;
|
|
6
|
+
if (value.createdAt < cutoff.createdAt) return false;
|
|
7
|
+
return value.id > cutoff.id;
|
|
8
|
+
}
|
|
9
|
+
function applyDashboardConversationHardLimitLock(params) {
|
|
10
|
+
const { conversation, cutoff } = params;
|
|
11
|
+
if (!isConversationAfterHardLimitCutoff(conversation, cutoff)) return {
|
|
12
|
+
...conversation,
|
|
13
|
+
dashboardLocked: false,
|
|
14
|
+
dashboardLockReason: null
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
...conversation,
|
|
18
|
+
lastTimelineItem: null,
|
|
19
|
+
lastMessageTimelineItem: null,
|
|
20
|
+
lastMessageAt: null,
|
|
21
|
+
dashboardLocked: true,
|
|
22
|
+
dashboardLockReason: DASHBOARD_CONVERSATION_LOCK_REASON
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function ensureDashboardConversationLockRedaction(conversation) {
|
|
26
|
+
if (!conversation.dashboardLocked) return {
|
|
27
|
+
...conversation,
|
|
28
|
+
dashboardLocked: false,
|
|
29
|
+
dashboardLockReason: null
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...conversation,
|
|
33
|
+
lastTimelineItem: null,
|
|
34
|
+
lastMessageTimelineItem: null,
|
|
35
|
+
lastMessageAt: null,
|
|
36
|
+
dashboardLocked: true,
|
|
37
|
+
dashboardLockReason: conversation.dashboardLockReason ?? DASHBOARD_CONVERSATION_LOCK_REASON
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { DASHBOARD_CONVERSATION_LOCK_REASON, applyDashboardConversationHardLimitLock, ensureDashboardConversationLockRedaction, isConversationAfterHardLimitCutoff };
|
|
43
|
+
//# sourceMappingURL=conversation-hard-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-hard-limit.js","names":[],"sources":["../../src/trpc/conversation-hard-limit.ts"],"sourcesContent":["export const DASHBOARD_CONVERSATION_LOCK_REASON = \"conversation_limit\" as const;\n\nexport type DashboardConversationLockReason =\n\ttypeof DASHBOARD_CONVERSATION_LOCK_REASON;\n\nexport type ConversationHardLimitCutoff = {\n\tid: string;\n\tcreatedAt: string;\n};\n\nexport type DashboardLockableConversation = {\n\tid: string;\n\tcreatedAt: string;\n\ttitle: string | null;\n\tlastTimelineItem: unknown | null;\n\tlastMessageTimelineItem: unknown | null;\n\tlastMessageAt: string | null;\n\tdashboardLocked?: boolean;\n\tdashboardLockReason?: DashboardConversationLockReason | null;\n};\n\ntype DashboardLockMetadata = {\n\tdashboardLocked: boolean;\n\tdashboardLockReason: DashboardConversationLockReason | null;\n};\n\nexport function isConversationAfterHardLimitCutoff(\n\tvalue: Pick<DashboardLockableConversation, \"createdAt\" | \"id\">,\n\tcutoff: ConversationHardLimitCutoff | null\n): boolean {\n\tif (!cutoff) {\n\t\treturn false;\n\t}\n\n\tif (value.createdAt > cutoff.createdAt) {\n\t\treturn true;\n\t}\n\n\tif (value.createdAt < cutoff.createdAt) {\n\t\treturn false;\n\t}\n\n\treturn value.id > cutoff.id;\n}\n\nexport function applyDashboardConversationHardLimitLock<\n\tT extends DashboardLockableConversation,\n>(params: {\n\tconversation: T;\n\tcutoff: ConversationHardLimitCutoff | null;\n}): T & DashboardLockMetadata {\n\tconst { conversation, cutoff } = params;\n\tconst isLocked = isConversationAfterHardLimitCutoff(conversation, cutoff);\n\n\tif (!isLocked) {\n\t\treturn {\n\t\t\t...conversation,\n\t\t\tdashboardLocked: false,\n\t\t\tdashboardLockReason: null,\n\t\t};\n\t}\n\n\treturn {\n\t\t...conversation,\n\t\tlastTimelineItem: null,\n\t\tlastMessageTimelineItem: null,\n\t\tlastMessageAt: null,\n\t\tdashboardLocked: true,\n\t\tdashboardLockReason: DASHBOARD_CONVERSATION_LOCK_REASON,\n\t};\n}\n\nexport function ensureDashboardConversationLockRedaction<\n\tT extends DashboardLockableConversation,\n>(conversation: T): T & DashboardLockMetadata {\n\tif (!conversation.dashboardLocked) {\n\t\treturn {\n\t\t\t...conversation,\n\t\t\tdashboardLocked: false,\n\t\t\tdashboardLockReason: null,\n\t\t};\n\t}\n\n\treturn {\n\t\t...conversation,\n\t\tlastTimelineItem: null,\n\t\tlastMessageTimelineItem: null,\n\t\tlastMessageAt: null,\n\t\tdashboardLocked: true,\n\t\tdashboardLockReason:\n\t\t\tconversation.dashboardLockReason ?? DASHBOARD_CONVERSATION_LOCK_REASON,\n\t};\n}\n"],"mappings":";AAAA,MAAa,qCAAqC;AA0BlD,SAAgB,mCACf,OACA,QACU;AACV,KAAI,CAAC,OACJ,QAAO;AAGR,KAAI,MAAM,YAAY,OAAO,UAC5B,QAAO;AAGR,KAAI,MAAM,YAAY,OAAO,UAC5B,QAAO;AAGR,QAAO,MAAM,KAAK,OAAO;;AAG1B,SAAgB,wCAEd,QAG4B;CAC7B,MAAM,EAAE,cAAc,WAAW;AAGjC,KAAI,CAFa,mCAAmC,cAAc,OAAO,CAGxE,QAAO;EACN,GAAG;EACH,iBAAiB;EACjB,qBAAqB;EACrB;AAGF,QAAO;EACN,GAAG;EACH,kBAAkB;EAClB,yBAAyB;EACzB,eAAe;EACf,iBAAiB;EACjB,qBAAqB;EACrB;;AAGF,SAAgB,yCAEd,cAA4C;AAC7C,KAAI,CAAC,aAAa,gBACjB,QAAO;EACN,GAAG;EACH,iBAAiB;EACjB,qBAAqB;EACrB;AAGF,QAAO;EACN,GAAG;EACH,kBAAkB;EAClB,yBAAyB;EACzB,eAAe;EACf,iBAAiB;EACjB,qBACC,aAAa,uBAAuB;EACrC"}
|