@desplega.ai/agent-swarm 1.152.2 → 1.154.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 (284) hide show
  1. package/README.md +2 -2
  2. package/dist/{acp-adapter-pfeje2v5.js → acp-adapter-eb2aj8xy.js} +4 -4
  3. package/dist/{actions-0sttc7f5.js → actions-kpnwp1kz.js} +31 -27
  4. package/dist/{anthropic-messages-2y8nktar.js → anthropic-messages-9vqsbznt.js} +112 -84
  5. package/dist/{app-p8teva95.js → app-zk1apkf6.js} +10 -7
  6. package/dist/{assistant-r45jnsrt.js → assistant-kwq4y50q.js} +32 -28
  7. package/dist/{azure-openai-responses-f38x2avq.js → azure-openai-responses-04qwdwfq.js} +27 -13
  8. package/dist/{boot-reembed-je26h5y7.js → boot-reembed-22hd3jjn.js} +9 -7
  9. package/dist/{boot-reembed-1qmybsd4.js → boot-reembed-qe168424.js} +10 -8
  10. package/dist/{boot-scrub-logs-gte3h1mm.js → boot-scrub-logs-pkdpsrjd.js} +7 -5
  11. package/dist/{claude-adapter-csc1mzka.js → claude-adapter-3fx90nww.js} +18 -16
  12. package/dist/{claude-managed-adapter-dsmkcrjy.js → claude-managed-adapter-ea2aga6w.js} +3 -3
  13. package/dist/{claude-sdk-session-fcd6f078.js → claude-sdk-session-z7fahf1k.js} +18 -16
  14. package/dist/{cli-r2fpe7cx.js → cli-00w2c66p.js} +61 -55
  15. package/dist/{cli-wbyk465z.js → cli-09y3tjxz.js} +1 -1
  16. package/dist/{cli-ht5rs63n.js → cli-0e31nm4n.js} +16 -7
  17. package/dist/cli-0x5qzvkg.js +4279 -0
  18. package/dist/{cli-d3p82erb.js → cli-18amys3y.js} +9 -9
  19. package/dist/{cli-4ahpr4sw.js → cli-1jpjafw4.js} +5 -5
  20. package/dist/{cli-jbmc0r7r.js → cli-243tzws8.js} +1 -1
  21. package/dist/{cli-ch38q5z4.js → cli-24k806sc.js} +6789 -2542
  22. package/dist/cli-3bkz2p7j.js +2828 -0
  23. package/dist/cli-3er6gcsn.js +1849 -0
  24. package/dist/cli-4k7jazkq.js +3339 -0
  25. package/dist/{cli-c4eeb5q2.js → cli-5b6b62tz.js} +1 -1
  26. package/dist/{cli-qd65dvr6.js → cli-5vs0nh43.js} +65 -44
  27. package/dist/{cli-z3wkng35.js → cli-6r3cgpk2.js} +224 -156
  28. package/dist/{cli-pgj4a5fb.js → cli-71cj99hx.js} +4 -3
  29. package/dist/cli-8sea27q4.js +14075 -0
  30. package/dist/{cli-jvy9qgjs.js → cli-913yakhv.js} +22 -7
  31. package/dist/{cli-pf9q3696.js → cli-927erqqt.js} +5 -2
  32. package/dist/cli-95jnpnqg.js +230 -0
  33. package/dist/{cli-wpv5rgg2.js → cli-abp3g4ax.js} +15 -2
  34. package/dist/{cli-ckz5t2hb.js → cli-acy6bfhr.js} +10 -7
  35. package/dist/{cli-4yc5d8fk.js → cli-avkd6mqv.js} +50 -0
  36. package/dist/{cli-8wrympd7.js → cli-bzr0ftht.js} +26 -7
  37. package/dist/{cli-qn042eh7.js → cli-c1v10xb2.js} +194 -1913
  38. package/dist/cli-cgj4hc12.js +18902 -0
  39. package/dist/{cli-2nnd56zt.js → cli-e0pg4zeh.js} +3 -2
  40. package/dist/{cli-r84ctdxn.js → cli-e31ehqwy.js} +2 -2
  41. package/dist/{cli-gphgnvpf.js → cli-e3229na9.js} +3 -3
  42. package/dist/{cli-gpqcs935.js → cli-e3cyf59d.js} +2 -2
  43. package/dist/{cli-s25avqg9.js → cli-e781c6f9.js} +1 -0
  44. package/dist/{cli-s2qjdd6z.js → cli-eetrvv91.js} +1 -1
  45. package/dist/{cli-j4nv2wqy.js → cli-fdzg6jhf.js} +10 -4
  46. package/dist/{cli-fm4ytsdk.js → cli-g2h29qar.js} +2 -2
  47. package/dist/{cli-zvgj5zg8.js → cli-ge67p080.js} +302 -3497
  48. package/dist/cli-h38x0qhg.js +6912 -0
  49. package/dist/{cli-9xvdm3bx.js → cli-h60qfasa.js} +742 -278
  50. package/dist/{cli-jew3jda5.js → cli-hws0vn86.js} +2 -2
  51. package/dist/{cli-j8dggbcr.js → cli-k0g1sjzm.js} +23 -31
  52. package/dist/{cli-xw7vak96.js → cli-kp3qs53m.js} +5 -5
  53. package/dist/{cli-rgvp6r2x.js → cli-mcnhgnn1.js} +193 -4
  54. package/dist/{cli-zvkq5csn.js → cli-myaxtgh8.js} +7 -6
  55. package/dist/{cli-56h18ng2.js → cli-n62atwh9.js} +1 -1
  56. package/dist/cli-n7h1kqpf.js +29 -0
  57. package/dist/{cli-fmy65jdn.js → cli-pf1v8xhb.js} +7 -5
  58. package/dist/{cli-xy1cchaf.js → cli-q85qhckh.js} +238 -11
  59. package/dist/{cli-3bpzj8me.js → cli-r1d3dzt6.js} +2 -2
  60. package/dist/{pi-mono-adapter-jcqt71cg.js → cli-rxkqvngf.js} +67343 -101083
  61. package/dist/{cli-kj76p1ez.js → cli-scwq51gn.js} +13 -7
  62. package/dist/{cli-b9dd0h3k.js → cli-stwsmd6k.js} +3 -2
  63. package/dist/{cli-c2mk1kgf.js → cli-v4en75c5.js} +8 -1
  64. package/dist/{cli-z61ykvam.js → cli-wg04s9kr.js} +4 -3
  65. package/dist/cli-yn0a417a.js +4069 -0
  66. package/dist/{cli-zfzznn7c.js → cli-ytxs7mn1.js} +26 -2
  67. package/dist/{cli-4j8k1m4w.js → cli-zt1227k1.js} +1162 -192
  68. package/dist/cli.js +28 -35
  69. package/dist/{codex-adapter-fxmpsabw.js → codex-adapter-ttdm995v.js} +12 -11
  70. package/dist/{codex-hook-8jexc34x.js → codex-hook-8gx7bcz0.js} +3 -3
  71. package/dist/{codex-session-runner-rr1e47ea.js → codex-session-runner-3v8nh4c8.js} +12 -11
  72. package/dist/{commands-0f5rxz51.js → commands-1cxwbhhq.js} +7 -5
  73. package/dist/{db-r3jxf3wy.js → db-y9zwsr79.js} +25 -5
  74. package/dist/{dispatcher-06vph6q4.js → dispatcher-9m9zss36.js} +30 -26
  75. package/dist/dsh-adapter-gsb2qqf9.js +19 -0
  76. package/dist/{e2b-413b8t4v.js → e2b-93x1k0j5.js} +6 -7
  77. package/dist/{google-generative-ai-ndjmj5fa.js → google-generative-ai-gwwrnzqn.js} +33 -73
  78. package/dist/{google-vertex-fr665tqs.js → google-vertex-5wfawpwz.js} +38 -68
  79. package/dist/{handlers-0hgtc910.js → handlers-36fm1bwn.js} +33 -29
  80. package/dist/{hook-9kvrv1er.js → hook-pntw4r8h.js} +12 -10
  81. package/dist/{hook-fbfhkat3.js → hook-vwq8y26p.js} +13 -11
  82. package/dist/{http-xbyx8k5j.js → http-20jesakk.js} +357 -261
  83. package/dist/{index-jsw3aynb.js → index-6artrehg.js} +30 -26
  84. package/dist/{cli-pdz9qde4.js → index-9ch1n761.js} +10 -11
  85. package/dist/{index-rnyahfn5.js → index-9n5z2492.js} +30 -26
  86. package/dist/{index-66xz5e9j.js → index-h5gs261z.js} +521 -9
  87. package/dist/{index-tfsdxyv6.js → index-j5wrf1yw.js} +40 -25
  88. package/dist/{index-2sp0384z.js → index-kkeftv5h.js} +738 -21
  89. package/dist/{index-sgk50mbg.js → index-m2xqpz5r.js} +31 -27
  90. package/dist/{index-gpfn1741.js → index-m9ks8a7t.js} +9 -7
  91. package/dist/index-w097eg0x.js +5 -0
  92. package/dist/jiti-loader-b4837mtm.js +34 -0
  93. package/dist/jiti-static-loader-q2g5ds0y.js +31267 -0
  94. package/dist/{keepalive-s3xpr7sw.js → keepalive-pwxvxd2c.js} +9 -7
  95. package/dist/{lead-rq4n5r16.js → lead-m789wqa3.js} +46 -41
  96. package/dist/{maintenance-f0atj1ab.js → maintenance-bvg6w7e2.js} +10 -8
  97. package/dist/{mistral-conversations-qhr84ph3.js → mistral-conversations-zx0kn554.js} +24 -18
  98. package/dist/{node-x1g4v0pq.js → node-5qtycf6a.js} +16 -11
  99. package/dist/{oauth-refresh-sweep-q0t3bxre.js → oauth-refresh-sweep-6v4bd737.js} +8 -6
  100. package/dist/{onboard-br5j1kch.js → onboard-snckpcj1.js} +115 -35
  101. package/dist/{openai-codex-responses-wy6a43wd.js → openai-codex-responses-4vjqzvjp.js} +33 -27
  102. package/dist/{openai-completions-32rdwmze.js → openai-completions-pxsmym7g.js} +52 -64
  103. package/dist/{openai-responses-6xwf7bzg.js → openai-responses-tmn0rqp0.js} +23 -24
  104. package/dist/{opencode-adapter-28axqa09.js → opencode-adapter-qbmv4tpy.js} +6 -6
  105. package/dist/{otel-impl-vdqge2nt.js → otel-impl-e0ytens5.js} +4 -4
  106. package/dist/{pi-messages-b1mbr6gp.js → pi-messages-txpjj39q.js} +3 -3
  107. package/dist/pi-mono-adapter-c4ggemhz.js +1316 -0
  108. package/dist/{pricing-refresh-hb3691fd.js → pricing-refresh-52g2ywrw.js} +9 -7
  109. package/dist/{rbac-roles-t78xt39b.js → rbac-roles-5455kfdn.js} +8 -6
  110. package/dist/{rbac-roles-jh280k9g.js → rbac-roles-hbf0xa52.js} +9 -7
  111. package/dist/{render-v2-7p8r2ymg.js → render-v2-npm8xdzh.js} +16 -9
  112. package/dist/{seed-pricing-hf889enh.js → seed-pricing-650wbr1n.js} +8 -6
  113. package/dist/{setup-w6mb03jv.js → setup-k1mew5rf.js} +4 -5
  114. package/dist/virtual-modules-2q5b2pk4.js +54 -0
  115. package/dist/{work-objects-nt8gy1kj.js → work-objects-2ea3kvwg.js} +33 -29
  116. package/dist/{worker-dwy617t0.js → worker-ec6hvc4m.js} +46 -41
  117. package/openapi.json +109 -16
  118. package/package.json +7 -6
  119. package/plugin/opencode-plugins/lib/memory-raters.ts +7 -0
  120. package/src/be/automation-preflight.ts +6 -4
  121. package/src/be/db/agents.ts +75 -2
  122. package/src/be/db/tasks/read.ts +2 -0
  123. package/src/be/db/tasks/write.ts +7 -1
  124. package/src/be/db.ts +140 -18
  125. package/src/be/extensions/db.ts +35 -4
  126. package/src/be/memory/raters/llm.ts +2 -6
  127. package/src/be/memory/raters/noop.ts +2 -3
  128. package/src/be/memory/raters/registry.ts +4 -10
  129. package/src/be/migrations/157_defer_provenance_and_marker.sql +27 -0
  130. package/src/be/models-catalog.ts +2 -0
  131. package/src/be/modelsdev-cache.json +213 -0
  132. package/src/be/rbac-audit.ts +2 -0
  133. package/src/be/seed/agent-fs-provision.ts +23 -0
  134. package/src/be/seed-pricing.ts +3 -1
  135. package/src/be/swarm-config-guard.ts +1 -0
  136. package/src/commands/onboard/compose-generator.ts +16 -1
  137. package/src/commands/onboard/env-generator.ts +14 -1
  138. package/src/commands/onboard/manifest.ts +1 -0
  139. package/src/commands/onboard/steps/integration-slack.tsx +56 -16
  140. package/src/commands/onboard/steps/review.tsx +5 -0
  141. package/src/commands/onboard/types.ts +6 -0
  142. package/src/commands/onboard.tsx +5 -1
  143. package/src/commands/provider-credentials.ts +14 -2
  144. package/src/commands/runner.ts +18 -2
  145. package/src/extensions/identity.ts +15 -7
  146. package/src/extensions/lifecycle.ts +15 -21
  147. package/src/hooks/codex-hook.ts +7 -1
  148. package/src/http/agents.ts +12 -4
  149. package/src/http/config.ts +1 -1
  150. package/src/http/core.ts +5 -3
  151. package/src/http/extensions.ts +108 -34
  152. package/src/http/poll.ts +7 -0
  153. package/src/http/schedules.ts +10 -0
  154. package/src/http/script-runs.ts +35 -26
  155. package/src/http/status.ts +24 -11
  156. package/src/http/tasks.ts +6 -1
  157. package/src/prompts/base-prompt.ts +15 -7
  158. package/src/prompts/memories.ts +5 -7
  159. package/src/prompts/session-templates.ts +3 -2
  160. package/src/prompts/steering-delivery.ts +2 -0
  161. package/src/providers/claude-managed-models.ts +8 -0
  162. package/src/providers/codex-adapter.ts +3 -6
  163. package/src/providers/codex-models.ts +15 -1
  164. package/src/providers/dsh-adapter.ts +248 -0
  165. package/src/providers/index.ts +5 -1
  166. package/src/providers/modelsdev-reasoning.json +50 -0
  167. package/src/providers/pi-mono-extension.ts +2 -5
  168. package/src/rbac/legacy-policy.ts +15 -1
  169. package/src/rbac/types.ts +2 -0
  170. package/src/server.ts +7 -1
  171. package/src/slack/ack.ts +43 -8
  172. package/src/slack/app.ts +32 -10
  173. package/src/slack/config.ts +29 -0
  174. package/src/slack/handlers.ts +7 -1
  175. package/src/slack/render-v2.ts +186 -17
  176. package/src/slack/responses.ts +1 -3
  177. package/src/slack/task-output.ts +66 -8
  178. package/src/slack/thread-buffer.ts +27 -3
  179. package/src/telemetry.ts +2 -3
  180. package/src/tests/agent-fs-provision-seeder.test.ts +56 -2
  181. package/src/tests/agents-harness-provider.test.ts +19 -0
  182. package/src/tests/agents-list-model-display.test.ts +60 -1
  183. package/src/tests/base-prompt.test.ts +25 -0
  184. package/src/tests/claude-managed-adapter.test.ts +6 -0
  185. package/src/tests/codex-gpt6-release.test.ts +97 -0
  186. package/src/tests/codex-steering-hook.test.ts +2 -2
  187. package/src/tests/config-api-only-keys.test.ts +9 -0
  188. package/src/tests/context-window.test.ts +1 -0
  189. package/src/tests/db-task-read-contract.test.ts +9 -0
  190. package/src/tests/db-task-write-contract.test.ts +9 -0
  191. package/src/tests/defer-task.test.ts +115 -16
  192. package/src/tests/dsh-adapter.test.ts +276 -0
  193. package/src/tests/e2e-nightly-report.test.ts +3 -3
  194. package/src/tests/e2e-redact.test.ts +2 -0
  195. package/src/tests/env-flag.test.ts +6 -0
  196. package/src/tests/extension-agent-visibility.test.ts +474 -0
  197. package/src/tests/extensions-db.test.ts +41 -0
  198. package/src/tests/extensions-http.test.ts +148 -4
  199. package/src/tests/extensions-lifecycle.test.ts +21 -1
  200. package/src/tests/extensions-mcp-tools.test.ts +9 -5
  201. package/src/tests/fetch-resolved-env.test.ts +43 -0
  202. package/src/tests/internal-ai/complete-structured.test.ts +32 -9
  203. package/src/tests/internal-ai/credentials.test.ts +4 -4
  204. package/src/tests/internal-ai/models.test.ts +20 -0
  205. package/src/tests/memory-rate-tool.test.ts +7 -10
  206. package/src/tests/memory-rater-defaults.test.ts +23 -0
  207. package/src/tests/memory-rater-e2e.test.ts +2 -3
  208. package/src/tests/migration-046-budgets.test.ts +2 -0
  209. package/src/tests/model-control.test.ts +2 -2
  210. package/src/tests/onboard-compose.test.ts +14 -0
  211. package/src/tests/onboard-env.test.ts +17 -0
  212. package/src/tests/onboard-manifest.test.ts +12 -0
  213. package/src/tests/opus-5-5-registry.test.ts +48 -0
  214. package/src/tests/pricing-refresh.test.ts +1 -1
  215. package/src/tests/pricing-routes.test.ts +15 -3
  216. package/src/tests/provider-registration.test.ts +5 -2
  217. package/src/tests/rbac-admission-e2e.test.ts +54 -0
  218. package/src/tests/rbac-e2e-helpers.ts +2 -0
  219. package/src/tests/rbac-engine.test.ts +32 -0
  220. package/src/tests/rbac-wire-e2e.test.ts +33 -0
  221. package/src/tests/reasoning-effort.test.ts +8 -0
  222. package/src/tests/reload-config.test.ts +33 -0
  223. package/src/tests/script-connections.test.ts +3 -0
  224. package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
  225. package/src/tests/slack-config.test.ts +136 -0
  226. package/src/tests/slack-mode-lifecycle.test.ts +69 -0
  227. package/src/tests/slack-render-v2.test.ts +446 -16
  228. package/src/tests/slack-steering.test.ts +69 -1
  229. package/src/tests/slack-task-output.test.ts +33 -12
  230. package/src/tests/status.test.ts +22 -2
  231. package/src/tests/steering-core.test.ts +35 -0
  232. package/src/tests/steering-delivery.test.ts +39 -0
  233. package/src/tests/steering-transport.test.ts +2 -2
  234. package/src/tests/task-tool-preload-mcp.test.ts +3 -1
  235. package/src/tests/telemetry-init.test.ts +18 -0
  236. package/src/tests/workflow-live-recovery.test.ts +126 -0
  237. package/src/tests/workflow-llm.test.ts +3 -3
  238. package/src/tools/defer-task.ts +64 -26
  239. package/src/tools/extension-common.ts +4 -0
  240. package/src/tools/extension-install.ts +1 -1
  241. package/src/tools/extension-list.ts +4 -3
  242. package/src/tools/join-swarm.ts +1 -1
  243. package/src/tools/schedules/create-schedule.ts +11 -1
  244. package/src/tools/schedules/patch-schedule.ts +5 -0
  245. package/src/tools/schedules/update-schedule.ts +5 -0
  246. package/src/tools/send-task.ts +6 -0
  247. package/src/tools/utils.ts +1 -1
  248. package/src/types.ts +30 -8
  249. package/src/utils/context-window.ts +1 -0
  250. package/src/utils/credentials.ts +8 -0
  251. package/src/utils/internal-ai/complete-structured.ts +8 -0
  252. package/src/utils/internal-ai/models.ts +5 -5
  253. package/src/utils/memory-raters.ts +3 -0
  254. package/src/workflows/engine.ts +28 -0
  255. package/src/workflows/recovery.ts +7 -4
  256. package/templates/schedules/daily-status-report/content.md +25 -12
  257. package/templates/schedules/daily-workflow-health-audit/content.md +1 -1
  258. package/templates/skills/swarm-extensions/content.md +9 -5
  259. package/dist/cli-4wppfkcm.js +0 -16384
  260. package/dist/cli-55qrx3q8.js +0 -6041
  261. package/dist/cli-cg4vnyh4.js +0 -305
  262. package/dist/cli-jyetr64j.js +0 -52
  263. package/dist/cli-pp9ax9pa.js +0 -520
  264. package/dist/cli-qa66qaf0.js +0 -6076
  265. package/dist/cli-qghpvca2.js +0 -590
  266. package/dist/cli-rembwgt8.js +0 -861
  267. package/dist/cli-tcvj7j2r.js +0 -1971
  268. package/dist/cli-vfcth11k.js +0 -36
  269. package/dist/cli-w1d1bgkk.js +0 -1422
  270. package/dist/cli-y6x0gqtg.js +0 -5977
  271. package/dist/es5-tj3tn4jj.js +0 -844
  272. package/dist/index-1kq5hw2p.js +0 -467
  273. package/dist/index-1p8wdstt.js +0 -7
  274. package/dist/index-8fdjzb2f.js +0 -100
  275. package/dist/index-bxmwzbgw.js +0 -365
  276. package/dist/index-nzerxd5z.js +0 -7
  277. package/dist/index-pyymnzat.js +0 -1168
  278. package/dist/index-qv6atbab.js +0 -619
  279. package/dist/index-rja32qa7.js +0 -801
  280. package/dist/index-tzg5srfp.js +0 -211
  281. package/dist/index-vhncw983.js +0 -90
  282. package/dist/index-xk036zsk.js +0 -859
  283. package/dist/index-zyazbzcb.js +0 -6
  284. package/dist/{claude-managed-setup-48dwg9bv.js → claude-managed-setup-f5pmsyrp.js} +3 -3
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  contentSha256,
3
3
  init_profile_sync
4
- } from "./cli-fm4ytsdk.js";
4
+ } from "./cli-g2h29qar.js";
5
5
  import {
6
6
  OpenAI,
7
7
  init_openai
@@ -11,7 +11,7 @@ import {
11
11
  getDbClient,
12
12
  init_db,
13
13
  isSqliteVecAvailable
14
- } from "./cli-zvgj5zg8.js";
14
+ } from "./cli-ge67p080.js";
15
15
  import {
16
16
  __esm,
17
17
  __export,
@@ -1,3 +1,7 @@
1
+ import {
2
+ getSystemMessageText
3
+ } from "./cli-mcnhgnn1.js";
4
+
1
5
  // node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
2
6
  class UnsupportedStrictJsonSchemaError extends Error {
3
7
  }
@@ -243,6 +247,9 @@ function estimateTextAndImageContentTokens(content) {
243
247
  }
244
248
  function estimateMessageTokens(message) {
245
249
  let chars = 0;
250
+ if (message.role === "system") {
251
+ return estimateTextTokens(getSystemMessageText(message)) + estimateToolsTokens(message.toolsAdded) + estimateToolsTokens(message.toolsRemoved);
252
+ }
246
253
  if (message.role === "user")
247
254
  return estimateTextAndImageContentTokens(message.content);
248
255
  if (message.role === "toolResult")
@@ -274,7 +281,8 @@ function getLastAssistantUsageInfo(messages) {
274
281
  }
275
282
  return usageInfo;
276
283
  }
277
- function estimateMessages(messages) {
284
+ function estimateContextTokens(context) {
285
+ const messages = "messages" in context ? context.messages : context;
278
286
  const usageInfo = getLastAssistantUsageInfo(messages);
279
287
  if (usageInfo) {
280
288
  const usageTokens = calculateContextTokens(usageInfo.usage);
@@ -294,31 +302,6 @@ function estimateToolsTokens(tools) {
294
302
  return 0;
295
303
  return estimateTextTokens(safeJsonStringify(tools));
296
304
  }
297
- function isMessageArray(value) {
298
- return Array.isArray(value);
299
- }
300
- function estimateContextTokens(context) {
301
- if (isMessageArray(context))
302
- return estimateMessages(context);
303
- const estimate = estimateMessages(context.messages);
304
- if (estimate.lastUsageIndex !== null) {
305
- const addedNames = new Set(context.messages.slice(estimate.lastUsageIndex + 1).filter((message) => message.role === "toolResult").flatMap((message) => message.addedToolNames ?? []));
306
- const addedToolTokens = estimateToolsTokens(context.tools?.filter((tool) => addedNames.has(tool.name)));
307
- return {
308
- tokens: estimate.tokens + addedToolTokens,
309
- usageTokens: estimate.usageTokens,
310
- trailingTokens: estimate.trailingTokens + addedToolTokens,
311
- lastUsageIndex: estimate.lastUsageIndex
312
- };
313
- }
314
- const prefixTokens = (context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0) + estimateToolsTokens(context.tools);
315
- return {
316
- tokens: estimate.tokens + prefixTokens,
317
- usageTokens: estimate.usageTokens,
318
- trailingTokens: estimate.trailingTokens + prefixTokens,
319
- lastUsageIndex: estimate.lastUsageIndex
320
- };
321
- }
322
305
 
323
306
  // node_modules/@earendil-works/pi-ai/dist/api/simple-options.js
324
307
  var CONTEXT_SAFETY_TOKENS = 4096;
@@ -424,7 +407,7 @@ function transformMessages(messages, model, normalizeToolCallId) {
424
407
  const normalizedMessages = messages.map((msg) => msg.content == null ? { ...msg, content: [] } : msg);
425
408
  const imageAwareMessages = downgradeUnsupportedImages(normalizedMessages, model);
426
409
  const transformed = imageAwareMessages.map((msg) => {
427
- if (msg.role === "user") {
410
+ if (msg.role === "system" || msg.role === "user") {
428
411
  return msg;
429
412
  }
430
413
  if (msg.role === "toolResult") {
@@ -489,7 +472,8 @@ function transformMessages(messages, model, normalizeToolCallId) {
489
472
  const result = [];
490
473
  let pendingToolCalls = [];
491
474
  let existingToolResultIds = new Set;
492
- const insertSyntheticToolResults = () => {
475
+ const heldSystemMessages = [];
476
+ const closePendingToolCalls = () => {
493
477
  if (pendingToolCalls.length > 0) {
494
478
  for (const tc of pendingToolCalls) {
495
479
  if (!existingToolResultIds.has(tc.id)) {
@@ -506,11 +490,13 @@ function transformMessages(messages, model, normalizeToolCallId) {
506
490
  pendingToolCalls = [];
507
491
  existingToolResultIds = new Set;
508
492
  }
493
+ result.push(...heldSystemMessages);
494
+ heldSystemMessages.length = 0;
509
495
  };
510
496
  for (let i = 0;i < transformed.length; i++) {
511
497
  const msg = transformed[i];
512
498
  if (msg.role === "assistant") {
513
- insertSyntheticToolResults();
499
+ closePendingToolCalls();
514
500
  const assistantMsg = msg;
515
501
  if (assistantMsg.stopReason === "error" || assistantMsg.stopReason === "aborted") {
516
502
  continue;
@@ -524,14 +510,20 @@ function transformMessages(messages, model, normalizeToolCallId) {
524
510
  } else if (msg.role === "toolResult") {
525
511
  existingToolResultIds.add(msg.toolCallId);
526
512
  result.push(msg);
513
+ } else if (msg.role === "system") {
514
+ if (pendingToolCalls.length > 0) {
515
+ heldSystemMessages.push(msg);
516
+ } else {
517
+ result.push(msg);
518
+ }
527
519
  } else if (msg.role === "user") {
528
- insertSyntheticToolResults();
520
+ closePendingToolCalls();
529
521
  result.push(msg);
530
522
  } else {
531
523
  result.push(msg);
532
524
  }
533
525
  }
534
- insertSyntheticToolResults();
526
+ closePendingToolCalls();
535
527
  return result;
536
528
  }
537
529
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runStopHookSessionSummarySubprocess
3
- } from "./cli-4ahpr4sw.js";
3
+ } from "./cli-1jpjafw4.js";
4
4
  import {
5
5
  fetchInstalledMcpServers
6
6
  } from "./cli-tng3131n.js";
@@ -19,14 +19,14 @@ import {
19
19
  clampContextPercent,
20
20
  computeContextUsedUnified,
21
21
  getContextWindowSize
22
- } from "./cli-s25avqg9.js";
22
+ } from "./cli-e781c6f9.js";
23
23
  import {
24
24
  isClaudeBridgeEffective,
25
25
  resolveClaudeTransport
26
26
  } from "./cli-eree7rnv.js";
27
27
  import {
28
28
  applyReasoningEffort
29
- } from "./cli-4yc5d8fk.js";
29
+ } from "./cli-avkd6mqv.js";
30
30
  import {
31
31
  swarmRuntimeInstanceId
32
32
  } from "./cli-re8z5p8p.js";
@@ -38,7 +38,7 @@ import {
38
38
  import {
39
39
  init_credentials,
40
40
  validateClaudeCredentials
41
- } from "./cli-c2mk1kgf.js";
41
+ } from "./cli-v4en75c5.js";
42
42
  import {
43
43
  init_secret_scrubber,
44
44
  scrubSecrets
@@ -819,7 +819,7 @@ class ClaudeAdapter {
819
819
  if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
820
820
  throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
821
821
  }
822
- const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-fcd6f078.js") : undefined;
822
+ const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-z7fahf1k.js") : undefined;
823
823
  claudeSdk?.validateClaudeSdkAdditionalArgs([
824
824
  ...claudeBinaryArgv.slice(1),
825
825
  ...config.additionalArgs ?? []
@@ -1,7 +1,194 @@
1
1
  import {
2
2
  AssistantMessageEventStream,
3
3
  formatThrownValue
4
- } from "./cli-8wrympd7.js";
4
+ } from "./cli-bzr0ftht.js";
5
+
6
+ // node_modules/@earendil-works/pi-ai/dist/utils/text.js
7
+ function contentText(content, separator = `
8
+ `) {
9
+ if (typeof content === "string")
10
+ return content;
11
+ return content.filter((block) => block.type === "text").map((block) => block.text).join(separator);
12
+ }
13
+ function getSystemMessageText(message) {
14
+ const parts = [contentText(message.content)];
15
+ for (const text of Object.values(message.sections ?? {})) {
16
+ if (text !== null)
17
+ parts.push(text);
18
+ }
19
+ return parts.filter((part) => part.length > 0).join(`
20
+
21
+ `);
22
+ }
23
+ function renderSystemMessageUpdate(message) {
24
+ const parts = [];
25
+ const text = contentText(message.content);
26
+ if (text.length > 0)
27
+ parts.push(text);
28
+ for (const [name, value] of Object.entries(message.sections ?? {})) {
29
+ parts.push(value === null ? `Removed system prompt section "${name}".` : `Updated system prompt section "${name}":
30
+
31
+ ${value}`);
32
+ }
33
+ return parts.join(`
34
+
35
+ `);
36
+ }
37
+
38
+ // node_modules/@earendil-works/pi-ai/dist/utils/transcript.js
39
+ function createInitialSystemMessage(systemPrompt, tools) {
40
+ const hasSystemPrompt = systemPrompt !== undefined && systemPrompt.length > 0;
41
+ const hasTools = tools !== undefined && tools.length > 0;
42
+ if (!hasSystemPrompt && !hasTools)
43
+ return;
44
+ return {
45
+ role: "system",
46
+ content: systemPrompt ?? "",
47
+ ...hasTools ? { toolsAdded: tools } : {},
48
+ timestamp: 0
49
+ };
50
+ }
51
+ function normalizeContext(context) {
52
+ const initialMessage = createInitialSystemMessage(context.systemPrompt, context.tools);
53
+ const messages = initialMessage ? [initialMessage, ...context.messages] : context.messages;
54
+ return { messages };
55
+ }
56
+ function isSystemMessage(message) {
57
+ return message.role === "system";
58
+ }
59
+ function getInitialSystemMessage(messages) {
60
+ const first = messages[0];
61
+ return first && isSystemMessage(first) ? first : undefined;
62
+ }
63
+ function withoutInitialSystemMessage(messages) {
64
+ return getInitialSystemMessage(messages) ? messages.slice(1) : messages;
65
+ }
66
+ function getCurrentTools(messages) {
67
+ const tools = new Map;
68
+ for (const message of messages) {
69
+ if (!isSystemMessage(message))
70
+ continue;
71
+ for (const tool of message.toolsRemoved ?? [])
72
+ tools.delete(tool.name);
73
+ for (const tool of message.toolsAdded ?? [])
74
+ tools.set(tool.name, tool);
75
+ }
76
+ return [...tools.values()];
77
+ }
78
+ function getCurrentSystemMessage(messages) {
79
+ const content = [];
80
+ const sections = new Map;
81
+ let timestamp;
82
+ for (const message of messages) {
83
+ if (!isSystemMessage(message))
84
+ continue;
85
+ timestamp ??= message.timestamp;
86
+ const text = contentText(message.content);
87
+ if (text.length > 0)
88
+ content.push(text);
89
+ for (const [name, value] of Object.entries(message.sections ?? {})) {
90
+ if (value === null)
91
+ sections.delete(name);
92
+ else
93
+ sections.set(name, value);
94
+ }
95
+ }
96
+ const tools = getCurrentTools(messages);
97
+ if (timestamp === undefined && tools.length === 0)
98
+ return;
99
+ return {
100
+ role: "system",
101
+ content: content.join(`
102
+
103
+ `),
104
+ ...sections.size > 0 ? { sections: Object.fromEntries(sections) } : {},
105
+ ...tools.length > 0 ? { toolsAdded: tools } : {},
106
+ timestamp: timestamp ?? 0
107
+ };
108
+ }
109
+ function getCurrentSystemPrompt(messages) {
110
+ const message = getCurrentSystemMessage(messages);
111
+ return message ? getSystemMessageText(message) : "";
112
+ }
113
+ function collapseSystemMessages(context) {
114
+ const head = getCurrentSystemMessage(context.messages);
115
+ const messages = context.messages.filter((message) => message.role !== "system");
116
+ return { messages: head ? [head, ...messages] : messages };
117
+ }
118
+ function resolveTranscript(context, supportsMidConvoSystemMessages) {
119
+ return supportsMidConvoSystemMessages ? context : collapseSystemMessages(context);
120
+ }
121
+ function toToolDeclaration(tool) {
122
+ return {
123
+ name: tool.name,
124
+ description: tool.description,
125
+ parameters: JSON.parse(JSON.stringify(tool.parameters)),
126
+ ...tool.constrainedSampling === undefined ? {} : { constrainedSampling: tool.constrainedSampling }
127
+ };
128
+ }
129
+ function declarationsEqual(left, right) {
130
+ return JSON.stringify(toToolDeclaration(left)) === JSON.stringify(toToolDeclaration(right));
131
+ }
132
+ function getToolStateChanges(previous, current) {
133
+ const previousTools = new Map(previous.map((tool) => [tool.name, tool]));
134
+ const currentTools = new Map(current.map((tool) => [tool.name, tool]));
135
+ return {
136
+ toolsAdded: current.filter((tool) => {
137
+ const previousTool = previousTools.get(tool.name);
138
+ return previousTool === undefined || !declarationsEqual(previousTool, tool);
139
+ }).map(toToolDeclaration),
140
+ toolsRemoved: previous.filter((tool) => {
141
+ const currentTool = currentTools.get(tool.name);
142
+ return currentTool === undefined || !declarationsEqual(tool, currentTool);
143
+ }).map((tool) => ({ name: tool.name }))
144
+ };
145
+ }
146
+ function getDeclaredTools(messages) {
147
+ const definitions = new Map;
148
+ for (const message of messages) {
149
+ if (!isSystemMessage(message))
150
+ continue;
151
+ for (const tool of message.toolsAdded ?? [])
152
+ definitions.set(tool.name, tool);
153
+ }
154
+ return [...definitions.values()];
155
+ }
156
+ function hasToolRedefinitions(messages) {
157
+ const declared = new Map;
158
+ for (const message of messages) {
159
+ if (!isSystemMessage(message))
160
+ continue;
161
+ for (const tool of message.toolsAdded ?? []) {
162
+ const previous = declared.get(tool.name);
163
+ if (previous !== undefined && !declarationsEqual(previous, tool))
164
+ return true;
165
+ declared.set(tool.name, tool);
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+ function hasNonAdditiveToolChanges(messages) {
171
+ const declared = new Set;
172
+ for (const message of messages) {
173
+ if (!isSystemMessage(message))
174
+ continue;
175
+ if ((message.toolsRemoved?.length ?? 0) > 0)
176
+ return true;
177
+ for (const tool of message.toolsAdded ?? []) {
178
+ if (declared.has(tool.name))
179
+ return true;
180
+ declared.add(tool.name);
181
+ }
182
+ }
183
+ return false;
184
+ }
185
+ function resolveTranscriptTools(messages, supportsToolAdditions) {
186
+ const anchorsAdditions = supportsToolAdditions && !hasNonAdditiveToolChanges(messages);
187
+ return {
188
+ requestTools: anchorsAdditions ? getInitialSystemMessage(messages)?.toolsAdded ?? [] : getCurrentTools(messages),
189
+ anchorsAdditions
190
+ };
191
+ }
5
192
 
6
193
  // node_modules/@earendil-works/pi-ai/dist/api/lazy.js
7
194
  function createSetupErrorMessage(model, error) {
@@ -674,20 +861,22 @@ class ModelsImpl {
674
861
  return { requestModel, requestOptions };
675
862
  }
676
863
  stream(model, context, options) {
864
+ const transcript = normalizeContext(context);
677
865
  return lazyStream(model, async () => {
678
866
  const provider = this.requireProvider(model);
679
867
  const { requestModel, requestOptions } = await this.applyAuth(model, options);
680
- return provider.stream(requestModel, context, requestOptions);
868
+ return provider.stream(requestModel, transcript, requestOptions);
681
869
  });
682
870
  }
683
871
  async complete(model, context, options) {
684
872
  return this.stream(model, context, options).result();
685
873
  }
686
874
  streamSimple(model, context, options) {
875
+ const transcript = normalizeContext(context);
687
876
  return lazyStream(model, async () => {
688
877
  const provider = this.requireProvider(model);
689
878
  const { requestModel, requestOptions } = await this.applyAuth(model, options);
690
- return provider.streamSimple(requestModel, context, requestOptions);
879
+ return provider.streamSimple(requestModel, transcript, requestOptions);
691
880
  });
692
881
  }
693
882
  async completeSimple(model, context, options) {
@@ -860,4 +1049,4 @@ function modelsAreEqual(a, b) {
860
1049
  return a.id === b.id && a.provider === b.provider;
861
1050
  }
862
1051
 
863
- export { lazyStream, lazyApi, defaultProviderAuthContext, InMemoryCredentialStore, ModelsError, resolveProviderAuth, InMemoryModelsStore, createModels, createProvider, hasApi, calculateCost, getSupportedThinkingLevels, clampThinkingLevel, modelsAreEqual };
1052
+ export { lazyStream, lazyApi, defaultProviderAuthContext, InMemoryCredentialStore, ModelsError, resolveProviderAuth, InMemoryModelsStore, contentText, getSystemMessageText, renderSystemMessageUpdate, createInitialSystemMessage, normalizeContext, getInitialSystemMessage, withoutInitialSystemMessage, getCurrentTools, getCurrentSystemMessage, getCurrentSystemPrompt, collapseSystemMessages, resolveTranscript, toToolDeclaration, declarationsEqual, getToolStateChanges, getDeclaredTools, hasToolRedefinitions, hasNonAdditiveToolChanges, resolveTranscriptTools, createModels, createProvider, hasApi, calculateCost, getSupportedThinkingLevels, clampThinkingLevel, modelsAreEqual };
@@ -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.152.2",
10
+ version: "1.154.0",
11
11
  description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
12
12
  keywords: [
13
13
  "agent-swarm.dev",
@@ -48,6 +48,7 @@ var init_package = __esm(() => {
48
48
  "plugin/commands/",
49
49
  "plugin/agents/",
50
50
  "plugin/pi-skills/",
51
+ "plugin/opencode-plugins/lib/memory-raters.ts",
51
52
  "templates/",
52
53
  "vendored-openapi/",
53
54
  "openapi.json"
@@ -195,14 +196,14 @@ var init_package = __esm(() => {
195
196
  "@aws-sdk/client-bedrock": "3.1048.0",
196
197
  "@desplega.ai/business-use": "^0.4.2",
197
198
  "@desplega.ai/localtunnel": "^2.2.0",
198
- "@earendil-works/pi-agent-core": "^0.85.1",
199
- "@earendil-works/pi-ai": "^0.85.1",
200
- "@earendil-works/pi-coding-agent": "^0.85.1",
199
+ "@earendil-works/pi-agent-core": "^0.87.1",
200
+ "@earendil-works/pi-ai": "^0.87.1",
201
+ "@earendil-works/pi-coding-agent": "^0.87.1",
201
202
  "@inkjs/ui": "^2.0.0",
202
203
  "@linear/sdk": "^77.0.0",
203
204
  "@modelcontextprotocol/sdk": "1.29.0",
204
- "@openai/codex": "0.154.0",
205
- "@opencode-ai/sdk": "^1.18.31",
205
+ "@openai/codex": "0.156.1",
206
+ "@opencode-ai/sdk": "^1.18.32",
206
207
  "@openfort/openfort-node": "^0.9.1",
207
208
  "@opentelemetry/api": "^1.9.1",
208
209
  "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
@@ -7,7 +7,7 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-zvgj5zg8.js";
10
+ } from "./cli-ge67p080.js";
11
11
  import {
12
12
  init_secret_scrubber,
13
13
  registerVolatileSecret,
@@ -0,0 +1,29 @@
1
+ import {
2
+ __esm
3
+ } from "./cli-bc05qbss.js";
4
+
5
+ // src/slack/config.ts
6
+ function getSlackConfiguration(env = process.env) {
7
+ const rawMode = env.SLACK_MODE === undefined ? "socket" : env.SLACK_MODE.trim();
8
+ const mode = SLACK_MODES.includes(rawMode) ? rawMode : null;
9
+ const missingCredentials = ["SLACK_BOT_TOKEN"];
10
+ if (mode === "socket")
11
+ missingCredentials.push("SLACK_APP_TOKEN");
12
+ if (mode === "http")
13
+ missingCredentials.push("SLACK_SIGNING_SECRET");
14
+ return {
15
+ disabled: env.SLACK_DISABLE === "true" || env.SLACK_DISABLE === "1",
16
+ mode,
17
+ missingCredentials: missingCredentials.filter((key) => !env[key]?.trim())
18
+ };
19
+ }
20
+ function isSlackConfigured(env = process.env) {
21
+ const config = getSlackConfiguration(env);
22
+ return !config.disabled && config.mode !== null && config.missingCredentials.length === 0;
23
+ }
24
+ var SLACK_MODES;
25
+ var init_config = __esm(() => {
26
+ SLACK_MODES = ["socket", "http"];
27
+ });
28
+
29
+ export { getSlackConfiguration, isSlackConfigured, init_config };
@@ -20,16 +20,15 @@ import {
20
20
  oauthAppRowToProviderConfig,
21
21
  updateAuthorizationTokens,
22
22
  upsertAuthorization
23
- } from "./cli-56h18ng2.js";
23
+ } from "./cli-n62atwh9.js";
24
24
  import {
25
25
  embedScript
26
- } from "./cli-gpqcs935.js";
26
+ } from "./cli-e3cyf59d.js";
27
27
  import {
28
28
  CredentialBroker,
29
29
  DEFAULT_CREDENTIAL_BINDINGS,
30
30
  computeContentHash,
31
31
  decryptSecret,
32
- defaultAssetKey,
33
32
  encryptSecret,
34
33
  getDb,
35
34
  getDbClient,
@@ -41,11 +40,14 @@ import {
41
40
  init_crypto,
42
41
  init_date_utils,
43
42
  init_db,
44
- init_key,
45
43
  normalizeDateRequired,
46
44
  placeholderForConfigKey,
47
45
  upsertSwarmConfig
48
- } from "./cli-zvgj5zg8.js";
46
+ } from "./cli-ge67p080.js";
47
+ import {
48
+ defaultAssetKey,
49
+ init_key
50
+ } from "./cli-4k7jazkq.js";
49
51
  import {
50
52
  init_env_flag,
51
53
  isEnvFlagEnabled