@okrlinkhub/agent-factory 2.0.1 → 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.
@@ -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;
@@ -40,9 +40,10 @@ 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";
46
47
  organizationSlug: string;
47
48
  image: string;
48
49
  region: string;
@@ -50,22 +51,21 @@ export declare function exposeApi(component: ComponentApi, options: {
50
51
  volumePath: string;
51
52
  volumeSizeGb: number;
52
53
  } | undefined;
53
- externalMessageId?: string | undefined;
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
- priority?: number | undefined;
67
- conversationId: string;
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;
@@ -111,18 +111,18 @@ export declare function exposeApi(component: ComponentApi, options: {
111
111
  };
112
112
  } | null>>;
113
113
  workerHeartbeat: import("convex/server").RegisteredMutation<"public", {
114
- workerId: string;
115
114
  messageId: string;
115
+ workerId: string;
116
116
  leaseId: string;
117
117
  }, Promise<boolean>>;
118
118
  workerComplete: import("convex/server").RegisteredMutation<"public", {
119
- workerId: string;
120
119
  messageId: string;
120
+ workerId: string;
121
121
  leaseId: string;
122
122
  }, Promise<boolean>>;
123
123
  workerFail: import("convex/server").RegisteredMutation<"public", {
124
- workerId: string;
125
124
  messageId: string;
125
+ workerId: string;
126
126
  leaseId: string;
127
127
  errorMessage: string;
128
128
  }, Promise<{
@@ -131,8 +131,8 @@ export declare function exposeApi(component: ComponentApi, options: {
131
131
  requeued: boolean;
132
132
  }>>;
133
133
  workerHydrationBundle: import("convex/server").RegisteredQuery<"public", {
134
- messageId: string;
135
134
  workspaceId: string;
135
+ messageId: string;
136
136
  }, Promise<{
137
137
  agentKey: string;
138
138
  bridgeRuntimeConfig: null | {
@@ -178,8 +178,8 @@ export declare function exposeApi(component: ComponentApi, options: {
178
178
  telegramBotToken: null | string;
179
179
  } | null>>;
180
180
  workerGlobalSkillsManifest: import("convex/server").RegisteredQuery<"public", {
181
- workerId?: string | undefined;
182
181
  workspaceId?: string | undefined;
182
+ workerId?: string | undefined;
183
183
  releaseChannel?: "stable" | "canary" | undefined;
184
184
  }, Promise<any>>;
185
185
  workerConversationHasQueued: import("convex/server").RegisteredQuery<"public", {
@@ -190,8 +190,8 @@ export declare function exposeApi(component: ComponentApi, options: {
190
190
  conversationId: string;
191
191
  messages: {
192
192
  at?: number | undefined;
193
- role: "system" | "user" | "assistant" | "tool";
194
193
  content: string;
194
+ role: "system" | "user" | "assistant" | "tool";
195
195
  }[];
196
196
  }, Promise<{
197
197
  messageCount: number;
@@ -201,27 +201,27 @@ export declare function exposeApi(component: ComponentApi, options: {
201
201
  workerId: string;
202
202
  }, Promise<any>>;
203
203
  workerPrepareSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
204
- conversationId: string;
205
204
  agentKey: string;
206
- workerId: string;
205
+ conversationId: string;
207
206
  workspaceId: string;
208
- reason: "drain" | "signal" | "manual";
207
+ workerId: string;
208
+ reason: "manual" | "drain" | "signal";
209
209
  }, Promise<any>>;
210
210
  workerFinalizeSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
211
- storageId: string;
212
- sizeBytes: number;
213
211
  workerId: string;
212
+ storageId: string;
214
213
  snapshotId: string;
215
214
  sha256: string;
215
+ sizeBytes: number;
216
216
  }, Promise<any>>;
217
217
  workerFailSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
218
218
  workerId: string;
219
- snapshotId: string;
220
219
  error: string;
220
+ snapshotId: string;
221
221
  }, Promise<any>>;
222
222
  workerLatestSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
223
- conversationId: string;
224
223
  agentKey: string;
224
+ conversationId: string;
225
225
  workspaceId: string;
226
226
  }, Promise<any>>;
227
227
  workerGenerateMediaUploadUrl: import("convex/server").RegisteredMutation<"public", {}, Promise<any>>;
@@ -233,25 +233,25 @@ export declare function exposeApi(component: ComponentApi, options: {
233
233
  messageId: string;
234
234
  }, Promise<any>>;
235
235
  globalSkillsDeploy: import("convex/server").RegisteredMutation<"public", {
236
- releaseChannel?: "stable" | "canary" | undefined;
237
- displayName?: string | undefined;
236
+ actor?: string | undefined;
238
237
  description?: string | undefined;
238
+ displayName?: string | undefined;
239
239
  entryPoint?: string | undefined;
240
240
  moduleFormat?: "esm" | "cjs" | undefined;
241
- actor?: string | undefined;
242
- slug: string;
241
+ releaseChannel?: "stable" | "canary" | undefined;
243
242
  version: string;
243
+ slug: string;
244
244
  sourceJs: string;
245
245
  }, Promise<any>>;
246
246
  globalSkillsList: import("convex/server").RegisteredQuery<"public", {
247
- status?: "active" | "disabled" | undefined;
248
- releaseChannel?: "stable" | "canary" | undefined;
249
247
  limit?: number | undefined;
248
+ releaseChannel?: "stable" | "canary" | undefined;
249
+ status?: "active" | "disabled" | undefined;
250
250
  }, Promise<any>>;
251
251
  globalSkillsSetStatus: import("convex/server").RegisteredMutation<"public", {
252
252
  actor?: string | undefined;
253
- status: "active" | "disabled";
254
253
  slug: string;
254
+ status: "active" | "disabled";
255
255
  }, Promise<any>>;
256
256
  globalSkillsDelete: import("convex/server").RegisteredMutation<"public", {
257
257
  slug: string;
@@ -322,8 +322,8 @@ export declare function exposeApi(component: ComponentApi, options: {
322
322
  bindUserAgent: import("convex/server").RegisteredMutation<"public", {
323
323
  metadata?: Record<string, string> | undefined;
324
324
  source?: "manual" | "telegram_pairing" | "api" | undefined;
325
- telegramUserId?: string | undefined;
326
325
  telegramChatId?: string | undefined;
326
+ telegramUserId?: string | undefined;
327
327
  agentKey: string;
328
328
  consumerUserId: string;
329
329
  }, Promise<{
@@ -378,8 +378,8 @@ export declare function exposeApi(component: ComponentApi, options: {
378
378
  consumerUserId: string;
379
379
  }, Promise<any>>;
380
380
  resolveAgentForTelegram: import("convex/server").RegisteredQuery<"public", {
381
- telegramUserId?: string | undefined;
382
381
  telegramChatId?: string | undefined;
382
+ telegramUserId?: string | undefined;
383
383
  }, Promise<{
384
384
  agentKey: null | string;
385
385
  consumerUserId: null | string;
@@ -406,8 +406,8 @@ export declare function exposeApi(component: ComponentApi, options: {
406
406
  consumerUserId: string;
407
407
  }, Promise<any>>;
408
408
  consumePairingCode: import("convex/server").RegisteredMutation<"public", {
409
- telegramUserId: string;
410
409
  telegramChatId: string;
410
+ telegramUserId: string;
411
411
  code: string;
412
412
  }, Promise<{
413
413
  agentKey: string;
@@ -440,8 +440,8 @@ export declare function exposeApi(component: ComponentApi, options: {
440
440
  importTelegramTokenForAgent: import("convex/server").RegisteredMutation<"public", {
441
441
  metadata?: Record<string, string> | undefined;
442
442
  agentKey: string;
443
- plaintextValue: string;
444
443
  consumerUserId: string;
444
+ plaintextValue: string;
445
445
  }, Promise<any>>;
446
446
  getUserAgentOnboardingState: import("convex/server").RegisteredQuery<"public", {
447
447
  agentKey: string;
@@ -477,11 +477,11 @@ export declare function exposeApi(component: ComponentApi, options: {
477
477
  }, Promise<any>>;
478
478
  createPushTemplate: import("convex/server").RegisteredMutation<"public", {
479
479
  enabled?: boolean | undefined;
480
- periodicity: "manual" | "daily" | "weekly" | "monthly";
481
480
  companyId: string;
482
- templateKey: string;
483
- title: string;
481
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
484
482
  text: string;
483
+ title: string;
484
+ actorUserId: string;
485
485
  suggestedTimes: ({
486
486
  kind: "daily";
487
487
  time: string;
@@ -494,12 +494,13 @@ export declare function exposeApi(component: ComponentApi, options: {
494
494
  time: string;
495
495
  dayOfMonth: number | "last";
496
496
  })[];
497
- actorUserId: string;
497
+ templateKey: string;
498
498
  }, Promise<any>>;
499
499
  updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
500
+ enabled?: boolean | undefined;
500
501
  periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
501
- title?: string | undefined;
502
502
  text?: string | undefined;
503
+ title?: string | undefined;
503
504
  suggestedTimes?: ({
504
505
  kind: "daily";
505
506
  time: string;
@@ -512,9 +513,8 @@ export declare function exposeApi(component: ComponentApi, options: {
512
513
  time: string;
513
514
  dayOfMonth: number | "last";
514
515
  })[] | undefined;
515
- enabled?: boolean | undefined;
516
- actorUserId: string;
517
516
  templateId: string;
517
+ actorUserId: string;
518
518
  }, Promise<any>>;
519
519
  deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
520
520
  templateId: string;
@@ -541,17 +541,14 @@ export declare function exposeApi(component: ComponentApi, options: {
541
541
  } | undefined;
542
542
  consumerUserId: string;
543
543
  companyId: string;
544
- templateId: string;
545
544
  timezone: string;
545
+ templateId: string;
546
546
  }, Promise<any>>;
547
547
  createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
548
548
  enabled?: boolean | undefined;
549
549
  consumerUserId: string;
550
- periodicity: "manual" | "daily" | "weekly" | "monthly";
551
550
  companyId: string;
552
- title: string;
553
- text: string;
554
- timezone: string;
551
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
555
552
  schedule: {
556
553
  kind: "manual";
557
554
  } | {
@@ -566,13 +563,13 @@ export declare function exposeApi(component: ComponentApi, options: {
566
563
  time: string;
567
564
  dayOfMonth: number | "last";
568
565
  };
566
+ text: string;
567
+ timezone: string;
568
+ title: string;
569
569
  }, Promise<any>>;
570
570
  updatePushJob: import("convex/server").RegisteredMutation<"public", {
571
- periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
572
- title?: string | undefined;
573
- text?: string | undefined;
574
571
  enabled?: boolean | undefined;
575
- timezone?: string | undefined;
572
+ periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
576
573
  schedule?: {
577
574
  kind: "manual";
578
575
  } | {
@@ -587,6 +584,9 @@ export declare function exposeApi(component: ComponentApi, options: {
587
584
  time: string;
588
585
  dayOfMonth: number | "last";
589
586
  } | undefined;
587
+ text?: string | undefined;
588
+ timezone?: string | undefined;
589
+ title?: string | undefined;
590
590
  jobId: string;
591
591
  }, Promise<any>>;
592
592
  deletePushJob: import("convex/server").RegisteredMutation<"public", {
@@ -606,7 +606,7 @@ export declare function exposeApi(component: ComponentApi, options: {
606
606
  }, Promise<any>>;
607
607
  listQueueItemsForUserAgent: import("convex/server").RegisteredQuery<"public", {
608
608
  limit?: number | undefined;
609
- statuses?: ("queued" | "processing" | "done" | "failed" | "dead_letter")[] | undefined;
609
+ statuses?: ("failed" | "done" | "queued" | "processing" | "dead_letter")[] | undefined;
610
610
  agentKey: string;
611
611
  consumerUserId: string;
612
612
  }, Promise<any>>;
@@ -618,8 +618,8 @@ export declare function exposeApi(component: ComponentApi, options: {
618
618
  sendMessageToUserAgent: import("convex/server").RegisteredMutation<"public", {
619
619
  metadata?: Record<string, string> | undefined;
620
620
  agentKey: string;
621
- content: string;
622
621
  consumerUserId: string;
622
+ content: string;
623
623
  }, Promise<any>>;
624
624
  listSnapshotsForConversation: import("convex/server").RegisteredQuery<"public", {
625
625
  limit?: number | undefined;
@@ -661,18 +661,15 @@ export declare function exposeApi(component: ComponentApi, options: {
661
661
  agentKey: string;
662
662
  consumerUserId: string;
663
663
  companyId: string;
664
- templateId: string;
665
664
  timezone: string;
665
+ templateId: string;
666
666
  }, Promise<any>>;
667
667
  createPushJobCustomForAgent: import("convex/server").RegisteredMutation<"public", {
668
668
  enabled?: boolean | undefined;
669
669
  agentKey: string;
670
670
  consumerUserId: string;
671
- periodicity: "manual" | "daily" | "weekly" | "monthly";
672
671
  companyId: string;
673
- title: string;
674
- text: string;
675
- timezone: string;
672
+ periodicity: "manual" | "daily" | "weekly" | "monthly";
676
673
  schedule: {
677
674
  kind: "manual";
678
675
  } | {
@@ -687,13 +684,13 @@ export declare function exposeApi(component: ComponentApi, options: {
687
684
  time: string;
688
685
  dayOfMonth: number | "last";
689
686
  };
687
+ text: string;
688
+ timezone: string;
689
+ title: string;
690
690
  }, Promise<any>>;
691
691
  updatePushJobForAgent: import("convex/server").RegisteredMutation<"public", {
692
- periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
693
- title?: string | undefined;
694
- text?: string | undefined;
695
692
  enabled?: boolean | undefined;
696
- timezone?: string | undefined;
693
+ periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
697
694
  schedule?: {
698
695
  kind: "manual";
699
696
  } | {
@@ -708,6 +705,9 @@ export declare function exposeApi(component: ComponentApi, options: {
708
705
  time: string;
709
706
  dayOfMonth: number | "last";
710
707
  } | undefined;
708
+ text?: string | undefined;
709
+ timezone?: string | undefined;
710
+ title?: string | undefined;
711
711
  agentKey: string;
712
712
  consumerUserId: string;
713
713
  jobId: string;
@@ -740,8 +740,8 @@ export declare function exposeApi(component: ComponentApi, options: {
740
740
  }, Promise<any>>;
741
741
  sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
742
742
  companyId: string;
743
- title: string;
744
743
  text: string;
744
+ title: string;
745
745
  requestedBy: string;
746
746
  }, Promise<any>>;
747
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,EAAsC,UAAU,EAAE,MAAM,eAAe,CAAC;AAE1F,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA47C4tf,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAAiC,CAAC;;;;;6BAAyK,CAAC;;oBAA+D,CAAC;;;yBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAk1N,CAAC;;wBAAiE,CAAC;;wBAAwG,CAAC;yBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
@@ -1155,19 +1155,11 @@ export function registerRoutes(http, component, { pathPrefix = "/agent-factory",
1155
1155
  metadata[metadataKey] = attachment.telegramFileId;
1156
1156
  }
1157
1157
  }
1158
- const ingressConfig = await ctx.runQuery(component.queue.getTelegramIngressRuntimeConfig, { agentKey });
1159
- if (attachmentCandidates.length > 0 && !ingressConfig.botToken) {
1160
- return new Response(JSON.stringify({
1161
- ok: false,
1162
- error: `missing active telegram bot token for agent '${agentKey}'`,
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