@meistrari/chat-nuxt 1.11.0 → 1.13.0
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/dist/module.json +1 -1
- package/dist/module.mjs +15 -0
- package/dist/runtime/components/chat/conversation-item.d.vue.ts +6 -1
- package/dist/runtime/components/chat/conversation-item.vue +30 -141
- package/dist/runtime/components/chat/conversation-item.vue.d.ts +6 -1
- package/dist/runtime/components/chat/conversation-list.d.vue.ts +1 -0
- package/dist/runtime/components/chat/conversation-list.vue +300 -72
- package/dist/runtime/components/chat/conversation-list.vue.d.ts +1 -0
- package/dist/runtime/components/chat/conversation-new-group-button.d.vue.ts +7 -0
- package/dist/runtime/components/chat/conversation-new-group-button.vue +90 -0
- package/dist/runtime/components/chat/conversation-new-group-button.vue.d.ts +7 -0
- package/dist/runtime/components/chat/conversation-new-group-popover-content.d.vue.ts +23 -0
- package/dist/runtime/components/chat/conversation-new-group-popover-content.vue +75 -0
- package/dist/runtime/components/chat/conversation-new-group-popover-content.vue.d.ts +23 -0
- package/dist/runtime/components/chat/mobile/shell/drawer.d.vue.ts +2 -2
- package/dist/runtime/components/chat/mobile/shell/drawer.vue +370 -41
- package/dist/runtime/components/chat/mobile/shell/drawer.vue.d.ts +2 -2
- package/dist/runtime/components/chat/mobile/shell/shell.d.vue.ts +6 -6
- package/dist/runtime/components/chat/mobile/shell/shell.vue +1 -1
- package/dist/runtime/components/chat/mobile/shell/shell.vue.d.ts +6 -6
- package/dist/runtime/components/chat/reasoning-message.vue +4 -1
- package/dist/runtime/components/chat/topbar.d.vue.ts +2 -2
- package/dist/runtime/components/chat/topbar.vue.d.ts +2 -2
- package/dist/runtime/composables/useConversationGroups.d.ts +12 -0
- package/dist/runtime/composables/useConversationGroups.js +160 -0
- package/dist/runtime/composables/useConversationItem.d.ts +48 -0
- package/dist/runtime/composables/useConversationItem.js +176 -0
- package/dist/runtime/composables/useConversationList.d.ts +128 -0
- package/dist/runtime/composables/useConversationList.js +553 -0
- package/dist/runtime/composables/useConversations.d.ts +2 -0
- package/dist/runtime/composables/useConversations.js +45 -1
- package/dist/runtime/composables/usePendingConversationGroup.d.ts +5 -0
- package/dist/runtime/composables/usePendingConversationGroup.js +33 -0
- package/dist/runtime/composables/useVerbConjugation.d.ts +1 -0
- package/dist/runtime/composables/useVerbConjugation.js +14 -1
- package/dist/runtime/embed/components/ChatConfigurationModal.d.vue.ts +1 -1
- package/dist/runtime/embed/components/ChatConfigurationModal.vue.d.ts +1 -1
- package/dist/runtime/embed/components/ChatEmbedInner.vue +24 -5
- package/dist/runtime/server/api/chat/conversations/[id]/group.patch.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/[id]/group.patch.js +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.delete.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.delete.js +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.patch.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/[groupId]/index.patch.js +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/index.get.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/index.get.js +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/index.post.d.ts +1 -0
- package/dist/runtime/server/api/chat/conversations/groups/index.post.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/group.patch.d.ts +2 -0
- package/dist/runtime/server/api/conversations/[id]/group.patch.js +46 -0
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +2 -0
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +26 -4
- package/dist/runtime/server/api/conversations/groups/[groupId]/index.delete.d.ts +4 -0
- package/dist/runtime/server/api/conversations/groups/[groupId]/index.delete.js +25 -0
- package/dist/runtime/server/api/conversations/groups/[groupId]/index.patch.d.ts +2 -0
- package/dist/runtime/server/api/conversations/groups/[groupId]/index.patch.js +30 -0
- package/dist/runtime/server/api/conversations/groups/index.get.d.ts +2 -0
- package/dist/runtime/server/api/conversations/groups/index.get.js +13 -0
- package/dist/runtime/server/api/conversations/groups/index.post.d.ts +2 -0
- package/dist/runtime/server/api/conversations/groups/index.post.js +26 -0
- package/dist/runtime/server/api/conversations/index.post.js +1 -0
- package/dist/runtime/server/db/schema/conversation-groups.d.ts +143 -0
- package/dist/runtime/server/db/schema/conversation-groups.js +20 -0
- package/dist/runtime/server/db/schema/conversations.d.ts +17 -0
- package/dist/runtime/server/db/schema/conversations.js +3 -0
- package/dist/runtime/server/db/schema/index.d.ts +1 -0
- package/dist/runtime/server/db/schema/index.js +1 -0
- package/dist/runtime/server/db/schema/messages.d.ts +34 -0
- package/dist/runtime/server/db/schema/messages.js +3 -1
- package/dist/runtime/server/utils/conversation-group.d.ts +4 -0
- package/dist/runtime/server/utils/conversation-group.js +48 -0
- package/dist/runtime/server/utils/conversation-message-sync.d.ts +1 -1
- package/dist/runtime/server/utils/conversation-message-sync.js +2 -2
- package/dist/runtime/server/utils/tela-agent-api.d.ts +3 -1
- package/dist/runtime/server/utils/tela-agent-api.js +285 -26
- package/dist/runtime/server/utils/tela-agent-session.d.ts +14 -4
- package/dist/runtime/server/utils/tela-agent-session.js +57 -22
- package/dist/runtime/types/chat.d.ts +2 -1
- package/dist/runtime/types/tela-agent.d.ts +155 -43
- package/dist/runtime/types/tela-agent.js +49 -11
- package/dist/runtime/utils/conversation-groups.d.ts +18 -0
- package/dist/runtime/utils/conversation-groups.js +30 -0
- package/drizzle/0016_dry_aaron_stack.sql +16 -0
- package/drizzle/0017_typical_dexter_bennett.sql +2 -0
- package/drizzle/meta/0016_snapshot.json +887 -0
- package/drizzle/meta/0017_snapshot.json +899 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { InferSelectModel } from 'drizzle-orm';
|
|
2
|
-
import type { conversations, messages, ContextFile as SchemaContextFile, ExternalSkill as SchemaExternalSkill, MessageFile as SchemaMessageFile } from '#chat-runtime/server/db/schema';
|
|
2
|
+
import type { conversationGroups, conversations, messages, ContextFile as SchemaContextFile, ExternalSkill as SchemaExternalSkill, MessageFile as SchemaMessageFile } from '#chat-runtime/server/db/schema';
|
|
3
3
|
export type ContextFile = SchemaContextFile;
|
|
4
4
|
export type ExternalSkill = SchemaExternalSkill;
|
|
5
5
|
export type MessageFile = SchemaMessageFile;
|
|
6
6
|
export type Conversation = InferSelectModel<typeof conversations>;
|
|
7
|
+
export type ConversationGroup = InferSelectModel<typeof conversationGroups>;
|
|
7
8
|
export type Message = InferSelectModel<typeof messages>;
|
|
8
9
|
export type ConversationCreatorFilter = 'all' | 'mine';
|
|
9
10
|
export type ConversationCreatorFilterCounts = Record<ConversationCreatorFilter, number>;
|
|
@@ -101,7 +101,7 @@ export declare const telaAgentSessionStatusSchema: z.ZodEnum<{
|
|
|
101
101
|
}>;
|
|
102
102
|
export type TelaAgentSessionStatus = z.infer<typeof telaAgentSessionStatusSchema>;
|
|
103
103
|
export declare const telaAgentStepSchema: z.ZodObject<{
|
|
104
|
-
id: z.ZodString
|
|
104
|
+
id: z.ZodOptional<z.ZodString>;
|
|
105
105
|
eventId: z.ZodOptional<z.ZodString>;
|
|
106
106
|
inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
107
|
outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -120,6 +120,22 @@ export declare const telaAgentUsageSchema: z.ZodObject<{
|
|
|
120
120
|
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
121
121
|
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
122
122
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
123
|
+
export declare const telaAgentSessionResultSchema: z.ZodObject<{
|
|
124
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
turns: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
completionTokens: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
completionCost: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
134
|
+
usageBreakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
135
|
+
content: z.ZodOptional<z.ZodString>;
|
|
136
|
+
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
137
|
+
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
138
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
123
139
|
export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
124
140
|
sessionId: z.ZodString;
|
|
125
141
|
status: z.ZodEnum<{
|
|
@@ -131,7 +147,7 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
131
147
|
cancelled: "cancelled";
|
|
132
148
|
}>;
|
|
133
149
|
steps: z.ZodArray<z.ZodObject<{
|
|
134
|
-
id: z.ZodString
|
|
150
|
+
id: z.ZodOptional<z.ZodString>;
|
|
135
151
|
eventId: z.ZodOptional<z.ZodString>;
|
|
136
152
|
inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
137
153
|
outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -151,6 +167,7 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
151
167
|
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
152
168
|
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
153
169
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
170
|
+
usageBreakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
154
171
|
content: z.ZodOptional<z.ZodString>;
|
|
155
172
|
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
156
173
|
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -160,6 +177,142 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
160
177
|
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
161
178
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
162
179
|
export type TelaAgentSession = z.infer<typeof telaAgentSessionSchema>;
|
|
180
|
+
export declare const telaAgentV4SessionStatusEventSchema: z.ZodObject<{
|
|
181
|
+
kind: z.ZodLiteral<"status">;
|
|
182
|
+
sessionId: z.ZodString;
|
|
183
|
+
status: z.ZodEnum<{
|
|
184
|
+
pending: "pending";
|
|
185
|
+
running: "running";
|
|
186
|
+
failed: "failed";
|
|
187
|
+
cancelled: "cancelled";
|
|
188
|
+
}>;
|
|
189
|
+
error: z.ZodOptional<z.ZodString>;
|
|
190
|
+
createdAt: z.ZodNumber;
|
|
191
|
+
updatedAt: z.ZodNumber;
|
|
192
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
193
|
+
export declare const telaAgentV4SessionStepsEventSchema: z.ZodObject<{
|
|
194
|
+
kind: z.ZodLiteral<"steps">;
|
|
195
|
+
sessionId: z.ZodString;
|
|
196
|
+
status: z.ZodEnum<{
|
|
197
|
+
pending: "pending";
|
|
198
|
+
running: "running";
|
|
199
|
+
completed: "completed";
|
|
200
|
+
failed: "failed";
|
|
201
|
+
waiting_messages: "waiting_messages";
|
|
202
|
+
cancelled: "cancelled";
|
|
203
|
+
}>;
|
|
204
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
205
|
+
id: z.ZodOptional<z.ZodString>;
|
|
206
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
208
|
+
outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
209
|
+
cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
210
|
+
cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
211
|
+
calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
212
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
213
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
214
|
+
createdAt: z.ZodNumber;
|
|
215
|
+
updatedAt: z.ZodNumber;
|
|
216
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
217
|
+
export declare const telaAgentV4SessionResultEventSchema: z.ZodObject<{
|
|
218
|
+
kind: z.ZodLiteral<"result">;
|
|
219
|
+
sessionId: z.ZodString;
|
|
220
|
+
status: z.ZodEnum<{
|
|
221
|
+
completed: "completed";
|
|
222
|
+
waiting_messages: "waiting_messages";
|
|
223
|
+
}>;
|
|
224
|
+
result: z.ZodObject<{
|
|
225
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
226
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
turns: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
completionTokens: z.ZodOptional<z.ZodNumber>;
|
|
229
|
+
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
completionCost: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
235
|
+
usageBreakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
236
|
+
content: z.ZodOptional<z.ZodString>;
|
|
237
|
+
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
238
|
+
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
239
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
240
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
241
|
+
createdAt: z.ZodNumber;
|
|
242
|
+
updatedAt: z.ZodNumber;
|
|
243
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
244
|
+
export declare const telaAgentV4SessionErrorEventSchema: z.ZodObject<{
|
|
245
|
+
kind: z.ZodLiteral<"error">;
|
|
246
|
+
sessionId: z.ZodString;
|
|
247
|
+
error: z.ZodString;
|
|
248
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
249
|
+
export declare const telaAgentV4SessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
250
|
+
kind: z.ZodLiteral<"status">;
|
|
251
|
+
sessionId: z.ZodString;
|
|
252
|
+
status: z.ZodEnum<{
|
|
253
|
+
pending: "pending";
|
|
254
|
+
running: "running";
|
|
255
|
+
failed: "failed";
|
|
256
|
+
cancelled: "cancelled";
|
|
257
|
+
}>;
|
|
258
|
+
error: z.ZodOptional<z.ZodString>;
|
|
259
|
+
createdAt: z.ZodNumber;
|
|
260
|
+
updatedAt: z.ZodNumber;
|
|
261
|
+
}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"steps">;
|
|
263
|
+
sessionId: z.ZodString;
|
|
264
|
+
status: z.ZodEnum<{
|
|
265
|
+
pending: "pending";
|
|
266
|
+
running: "running";
|
|
267
|
+
completed: "completed";
|
|
268
|
+
failed: "failed";
|
|
269
|
+
waiting_messages: "waiting_messages";
|
|
270
|
+
cancelled: "cancelled";
|
|
271
|
+
}>;
|
|
272
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
273
|
+
id: z.ZodOptional<z.ZodString>;
|
|
274
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
275
|
+
inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
276
|
+
outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
277
|
+
cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
278
|
+
cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
279
|
+
calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
280
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
281
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
282
|
+
createdAt: z.ZodNumber;
|
|
283
|
+
updatedAt: z.ZodNumber;
|
|
284
|
+
}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
285
|
+
kind: z.ZodLiteral<"result">;
|
|
286
|
+
sessionId: z.ZodString;
|
|
287
|
+
status: z.ZodEnum<{
|
|
288
|
+
completed: "completed";
|
|
289
|
+
waiting_messages: "waiting_messages";
|
|
290
|
+
}>;
|
|
291
|
+
result: z.ZodObject<{
|
|
292
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
293
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
turns: z.ZodOptional<z.ZodNumber>;
|
|
295
|
+
completionTokens: z.ZodOptional<z.ZodNumber>;
|
|
296
|
+
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
298
|
+
completionCost: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
301
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
302
|
+
usageBreakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
303
|
+
content: z.ZodOptional<z.ZodString>;
|
|
304
|
+
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
305
|
+
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
306
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
307
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
308
|
+
createdAt: z.ZodNumber;
|
|
309
|
+
updatedAt: z.ZodNumber;
|
|
310
|
+
}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
311
|
+
kind: z.ZodLiteral<"error">;
|
|
312
|
+
sessionId: z.ZodString;
|
|
313
|
+
error: z.ZodString;
|
|
314
|
+
}, z.core.$catchall<z.ZodUnknown>>], "kind">;
|
|
315
|
+
export type TelaAgentV4SessionStreamEvent = z.infer<typeof telaAgentV4SessionStreamEventSchema>;
|
|
163
316
|
export declare const telaAgentRunApiResponseSchema: z.ZodObject<{
|
|
164
317
|
data: z.ZodObject<{
|
|
165
318
|
sessionId: z.ZodString;
|
|
@@ -195,47 +348,6 @@ export declare const telaAgentApiResponseSchema: z.ZodObject<{
|
|
|
195
348
|
isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
196
349
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
197
350
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
198
|
-
export declare const telaAgentSessionApiResponseSchema: z.ZodObject<{
|
|
199
|
-
data: z.ZodObject<{
|
|
200
|
-
sessionId: z.ZodString;
|
|
201
|
-
status: z.ZodEnum<{
|
|
202
|
-
pending: "pending";
|
|
203
|
-
running: "running";
|
|
204
|
-
completed: "completed";
|
|
205
|
-
failed: "failed";
|
|
206
|
-
waiting_messages: "waiting_messages";
|
|
207
|
-
cancelled: "cancelled";
|
|
208
|
-
}>;
|
|
209
|
-
steps: z.ZodArray<z.ZodObject<{
|
|
210
|
-
id: z.ZodString;
|
|
211
|
-
eventId: z.ZodOptional<z.ZodString>;
|
|
212
|
-
inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
213
|
-
outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
214
|
-
cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
215
|
-
cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
216
|
-
calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
217
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
218
|
-
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
219
|
-
result: z.ZodOptional<z.ZodObject<{
|
|
220
|
-
usage: z.ZodOptional<z.ZodObject<{
|
|
221
|
-
duration: z.ZodOptional<z.ZodNumber>;
|
|
222
|
-
turns: z.ZodOptional<z.ZodNumber>;
|
|
223
|
-
completionTokens: z.ZodOptional<z.ZodNumber>;
|
|
224
|
-
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
225
|
-
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
226
|
-
completionCost: z.ZodOptional<z.ZodNumber>;
|
|
227
|
-
promptCost: z.ZodOptional<z.ZodNumber>;
|
|
228
|
-
totalCost: z.ZodOptional<z.ZodNumber>;
|
|
229
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
230
|
-
content: z.ZodOptional<z.ZodString>;
|
|
231
|
-
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
232
|
-
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
233
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
234
|
-
error: z.ZodOptional<z.ZodString>;
|
|
235
|
-
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
236
|
-
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
237
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
238
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
239
351
|
export declare const telaAgentEndSessionApiResponseSchema: z.ZodObject<{
|
|
240
352
|
data: z.ZodObject<{
|
|
241
353
|
success: z.ZodBoolean;
|
|
@@ -49,14 +49,16 @@ export const telaAgentSessionStatusSchema = z.enum([
|
|
|
49
49
|
"cancelled"
|
|
50
50
|
]);
|
|
51
51
|
export const telaAgentStepSchema = z.object({
|
|
52
|
-
id: z.string(),
|
|
52
|
+
id: z.string().optional(),
|
|
53
53
|
eventId: z.string().optional(),
|
|
54
54
|
inputTokens: z.number().nullable().optional(),
|
|
55
55
|
outputTokens: z.number().nullable().optional(),
|
|
56
56
|
cacheReadInputTokens: z.number().nullable().optional(),
|
|
57
57
|
cacheCreationInputTokens: z.number().nullable().optional(),
|
|
58
58
|
calculatedCostUsd: z.number().nullable().optional()
|
|
59
|
-
}).catchall(z.unknown())
|
|
59
|
+
}).catchall(z.unknown()).refine((step) => Boolean(step.id || step.eventId), {
|
|
60
|
+
message: "Tela agent step must include id or eventId"
|
|
61
|
+
});
|
|
60
62
|
export const telaAgentUsageSchema = z.object({
|
|
61
63
|
duration: z.number().optional(),
|
|
62
64
|
turns: z.number().optional(),
|
|
@@ -67,30 +69,66 @@ export const telaAgentUsageSchema = z.object({
|
|
|
67
69
|
promptCost: z.number().optional(),
|
|
68
70
|
totalCost: z.number().optional()
|
|
69
71
|
}).catchall(z.unknown());
|
|
72
|
+
export const telaAgentSessionResultSchema = z.object({
|
|
73
|
+
usage: telaAgentUsageSchema.optional(),
|
|
74
|
+
usageBreakdown: z.record(z.string(), z.unknown()).optional(),
|
|
75
|
+
content: z.string().optional(),
|
|
76
|
+
structuredContent: z.record(z.string(), z.unknown()).optional(),
|
|
77
|
+
childEventIds: z.array(z.string()).optional()
|
|
78
|
+
}).catchall(z.unknown());
|
|
70
79
|
export const telaAgentSessionSchema = z.object({
|
|
71
80
|
sessionId: z.string(),
|
|
72
81
|
status: telaAgentSessionStatusSchema,
|
|
73
82
|
steps: z.array(telaAgentStepSchema),
|
|
74
83
|
nextCursor: z.number().nullable().optional(),
|
|
75
|
-
result:
|
|
76
|
-
usage: telaAgentUsageSchema.optional(),
|
|
77
|
-
content: z.string().optional(),
|
|
78
|
-
structuredContent: z.record(z.string(), z.unknown()).optional(),
|
|
79
|
-
childEventIds: z.array(z.string()).optional()
|
|
80
|
-
}).catchall(z.unknown()).optional(),
|
|
84
|
+
result: telaAgentSessionResultSchema.optional(),
|
|
81
85
|
error: z.string().optional(),
|
|
82
86
|
createdAt: z.number().optional(),
|
|
83
87
|
updatedAt: z.number().optional()
|
|
84
88
|
}).catchall(z.unknown());
|
|
89
|
+
export const telaAgentV4SessionStatusEventSchema = z.object({
|
|
90
|
+
kind: z.literal("status"),
|
|
91
|
+
sessionId: z.string(),
|
|
92
|
+
status: z.enum(["pending", "running", "failed", "cancelled"]),
|
|
93
|
+
error: z.string().optional(),
|
|
94
|
+
createdAt: z.number(),
|
|
95
|
+
updatedAt: z.number()
|
|
96
|
+
}).catchall(z.unknown());
|
|
97
|
+
export const telaAgentV4SessionStepsEventSchema = z.object({
|
|
98
|
+
kind: z.literal("steps"),
|
|
99
|
+
sessionId: z.string(),
|
|
100
|
+
status: telaAgentSessionStatusSchema,
|
|
101
|
+
steps: z.array(telaAgentStepSchema),
|
|
102
|
+
nextCursor: z.number().nullable(),
|
|
103
|
+
createdAt: z.number(),
|
|
104
|
+
updatedAt: z.number()
|
|
105
|
+
}).catchall(z.unknown());
|
|
106
|
+
export const telaAgentV4SessionResultEventSchema = z.object({
|
|
107
|
+
kind: z.literal("result"),
|
|
108
|
+
sessionId: z.string(),
|
|
109
|
+
status: z.enum(["completed", "waiting_messages"]),
|
|
110
|
+
result: telaAgentSessionResultSchema,
|
|
111
|
+
nextCursor: z.number().nullable(),
|
|
112
|
+
createdAt: z.number(),
|
|
113
|
+
updatedAt: z.number()
|
|
114
|
+
}).catchall(z.unknown());
|
|
115
|
+
export const telaAgentV4SessionErrorEventSchema = z.object({
|
|
116
|
+
kind: z.literal("error"),
|
|
117
|
+
sessionId: z.string(),
|
|
118
|
+
error: z.string()
|
|
119
|
+
}).catchall(z.unknown());
|
|
120
|
+
export const telaAgentV4SessionStreamEventSchema = z.discriminatedUnion("kind", [
|
|
121
|
+
telaAgentV4SessionStatusEventSchema,
|
|
122
|
+
telaAgentV4SessionStepsEventSchema,
|
|
123
|
+
telaAgentV4SessionResultEventSchema,
|
|
124
|
+
telaAgentV4SessionErrorEventSchema
|
|
125
|
+
]);
|
|
85
126
|
export const telaAgentRunApiResponseSchema = z.object({
|
|
86
127
|
data: telaAgentRunResponseSchema
|
|
87
128
|
}).catchall(z.unknown());
|
|
88
129
|
export const telaAgentApiResponseSchema = z.object({
|
|
89
130
|
data: telaAgentSchema
|
|
90
131
|
}).catchall(z.unknown());
|
|
91
|
-
export const telaAgentSessionApiResponseSchema = z.object({
|
|
92
|
-
data: telaAgentSessionSchema
|
|
93
|
-
}).catchall(z.unknown());
|
|
94
132
|
export const telaAgentEndSessionApiResponseSchema = z.object({
|
|
95
133
|
data: z.object({
|
|
96
134
|
success: z.boolean()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConversationGroupLike = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
createdAt?: Date | string;
|
|
5
|
+
};
|
|
6
|
+
export type ConversationGroupItem = {
|
|
7
|
+
groupId?: string | null;
|
|
8
|
+
updatedAt: Date | string;
|
|
9
|
+
};
|
|
10
|
+
export type ConversationGroupBucket<TGroup extends ConversationGroupLike, TConversation extends ConversationGroupItem> = {
|
|
11
|
+
group: TGroup;
|
|
12
|
+
items: TConversation[];
|
|
13
|
+
};
|
|
14
|
+
export type GroupedConversations<TGroup extends ConversationGroupLike, TConversation extends ConversationGroupItem> = {
|
|
15
|
+
groups: ConversationGroupBucket<TGroup, TConversation>[];
|
|
16
|
+
unfiled: TConversation[];
|
|
17
|
+
};
|
|
18
|
+
export declare function groupConversationsByGroup<TConversation extends ConversationGroupItem, TGroup extends ConversationGroupLike>(conversations: readonly TConversation[], groups: readonly TGroup[]): GroupedConversations<TGroup, TConversation>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function byUpdatedAtDesc(a, b) {
|
|
2
|
+
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime();
|
|
3
|
+
}
|
|
4
|
+
function byGroupOrder(a, b) {
|
|
5
|
+
const createdAtDelta = new Date(a.createdAt ?? 0).getTime() - new Date(b.createdAt ?? 0).getTime();
|
|
6
|
+
if (createdAtDelta !== 0)
|
|
7
|
+
return createdAtDelta;
|
|
8
|
+
return a.name.localeCompare(b.name);
|
|
9
|
+
}
|
|
10
|
+
export function groupConversationsByGroup(conversations, groups) {
|
|
11
|
+
const groupById = new Map(groups.map((group) => [group.id, group]));
|
|
12
|
+
const itemsByGroupId = /* @__PURE__ */ new Map();
|
|
13
|
+
const unfiled = [];
|
|
14
|
+
for (const conversation of conversations) {
|
|
15
|
+
if (conversation.groupId && groupById.has(conversation.groupId)) {
|
|
16
|
+
const groupItems = itemsByGroupId.get(conversation.groupId) ?? [];
|
|
17
|
+
groupItems.push(conversation);
|
|
18
|
+
itemsByGroupId.set(conversation.groupId, groupItems);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
unfiled.push(conversation);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
groups: [...groups].sort(byGroupOrder).map((group) => ({
|
|
25
|
+
group,
|
|
26
|
+
items: [...itemsByGroupId.get(group.id) ?? []].sort(byUpdatedAtDesc)
|
|
27
|
+
})),
|
|
28
|
+
unfiled: [...unfiled].sort(byUpdatedAtDesc)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
CREATE TABLE "chat"."conversation_groups" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"workspace_id" text NOT NULL,
|
|
4
|
+
"tela_agent_id" text,
|
|
5
|
+
"conversation_scope" text,
|
|
6
|
+
"name" text NOT NULL,
|
|
7
|
+
"created_by" text,
|
|
8
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
9
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
ALTER TABLE "chat"."conversations" ADD COLUMN "group_id" uuid;--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "idx_conversation_groups_workspace" ON "chat"."conversation_groups" USING btree ("workspace_id");--> statement-breakpoint
|
|
14
|
+
CREATE INDEX "idx_conversation_groups_runtime_created_at" ON "chat"."conversation_groups" USING btree ("workspace_id","tela_agent_id","conversation_scope","created_at");--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "chat"."conversations" ADD CONSTRAINT "conversations_group_id_conversation_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "chat"."conversation_groups"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "idx_conversations_group" ON "chat"."conversations" USING btree ("group_id");
|