@okrlinkhub/agent-factory 2.0.1 → 2.0.3
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 +66 -64
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -90
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +32 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/identity.d.ts +6 -6
- package/dist/component/pushing.d.ts +40 -40
- package/dist/component/queue.d.ts +125 -97
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +153 -3
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +23 -23
- package/dist/component/schema.d.ts +21 -16
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +1 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +6 -137
- package/src/component/_generated/component.ts +38 -0
- package/src/component/lib.test.ts +1 -0
- package/src/component/queue.ts +260 -3
- package/src/component/schema.ts +1 -0
package/dist/client/index.d.ts
CHANGED
|
@@ -22,11 +22,11 @@ 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
|
+
region: string;
|
|
27
28
|
organizationSlug: string;
|
|
28
29
|
image: string;
|
|
29
|
-
region: string;
|
|
30
30
|
volumeName: string;
|
|
31
31
|
volumePath: string;
|
|
32
32
|
volumeSizeGb: number;
|
|
@@ -40,32 +40,32 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
40
40
|
};
|
|
41
41
|
}, Promise<null>>;
|
|
42
42
|
enqueue: import("convex/server").RegisteredMutation<"public", {
|
|
43
|
+
metadata?: Record<string, string> | undefined;
|
|
43
44
|
providerConfig?: {
|
|
44
|
-
kind: "fly" | "runpod" | "ecs";
|
|
45
45
|
appName: string;
|
|
46
|
+
kind: "fly" | "runpod" | "ecs";
|
|
47
|
+
region: string;
|
|
46
48
|
organizationSlug: string;
|
|
47
49
|
image: string;
|
|
48
|
-
region: string;
|
|
49
50
|
volumeName: string;
|
|
50
51
|
volumePath: string;
|
|
51
52
|
volumeSizeGb: number;
|
|
52
53
|
} | undefined;
|
|
53
|
-
|
|
54
|
-
rawUpdateJson?: string | undefined;
|
|
55
|
-
metadata?: Record<string, string> | undefined;
|
|
54
|
+
priority?: number | undefined;
|
|
56
55
|
attachments?: {
|
|
56
|
+
sizeBytes?: number | undefined;
|
|
57
57
|
fileName?: string | undefined;
|
|
58
58
|
mimeType?: string | undefined;
|
|
59
|
-
sizeBytes?: number | undefined;
|
|
60
|
-
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
61
|
-
status: "ready" | "expired";
|
|
62
59
|
storageId: string;
|
|
60
|
+
status: "expired" | "ready";
|
|
61
|
+
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
63
62
|
telegramFileId: string;
|
|
64
63
|
expiresAt: number;
|
|
65
64
|
}[] | undefined;
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
externalMessageId?: string | undefined;
|
|
66
|
+
rawUpdateJson?: string | undefined;
|
|
68
67
|
agentKey: string;
|
|
68
|
+
conversationId: string;
|
|
69
69
|
provider: string;
|
|
70
70
|
providerUserId: string;
|
|
71
71
|
messageText: string;
|
|
@@ -93,6 +93,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
93
93
|
messageId: string;
|
|
94
94
|
payload: {
|
|
95
95
|
attachments?: Array<{
|
|
96
|
+
downloadUrl?: string;
|
|
96
97
|
expiresAt: number;
|
|
97
98
|
fileName?: string;
|
|
98
99
|
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
@@ -111,18 +112,18 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
111
112
|
};
|
|
112
113
|
} | null>>;
|
|
113
114
|
workerHeartbeat: import("convex/server").RegisteredMutation<"public", {
|
|
114
|
-
workerId: string;
|
|
115
115
|
messageId: string;
|
|
116
|
+
workerId: string;
|
|
116
117
|
leaseId: string;
|
|
117
118
|
}, Promise<boolean>>;
|
|
118
119
|
workerComplete: import("convex/server").RegisteredMutation<"public", {
|
|
119
|
-
workerId: string;
|
|
120
120
|
messageId: string;
|
|
121
|
+
workerId: string;
|
|
121
122
|
leaseId: string;
|
|
122
123
|
}, Promise<boolean>>;
|
|
123
124
|
workerFail: import("convex/server").RegisteredMutation<"public", {
|
|
124
|
-
workerId: string;
|
|
125
125
|
messageId: string;
|
|
126
|
+
workerId: string;
|
|
126
127
|
leaseId: string;
|
|
127
128
|
errorMessage: string;
|
|
128
129
|
}, Promise<{
|
|
@@ -131,8 +132,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
131
132
|
requeued: boolean;
|
|
132
133
|
}>>;
|
|
133
134
|
workerHydrationBundle: import("convex/server").RegisteredQuery<"public", {
|
|
134
|
-
messageId: string;
|
|
135
135
|
workspaceId: string;
|
|
136
|
+
messageId: string;
|
|
136
137
|
}, Promise<{
|
|
137
138
|
agentKey: string;
|
|
138
139
|
bridgeRuntimeConfig: null | {
|
|
@@ -159,6 +160,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
159
160
|
messageId: string;
|
|
160
161
|
payload: {
|
|
161
162
|
attachments?: Array<{
|
|
163
|
+
downloadUrl?: string;
|
|
162
164
|
expiresAt: number;
|
|
163
165
|
fileName?: string;
|
|
164
166
|
kind: "photo" | "video" | "audio" | "voice" | "document";
|
|
@@ -178,8 +180,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
178
180
|
telegramBotToken: null | string;
|
|
179
181
|
} | null>>;
|
|
180
182
|
workerGlobalSkillsManifest: import("convex/server").RegisteredQuery<"public", {
|
|
181
|
-
workerId?: string | undefined;
|
|
182
183
|
workspaceId?: string | undefined;
|
|
184
|
+
workerId?: string | undefined;
|
|
183
185
|
releaseChannel?: "stable" | "canary" | undefined;
|
|
184
186
|
}, Promise<any>>;
|
|
185
187
|
workerConversationHasQueued: import("convex/server").RegisteredQuery<"public", {
|
|
@@ -190,8 +192,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
190
192
|
conversationId: string;
|
|
191
193
|
messages: {
|
|
192
194
|
at?: number | undefined;
|
|
193
|
-
role: "system" | "user" | "assistant" | "tool";
|
|
194
195
|
content: string;
|
|
196
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
195
197
|
}[];
|
|
196
198
|
}, Promise<{
|
|
197
199
|
messageCount: number;
|
|
@@ -201,27 +203,27 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
201
203
|
workerId: string;
|
|
202
204
|
}, Promise<any>>;
|
|
203
205
|
workerPrepareSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
204
|
-
conversationId: string;
|
|
205
206
|
agentKey: string;
|
|
206
|
-
|
|
207
|
+
conversationId: string;
|
|
207
208
|
workspaceId: string;
|
|
208
|
-
|
|
209
|
+
workerId: string;
|
|
210
|
+
reason: "manual" | "drain" | "signal";
|
|
209
211
|
}, Promise<any>>;
|
|
210
212
|
workerFinalizeSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
211
|
-
storageId: string;
|
|
212
|
-
sizeBytes: number;
|
|
213
213
|
workerId: string;
|
|
214
|
+
storageId: string;
|
|
214
215
|
snapshotId: string;
|
|
215
216
|
sha256: string;
|
|
217
|
+
sizeBytes: number;
|
|
216
218
|
}, Promise<any>>;
|
|
217
219
|
workerFailSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
218
220
|
workerId: string;
|
|
219
|
-
snapshotId: string;
|
|
220
221
|
error: string;
|
|
222
|
+
snapshotId: string;
|
|
221
223
|
}, Promise<any>>;
|
|
222
224
|
workerLatestSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
223
|
-
conversationId: string;
|
|
224
225
|
agentKey: string;
|
|
226
|
+
conversationId: string;
|
|
225
227
|
workspaceId: string;
|
|
226
228
|
}, Promise<any>>;
|
|
227
229
|
workerGenerateMediaUploadUrl: import("convex/server").RegisteredMutation<"public", {}, Promise<any>>;
|
|
@@ -233,25 +235,25 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
233
235
|
messageId: string;
|
|
234
236
|
}, Promise<any>>;
|
|
235
237
|
globalSkillsDeploy: import("convex/server").RegisteredMutation<"public", {
|
|
236
|
-
|
|
237
|
-
displayName?: string | undefined;
|
|
238
|
+
actor?: string | undefined;
|
|
238
239
|
description?: string | undefined;
|
|
240
|
+
displayName?: string | undefined;
|
|
239
241
|
entryPoint?: string | undefined;
|
|
240
242
|
moduleFormat?: "esm" | "cjs" | undefined;
|
|
241
|
-
|
|
242
|
-
slug: string;
|
|
243
|
+
releaseChannel?: "stable" | "canary" | undefined;
|
|
243
244
|
version: string;
|
|
245
|
+
slug: string;
|
|
244
246
|
sourceJs: string;
|
|
245
247
|
}, Promise<any>>;
|
|
246
248
|
globalSkillsList: import("convex/server").RegisteredQuery<"public", {
|
|
247
|
-
status?: "active" | "disabled" | undefined;
|
|
248
|
-
releaseChannel?: "stable" | "canary" | undefined;
|
|
249
249
|
limit?: number | undefined;
|
|
250
|
+
releaseChannel?: "stable" | "canary" | undefined;
|
|
251
|
+
status?: "active" | "disabled" | undefined;
|
|
250
252
|
}, Promise<any>>;
|
|
251
253
|
globalSkillsSetStatus: import("convex/server").RegisteredMutation<"public", {
|
|
252
254
|
actor?: string | undefined;
|
|
253
|
-
status: "active" | "disabled";
|
|
254
255
|
slug: string;
|
|
256
|
+
status: "active" | "disabled";
|
|
255
257
|
}, Promise<any>>;
|
|
256
258
|
globalSkillsDelete: import("convex/server").RegisteredMutation<"public", {
|
|
257
259
|
slug: string;
|
|
@@ -322,8 +324,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
322
324
|
bindUserAgent: import("convex/server").RegisteredMutation<"public", {
|
|
323
325
|
metadata?: Record<string, string> | undefined;
|
|
324
326
|
source?: "manual" | "telegram_pairing" | "api" | undefined;
|
|
325
|
-
telegramUserId?: string | undefined;
|
|
326
327
|
telegramChatId?: string | undefined;
|
|
328
|
+
telegramUserId?: string | undefined;
|
|
327
329
|
agentKey: string;
|
|
328
330
|
consumerUserId: string;
|
|
329
331
|
}, Promise<{
|
|
@@ -378,8 +380,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
378
380
|
consumerUserId: string;
|
|
379
381
|
}, Promise<any>>;
|
|
380
382
|
resolveAgentForTelegram: import("convex/server").RegisteredQuery<"public", {
|
|
381
|
-
telegramUserId?: string | undefined;
|
|
382
383
|
telegramChatId?: string | undefined;
|
|
384
|
+
telegramUserId?: string | undefined;
|
|
383
385
|
}, Promise<{
|
|
384
386
|
agentKey: null | string;
|
|
385
387
|
consumerUserId: null | string;
|
|
@@ -406,8 +408,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
406
408
|
consumerUserId: string;
|
|
407
409
|
}, Promise<any>>;
|
|
408
410
|
consumePairingCode: import("convex/server").RegisteredMutation<"public", {
|
|
409
|
-
telegramUserId: string;
|
|
410
411
|
telegramChatId: string;
|
|
412
|
+
telegramUserId: string;
|
|
411
413
|
code: string;
|
|
412
414
|
}, Promise<{
|
|
413
415
|
agentKey: string;
|
|
@@ -440,8 +442,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
440
442
|
importTelegramTokenForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
441
443
|
metadata?: Record<string, string> | undefined;
|
|
442
444
|
agentKey: string;
|
|
443
|
-
plaintextValue: string;
|
|
444
445
|
consumerUserId: string;
|
|
446
|
+
plaintextValue: string;
|
|
445
447
|
}, Promise<any>>;
|
|
446
448
|
getUserAgentOnboardingState: import("convex/server").RegisteredQuery<"public", {
|
|
447
449
|
agentKey: string;
|
|
@@ -477,11 +479,11 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
477
479
|
}, Promise<any>>;
|
|
478
480
|
createPushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
479
481
|
enabled?: boolean | undefined;
|
|
480
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
481
482
|
companyId: string;
|
|
482
|
-
|
|
483
|
-
title: string;
|
|
483
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
484
484
|
text: string;
|
|
485
|
+
title: string;
|
|
486
|
+
actorUserId: string;
|
|
485
487
|
suggestedTimes: ({
|
|
486
488
|
kind: "daily";
|
|
487
489
|
time: string;
|
|
@@ -494,12 +496,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
494
496
|
time: string;
|
|
495
497
|
dayOfMonth: number | "last";
|
|
496
498
|
})[];
|
|
497
|
-
|
|
499
|
+
templateKey: string;
|
|
498
500
|
}, Promise<any>>;
|
|
499
501
|
updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
502
|
+
enabled?: boolean | undefined;
|
|
500
503
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
501
|
-
title?: string | undefined;
|
|
502
504
|
text?: string | undefined;
|
|
505
|
+
title?: string | undefined;
|
|
503
506
|
suggestedTimes?: ({
|
|
504
507
|
kind: "daily";
|
|
505
508
|
time: string;
|
|
@@ -512,9 +515,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
512
515
|
time: string;
|
|
513
516
|
dayOfMonth: number | "last";
|
|
514
517
|
})[] | undefined;
|
|
515
|
-
enabled?: boolean | undefined;
|
|
516
|
-
actorUserId: string;
|
|
517
518
|
templateId: string;
|
|
519
|
+
actorUserId: string;
|
|
518
520
|
}, Promise<any>>;
|
|
519
521
|
deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
520
522
|
templateId: string;
|
|
@@ -541,17 +543,14 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
541
543
|
} | undefined;
|
|
542
544
|
consumerUserId: string;
|
|
543
545
|
companyId: string;
|
|
544
|
-
templateId: string;
|
|
545
546
|
timezone: string;
|
|
547
|
+
templateId: string;
|
|
546
548
|
}, Promise<any>>;
|
|
547
549
|
createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
|
|
548
550
|
enabled?: boolean | undefined;
|
|
549
551
|
consumerUserId: string;
|
|
550
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
551
552
|
companyId: string;
|
|
552
|
-
|
|
553
|
-
text: string;
|
|
554
|
-
timezone: string;
|
|
553
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
555
554
|
schedule: {
|
|
556
555
|
kind: "manual";
|
|
557
556
|
} | {
|
|
@@ -566,13 +565,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
566
565
|
time: string;
|
|
567
566
|
dayOfMonth: number | "last";
|
|
568
567
|
};
|
|
568
|
+
text: string;
|
|
569
|
+
timezone: string;
|
|
570
|
+
title: string;
|
|
569
571
|
}, Promise<any>>;
|
|
570
572
|
updatePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
571
|
-
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
572
|
-
title?: string | undefined;
|
|
573
|
-
text?: string | undefined;
|
|
574
573
|
enabled?: boolean | undefined;
|
|
575
|
-
|
|
574
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
576
575
|
schedule?: {
|
|
577
576
|
kind: "manual";
|
|
578
577
|
} | {
|
|
@@ -587,6 +586,9 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
587
586
|
time: string;
|
|
588
587
|
dayOfMonth: number | "last";
|
|
589
588
|
} | undefined;
|
|
589
|
+
text?: string | undefined;
|
|
590
|
+
timezone?: string | undefined;
|
|
591
|
+
title?: string | undefined;
|
|
590
592
|
jobId: string;
|
|
591
593
|
}, Promise<any>>;
|
|
592
594
|
deletePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
@@ -606,7 +608,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
606
608
|
}, Promise<any>>;
|
|
607
609
|
listQueueItemsForUserAgent: import("convex/server").RegisteredQuery<"public", {
|
|
608
610
|
limit?: number | undefined;
|
|
609
|
-
statuses?: ("
|
|
611
|
+
statuses?: ("failed" | "done" | "queued" | "processing" | "dead_letter")[] | undefined;
|
|
610
612
|
agentKey: string;
|
|
611
613
|
consumerUserId: string;
|
|
612
614
|
}, Promise<any>>;
|
|
@@ -618,8 +620,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
618
620
|
sendMessageToUserAgent: import("convex/server").RegisteredMutation<"public", {
|
|
619
621
|
metadata?: Record<string, string> | undefined;
|
|
620
622
|
agentKey: string;
|
|
621
|
-
content: string;
|
|
622
623
|
consumerUserId: string;
|
|
624
|
+
content: string;
|
|
623
625
|
}, Promise<any>>;
|
|
624
626
|
listSnapshotsForConversation: import("convex/server").RegisteredQuery<"public", {
|
|
625
627
|
limit?: number | undefined;
|
|
@@ -661,18 +663,15 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
661
663
|
agentKey: string;
|
|
662
664
|
consumerUserId: string;
|
|
663
665
|
companyId: string;
|
|
664
|
-
templateId: string;
|
|
665
666
|
timezone: string;
|
|
667
|
+
templateId: string;
|
|
666
668
|
}, Promise<any>>;
|
|
667
669
|
createPushJobCustomForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
668
670
|
enabled?: boolean | undefined;
|
|
669
671
|
agentKey: string;
|
|
670
672
|
consumerUserId: string;
|
|
671
|
-
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
672
673
|
companyId: string;
|
|
673
|
-
|
|
674
|
-
text: string;
|
|
675
|
-
timezone: string;
|
|
674
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
676
675
|
schedule: {
|
|
677
676
|
kind: "manual";
|
|
678
677
|
} | {
|
|
@@ -687,13 +686,13 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
687
686
|
time: string;
|
|
688
687
|
dayOfMonth: number | "last";
|
|
689
688
|
};
|
|
689
|
+
text: string;
|
|
690
|
+
timezone: string;
|
|
691
|
+
title: string;
|
|
690
692
|
}, Promise<any>>;
|
|
691
693
|
updatePushJobForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
692
|
-
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
693
|
-
title?: string | undefined;
|
|
694
|
-
text?: string | undefined;
|
|
695
694
|
enabled?: boolean | undefined;
|
|
696
|
-
|
|
695
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
697
696
|
schedule?: {
|
|
698
697
|
kind: "manual";
|
|
699
698
|
} | {
|
|
@@ -708,6 +707,9 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
708
707
|
time: string;
|
|
709
708
|
dayOfMonth: number | "last";
|
|
710
709
|
} | undefined;
|
|
710
|
+
text?: string | undefined;
|
|
711
|
+
timezone?: string | undefined;
|
|
712
|
+
title?: string | undefined;
|
|
711
713
|
agentKey: string;
|
|
712
714
|
consumerUserId: string;
|
|
713
715
|
jobId: string;
|
|
@@ -740,8 +742,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
740
742
|
}, Promise<any>>;
|
|
741
743
|
sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
|
|
742
744
|
companyId: string;
|
|
743
|
-
title: string;
|
|
744
745
|
text: string;
|
|
746
|
+
title: string;
|
|
745
747
|
requestedBy: string;
|
|
746
748
|
}, Promise<any>>;
|
|
747
749
|
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,
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAyzC2poB,CAAC;2BAAmC,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAAiC,CAAC;;;;;6BAAyK,CAAC;;oBAA+D,CAAC;;;yBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAA45N,CAAC;2BAAmC,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAAiC,CAAC;;;;;6BAAyK,CAAC;;oBAA+D,CAAC;;;yBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA5T7t4B;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
|
@@ -1155,19 +1155,11 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
|
|
|
1155
1155
|
metadata[metadataKey] = attachment.telegramFileId;
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}), {
|
|
1164
|
-
status: 503,
|
|
1165
|
-
headers: { "Content-Type": "application/json" },
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
const expiresAt = Date.now() + ingressConfig.attachmentRetentionMs;
|
|
1169
|
-
const attachments = attachmentCandidates.length > 0 && ingressConfig.botToken
|
|
1170
|
-
? await Promise.all(attachmentCandidates.map((attachment) => uploadTelegramAttachmentToConvex(ctx, component, ingressConfig.botToken, attachment, expiresAt)))
|
|
1158
|
+
const attachments = attachmentCandidates.length > 0
|
|
1159
|
+
? await ctx.runAction(component.queue.prepareTelegramAttachmentsForEnqueue, {
|
|
1160
|
+
agentKey,
|
|
1161
|
+
attachments: attachmentCandidates,
|
|
1162
|
+
})
|
|
1171
1163
|
: undefined;
|
|
1172
1164
|
await ctx.runMutation(component.lib.enqueue, {
|
|
1173
1165
|
conversationId: mapped.conversationId ?? `telegram:${telegramChatId}`,
|
|
@@ -1256,81 +1248,4 @@ function buildTelegramMessageText(text, caption, attachments) {
|
|
|
1256
1248
|
const label = kinds.join(" + ");
|
|
1257
1249
|
return `[telegram media] ${label} message`;
|
|
1258
1250
|
}
|
|
1259
|
-
async function uploadTelegramAttachmentToConvex(ctx, component, telegramBotToken, attachment, expiresAt) {
|
|
1260
|
-
const filePath = await fetchTelegramFilePath(telegramBotToken, attachment.telegramFileId);
|
|
1261
|
-
const downloaded = await downloadTelegramFile(telegramBotToken, filePath);
|
|
1262
|
-
const uploadTarget = (await ctx.runMutation(component.queue.generateMediaUploadUrl, {}));
|
|
1263
|
-
const uploadResponse = await fetch(uploadTarget.uploadUrl, {
|
|
1264
|
-
method: "POST",
|
|
1265
|
-
headers: downloaded.mimeType.length > 0
|
|
1266
|
-
? {
|
|
1267
|
-
"Content-Type": downloaded.mimeType,
|
|
1268
|
-
}
|
|
1269
|
-
: undefined,
|
|
1270
|
-
body: downloaded.blob,
|
|
1271
|
-
});
|
|
1272
|
-
const uploadPayload = (await uploadResponse.json().catch(() => ({})));
|
|
1273
|
-
if (!uploadResponse.ok || typeof uploadPayload.storageId !== "string") {
|
|
1274
|
-
throw new Error(`Convex storage upload failed for Telegram ${attachment.kind} attachment`);
|
|
1275
|
-
}
|
|
1276
|
-
return {
|
|
1277
|
-
kind: attachment.kind,
|
|
1278
|
-
status: "ready",
|
|
1279
|
-
storageId: uploadPayload.storageId,
|
|
1280
|
-
telegramFileId: attachment.telegramFileId,
|
|
1281
|
-
fileName: attachment.fileName,
|
|
1282
|
-
mimeType: downloaded.mimeType || attachment.mimeType,
|
|
1283
|
-
sizeBytes: attachment.sizeBytes ?? downloaded.blob.size,
|
|
1284
|
-
expiresAt,
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
async function fetchTelegramFilePath(telegramBotToken, telegramFileId) {
|
|
1288
|
-
const telegramApiBaseUrl = `https://api.telegram.org/bot${encodeURIComponent(telegramBotToken)}`;
|
|
1289
|
-
const response = await fetch(`${telegramApiBaseUrl}/getFile?file_id=${encodeURIComponent(telegramFileId)}`);
|
|
1290
|
-
const payload = (await response.json().catch(() => ({})));
|
|
1291
|
-
if (!response.ok || payload.ok !== true || typeof payload.result?.file_path !== "string") {
|
|
1292
|
-
throw new Error(`Telegram getFile failed: ${typeof payload.description === "string" ? payload.description : "missing file_path"}`);
|
|
1293
|
-
}
|
|
1294
|
-
return payload.result.file_path;
|
|
1295
|
-
}
|
|
1296
|
-
async function downloadTelegramFile(telegramBotToken, filePath) {
|
|
1297
|
-
const response = await fetch(`https://api.telegram.org/file/bot${encodeURIComponent(telegramBotToken)}/${filePath}`);
|
|
1298
|
-
if (!response.ok) {
|
|
1299
|
-
throw new Error(`Telegram file download failed with status ${response.status}`);
|
|
1300
|
-
}
|
|
1301
|
-
const blob = await response.blob();
|
|
1302
|
-
const mimeType = response.headers.get("Content-Type") ??
|
|
1303
|
-
blob.type ??
|
|
1304
|
-
inferMimeTypeFromFilePath(filePath) ??
|
|
1305
|
-
"application/octet-stream";
|
|
1306
|
-
return {
|
|
1307
|
-
blob: mimeType === blob.type ? blob : new Blob([await blob.arrayBuffer()], { type: mimeType }),
|
|
1308
|
-
mimeType,
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
function inferMimeTypeFromFilePath(filePath) {
|
|
1312
|
-
const normalizedPath = filePath.toLowerCase();
|
|
1313
|
-
if (normalizedPath.endsWith(".jpg") || normalizedPath.endsWith(".jpeg")) {
|
|
1314
|
-
return "image/jpeg";
|
|
1315
|
-
}
|
|
1316
|
-
if (normalizedPath.endsWith(".png")) {
|
|
1317
|
-
return "image/png";
|
|
1318
|
-
}
|
|
1319
|
-
if (normalizedPath.endsWith(".webp")) {
|
|
1320
|
-
return "image/webp";
|
|
1321
|
-
}
|
|
1322
|
-
if (normalizedPath.endsWith(".mp4")) {
|
|
1323
|
-
return "video/mp4";
|
|
1324
|
-
}
|
|
1325
|
-
if (normalizedPath.endsWith(".mp3")) {
|
|
1326
|
-
return "audio/mpeg";
|
|
1327
|
-
}
|
|
1328
|
-
if (normalizedPath.endsWith(".ogg")) {
|
|
1329
|
-
return "audio/ogg";
|
|
1330
|
-
}
|
|
1331
|
-
if (normalizedPath.endsWith(".pdf")) {
|
|
1332
|
-
return "application/pdf";
|
|
1333
|
-
}
|
|
1334
|
-
return null;
|
|
1335
|
-
}
|
|
1336
1251
|
//# sourceMappingURL=index.js.map
|