@okrlinkhub/agent-factory 2.0.0 → 2.0.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/dist/client/index.d.ts +88 -54
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +90 -37
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +157 -8
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/identity.d.ts +4 -4
- package/dist/component/pushing.d.ts +27 -27
- package/dist/component/queue.d.ts +145 -50
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +231 -16
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +10 -10
- package/dist/component/scheduler.js +4 -0
- package/dist/component/scheduler.js.map +1 -1
- package/dist/component/schema.d.ts +164 -80
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +29 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +171 -42
- package/src/component/_generated/component.ts +189 -14
- package/src/component/lib.test.ts +132 -0
- package/src/component/queue.ts +356 -22
- package/src/component/scheduler.ts +4 -0
- package/src/component/schema.ts +46 -0
package/dist/client/index.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
22
22
|
getProviderRuntimeConfig: import("convex/server").RegisteredQuery<"public", {}, Promise<any>>;
|
|
23
23
|
setProviderRuntimeConfig: import("convex/server").RegisteredMutation<"public", {
|
|
24
24
|
providerConfig: {
|
|
25
|
-
kind: "fly" | "runpod" | "ecs";
|
|
26
25
|
appName: string;
|
|
26
|
+
kind: "fly" | "runpod" | "ecs";
|
|
27
27
|
organizationSlug: string;
|
|
28
28
|
image: string;
|
|
29
29
|
region: string;
|
|
@@ -36,12 +36,14 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
36
36
|
setMessageRuntimeConfig: import("convex/server").RegisteredMutation<"public", {
|
|
37
37
|
messageConfig: {
|
|
38
38
|
systemPrompt?: string | undefined;
|
|
39
|
+
telegramAttachmentRetentionMs?: number | undefined;
|
|
39
40
|
};
|
|
40
41
|
}, Promise<null>>;
|
|
41
42
|
enqueue: import("convex/server").RegisteredMutation<"public", {
|
|
43
|
+
metadata?: Record<string, string> | undefined;
|
|
42
44
|
providerConfig?: {
|
|
43
|
-
kind: "fly" | "runpod" | "ecs";
|
|
44
45
|
appName: string;
|
|
46
|
+
kind: "fly" | "runpod" | "ecs";
|
|
45
47
|
organizationSlug: string;
|
|
46
48
|
image: string;
|
|
47
49
|
region: string;
|
|
@@ -49,12 +51,21 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
49
51
|
volumePath: string;
|
|
50
52
|
volumeSizeGb: number;
|
|
51
53
|
} | undefined;
|
|
54
|
+
priority?: number | undefined;
|
|
55
|
+
attachments?: {
|
|
56
|
+
sizeBytes?: number | undefined;
|
|
57
|
+
fileName?: string | undefined;
|
|
58
|
+
mimeType?: string | undefined;
|
|
59
|
+
storageId: string;
|
|
60
|
+
status: "expired" | "ready";
|
|
61
|
+
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
62
|
+
telegramFileId: string;
|
|
63
|
+
expiresAt: number;
|
|
64
|
+
}[] | undefined;
|
|
52
65
|
externalMessageId?: string | undefined;
|
|
53
66
|
rawUpdateJson?: string | undefined;
|
|
54
|
-
metadata?: Record<string, string> | undefined;
|
|
55
|
-
priority?: number | undefined;
|
|
56
|
-
conversationId: string;
|
|
57
67
|
agentKey: string;
|
|
68
|
+
conversationId: string;
|
|
58
69
|
provider: string;
|
|
59
70
|
providerUserId: string;
|
|
60
71
|
messageText: string;
|
|
@@ -81,6 +92,16 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
81
92
|
leaseId: string;
|
|
82
93
|
messageId: string;
|
|
83
94
|
payload: {
|
|
95
|
+
attachments?: Array<{
|
|
96
|
+
expiresAt: number;
|
|
97
|
+
fileName?: string;
|
|
98
|
+
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
99
|
+
mimeType?: string;
|
|
100
|
+
sizeBytes?: number;
|
|
101
|
+
status: "ready" | "expired";
|
|
102
|
+
storageId: string;
|
|
103
|
+
telegramFileId: string;
|
|
104
|
+
}>;
|
|
84
105
|
externalMessageId?: string;
|
|
85
106
|
messageText: string;
|
|
86
107
|
metadata?: Record<string, string>;
|
|
@@ -90,18 +111,18 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
90
111
|
};
|
|
91
112
|
} | null>>;
|
|
92
113
|
workerHeartbeat: import("convex/server").RegisteredMutation<"public", {
|
|
93
|
-
workerId: string;
|
|
94
114
|
messageId: string;
|
|
115
|
+
workerId: string;
|
|
95
116
|
leaseId: string;
|
|
96
117
|
}, Promise<boolean>>;
|
|
97
118
|
workerComplete: import("convex/server").RegisteredMutation<"public", {
|
|
98
|
-
workerId: string;
|
|
99
119
|
messageId: string;
|
|
120
|
+
workerId: string;
|
|
100
121
|
leaseId: string;
|
|
101
122
|
}, Promise<boolean>>;
|
|
102
123
|
workerFail: import("convex/server").RegisteredMutation<"public", {
|
|
103
|
-
workerId: string;
|
|
104
124
|
messageId: string;
|
|
125
|
+
workerId: string;
|
|
105
126
|
leaseId: string;
|
|
106
127
|
errorMessage: string;
|
|
107
128
|
}, Promise<{
|
|
@@ -110,8 +131,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
110
131
|
requeued: boolean;
|
|
111
132
|
}>>;
|
|
112
133
|
workerHydrationBundle: import("convex/server").RegisteredQuery<"public", {
|
|
113
|
-
messageId: string;
|
|
114
134
|
workspaceId: string;
|
|
135
|
+
messageId: string;
|
|
115
136
|
}, Promise<{
|
|
116
137
|
agentKey: string;
|
|
117
138
|
bridgeRuntimeConfig: null | {
|
|
@@ -137,6 +158,16 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
137
158
|
};
|
|
138
159
|
messageId: string;
|
|
139
160
|
payload: {
|
|
161
|
+
attachments?: Array<{
|
|
162
|
+
expiresAt: number;
|
|
163
|
+
fileName?: string;
|
|
164
|
+
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
165
|
+
mimeType?: string;
|
|
166
|
+
sizeBytes?: number;
|
|
167
|
+
status: "ready" | "expired";
|
|
168
|
+
storageId: string;
|
|
169
|
+
telegramFileId: string;
|
|
170
|
+
}>;
|
|
140
171
|
externalMessageId?: string;
|
|
141
172
|
messageText: string;
|
|
142
173
|
metadata?: Record<string, string>;
|
|
@@ -147,8 +178,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
147
178
|
telegramBotToken: null | string;
|
|
148
179
|
} | null>>;
|
|
149
180
|
workerGlobalSkillsManifest: import("convex/server").RegisteredQuery<"public", {
|
|
150
|
-
workerId?: string | undefined;
|
|
151
181
|
workspaceId?: string | undefined;
|
|
182
|
+
workerId?: string | undefined;
|
|
152
183
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
153
184
|
}, Promise<any>>;
|
|
154
185
|
workerConversationHasQueued: import("convex/server").RegisteredQuery<"public", {
|
|
@@ -159,8 +190,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
159
190
|
conversationId: string;
|
|
160
191
|
messages: {
|
|
161
192
|
at?: number | undefined;
|
|
162
|
-
role: "system" | "user" | "assistant" | "tool";
|
|
163
193
|
content: string;
|
|
194
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
164
195
|
}[];
|
|
165
196
|
}, Promise<{
|
|
166
197
|
messageCount: number;
|
|
@@ -170,27 +201,27 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
170
201
|
workerId: string;
|
|
171
202
|
}, Promise<any>>;
|
|
172
203
|
workerPrepareSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
173
|
-
conversationId: string;
|
|
174
204
|
agentKey: string;
|
|
175
|
-
|
|
205
|
+
conversationId: string;
|
|
176
206
|
workspaceId: string;
|
|
177
|
-
|
|
207
|
+
workerId: string;
|
|
208
|
+
reason: "manual" | "drain" | "signal";
|
|
178
209
|
}, Promise<any>>;
|
|
179
210
|
workerFinalizeSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
180
211
|
workerId: string;
|
|
181
|
-
snapshotId: string;
|
|
182
212
|
storageId: string;
|
|
213
|
+
snapshotId: string;
|
|
183
214
|
sha256: string;
|
|
184
215
|
sizeBytes: number;
|
|
185
216
|
}, Promise<any>>;
|
|
186
217
|
workerFailSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
187
218
|
workerId: string;
|
|
188
|
-
snapshotId: string;
|
|
189
219
|
error: string;
|
|
220
|
+
snapshotId: string;
|
|
190
221
|
}, Promise<any>>;
|
|
191
222
|
workerLatestSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
192
|
-
conversationId: string;
|
|
193
223
|
agentKey: string;
|
|
224
|
+
conversationId: string;
|
|
194
225
|
workspaceId: string;
|
|
195
226
|
}, Promise<any>>;
|
|
196
227
|
workerGenerateMediaUploadUrl: import("convex/server").RegisteredMutation<"public", {}, Promise<any>>;
|
|
@@ -202,20 +233,20 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
202
233
|
messageId: string;
|
|
203
234
|
}, Promise<any>>;
|
|
204
235
|
globalSkillsDeploy: import("convex/server").RegisteredMutation<"public", {
|
|
205
|
-
|
|
206
|
-
displayName?: string | undefined;
|
|
236
|
+
actor?: string | undefined;
|
|
207
237
|
description?: string | undefined;
|
|
238
|
+
displayName?: string | undefined;
|
|
208
239
|
entryPoint?: string | undefined;
|
|
209
240
|
moduleFormat?: "esm" | "cjs" | undefined;
|
|
210
|
-
|
|
211
|
-
slug: string;
|
|
241
|
+
releaseChannel?: "stable" | "canary" | undefined;
|
|
212
242
|
version: string;
|
|
243
|
+
slug: string;
|
|
213
244
|
sourceJs: string;
|
|
214
245
|
}, Promise<any>>;
|
|
215
246
|
globalSkillsList: import("convex/server").RegisteredQuery<"public", {
|
|
247
|
+
limit?: number | undefined;
|
|
216
248
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
217
249
|
status?: "active" | "disabled" | undefined;
|
|
218
|
-
limit?: number | undefined;
|
|
219
250
|
}, Promise<any>>;
|
|
220
251
|
globalSkillsSetStatus: import("convex/server").RegisteredMutation<"public", {
|
|
221
252
|
actor?: string | undefined;
|
|
@@ -291,14 +322,15 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
291
322
|
bindUserAgent: import("convex/server").RegisteredMutation<"public", {
|
|
292
323
|
metadata?: Record<string, string> | undefined;
|
|
293
324
|
source?: "manual" | "telegram_pairing" | "api" | undefined;
|
|
294
|
-
telegramUserId?: string | undefined;
|
|
295
325
|
telegramChatId?: string | undefined;
|
|
326
|
+
telegramUserId?: string | undefined;
|
|
296
327
|
agentKey: string;
|
|
297
328
|
consumerUserId: string;
|
|
298
329
|
}, Promise<{
|
|
299
330
|
agentKey: string;
|
|
300
331
|
boundAt: number;
|
|
301
332
|
consumerUserId: string;
|
|
333
|
+
conversationId: string;
|
|
302
334
|
metadata: null | Record<string, string>;
|
|
303
335
|
revokedAt: null | number;
|
|
304
336
|
source: "manual" | "telegram_pairing" | "api";
|
|
@@ -323,6 +355,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
323
355
|
agentKey: string;
|
|
324
356
|
boundAt: number;
|
|
325
357
|
consumerUserId: string;
|
|
358
|
+
conversationId: string;
|
|
326
359
|
metadata: null | Record<string, string>;
|
|
327
360
|
revokedAt: null | number;
|
|
328
361
|
source: "manual" | "telegram_pairing" | "api";
|
|
@@ -345,11 +378,12 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
345
378
|
consumerUserId: string;
|
|
346
379
|
}, Promise<any>>;
|
|
347
380
|
resolveAgentForTelegram: import("convex/server").RegisteredQuery<"public", {
|
|
348
|
-
telegramUserId?: string | undefined;
|
|
349
381
|
telegramChatId?: string | undefined;
|
|
382
|
+
telegramUserId?: string | undefined;
|
|
350
383
|
}, Promise<{
|
|
351
384
|
agentKey: null | string;
|
|
352
385
|
consumerUserId: null | string;
|
|
386
|
+
conversationId: null | string;
|
|
353
387
|
}>>;
|
|
354
388
|
createPairingCode: import("convex/server").RegisteredMutation<"public", {
|
|
355
389
|
ttlMs?: number | undefined;
|
|
@@ -372,8 +406,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
372
406
|
consumerUserId: string;
|
|
373
407
|
}, Promise<any>>;
|
|
374
408
|
consumePairingCode: import("convex/server").RegisteredMutation<"public", {
|
|
375
|
-
telegramUserId: string;
|
|
376
409
|
telegramChatId: string;
|
|
410
|
+
telegramUserId: string;
|
|
377
411
|
code: string;
|
|
378
412
|
}, Promise<{
|
|
379
413
|
agentKey: string;
|
|
@@ -406,8 +440,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
406
440
|
importTelegramTokenForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
407
441
|
metadata?: Record<string, string> | undefined;
|
|
408
442
|
agentKey: string;
|
|
409
|
-
plaintextValue: string;
|
|
410
443
|
consumerUserId: string;
|
|
444
|
+
plaintextValue: string;
|
|
411
445
|
}, Promise<any>>;
|
|
412
446
|
getUserAgentOnboardingState: import("convex/server").RegisteredQuery<"public", {
|
|
413
447
|
agentKey: string;
|
|
@@ -443,11 +477,11 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
443
477
|
}, Promise<any>>;
|
|
444
478
|
createPushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
445
479
|
enabled?: boolean | undefined;
|
|
446
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
447
480
|
companyId: string;
|
|
448
|
-
|
|
449
|
-
title: string;
|
|
481
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
450
482
|
text: string;
|
|
483
|
+
title: string;
|
|
484
|
+
actorUserId: string;
|
|
451
485
|
suggestedTimes: ({
|
|
452
486
|
kind: "daily";
|
|
453
487
|
time: string;
|
|
@@ -460,12 +494,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
460
494
|
time: string;
|
|
461
495
|
dayOfMonth: number | "last";
|
|
462
496
|
})[];
|
|
463
|
-
|
|
497
|
+
templateKey: string;
|
|
464
498
|
}, Promise<any>>;
|
|
465
499
|
updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
500
|
+
enabled?: boolean | undefined;
|
|
466
501
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
467
|
-
title?: string | undefined;
|
|
468
502
|
text?: string | undefined;
|
|
503
|
+
title?: string | undefined;
|
|
469
504
|
suggestedTimes?: ({
|
|
470
505
|
kind: "daily";
|
|
471
506
|
time: string;
|
|
@@ -478,9 +513,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
478
513
|
time: string;
|
|
479
514
|
dayOfMonth: number | "last";
|
|
480
515
|
})[] | undefined;
|
|
481
|
-
enabled?: boolean | undefined;
|
|
482
|
-
actorUserId: string;
|
|
483
516
|
templateId: string;
|
|
517
|
+
actorUserId: string;
|
|
484
518
|
}, Promise<any>>;
|
|
485
519
|
deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
486
520
|
templateId: string;
|
|
@@ -507,17 +541,14 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
507
541
|
} | undefined;
|
|
508
542
|
consumerUserId: string;
|
|
509
543
|
companyId: string;
|
|
510
|
-
templateId: string;
|
|
511
544
|
timezone: string;
|
|
545
|
+
templateId: string;
|
|
512
546
|
}, Promise<any>>;
|
|
513
547
|
createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
|
|
514
548
|
enabled?: boolean | undefined;
|
|
515
549
|
consumerUserId: string;
|
|
516
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
517
550
|
companyId: string;
|
|
518
|
-
|
|
519
|
-
text: string;
|
|
520
|
-
timezone: string;
|
|
551
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
521
552
|
schedule: {
|
|
522
553
|
kind: "manual";
|
|
523
554
|
} | {
|
|
@@ -532,13 +563,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
532
563
|
time: string;
|
|
533
564
|
dayOfMonth: number | "last";
|
|
534
565
|
};
|
|
566
|
+
text: string;
|
|
567
|
+
timezone: string;
|
|
568
|
+
title: string;
|
|
535
569
|
}, Promise<any>>;
|
|
536
570
|
updatePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
537
|
-
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
538
|
-
title?: string | undefined;
|
|
539
|
-
text?: string | undefined;
|
|
540
571
|
enabled?: boolean | undefined;
|
|
541
|
-
|
|
572
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
542
573
|
schedule?: {
|
|
543
574
|
kind: "manual";
|
|
544
575
|
} | {
|
|
@@ -553,6 +584,9 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
553
584
|
time: string;
|
|
554
585
|
dayOfMonth: number | "last";
|
|
555
586
|
} | undefined;
|
|
587
|
+
text?: string | undefined;
|
|
588
|
+
timezone?: string | undefined;
|
|
589
|
+
title?: string | undefined;
|
|
556
590
|
jobId: string;
|
|
557
591
|
}, Promise<any>>;
|
|
558
592
|
deletePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
@@ -572,7 +606,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
572
606
|
}, Promise<any>>;
|
|
573
607
|
listQueueItemsForUserAgent: import("convex/server").RegisteredQuery<"public", {
|
|
574
608
|
limit?: number | undefined;
|
|
575
|
-
statuses?: ("
|
|
609
|
+
statuses?: ("failed" | "done" | "queued" | "processing" | "dead_letter")[] | undefined;
|
|
576
610
|
agentKey: string;
|
|
577
611
|
consumerUserId: string;
|
|
578
612
|
}, Promise<any>>;
|
|
@@ -584,8 +618,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
584
618
|
sendMessageToUserAgent: import("convex/server").RegisteredMutation<"public", {
|
|
585
619
|
metadata?: Record<string, string> | undefined;
|
|
586
620
|
agentKey: string;
|
|
587
|
-
content: string;
|
|
588
621
|
consumerUserId: string;
|
|
622
|
+
content: string;
|
|
589
623
|
}, Promise<any>>;
|
|
590
624
|
listSnapshotsForConversation: import("convex/server").RegisteredQuery<"public", {
|
|
591
625
|
limit?: number | undefined;
|
|
@@ -627,18 +661,15 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
627
661
|
agentKey: string;
|
|
628
662
|
consumerUserId: string;
|
|
629
663
|
companyId: string;
|
|
630
|
-
templateId: string;
|
|
631
664
|
timezone: string;
|
|
665
|
+
templateId: string;
|
|
632
666
|
}, Promise<any>>;
|
|
633
667
|
createPushJobCustomForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
634
668
|
enabled?: boolean | undefined;
|
|
635
669
|
agentKey: string;
|
|
636
670
|
consumerUserId: string;
|
|
637
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
638
671
|
companyId: string;
|
|
639
|
-
|
|
640
|
-
text: string;
|
|
641
|
-
timezone: string;
|
|
672
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
642
673
|
schedule: {
|
|
643
674
|
kind: "manual";
|
|
644
675
|
} | {
|
|
@@ -653,13 +684,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
653
684
|
time: string;
|
|
654
685
|
dayOfMonth: number | "last";
|
|
655
686
|
};
|
|
687
|
+
text: string;
|
|
688
|
+
timezone: string;
|
|
689
|
+
title: string;
|
|
656
690
|
}, Promise<any>>;
|
|
657
691
|
updatePushJobForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
658
|
-
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
659
|
-
title?: string | undefined;
|
|
660
|
-
text?: string | undefined;
|
|
661
692
|
enabled?: boolean | undefined;
|
|
662
|
-
|
|
693
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
663
694
|
schedule?: {
|
|
664
695
|
kind: "manual";
|
|
665
696
|
} | {
|
|
@@ -674,6 +705,9 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
674
705
|
time: string;
|
|
675
706
|
dayOfMonth: number | "last";
|
|
676
707
|
} | undefined;
|
|
708
|
+
text?: string | undefined;
|
|
709
|
+
timezone?: string | undefined;
|
|
710
|
+
title?: string | undefined;
|
|
677
711
|
agentKey: string;
|
|
678
712
|
consumerUserId: string;
|
|
679
713
|
jobId: string;
|
|
@@ -706,8 +740,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
706
740
|
}, Promise<any>>;
|
|
707
741
|
sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
|
|
708
742
|
companyId: string;
|
|
709
|
-
title: string;
|
|
710
743
|
text: string;
|
|
744
|
+
title: string;
|
|
711
745
|
requestedBy: string;
|
|
712
746
|
}, Promise<any>>;
|
|
713
747
|
listPushDispatchesByJob: import("convex/server").RegisteredQuery<"public", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAqEhC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,MAAM,aAAa,CAAC;AAErB,wBAAgB,SAAS,CACvB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE;IACP,IAAI,EAAE,CACJ,GAAG,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,EACnB,SAAS,EACL;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAChB;QACE,IAAI,EAAE,OAAO,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,KACF,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAyzCi8nB,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAAiC,CAAC;;;;;6BAAyK,CAAC;;oBAA+D,CAAC;;;yBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAk1N,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAAiC,CAAC;;;;;6BAAyK,CAAC;;oBAA+D,CAAC;;;yBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA5Tj33B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,YAAY,EACvB,EACE,UAA6B,EAC7B,eAAe,EACf,0BAAiC,EACjC,gBAA4B,EAC5B,yBAAiC,EACjC,cAAc,GACf,GAAE;IACD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IAC9C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,QAkLP"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { actionGeneric, httpActionGeneric, mutationGeneric, queryGeneric, } from "convex/server";
|
|
2
2
|
import { v } from "convex/values";
|
|
3
3
|
import { providerConfigValidator, scalingPolicyValidator, } from "../component/config.js";
|
|
4
|
+
const telegramAttachmentKindValidator = v.union(v.literal("photo"), v.literal("video"), v.literal("audio"), v.literal("voice"), v.literal("document"));
|
|
5
|
+
const telegramAttachmentValidator = v.object({
|
|
6
|
+
kind: telegramAttachmentKindValidator,
|
|
7
|
+
status: v.union(v.literal("ready"), v.literal("expired")),
|
|
8
|
+
storageId: v.string(),
|
|
9
|
+
telegramFileId: v.string(),
|
|
10
|
+
fileName: v.optional(v.string()),
|
|
11
|
+
mimeType: v.optional(v.string()),
|
|
12
|
+
sizeBytes: v.optional(v.number()),
|
|
13
|
+
expiresAt: v.number(),
|
|
14
|
+
});
|
|
4
15
|
const pushPeriodicityValidator = v.union(v.literal("manual"), v.literal("daily"), v.literal("weekly"), v.literal("monthly"));
|
|
5
16
|
const pushSuggestedTimeValidator = v.union(v.object({
|
|
6
17
|
kind: v.literal("daily"),
|
|
@@ -30,6 +41,7 @@ const pushScheduleValidator = v.union(v.object({
|
|
|
30
41
|
}));
|
|
31
42
|
const messageRuntimeConfigValidator = v.object({
|
|
32
43
|
systemPrompt: v.optional(v.string()),
|
|
44
|
+
telegramAttachmentRetentionMs: v.optional(v.number()),
|
|
33
45
|
});
|
|
34
46
|
export { bridgeFunctionKeyFromToolName, executeBridgeFunction, isBridgeToolName, maybeExecuteBridgeToolCall, resolveBridgeRuntimeConfig, } from "./bridge.js";
|
|
35
47
|
export function exposeApi(component, options) {
|
|
@@ -85,6 +97,7 @@ export function exposeApi(component, options) {
|
|
|
85
97
|
externalMessageId: v.optional(v.string()),
|
|
86
98
|
rawUpdateJson: v.optional(v.string()),
|
|
87
99
|
metadata: v.optional(v.record(v.string(), v.string())),
|
|
100
|
+
attachments: v.optional(v.array(telegramAttachmentValidator)),
|
|
88
101
|
priority: v.optional(v.number()),
|
|
89
102
|
providerConfig: v.optional(providerConfigValidator),
|
|
90
103
|
},
|
|
@@ -104,6 +117,7 @@ export function exposeApi(component, options) {
|
|
|
104
117
|
externalMessageId: args.externalMessageId,
|
|
105
118
|
rawUpdateJson: args.rawUpdateJson,
|
|
106
119
|
metadata: args.metadata,
|
|
120
|
+
attachments: args.attachments,
|
|
107
121
|
},
|
|
108
122
|
priority: args.priority,
|
|
109
123
|
providerConfig: args.providerConfig ?? options.providerConfig,
|
|
@@ -1057,9 +1071,7 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
|
|
|
1057
1071
|
const telegramChatId = String(message.chat.id);
|
|
1058
1072
|
const text = typeof message.text === "string" ? message.text.trim() : "";
|
|
1059
1073
|
const caption = typeof message.caption === "string" ? message.caption.trim() : "";
|
|
1060
|
-
const
|
|
1061
|
-
const hasVideo = !!message.video;
|
|
1062
|
-
const hasAudio = !!message.audio || !!message.voice;
|
|
1074
|
+
const attachmentCandidates = collectTelegramAttachmentCandidates(message);
|
|
1063
1075
|
const startCommandCode = text ? parseStartCommandCode(text) : null;
|
|
1064
1076
|
const isStartCommand = text.trimStart().startsWith("/start");
|
|
1065
1077
|
if (startCommandCode) {
|
|
@@ -1125,23 +1137,7 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
|
|
|
1125
1137
|
headers: { "Content-Type": "application/json" },
|
|
1126
1138
|
});
|
|
1127
1139
|
}
|
|
1128
|
-
const messageText = text
|
|
1129
|
-
caption ||
|
|
1130
|
-
(hasPhoto && hasVideo && hasAudio
|
|
1131
|
-
? "[telegram media] photo + video + audio message"
|
|
1132
|
-
: hasPhoto && hasVideo
|
|
1133
|
-
? "[telegram media] photo + video message"
|
|
1134
|
-
: hasPhoto && hasAudio
|
|
1135
|
-
? "[telegram media] photo + audio message"
|
|
1136
|
-
: hasVideo && hasAudio
|
|
1137
|
-
? "[telegram media] video + audio message"
|
|
1138
|
-
: hasPhoto
|
|
1139
|
-
? "[telegram media] photo message"
|
|
1140
|
-
: hasVideo
|
|
1141
|
-
? "[telegram media] video message"
|
|
1142
|
-
: hasAudio
|
|
1143
|
-
? "[telegram media] audio message"
|
|
1144
|
-
: "");
|
|
1140
|
+
const messageText = buildTelegramMessageText(text, caption, attachmentCandidates);
|
|
1145
1141
|
if (!messageText) {
|
|
1146
1142
|
return new Response(JSON.stringify({ ok: true, ignored: true }), {
|
|
1147
1143
|
status: 200,
|
|
@@ -1152,25 +1148,19 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
|
|
|
1152
1148
|
telegramChatId,
|
|
1153
1149
|
telegramUserId,
|
|
1154
1150
|
};
|
|
1155
|
-
if (
|
|
1156
|
-
metadata.telegramMediaType = "
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
metadata
|
|
1151
|
+
if (attachmentCandidates.length > 0) {
|
|
1152
|
+
metadata.telegramMediaType = Array.from(new Set(attachmentCandidates.map((attachment) => attachment.kind))).join("+");
|
|
1153
|
+
for (const attachment of attachmentCandidates) {
|
|
1154
|
+
const metadataKey = `telegram${attachment.kind[0].toUpperCase()}${attachment.kind.slice(1)}FileId`;
|
|
1155
|
+
metadata[metadataKey] = attachment.telegramFileId;
|
|
1160
1156
|
}
|
|
1161
1157
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
metadata.telegramVoiceFileId = message.voice.file_id;
|
|
1169
|
-
}
|
|
1170
|
-
if (message.video?.file_id) {
|
|
1171
|
-
metadata.telegramMediaType = hasPhoto ? "photo+video" : "video";
|
|
1172
|
-
metadata.telegramVideoFileId = message.video.file_id;
|
|
1173
|
-
}
|
|
1158
|
+
const attachments = attachmentCandidates.length > 0
|
|
1159
|
+
? await ctx.runAction(component.queue.prepareTelegramAttachmentsForEnqueue, {
|
|
1160
|
+
agentKey,
|
|
1161
|
+
attachments: attachmentCandidates,
|
|
1162
|
+
})
|
|
1163
|
+
: undefined;
|
|
1174
1164
|
await ctx.runMutation(component.lib.enqueue, {
|
|
1175
1165
|
conversationId: mapped.conversationId ?? `telegram:${telegramChatId}`,
|
|
1176
1166
|
agentKey,
|
|
@@ -1181,6 +1171,7 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
|
|
|
1181
1171
|
externalMessageId: String(message.message_id ?? update.update_id ?? ""),
|
|
1182
1172
|
rawUpdateJson: JSON.stringify(update),
|
|
1183
1173
|
metadata,
|
|
1174
|
+
attachments,
|
|
1184
1175
|
},
|
|
1185
1176
|
providerConfig,
|
|
1186
1177
|
});
|
|
@@ -1195,4 +1186,66 @@ function parseStartCommandCode(messageText) {
|
|
|
1195
1186
|
const match = messageText.match(/^\/start(?:@\w+)?\s+([A-Za-z0-9_-]{4,128})\s*$/);
|
|
1196
1187
|
return match ? match[1] : null;
|
|
1197
1188
|
}
|
|
1189
|
+
function collectTelegramAttachmentCandidates(message) {
|
|
1190
|
+
const attachments = [];
|
|
1191
|
+
const largestPhoto = Array.isArray(message.photo) ? message.photo[message.photo.length - 1] : null;
|
|
1192
|
+
if (largestPhoto?.file_id) {
|
|
1193
|
+
attachments.push({
|
|
1194
|
+
kind: "photo",
|
|
1195
|
+
telegramFileId: largestPhoto.file_id,
|
|
1196
|
+
sizeBytes: largestPhoto.file_size,
|
|
1197
|
+
mimeType: "image/jpeg",
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
if (message.video?.file_id) {
|
|
1201
|
+
attachments.push({
|
|
1202
|
+
kind: "video",
|
|
1203
|
+
telegramFileId: message.video.file_id,
|
|
1204
|
+
fileName: message.video.file_name,
|
|
1205
|
+
mimeType: message.video.mime_type,
|
|
1206
|
+
sizeBytes: message.video.file_size,
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
if (message.audio?.file_id) {
|
|
1210
|
+
attachments.push({
|
|
1211
|
+
kind: "audio",
|
|
1212
|
+
telegramFileId: message.audio.file_id,
|
|
1213
|
+
fileName: message.audio.file_name,
|
|
1214
|
+
mimeType: message.audio.mime_type,
|
|
1215
|
+
sizeBytes: message.audio.file_size,
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
if (message.voice?.file_id) {
|
|
1219
|
+
attachments.push({
|
|
1220
|
+
kind: "voice",
|
|
1221
|
+
telegramFileId: message.voice.file_id,
|
|
1222
|
+
mimeType: message.voice.mime_type,
|
|
1223
|
+
sizeBytes: message.voice.file_size,
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
if (message.document?.file_id) {
|
|
1227
|
+
attachments.push({
|
|
1228
|
+
kind: "document",
|
|
1229
|
+
telegramFileId: message.document.file_id,
|
|
1230
|
+
fileName: message.document.file_name,
|
|
1231
|
+
mimeType: message.document.mime_type,
|
|
1232
|
+
sizeBytes: message.document.file_size,
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return attachments;
|
|
1236
|
+
}
|
|
1237
|
+
function buildTelegramMessageText(text, caption, attachments) {
|
|
1238
|
+
if (text) {
|
|
1239
|
+
return text;
|
|
1240
|
+
}
|
|
1241
|
+
if (caption) {
|
|
1242
|
+
return caption;
|
|
1243
|
+
}
|
|
1244
|
+
if (attachments.length === 0) {
|
|
1245
|
+
return "";
|
|
1246
|
+
}
|
|
1247
|
+
const kinds = Array.from(new Set(attachments.map((attachment) => attachment.kind)));
|
|
1248
|
+
const label = kinds.join(" + ");
|
|
1249
|
+
return `[telegram media] ${label} message`;
|
|
1250
|
+
}
|
|
1198
1251
|
//# sourceMappingURL=index.js.map
|