@okrlinkhub/agent-factory 0.2.0 → 0.2.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.
Files changed (36) hide show
  1. package/README.md +48 -9
  2. package/dist/client/index.d.ts +41 -15
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +18 -2
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/component/_generated/component.d.ts +46 -0
  7. package/dist/component/_generated/component.d.ts.map +1 -1
  8. package/dist/component/config.d.ts +1 -1
  9. package/dist/component/config.d.ts.map +1 -1
  10. package/dist/component/config.js +5 -5
  11. package/dist/component/config.js.map +1 -1
  12. package/dist/component/identity.d.ts +19 -6
  13. package/dist/component/identity.d.ts.map +1 -1
  14. package/dist/component/identity.js +85 -1
  15. package/dist/component/identity.js.map +1 -1
  16. package/dist/component/lib.d.ts +1 -1
  17. package/dist/component/lib.d.ts.map +1 -1
  18. package/dist/component/lib.js +1 -1
  19. package/dist/component/lib.js.map +1 -1
  20. package/dist/component/queue.d.ts +38 -28
  21. package/dist/component/queue.d.ts.map +1 -1
  22. package/dist/component/queue.js +3 -1
  23. package/dist/component/queue.js.map +1 -1
  24. package/dist/component/scheduler.d.ts +32 -32
  25. package/dist/component/scheduler.js +18 -2
  26. package/dist/component/scheduler.js.map +1 -1
  27. package/dist/component/schema.d.ts +45 -45
  28. package/package.json +5 -2
  29. package/src/client/index.ts +24 -1
  30. package/src/component/_generated/component.ts +52 -0
  31. package/src/component/config.ts +5 -5
  32. package/src/component/identity.ts +113 -1
  33. package/src/component/lib.test.ts +13 -10
  34. package/src/component/lib.ts +1 -0
  35. package/src/component/queue.ts +3 -1
  36. package/src/component/scheduler.ts +23 -2
@@ -1,19 +1,19 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
2
  agentProfiles: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
- clientMd?: string | undefined;
4
3
  bridgeConfig?: {
5
- baseUrl?: string | undefined;
6
4
  serviceId?: string | undefined;
5
+ baseUrl?: string | undefined;
7
6
  appKey?: string | undefined;
8
7
  serviceKeySecretRef?: string | undefined;
9
8
  enabled: boolean;
10
9
  } | undefined;
10
+ clientMd?: string | undefined;
11
11
  agentKey: string;
12
- version: string;
13
- soulMd: string;
14
- skills: string[];
15
- secretsRef: string[];
16
12
  enabled: boolean;
13
+ secretsRef: string[];
14
+ skills: string[];
15
+ soulMd: string;
16
+ version: string;
17
17
  }, {
18
18
  agentKey: import("convex/values").VString<string, "required">;
19
19
  version: import("convex/values").VString<string, "required">;
@@ -22,8 +22,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
22
22
  skills: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
23
23
  secretsRef: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
24
24
  bridgeConfig: import("convex/values").VObject<{
25
- baseUrl?: string | undefined;
26
25
  serviceId?: string | undefined;
26
+ baseUrl?: string | undefined;
27
27
  appKey?: string | undefined;
28
28
  serviceKeySecretRef?: string | undefined;
29
29
  enabled: boolean;
@@ -33,16 +33,16 @@ declare const _default: import("convex/server").SchemaDefinition<{
33
33
  serviceId: import("convex/values").VString<string | undefined, "optional">;
34
34
  appKey: import("convex/values").VString<string | undefined, "optional">;
35
35
  serviceKeySecretRef: import("convex/values").VString<string | undefined, "optional">;
36
- }, "optional", "enabled" | "baseUrl" | "serviceId" | "appKey" | "serviceKeySecretRef">;
36
+ }, "optional", "serviceId" | "baseUrl" | "appKey" | "enabled" | "serviceKeySecretRef">;
37
37
  enabled: import("convex/values").VBoolean<boolean, "required">;
38
- }, "required", "agentKey" | "version" | "soulMd" | "clientMd" | "skills" | "secretsRef" | "bridgeConfig" | "enabled" | "bridgeConfig.enabled" | "bridgeConfig.baseUrl" | "bridgeConfig.serviceId" | "bridgeConfig.appKey" | "bridgeConfig.serviceKeySecretRef">, {
38
+ }, "required", "agentKey" | "bridgeConfig" | "clientMd" | "enabled" | "secretsRef" | "skills" | "soulMd" | "version" | "bridgeConfig.serviceId" | "bridgeConfig.baseUrl" | "bridgeConfig.appKey" | "bridgeConfig.enabled" | "bridgeConfig.serviceKeySecretRef">, {
39
39
  by_agentKey: ["agentKey", "_creationTime"];
40
40
  by_enabled: ["enabled", "_creationTime"];
41
41
  }, {}, {}>;
42
42
  conversations: import("convex/server").TableDefinition<import("convex/values").VObject<{
43
43
  processingLock?: {
44
- leaseId: string;
45
44
  workerId: string;
45
+ leaseId: string;
46
46
  leaseExpiresAt: number;
47
47
  heartbeatAt: number;
48
48
  claimedMessageId: import("convex/values").GenericId<"messageQueue">;
@@ -55,9 +55,9 @@ declare const _default: import("convex/server").SchemaDefinition<{
55
55
  at: number;
56
56
  }[];
57
57
  pendingToolCalls: {
58
+ status: "pending" | "running" | "done" | "failed";
58
59
  toolName: string;
59
60
  callId: string;
60
- status: "pending" | "running" | "done" | "failed";
61
61
  }[];
62
62
  }, {
63
63
  conversationId: import("convex/values").VString<string, "required">;
@@ -76,21 +76,21 @@ declare const _default: import("convex/server").SchemaDefinition<{
76
76
  at: import("convex/values").VFloat64<number, "required">;
77
77
  }, "required", "role" | "content" | "at">, "required">;
78
78
  pendingToolCalls: import("convex/values").VArray<{
79
+ status: "pending" | "running" | "done" | "failed";
79
80
  toolName: string;
80
81
  callId: string;
81
- status: "pending" | "running" | "done" | "failed";
82
82
  }[], import("convex/values").VObject<{
83
+ status: "pending" | "running" | "done" | "failed";
83
84
  toolName: string;
84
85
  callId: string;
85
- status: "pending" | "running" | "done" | "failed";
86
86
  }, {
87
87
  toolName: import("convex/values").VString<string, "required">;
88
88
  callId: import("convex/values").VString<string, "required">;
89
89
  status: import("convex/values").VUnion<"pending" | "running" | "done" | "failed", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"done", "required">, import("convex/values").VLiteral<"failed", "required">], "required", never>;
90
- }, "required", "toolName" | "callId" | "status">, "required">;
90
+ }, "required", "status" | "toolName" | "callId">, "required">;
91
91
  processingLock: import("convex/values").VObject<{
92
- leaseId: string;
93
92
  workerId: string;
93
+ leaseId: string;
94
94
  leaseExpiresAt: number;
95
95
  heartbeatAt: number;
96
96
  claimedMessageId: import("convex/values").GenericId<"messageQueue">;
@@ -100,8 +100,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
100
100
  leaseExpiresAt: import("convex/values").VFloat64<number, "required">;
101
101
  heartbeatAt: import("convex/values").VFloat64<number, "required">;
102
102
  claimedMessageId: import("convex/values").VId<import("convex/values").GenericId<"messageQueue">, "required">;
103
- }, "optional", "leaseId" | "workerId" | "leaseExpiresAt" | "heartbeatAt" | "claimedMessageId">;
104
- }, "required", "agentKey" | "conversationId" | "contextHistory" | "pendingToolCalls" | "processingLock" | "processingLock.leaseId" | "processingLock.workerId" | "processingLock.leaseExpiresAt" | "processingLock.heartbeatAt" | "processingLock.claimedMessageId">, {
103
+ }, "optional", "workerId" | "leaseId" | "leaseExpiresAt" | "heartbeatAt" | "claimedMessageId">;
104
+ }, "required", "agentKey" | "conversationId" | "contextHistory" | "pendingToolCalls" | "processingLock" | "processingLock.workerId" | "processingLock.leaseId" | "processingLock.leaseExpiresAt" | "processingLock.heartbeatAt" | "processingLock.claimedMessageId">, {
105
105
  by_conversationId: ["conversationId", "_creationTime"];
106
106
  by_agentKey: ["agentKey", "_creationTime"];
107
107
  }, {}, {}>;
@@ -112,13 +112,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
112
112
  lastError?: string | undefined;
113
113
  nextRetryAt?: number | undefined;
114
114
  deadLetteredAt?: number | undefined;
115
+ status: "done" | "failed" | "queued" | "processing" | "dead_letter";
115
116
  agentKey: string;
116
117
  conversationId: string;
117
- status: "done" | "failed" | "queued" | "processing" | "dead_letter";
118
+ maxAttempts: number;
118
119
  payload: {
120
+ metadata?: Record<string, string> | undefined;
119
121
  externalMessageId?: string | undefined;
120
122
  rawUpdateJson?: string | undefined;
121
- metadata?: Record<string, string> | undefined;
122
123
  provider: string;
123
124
  providerUserId: string;
124
125
  messageText: string;
@@ -126,14 +127,13 @@ declare const _default: import("convex/server").SchemaDefinition<{
126
127
  priority: number;
127
128
  scheduledFor: number;
128
129
  attempts: number;
129
- maxAttempts: number;
130
130
  }, {
131
131
  conversationId: import("convex/values").VString<string, "required">;
132
132
  agentKey: import("convex/values").VString<string, "required">;
133
133
  payload: import("convex/values").VObject<{
134
+ metadata?: Record<string, string> | undefined;
134
135
  externalMessageId?: string | undefined;
135
136
  rawUpdateJson?: string | undefined;
136
- metadata?: Record<string, string> | undefined;
137
137
  provider: string;
138
138
  providerUserId: string;
139
139
  messageText: string;
@@ -144,7 +144,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
144
144
  externalMessageId: import("convex/values").VString<string | undefined, "optional">;
145
145
  rawUpdateJson: import("convex/values").VString<string | undefined, "optional">;
146
146
  metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
147
- }, "required", "provider" | "providerUserId" | "messageText" | "externalMessageId" | "rawUpdateJson" | "metadata" | `metadata.${string}`>;
147
+ }, "required", "metadata" | "provider" | "providerUserId" | "messageText" | "externalMessageId" | "rawUpdateJson" | `metadata.${string}`>;
148
148
  status: import("convex/values").VUnion<"done" | "failed" | "queued" | "processing" | "dead_letter", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"processing", "required">, import("convex/values").VLiteral<"done", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"dead_letter", "required">], "required", never>;
149
149
  priority: import("convex/values").VFloat64<number, "required">;
150
150
  scheduledFor: import("convex/values").VFloat64<number, "required">;
@@ -156,7 +156,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
156
156
  lastError: import("convex/values").VString<string | undefined, "optional">;
157
157
  nextRetryAt: import("convex/values").VFloat64<number | undefined, "optional">;
158
158
  deadLetteredAt: import("convex/values").VFloat64<number | undefined, "optional">;
159
- }, "required", "agentKey" | "conversationId" | "status" | "leaseId" | "leaseExpiresAt" | "payload" | "priority" | "scheduledFor" | "claimedBy" | "attempts" | "maxAttempts" | "lastError" | "nextRetryAt" | "deadLetteredAt" | "payload.provider" | "payload.providerUserId" | "payload.messageText" | "payload.externalMessageId" | "payload.rawUpdateJson" | "payload.metadata" | `payload.metadata.${string}`>, {
159
+ }, "required", "status" | "agentKey" | "conversationId" | "leaseId" | "maxAttempts" | "payload" | "priority" | "scheduledFor" | "leaseExpiresAt" | "claimedBy" | "attempts" | "lastError" | "nextRetryAt" | "deadLetteredAt" | "payload.metadata" | "payload.provider" | "payload.providerUserId" | "payload.messageText" | "payload.externalMessageId" | "payload.rawUpdateJson" | `payload.metadata.${string}`>, {
160
160
  by_status_and_scheduledFor: ["status", "scheduledFor", "_creationTime"];
161
161
  by_status_and_priority_and_scheduledFor: ["status", "priority", "scheduledFor", "_creationTime"];
162
162
  by_status_and_leaseExpiresAt: ["status", "leaseExpiresAt", "_creationTime"];
@@ -176,8 +176,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
176
176
  lastSnapshotId?: import("convex/values").GenericId<"dataSnapshots"> | undefined;
177
177
  status: "active" | "stopped";
178
178
  workerId: string;
179
- heartbeatAt: number;
180
179
  provider: string;
180
+ heartbeatAt: number;
181
181
  load: number;
182
182
  capabilities: string[];
183
183
  }, {
@@ -191,7 +191,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
191
191
  appName: import("convex/values").VString<string, "required">;
192
192
  machineId: import("convex/values").VString<string, "required">;
193
193
  region: import("convex/values").VString<string | undefined, "optional">;
194
- }, "optional", "appName" | "machineId" | "region">;
194
+ }, "optional", "appName" | "region" | "machineId">;
195
195
  status: import("convex/values").VUnion<"active" | "stopped", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"stopped", "required">], "required", never>;
196
196
  load: import("convex/values").VFloat64<number, "required">;
197
197
  heartbeatAt: import("convex/values").VFloat64<number, "required">;
@@ -200,24 +200,24 @@ declare const _default: import("convex/server").SchemaDefinition<{
200
200
  stoppedAt: import("convex/values").VFloat64<number | undefined, "optional">;
201
201
  lastSnapshotId: import("convex/values").VId<import("convex/values").GenericId<"dataSnapshots"> | undefined, "optional">;
202
202
  capabilities: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
203
- }, "required", "status" | "workerId" | "heartbeatAt" | "provider" | "machineRef" | "load" | "lastClaimAt" | "scheduledShutdownAt" | "stoppedAt" | "lastSnapshotId" | "capabilities" | "machineRef.appName" | "machineRef.machineId" | "machineRef.region">, {
203
+ }, "required", "status" | "workerId" | "provider" | "heartbeatAt" | "machineRef" | "load" | "lastClaimAt" | "scheduledShutdownAt" | "stoppedAt" | "lastSnapshotId" | "capabilities" | "machineRef.appName" | "machineRef.region" | "machineRef.machineId">, {
204
204
  by_workerId: ["workerId", "_creationTime"];
205
205
  by_status: ["status", "_creationTime"];
206
206
  by_heartbeatAt: ["heartbeatAt", "_creationTime"];
207
207
  by_scheduledShutdownAt: ["scheduledShutdownAt", "_creationTime"];
208
208
  }, {}, {}>;
209
209
  dataSnapshots: import("convex/server").TableDefinition<import("convex/values").VObject<{
210
+ error?: string | undefined;
210
211
  conversationId?: string | undefined;
211
- archiveFileId?: import("convex/values").GenericId<"_storage"> | undefined;
212
212
  sha256?: string | undefined;
213
213
  sizeBytes?: number | undefined;
214
- error?: string | undefined;
214
+ archiveFileId?: import("convex/values").GenericId<"_storage"> | undefined;
215
215
  completedAt?: number | undefined;
216
+ status: "expired" | "failed" | "uploading" | "ready";
216
217
  agentKey: string;
217
- status: "failed" | "uploading" | "ready" | "expired";
218
- workerId: string;
219
218
  workspaceId: string;
220
- reason: "drain" | "signal" | "manual";
219
+ workerId: string;
220
+ reason: "manual" | "drain" | "signal";
221
221
  formatVersion: number;
222
222
  createdAt: number;
223
223
  expiresAt: number;
@@ -226,17 +226,17 @@ declare const _default: import("convex/server").SchemaDefinition<{
226
226
  agentKey: import("convex/values").VString<string, "required">;
227
227
  workerId: import("convex/values").VString<string, "required">;
228
228
  conversationId: import("convex/values").VString<string | undefined, "optional">;
229
- reason: import("convex/values").VUnion<"drain" | "signal" | "manual", [import("convex/values").VLiteral<"drain", "required">, import("convex/values").VLiteral<"signal", "required">, import("convex/values").VLiteral<"manual", "required">], "required", never>;
229
+ reason: import("convex/values").VUnion<"manual" | "drain" | "signal", [import("convex/values").VLiteral<"drain", "required">, import("convex/values").VLiteral<"signal", "required">, import("convex/values").VLiteral<"manual", "required">], "required", never>;
230
230
  formatVersion: import("convex/values").VFloat64<number, "required">;
231
231
  archiveFileId: import("convex/values").VId<import("convex/values").GenericId<"_storage"> | undefined, "optional">;
232
232
  sha256: import("convex/values").VString<string | undefined, "optional">;
233
233
  sizeBytes: import("convex/values").VFloat64<number | undefined, "optional">;
234
- status: import("convex/values").VUnion<"failed" | "uploading" | "ready" | "expired", [import("convex/values").VLiteral<"uploading", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
234
+ status: import("convex/values").VUnion<"expired" | "failed" | "uploading" | "ready", [import("convex/values").VLiteral<"uploading", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
235
235
  error: import("convex/values").VString<string | undefined, "optional">;
236
236
  createdAt: import("convex/values").VFloat64<number, "required">;
237
237
  completedAt: import("convex/values").VFloat64<number | undefined, "optional">;
238
238
  expiresAt: import("convex/values").VFloat64<number, "required">;
239
- }, "required", "agentKey" | "conversationId" | "status" | "workerId" | "workspaceId" | "reason" | "formatVersion" | "archiveFileId" | "sha256" | "sizeBytes" | "error" | "createdAt" | "completedAt" | "expiresAt">, {
239
+ }, "required", "error" | "status" | "agentKey" | "conversationId" | "workspaceId" | "workerId" | "sha256" | "sizeBytes" | "reason" | "formatVersion" | "archiveFileId" | "createdAt" | "completedAt" | "expiresAt">, {
240
240
  by_workerId_and_createdAt: ["workerId", "createdAt", "_creationTime"];
241
241
  by_workspaceId_and_agentKey_and_createdAt: ["workspaceId", "agentKey", "createdAt", "_creationTime"];
242
242
  by_conversationId_and_createdAt: ["conversationId", "createdAt", "_creationTime"];
@@ -245,9 +245,9 @@ declare const _default: import("convex/server").SchemaDefinition<{
245
245
  secrets: import("convex/server").TableDefinition<import("convex/values").VObject<{
246
246
  metadata?: Record<string, string> | undefined;
247
247
  rotatedFrom?: number | undefined;
248
- version: number;
249
248
  active: boolean;
250
249
  secretRef: string;
250
+ version: number;
251
251
  encryptedValue: string;
252
252
  keyId: string;
253
253
  algorithm: string;
@@ -260,18 +260,18 @@ declare const _default: import("convex/server").SchemaDefinition<{
260
260
  active: import("convex/values").VBoolean<boolean, "required">;
261
261
  rotatedFrom: import("convex/values").VFloat64<number | undefined, "optional">;
262
262
  metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
263
- }, "required", "version" | "metadata" | `metadata.${string}` | "active" | "secretRef" | "encryptedValue" | "keyId" | "algorithm" | "rotatedFrom">, {
263
+ }, "required", "active" | "metadata" | "secretRef" | "version" | `metadata.${string}` | "encryptedValue" | "keyId" | "algorithm" | "rotatedFrom">, {
264
264
  by_secretRef: ["secretRef", "_creationTime"];
265
265
  by_secretRef_and_active: ["secretRef", "active", "_creationTime"];
266
266
  by_active: ["active", "_creationTime"];
267
267
  }, {}, {}>;
268
268
  identityBindings: import("convex/server").TableDefinition<import("convex/values").VObject<{
269
269
  metadata?: Record<string, string> | undefined;
270
- telegramUserId?: string | undefined;
271
270
  telegramChatId?: string | undefined;
271
+ telegramUserId?: string | undefined;
272
272
  revokedAt?: number | undefined;
273
- agentKey: string;
274
273
  status: "active" | "revoked";
274
+ agentKey: string;
275
275
  consumerUserId: string;
276
276
  source: "manual" | "telegram_pairing" | "api";
277
277
  boundAt: number;
@@ -285,33 +285,33 @@ declare const _default: import("convex/server").SchemaDefinition<{
285
285
  metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
286
286
  boundAt: import("convex/values").VFloat64<number, "required">;
287
287
  revokedAt: import("convex/values").VFloat64<number | undefined, "optional">;
288
- }, "required", "agentKey" | "status" | "metadata" | `metadata.${string}` | "consumerUserId" | "source" | "telegramUserId" | "telegramChatId" | "boundAt" | "revokedAt">, {
288
+ }, "required", "status" | "agentKey" | "consumerUserId" | "metadata" | "source" | "telegramChatId" | "telegramUserId" | `metadata.${string}` | "boundAt" | "revokedAt">, {
289
289
  by_consumerUserId_and_status: ["consumerUserId", "status", "_creationTime"];
290
290
  by_telegramUserId_and_status: ["telegramUserId", "status", "_creationTime"];
291
291
  by_telegramChatId_and_status: ["telegramChatId", "status", "_creationTime"];
292
292
  by_agentKey_and_status: ["agentKey", "status", "_creationTime"];
293
293
  }, {}, {}>;
294
294
  pairingCodes: import("convex/server").TableDefinition<import("convex/values").VObject<{
295
- telegramUserId?: string | undefined;
296
295
  telegramChatId?: string | undefined;
296
+ telegramUserId?: string | undefined;
297
297
  usedAt?: number | undefined;
298
+ status: "pending" | "used" | "expired";
298
299
  agentKey: string;
299
- status: "pending" | "expired" | "used";
300
- createdAt: number;
301
- expiresAt: number;
302
300
  consumerUserId: string;
303
301
  code: string;
302
+ createdAt: number;
303
+ expiresAt: number;
304
304
  }, {
305
305
  code: import("convex/values").VString<string, "required">;
306
306
  consumerUserId: import("convex/values").VString<string, "required">;
307
307
  agentKey: import("convex/values").VString<string, "required">;
308
- status: import("convex/values").VUnion<"pending" | "expired" | "used", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"used", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
308
+ status: import("convex/values").VUnion<"pending" | "used" | "expired", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"used", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
309
309
  createdAt: import("convex/values").VFloat64<number, "required">;
310
310
  expiresAt: import("convex/values").VFloat64<number, "required">;
311
311
  usedAt: import("convex/values").VFloat64<number | undefined, "optional">;
312
312
  telegramUserId: import("convex/values").VString<string | undefined, "optional">;
313
313
  telegramChatId: import("convex/values").VString<string | undefined, "optional">;
314
- }, "required", "agentKey" | "status" | "createdAt" | "expiresAt" | "consumerUserId" | "telegramUserId" | "telegramChatId" | "code" | "usedAt">, {
314
+ }, "required", "status" | "agentKey" | "consumerUserId" | "telegramChatId" | "telegramUserId" | "code" | "createdAt" | "expiresAt" | "usedAt">, {
315
315
  by_code: ["code", "_creationTime"];
316
316
  by_consumerUserId_and_status: ["consumerUserId", "status", "_creationTime"];
317
317
  by_expiresAt: ["expiresAt", "_creationTime"];
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@okrlinkhub/agent-factory",
3
3
  "description": "A agent factory component for Convex.",
4
- "repository": "github:okrlinkhub/agent-factory",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/okrlinkhub/agent-factory.git"
7
+ },
5
8
  "homepage": "https://github.com/okrlinkhub/agent-factory#readme",
6
9
  "bugs": {
7
10
  "url": "https://github.com/okrlinkhub/agent-factory/issues"
8
11
  },
9
- "version": "0.2.0",
12
+ "version": "0.2.2",
10
13
  "license": "Apache-2.0",
11
14
  "keywords": [
12
15
  "convex",
@@ -7,7 +7,11 @@ import {
7
7
  import type { Auth, HttpRouter } from "convex/server";
8
8
  import { v } from "convex/values";
9
9
  import type { ComponentApi } from "../component/_generated/component.js";
10
- import { scalingPolicyValidator } from "../component/config.js";
10
+ import {
11
+ providerConfigValidator,
12
+ scalingPolicyValidator,
13
+ type ProviderConfig,
14
+ } from "../component/config.js";
11
15
  export {
12
16
  bridgeFunctionKeyFromToolName,
13
17
  executeBridgeFunction,
@@ -32,6 +36,7 @@ export function exposeApi(
32
36
  agentKey?: string;
33
37
  },
34
38
  ) => Promise<string>;
39
+ providerConfig?: ProviderConfig;
35
40
  },
36
41
  ) {
37
42
  return {
@@ -53,6 +58,7 @@ export function exposeApi(
53
58
  rawUpdateJson: v.optional(v.string()),
54
59
  metadata: v.optional(v.record(v.string(), v.string())),
55
60
  priority: v.optional(v.number()),
61
+ providerConfig: v.optional(providerConfigValidator),
56
62
  },
57
63
  handler: async (ctx, args) => {
58
64
  await options.auth(ctx, {
@@ -72,6 +78,7 @@ export function exposeApi(
72
78
  metadata: args.metadata,
73
79
  },
74
80
  priority: args.priority,
81
+ providerConfig: args.providerConfig ?? options.providerConfig,
75
82
  });
76
83
  },
77
84
  }),
@@ -302,6 +309,7 @@ export function exposeApi(
302
309
  convexUrl: args.convexUrl,
303
310
  workspaceId: args.workspaceId,
304
311
  scalingPolicy: args.scalingPolicy,
312
+ providerConfig: options.providerConfig,
305
313
  });
306
314
  },
307
315
  }),
@@ -313,6 +321,7 @@ export function exposeApi(
313
321
  await options.auth(ctx, { type: "read" });
314
322
  return await ctx.runAction((component.lib as any).checkIdleShutdowns, {
315
323
  flyApiToken: args.flyApiToken,
324
+ providerConfig: options.providerConfig,
316
325
  });
317
326
  },
318
327
  }),
@@ -343,6 +352,7 @@ export function exposeApi(
343
352
  const reconcile = await ctx.runAction(component.lib.reconcileWorkers, {
344
353
  workspaceId: args.workspaceId,
345
354
  scalingPolicy: args.scalingPolicy,
355
+ providerConfig: options.providerConfig,
346
356
  });
347
357
  return {
348
358
  released,
@@ -437,6 +447,16 @@ export function exposeApi(
437
447
  return await ctx.runQuery(component.lib.getPairingCodeStatus, args);
438
448
  },
439
449
  }),
450
+ configureTelegramWebhook: actionGeneric({
451
+ args: {
452
+ convexSiteUrl: v.string(),
453
+ secretRef: v.optional(v.string()),
454
+ },
455
+ handler: async (ctx, args) => {
456
+ await options.auth(ctx, { type: "read" });
457
+ return await ctx.runAction(component.lib.configureTelegramWebhook, args);
458
+ },
459
+ }),
440
460
  };
441
461
  }
442
462
 
@@ -453,12 +473,14 @@ export function registerRoutes(
453
473
  resolveAgentKeyFromBinding = true,
454
474
  fallbackAgentKey = "default",
455
475
  requireBindingForTelegram = false,
476
+ providerConfig,
456
477
  }: {
457
478
  pathPrefix?: string;
458
479
  resolveAgentKey?: (update: unknown) => string;
459
480
  resolveAgentKeyFromBinding?: boolean;
460
481
  fallbackAgentKey?: string;
461
482
  requireBindingForTelegram?: boolean;
483
+ providerConfig?: ProviderConfig;
462
484
  } = {},
463
485
  ) {
464
486
  http.route({
@@ -626,6 +648,7 @@ export function registerRoutes(
626
648
  rawUpdateJson: JSON.stringify(update),
627
649
  metadata,
628
650
  },
651
+ providerConfig,
629
652
  });
630
653
  return new Response(JSON.stringify({ ok: true }), {
631
654
  status: 202,
@@ -49,6 +49,22 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
49
49
  },
50
50
  Name
51
51
  >;
52
+ configureTelegramWebhook: FunctionReference<
53
+ "action",
54
+ "internal",
55
+ { convexSiteUrl: string; secretRef?: string },
56
+ {
57
+ currentUrl: null | string;
58
+ description: string;
59
+ isReady: boolean;
60
+ lastErrorDate: null | number;
61
+ lastErrorMessage: null | string;
62
+ ok: boolean;
63
+ pendingUpdateCount: number;
64
+ webhookUrl: string;
65
+ },
66
+ Name
67
+ >;
52
68
  consumePairingCode: FunctionReference<
53
69
  "mutation",
54
70
  "internal",
@@ -278,6 +294,22 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
278
294
  string,
279
295
  Name
280
296
  >;
297
+ configureTelegramWebhook: FunctionReference<
298
+ "action",
299
+ "internal",
300
+ { convexSiteUrl: string; secretRef?: string },
301
+ {
302
+ currentUrl: null | string;
303
+ description: string;
304
+ isReady: boolean;
305
+ lastErrorDate: null | number;
306
+ lastErrorMessage: null | string;
307
+ ok: boolean;
308
+ pendingUpdateCount: number;
309
+ webhookUrl: string;
310
+ },
311
+ Name
312
+ >;
281
313
  consumePairingCode: FunctionReference<
282
314
  "mutation",
283
315
  "internal",
@@ -346,6 +378,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
346
378
  rawUpdateJson?: string;
347
379
  };
348
380
  priority?: number;
381
+ providerConfig?: {
382
+ appName: string;
383
+ image: string;
384
+ kind: "fly" | "runpod" | "ecs";
385
+ organizationSlug: string;
386
+ region: string;
387
+ volumeName: string;
388
+ volumePath: string;
389
+ volumeSizeGb: number;
390
+ };
349
391
  scheduledFor?: number;
350
392
  },
351
393
  string,
@@ -657,6 +699,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
657
699
  rawUpdateJson?: string;
658
700
  };
659
701
  priority?: number;
702
+ providerConfig?: {
703
+ appName: string;
704
+ image: string;
705
+ kind: "fly" | "runpod" | "ecs";
706
+ organizationSlug: string;
707
+ region: string;
708
+ volumeName: string;
709
+ volumePath: string;
710
+ volumeSizeGb: number;
711
+ };
660
712
  scheduledFor?: number;
661
713
  },
662
714
  string,
@@ -59,7 +59,7 @@ export type AgentFactoryConfig = {
59
59
  };
60
60
 
61
61
  export const DEFAULT_WORKER_IMAGE =
62
- "registry.fly.io/agent-factory-workers:deployment-01KJ1MDGR3KQV025S7SZXJTZDH";
62
+ "";
63
63
  export const DEFAULT_WORKER_VOLUME_NAME = "openclaw_data";
64
64
  export const DEFAULT_WORKER_VOLUME_PATH = "/data";
65
65
  export const DEFAULT_WORKER_RUNTIME_ENV: Record<string, string> = {
@@ -172,11 +172,11 @@ export const DEFAULT_CONFIG: AgentFactoryConfig = {
172
172
  },
173
173
  provider: {
174
174
  kind: "fly",
175
- appName: "agent-factory-workers",
176
- organizationSlug: "personal",
175
+ appName: "",
176
+ organizationSlug: "",
177
177
  image: DEFAULT_WORKER_IMAGE,
178
- region: "iad",
179
- volumeName: DEFAULT_WORKER_VOLUME_NAME,
178
+ region: "",
179
+ volumeName: "",
180
180
  volumePath: DEFAULT_WORKER_VOLUME_PATH,
181
181
  volumeSizeGb: 10,
182
182
  },