@cossistant/types 0.0.28 → 0.0.29
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 +202 -4
- package/api/ai-agent.d.ts.map +1 -1
- package/api/ai-agent.js +249 -7
- package/api/ai-agent.js.map +1 -1
- package/api/common.d.ts.map +1 -1
- package/api/contact.d.ts.map +1 -1
- package/api/index.d.ts +3 -2
- package/api/index.js +3 -2
- package/api/knowledge.d.ts +6 -0
- package/api/knowledge.d.ts.map +1 -1
- package/api/knowledge.js +12 -0
- package/api/knowledge.js.map +1 -1
- package/api/link-source.d.ts +262 -0
- package/api/link-source.d.ts.map +1 -0
- package/api/link-source.js +453 -0
- package/api/link-source.js.map +1 -0
- package/api/timeline-item.d.ts.map +1 -1
- package/enums.d.ts +3 -0
- package/enums.d.ts.map +1 -1
- package/enums.js +4 -1
- package/enums.js.map +1 -1
- package/index.d.ts +3 -2
- package/index.d.ts.map +1 -1
- package/index.js +3 -2
- package/package.json +1 -1
- package/realtime-events.d.ts +124 -0
- package/realtime-events.d.ts.map +1 -1
- package/realtime-events.js +86 -0
- package/realtime-events.js.map +1 -1
- package/trpc/conversation.d.ts +24 -0
- package/trpc/conversation.d.ts.map +1 -1
- package/trpc/conversation.js +12 -0
- package/trpc/conversation.js.map +1 -1
- package/trpc/visitor.d.ts +6 -0
- package/trpc/visitor.d.ts.map +1 -1
package/api/ai-agent.d.ts
CHANGED
|
@@ -6,19 +6,61 @@ import { z } from "@hono/zod-openapi";
|
|
|
6
6
|
* Available AI models from OpenRouter
|
|
7
7
|
*/
|
|
8
8
|
declare const AI_MODELS: readonly [{
|
|
9
|
+
readonly value: "moonshotai/kimi-k2-0905";
|
|
10
|
+
readonly label: "Kimi K2";
|
|
11
|
+
readonly provider: "Moonshot AI";
|
|
12
|
+
readonly icon: "agent";
|
|
13
|
+
readonly freeOnly: true;
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "openai/gpt-5.2-chat";
|
|
16
|
+
readonly label: "GPT-5.2";
|
|
17
|
+
readonly provider: "OpenAI";
|
|
18
|
+
readonly icon: "star";
|
|
19
|
+
readonly requiresPaid: true;
|
|
20
|
+
}, {
|
|
9
21
|
readonly value: "openai/gpt-5.1-chat";
|
|
10
22
|
readonly label: "GPT-5.1";
|
|
11
23
|
readonly provider: "OpenAI";
|
|
24
|
+
readonly icon: "star";
|
|
25
|
+
readonly requiresPaid: true;
|
|
12
26
|
}, {
|
|
13
27
|
readonly value: "openai/gpt-5-mini";
|
|
14
28
|
readonly label: "GPT-5 Mini";
|
|
15
29
|
readonly provider: "OpenAI";
|
|
30
|
+
readonly icon: "star";
|
|
31
|
+
readonly requiresPaid: true;
|
|
16
32
|
}, {
|
|
17
33
|
readonly value: "google/gemini-3-flash-preview";
|
|
18
34
|
readonly label: "Gemini 3 Flash";
|
|
19
35
|
readonly provider: "Google";
|
|
36
|
+
readonly icon: "dashboard";
|
|
37
|
+
readonly requiresPaid: true;
|
|
20
38
|
}];
|
|
21
39
|
type AIModel = (typeof AI_MODELS)[number]["value"];
|
|
40
|
+
type AIModelConfig = (typeof AI_MODELS)[number];
|
|
41
|
+
/**
|
|
42
|
+
* Available AI agent goals/intents
|
|
43
|
+
*/
|
|
44
|
+
declare const AI_AGENT_GOALS: readonly [{
|
|
45
|
+
readonly value: "sales";
|
|
46
|
+
readonly label: "Increase sales conversions";
|
|
47
|
+
}, {
|
|
48
|
+
readonly value: "support";
|
|
49
|
+
readonly label: "Provide customer support";
|
|
50
|
+
}, {
|
|
51
|
+
readonly value: "product_qa";
|
|
52
|
+
readonly label: "Answer product questions";
|
|
53
|
+
}, {
|
|
54
|
+
readonly value: "lead_qualification";
|
|
55
|
+
readonly label: "Qualify leads";
|
|
56
|
+
}, {
|
|
57
|
+
readonly value: "scheduling";
|
|
58
|
+
readonly label: "Schedule appointments";
|
|
59
|
+
}, {
|
|
60
|
+
readonly value: "feedback";
|
|
61
|
+
readonly label: "Collect customer feedback";
|
|
62
|
+
}];
|
|
63
|
+
type AIAgentGoal = (typeof AI_AGENT_GOALS)[number]["value"];
|
|
22
64
|
/**
|
|
23
65
|
* AI Agent response schema
|
|
24
66
|
*/
|
|
@@ -29,12 +71,14 @@ declare const aiAgentResponseSchema: z.ZodObject<{
|
|
|
29
71
|
basePrompt: z.ZodString;
|
|
30
72
|
model: z.ZodString;
|
|
31
73
|
temperature: z.ZodNullable<z.ZodNumber>;
|
|
32
|
-
|
|
74
|
+
maxOutputTokens: z.ZodNullable<z.ZodNumber>;
|
|
33
75
|
isActive: z.ZodBoolean;
|
|
34
76
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
35
77
|
usageCount: z.ZodNumber;
|
|
78
|
+
goals: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
36
79
|
createdAt: z.ZodString;
|
|
37
80
|
updatedAt: z.ZodString;
|
|
81
|
+
onboardingCompletedAt: z.ZodNullable<z.ZodString>;
|
|
38
82
|
}, z.core.$strip>;
|
|
39
83
|
/**
|
|
40
84
|
* Create AI Agent request schema
|
|
@@ -46,7 +90,8 @@ declare const createAiAgentRequestSchema: z.ZodObject<{
|
|
|
46
90
|
basePrompt: z.ZodString;
|
|
47
91
|
model: z.ZodString;
|
|
48
92
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
|
|
93
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
goals: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
95
|
}, z.core.$strip>;
|
|
51
96
|
/**
|
|
52
97
|
* Update AI Agent request schema
|
|
@@ -59,7 +104,9 @@ declare const updateAiAgentRequestSchema: z.ZodObject<{
|
|
|
59
104
|
basePrompt: z.ZodString;
|
|
60
105
|
model: z.ZodString;
|
|
61
106
|
temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
62
|
-
|
|
107
|
+
maxOutputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
goals: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
109
|
+
onboardingCompletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
110
|
}, z.core.$strip>;
|
|
64
111
|
/**
|
|
65
112
|
* Toggle AI Agent active status request schema
|
|
@@ -69,17 +116,168 @@ declare const toggleAiAgentActiveRequestSchema: z.ZodObject<{
|
|
|
69
116
|
aiAgentId: z.ZodULID;
|
|
70
117
|
isActive: z.ZodBoolean;
|
|
71
118
|
}, z.core.$strip>;
|
|
119
|
+
/**
|
|
120
|
+
* Delete AI Agent request schema
|
|
121
|
+
*/
|
|
122
|
+
declare const deleteAiAgentRequestSchema: z.ZodObject<{
|
|
123
|
+
websiteSlug: z.ZodString;
|
|
124
|
+
aiAgentId: z.ZodULID;
|
|
125
|
+
}, z.core.$strip>;
|
|
72
126
|
/**
|
|
73
127
|
* Get AI Agent request schema
|
|
74
128
|
*/
|
|
75
129
|
declare const getAiAgentRequestSchema: z.ZodObject<{
|
|
76
130
|
websiteSlug: z.ZodString;
|
|
77
131
|
}, z.core.$strip>;
|
|
132
|
+
/**
|
|
133
|
+
* Generate Base Prompt request schema
|
|
134
|
+
* Used to scrape a website and generate a tailored base prompt for the AI agent
|
|
135
|
+
*/
|
|
136
|
+
declare const generateBasePromptRequestSchema: z.ZodObject<{
|
|
137
|
+
websiteSlug: z.ZodString;
|
|
138
|
+
sourceUrl: z.ZodOptional<z.ZodString>;
|
|
139
|
+
agentName: z.ZodString;
|
|
140
|
+
goals: z.ZodArray<z.ZodString>;
|
|
141
|
+
manualDescription: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
/**
|
|
144
|
+
* Generate Base Prompt response schema
|
|
145
|
+
*/
|
|
146
|
+
declare const generateBasePromptResponseSchema: z.ZodObject<{
|
|
147
|
+
basePrompt: z.ZodString;
|
|
148
|
+
isGenerated: z.ZodBoolean;
|
|
149
|
+
companyName: z.ZodNullable<z.ZodString>;
|
|
150
|
+
websiteDescription: z.ZodNullable<z.ZodString>;
|
|
151
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
152
|
+
favicon: z.ZodNullable<z.ZodString>;
|
|
153
|
+
discoveredLinksCount: z.ZodNumber;
|
|
154
|
+
}, z.core.$strip>;
|
|
78
155
|
type AiAgentResponse = z.infer<typeof aiAgentResponseSchema>;
|
|
79
156
|
type CreateAiAgentRequest = z.infer<typeof createAiAgentRequestSchema>;
|
|
80
157
|
type UpdateAiAgentRequest = z.infer<typeof updateAiAgentRequestSchema>;
|
|
81
158
|
type ToggleAiAgentActiveRequest = z.infer<typeof toggleAiAgentActiveRequestSchema>;
|
|
159
|
+
type DeleteAiAgentRequest = z.infer<typeof deleteAiAgentRequestSchema>;
|
|
82
160
|
type GetAiAgentRequest = z.infer<typeof getAiAgentRequestSchema>;
|
|
161
|
+
type GenerateBasePromptRequest = z.infer<typeof generateBasePromptRequestSchema>;
|
|
162
|
+
type GenerateBasePromptResponse = z.infer<typeof generateBasePromptResponseSchema>;
|
|
163
|
+
/**
|
|
164
|
+
* AI Agent Behavior Settings Schema
|
|
165
|
+
*
|
|
166
|
+
* Controls how the AI agent behaves in conversations.
|
|
167
|
+
*/
|
|
168
|
+
declare const aiAgentBehaviorSettingsSchema: z.ZodObject<{
|
|
169
|
+
responseMode: z.ZodEnum<{
|
|
170
|
+
manual: "manual";
|
|
171
|
+
always: "always";
|
|
172
|
+
when_no_human: "when_no_human";
|
|
173
|
+
on_mention: "on_mention";
|
|
174
|
+
}>;
|
|
175
|
+
responseDelayMs: z.ZodNumber;
|
|
176
|
+
pauseOnHumanReply: z.ZodBoolean;
|
|
177
|
+
pauseDurationMinutes: z.ZodNullable<z.ZodNumber>;
|
|
178
|
+
canResolve: z.ZodBoolean;
|
|
179
|
+
canMarkSpam: z.ZodBoolean;
|
|
180
|
+
canAssign: z.ZodBoolean;
|
|
181
|
+
canSetPriority: z.ZodBoolean;
|
|
182
|
+
canCategorize: z.ZodBoolean;
|
|
183
|
+
canEscalate: z.ZodBoolean;
|
|
184
|
+
defaultEscalationUserId: z.ZodNullable<z.ZodString>;
|
|
185
|
+
autoAssignOnEscalation: z.ZodBoolean;
|
|
186
|
+
autoAnalyzeSentiment: z.ZodBoolean;
|
|
187
|
+
autoGenerateTitle: z.ZodBoolean;
|
|
188
|
+
autoCategorize: z.ZodBoolean;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
type AiAgentBehaviorSettings = z.infer<typeof aiAgentBehaviorSettingsSchema>;
|
|
191
|
+
/**
|
|
192
|
+
* Get Behavior Settings request schema
|
|
193
|
+
*/
|
|
194
|
+
declare const getBehaviorSettingsRequestSchema: z.ZodObject<{
|
|
195
|
+
websiteSlug: z.ZodString;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
/**
|
|
198
|
+
* Get Behavior Settings response schema
|
|
199
|
+
*/
|
|
200
|
+
declare const getBehaviorSettingsResponseSchema: z.ZodObject<{
|
|
201
|
+
responseMode: z.ZodEnum<{
|
|
202
|
+
manual: "manual";
|
|
203
|
+
always: "always";
|
|
204
|
+
when_no_human: "when_no_human";
|
|
205
|
+
on_mention: "on_mention";
|
|
206
|
+
}>;
|
|
207
|
+
responseDelayMs: z.ZodNumber;
|
|
208
|
+
pauseOnHumanReply: z.ZodBoolean;
|
|
209
|
+
pauseDurationMinutes: z.ZodNullable<z.ZodNumber>;
|
|
210
|
+
canResolve: z.ZodBoolean;
|
|
211
|
+
canMarkSpam: z.ZodBoolean;
|
|
212
|
+
canAssign: z.ZodBoolean;
|
|
213
|
+
canSetPriority: z.ZodBoolean;
|
|
214
|
+
canCategorize: z.ZodBoolean;
|
|
215
|
+
canEscalate: z.ZodBoolean;
|
|
216
|
+
defaultEscalationUserId: z.ZodNullable<z.ZodString>;
|
|
217
|
+
autoAssignOnEscalation: z.ZodBoolean;
|
|
218
|
+
autoAnalyzeSentiment: z.ZodBoolean;
|
|
219
|
+
autoGenerateTitle: z.ZodBoolean;
|
|
220
|
+
autoCategorize: z.ZodBoolean;
|
|
221
|
+
aiAgentId: z.ZodULID;
|
|
222
|
+
}, z.core.$strip>;
|
|
223
|
+
/**
|
|
224
|
+
* Update Behavior Settings request schema
|
|
225
|
+
*/
|
|
226
|
+
declare const updateBehaviorSettingsRequestSchema: z.ZodObject<{
|
|
227
|
+
websiteSlug: z.ZodString;
|
|
228
|
+
aiAgentId: z.ZodULID;
|
|
229
|
+
settings: z.ZodObject<{
|
|
230
|
+
responseMode: z.ZodOptional<z.ZodEnum<{
|
|
231
|
+
manual: "manual";
|
|
232
|
+
always: "always";
|
|
233
|
+
when_no_human: "when_no_human";
|
|
234
|
+
on_mention: "on_mention";
|
|
235
|
+
}>>;
|
|
236
|
+
responseDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
237
|
+
pauseOnHumanReply: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
pauseDurationMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
239
|
+
canResolve: z.ZodOptional<z.ZodBoolean>;
|
|
240
|
+
canMarkSpam: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
canAssign: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
canSetPriority: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
canCategorize: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
+
canEscalate: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
defaultEscalationUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
246
|
+
autoAssignOnEscalation: z.ZodOptional<z.ZodBoolean>;
|
|
247
|
+
autoAnalyzeSentiment: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
autoGenerateTitle: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
autoCategorize: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
/**
|
|
253
|
+
* Update Behavior Settings response schema
|
|
254
|
+
*/
|
|
255
|
+
declare const updateBehaviorSettingsResponseSchema: z.ZodObject<{
|
|
256
|
+
responseMode: z.ZodEnum<{
|
|
257
|
+
manual: "manual";
|
|
258
|
+
always: "always";
|
|
259
|
+
when_no_human: "when_no_human";
|
|
260
|
+
on_mention: "on_mention";
|
|
261
|
+
}>;
|
|
262
|
+
responseDelayMs: z.ZodNumber;
|
|
263
|
+
pauseOnHumanReply: z.ZodBoolean;
|
|
264
|
+
pauseDurationMinutes: z.ZodNullable<z.ZodNumber>;
|
|
265
|
+
canResolve: z.ZodBoolean;
|
|
266
|
+
canMarkSpam: z.ZodBoolean;
|
|
267
|
+
canAssign: z.ZodBoolean;
|
|
268
|
+
canSetPriority: z.ZodBoolean;
|
|
269
|
+
canCategorize: z.ZodBoolean;
|
|
270
|
+
canEscalate: z.ZodBoolean;
|
|
271
|
+
defaultEscalationUserId: z.ZodNullable<z.ZodString>;
|
|
272
|
+
autoAssignOnEscalation: z.ZodBoolean;
|
|
273
|
+
autoAnalyzeSentiment: z.ZodBoolean;
|
|
274
|
+
autoGenerateTitle: z.ZodBoolean;
|
|
275
|
+
autoCategorize: z.ZodBoolean;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
type GetBehaviorSettingsRequest = z.infer<typeof getBehaviorSettingsRequestSchema>;
|
|
278
|
+
type GetBehaviorSettingsResponse = z.infer<typeof getBehaviorSettingsResponseSchema>;
|
|
279
|
+
type UpdateBehaviorSettingsRequest = z.infer<typeof updateBehaviorSettingsRequestSchema>;
|
|
280
|
+
type UpdateBehaviorSettingsResponse = z.infer<typeof updateBehaviorSettingsResponseSchema>;
|
|
83
281
|
//#endregion
|
|
84
|
-
export { AIModel, AI_MODELS, AiAgentResponse, CreateAiAgentRequest, GetAiAgentRequest, ToggleAiAgentActiveRequest, UpdateAiAgentRequest, aiAgentResponseSchema, createAiAgentRequestSchema, getAiAgentRequestSchema, toggleAiAgentActiveRequestSchema, updateAiAgentRequestSchema };
|
|
282
|
+
export { AIAgentGoal, AIModel, AIModelConfig, AI_AGENT_GOALS, AI_MODELS, AiAgentBehaviorSettings, AiAgentResponse, CreateAiAgentRequest, DeleteAiAgentRequest, GenerateBasePromptRequest, GenerateBasePromptResponse, GetAiAgentRequest, GetBehaviorSettingsRequest, GetBehaviorSettingsResponse, ToggleAiAgentActiveRequest, UpdateAiAgentRequest, UpdateBehaviorSettingsRequest, UpdateBehaviorSettingsResponse, aiAgentBehaviorSettingsSchema, aiAgentResponseSchema, createAiAgentRequestSchema, deleteAiAgentRequestSchema, generateBasePromptRequestSchema, generateBasePromptResponseSchema, getAiAgentRequestSchema, getBehaviorSettingsRequestSchema, getBehaviorSettingsResponseSchema, toggleAiAgentActiveRequestSchema, updateAiAgentRequestSchema, updateBehaviorSettingsRequestSchema, updateBehaviorSettingsResponseSchema };
|
|
85
283
|
//# sourceMappingURL=ai-agent.d.ts.map
|
package/api/ai-agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent.d.ts","names":[],"sources":["../../src/api/ai-agent.ts"],"sourcesContent":[],"mappings":";;;;;;AAKA;
|
|
1
|
+
{"version":3,"file":"ai-agent.d.ts","names":[],"sources":["../../src/api/ai-agent.ts"],"sourcesContent":[],"mappings":"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"}
|
package/api/ai-agent.js
CHANGED
|
@@ -5,20 +5,69 @@ import { z } from "@hono/zod-openapi";
|
|
|
5
5
|
* Available AI models from OpenRouter
|
|
6
6
|
*/
|
|
7
7
|
const AI_MODELS = [
|
|
8
|
+
{
|
|
9
|
+
value: "moonshotai/kimi-k2-0905",
|
|
10
|
+
label: "Kimi K2",
|
|
11
|
+
provider: "Moonshot AI",
|
|
12
|
+
icon: "agent",
|
|
13
|
+
freeOnly: true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "openai/gpt-5.2-chat",
|
|
17
|
+
label: "GPT-5.2",
|
|
18
|
+
provider: "OpenAI",
|
|
19
|
+
icon: "star",
|
|
20
|
+
requiresPaid: true
|
|
21
|
+
},
|
|
8
22
|
{
|
|
9
23
|
value: "openai/gpt-5.1-chat",
|
|
10
24
|
label: "GPT-5.1",
|
|
11
|
-
provider: "OpenAI"
|
|
25
|
+
provider: "OpenAI",
|
|
26
|
+
icon: "star",
|
|
27
|
+
requiresPaid: true
|
|
12
28
|
},
|
|
13
29
|
{
|
|
14
30
|
value: "openai/gpt-5-mini",
|
|
15
31
|
label: "GPT-5 Mini",
|
|
16
|
-
provider: "OpenAI"
|
|
32
|
+
provider: "OpenAI",
|
|
33
|
+
icon: "star",
|
|
34
|
+
requiresPaid: true
|
|
17
35
|
},
|
|
18
36
|
{
|
|
19
37
|
value: "google/gemini-3-flash-preview",
|
|
20
38
|
label: "Gemini 3 Flash",
|
|
21
|
-
provider: "Google"
|
|
39
|
+
provider: "Google",
|
|
40
|
+
icon: "dashboard",
|
|
41
|
+
requiresPaid: true
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* Available AI agent goals/intents
|
|
46
|
+
*/
|
|
47
|
+
const AI_AGENT_GOALS = [
|
|
48
|
+
{
|
|
49
|
+
value: "sales",
|
|
50
|
+
label: "Increase sales conversions"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "support",
|
|
54
|
+
label: "Provide customer support"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "product_qa",
|
|
58
|
+
label: "Answer product questions"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "lead_qualification",
|
|
62
|
+
label: "Qualify leads"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "scheduling",
|
|
66
|
+
label: "Schedule appointments"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: "feedback",
|
|
70
|
+
label: "Collect customer feedback"
|
|
22
71
|
}
|
|
23
72
|
];
|
|
24
73
|
/**
|
|
@@ -49,7 +98,7 @@ const aiAgentResponseSchema = z.object({
|
|
|
49
98
|
description: "The temperature setting for response generation (0-2).",
|
|
50
99
|
example: .7
|
|
51
100
|
}),
|
|
52
|
-
|
|
101
|
+
maxOutputTokens: z.number().nullable().openapi({
|
|
53
102
|
description: "Maximum tokens for response generation.",
|
|
54
103
|
example: 1024
|
|
55
104
|
}),
|
|
@@ -65,6 +114,10 @@ const aiAgentResponseSchema = z.object({
|
|
|
65
114
|
description: "Total number of times the AI agent has been used.",
|
|
66
115
|
example: 42
|
|
67
116
|
}),
|
|
117
|
+
goals: z.array(z.string()).nullable().openapi({
|
|
118
|
+
description: "The goals/intents for this AI agent.",
|
|
119
|
+
example: ["support", "product_qa"]
|
|
120
|
+
}),
|
|
68
121
|
createdAt: z.string().openapi({
|
|
69
122
|
description: "When the AI agent was created.",
|
|
70
123
|
example: "2024-01-01T00:00:00.000Z"
|
|
@@ -72,6 +125,10 @@ const aiAgentResponseSchema = z.object({
|
|
|
72
125
|
updatedAt: z.string().openapi({
|
|
73
126
|
description: "When the AI agent was last updated.",
|
|
74
127
|
example: "2024-01-01T00:00:00.000Z"
|
|
128
|
+
}),
|
|
129
|
+
onboardingCompletedAt: z.string().nullable().openapi({
|
|
130
|
+
description: "When onboarding was completed. Null if still in onboarding flow.",
|
|
131
|
+
example: "2024-01-01T00:00:00.000Z"
|
|
75
132
|
})
|
|
76
133
|
});
|
|
77
134
|
/**
|
|
@@ -102,9 +159,13 @@ const createAiAgentRequestSchema = z.object({
|
|
|
102
159
|
description: "The temperature setting for response generation (0-2).",
|
|
103
160
|
example: .7
|
|
104
161
|
}),
|
|
105
|
-
|
|
162
|
+
maxOutputTokens: z.number().min(100, { message: "Max tokens must be at least 100." }).max(16e3, { message: "Max tokens must be at most 16,000." }).optional().openapi({
|
|
106
163
|
description: "Maximum tokens for response generation.",
|
|
107
164
|
example: 1024
|
|
165
|
+
}),
|
|
166
|
+
goals: z.array(z.string()).optional().openapi({
|
|
167
|
+
description: "The goals/intents for this AI agent.",
|
|
168
|
+
example: ["support", "product_qa"]
|
|
108
169
|
})
|
|
109
170
|
}).openapi({ description: "Payload used to create a new AI agent." });
|
|
110
171
|
/**
|
|
@@ -139,9 +200,17 @@ const updateAiAgentRequestSchema = z.object({
|
|
|
139
200
|
description: "The temperature setting for response generation (0-2).",
|
|
140
201
|
example: .7
|
|
141
202
|
}),
|
|
142
|
-
|
|
203
|
+
maxOutputTokens: z.number().min(100, { message: "Max tokens must be at least 100." }).max(16e3, { message: "Max tokens must be at most 16,000." }).nullable().optional().openapi({
|
|
143
204
|
description: "Maximum tokens for response generation.",
|
|
144
205
|
example: 1024
|
|
206
|
+
}),
|
|
207
|
+
goals: z.array(z.string()).nullable().optional().openapi({
|
|
208
|
+
description: "The goals/intents for this AI agent.",
|
|
209
|
+
example: ["support", "product_qa"]
|
|
210
|
+
}),
|
|
211
|
+
onboardingCompletedAt: z.string().nullable().optional().openapi({
|
|
212
|
+
description: "Mark onboarding as complete by setting this timestamp. Set to current ISO timestamp to complete onboarding.",
|
|
213
|
+
example: "2024-01-01T00:00:00.000Z"
|
|
145
214
|
})
|
|
146
215
|
}).openapi({ description: "Payload used to update an existing AI agent." });
|
|
147
216
|
/**
|
|
@@ -162,13 +231,186 @@ const toggleAiAgentActiveRequestSchema = z.object({
|
|
|
162
231
|
})
|
|
163
232
|
}).openapi({ description: "Payload used to toggle an AI agent's active status." });
|
|
164
233
|
/**
|
|
234
|
+
* Delete AI Agent request schema
|
|
235
|
+
*/
|
|
236
|
+
const deleteAiAgentRequestSchema = z.object({
|
|
237
|
+
websiteSlug: z.string().openapi({
|
|
238
|
+
description: "The website slug.",
|
|
239
|
+
example: "my-website"
|
|
240
|
+
}),
|
|
241
|
+
aiAgentId: z.ulid().openapi({
|
|
242
|
+
description: "The AI agent's unique identifier.",
|
|
243
|
+
example: "01JG000000000000000000000"
|
|
244
|
+
})
|
|
245
|
+
}).openapi({ description: "Payload used to permanently delete an AI agent." });
|
|
246
|
+
/**
|
|
165
247
|
* Get AI Agent request schema
|
|
166
248
|
*/
|
|
167
249
|
const getAiAgentRequestSchema = z.object({ websiteSlug: z.string().openapi({
|
|
168
250
|
description: "The website slug.",
|
|
169
251
|
example: "my-website"
|
|
170
252
|
}) }).openapi({ description: "Request to get the AI agent for a website." });
|
|
253
|
+
/**
|
|
254
|
+
* Generate Base Prompt request schema
|
|
255
|
+
* Used to scrape a website and generate a tailored base prompt for the AI agent
|
|
256
|
+
*/
|
|
257
|
+
const generateBasePromptRequestSchema = z.object({
|
|
258
|
+
websiteSlug: z.string().openapi({
|
|
259
|
+
description: "The website slug.",
|
|
260
|
+
example: "my-website"
|
|
261
|
+
}),
|
|
262
|
+
sourceUrl: z.string().url({ message: "Please enter a valid URL." }).optional().openapi({
|
|
263
|
+
description: "The URL to scrape for content and brand information. Optional - if not provided, manualDescription should be used.",
|
|
264
|
+
example: "https://example.com"
|
|
265
|
+
}),
|
|
266
|
+
agentName: z.string().min(1, { message: "Agent name is required." }).max(100, { message: "Agent name must be 100 characters or fewer." }).openapi({
|
|
267
|
+
description: "The name for the AI agent.",
|
|
268
|
+
example: "Support Assistant"
|
|
269
|
+
}),
|
|
270
|
+
goals: z.array(z.string()).openapi({
|
|
271
|
+
description: "The goals/intents for this AI agent.",
|
|
272
|
+
example: ["support", "product_qa"]
|
|
273
|
+
}),
|
|
274
|
+
manualDescription: z.string().max(1e3, { message: "Description must be 1000 characters or fewer." }).optional().openapi({
|
|
275
|
+
description: "Manual description of the business, used when scraping returns no description or no URL is provided.",
|
|
276
|
+
example: "We help small businesses manage their inventory efficiently."
|
|
277
|
+
})
|
|
278
|
+
}).openapi({ description: "Request to generate a base prompt by scraping a website and using AI." });
|
|
279
|
+
/**
|
|
280
|
+
* Generate Base Prompt response schema
|
|
281
|
+
*/
|
|
282
|
+
const generateBasePromptResponseSchema = z.object({
|
|
283
|
+
basePrompt: z.string().openapi({
|
|
284
|
+
description: "The generated base prompt for the AI agent.",
|
|
285
|
+
example: "You are a helpful support assistant for Acme Corp..."
|
|
286
|
+
}),
|
|
287
|
+
isGenerated: z.boolean().openapi({
|
|
288
|
+
description: "Whether the prompt was AI-generated (true) or fell back to default (false).",
|
|
289
|
+
example: true
|
|
290
|
+
}),
|
|
291
|
+
companyName: z.string().nullable().openapi({
|
|
292
|
+
description: "The company name extracted from the website.",
|
|
293
|
+
example: "Acme Corp"
|
|
294
|
+
}),
|
|
295
|
+
websiteDescription: z.string().nullable().openapi({
|
|
296
|
+
description: "The description extracted from the website.",
|
|
297
|
+
example: "Acme Corp helps businesses grow with innovative solutions."
|
|
298
|
+
}),
|
|
299
|
+
logo: z.string().nullable().openapi({
|
|
300
|
+
description: "The logo URL extracted from the website (og:image).",
|
|
301
|
+
example: "https://example.com/logo.png"
|
|
302
|
+
}),
|
|
303
|
+
favicon: z.string().nullable().openapi({
|
|
304
|
+
description: "The favicon URL extracted from the website.",
|
|
305
|
+
example: "https://example.com/favicon.ico"
|
|
306
|
+
}),
|
|
307
|
+
discoveredLinksCount: z.number().openapi({
|
|
308
|
+
description: "Number of pages discovered on the website for future knowledge base training.",
|
|
309
|
+
example: 47
|
|
310
|
+
})
|
|
311
|
+
}).openapi({ description: "Response containing the generated base prompt and brand info." });
|
|
312
|
+
/**
|
|
313
|
+
* AI Agent Behavior Settings Schema
|
|
314
|
+
*
|
|
315
|
+
* Controls how the AI agent behaves in conversations.
|
|
316
|
+
*/
|
|
317
|
+
const aiAgentBehaviorSettingsSchema = z.object({
|
|
318
|
+
responseMode: z.enum([
|
|
319
|
+
"always",
|
|
320
|
+
"when_no_human",
|
|
321
|
+
"on_mention",
|
|
322
|
+
"manual"
|
|
323
|
+
]).openapi({
|
|
324
|
+
description: "When the AI agent should respond to messages.",
|
|
325
|
+
example: "always"
|
|
326
|
+
}),
|
|
327
|
+
responseDelayMs: z.number().min(0).max(3e4).openapi({
|
|
328
|
+
description: "Delay in milliseconds before responding (0-30000). Makes responses feel more natural.",
|
|
329
|
+
example: 3e3
|
|
330
|
+
}),
|
|
331
|
+
pauseOnHumanReply: z.boolean().openapi({
|
|
332
|
+
description: "Whether to pause AI responses when a human agent replies.",
|
|
333
|
+
example: true
|
|
334
|
+
}),
|
|
335
|
+
pauseDurationMinutes: z.number().min(1).max(1440).nullable().openapi({
|
|
336
|
+
description: "How long to pause after a human reply (1-1440 minutes). Null for indefinite.",
|
|
337
|
+
example: 60
|
|
338
|
+
}),
|
|
339
|
+
canResolve: z.boolean().openapi({
|
|
340
|
+
description: "Whether the AI can mark conversations as resolved.",
|
|
341
|
+
example: true
|
|
342
|
+
}),
|
|
343
|
+
canMarkSpam: z.boolean().openapi({
|
|
344
|
+
description: "Whether the AI can mark conversations as spam.",
|
|
345
|
+
example: false
|
|
346
|
+
}),
|
|
347
|
+
canAssign: z.boolean().openapi({
|
|
348
|
+
description: "Whether the AI can assign conversations to team members.",
|
|
349
|
+
example: true
|
|
350
|
+
}),
|
|
351
|
+
canSetPriority: z.boolean().openapi({
|
|
352
|
+
description: "Whether the AI can change conversation priority.",
|
|
353
|
+
example: true
|
|
354
|
+
}),
|
|
355
|
+
canCategorize: z.boolean().openapi({
|
|
356
|
+
description: "Whether the AI can add conversations to views.",
|
|
357
|
+
example: true
|
|
358
|
+
}),
|
|
359
|
+
canEscalate: z.boolean().openapi({
|
|
360
|
+
description: "Whether the AI can escalate conversations to human agents.",
|
|
361
|
+
example: true
|
|
362
|
+
}),
|
|
363
|
+
defaultEscalationUserId: z.string().nullable().openapi({
|
|
364
|
+
description: "Default user ID to assign escalated conversations to.",
|
|
365
|
+
example: null
|
|
366
|
+
}),
|
|
367
|
+
autoAssignOnEscalation: z.boolean().openapi({
|
|
368
|
+
description: "Whether to automatically assign conversations when escalating.",
|
|
369
|
+
example: true
|
|
370
|
+
}),
|
|
371
|
+
autoAnalyzeSentiment: z.boolean().openapi({
|
|
372
|
+
description: "Whether to automatically analyze conversation sentiment.",
|
|
373
|
+
example: true
|
|
374
|
+
}),
|
|
375
|
+
autoGenerateTitle: z.boolean().openapi({
|
|
376
|
+
description: "Whether to automatically generate conversation titles.",
|
|
377
|
+
example: true
|
|
378
|
+
}),
|
|
379
|
+
autoCategorize: z.boolean().openapi({
|
|
380
|
+
description: "Whether to automatically add conversations to matching views.",
|
|
381
|
+
example: false
|
|
382
|
+
})
|
|
383
|
+
}).openapi({ description: "AI agent behavior settings." });
|
|
384
|
+
/**
|
|
385
|
+
* Get Behavior Settings request schema
|
|
386
|
+
*/
|
|
387
|
+
const getBehaviorSettingsRequestSchema = z.object({ websiteSlug: z.string().openapi({
|
|
388
|
+
description: "The website slug.",
|
|
389
|
+
example: "my-website"
|
|
390
|
+
}) }).openapi({ description: "Request to get behavior settings for an AI agent." });
|
|
391
|
+
/**
|
|
392
|
+
* Get Behavior Settings response schema
|
|
393
|
+
*/
|
|
394
|
+
const getBehaviorSettingsResponseSchema = aiAgentBehaviorSettingsSchema.extend({ aiAgentId: z.ulid().openapi({
|
|
395
|
+
description: "The AI agent's unique identifier.",
|
|
396
|
+
example: "01JG000000000000000000000"
|
|
397
|
+
}) }).openapi({ description: "Response containing the AI agent's behavior settings." });
|
|
398
|
+
/**
|
|
399
|
+
* Update Behavior Settings request schema
|
|
400
|
+
*/
|
|
401
|
+
const updateBehaviorSettingsRequestSchema = z.object({
|
|
402
|
+
websiteSlug: z.string().openapi({
|
|
403
|
+
description: "The website slug.",
|
|
404
|
+
example: "my-website"
|
|
405
|
+
}),
|
|
406
|
+
aiAgentId: z.ulid().openapi({
|
|
407
|
+
description: "The AI agent's unique identifier.",
|
|
408
|
+
example: "01JG000000000000000000000"
|
|
409
|
+
}),
|
|
410
|
+
settings: aiAgentBehaviorSettingsSchema.partial().openapi({ description: "Partial behavior settings to update." })
|
|
411
|
+
}).openapi({ description: "Payload used to update an AI agent's behavior settings." });
|
|
412
|
+
const updateBehaviorSettingsResponseSchema = aiAgentBehaviorSettingsSchema.openapi({ description: "The updated behavior settings." });
|
|
171
413
|
|
|
172
414
|
//#endregion
|
|
173
|
-
export { AI_MODELS, aiAgentResponseSchema, createAiAgentRequestSchema, getAiAgentRequestSchema, toggleAiAgentActiveRequestSchema, updateAiAgentRequestSchema };
|
|
415
|
+
export { AI_AGENT_GOALS, AI_MODELS, aiAgentBehaviorSettingsSchema, aiAgentResponseSchema, createAiAgentRequestSchema, deleteAiAgentRequestSchema, generateBasePromptRequestSchema, generateBasePromptResponseSchema, getAiAgentRequestSchema, getBehaviorSettingsRequestSchema, getBehaviorSettingsResponseSchema, toggleAiAgentActiveRequestSchema, updateAiAgentRequestSchema, updateBehaviorSettingsRequestSchema, updateBehaviorSettingsResponseSchema };
|
|
174
416
|
//# sourceMappingURL=ai-agent.js.map
|