@okrlinkhub/agent-factory 0.2.1 → 0.2.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.
@@ -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
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/okrlinkhub/agent-factory/issues"
11
11
  },
12
- "version": "0.2.1",
12
+ "version": "0.2.3",
13
13
  "license": "Apache-2.0",
14
14
  "keywords": [
15
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
  }),
@@ -112,7 +119,10 @@ export function exposeApi(
112
119
  },
113
120
  handler: async (ctx, args) => {
114
121
  await options.auth(ctx, { type: "write" });
115
- return await ctx.runMutation(component.queue.completeJob, args);
122
+ return await ctx.runMutation(component.queue.completeJob, {
123
+ ...args,
124
+ providerConfig: options.providerConfig,
125
+ });
116
126
  },
117
127
  }),
118
128
  workerFail: mutationGeneric({
@@ -124,7 +134,10 @@ export function exposeApi(
124
134
  },
125
135
  handler: async (ctx, args) => {
126
136
  await options.auth(ctx, { type: "write" });
127
- return await ctx.runMutation(component.queue.failJob, args);
137
+ return await ctx.runMutation(component.queue.failJob, {
138
+ ...args,
139
+ providerConfig: options.providerConfig,
140
+ });
128
141
  },
129
142
  }),
130
143
  workerHydrationBundle: queryGeneric({
@@ -302,6 +315,7 @@ export function exposeApi(
302
315
  convexUrl: args.convexUrl,
303
316
  workspaceId: args.workspaceId,
304
317
  scalingPolicy: args.scalingPolicy,
318
+ providerConfig: options.providerConfig,
305
319
  });
306
320
  },
307
321
  }),
@@ -313,6 +327,7 @@ export function exposeApi(
313
327
  await options.auth(ctx, { type: "read" });
314
328
  return await ctx.runAction((component.lib as any).checkIdleShutdowns, {
315
329
  flyApiToken: args.flyApiToken,
330
+ providerConfig: options.providerConfig,
316
331
  });
317
332
  },
318
333
  }),
@@ -343,6 +358,7 @@ export function exposeApi(
343
358
  const reconcile = await ctx.runAction(component.lib.reconcileWorkers, {
344
359
  workspaceId: args.workspaceId,
345
360
  scalingPolicy: args.scalingPolicy,
361
+ providerConfig: options.providerConfig,
346
362
  });
347
363
  return {
348
364
  released,
@@ -463,12 +479,14 @@ export function registerRoutes(
463
479
  resolveAgentKeyFromBinding = true,
464
480
  fallbackAgentKey = "default",
465
481
  requireBindingForTelegram = false,
482
+ providerConfig,
466
483
  }: {
467
484
  pathPrefix?: string;
468
485
  resolveAgentKey?: (update: unknown) => string;
469
486
  resolveAgentKeyFromBinding?: boolean;
470
487
  fallbackAgentKey?: string;
471
488
  requireBindingForTelegram?: boolean;
489
+ providerConfig?: ProviderConfig;
472
490
  } = {},
473
491
  ) {
474
492
  http.route({
@@ -636,6 +654,7 @@ export function registerRoutes(
636
654
  rawUpdateJson: JSON.stringify(update),
637
655
  metadata,
638
656
  },
657
+ providerConfig,
639
658
  });
640
659
  return new Response(JSON.stringify({ ok: true }), {
641
660
  status: 202,
@@ -267,6 +267,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
267
267
  leaseId: string;
268
268
  messageId: string;
269
269
  nowMs?: number;
270
+ providerConfig?: {
271
+ appName: string;
272
+ image: string;
273
+ kind: "fly" | "runpod" | "ecs";
274
+ organizationSlug: string;
275
+ region: string;
276
+ volumeName: string;
277
+ volumePath: string;
278
+ volumeSizeGb: number;
279
+ };
270
280
  workerId: string;
271
281
  },
272
282
  boolean,
@@ -378,6 +388,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
378
388
  rawUpdateJson?: string;
379
389
  };
380
390
  priority?: number;
391
+ providerConfig?: {
392
+ appName: string;
393
+ image: string;
394
+ kind: "fly" | "runpod" | "ecs";
395
+ organizationSlug: string;
396
+ region: string;
397
+ volumeName: string;
398
+ volumePath: string;
399
+ volumeSizeGb: number;
400
+ };
381
401
  scheduledFor?: number;
382
402
  },
383
403
  string,
@@ -391,6 +411,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
391
411
  leaseId: string;
392
412
  messageId: string;
393
413
  nowMs?: number;
414
+ providerConfig?: {
415
+ appName: string;
416
+ image: string;
417
+ kind: "fly" | "runpod" | "ecs";
418
+ organizationSlug: string;
419
+ region: string;
420
+ volumeName: string;
421
+ volumePath: string;
422
+ volumeSizeGb: number;
423
+ };
394
424
  workerId: string;
395
425
  },
396
426
  {
@@ -667,6 +697,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
667
697
  leaseId: string;
668
698
  messageId: string;
669
699
  nowMs?: number;
700
+ providerConfig?: {
701
+ appName: string;
702
+ image: string;
703
+ kind: "fly" | "runpod" | "ecs";
704
+ organizationSlug: string;
705
+ region: string;
706
+ volumeName: string;
707
+ volumePath: string;
708
+ volumeSizeGb: number;
709
+ };
670
710
  workerId: string;
671
711
  },
672
712
  boolean,
@@ -689,6 +729,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
689
729
  rawUpdateJson?: string;
690
730
  };
691
731
  priority?: number;
732
+ providerConfig?: {
733
+ appName: string;
734
+ image: string;
735
+ kind: "fly" | "runpod" | "ecs";
736
+ organizationSlug: string;
737
+ region: string;
738
+ volumeName: string;
739
+ volumePath: string;
740
+ volumeSizeGb: number;
741
+ };
692
742
  scheduledFor?: number;
693
743
  },
694
744
  string,
@@ -709,6 +759,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
709
759
  leaseId: string;
710
760
  messageId: string;
711
761
  nowMs?: number;
762
+ providerConfig?: {
763
+ appName: string;
764
+ image: string;
765
+ kind: "fly" | "runpod" | "ecs";
766
+ organizationSlug: string;
767
+ region: string;
768
+ volumeName: string;
769
+ volumePath: string;
770
+ volumeSizeGb: number;
771
+ };
712
772
  workerId: string;
713
773
  },
714
774
  {
@@ -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
  },
@@ -4,6 +4,17 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
4
4
  import { api, internal } from "./_generated/api.js";
5
5
  import { initConvexTest } from "./setup.test.js";
6
6
 
7
+ const TEST_PROVIDER_CONFIG = {
8
+ kind: "fly" as const,
9
+ appName: "agent-factory-workers-test",
10
+ organizationSlug: "personal",
11
+ image: "registry.fly.io/agent-factory-workers-test:test-image",
12
+ region: "iad",
13
+ volumeName: "openclaw_data_test",
14
+ volumePath: "/data",
15
+ volumeSizeGb: 10,
16
+ };
17
+
7
18
  describe("component lib", () => {
8
19
  beforeEach(async () => {
9
20
  vi.useFakeTimers();
@@ -361,6 +372,7 @@ describe("component lib", () => {
361
372
  idleTimeoutMs: 300_000,
362
373
  reconcileIntervalMs: 15_000,
363
374
  },
375
+ providerConfig: TEST_PROVIDER_CONFIG,
364
376
  });
365
377
  expect(reconcile.activeWorkers).toBe(3);
366
378
  expect(reconcile.spawned).toBe(0);
@@ -433,16 +445,7 @@ describe("component lib", () => {
433
445
  idleTimeoutMs: 300_000,
434
446
  reconcileIntervalMs: 15_000,
435
447
  },
436
- providerConfig: {
437
- kind: "fly",
438
- appName: "agent-factory-workers",
439
- organizationSlug: "personal",
440
- image: "registry.fly.io/agent-factory-workers:test-image",
441
- region: "iad",
442
- volumeName: "",
443
- volumePath: "",
444
- volumeSizeGb: 10,
445
- },
448
+ providerConfig: TEST_PROVIDER_CONFIG,
446
449
  });
447
450
  expect(reconcile.activeWorkers).toBe(3);
448
451
  expect(reconcile.spawned).toBe(0);
@@ -6,7 +6,7 @@ import {
6
6
  mutation,
7
7
  query,
8
8
  } from "./_generated/server.js";
9
- import { computeRetryDelayMs, DEFAULT_CONFIG } from "./config.js";
9
+ import { computeRetryDelayMs, DEFAULT_CONFIG, providerConfigValidator } from "./config.js";
10
10
 
11
11
  const queueStatusValidator = v.union(
12
12
  v.literal("queued"),
@@ -79,6 +79,7 @@ export const enqueueMessage = mutation({
79
79
  scheduledFor: v.optional(v.number()),
80
80
  maxAttempts: v.optional(v.number()),
81
81
  nowMs: v.optional(v.number()),
82
+ providerConfig: v.optional(providerConfigValidator),
82
83
  },
83
84
  returns: v.id("messageQueue"),
84
85
  handler: async (ctx, args) => {
@@ -125,6 +126,7 @@ export const enqueueMessage = mutation({
125
126
  try {
126
127
  await ctx.scheduler.runAfter(0, (internal.scheduler as any).reconcileWorkerPoolFromEnqueue, {
127
128
  workspaceId: "default",
129
+ providerConfig: args.providerConfig,
128
130
  });
129
131
  } catch (error) {
130
132
  console.warn(
@@ -527,6 +529,7 @@ export const completeJob = mutation({
527
529
  messageId: v.id("messageQueue"),
528
530
  leaseId: v.string(),
529
531
  nowMs: v.optional(v.number()),
532
+ providerConfig: v.optional(providerConfigValidator),
530
533
  },
531
534
  returns: v.boolean(),
532
535
  handler: async (ctx, args) => {
@@ -586,7 +589,9 @@ export const completeJob = mutation({
586
589
  await ctx.scheduler.runAfter(
587
590
  delayMs,
588
591
  (internal.scheduler as any).enforceIdleShutdowns,
589
- {},
592
+ {
593
+ providerConfig: args.providerConfig,
594
+ },
590
595
  );
591
596
  } catch (error) {
592
597
  console.warn(
@@ -608,6 +613,7 @@ export const failJob = mutation({
608
613
  leaseId: v.string(),
609
614
  errorMessage: v.string(),
610
615
  nowMs: v.optional(v.number()),
616
+ providerConfig: v.optional(providerConfigValidator),
611
617
  },
612
618
  returns: v.object({
613
619
  requeued: v.boolean(),
@@ -691,7 +697,9 @@ export const failJob = mutation({
691
697
  await ctx.scheduler.runAfter(
692
698
  delayMs,
693
699
  (internal.scheduler as any).enforceIdleShutdowns,
694
- {},
700
+ {
701
+ providerConfig: args.providerConfig,
702
+ },
695
703
  );
696
704
  } catch (error) {
697
705
  console.warn(