@okrlinkhub/agent-factory 0.2.1 → 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.
@@ -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.2",
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
  }),
@@ -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,
@@ -463,12 +473,14 @@ export function registerRoutes(
463
473
  resolveAgentKeyFromBinding = true,
464
474
  fallbackAgentKey = "default",
465
475
  requireBindingForTelegram = false,
476
+ providerConfig,
466
477
  }: {
467
478
  pathPrefix?: string;
468
479
  resolveAgentKey?: (update: unknown) => string;
469
480
  resolveAgentKeyFromBinding?: boolean;
470
481
  fallbackAgentKey?: string;
471
482
  requireBindingForTelegram?: boolean;
483
+ providerConfig?: ProviderConfig;
472
484
  } = {},
473
485
  ) {
474
486
  http.route({
@@ -636,6 +648,7 @@ export function registerRoutes(
636
648
  rawUpdateJson: JSON.stringify(update),
637
649
  metadata,
638
650
  },
651
+ providerConfig,
639
652
  });
640
653
  return new Response(JSON.stringify({ ok: true }), {
641
654
  status: 202,
@@ -378,6 +378,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
378
378
  rawUpdateJson?: string;
379
379
  };
380
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
+ };
381
391
  scheduledFor?: number;
382
392
  },
383
393
  string,
@@ -689,6 +699,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
689
699
  rawUpdateJson?: string;
690
700
  };
691
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
+ };
692
712
  scheduledFor?: number;
693
713
  },
694
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
  },
@@ -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(
@@ -99,7 +99,7 @@ async function runReconcileWorkerPool(
99
99
  ) {
100
100
  const nowMs = args.nowMs ?? Date.now();
101
101
  const scaling = args.scalingPolicy ?? DEFAULT_CONFIG.scaling;
102
- const providerConfig = args.providerConfig ?? DEFAULT_CONFIG.provider;
102
+ const providerConfig = ensureProviderConfig(args.providerConfig ?? DEFAULT_CONFIG.provider);
103
103
  const flyApiToken =
104
104
  args.flyApiToken ??
105
105
  (await ctx.runQuery(internal.queue.getActiveSecretPlaintext, {
@@ -304,7 +304,7 @@ async function runEnforceIdleShutdowns(
304
304
  },
305
305
  ) {
306
306
  const nowMs = args.nowMs ?? Date.now();
307
- const providerConfig = args.providerConfig ?? DEFAULT_CONFIG.provider;
307
+ const providerConfig = ensureProviderConfig(args.providerConfig ?? DEFAULT_CONFIG.provider);
308
308
  const flyApiToken =
309
309
  args.flyApiToken ??
310
310
  (await ctx.runQuery(internal.queue.getActiveSecretPlaintext, {
@@ -431,6 +431,27 @@ function resolveProvider(kind: string, flyApiToken: string): WorkerProvider {
431
431
  }
432
432
  }
433
433
 
434
+ function ensureProviderConfig(providerConfig: typeof DEFAULT_CONFIG.provider) {
435
+ const requiredFields: Array<
436
+ "appName" | "organizationSlug" | "image" | "region" | "volumeName" | "volumePath"
437
+ > = [
438
+ "appName",
439
+ "organizationSlug",
440
+ "image",
441
+ "region",
442
+ "volumeName",
443
+ "volumePath",
444
+ ];
445
+ for (const field of requiredFields) {
446
+ if (!providerConfig[field]?.trim()) {
447
+ throw new Error(
448
+ `Missing providerConfig.${field}. Pass providerConfig explicitly when starting/reconciling workers.`,
449
+ );
450
+ }
451
+ }
452
+ return providerConfig;
453
+ }
454
+
434
455
  function clamp(value: number, min: number, max: number): number {
435
456
  return Math.max(min, Math.min(max, value));
436
457
  }