@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.
- package/README.md +5 -1
- package/dist/client/index.d.ts +14 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +16 -4
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +60 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/config.d.ts +1 -1
- package/dist/component/config.d.ts.map +1 -1
- package/dist/component/config.js +5 -5
- package/dist/component/config.js.map +1 -1
- package/dist/component/queue.d.ts +31 -1
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +11 -3
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +5 -5
- package/dist/component/scheduler.js +18 -2
- package/dist/component/scheduler.js.map +1 -1
- package/dist/component/schema.d.ts +45 -45
- package/package.json +1 -1
- package/src/client/index.ts +22 -3
- package/src/component/_generated/component.ts +60 -0
- package/src/component/config.ts +5 -5
- package/src/component/lib.test.ts +13 -10
- package/src/component/queue.ts +11 -3
- package/src/component/scheduler.ts +23 -2
|
@@ -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
|
}
|