@desplega.ai/agent-swarm 1.119.5 → 1.120.0

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 (137) hide show
  1. package/dist/{actions-xqb0w6as.js → actions-rym7jyg2.js} +5 -5
  2. package/dist/{app-qv9sy539.js → app-ss3a0nfj.js} +3 -3
  3. package/dist/{assistant-54jkns28.js → assistant-8sd2b21b.js} +8 -8
  4. package/dist/{boot-reembed-m3cpwet0.js → boot-reembed-7bs0d0sj.js} +4 -4
  5. package/dist/{boot-reembed-s0mftrn2.js → boot-reembed-eh18r04f.js} +3 -3
  6. package/dist/{boot-scrub-logs-btj144vd.js → boot-scrub-logs-v8ch000n.js} +2 -2
  7. package/dist/{cli-65anxt77.js → cli-0ap79nha.js} +1 -1
  8. package/dist/{cli-4ntm7f2r.js → cli-0kkggfr9.js} +1 -1
  9. package/dist/{cli-rp04sjbc.js → cli-383wyw2f.js} +277 -3
  10. package/dist/{cli-9rrpjvan.js → cli-4cb3p8pj.js} +2 -2
  11. package/dist/cli-84j2vp67.js +791 -0
  12. package/dist/{cli-xv365pmn.js → cli-d2eyq90a.js} +1 -1
  13. package/dist/{cli-tznnqgnf.js → cli-dnx98dwa.js} +477 -188
  14. package/dist/{cli-zn7x1nkq.js → cli-f6c6y7fw.js} +2 -2
  15. package/dist/cli-gad984jj.js +367 -0
  16. package/dist/{cli-5sexkty0.js → cli-gq12jc1m.js} +4 -1
  17. package/dist/{cli-qh6dfg7b.js → cli-j59bj3vs.js} +5 -5
  18. package/dist/{cli-jcp7f17k.js → cli-kyfx7z3d.js} +4 -4
  19. package/dist/{cli-ctdx3h19.js → cli-kyqs14qe.js} +5 -5
  20. package/dist/{cli-m0aghjk5.js → cli-n745f8e5.js} +2 -2
  21. package/dist/{cli-7h1sce5x.js → cli-py8z9bjq.js} +2120 -1530
  22. package/dist/{cli-3brg2qy0.js → cli-sbh0b9r1.js} +2 -2
  23. package/dist/{cli-hc543pgg.js → cli-shdvvj0n.js} +2 -2
  24. package/dist/{cli-w9jp9sc4.js → cli-t91zbm2s.js} +4 -4
  25. package/dist/{cli-wejdajv9.js → cli-th08nm8p.js} +1 -1
  26. package/dist/{cli-hjpdm93t.js → cli-v65h59hn.js} +1 -1
  27. package/dist/{cli-150bvqyw.js → cli-vmhqfnp1.js} +1 -1
  28. package/dist/{cli-wqfxznva.js → cli-w5em21am.js} +3 -3
  29. package/dist/{cli-86fdnerz.js → cli-wwsaj97q.js} +9 -4
  30. package/dist/{cli-4yby3gz2.js → cli-zxeb2qe3.js} +1 -1
  31. package/dist/{cli-sjvxb0ys.js → cli-zxnp21rf.js} +64 -45
  32. package/dist/cli.js +12 -9
  33. package/dist/{commands-jc6a4g7b.js → commands-w1swgcgg.js} +2 -2
  34. package/dist/{db-5gntqs7z.js → db-yv6y0fxw.js} +2 -2
  35. package/dist/{handlers-jtjhcfec.js → handlers-yjyafdwk.js} +8 -8
  36. package/dist/{hook-d3yspdv9.js → hook-6nvc6p19.js} +1 -1
  37. package/dist/{http-vf5qsq5m.js → http-g6j8rc6h.js} +1027 -513
  38. package/dist/{index-be74p0aj.js → index-64th6eqs.js} +9 -9
  39. package/dist/{index-dh8vf4p5.js → index-7betnvg6.js} +7 -7
  40. package/dist/{index-krp5s3s3.js → index-b2rarbkn.js} +10 -10
  41. package/dist/{index-9t676t5s.js → index-cbknx39k.js} +11 -11
  42. package/dist/{keepalive-p5m5d3g9.js → keepalive-j8c99r3m.js} +17 -13
  43. package/dist/{lead-z4z70dn3.js → lead-8xe71m3s.js} +20 -20
  44. package/dist/{maintenance-n67pnrp0.js → maintenance-eqnmrwb2.js} +4 -4
  45. package/dist/{oauth-refresh-sweep-ygx2e3hv.js → oauth-refresh-sweep-c5dy1653.js} +21 -15
  46. package/dist/{onboard-76fn6mr2.js → onboard-4avg01c1.js} +2 -2
  47. package/dist/{otel-impl-d9vmbspk.js → otel-impl-z4cwkp40.js} +1 -1
  48. package/dist/{pricing-refresh-wn1gbbnc.js → pricing-refresh-dts9429d.js} +4 -4
  49. package/dist/{rbac-roles-gzzmwqyj.js → rbac-roles-24cvsejy.js} +3 -3
  50. package/dist/{rbac-roles-xz80cgy4.js → rbac-roles-4f64wch6.js} +4 -4
  51. package/dist/{seed-pricing-yr9dg75w.js → seed-pricing-74ph9wap.js} +3 -3
  52. package/dist/{setup-g15twpgb.js → setup-9q0n8rvd.js} +2 -2
  53. package/dist/{worker-jdsz3va6.js → worker-x7g344z8.js} +20 -20
  54. package/openapi.json +3433 -2657
  55. package/package.json +4 -1
  56. package/src/be/connection-bindings-blob-migration.ts +123 -0
  57. package/src/be/db-queries/mcp-oauth.ts +409 -247
  58. package/src/be/db-queries/oauth.ts +813 -131
  59. package/src/be/db.ts +36 -1
  60. package/src/be/migrations/117_unified_oauth.sql +624 -0
  61. package/src/be/oauth-credential-bindings.ts +48 -14
  62. package/src/be/oauth-encryption-backfill.ts +84 -0
  63. package/src/be/oauth-refresh-sweep.ts +38 -23
  64. package/src/be/script-connections.ts +1130 -163
  65. package/src/be/script-credential-broker.ts +37 -27
  66. package/src/be/vendored-openapi.ts +98 -0
  67. package/src/http/all-routes.ts +1 -0
  68. package/src/http/index.ts +7 -5
  69. package/src/http/mcp-oauth.ts +103 -101
  70. package/src/http/oauth-callback.ts +332 -0
  71. package/src/http/oauth-generic.ts +14 -54
  72. package/src/http/script-connections.ts +651 -170
  73. package/src/http/scripts.ts +4 -2
  74. package/src/http/trackers/jira.ts +22 -34
  75. package/src/http/trackers/linear.ts +21 -36
  76. package/src/http/x.ts +6 -2
  77. package/src/jira/app.ts +12 -6
  78. package/src/jira/oauth.ts +48 -48
  79. package/src/linear/app.ts +44 -2
  80. package/src/linear/oauth.ts +12 -37
  81. package/src/oauth/app-validation.ts +27 -9
  82. package/src/oauth/ensure-mcp-token.ts +1 -0
  83. package/src/oauth/ensure-token.ts +331 -108
  84. package/src/oauth/identity-capture.ts +103 -0
  85. package/src/oauth/keepalive.ts +14 -9
  86. package/src/oauth/presets.ts +242 -0
  87. package/src/oauth/wrapper.ts +197 -76
  88. package/src/rbac/legacy-policy.ts +2 -1
  89. package/src/rbac/permissions.ts +7 -3
  90. package/src/scripts-runtime/credential-broker/broker.ts +51 -8
  91. package/src/scripts-runtime/credential-broker/fetch-patch.ts +30 -3
  92. package/src/scripts-runtime/credential-broker/index.ts +1 -1
  93. package/src/scripts-runtime/credential-broker/types.ts +55 -8
  94. package/src/scripts-runtime/egress-secrets.ts +6 -2
  95. package/src/scripts-runtime/eval-harness.ts +2 -2
  96. package/src/scripts-runtime/executors/types.ts +2 -1
  97. package/src/scripts-runtime/loader.ts +3 -0
  98. package/src/tests/connection-embedded-auth.test.ts +709 -0
  99. package/src/tests/credential-broker.test.ts +123 -125
  100. package/src/tests/db-queries-oauth.test.ts +126 -1
  101. package/src/tests/ensure-token.test.ts +44 -2
  102. package/src/tests/mcp-oauth-manual-client.test.ts +20 -1
  103. package/src/tests/mcp-oauth-queries.test.ts +154 -8
  104. package/src/tests/oauth-access-token-tool.test.ts +37 -1
  105. package/src/tests/oauth-callback-flow.test.ts +534 -0
  106. package/src/tests/oauth-credential-bindings.test.ts +50 -22
  107. package/src/tests/oauth-presets.test.ts +275 -0
  108. package/src/tests/oauth-refresh-failure.test.ts +263 -0
  109. package/src/tests/oauth-refresh-sweep.test.ts +83 -3
  110. package/src/tests/oauth-wrapper.test.ts +77 -55
  111. package/src/tests/rbac-charact-misc-tools.test.ts +60 -0
  112. package/src/tests/rbac-engine.test.ts +2 -1
  113. package/src/tests/script-connections-http.test.ts +356 -11
  114. package/src/tests/script-connections.test.ts +101 -0
  115. package/src/tests/scripts-only-gating.test.ts +93 -31
  116. package/src/tests/spec-base-url.test.ts +266 -0
  117. package/src/tests/status.test.ts +3 -4
  118. package/src/tests/swarm-config-reserved-keys.test.ts +4 -2
  119. package/src/tests/tracker-fold.test.ts +412 -0
  120. package/src/tests/unified-oauth-migration.test.ts +455 -0
  121. package/src/tests/vendored-openapi.test.ts +263 -0
  122. package/src/tools/credential-bindings/tool.ts +232 -77
  123. package/src/tools/oauth-access-token.ts +55 -6
  124. package/src/tools/script-connections/tool.ts +73 -53
  125. package/src/tools/swarm-config/set-config.ts +24 -50
  126. package/src/tracker/types.ts +12 -0
  127. package/src/workflows/executors/swarm-script.ts +6 -2
  128. package/vendored-openapi/README.md +22 -0
  129. package/vendored-openapi/github.json +7759 -0
  130. package/vendored-openapi/gmail.json +393 -0
  131. package/vendored-openapi/jira.json +3396 -0
  132. package/vendored-openapi/linear.json +252 -0
  133. package/vendored-openapi/manifest.json +128 -0
  134. package/vendored-openapi/slack.json +2895 -0
  135. package/dist/cli-0pygq9r1.js +0 -429
  136. package/dist/cli-wbrj97j4.js +0 -393
  137. package/src/scripts-runtime/credential-broker/store.ts +0 -72
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-zn7x1nkq.js";
4
- import"./cli-xv365pmn.js";
3
+ } from "./cli-f6c6y7fw.js";
4
+ import"./cli-d2eyq90a.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-wejdajv9.js";
7
+ } from "./cli-th08nm8p.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  getTaskLink
@@ -19,11 +19,11 @@ import {
19
19
  init_context_key,
20
20
  init_db,
21
21
  slackContextKey
22
- } from "./cli-rp04sjbc.js";
22
+ } from "./cli-383wyw2f.js";
23
23
  import"./cli-z2zcxes1.js";
24
24
  import"./cli-bw80ck94.js";
25
25
  import"./cli-xz9aq0rf.js";
26
- import"./cli-5sexkty0.js";
26
+ import"./cli-gq12jc1m.js";
27
27
  import"./cli-4j2mrzag.js";
28
28
  import"./cli-p9swy5t3.js";
29
29
 
@@ -3,17 +3,17 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-ctdx3h19.js";
6
+ } from "./cli-kyqs14qe.js";
7
7
  import"./cli-rkndnn90.js";
8
8
  import"./cli-b0p7rfnd.js";
9
9
  import"./cli-ma04faw5.js";
10
10
  import"./cli-wspgs9bt.js";
11
11
  import"./cli-dh55d5fg.js";
12
- import"./cli-rp04sjbc.js";
12
+ import"./cli-383wyw2f.js";
13
13
  import"./cli-z2zcxes1.js";
14
14
  import"./cli-bw80ck94.js";
15
15
  import"./cli-xz9aq0rf.js";
16
- import"./cli-5sexkty0.js";
16
+ import"./cli-gq12jc1m.js";
17
17
  import"./cli-4j2mrzag.js";
18
18
  import"./cli-e15jhafb.js";
19
19
  import"./cli-7wmybrt5.js";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  bufferThreadMessage,
3
3
  wasEventSeen
4
- } from "./cli-qh6dfg7b.js";
4
+ } from "./cli-j59bj3vs.js";
5
5
  import {
6
6
  hasOtherUserMention
7
- } from "./cli-4ntm7f2r.js";
7
+ } from "./cli-0kkggfr9.js";
8
8
  import {
9
9
  require_dist
10
- } from "./cli-ctdx3h19.js";
10
+ } from "./cli-kyqs14qe.js";
11
11
  import"./cli-rkndnn90.js";
12
12
  import"./cli-b0p7rfnd.js";
13
13
  import {
14
14
  resolveSlackUserId,
15
15
  rewriteSlackMentions
16
- } from "./cli-zn7x1nkq.js";
17
- import"./cli-xv365pmn.js";
16
+ } from "./cli-f6c6y7fw.js";
17
+ import"./cli-d2eyq90a.js";
18
18
  import {
19
19
  createTaskWithSiblingAwareness
20
- } from "./cli-wejdajv9.js";
20
+ } from "./cli-th08nm8p.js";
21
21
  import"./cli-ma04faw5.js";
22
22
  import"./cli-wspgs9bt.js";
23
23
  import"./cli-dh55d5fg.js";
@@ -30,11 +30,11 @@ import {
30
30
  init_resolver,
31
31
  resolveTemplate,
32
32
  slackContextKey
33
- } from "./cli-rp04sjbc.js";
33
+ } from "./cli-383wyw2f.js";
34
34
  import"./cli-z2zcxes1.js";
35
35
  import"./cli-bw80ck94.js";
36
36
  import"./cli-xz9aq0rf.js";
37
- import"./cli-5sexkty0.js";
37
+ import"./cli-gq12jc1m.js";
38
38
  import"./cli-4j2mrzag.js";
39
39
  import"./cli-e15jhafb.js";
40
40
  import"./cli-7wmybrt5.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-9rrpjvan.js";
5
- import"./cli-65anxt77.js";
4
+ } from "./cli-4cb3p8pj.js";
5
+ import"./cli-0ap79nha.js";
6
6
  import"./cli-q25ejbyn.js";
7
7
  import {
8
8
  getDb,
9
9
  init_db
10
- } from "./cli-rp04sjbc.js";
10
+ } from "./cli-383wyw2f.js";
11
11
  import"./cli-z2zcxes1.js";
12
12
  import"./cli-bw80ck94.js";
13
13
  import"./cli-xz9aq0rf.js";
14
- import"./cli-5sexkty0.js";
14
+ import"./cli-gq12jc1m.js";
15
15
  import"./cli-4j2mrzag.js";
16
16
  import"./cli-p9swy5t3.js";
17
17
 
@@ -3,16 +3,16 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-65anxt77.js";
6
+ } from "./cli-0ap79nha.js";
7
7
  import"./cli-q25ejbyn.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-rp04sjbc.js";
11
+ } from "./cli-383wyw2f.js";
12
12
  import"./cli-z2zcxes1.js";
13
13
  import"./cli-bw80ck94.js";
14
14
  import"./cli-xz9aq0rf.js";
15
- import"./cli-5sexkty0.js";
15
+ import"./cli-gq12jc1m.js";
16
16
  import"./cli-4j2mrzag.js";
17
17
  import"./cli-p9swy5t3.js";
18
18
 
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-rp04sjbc.js";
4
+ } from "./cli-383wyw2f.js";
5
5
  import"./cli-z2zcxes1.js";
6
6
  import"./cli-bw80ck94.js";
7
7
  import"./cli-xz9aq0rf.js";
8
- import"./cli-5sexkty0.js";
8
+ import"./cli-gq12jc1m.js";
9
9
  import {
10
10
  init_secret_scrubber,
11
11
  scrubSecrets
@@ -6,7 +6,7 @@ import {
6
6
  getDb,
7
7
  init_db,
8
8
  isSqliteVecAvailable
9
- } from "./cli-rp04sjbc.js";
9
+ } from "./cli-383wyw2f.js";
10
10
  import {
11
11
  __esm,
12
12
  __export,
@@ -3,7 +3,7 @@ import {
3
3
  getAgentWorkingOnThread,
4
4
  getAllAgents,
5
5
  init_db
6
- } from "./cli-rp04sjbc.js";
6
+ } from "./cli-383wyw2f.js";
7
7
 
8
8
  // src/slack/router.ts
9
9
  init_db();
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  init_package,
28
28
  package_default
29
- } from "./cli-5sexkty0.js";
29
+ } from "./cli-gq12jc1m.js";
30
30
  import {
31
31
  init_secret_scrubber,
32
32
  scrubSecrets
@@ -2378,6 +2378,220 @@ var init_asset_key_audit = __esm(() => {
2378
2378
  ];
2379
2379
  });
2380
2380
 
2381
+ // src/scripts-runtime/credential-broker/types.ts
2382
+ function placeholderForConfigKey(configKey) {
2383
+ return `${REDACTED_PLACEHOLDER_PREFIX}${configKey}]`;
2384
+ }
2385
+ function normalizeCredentialBindingsDocument(input, resolveLegacyOAuthProvider, defaultScope) {
2386
+ const document = Array.isArray(input) ? input : input && typeof input === "object" && Array.isArray(input.bindings) ? input.bindings : [];
2387
+ return document.flatMap((raw) => {
2388
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
2389
+ return [];
2390
+ const candidate = { ...raw };
2391
+ if (defaultScope !== undefined && candidate.scope == null) {
2392
+ candidate.scope = defaultScope;
2393
+ }
2394
+ if (candidate.authKind === "oauth" && typeof candidate.oauthAuthorizationId !== "string" && typeof candidate.oauthProvider === "string") {
2395
+ const authorizationId = resolveLegacyOAuthProvider?.(candidate.oauthProvider);
2396
+ if (!authorizationId)
2397
+ return [];
2398
+ candidate.oauthAuthorizationId = authorizationId;
2399
+ }
2400
+ const parsed = CredentialBindingSchema.safeParse(candidate);
2401
+ return parsed.success ? [parsed.data] : [];
2402
+ });
2403
+ }
2404
+ var CREDENTIAL_BINDINGS_CONFIG_KEY = "SCRIPT_CREDENTIAL_BINDINGS", REDACTED_PLACEHOLDER_PREFIX = "[REDACTED:", CredentialBindingScopeSchema, CredentialBindingAuthKindSchema, CredentialBindingSchema, CredentialBindingsDocumentSchema;
2405
+ var init_types2 = __esm(() => {
2406
+ init_zod();
2407
+ CredentialBindingScopeSchema = _enum(["global", "agent", "repo"]);
2408
+ CredentialBindingAuthKindSchema = _enum(["config", "oauth"]);
2409
+ CredentialBindingSchema = object({
2410
+ configKey: string().min(1).max(255),
2411
+ allowedHosts: array(string().min(1)).min(1),
2412
+ headerTemplate: string().min(1).optional(),
2413
+ queryTemplate: string().min(1).optional(),
2414
+ scope: CredentialBindingScopeSchema.default("global"),
2415
+ scopeId: string().nullable().optional(),
2416
+ active: boolean().default(true),
2417
+ authKind: CredentialBindingAuthKindSchema.default("config"),
2418
+ oauthAuthorizationId: string().min(1).max(255).optional()
2419
+ }).refine((binding) => binding.headerTemplate || binding.queryTemplate, {
2420
+ message: "At least one of headerTemplate or queryTemplate is required."
2421
+ }).refine((binding) => binding.authKind !== "oauth" || !!binding.oauthAuthorizationId, {
2422
+ message: "oauthAuthorizationId is required when authKind is oauth.",
2423
+ path: ["oauthAuthorizationId"]
2424
+ });
2425
+ CredentialBindingsDocumentSchema = union([
2426
+ array(CredentialBindingSchema),
2427
+ object({ bindings: array(CredentialBindingSchema) })
2428
+ ]);
2429
+ });
2430
+
2431
+ // src/scripts-runtime/credential-broker/broker.ts
2432
+ function bindingHasPlaceholder(binding) {
2433
+ const placeholder = placeholderForConfigKey(binding.configKey);
2434
+ return binding.headerTemplate?.includes(placeholder) === true || binding.queryTemplate?.includes(placeholder) === true;
2435
+ }
2436
+ function reasonFromError(err) {
2437
+ const reason = err.reason;
2438
+ return typeof reason === "string" && reason.length > 0 ? reason : "refresh_failed";
2439
+ }
2440
+ function labelFromError(err) {
2441
+ const label = err.authorizationLabel;
2442
+ return typeof label === "string" && label.length > 0 ? label : undefined;
2443
+ }
2444
+
2445
+ class CredentialBroker {
2446
+ store;
2447
+ resolveConfigCredential;
2448
+ defaults;
2449
+ resolveOAuthCredential;
2450
+ constructor(store, resolveConfigCredential, defaults = [], resolveOAuthCredential) {
2451
+ this.store = store;
2452
+ this.resolveConfigCredential = resolveConfigCredential;
2453
+ this.defaults = defaults;
2454
+ this.resolveOAuthCredential = resolveOAuthCredential;
2455
+ }
2456
+ async resolveBindingsWithFailures(context) {
2457
+ const merged = [...this.defaults, ...this.store.listActiveBindings(context)];
2458
+ const resolved = [];
2459
+ const failed = [];
2460
+ const seen = new Set;
2461
+ const failedSeen = new Set;
2462
+ for (const binding of merged) {
2463
+ if (binding.active === false)
2464
+ continue;
2465
+ if (!bindingHasPlaceholder(binding))
2466
+ continue;
2467
+ let value;
2468
+ if (binding.authKind === "oauth") {
2469
+ if (!binding.oauthAuthorizationId)
2470
+ continue;
2471
+ try {
2472
+ value = await this.resolveOAuthCredential?.(binding.oauthAuthorizationId);
2473
+ } catch (err) {
2474
+ const placeholder = placeholderForConfigKey(binding.configKey);
2475
+ const failKey = [placeholder, [...binding.allowedHosts].sort().join(",")].join("\x00");
2476
+ if (!failedSeen.has(failKey)) {
2477
+ failedSeen.add(failKey);
2478
+ const label = labelFromError(err);
2479
+ failed.push({
2480
+ placeholder,
2481
+ allowedHosts: binding.allowedHosts,
2482
+ reason: reasonFromError(err),
2483
+ ...label ? { authorizationLabel: label } : {}
2484
+ });
2485
+ }
2486
+ continue;
2487
+ }
2488
+ } else {
2489
+ value = this.resolveConfigCredential(binding.configKey);
2490
+ }
2491
+ if (!value)
2492
+ continue;
2493
+ const dedupeKey = [
2494
+ binding.configKey,
2495
+ [...binding.allowedHosts].sort().join(","),
2496
+ binding.headerTemplate ?? "",
2497
+ binding.queryTemplate ?? "",
2498
+ binding.scope,
2499
+ binding.scopeId ?? ""
2500
+ ].join("\x00");
2501
+ if (seen.has(dedupeKey))
2502
+ continue;
2503
+ seen.add(dedupeKey);
2504
+ resolved.push({
2505
+ ...binding,
2506
+ placeholder: placeholderForConfigKey(binding.configKey),
2507
+ value
2508
+ });
2509
+ }
2510
+ return { resolved, failed };
2511
+ }
2512
+ async resolveBindings(context) {
2513
+ return (await this.resolveBindingsWithFailures(context)).resolved;
2514
+ }
2515
+ }
2516
+ var init_broker = __esm(() => {
2517
+ init_types2();
2518
+ });
2519
+
2520
+ // src/scripts-runtime/credential-broker/default-bindings.ts
2521
+ var DEFAULT_CREDENTIAL_BINDINGS;
2522
+ var init_default_bindings = __esm(() => {
2523
+ DEFAULT_CREDENTIAL_BINDINGS = [
2524
+ {
2525
+ configKey: "GITHUB_TOKEN",
2526
+ allowedHosts: ["api.github.com"],
2527
+ headerTemplate: "Authorization: Bearer [REDACTED:GITHUB_TOKEN]",
2528
+ scope: "global",
2529
+ scopeId: null,
2530
+ active: true,
2531
+ authKind: "config"
2532
+ }
2533
+ ];
2534
+ });
2535
+
2536
+ // src/scripts-runtime/credential-broker/fetch-patch.ts
2537
+ var init_fetch_patch = () => {};
2538
+
2539
+ // src/scripts-runtime/credential-broker/index.ts
2540
+ var init_credential_broker = __esm(() => {
2541
+ init_broker();
2542
+ init_default_bindings();
2543
+ init_fetch_patch();
2544
+ init_types2();
2545
+ });
2546
+
2547
+ // src/be/connection-bindings-blob-migration.ts
2548
+ function migrateLegacyCredentialBindingBlob(database) {
2549
+ const rows = database.prepare("SELECT id, scope, scopeId, value FROM swarm_config WHERE key = ?").all(CREDENTIAL_BINDINGS_CONFIG_KEY);
2550
+ if (rows.length === 0)
2551
+ return 0;
2552
+ const resolveLegacyOAuthProvider = (provider) => {
2553
+ const row = database.prepare(`SELECT z.id
2554
+ FROM oauth_authorizations z
2555
+ JOIN oauth_apps a ON a.id = z.appId
2556
+ WHERE a.provider = ? AND a.mcpServerId IS NULL AND z.label = 'default'
2557
+ ORDER BY a.createdAt ASC, a.id ASC
2558
+ LIMIT 1`).get(provider);
2559
+ return row?.id;
2560
+ };
2561
+ const insert = database.prepare(`INSERT OR IGNORE INTO script_credential_bindings
2562
+ (id, config_key, allowed_hosts_json, header_template, query_template, scope, scope_id,
2563
+ active, auth_kind, oauth_authorization_id, source, managed_by_connection_id,
2564
+ created_at, updated_at)
2565
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'migration', NULL,
2566
+ datetime('now'), datetime('now'))`);
2567
+ let imported = 0;
2568
+ const tx = database.transaction(() => {
2569
+ for (const config of rows) {
2570
+ let bindings;
2571
+ try {
2572
+ bindings = normalizeCredentialBindingsDocument(JSON.parse(config.value), resolveLegacyOAuthProvider, config.scope);
2573
+ } catch (err) {
2574
+ console.warn(`[credential-bindings] Skipping unparseable SCRIPT_CREDENTIAL_BINDINGS entry (config id ${config.id}, scope ${config.scope}): ${scrubSecrets(err instanceof Error ? err.message : String(err))}`);
2575
+ continue;
2576
+ }
2577
+ for (const binding of bindings) {
2578
+ const scope = binding.scope ?? config.scope;
2579
+ const scopeId = binding.scopeId ?? config.scopeId ?? null;
2580
+ insert.run(crypto.randomUUID(), binding.configKey, JSON.stringify(binding.allowedHosts), binding.headerTemplate ?? null, binding.queryTemplate ?? null, scope, scope === "global" ? null : scopeId, binding.active === false ? 0 : 1, binding.authKind, binding.oauthAuthorizationId ?? null);
2581
+ imported += 1;
2582
+ }
2583
+ }
2584
+ database.prepare("DELETE FROM swarm_config WHERE key = ?").run(CREDENTIAL_BINDINGS_CONFIG_KEY);
2585
+ });
2586
+ tx();
2587
+ console.log(`[credential-bindings] Migrated ${imported} legacy SCRIPT_CREDENTIAL_BINDINGS entr(ies) to relational rows and retired the blob key.`);
2588
+ return imported;
2589
+ }
2590
+ var init_connection_bindings_blob_migration = __esm(() => {
2591
+ init_credential_broker();
2592
+ init_secret_scrubber();
2593
+ });
2594
+
2381
2595
  // src/be/crypto/secrets-cipher.ts
2382
2596
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
2383
2597
  function assertKey(key) {
@@ -2692,6 +2906,45 @@ var init_runner = __esm(() => {
2692
2906
  ];
2693
2907
  });
2694
2908
 
2909
+ // src/be/oauth-encryption-backfill.ts
2910
+ function autoEncryptLegacyOAuthSecrets(database) {
2911
+ const apps = database.prepare(`SELECT id, clientSecret
2912
+ FROM oauth_apps
2913
+ WHERE clientSecretEncrypted = 0 AND clientSecret IS NOT NULL`).all();
2914
+ const authorizations = database.prepare(`SELECT id, accessToken, refreshToken
2915
+ FROM oauth_authorizations
2916
+ WHERE tokensEncrypted = 0`).all();
2917
+ if (apps.length === 0 && authorizations.length === 0) {
2918
+ console.log("[oauth-encryption] No plaintext OAuth secrets to migrate.");
2919
+ return { appsEncrypted: 0, authorizationsEncrypted: 0 };
2920
+ }
2921
+ const key = getEncryptionKey();
2922
+ const updateApp = database.prepare(`UPDATE oauth_apps
2923
+ SET clientSecret = ?, clientSecretEncrypted = 1,
2924
+ updatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
2925
+ WHERE id = ? AND clientSecretEncrypted = 0`);
2926
+ const updateAuthorization = database.prepare(`UPDATE oauth_authorizations
2927
+ SET accessToken = ?, refreshToken = ?, tokensEncrypted = 1,
2928
+ updatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
2929
+ WHERE id = ? AND tokensEncrypted = 0`);
2930
+ database.transaction(() => {
2931
+ for (const app of apps) {
2932
+ updateApp.run(encryptSecret(app.clientSecret, key), app.id);
2933
+ }
2934
+ for (const authorization of authorizations) {
2935
+ updateAuthorization.run(encryptSecret(authorization.accessToken, key), authorization.refreshToken == null ? null : encryptSecret(authorization.refreshToken, key), authorization.id);
2936
+ }
2937
+ })();
2938
+ console.log(`[oauth-encryption] Migrated ${apps.length} app secret(s) and ${authorizations.length} authorization token set(s).`);
2939
+ return {
2940
+ appsEncrypted: apps.length,
2941
+ authorizationsEncrypted: authorizations.length
2942
+ };
2943
+ }
2944
+ var init_oauth_encryption_backfill = __esm(() => {
2945
+ init_crypto();
2946
+ });
2947
+
2695
2948
  // src/prompts/session-templates.ts
2696
2949
  var init_session_templates = __esm(() => {
2697
2950
  init_registry();
@@ -4661,15 +4914,34 @@ function initDb(dbPath = "./agent-swarm-db.sqlite") {
4661
4914
  seedContextVersions();
4662
4915
  configureDbResolver(resolvePromptTemplate);
4663
4916
  seedDefaultTemplates();
4664
- const hasExistingEncryptedSecrets = (database.prepare("SELECT EXISTS(SELECT 1 FROM swarm_config WHERE isSecret = 1 AND encrypted = 1) as present").get()?.present ?? 0) === 1;
4917
+ const hasExistingEncryptedSecrets = (database.prepare(`SELECT EXISTS(
4918
+ SELECT 1 FROM swarm_config WHERE isSecret = 1 AND encrypted = 1
4919
+ UNION ALL
4920
+ SELECT 1 FROM oauth_apps
4921
+ WHERE clientSecretEncrypted = 1 AND clientSecret IS NOT NULL
4922
+ UNION ALL
4923
+ SELECT 1 FROM oauth_authorizations WHERE tokensEncrypted = 1
4924
+ ) AS present`).get()?.present ?? 0) === 1;
4665
4925
  const userProvidedKey = !!(process.env.SECRETS_ENCRYPTION_KEY?.length || process.env.SECRETS_ENCRYPTION_KEY_FILE?.length);
4666
4926
  resolveEncryptionKey(dbPath, { allowGenerate: !hasExistingEncryptedSecrets });
4927
+ try {
4928
+ autoEncryptLegacyOAuthSecrets(database);
4929
+ } catch (err) {
4930
+ console.error(`[oauth-encryption] FATAL: failed to auto-encrypt legacy OAuth secrets: ${err.message}`);
4931
+ throw err;
4932
+ }
4667
4933
  try {
4668
4934
  autoEncryptLegacyPlaintextSecrets(database, dbPath, { createBackup: !userProvidedKey });
4669
4935
  } catch (err) {
4670
4936
  console.error(`[secrets] FATAL: failed to auto-encrypt legacy secrets: ${err.message}`);
4671
4937
  throw err;
4672
4938
  }
4939
+ try {
4940
+ migrateLegacyCredentialBindingBlob(database);
4941
+ } catch (err) {
4942
+ console.error(`[credential-bindings] FATAL: failed to migrate legacy credential binding blob: ${err.message}`);
4943
+ throw err;
4944
+ }
4673
4945
  return db;
4674
4946
  }
4675
4947
  function getDb(path2) {
@@ -11143,9 +11415,11 @@ var init_db = __esm(() => {
11143
11415
  init_request_auth_context();
11144
11416
  init_secret_scrubber();
11145
11417
  init_asset_key_audit();
11418
+ init_connection_bindings_blob_migration();
11146
11419
  init_crypto();
11147
11420
  init_date_utils();
11148
11421
  init_runner();
11422
+ init_oauth_encryption_backfill();
11149
11423
  init_seed_prompt_templates();
11150
11424
  init_swarm_config_guard();
11151
11425
  init_task_lifecycle_events();
@@ -11243,4 +11517,4 @@ var init_db = __esm(() => {
11243
11517
  };
11244
11518
  });
11245
11519
 
11246
- export { normalizeAssetKey, parseAssetKey, canWriteAssetKey, init_key, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, initTelemetry, telemetry, init_telemetry, AssetKeySchema, AssetEntityTypeSchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, FavoriteItemTypeSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, ScheduledTaskTargetTypeSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptApiAuthModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, getCurrentRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
11520
+ export { normalizeAssetKey, parseAssetKey, canWriteAssetKey, init_key, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, initTelemetry, telemetry, init_telemetry, AssetKeySchema, AssetEntityTypeSchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, FavoriteItemTypeSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, ScheduledTaskTargetTypeSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptApiAuthModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, getCurrentRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-65anxt77.js";
7
+ } from "./cli-0ap79nha.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-rp04sjbc.js";
11
+ } from "./cli-383wyw2f.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets