@okrlinkhub/agent-factory 0.2.2 → 0.2.4

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.
@@ -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,
@@ -281,6 +291,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
281
291
  appKey?: string;
282
292
  baseUrl?: string;
283
293
  enabled: boolean;
294
+ appBaseUrlMapJsonSecretRef?: string;
284
295
  serviceId?: string;
285
296
  serviceKeySecretRef?: string;
286
297
  };
@@ -401,6 +412,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
401
412
  leaseId: string;
402
413
  messageId: string;
403
414
  nowMs?: number;
415
+ providerConfig?: {
416
+ appName: string;
417
+ image: string;
418
+ kind: "fly" | "runpod" | "ecs";
419
+ organizationSlug: string;
420
+ region: string;
421
+ volumeName: string;
422
+ volumePath: string;
423
+ volumeSizeGb: number;
424
+ };
404
425
  workerId: string;
405
426
  },
406
427
  {
@@ -426,6 +447,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
426
447
  bridgeRuntimeConfig: null | {
427
448
  appKey: null | string;
428
449
  baseUrl: null | string;
450
+ appBaseUrlMapJson: null | string;
429
451
  serviceId: null | string;
430
452
  serviceKey: null | string;
431
453
  serviceKeySecretRef: null | string;
@@ -677,6 +699,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
677
699
  leaseId: string;
678
700
  messageId: string;
679
701
  nowMs?: 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
+ };
680
712
  workerId: string;
681
713
  },
682
714
  boolean,
@@ -729,6 +761,16 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
729
761
  leaseId: string;
730
762
  messageId: string;
731
763
  nowMs?: number;
764
+ providerConfig?: {
765
+ appName: string;
766
+ image: string;
767
+ kind: "fly" | "runpod" | "ecs";
768
+ organizationSlug: string;
769
+ region: string;
770
+ volumeName: string;
771
+ volumePath: string;
772
+ volumeSizeGb: number;
773
+ };
732
774
  workerId: string;
733
775
  },
734
776
  {
@@ -768,6 +810,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
768
810
  bridgeRuntimeConfig: null | {
769
811
  appKey: null | string;
770
812
  baseUrl: null | string;
813
+ appBaseUrlMapJson: null | string;
771
814
  serviceId: null | string;
772
815
  serviceKey: null | string;
773
816
  serviceKeySecretRef: null | string;
@@ -947,6 +990,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
947
990
  appKey?: string;
948
991
  baseUrl?: string;
949
992
  enabled: boolean;
993
+ appBaseUrlMapJsonSecretRef?: string;
950
994
  serviceId?: string;
951
995
  serviceKeySecretRef?: string;
952
996
  };
@@ -178,6 +178,10 @@ describe("component lib", () => {
178
178
  secretRef: "agent-bridge.serviceKey.bridge-agent",
179
179
  plaintextValue: "abs_live_bridge_key",
180
180
  });
181
+ await t.mutation(api.queue.importPlaintextSecret, {
182
+ secretRef: "agent-bridge.baseUrlMapJson.bridge-agent",
183
+ plaintextValue: '{"crm":"https://consumer.example.com","billing":"https://billing.example.com"}',
184
+ });
181
185
 
182
186
  const messageId = await t.mutation(api.lib.enqueue, {
183
187
  conversationId: "bridge:chat:1",
@@ -200,6 +204,7 @@ describe("component lib", () => {
200
204
  expect(bundle).not.toBeNull();
201
205
  expect(bundle?.bridgeRuntimeConfig).toEqual({
202
206
  baseUrl: "https://consumer.example.com",
207
+ appBaseUrlMapJson: '{"crm":"https://consumer.example.com","billing":"https://billing.example.com"}',
203
208
  serviceId: "openclaw-prod",
204
209
  appKey: "crm",
205
210
  serviceKey: "abs_live_bridge_key",
@@ -53,10 +53,12 @@ const bridgeProfileConfigValidator = v.object({
53
53
  serviceId: v.optional(v.string()),
54
54
  appKey: v.optional(v.string()),
55
55
  serviceKeySecretRef: v.optional(v.string()),
56
+ appBaseUrlMapJsonSecretRef: v.optional(v.string()),
56
57
  });
57
58
 
58
59
  const bridgeRuntimeConfigValidator = v.object({
59
60
  baseUrl: v.union(v.null(), v.string()),
61
+ appBaseUrlMapJson: v.union(v.null(), v.string()),
60
62
  serviceId: v.union(v.null(), v.string()),
61
63
  appKey: v.union(v.null(), v.string()),
62
64
  serviceKey: v.union(v.null(), v.string()),
@@ -66,6 +68,7 @@ const bridgeRuntimeConfigValidator = v.object({
66
68
  const BRIDGE_SECRET_REFS = {
67
69
  serviceKey: "agent-bridge.serviceKey",
68
70
  baseUrl: "agent-bridge.baseUrl",
71
+ baseUrlMapJson: "agent-bridge.baseUrlMapJson",
69
72
  serviceId: "agent-bridge.serviceId",
70
73
  appKey: "agent-bridge.appKey",
71
74
  } as const;
@@ -529,6 +532,7 @@ export const completeJob = mutation({
529
532
  messageId: v.id("messageQueue"),
530
533
  leaseId: v.string(),
531
534
  nowMs: v.optional(v.number()),
535
+ providerConfig: v.optional(providerConfigValidator),
532
536
  },
533
537
  returns: v.boolean(),
534
538
  handler: async (ctx, args) => {
@@ -588,7 +592,9 @@ export const completeJob = mutation({
588
592
  await ctx.scheduler.runAfter(
589
593
  delayMs,
590
594
  (internal.scheduler as any).enforceIdleShutdowns,
591
- {},
595
+ {
596
+ providerConfig: args.providerConfig,
597
+ },
592
598
  );
593
599
  } catch (error) {
594
600
  console.warn(
@@ -610,6 +616,7 @@ export const failJob = mutation({
610
616
  leaseId: v.string(),
611
617
  errorMessage: v.string(),
612
618
  nowMs: v.optional(v.number()),
619
+ providerConfig: v.optional(providerConfigValidator),
613
620
  },
614
621
  returns: v.object({
615
622
  requeued: v.boolean(),
@@ -693,7 +700,9 @@ export const failJob = mutation({
693
700
  await ctx.scheduler.runAfter(
694
701
  delayMs,
695
702
  (internal.scheduler as any).enforceIdleShutdowns,
696
- {},
703
+ {
704
+ providerConfig: args.providerConfig,
705
+ },
697
706
  );
698
707
  } catch (error) {
699
708
  console.warn(
@@ -1407,10 +1416,12 @@ async function resolveBridgeRuntimeConfig(
1407
1416
  serviceId?: string;
1408
1417
  appKey?: string;
1409
1418
  serviceKeySecretRef?: string;
1419
+ appBaseUrlMapJsonSecretRef?: string;
1410
1420
  };
1411
1421
  },
1412
1422
  ): Promise<{
1413
1423
  baseUrl: string | null;
1424
+ appBaseUrlMapJson: string | null;
1414
1425
  serviceId: string | null;
1415
1426
  appKey: string | null;
1416
1427
  serviceKey: string | null;
@@ -1421,6 +1432,7 @@ async function resolveBridgeRuntimeConfig(
1421
1432
  }
1422
1433
 
1423
1434
  const configuredServiceKeySecretRef = profile.bridgeConfig.serviceKeySecretRef ?? null;
1435
+ const configuredBaseUrlMapSecretRef = profile.bridgeConfig.appBaseUrlMapJsonSecretRef ?? null;
1424
1436
  const [serviceKeySecretRef, serviceKey] = await resolveFirstActiveSecretValue(
1425
1437
  ctx,
1426
1438
  getScopedSecretRefCandidates(
@@ -1434,6 +1446,14 @@ async function resolveBridgeRuntimeConfig(
1434
1446
  ctx,
1435
1447
  getScopedSecretRefCandidates(profile.agentKey, BRIDGE_SECRET_REFS.baseUrl),
1436
1448
  );
1449
+ const [, appBaseUrlMapJsonFromSecret] = await resolveFirstActiveSecretValue(
1450
+ ctx,
1451
+ getScopedSecretRefCandidates(
1452
+ profile.agentKey,
1453
+ BRIDGE_SECRET_REFS.baseUrlMapJson,
1454
+ configuredBaseUrlMapSecretRef,
1455
+ ),
1456
+ );
1437
1457
  const [, serviceIdFromSecret] = await resolveFirstActiveSecretValue(
1438
1458
  ctx,
1439
1459
  getScopedSecretRefCandidates(profile.agentKey, BRIDGE_SECRET_REFS.serviceId),
@@ -1445,6 +1465,7 @@ async function resolveBridgeRuntimeConfig(
1445
1465
 
1446
1466
  return {
1447
1467
  baseUrl: profile.bridgeConfig.baseUrl ?? baseUrlFromSecret,
1468
+ appBaseUrlMapJson: appBaseUrlMapJsonFromSecret,
1448
1469
  serviceId: profile.bridgeConfig.serviceId ?? serviceIdFromSecret,
1449
1470
  appKey: profile.bridgeConfig.appKey ?? appKeyFromSecret,
1450
1471
  serviceKey,
@@ -1458,6 +1479,7 @@ function getBridgeSecretRefsForProfile(
1458
1479
  | {
1459
1480
  enabled: boolean;
1460
1481
  serviceKeySecretRef?: string;
1482
+ appBaseUrlMapJsonSecretRef?: string;
1461
1483
  }
1462
1484
  | undefined,
1463
1485
  ): Array<string> {
@@ -1466,6 +1488,8 @@ function getBridgeSecretRefsForProfile(
1466
1488
  }
1467
1489
  const refs: Array<string> = [
1468
1490
  bridgeConfig.serviceKeySecretRef ?? `${BRIDGE_SECRET_REFS.serviceKey}.${agentKey}`,
1491
+ bridgeConfig.appBaseUrlMapJsonSecretRef ??
1492
+ `${BRIDGE_SECRET_REFS.baseUrlMapJson}.${agentKey}`,
1469
1493
  ];
1470
1494
  return refs;
1471
1495
  }
@@ -16,6 +16,7 @@ export default defineSchema({
16
16
  serviceId: v.optional(v.string()),
17
17
  appKey: v.optional(v.string()),
18
18
  serviceKeySecretRef: v.optional(v.string()),
19
+ appBaseUrlMapJsonSecretRef: v.optional(v.string()),
19
20
  }),
20
21
  ),
21
22
  enabled: v.boolean(),