@desplega.ai/agent-swarm 1.135.0 → 1.135.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.
Files changed (118) hide show
  1. package/README.md +1 -1
  2. package/dist/{actions-3fpj602h.js → actions-3az2vwwn.js} +6 -6
  3. package/dist/{anthropic-messages-706yad38.js → anthropic-messages-pm7pp23c.js} +36 -23
  4. package/dist/{app-12mwdsvg.js → app-vygnfvrh.js} +3 -3
  5. package/dist/{assistant-p87pt2b5.js → assistant-2jr2frrm.js} +8 -8
  6. package/dist/{azure-openai-responses-40z2astx.js → azure-openai-responses-cwesc845.js} +13 -4
  7. package/dist/{boot-reembed-jf6gx8yr.js → boot-reembed-ncbg16rb.js} +4 -4
  8. package/dist/{boot-reembed-vjkptm2x.js → boot-reembed-y7r9cxt0.js} +3 -3
  9. package/dist/{boot-scrub-logs-ah6bpjte.js → boot-scrub-logs-t82rwa0y.js} +2 -2
  10. package/dist/{claude-adapter-9ry59y9k.js → claude-adapter-vvx2aw3v.js} +5 -5
  11. package/dist/{claude-managed-adapter-m2v2e90a.js → claude-managed-adapter-5zr3n86v.js} +2 -2
  12. package/dist/{cli-77vf7z36.js → cli-0crn5kaz.js} +7 -16
  13. package/dist/{cli-h9gpdrzg.js → cli-0jhyxtdj.js} +2 -2
  14. package/dist/cli-0v7jxbvz.js +6724 -0
  15. package/dist/{cli-w3xch1b8.js → cli-1857msnd.js} +1 -1
  16. package/dist/{cli-y98ry8cz.js → cli-1dfatkzm.js} +1 -1
  17. package/dist/{cli-a2brkr6h.js → cli-1z01xdqh.js} +5 -5
  18. package/dist/{cli-d08xq4nz.js → cli-3f0tnh34.js} +102 -45
  19. package/dist/{cli-w4ezqgkj.js → cli-4dakdn30.js} +6 -6
  20. package/dist/{cli-10694wk0.js → cli-4rdjdddh.js} +1 -1
  21. package/dist/{cli-j2p3bfs3.js → cli-5a5nrq3g.js} +5 -5
  22. package/dist/{cli-dphm5tyw.js → cli-6290n4yz.js} +1 -1
  23. package/dist/{cli-f2tgry1v.js → cli-6bz2hzvw.js} +2 -2
  24. package/dist/{cli-bynsg176.js → cli-6mmwmy45.js} +20 -9
  25. package/dist/{cli-crkvptsz.js → cli-7ccy0h4r.js} +2 -2
  26. package/dist/{cli-wzmeara2.js → cli-83razmqg.js} +38 -12
  27. package/dist/{cli-8ca5b9j9.js → cli-8f4h27gm.js} +1 -1
  28. package/dist/{cli-vtz6yj3v.js → cli-9phjbffs.js} +1 -1
  29. package/dist/{cli-y37pxs1m.js → cli-a1zrc2g6.js} +146 -96
  30. package/dist/{cli-vd2twm2p.js → cli-cf6vq6qa.js} +1 -1
  31. package/dist/{cli-9kekm9yz.js → cli-cm4z7w7w.js} +2 -2
  32. package/dist/{cli-269pdgm4.js → cli-cv2vjg2y.js} +1 -1
  33. package/dist/{cli-3m4mkyqy.js → cli-ey09krp2.js} +1 -1
  34. package/dist/{cli-2gwpvmew.js → cli-fhsz3twr.js} +1 -171
  35. package/dist/{cli-yd6vqt1x.js → cli-fmha74ga.js} +9 -7
  36. package/dist/{cli-1gvam274.js → cli-j3xnd5b4.js} +22 -6
  37. package/dist/{cli-xmyqv00z.js → cli-j8dggbcr.js} +17 -11
  38. package/dist/{cli-p0sqfhw1.js → cli-jfrh963q.js} +14 -14
  39. package/dist/{cli-z6gdnbjy.js → cli-mfa2eaef.js} +5 -5
  40. package/dist/cli-n1q8q14d.js +177 -0
  41. package/dist/{cli-md759nb0.js → cli-nhvym0d2.js} +3 -3
  42. package/dist/{cli-prfghf4h.js → cli-qxn3g3yx.js} +72 -45
  43. package/dist/{cli-2ecesrtw.js → cli-r5vwg1ma.js} +4 -4
  44. package/dist/{cli-tv9f1kyb.js → cli-s73zwwqn.js} +97 -7
  45. package/dist/{cli-3zmdzfjf.js → cli-s9gpxh9q.js} +17 -2
  46. package/dist/{cli-1gzz6pmf.js → cli-w0ygcv43.js} +1 -1
  47. package/dist/{cli-v21nahej.js → cli-yw2z5kj9.js} +1 -1
  48. package/dist/cli.js +19 -19
  49. package/dist/{codex-adapter-6r08aepx.js → codex-adapter-6p290yq3.js} +4 -4
  50. package/dist/{codex-session-runner-9dk036pn.js → codex-session-runner-7b3dhpmx.js} +4 -4
  51. package/dist/{commands-kg7cm1jz.js → commands-wxg1g4nq.js} +2 -2
  52. package/dist/{db-g666qxpv.js → db-8fqeheve.js} +2 -2
  53. package/dist/{google-generative-ai-b0wzss55.js → google-generative-ai-6xxdj4t3.js} +20 -13
  54. package/dist/{google-vertex-e8q4dpya.js → google-vertex-zma18wb0.js} +19 -12
  55. package/dist/{handlers-58k0e9mc.js → handlers-gwtqp17c.js} +13 -10
  56. package/dist/{hook-gezxk50h.js → hook-gd9fwfp0.js} +5 -5
  57. package/dist/{hook-51ez1v2s.js → hook-mrqygs7p.js} +3 -3
  58. package/dist/{http-d4qhhnyy.js → http-x4mc1mqg.js} +50 -47
  59. package/dist/{index-c06j5e9e.js → index-2mdqrd0n.js} +10 -10
  60. package/dist/{index-kvgmhb7w.js → index-4djjkp9z.js} +9 -9
  61. package/dist/index-g9tttwkm.js +26012 -0
  62. package/dist/{index-ys39hr8t.js → index-pzgasj16.js} +11 -11
  63. package/dist/{index-h96j88n6.js → index-yd654kac.js} +9 -9
  64. package/dist/{keepalive-b6n7th6x.js → keepalive-3tycspcy.js} +4 -4
  65. package/dist/{lead-3wgc402v.js → lead-js1h3z7d.js} +30 -29
  66. package/dist/{maintenance-wr20z889.js → maintenance-y91ry8q4.js} +4 -4
  67. package/dist/{mistral-conversations-2njwdwhj.js → mistral-conversations-hdmnkf6h.js} +9 -2
  68. package/dist/{oauth-refresh-sweep-brxmpz1j.js → oauth-refresh-sweep-s33gtxrw.js} +3 -3
  69. package/dist/{onboard-88hgdp28.js → onboard-vndj64mb.js} +2 -2
  70. package/dist/{openai-codex-responses-kt84eq86.js → openai-codex-responses-xxca1qr1.js} +9 -6
  71. package/dist/{openai-completions-kasahkpq.js → openai-completions-cwy2kkzg.js} +105 -70
  72. package/dist/{openai-responses-175qgngv.js → openai-responses-e4dcwm9g.js} +10 -4
  73. package/dist/{opencode-adapter-rar9676j.js → opencode-adapter-sx38y7f7.js} +3 -3
  74. package/dist/{otel-impl-an7gh3eh.js → otel-impl-d2p84k6e.js} +4 -4
  75. package/dist/{pi-messages-txp9f97r.js → pi-messages-2d3e7egd.js} +1 -1
  76. package/dist/{pi-mono-adapter-6vmrr3g8.js → pi-mono-adapter-1phspz2y.js} +96035 -130798
  77. package/dist/{pricing-refresh-ettrct0b.js → pricing-refresh-c2bwsyk5.js} +4 -4
  78. package/dist/{rbac-roles-grtmky49.js → rbac-roles-2pedz5e9.js} +2 -2
  79. package/dist/{rbac-roles-wdwpg5fc.js → rbac-roles-reef5y2d.js} +3 -3
  80. package/dist/{registry-2g6d2p3n.js → registry-6nvn6bj0.js} +2 -1
  81. package/dist/{render-v2-k7h2sbmp.js → render-v2-zd5r5wgf.js} +3 -3
  82. package/dist/{seed-pricing-gtqxtqzc.js → seed-pricing-2kyk1vhg.js} +3 -3
  83. package/dist/{setup-3tcfqyz9.js → setup-5ys9pwyr.js} +2 -2
  84. package/dist/{worker-9tejebcv.js → worker-nb1f7k04.js} +30 -29
  85. package/openapi.json +16 -5
  86. package/package.json +6 -6
  87. package/src/be/db.ts +52 -26
  88. package/src/be/migrations/runner.ts +78 -17
  89. package/src/be/seed/agent-fs-provision.ts +37 -8
  90. package/src/http/db-query.ts +20 -5
  91. package/src/http/scripts.ts +2 -1
  92. package/src/http/task-templates.ts +1 -1
  93. package/src/http/workflow-events.ts +2 -2
  94. package/src/providers/claude-managed-models.ts +2 -12
  95. package/src/providers/pricing-sources.md +5 -5
  96. package/src/scripts-runtime/eval-harness.ts +1 -3
  97. package/src/scripts-runtime/import-allowlist.ts +7 -1
  98. package/src/slack/app.ts +9 -0
  99. package/src/slack/handlers.ts +22 -4
  100. package/src/slack/socket-mode-guard.test.ts +25 -0
  101. package/src/slack/socket-mode-guard.ts +10 -0
  102. package/src/tests/agent-fs-provision-seeder.test.ts +82 -1
  103. package/src/tests/claude-managed-adapter.test.ts +8 -16
  104. package/src/tests/db-query.test.ts +95 -0
  105. package/src/tests/docs-index-footprint.test.js +147 -0
  106. package/src/tests/fixtures/compiled-migrations-boot.ts +47 -0
  107. package/src/tests/migration-bunfs-compat.test.ts +167 -0
  108. package/src/tests/script-connections.test.ts +17 -7
  109. package/src/tests/scripts-import-allowlist.test.ts +23 -1
  110. package/src/tests/scripts-mcp-e2e.test.ts +32 -0
  111. package/src/tests/scripts-runtime-secret-egress.test.ts +33 -0
  112. package/src/tests/session-costs.test.ts +414 -0
  113. package/src/tests/slack-thread-buffer.test.ts +248 -2
  114. package/src/tests/store-progress-attachments-handler.test.ts +156 -23
  115. package/src/tests/workflow-ctx.test.ts +22 -7
  116. package/src/tools/db-query.ts +5 -4
  117. package/src/tools/store-progress.ts +83 -22
  118. package/dist/{cli-snz3p4yf.js → cli-06ghj6pe.js} +6 -6
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  SYSTEM_COLUMN_KINDS,
3
3
  listAppRecords
4
- } from "./cli-f2tgry1v.js";
4
+ } from "./cli-6bz2hzvw.js";
5
5
  import {
6
6
  getScriptApiTypes,
7
7
  getScriptMcpTypes,
8
8
  require_typescript
9
- } from "./cli-yd6vqt1x.js";
9
+ } from "./cli-fmha74ga.js";
10
10
  import {
11
11
  deleteSwarmConfigByKey,
12
12
  getAgentById,
@@ -15,7 +15,7 @@ import {
15
15
  getSwarmConfigs,
16
16
  init_db,
17
17
  upsertSwarmConfig
18
- } from "./cli-prfghf4h.js";
18
+ } from "./cli-qxn3g3yx.js";
19
19
  import {
20
20
  init_secret_scrubber,
21
21
  scrubSecrets
@@ -28,7 +28,7 @@ import {
28
28
  // src/be/seed/agent-fs-provision.ts
29
29
  init_secret_scrubber();
30
30
  init_db();
31
- import { createHash } from "node:crypto";
31
+ import { createHash, randomUUID } from "node:crypto";
32
32
  var KIND = "agent-fs-provision";
33
33
  var ITEM_KEY = "shared-org-drive";
34
34
  var PROVISION_VERSION = 1;
@@ -37,6 +37,14 @@ var DRIVE_NAME = "shared";
37
37
  var PROVISION_HASH_KEY = "AGENT_FS_PROVISION_HASH";
38
38
  var API_KEY_CONFIG = "API_AGENT_FS_API_KEY";
39
39
  var LEGACY_SHARED_KEY_CONFIG = "AGENT_FS_API_KEY";
40
+
41
+ class AgentFsRequestError extends Error {
42
+ status;
43
+ constructor(message, status) {
44
+ super(message);
45
+ this.status = status;
46
+ }
47
+ }
40
48
  var AGENT_FS_REQUEST_TIMEOUT_MS = 1e4;
41
49
  var fetchImpl = globalThis.fetch;
42
50
  var agentFsProvisionSeeder = {
@@ -127,7 +135,7 @@ async function ensureAgentFsSharedProvisioning(options) {
127
135
  await upsertSwarmConfig({ scope: "global", key, value, isSecret: false, description });
128
136
  }
129
137
  process.env.AGENT_FS_API_URL = apiUrl;
130
- const { resetFileStorageProvider } = await import("./registry-2g6d2p3n.js");
138
+ const { resetFileStorageProvider } = await import("./registry-6nvn6bj0.js");
131
139
  resetFileStorageProvider();
132
140
  return { apiUrl, apiKey, orgId, driveId, authHeaders };
133
141
  }
@@ -169,12 +177,24 @@ async function ensureAgentFsCredentialsForAgent(agentId) {
169
177
  };
170
178
  }
171
179
  const shared = await ensureAgentFsSharedProvisioning({ apiUrl });
172
- const email = await resolveAgentEmail(agentId);
173
- const registered = await agentFsRequest(apiUrl, "/auth/register", {
174
- method: "POST",
175
- body: { email },
176
- allowConflict: false
177
- });
180
+ let email = await resolveAgentEmail(agentId);
181
+ let registered;
182
+ try {
183
+ registered = await agentFsRequest(apiUrl, "/auth/register", {
184
+ method: "POST",
185
+ body: { email },
186
+ allowConflict: false
187
+ });
188
+ } catch (error) {
189
+ if (!(error instanceof AgentFsRequestError) || error.status !== 409)
190
+ throw error;
191
+ email = recoveryAgentEmail(email);
192
+ registered = await agentFsRequest(apiUrl, "/auth/register", {
193
+ method: "POST",
194
+ body: { email },
195
+ allowConflict: false
196
+ });
197
+ }
178
198
  const apiKey = registered.apiKey ?? "";
179
199
  if (!apiKey)
180
200
  throw new Error(`agent-fs registration did not return an apiKey for ${agentId}`);
@@ -279,7 +299,7 @@ async function agentFsRequest(apiUrl, path, options = {}) {
279
299
  });
280
300
  if (!response.ok && !(options.allowConflict && response.status === 409)) {
281
301
  const text = await response.text().catch(() => "");
282
- throw new Error(`agent-fs ${options.method ?? "GET"} ${path} failed: HTTP ${response.status}${text ? ` ${text}` : ""}`);
302
+ throw new AgentFsRequestError(`agent-fs ${options.method ?? "GET"} ${path} failed: HTTP ${response.status}${text ? ` ${text}` : ""}`, response.status);
283
303
  }
284
304
  return await response.json().catch(() => ({}));
285
305
  }
@@ -333,6 +353,12 @@ async function resolveAgentEmail(agentId) {
333
353
  const domain = process.env.AGENT_FS_EMAIL_DOMAIN || "swarm.local";
334
354
  return `${agentId}@${domain}`;
335
355
  }
356
+ function recoveryAgentEmail(email) {
357
+ const separator = email.lastIndexOf("@");
358
+ const localPart = separator === -1 ? email : email.slice(0, separator);
359
+ const domain = separator === -1 ? "swarm.local" : email.slice(separator + 1);
360
+ return `${localPart}+recovery-${randomUUID()}@${domain}`;
361
+ }
336
362
  function slugEmailPart(value) {
337
363
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || "swarm";
338
364
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runStopHookSessionSummarySubprocess
3
- } from "./cli-a2brkr6h.js";
3
+ } from "./cli-1z01xdqh.js";
4
4
  import {
5
5
  SessionErrorTracker,
6
6
  buildOtelTraceparentEnv,
@@ -11,7 +11,7 @@ import {
11
11
  resolveGrammarConstrainedSampling,
12
12
  resolveJsonSchemaStrictSampling,
13
13
  transformMessages
14
- } from "./cli-xmyqv00z.js";
14
+ } from "./cli-j8dggbcr.js";
15
15
  import {
16
16
  sanitizeSurrogates
17
17
  } from "./cli-y2apkfe2.js";