@desplega.ai/agent-swarm 1.123.0 → 1.124.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 (234) hide show
  1. package/README.md +2 -1
  2. package/dist/{actions-e4c9f0xy.js → actions-z3d0fk7z.js} +6 -6
  3. package/dist/{app-vmvmj2v3.js → app-q2rc9tdr.js} +4 -4
  4. package/dist/{assistant-yn7a792a.js → assistant-3stjq7fz.js} +9 -9
  5. package/dist/{boot-reembed-xg1r86h2.js → boot-reembed-5867whnb.js} +3 -3
  6. package/dist/{boot-reembed-chxty50a.js → boot-reembed-v6r1df32.js} +4 -4
  7. package/dist/{boot-scrub-logs-exwddvp5.js → boot-scrub-logs-8b8jegk3.js} +2 -2
  8. package/dist/{cli-1592nfd6.js → cli-0925phzv.js} +1 -1
  9. package/dist/{cli-hbbxmhec.js → cli-2yr6edr7.js} +4 -4
  10. package/dist/{cli-8cq4z4x7.js → cli-3z4q09tn.js} +182 -19
  11. package/dist/{cli-vz9drmce.js → cli-5jn6wnd9.js} +17 -8
  12. package/dist/{cli-5arfywtm.js → cli-5ncdb7ff.js} +19 -9
  13. package/dist/{cli-3tv9z4wx.js → cli-92bqgbgy.js} +1 -1
  14. package/dist/{cli-fjf04hpa.js → cli-dq2ssyf0.js} +48 -56
  15. package/dist/{cli-mngsj9fx.js → cli-gkvf8d83.js} +1 -1
  16. package/dist/{cli-mepk1j0t.js → cli-gzjsamwc.js} +2 -2
  17. package/dist/{cli-c9m59f83.js → cli-h89g0qrd.js} +1 -1
  18. package/dist/{cli-n8mf7x4b.js → cli-jp4mdj9d.js} +2 -2
  19. package/dist/{cli-822d4bjk.js → cli-kk58tg33.js} +7 -7
  20. package/dist/{cli-9hj1adgp.js → cli-mcez7z4p.js} +1 -1
  21. package/dist/{cli-byv3720g.js → cli-mmk5vagg.js} +2 -2
  22. package/dist/{cli-zdp11t8m.js → cli-p0ec4vv6.js} +1 -1
  23. package/dist/{cli-h2say6xk.js → cli-p0zgv8pj.js} +3 -1
  24. package/dist/{cli-8ef5ky75.js → cli-perb20ma.js} +1 -1
  25. package/dist/{cli-zkj6f2sk.js → cli-qf7acvyr.js} +90 -4
  26. package/dist/{cli-kmm1rwmp.js → cli-qwsagsmg.js} +1 -1
  27. package/dist/{cli-we91ywvy.js → cli-sqv6c9b8.js} +6 -6
  28. package/dist/{cli-np0yhmmk.js → cli-vm20sh8d.js} +3 -3
  29. package/dist/{cli-p11rf59d.js → cli-wn3m6q54.js} +3 -3
  30. package/dist/{cli-mkpf4ndf.js → cli-x268say8.js} +2976 -5621
  31. package/dist/{cli-ngbsk4yx.js → cli-y43n987v.js} +1 -1
  32. package/dist/{cli-4509mwm5.js → cli-ykthjw29.js} +8 -8
  33. package/dist/{cli-9eka6jwv.js → cli-zxb72ctk.js} +2 -2
  34. package/dist/cli.js +12 -10
  35. package/dist/{commands-sjk3zfyr.js → commands-sda76yn8.js} +2 -2
  36. package/dist/{db-2je5agjb.js → db-vn9e4rqj.js} +6 -2
  37. package/dist/{e2b-2s4psnbf.js → e2b-q345y8s4.js} +0 -4
  38. package/dist/{handlers-yzv369hf.js → handlers-xfja18ac.js} +9 -9
  39. package/dist/{hook-rfsj2r8x.js → hook-2medrp47.js} +1 -40
  40. package/dist/{http-v9rr144m.js → http-937pyjfc.js} +99 -44
  41. package/dist/{index-nr2199m6.js → index-2bqd2q9v.js} +11 -11
  42. package/dist/{index-3xtk777g.js → index-gw4en7jg.js} +9 -9
  43. package/dist/{index-c3tan44f.js → index-knqczmnm.js} +10 -10
  44. package/dist/{index-smjdc3h9.js → index-vah60vxp.js} +8 -8
  45. package/dist/{keepalive-5ds53bjd.js → keepalive-20rd6hxh.js} +5 -5
  46. package/dist/{lead-5xhez25b.js → lead-7w2k3a49.js} +21 -21
  47. package/dist/{maintenance-b43d24q6.js → maintenance-p3x918yw.js} +4 -4
  48. package/dist/{oauth-refresh-sweep-qe286vn2.js → oauth-refresh-sweep-shm0nzm4.js} +4 -4
  49. package/dist/{onboard-c4r3ds3z.js → onboard-py9dnf54.js} +6 -2
  50. package/dist/{otel-impl-nv3rjw61.js → otel-impl-7yjkfg68.js} +1 -1
  51. package/dist/{pi-mono-adapter-2syx1x4d.js → pi-mono-adapter-z6h98fva.js} +4 -38
  52. package/dist/{pricing-refresh-5ct2wp4k.js → pricing-refresh-3snb6370.js} +4 -4
  53. package/dist/{rbac-roles-m502w0qv.js → rbac-roles-5e72bbpk.js} +3 -3
  54. package/dist/{rbac-roles-b82cxpxn.js → rbac-roles-gqxdp8st.js} +4 -4
  55. package/dist/{seed-pricing-jhjphbf0.js → seed-pricing-bg42d7h2.js} +3 -3
  56. package/dist/{setup-zbaspydq.js → setup-nzk3kbbq.js} +2 -2
  57. package/dist/{worker-snvhpax5.js → worker-0p1jdzkm.js} +21 -21
  58. package/openapi.json +146 -1
  59. package/package.json +3 -1
  60. package/src/be/db.ts +81 -4
  61. package/src/be/models-catalog.ts +156 -0
  62. package/src/be/modelsdev-cache.ts +14 -1
  63. package/src/be/pricing-refresh.ts +2 -0
  64. package/src/be/scripts/typecheck.ts +17 -4
  65. package/src/be/seed-scripts/catalog/task-context-gathering.ts +1 -1
  66. package/src/commands/onboard/env-generator.ts +12 -0
  67. package/src/e2b/env.ts +0 -4
  68. package/src/hooks/hook.ts +0 -67
  69. package/src/http/all-routes.ts +1 -0
  70. package/src/http/index.ts +2 -0
  71. package/src/http/models-catalog.ts +65 -0
  72. package/src/http/workflows.ts +16 -4
  73. package/src/prompts/base-prompt.ts +8 -7
  74. package/src/prompts/session-templates.ts +106 -12
  75. package/src/providers/pi-mono-adapter.ts +12 -2
  76. package/src/providers/pi-mono-extension.ts +0 -64
  77. package/src/providers/pricing-sources.md +16 -1
  78. package/src/scripts-runtime/eval-harness.ts +18 -1
  79. package/src/scripts-runtime/swarm-sdk.ts +10 -0
  80. package/src/scripts-runtime/types/stdlib.d.ts +13 -0
  81. package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -0
  82. package/src/server-user.ts +4 -7
  83. package/src/slack/blocks.ts +21 -8
  84. package/src/slack/responses.ts +27 -51
  85. package/src/slack/watcher.ts +22 -5
  86. package/src/telemetry.ts +169 -3
  87. package/src/tests/base-prompt.test.ts +79 -0
  88. package/src/tests/mcp-tools-user.test.ts +62 -16
  89. package/src/tests/mcp-tools.test.ts +6 -3
  90. package/src/tests/memory-edit.test.ts +21 -4
  91. package/src/tests/model-groups-live-catalog.test.ts +65 -0
  92. package/src/tests/models-catalog.test.ts +119 -0
  93. package/src/tests/oauth-access-token-tool.test.ts +71 -1
  94. package/src/tests/pricing-refresh.test.ts +25 -0
  95. package/src/tests/prompt-template-session.test.ts +142 -5
  96. package/src/tests/rbac-charact-skills.test.ts +81 -14
  97. package/src/tests/script-apis-mcp.test.ts +56 -8
  98. package/src/tests/scripts-mcp-e2e.test.ts +157 -8
  99. package/src/tests/scripts-typecheck.test.ts +17 -0
  100. package/src/tests/sdk-allowlist.test.ts +34 -1
  101. package/src/tests/seed-scripts.test.ts +43 -0
  102. package/src/tests/slack-blocks.test.ts +2 -1
  103. package/src/tests/slack-inline-output.test.ts +24 -30
  104. package/src/tests/slack-watcher.test.ts +42 -0
  105. package/src/tests/steer-task-tool.test.ts +37 -8
  106. package/src/tests/steering-transport.test.ts +18 -3
  107. package/src/tests/swarm-tool-result-gate.test.ts +399 -0
  108. package/src/tests/task-tools-ctx.test.ts +49 -17
  109. package/src/tests/task-tools-ownership.test.ts +41 -13
  110. package/src/tests/telemetry-init.test.ts +376 -2
  111. package/src/tests/tool-output-agent-id.test.ts +14 -2
  112. package/src/tests/workflow-http-v2.test.ts +116 -0
  113. package/src/tools/accept-steer.ts +45 -53
  114. package/src/tools/cancel-task.ts +31 -41
  115. package/src/tools/context-diff.ts +19 -63
  116. package/src/tools/context-history.ts +22 -51
  117. package/src/tools/create-channel.ts +24 -39
  118. package/src/tools/create-metric.ts +19 -82
  119. package/src/tools/create-page.ts +20 -81
  120. package/src/tools/credential-bindings/tool.ts +125 -246
  121. package/src/tools/db-query.ts +13 -24
  122. package/src/tools/delete-channel.ts +25 -71
  123. package/src/tools/delete-page.ts +27 -75
  124. package/src/tools/get-metrics.ts +29 -22
  125. package/src/tools/get-swarm.ts +44 -15
  126. package/src/tools/get-task-details.ts +150 -32
  127. package/src/tools/get-tasks.ts +63 -29
  128. package/src/tools/inject-learning.ts +8 -38
  129. package/src/tools/join-swarm.ts +45 -47
  130. package/src/tools/kv/kv-delete.ts +13 -37
  131. package/src/tools/kv/kv-get.ts +38 -29
  132. package/src/tools/kv/kv-incr.ts +28 -56
  133. package/src/tools/kv/kv-list.ts +40 -31
  134. package/src/tools/kv/kv-set.ts +34 -76
  135. package/src/tools/list-channels.ts +24 -17
  136. package/src/tools/list-services.ts +37 -45
  137. package/src/tools/manage-user.ts +53 -66
  138. package/src/tools/mcp-servers/mcp-server-create.ts +19 -55
  139. package/src/tools/mcp-servers/mcp-server-delete.ts +9 -39
  140. package/src/tools/mcp-servers/mcp-server-get.ts +9 -35
  141. package/src/tools/mcp-servers/mcp-server-install.ts +13 -60
  142. package/src/tools/mcp-servers/mcp-server-list.ts +28 -26
  143. package/src/tools/mcp-servers/mcp-server-uninstall.ts +10 -36
  144. package/src/tools/mcp-servers/mcp-server-update.ts +13 -57
  145. package/src/tools/memory-delete.ts +16 -46
  146. package/src/tools/memory-edit.ts +48 -49
  147. package/src/tools/memory-get.ts +40 -36
  148. package/src/tools/memory-rate.ts +14 -44
  149. package/src/tools/memory-search.ts +46 -52
  150. package/src/tools/my-agent-info.ts +39 -33
  151. package/src/tools/oauth-access-token.ts +9 -24
  152. package/src/tools/poll-task.ts +50 -77
  153. package/src/tools/post-message.ts +24 -38
  154. package/src/tools/prompt-templates/delete.ts +16 -48
  155. package/src/tools/prompt-templates/get.ts +45 -42
  156. package/src/tools/prompt-templates/list.ts +29 -44
  157. package/src/tools/prompt-templates/preview.ts +14 -40
  158. package/src/tools/prompt-templates/set.ts +30 -52
  159. package/src/tools/read-messages.ts +45 -54
  160. package/src/tools/register-agentmail-inbox.ts +28 -84
  161. package/src/tools/register-kapso-number.ts +20 -50
  162. package/src/tools/register-service.ts +36 -44
  163. package/src/tools/repos/get-repos.ts +29 -21
  164. package/src/tools/repos/update-repo.ts +30 -27
  165. package/src/tools/request-human-input.ts +10 -33
  166. package/src/tools/resolve-user.ts +59 -16
  167. package/src/tools/schedules/create-schedule.ts +58 -173
  168. package/src/tools/schedules/delete-schedule.ts +16 -56
  169. package/src/tools/schedules/list-schedules.ts +41 -67
  170. package/src/tools/schedules/patch-schedule.ts +57 -153
  171. package/src/tools/schedules/run-schedule-now.ts +18 -59
  172. package/src/tools/schedules/update-schedule.ts +57 -153
  173. package/src/tools/script-apis.ts +46 -28
  174. package/src/tools/script-common.ts +129 -34
  175. package/src/tools/script-connections/tool.ts +59 -154
  176. package/src/tools/script-query-types.ts +43 -3
  177. package/src/tools/script-run.ts +41 -2
  178. package/src/tools/script-runs.ts +69 -1
  179. package/src/tools/script-search.ts +24 -1
  180. package/src/tools/script-upsert.ts +18 -3
  181. package/src/tools/send-task.ts +32 -81
  182. package/src/tools/skills/skill-create.ts +14 -39
  183. package/src/tools/skills/skill-delete.ts +14 -42
  184. package/src/tools/skills/skill-get-file.ts +10 -43
  185. package/src/tools/skills/skill-get.ts +9 -32
  186. package/src/tools/skills/skill-install-remote.ts +16 -52
  187. package/src/tools/skills/skill-install.ts +14 -52
  188. package/src/tools/skills/skill-list.ts +24 -26
  189. package/src/tools/skills/skill-publish.ts +18 -54
  190. package/src/tools/skills/skill-search.ts +21 -18
  191. package/src/tools/skills/skill-sync-remote.ts +12 -24
  192. package/src/tools/skills/skill-uninstall.ts +10 -26
  193. package/src/tools/skills/skill-update.ts +24 -81
  194. package/src/tools/slack-delete.ts +8 -32
  195. package/src/tools/slack-download-file.ts +17 -57
  196. package/src/tools/slack-list-channels.ts +16 -43
  197. package/src/tools/slack-post.ts +11 -40
  198. package/src/tools/slack-read.ts +33 -103
  199. package/src/tools/slack-reply.ts +16 -53
  200. package/src/tools/slack-start-thread.ts +14 -55
  201. package/src/tools/slack-update.ts +8 -35
  202. package/src/tools/slack-upload-file.ts +22 -122
  203. package/src/tools/steer-task.ts +22 -35
  204. package/src/tools/store-progress.ts +11 -26
  205. package/src/tools/swarm-config/delete-config.ts +19 -57
  206. package/src/tools/swarm-config/get-config.ts +36 -44
  207. package/src/tools/swarm-config/list-config.ts +36 -44
  208. package/src/tools/swarm-config/set-config.ts +35 -73
  209. package/src/tools/swarm-x.ts +20 -26
  210. package/src/tools/task-action.ts +26 -46
  211. package/src/tools/task-tool-ctx.ts +5 -13
  212. package/src/tools/tracker/tracker-link-task.ts +8 -22
  213. package/src/tools/tracker/tracker-map-agent.ts +8 -22
  214. package/src/tools/tracker/tracker-status.ts +27 -19
  215. package/src/tools/tracker/tracker-sync-status.ts +8 -18
  216. package/src/tools/tracker/tracker-unlink.ts +4 -16
  217. package/src/tools/unregister-service.ts +19 -59
  218. package/src/tools/update-profile.ts +60 -100
  219. package/src/tools/update-service-status.ts +42 -67
  220. package/src/tools/utils.ts +189 -8
  221. package/src/tools/whatsapp-message.ts +19 -32
  222. package/src/tools/workflows/cancel-workflow-run.ts +4 -16
  223. package/src/tools/workflows/create-workflow.ts +9 -38
  224. package/src/tools/workflows/delete-workflow.ts +5 -17
  225. package/src/tools/workflows/get-workflow-run.ts +41 -31
  226. package/src/tools/workflows/get-workflow.ts +10 -21
  227. package/src/tools/workflows/list-workflow-runs.ts +107 -34
  228. package/src/tools/workflows/list-workflows.ts +5 -17
  229. package/src/tools/workflows/patch-workflow-node.ts +11 -39
  230. package/src/tools/workflows/patch-workflow.ts +11 -36
  231. package/src/tools/workflows/retry-workflow-run.ts +4 -16
  232. package/src/tools/workflows/trigger-workflow.ts +22 -58
  233. package/src/tools/workflows/update-workflow.ts +10 -42
  234. package/templates/skills/swarm-scripts/SKILL.md +1 -1
@@ -185,13 +185,23 @@ var MAX_VISIBLE_CHILDREN = 8;
185
185
  var MAX_OUTPUT_LENGTH = 120;
186
186
  function truncateOutput(text) {
187
187
  const sentenceEnd = text.search(/\.\s/);
188
- const firstSentence = sentenceEnd !== -1 ? text.slice(0, sentenceEnd + 1) : text;
189
- if (firstSentence.length <= MAX_OUTPUT_LENGTH)
190
- return firstSentence;
191
- const boundary = text.lastIndexOf(" ", MAX_OUTPUT_LENGTH);
192
- const cut = boundary >= MAX_OUTPUT_LENGTH / 2 ? boundary : MAX_OUTPUT_LENGTH;
188
+ const sentenceCut = sentenceEnd !== -1 ? sentenceEnd + 1 : text.length;
189
+ if (sentenceCut === text.length && text.length <= MAX_OUTPUT_LENGTH) {
190
+ return { text, truncated: false };
191
+ }
192
+ let cut = Math.min(sentenceCut, MAX_OUTPUT_LENGTH);
193
+ if (cut === MAX_OUTPUT_LENGTH) {
194
+ const boundary = text.lastIndexOf(" ", MAX_OUTPUT_LENGTH);
195
+ cut = boundary >= MAX_OUTPUT_LENGTH / 2 ? boundary : MAX_OUTPUT_LENGTH;
196
+ }
193
197
  const omitted = text.length - cut;
194
- return `${text.slice(0, cut).trimEnd()}… (${omitted} more chars; full output in thread)`;
198
+ return {
199
+ text: `${text.slice(0, cut).trimEnd()}… (${omitted} more chars; open task for full output)`,
200
+ truncated: true
201
+ };
202
+ }
203
+ function isTreeOutputTruncated(text) {
204
+ return truncateOutput(text).truncated;
195
205
  }
196
206
  function renderNodeLine(node) {
197
207
  const icon = STATUS_ICON[node.status] ?? "•";
@@ -212,7 +222,7 @@ function renderChildDetail(node, indent) {
212
222
  lines.push(`${indent}${node.progress}`);
213
223
  }
214
224
  if (node.status === "completed" && !node.slackReplySent && node.output) {
215
- lines.push(`${indent}${truncateOutput(markdownToSlack(node.output))}`);
225
+ lines.push(`${indent}${truncateOutput(markdownToSlack(node.output)).text}`);
216
226
  }
217
227
  return lines;
218
228
  }
@@ -227,7 +237,7 @@ function renderTree(root) {
227
237
  lines.push(` Error: ${root.failureReason}`);
228
238
  }
229
239
  if (root.status === "completed" && !root.slackReplySent && root.output) {
230
- lines.push(` ${truncateOutput(markdownToSlack(root.output))}`);
240
+ lines.push(` ${truncateOutput(markdownToSlack(root.output)).text}`);
231
241
  }
232
242
  return lines.join(`
233
243
  `);
@@ -296,4 +306,4 @@ function buildTreeBlocks(roots) {
296
306
  return blocks;
297
307
  }
298
308
 
299
- export { getTaskLink, markdownToSlack, splitSlackSectionText, formatAttachmentsBlockForSlack, formatDuration, buildCompletedBlocks, buildCompletedBlockBatches, buildFailedBlocks, buildProgressBlocks, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks };
309
+ export { getTaskLink, markdownToSlack, splitSlackSectionText, formatAttachmentsBlockForSlack, formatDuration, buildCompletedBlocks, buildCompletedBlockBatches, buildFailedBlocks, buildProgressBlocks, buildCancelledBlocks, buildBufferFlushBlocks, isTreeOutputTruncated, buildTreeBlocks };
@@ -5,7 +5,7 @@ import {
5
5
  init_db,
6
6
  init_env_flag,
7
7
  isEnvFlagEnabled
8
- } from "./cli-8cq4z4x7.js";
8
+ } from "./cli-3z4q09tn.js";
9
9
 
10
10
  // src/slack/router.ts
11
11
  init_db();
@@ -15,9 +15,10 @@ import {
15
15
  formatAttachmentsBlockForSlack,
16
16
  formatDuration,
17
17
  getTaskLink,
18
+ isTreeOutputTruncated,
18
19
  markdownToSlack,
19
20
  splitSlackSectionText
20
- } from "./cli-5arfywtm.js";
21
+ } from "./cli-5ncdb7ff.js";
21
22
  import {
22
23
  getAgentById,
23
24
  getChildTasks,
@@ -27,8 +28,9 @@ import {
27
28
  getTaskAttachments,
28
29
  getTaskById,
29
30
  init_db,
31
+ markTaskSlackReplySent,
30
32
  setSlackMessageTracking
31
- } from "./cli-8cq4z4x7.js";
33
+ } from "./cli-3z4q09tn.js";
32
34
  import {
33
35
  require_receiver,
34
36
  require_sender,
@@ -54215,20 +54217,11 @@ function classifySlackUpdateError(error) {
54215
54217
  return "failed";
54216
54218
  }
54217
54219
  var isDev = process.env.ENV === "development";
54218
- var MIN_INLINE_OUTPUT_LENGTH = 20;
54219
- var MAX_INLINE_OUTPUT_MESSAGE_LENGTH = 4000;
54220
- var INLINE_OUTPUT_FALLBACKS = new Set([
54221
- "done",
54222
- "completed",
54223
- "complete",
54224
- "task completed",
54225
- "process completed successfully",
54226
- "process completed successfully (no output captured)"
54227
- ]);
54220
+ var MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE = 10;
54228
54221
  function getAgentDisplayName(agent) {
54229
54222
  return isDev ? `(dev) ${agent.name}` : agent.name;
54230
54223
  }
54231
- function shouldPostInlineCompletionOutput(task, attachments) {
54224
+ function shouldPostInlineCompletionOutput(task) {
54232
54225
  if (task.status !== "completed")
54233
54226
  return false;
54234
54227
  if (!task.slackChannelId || !task.slackThreadTs)
@@ -54236,34 +54229,14 @@ function shouldPostInlineCompletionOutput(task, attachments) {
54236
54229
  if (task.slackReplySent)
54237
54230
  return false;
54238
54231
  const output = task.output?.trim();
54239
- if (!output || output.length < MIN_INLINE_OUTPUT_LENGTH)
54240
- return false;
54241
- if (INLINE_OUTPUT_FALLBACKS.has(output.toLowerCase()))
54242
- return false;
54243
- return !attachments.some((attachment) => attachment.isPrimary);
54232
+ return !!output && isTreeOutputTruncated(markdownToSlack(output));
54244
54233
  }
54245
- function formatInlineCompletionOutputText(opts) {
54234
+ function formatInlineCompletionOutputChunks(opts) {
54246
54235
  const header = `✅ *${opts.agentName}* completed with output (${getTaskLink(opts.taskId)}):
54247
54236
 
54248
54237
  `;
54249
- const tail = `
54250
-
54251
- …(full output in task ${getTaskLink(opts.taskId)})`;
54252
54238
  const slackOutput = markdownToSlack(opts.output.trim());
54253
- const maxBodyLength = MAX_INLINE_OUTPUT_MESSAGE_LENGTH - header.length;
54254
- if (slackOutput.length <= maxBodyLength) {
54255
- return header + slackOutput;
54256
- }
54257
- const maxTruncatedBodyLength = Math.max(0, maxBodyLength - tail.length);
54258
- let cut = slackOutput.lastIndexOf(`
54259
- `, maxTruncatedBodyLength);
54260
- if (cut < maxTruncatedBodyLength / 2) {
54261
- cut = slackOutput.lastIndexOf(" ", maxTruncatedBodyLength);
54262
- }
54263
- if (cut < maxTruncatedBodyLength / 2) {
54264
- cut = maxTruncatedBodyLength;
54265
- }
54266
- return header + slackOutput.slice(0, cut).trimEnd() + tail;
54239
+ return splitSlackSectionText(header + slackOutput);
54267
54240
  }
54268
54241
  async function sendInlineTaskOutput(task) {
54269
54242
  const app = getSlackApp();
@@ -54275,23 +54248,29 @@ async function sendInlineTaskOutput(task) {
54275
54248
  console.error(`[Slack] Agent not found for task ${task.id}`);
54276
54249
  return false;
54277
54250
  }
54278
- const text = formatInlineCompletionOutputText({
54251
+ const chunks = formatInlineCompletionOutputChunks({
54279
54252
  agentName: agent.name,
54280
54253
  taskId: task.id,
54281
54254
  output: task.output
54282
54255
  });
54283
54256
  try {
54284
- await sendWithPersona(app.client, {
54285
- channel: task.slackChannelId,
54286
- thread_ts: task.slackThreadTs,
54287
- text,
54288
- username: getAgentDisplayName(agent),
54289
- icon_emoji: getAgentEmoji(agent),
54290
- blocks: splitSlackSectionText(text).map((chunk) => ({
54291
- type: "section",
54292
- text: { type: "mrkdwn", text: chunk }
54293
- }))
54294
- });
54257
+ for (let i = 0;i < chunks.length; i += MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE) {
54258
+ const batch = chunks.slice(i, i + MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE);
54259
+ await sendWithPersona(app.client, {
54260
+ channel: task.slackChannelId,
54261
+ thread_ts: task.slackThreadTs,
54262
+ text: batch.join(`
54263
+
54264
+ `),
54265
+ username: getAgentDisplayName(agent),
54266
+ icon_emoji: getAgentEmoji(agent),
54267
+ blocks: batch.map((chunk) => ({
54268
+ type: "section",
54269
+ text: { type: "mrkdwn", text: chunk }
54270
+ }))
54271
+ });
54272
+ }
54273
+ markTaskSlackReplySent(task.id);
54295
54274
  return true;
54296
54275
  } catch (error) {
54297
54276
  console.error(`[Slack] Failed to send inline output for task ${task.id}:`, error);
@@ -54676,6 +54655,20 @@ async function processTreeMessages() {
54676
54655
  if (nodes.length === 0)
54677
54656
  continue;
54678
54657
  const fullyTerminal = isTreeFullyTerminal(nodes);
54658
+ let outputDeliverySucceeded = true;
54659
+ for (const node of nodes.flatMap((root) => [root, ...root.children])) {
54660
+ const task = getTaskById(node.taskId);
54661
+ if (!task || !shouldPostInlineCompletionOutput(task))
54662
+ continue;
54663
+ const sent = await sendInlineTaskOutput(task);
54664
+ if (sent) {
54665
+ node.slackReplySent = true;
54666
+ notifiedCompletions.set(task.id, now);
54667
+ console.log(`[Slack] Sent full output for tree-tracked completion ${task.id.slice(0, 8)}`);
54668
+ } else {
54669
+ outputDeliverySucceeded = false;
54670
+ }
54671
+ }
54679
54672
  let blocks;
54680
54673
  try {
54681
54674
  blocks = buildTreeBlocks(nodes);
@@ -54686,7 +54679,7 @@ async function processTreeMessages() {
54686
54679
  const serialized = JSON.stringify(blocks);
54687
54680
  const lastSerialized = lastRenderedTree.get(messageTs);
54688
54681
  if (serialized === lastSerialized) {
54689
- if (fullyTerminal) {
54682
+ if (fullyTerminal && outputDeliverySucceeded) {
54690
54683
  cleanupCompletedTree(messageTs, tree, nodes);
54691
54684
  }
54692
54685
  continue;
@@ -54727,7 +54720,7 @@ async function processTreeMessages() {
54727
54720
  if (isDMChannel(tree.channelId) && fullyTerminal) {
54728
54721
  setAssistantStatus(tree.channelId, tree.threadTs, "").catch((error) => console.error(`[Slack] Failed to clear DM assistant status for tree ${messageTs}:`, error));
54729
54722
  }
54730
- if (fullyTerminal && success) {
54723
+ if (fullyTerminal && success && outputDeliverySucceeded) {
54731
54724
  cleanupCompletedTree(messageTs, tree, nodes);
54732
54725
  }
54733
54726
  }
@@ -54991,8 +54984,7 @@ function startTaskWatcher(intervalMs = 3000) {
54991
54984
  if (lastSent && now2 - lastSent < MIN_SEND_INTERVAL)
54992
54985
  continue;
54993
54986
  if (taskToTree.has(task.id)) {
54994
- const attachments = task.status === "completed" ? getTaskAttachments(task.id) : [];
54995
- if (!shouldPostInlineCompletionOutput(task, attachments)) {
54987
+ if (!shouldPostInlineCompletionOutput(task)) {
54996
54988
  notifiedCompletions.set(task.id, now2);
54997
54989
  continue;
54998
54990
  }
@@ -55078,13 +55070,13 @@ async function initSlackApp() {
55078
55070
  socketMode: true,
55079
55071
  logLevel: import_bolt.LogLevel.DEBUG
55080
55072
  });
55081
- const { registerMessageHandler } = await import("./handlers-yzv369hf.js");
55082
- const { registerCommandHandler } = await import("./commands-sjk3zfyr.js");
55083
- const { registerActionHandlers } = await import("./actions-e4c9f0xy.js");
55073
+ const { registerMessageHandler } = await import("./handlers-xfja18ac.js");
55074
+ const { registerCommandHandler } = await import("./commands-sda76yn8.js");
55075
+ const { registerActionHandlers } = await import("./actions-z3d0fk7z.js");
55084
55076
  registerMessageHandler(app);
55085
55077
  registerCommandHandler(app);
55086
55078
  registerActionHandlers(app);
55087
- const { createAssistant } = await import("./assistant-yn7a792a.js");
55079
+ const { createAssistant } = await import("./assistant-3stjq7fz.js");
55088
55080
  app.assistant(createAssistant());
55089
55081
  return app;
55090
55082
  }
@@ -20,7 +20,7 @@ import {
20
20
  isEnvFlagEnabled,
21
21
  normalizeDateRequired,
22
22
  resolveTemplate
23
- } from "./cli-8cq4z4x7.js";
23
+ } from "./cli-3z4q09tn.js";
24
24
 
25
25
  // src/be/db-queries/tracker.ts
26
26
  init_date_utils();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-8cq4z4x7.js";
4
+ } from "./cli-3z4q09tn.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -195,4 +195,4 @@ function seedPricingFromModelsDev(opts) {
195
195
  return { inserted, modelsdevFound: !!cache };
196
196
  }
197
197
 
198
- export { normalizeModelKey, buildModelsDevSeedRows, seedPricingFromModelsDev };
198
+ export { loadModelsDevCache, normalizeModelKey, buildModelsDevSeedRows, seedPricingFromModelsDev };
@@ -11,7 +11,7 @@ import {
11
11
  markAuthorizationRefreshFailed,
12
12
  releaseOAuthRefreshLock,
13
13
  updateAuthorizationTokens
14
- } from "./cli-9hj1adgp.js";
14
+ } from "./cli-mcez7z4p.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  registerVolatileSecret,
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-1592nfd6.js";
7
+ } from "./cli-0925phzv.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-8cq4z4x7.js";
12
+ } from "./cli-3z4q09tn.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  ensureAuthorizationTokenOrThrow,
9
9
  oauthAppRowToProviderConfig
10
- } from "./cli-c9m59f83.js";
10
+ } from "./cli-h89g0qrd.js";
11
11
  import {
12
12
  getScript,
13
13
  getScriptApiConnectionDescriptors,
@@ -15,15 +15,15 @@ import {
15
15
  getScriptVersion,
16
16
  listRelationalCredentialBindings,
17
17
  validateScriptImports
18
- } from "./cli-p11rf59d.js";
18
+ } from "./cli-wn3m6q54.js";
19
19
  import {
20
20
  getAuthorizationById,
21
21
  getOAuthApp,
22
22
  getOAuthAppById
23
- } from "./cli-9hj1adgp.js";
23
+ } from "./cli-mcez7z4p.js";
24
24
  import {
25
25
  withSiblingAwareness
26
- } from "./cli-kmm1rwmp.js";
26
+ } from "./cli-qwsagsmg.js";
27
27
  import {
28
28
  getAppUrl
29
29
  } from "./cli-dh55d5fg.js";
@@ -77,7 +77,7 @@ import {
77
77
  updateWorkflowRun,
78
78
  updateWorkflowRunStep,
79
79
  workflowContextKey
80
- } from "./cli-8cq4z4x7.js";
80
+ } from "./cli-3z4q09tn.js";
81
81
  import {
82
82
  init_secret_scrubber,
83
83
  isSensitiveKey,
@@ -2627,7 +2627,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
2627
2627
  }
2628
2628
  if (notification.channel === "slack") {
2629
2629
  try {
2630
- const { getSlackApp } = await import("./app-vmvmj2v3.js");
2630
+ const { getSlackApp } = await import("./app-q2rc9tdr.js");
2631
2631
  const slackApp = getSlackApp();
2632
2632
  if (!slackApp) {
2633
2633
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -2741,7 +2741,7 @@ class NotifyExecutor extends BaseExecutor {
2741
2741
  }
2742
2742
  }
2743
2743
  case "slack": {
2744
- const { getSlackApp } = await import("./app-vmvmj2v3.js");
2744
+ const { getSlackApp } = await import("./app-q2rc9tdr.js");
2745
2745
  const app = getSlackApp();
2746
2746
  if (!app) {
2747
2747
  return {
@@ -7,7 +7,7 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-8cq4z4x7.js";
10
+ } from "./cli-3z4q09tn.js";
11
11
 
12
12
  // src/be/db-queries/oauth.ts
13
13
  init_crypto();
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-zdp11t8m.js";
7
+ } from "./cli-p0ec4vv6.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-8cq4z4x7.js";
11
+ } from "./cli-3z4q09tn.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -6,7 +6,7 @@ import {
6
6
  getDb,
7
7
  init_db,
8
8
  isSqliteVecAvailable
9
- } from "./cli-8cq4z4x7.js";
9
+ } from "./cli-3z4q09tn.js";
10
10
  import {
11
11
  __esm,
12
12
  __export,
@@ -7,7 +7,7 @@ var package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  name: "@desplega.ai/agent-swarm",
10
- version: "1.123.0",
10
+ version: "1.124.0",
11
11
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
12
12
  license: "MIT",
13
13
  author: "desplega.sh <contact@desplega.sh>",
@@ -106,7 +106,9 @@ var init_package = __esm(() => {
106
106
  format: "biome format --write src",
107
107
  "build:binary": "bun build ./src/cli.tsx --compile --compile-exec-argv='--expose-gc' --target=bun-linux-x64 --outfile ./dist/agent-swarm",
108
108
  "build:binary:arm64": "bun build ./src/cli.tsx --compile --compile-exec-argv='--expose-gc' --target=bun-linux-arm64 --outfile ./dist/agent-swarm",
109
+ "docker:build:api": "docker build -f Dockerfile -t agent-swarm-api:latest .",
109
110
  "docker:build:worker": "docker build -f Dockerfile.worker -t agent-swarm-worker:latest .",
111
+ "docker:build:worker:slim": "docker build -f Dockerfile.worker --target worker-slim -t agent-swarm-worker:slim .",
110
112
  "docker:run:worker": "docker run --rm -it --env-file .env.docker -p 3202:3000 -v ./logs:/logs -v ./work/shared:/workspace/shared -v ./work/worker-1:/workspace/personal agent-swarm-worker:latest",
111
113
  "docker:run:lead": "docker run --rm -it --env-file .env.docker-lead -e AGENT_ROLE=lead -p 3201:3000 -v ./logs:/logs -v ./work/shared:/workspace/shared -v ./work/lead:/workspace/personal agent-swarm-worker:latest",
112
114
  "deploy:install": "bun deploy/install.ts",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-h2say6xk.js";
4
+ } from "./cli-p0zgv8pj.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();
@@ -1,13 +1,14 @@
1
1
  import {
2
- buildModelsDevSeedRows
3
- } from "./cli-mepk1j0t.js";
2
+ buildModelsDevSeedRows,
3
+ loadModelsDevCache
4
+ } from "./cli-gzjsamwc.js";
4
5
  import {
5
6
  createLogEntry,
6
7
  getActivePricingRow,
7
8
  getDb,
8
9
  init_db,
9
10
  insertPricingRow
10
- } from "./cli-8cq4z4x7.js";
11
+ } from "./cli-3z4q09tn.js";
11
12
  import {
12
13
  init_secret_scrubber,
13
14
  scrubSecrets
@@ -16,6 +17,90 @@ import {
16
17
  // src/be/pricing-refresh.ts
17
18
  init_secret_scrubber();
18
19
  init_db();
20
+
21
+ // src/be/models-catalog.ts
22
+ var CATALOG_PROVIDER_IDS = [
23
+ "openrouter",
24
+ "anthropic",
25
+ "openai",
26
+ "amazon-bedrock"
27
+ ];
28
+ var PINNED_MODELSDEV_ENTRIES = [
29
+ "anthropic/claude-mythos-5",
30
+ "anthropic/claude-sonnet-5",
31
+ "amazon-bedrock/anthropic.claude-sonnet-5"
32
+ ];
33
+ function slimModel(modelKey, model) {
34
+ const reasoningOptions = Array.isArray(model.reasoning_options) ? model.reasoning_options.filter((o) => typeof o.type === "string").map((o) => ({
35
+ type: o.type,
36
+ ...Array.isArray(o.values) ? { values: o.values } : {}
37
+ })) : [];
38
+ return {
39
+ id: model.id ?? modelKey,
40
+ ...model.name !== undefined ? { name: model.name } : {},
41
+ ...model.cost !== undefined ? { cost: { input: model.cost.input, output: model.cost.output } } : {},
42
+ ...model.limit?.context !== undefined ? { limit: { context: model.limit.context } } : {},
43
+ ...model.reasoning !== undefined ? { reasoning: model.reasoning } : {},
44
+ ...reasoningOptions.length > 0 ? { reasoning_options: reasoningOptions } : {}
45
+ };
46
+ }
47
+ function buildModelsCatalog(cache) {
48
+ const catalog = {};
49
+ for (const providerId of CATALOG_PROVIDER_IDS) {
50
+ const provider = cache[providerId];
51
+ if (!provider?.models)
52
+ continue;
53
+ const models = {};
54
+ for (const [modelKey, model] of Object.entries(provider.models)) {
55
+ models[modelKey] = slimModel(modelKey, model);
56
+ }
57
+ catalog[providerId] = {
58
+ id: provider.id ?? providerId,
59
+ ...provider.name !== undefined ? { name: provider.name } : {},
60
+ models
61
+ };
62
+ }
63
+ return catalog;
64
+ }
65
+ var liveCatalog = null;
66
+ var liveUpdatedAt = null;
67
+ var snapshotCatalog;
68
+ function bundledSnapshotCatalog() {
69
+ if (snapshotCatalog === undefined) {
70
+ const raw = loadModelsDevCache();
71
+ snapshotCatalog = raw ? buildModelsCatalog(raw) : null;
72
+ }
73
+ return snapshotCatalog ?? {};
74
+ }
75
+ function mergePinnedEntries(catalog) {
76
+ const snapshot = bundledSnapshotCatalog();
77
+ for (const entryPath of PINNED_MODELSDEV_ENTRIES) {
78
+ const slashIndex = entryPath.indexOf("/");
79
+ const providerId = entryPath.slice(0, slashIndex);
80
+ const modelId = entryPath.slice(slashIndex + 1);
81
+ if (catalog[providerId]?.models[modelId])
82
+ continue;
83
+ const pinned = snapshot[providerId]?.models[modelId];
84
+ if (!pinned)
85
+ continue;
86
+ catalog[providerId] ??= { id: providerId, models: {} };
87
+ catalog[providerId].models[modelId] = pinned;
88
+ }
89
+ }
90
+ function updateLiveModelsCatalog(cache, now = Date.now()) {
91
+ const catalog = buildModelsCatalog(cache);
92
+ mergePinnedEntries(catalog);
93
+ liveCatalog = catalog;
94
+ liveUpdatedAt = now;
95
+ }
96
+ function getModelsCatalog() {
97
+ if (liveCatalog) {
98
+ return { source: "live", updatedAt: liveUpdatedAt, providers: liveCatalog };
99
+ }
100
+ return { source: "snapshot", updatedAt: null, providers: bundledSnapshotCatalog() };
101
+ }
102
+
103
+ // src/be/pricing-refresh.ts
19
104
  var MODELSDEV_API_URL = "https://models.dev/api.json";
20
105
  var PRICING_REFRESH_INTERVAL_MS = 12 * 60 * 60 * 1000;
21
106
  var lastETag = null;
@@ -116,6 +201,7 @@ async function refreshPricingFromModelsDev(opts = {}) {
116
201
  }
117
202
  const cache = await response.json();
118
203
  const etag = response.headers.get("etag");
204
+ updateLiveModelsCatalog(cache, now);
119
205
  const rows = buildModelsDevSeedRows(cache);
120
206
  const { inserted, unchanged } = insertChangedPricingRows(rows, now);
121
207
  const pruned = prunePricingHistory(2);
@@ -151,4 +237,4 @@ function startPricingRefreshLoop() {
151
237
  interval.unref?.();
152
238
  }
153
239
 
154
- export { PRICING_REFRESH_INTERVAL_MS, refreshPricingFromModelsDev, startPricingRefreshLoop };
240
+ export { getModelsCatalog, PRICING_REFRESH_INTERVAL_MS, refreshPricingFromModelsDev, startPricingRefreshLoop };
@@ -3,7 +3,7 @@ import {
3
3
  getAgentById,
4
4
  getInProgressTasksByContextKey,
5
5
  init_db
6
- } from "./cli-8cq4z4x7.js";
6
+ } from "./cli-3z4q09tn.js";
7
7
 
8
8
  // src/tasks/sibling-awareness.ts
9
9
  init_db();
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-3tv9z4wx.js";
4
+ } from "./cli-92bqgbgy.js";
5
5
  import {
6
6
  rewriteSlackMentions
7
- } from "./cli-n8mf7x4b.js";
7
+ } from "./cli-jp4mdj9d.js";
8
8
  import {
9
9
  createTaskWithSiblingAwareness
10
- } from "./cli-kmm1rwmp.js";
10
+ } from "./cli-qwsagsmg.js";
11
11
  import {
12
12
  getSlackApp,
13
13
  registerTreeMessage
14
- } from "./cli-fjf04hpa.js";
14
+ } from "./cli-dq2ssyf0.js";
15
15
  import {
16
16
  buildBufferFlushBlocks
17
- } from "./cli-5arfywtm.js";
17
+ } from "./cli-5ncdb7ff.js";
18
18
  import {
19
19
  getLatestActiveTaskInThread,
20
20
  getLatestLeadTaskInThread,
@@ -29,7 +29,7 @@ import {
29
29
  registerTemplate,
30
30
  requestSteering,
31
31
  slackContextKey
32
- } from "./cli-8cq4z4x7.js";
32
+ } from "./cli-3z4q09tn.js";
33
33
 
34
34
  // src/slack/event-dedup.ts
35
35
  var DEFAULT_TTL_MS = 300000;
@@ -7,11 +7,11 @@ import {
7
7
  getPinCandidateAgent,
8
8
  getResumeGeneration,
9
9
  repointTrackerSyncBySwarmId
10
- } from "./cli-mngsj9fx.js";
10
+ } from "./cli-gkvf8d83.js";
11
11
  import {
12
12
  getExecutorRegistry,
13
13
  recoverIncompleteRuns
14
- } from "./cli-822d4bjk.js";
14
+ } from "./cli-kk58tg33.js";
15
15
  import {
16
16
  MAX_EMPTY_POLLS,
17
17
  assignUnassignedTaskPending,
@@ -55,7 +55,7 @@ import {
55
55
  resolveTemplate,
56
56
  supersedeTask,
57
57
  updateAgentStatus
58
- } from "./cli-8cq4z4x7.js";
58
+ } from "./cli-3z4q09tn.js";
59
59
  import {
60
60
  init_secret_scrubber,
61
61
  scrubSecrets
@@ -3,7 +3,7 @@ import {
3
3
  } from "./cli-jkhwmmgg.js";
4
4
  import {
5
5
  embedScript
6
- } from "./cli-byv3720g.js";
6
+ } from "./cli-mmk5vagg.js";
7
7
  import {
8
8
  calculatePKCECodeChallenge,
9
9
  generateRandomCodeVerifier,
@@ -12,7 +12,7 @@ import {
12
12
  getOAuthAppById,
13
13
  updateAuthorizationTokens,
14
14
  upsertAuthorization
15
- } from "./cli-9hj1adgp.js";
15
+ } from "./cli-mcez7z4p.js";
16
16
  import {
17
17
  computeContentHash,
18
18
  decryptSecret,
@@ -30,7 +30,7 @@ import {
30
30
  normalizeDateRequired,
31
31
  placeholderForConfigKey,
32
32
  upsertSwarmConfig
33
- } from "./cli-8cq4z4x7.js";
33
+ } from "./cli-3z4q09tn.js";
34
34
  import {
35
35
  init_secret_scrubber,
36
36
  refreshSecretScrubberCache,