@desplega.ai/agent-swarm 1.131.1 → 1.134.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 (360) hide show
  1. package/README.md +3 -3
  2. package/dist/{actions-jgcy477k.js → actions-7kast243.js} +20 -18
  3. package/dist/{anthropic-messages-rjmd2e7n.js → anthropic-messages-706yad38.js} +33 -17
  4. package/dist/app-0g84t8wf.js +28 -0
  5. package/dist/{artifact-jysj3wrg.js → artifact-dje5ke4h.js} +37 -131
  6. package/dist/{assistant-f2vkk1hj.js → assistant-ac4htcky.js} +25 -22
  7. package/dist/{azure-openai-responses-c0yjmbfd.js → azure-openai-responses-be59fbsz.js} +13 -13
  8. package/dist/{boot-reembed-q7mp8hcr.js → boot-reembed-b1rcqn85.js} +13 -11
  9. package/dist/{boot-reembed-xmw8wcx6.js → boot-reembed-kw2541c4.js} +14 -12
  10. package/dist/{boot-scrub-logs-dsqrv79n.js → boot-scrub-logs-ja29t92g.js} +11 -9
  11. package/dist/{claude-adapter-q6x7yspx.js → claude-adapter-5cg1fv8s.js} +33 -29
  12. package/dist/{claude-managed-adapter-wsg37bt8.js → claude-managed-adapter-9z9sdytx.js} +9 -9
  13. package/dist/{claude-managed-setup-52z4mq9w.js → claude-managed-setup-3zqp51cr.js} +5 -5
  14. package/dist/{claude-1ex232fc.js → claude-wqn3dtca.js} +1 -1
  15. package/dist/{cli-4wgngmwv.js → cli-00w4hbam.js} +1 -1
  16. package/dist/{cli-er3a4bb0.js → cli-15429qdw.js} +6 -1
  17. package/dist/{cli-e5dabkx0.js → cli-1cwhyvta.js} +4 -4
  18. package/dist/{cli-zsspvvm2.js → cli-1ybr6vw2.js} +237 -237
  19. package/dist/{cli-xpxde7rm.js → cli-2wv4kj0e.js} +60 -31
  20. package/dist/cli-34w2584r.js +530 -0
  21. package/dist/{cli-se2p6rkb.js → cli-38taxznr.js} +6 -6
  22. package/dist/{cli-9sbhdpvb.js → cli-3cgfyfzm.js} +14 -14
  23. package/dist/{cli-5n6e5yfn.js → cli-3zmdzfjf.js} +79 -74
  24. package/dist/{cli-3ty0t082.js → cli-43x36mty.js} +197 -8
  25. package/dist/{cli-ycrnynpw.js → cli-480nehnh.js} +29 -22
  26. package/dist/{cli-0258203w.js → cli-492e7ap5.js} +140 -20
  27. package/dist/{cli-3fj60etf.js → cli-497b685t.js} +3 -3
  28. package/dist/{cli-pxfxkx5m.js → cli-4bap00k0.js} +1 -1
  29. package/dist/{cli-w2wxd56v.js → cli-4bc8vmhm.js} +848 -770
  30. package/dist/{cli-aca5pz9f.js → cli-589599p9.js} +1 -1
  31. package/dist/{cli-t930g0xh.js → cli-5tnr64pm.js} +1 -1
  32. package/dist/{cli-jxg3s9ey.js → cli-65d93ves.js} +7 -7
  33. package/dist/{cli-6dpytdr2.js → cli-6x363v1z.js} +2 -2
  34. package/dist/{cli-dxak0fqd.js → cli-787ph852.js} +11 -11
  35. package/dist/{cli-793jvbsh.js → cli-7bv8nckk.js} +16 -11
  36. package/dist/{cli-zyxs93y9.js → cli-7jcc9y1r.js} +3 -3
  37. package/dist/{cli-f1am9szv.js → cli-87t2gstf.js} +1 -1
  38. package/dist/{cli-9aryf9tv.js → cli-95m51ztz.js} +1 -1
  39. package/dist/{cli-4w4fmq9x.js → cli-9w49enmh.js} +2 -2
  40. package/dist/{cli-v69vk5h0.js → cli-9y5b02vr.js} +13 -13
  41. package/dist/{cli-x23me2mg.js → cli-a1rrkrb4.js} +1 -1
  42. package/dist/{cli-psrqtw2m.js → cli-a3pkfpqs.js} +2 -2
  43. package/dist/{cli-h0rgxd24.js → cli-a4ajmfvp.js} +6 -6
  44. package/dist/{cli-ygrbmjja.js → cli-aw8bb6sf.js} +6 -6
  45. package/dist/{cli-g74vpjp2.js → cli-brm3et47.js} +55 -22
  46. package/dist/{cli-czkae1fp.js → cli-c5ddbdfj.js} +9 -9
  47. package/dist/{cli-114fvtmj.js → cli-c79a9zrc.js} +1 -1
  48. package/dist/{cli-49n9f49x.js → cli-dx3dz0ms.js} +3 -3
  49. package/dist/{cli-6dp3ydxa.js → cli-e07exmsb.js} +18 -14
  50. package/dist/cli-et1bbwqf.js +13 -0
  51. package/dist/{cli-yazx6hap.js → cli-f3s9dry0.js} +14 -14
  52. package/dist/{cli-t8d349cy.js → cli-f4wj0s3m.js} +3 -3
  53. package/dist/{cli-d6n0thxw.js → cli-f64gdfxc.js} +1 -1
  54. package/dist/{cli-pwfsqc2x.js → cli-fyd58xgb.js} +55 -55
  55. package/dist/{cli-7dm2zqy2.js → cli-g0j14czv.js} +2 -2
  56. package/dist/{cli-b0p7rfnd.js → cli-g2p9bd1z.js} +14 -14
  57. package/dist/{cli-z905tvmm.js → cli-g814jbst.js} +2 -2
  58. package/dist/{cli-5dsbcjjw.js → cli-ghexzd2d.js} +970 -970
  59. package/dist/{cli-jvv0g8bh.js → cli-gpt9kf01.js} +15 -15
  60. package/dist/{cli-rgrfzg8z.js → cli-grt6qv91.js} +380 -380
  61. package/dist/{cli-wz9115x0.js → cli-gtafvdy0.js} +8 -8
  62. package/dist/{cli-q5dzzak0.js → cli-gy07xk4s.js} +2 -2
  63. package/dist/{cli-sy7jk3tx.js → cli-h0djenzm.js} +2 -2
  64. package/dist/{cli-nrkkknat.js → cli-h37gbjbf.js} +2 -281
  65. package/dist/{cli-jevgrb4w.js → cli-h39xxnq6.js} +1200 -491
  66. package/dist/{cli-gz9sbyk3.js → cli-jepmgn7r.js} +1 -1
  67. package/dist/{cli-ccf9vy7q.js → cli-jmvk6et8.js} +7 -7
  68. package/dist/{cli-2rk0cx7s.js → cli-jxj92gkt.js} +51 -41
  69. package/dist/{cli-bqw0mt1n.js → cli-k46t4664.js} +18 -3
  70. package/dist/{cli-50vbt00w.js → cli-m07313tr.js} +1153 -696
  71. package/dist/{cli-4j2mrzag.js → cli-mkq1rk7b.js} +1 -1
  72. package/dist/{cli-1z7048dy.js → cli-mnm7w46e.js} +1 -1
  73. package/dist/{cli-kd1ck4rx.js → cli-mp9sg4cg.js} +14 -8
  74. package/dist/{cli-jbcva0xj.js → cli-mrammd8c.js} +60 -35
  75. package/dist/cli-nanaxrz6.js +27 -0
  76. package/dist/{cli-p9swy5t3.js → cli-pq2ee5ja.js} +8 -6
  77. package/dist/{cli-2wadx7p2.js → cli-pt43pdp1.js} +2 -2
  78. package/dist/{cli-7sgrxg9a.js → cli-q6d0vvey.js} +4 -4
  79. package/dist/{cli-k9qkf1hw.js → cli-qf9kpsve.js} +9 -9
  80. package/dist/cli-qh4sqfws.js +15 -0
  81. package/dist/{cli-e15jhafb.js → cli-qntkxysp.js} +14 -14
  82. package/dist/{cli-sajgpkqg.js → cli-qs9hhsvb.js} +1723 -325
  83. package/dist/{cli-z2zcxes1.js → cli-qt5bt3vk.js} +1 -1
  84. package/dist/{cli-wx82tw1k.js → cli-qtekrty1.js} +3 -3
  85. package/dist/{cli-g1re8r05.js → cli-rh6f3s9n.js} +3 -3
  86. package/dist/{cli-n0krnc6d.js → cli-rzhcrw2p.js} +2 -2
  87. package/dist/{cli-gecy3z2s.js → cli-snw62ze5.js} +4 -4
  88. package/dist/{cli-n6h8qt8n.js → cli-snz3p4yf.js} +15 -10
  89. package/dist/{cli-r6kqqbj0.js → cli-tkf8n6cw.js} +11 -11
  90. package/dist/{cli-4rkfg1wx.js → cli-tkrr24mz.js} +14 -9
  91. package/dist/{cli-9dr5qzc0.js → cli-tv9f1kyb.js} +54 -43
  92. package/dist/{cli-gm9cbhbq.js → cli-vtz6yj3v.js} +28 -9
  93. package/dist/{cli-2f07m0xr.js → cli-wf86d5t7.js} +1 -1
  94. package/dist/{cli-7zd05xb4.js → cli-whrvct19.js} +45 -45
  95. package/dist/{cli-ap1czx8f.js → cli-wrrea8xm.js} +3 -3
  96. package/dist/{cli-57khth04.js → cli-xmyqv00z.js} +120 -4
  97. package/dist/{cli-cwy5hqbq.js → cli-yjmk7tzc.js} +1 -1
  98. package/dist/{cli-6pcz9h15.js → cli-zykjrwcx.js} +180 -394
  99. package/dist/cli.js +45 -45
  100. package/dist/{codex-adapter-htjkn22b.js → codex-adapter-hsq6mz3m.js} +21 -19
  101. package/dist/{codex-hook-hq54t9ft.js → codex-hook-8c500gq8.js} +8 -7
  102. package/dist/{codex-login-z6yhbkmk.js → codex-login-x7603481.js} +3 -3
  103. package/dist/{codex-session-runner-wjfc7smz.js → codex-session-runner-c1x3x143.js} +15 -13
  104. package/dist/{commands-xhrfwqsk.js → commands-rwtddtst.js} +11 -9
  105. package/dist/{db-anvwb22f.js → db-j2b355vz.js} +458 -444
  106. package/dist/{devin-adapter-v1sarqtw.js → devin-adapter-8qmhqpy3.js} +3 -3
  107. package/dist/{devtools-2y1r7yqk.js → devtools-j2rnj8w7.js} +4 -4
  108. package/dist/{e2b-jdkwemv2.js → e2b-znpx78eg.js} +16 -16
  109. package/dist/{es5-vjgtkgp6.js → es5-fmqrjzy3.js} +2 -2
  110. package/dist/{event-bus-axn823e9.js → event-bus-n8sb35pw.js} +4 -4
  111. package/dist/{getMachineId-bsd-6tc9wxdj.js → getMachineId-bsd-wpzbhkm6.js} +4 -4
  112. package/dist/{getMachineId-darwin-sjt9sgnc.js → getMachineId-darwin-45zabjy0.js} +4 -4
  113. package/dist/{getMachineId-linux-v5n18y9p.js → getMachineId-linux-warnp5pd.js} +3 -3
  114. package/dist/{getMachineId-unsupported-yrjyqw3d.js → getMachineId-unsupported-5spent2a.js} +3 -3
  115. package/dist/{getMachineId-win-w3r8063c.js → getMachineId-win-v4bvcw7a.js} +4 -4
  116. package/dist/{google-generative-ai-hysrd8qx.js → google-generative-ai-b0wzss55.js} +17 -14
  117. package/dist/{google-vertex-p5arrga0.js → google-vertex-e8q4dpya.js} +18 -15
  118. package/dist/{handlers-b9kbc621.js → handlers-hchgrxkh.js} +32 -29
  119. package/dist/{hook-xkvn6c5h.js → hook-p49egqc0.js} +66 -52
  120. package/dist/hook-spb00w76.js +34 -0
  121. package/dist/{http-9xh6ta4r.js → http-nh14kkms.js} +663 -181
  122. package/dist/index-1qthq7vc.js +6 -0
  123. package/dist/{index-0g68f0p6.js → index-20xqmn3v.js} +3 -3
  124. package/dist/{index-vdkr5z2w.js → index-3e03k6e4.js} +114 -114
  125. package/dist/{index-ywds4812.js → index-4cbyhq2g.js} +43 -41
  126. package/dist/index-67pzqfrb.js +36 -0
  127. package/dist/{index-bccrkdkn.js → index-7m8yxkw5.js} +16 -16
  128. package/dist/{index-eaxyqcmj.js → index-dvsk64sm.js} +163 -83
  129. package/dist/{index-dqkpnmqm.js → index-e19s2m8k.js} +18 -18
  130. package/dist/{index-j30k5zxn.js → index-emvxcy98.js} +16 -16
  131. package/dist/{index-7ndw6ecy.js → index-gqnmr60d.js} +9 -9
  132. package/dist/{index-9znhar3x.js → index-j02xvjtd.js} +184 -185
  133. package/dist/{index-1s2442yw.js → index-ns5kksc1.js} +7 -7
  134. package/dist/{index-dpy2hth8.js → index-pdxc8kfh.js} +71 -71
  135. package/dist/{index-z1m7pw0v.js → index-ptcqm8bc.js} +107 -107
  136. package/dist/{index-070v4eyb.js → index-pyp7rexm.js} +5 -6
  137. package/dist/{index-86znjz1p.js → index-shne41sd.js} +13 -13
  138. package/dist/{index-2qn2qndv.js → index-t36q2v4t.js} +183 -183
  139. package/dist/index-tcnvv8w6.js +7 -0
  140. package/dist/index-w91qbfv1.js +7 -0
  141. package/dist/{index-fzc0mwvj.js → index-yqweff5n.js} +32 -32
  142. package/dist/index-yrfphye1.js +39 -0
  143. package/dist/{keepalive-vc7s2aa6.js → keepalive-9k51nqhc.js} +21 -15
  144. package/dist/lead-2xq3dxbz.js +88 -0
  145. package/dist/maintenance-0c0g6nym.js +28 -0
  146. package/dist/mistral-conversations-2njwdwhj.js +717 -0
  147. package/dist/{multipart-parser-qaktc7p8.js → multipart-parser-6gftesw0.js} +2 -2
  148. package/dist/{oauth-refresh-sweep-yecgjpk4.js → oauth-refresh-sweep-273a64r2.js} +14 -12
  149. package/dist/{onboard-xj0f73f9.js → onboard-tsv9wwhz.js} +12 -12
  150. package/dist/{openai-codex-responses-5g27pd6f.js → openai-codex-responses-kt84eq86.js} +26 -26
  151. package/dist/{openai-completions-3vkmfz2a.js → openai-completions-mrypq7qp.js} +17 -16
  152. package/dist/{openai-responses-dg4t7j7a.js → openai-responses-qhrk21ez.js} +20 -17
  153. package/dist/{opencode-adapter-1gm38aba.js → opencode-adapter-rar9676j.js} +13 -11
  154. package/dist/{openrouter-images-g3gm8931.js → openrouter-images-684fysx9.js} +5 -5
  155. package/dist/{otel-impl-nxg0n0b3.js → otel-impl-wp1mfzd2.js} +752 -537
  156. package/dist/{photon_rs-ky7dj5qw.js → photon_rs-8dwt2pzy.js} +581 -581
  157. package/dist/{pi-messages-tqj8q6b9.js → pi-messages-txp9f97r.js} +7 -7
  158. package/dist/{pi-mono-adapter-4g5kby31.js → pi-mono-adapter-yz47kk8e.js} +1910 -1180
  159. package/dist/pricing-refresh-jw1yw2fn.js +22 -0
  160. package/dist/rbac-roles-dg964c8p.js +32 -0
  161. package/dist/{rbac-roles-1hcxdtg7.js → rbac-roles-p53cg5cv.js} +19 -17
  162. package/dist/{registry-02cy9z5z.js → registry-mh12y17v.js} +4 -4
  163. package/dist/render-v2-56vn2rk9.js +36 -0
  164. package/dist/seed-pricing-52xx6z63.js +19 -0
  165. package/dist/{setup-46xtgq3c.js → setup-e8gp79sy.js} +7 -7
  166. package/dist/token-util-zy908s1a.js +6 -0
  167. package/dist/{token-fxkn2zf2.js → token-xg5711x5.js} +4 -4
  168. package/dist/worker-s17f1g46.js +88 -0
  169. package/dist/{x-6mg4kfpe.js → x-xkfh0w0v.js} +5 -5
  170. package/openapi.json +566 -22
  171. package/package.json +6 -6
  172. package/src/be/budget-refusal-notify.ts +14 -7
  173. package/src/be/db-queries/task-artifacts.ts +182 -0
  174. package/src/be/db.ts +834 -171
  175. package/src/be/events.ts +5 -0
  176. package/src/be/migrations/131_session_logs_created_at_index.sql +2 -0
  177. package/src/be/migrations/132_multi_runtime_instances.sql +44 -0
  178. package/src/be/migrations/133_workflow_run_trigger_type.sql +12 -0
  179. package/src/be/migrations/135_backfill_task_pull_request_attachments.sql +228 -0
  180. package/src/be/migrations/136_task_requester_provenance.sql +37 -0
  181. package/src/be/migrations/137_memory_retrieval_composite_index.sql +1 -0
  182. package/src/be/migrations/runner.ts +17 -11
  183. package/src/be/multi-runtime.ts +430 -0
  184. package/src/be/scripts/extract-schema.ts +3 -1
  185. package/src/be/scripts/typecheck.ts +6 -2
  186. package/src/be/seed-prompt-templates.ts +25 -2
  187. package/src/be/seed-skills/index.ts +7 -0
  188. package/src/be/steering.ts +1 -1
  189. package/src/be/swarm-config-guard.ts +18 -0
  190. package/src/commands/credential-wait.ts +54 -0
  191. package/src/commands/onboard/steps/core-credentials.tsx +1 -1
  192. package/src/commands/onboard/steps/custom-templates.tsx +1 -1
  193. package/src/commands/onboard/steps/harness-credentials.tsx +1 -1
  194. package/src/commands/onboard/steps/health-check.tsx +1 -1
  195. package/src/commands/onboard/steps/start.tsx +1 -1
  196. package/src/commands/profile-sync-audit.ts +56 -0
  197. package/src/commands/profile-sync.ts +287 -15
  198. package/src/commands/provider-credentials.ts +46 -19
  199. package/src/commands/runner.ts +199 -33
  200. package/src/commands/templates.ts +22 -0
  201. package/src/github/handlers.ts +55 -9
  202. package/src/heartbeat/heartbeat.ts +109 -17
  203. package/src/hooks/hook.ts +49 -33
  204. package/src/http/active-sessions.ts +11 -1
  205. package/src/http/agents.ts +261 -30
  206. package/src/http/all-routes.ts +1 -0
  207. package/src/http/config.ts +13 -2
  208. package/src/http/core.ts +102 -4
  209. package/src/http/db-query-bounded.ts +313 -0
  210. package/src/http/db-query-shared.ts +249 -0
  211. package/src/http/db-query.ts +54 -42
  212. package/src/http/events.ts +2 -0
  213. package/src/http/index.ts +23 -2
  214. package/src/http/mcp-bridge.ts +37 -3
  215. package/src/http/mcp.ts +12 -0
  216. package/src/http/memory.ts +13 -2
  217. package/src/http/openapi.ts +1 -0
  218. package/src/http/poll.ts +70 -27
  219. package/src/http/prompt-templates.ts +36 -13
  220. package/src/http/route-def.ts +43 -9
  221. package/src/http/schedules.ts +2 -2
  222. package/src/http/scripts.ts +10 -1
  223. package/src/http/session-data.ts +44 -0
  224. package/src/http/tasks.ts +2 -2
  225. package/src/http/users.ts +74 -52
  226. package/src/http/webhooks.ts +5 -2
  227. package/src/http/workflows.ts +1 -4
  228. package/src/integrations/kapso/inbound.ts +1 -1
  229. package/src/jira/outbound.ts +39 -8
  230. package/src/jira/webhook-lifecycle.ts +13 -2
  231. package/src/linear/outbound.ts +43 -10
  232. package/src/oauth/keepalive.ts +13 -2
  233. package/src/prompts/base-prompt.ts +1 -1
  234. package/src/prompts/default-drift.ts +21 -0
  235. package/src/prompts/session-templates.ts +56 -7
  236. package/src/providers/claude-adapter.ts +6 -0
  237. package/src/providers/codex-adapter.ts +6 -0
  238. package/src/providers/opencode-adapter.ts +6 -0
  239. package/src/providers/pi-mono-adapter.ts +8 -0
  240. package/src/providers/pricing-sources.md +24 -0
  241. package/src/queue-stall-alarm.ts +216 -0
  242. package/src/rbac/legacy-policy.ts +3 -0
  243. package/src/rbac/permissions.ts +12 -0
  244. package/src/scheduler/scheduler.ts +7 -0
  245. package/src/script-workflows/executor.ts +2 -1
  246. package/src/scripts-runtime/executors/native.ts +2 -1
  247. package/src/scripts-runtime/executors/types.ts +5 -0
  248. package/src/scripts-runtime/loader.ts +5 -0
  249. package/src/scripts-runtime/sdk-allowlist.ts +3 -0
  250. package/src/scripts-runtime/swarm-config.ts +8 -0
  251. package/src/scripts-runtime/swarm-sdk.ts +7 -0
  252. package/src/scripts-runtime/types/stdlib.d.ts +4 -0
  253. package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -0
  254. package/src/server.ts +6 -0
  255. package/src/slack/channel-join.ts +22 -3
  256. package/src/slack/channel-lifecycle.ts +114 -0
  257. package/src/tests/budget-claim-gate.test.ts +20 -0
  258. package/src/tests/claude-adapter.test.ts +32 -0
  259. package/src/tests/codex-adapter.test.ts +30 -0
  260. package/src/tests/create-task-validation.test.ts +128 -0
  261. package/src/tests/credential-wait.test.ts +67 -1
  262. package/src/tests/db-query.test.ts +711 -2
  263. package/src/tests/heartbeat-checklist.test.ts +28 -0
  264. package/src/tests/http-api-integration.test.ts +81 -0
  265. package/src/tests/http-users.test.ts +166 -1
  266. package/src/tests/identity-field-budget.test.ts +176 -0
  267. package/src/tests/mcp-tools-user.test.ts +34 -0
  268. package/src/tests/mcp-user-route.test.ts +17 -0
  269. package/src/tests/metrics-http.test.ts +44 -0
  270. package/src/tests/migration-failure.test.ts +86 -0
  271. package/src/tests/multi-runtime-registration.test.ts +2810 -0
  272. package/src/tests/openapi-response-contract.test.ts +24 -0
  273. package/src/tests/openapi-route-headers.test.ts +83 -0
  274. package/src/tests/opencode-adapter.test.ts +40 -0
  275. package/src/tests/outbound-listener-rejection.test.ts +138 -0
  276. package/src/tests/pi-mono-adapter.test.ts +98 -0
  277. package/src/tests/preload.ts +2 -0
  278. package/src/tests/profile-sync-warning.test.ts +277 -0
  279. package/src/tests/profile-sync.test.ts +232 -6
  280. package/src/tests/prompt-template-resolver.test.ts +177 -6
  281. package/src/tests/prompt-template-session.test.ts +39 -3
  282. package/src/tests/queue-stall-alarm.test.ts +226 -0
  283. package/src/tests/rbac-charact-slack.test.ts +29 -0
  284. package/src/tests/rbac-engine.test.ts +3 -0
  285. package/src/tests/requester-comms.test.ts +32 -0
  286. package/src/tests/runner-requester-profile.test.ts +38 -0
  287. package/src/tests/schedule-target-type.test.ts +38 -0
  288. package/src/tests/script-connections.test.ts +13 -1
  289. package/src/tests/scripts-runtime-identity.test.ts +375 -0
  290. package/src/tests/scripts-runtime.test.ts +4 -3
  291. package/src/tests/sdk-allowlist.test.ts +47 -0
  292. package/src/tests/send-task-requested-by.test.ts +9 -0
  293. package/src/tests/session-costs.test.ts +506 -1
  294. package/src/tests/shutdown-error-scrubbing.test.ts +92 -0
  295. package/src/tests/slack-channel-lifecycle.test.ts +241 -0
  296. package/src/tests/slack-render-v2.test.ts +43 -0
  297. package/src/tests/steering-core.test.ts +28 -0
  298. package/src/tests/swarm-config-reserved-keys.test.ts +22 -0
  299. package/src/tests/task-artifacts.test.ts +386 -0
  300. package/src/tests/task-attachments-schema.test.ts +17 -1
  301. package/src/tests/task-completion-idempotency.test.ts +57 -0
  302. package/src/tests/task-pull-request-backfill-migration.test.ts +321 -0
  303. package/src/tests/tool-annotations.test.ts +4 -0
  304. package/src/tests/update-profile-api.test.ts +67 -39
  305. package/src/tests/update-profile-auth.test.ts +48 -4
  306. package/src/tests/user-attribution-migration.test.ts +54 -0
  307. package/src/tests/user-identity.test.ts +72 -0
  308. package/src/tests/workflow-async-v2.test.ts +39 -1
  309. package/src/tests/workflow-http-v2.test.ts +3 -2
  310. package/src/tests/workflow-mcp-trigger-schema.test.ts +52 -3
  311. package/src/tests/workflow-retry-v2.test.ts +45 -1
  312. package/src/tools/db-query.ts +18 -8
  313. package/src/tools/get-task-details.ts +24 -3
  314. package/src/tools/manage-user.ts +36 -3
  315. package/src/tools/poll-task.ts +93 -14
  316. package/src/tools/script-common.ts +5 -0
  317. package/src/tools/send-task.ts +1 -4
  318. package/src/tools/slack-archive-channel.ts +70 -0
  319. package/src/tools/slack-create-channel.ts +74 -0
  320. package/src/tools/slack-invite-to-channel.ts +78 -0
  321. package/src/tools/store-progress.ts +13 -2
  322. package/src/tools/swarm-config/delete-config.ts +9 -0
  323. package/src/tools/swarm-config/set-config.ts +3 -2
  324. package/src/tools/task-action.ts +30 -0
  325. package/src/tools/task-tool-ctx.ts +8 -1
  326. package/src/tools/tool-config.ts +4 -1
  327. package/src/tools/update-profile.ts +16 -21
  328. package/src/tools/utils.ts +5 -0
  329. package/src/tools/workflows/trigger-workflow.ts +7 -1
  330. package/src/types.ts +165 -1
  331. package/src/utils/github-pull-request.ts +76 -0
  332. package/src/utils/identity-field-budget.ts +73 -0
  333. package/src/utils/multi-runtime.ts +20 -0
  334. package/src/utils/requester-comms.ts +24 -0
  335. package/src/workflows/engine.ts +22 -2
  336. package/src/workflows/resume.ts +19 -11
  337. package/src/workflows/retry-poller.ts +1 -0
  338. package/src/workflows/triggers.ts +4 -0
  339. package/templates/skills/db-query-guidance/config.json +14 -0
  340. package/templates/skills/db-query-guidance/content.md +57 -0
  341. package/dist/app-5da78bd4.js +0 -26
  342. package/dist/cli-3te4jdkm.js +0 -225
  343. package/dist/cli-bmze986d.js +0 -7
  344. package/dist/cli-kh3ba2zf.js +0 -607
  345. package/dist/hook-cgk4wxmx.js +0 -31
  346. package/dist/index-25wjsdv2.js +0 -34
  347. package/dist/index-76at2ymp.js +0 -7
  348. package/dist/index-hase6zbe.js +0 -6
  349. package/dist/index-vg4snay4.js +0 -36
  350. package/dist/index-vy8edt27.js +0 -7
  351. package/dist/lead-r2yqfmx7.js +0 -85
  352. package/dist/maintenance-mw70k468.js +0 -26
  353. package/dist/mistral-conversations-81fwav0j.js +0 -30578
  354. package/dist/otel-nqa12wf3.js +0 -3149
  355. package/dist/pricing-refresh-2cn6effr.js +0 -20
  356. package/dist/rbac-roles-vynday5g.js +0 -30
  357. package/dist/render-v2-tc0bh8kk.js +0 -34
  358. package/dist/seed-pricing-8kceb43f.js +0 -17
  359. package/dist/token-util-pqyc8kng.js +0 -6
  360. package/dist/worker-qrbz6hmv.js +0 -85
@@ -4,7 +4,7 @@ import {
4
4
  incrKv,
5
5
  init_db,
6
6
  upsertKv
7
- } from "./cli-50vbt00w.js";
7
+ } from "./cli-m07313tr.js";
8
8
 
9
9
  // src/be/users.ts
10
10
  init_db();
@@ -2,7 +2,7 @@ import {
2
2
  buildAgentFsLiveUrl,
3
3
  getAppUrl,
4
4
  init_constants
5
- } from "./cli-x23me2mg.js";
5
+ } from "./cli-a1rrkrb4.js";
6
6
 
7
7
  // src/utils/task-attachment-links.ts
8
8
  init_constants();
@@ -5,15 +5,15 @@ import {
5
5
  require_endpoints,
6
6
  require_protocols,
7
7
  require_serde
8
- } from "./cli-czkae1fp.js";
8
+ } from "./cli-c5ddbdfj.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require,
12
12
  __toESM
13
- } from "./cli-p9swy5t3.js";
13
+ } from "./cli-pq2ee5ja.js";
14
14
 
15
15
  // node_modules/@smithy/core/dist-cjs/submodules/retry/index.js
16
- var require_retry = __commonJS((exports) => {
16
+ var require_retry = __commonJS(function(exports) {
17
17
  var node_stream = __require("node:stream");
18
18
  var client = require_client();
19
19
  var protocols = require_protocols();
@@ -789,7 +789,7 @@ var require_retry = __commonJS((exports) => {
789
789
  });
790
790
 
791
791
  // node_modules/@smithy/core/dist-cjs/index.js
792
- var require_dist_cjs2 = __commonJS((exports) => {
792
+ var require_dist_cjs2 = __commonJS(function(exports) {
793
793
  var types = require_dist_cjs();
794
794
  var protocols = require_protocols();
795
795
  var client = require_client();
@@ -1115,7 +1115,7 @@ var require_dist_cjs2 = __commonJS((exports) => {
1115
1115
  });
1116
1116
 
1117
1117
  // node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js
1118
- var require_invoke_store = __commonJS((exports) => {
1118
+ var require_invoke_store = __commonJS(function(exports) {
1119
1119
  var PROTECTED_KEYS = {
1120
1120
  REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
1121
1121
  X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
@@ -1232,7 +1232,7 @@ var require_invoke_store = __commonJS((exports) => {
1232
1232
  });
1233
1233
 
1234
1234
  // node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
1235
- var require_client2 = __commonJS((exports) => {
1235
+ var require_client2 = __commonJS(function(exports) {
1236
1236
  var __dirname = "/home/runner/work/agent-swarm/agent-swarm/node_modules/@aws-sdk/core/dist-cjs/submodules/client";
1237
1237
  var retry = require_retry();
1238
1238
  var protocols = require_protocols();
@@ -1777,7 +1777,7 @@ More information can be found at: https://a.co/c895JFp`);
1777
1777
  default: DEFAULT_UA_APP_ID
1778
1778
  };
1779
1779
  var createUserAgentStringParsingProvider = ({ serviceId, clientVersion }) => async (config2) => {
1780
- const module2 = await import("./es5-vjgtkgp6.js").then((m)=>__toESM(m.default));
1780
+ const module2 = await import("./es5-fmqrjzy3.js").then((m)=>__toESM(m.default));
1781
1781
  const parse = module2.parse ?? module2.default.parse ?? (() => "");
1782
1782
  const parsedUA = typeof window !== "undefined" && window?.navigator?.userAgent ? parse(window.navigator.userAgent) : undefined;
1783
1783
  const sections = [
@@ -3,11 +3,11 @@ import {
3
3
  getAgentWorkingOnThread,
4
4
  getAllAgents,
5
5
  init_db
6
- } from "./cli-50vbt00w.js";
6
+ } from "./cli-m07313tr.js";
7
7
  import {
8
8
  init_env_flag,
9
9
  isEnvFlagEnabled
10
- } from "./cli-xpxde7rm.js";
10
+ } from "./cli-nanaxrz6.js";
11
11
 
12
12
  // src/slack/router.ts
13
13
  init_db();
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  require_client as require_client2,
3
3
  require_dist_cjs
4
- } from "./cli-jxg3s9ey.js";
4
+ } from "./cli-65d93ves.js";
5
5
  import {
6
6
  require_client,
7
7
  require_config,
8
8
  require_protocols,
9
9
  require_schema,
10
10
  require_serde
11
- } from "./cli-czkae1fp.js";
11
+ } from "./cli-c5ddbdfj.js";
12
12
  import {
13
13
  __commonJS
14
- } from "./cli-p9swy5t3.js";
14
+ } from "./cli-pq2ee5ja.js";
15
15
 
16
16
  // node_modules/@smithy/signature-v4/dist-cjs/index.js
17
- var require_dist_cjs2 = __commonJS((exports) => {
17
+ var require_dist_cjs2 = __commonJS(function(exports) {
18
18
  var serde = require_serde();
19
19
  var client = require_client();
20
20
  var protocols = require_protocols();
@@ -554,7 +554,7 @@ ${serde.toHex(hashedRequest)}`;
554
554
  });
555
555
 
556
556
  // node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js
557
- var require_httpAuthSchemes = __commonJS((exports) => {
557
+ var require_httpAuthSchemes = __commonJS(function(exports) {
558
558
  var protocols = require_protocols();
559
559
  var core = require_dist_cjs();
560
560
  var config = require_config();
@@ -844,7 +844,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
844
844
  });
845
845
 
846
846
  // node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js
847
- var require_cbor = __commonJS((exports) => {
847
+ var require_cbor = __commonJS(function(exports) {
848
848
  var serde = require_serde();
849
849
  var protocols = require_protocols();
850
850
  var client = require_client();
@@ -1883,7 +1883,7 @@ var require_cbor = __commonJS((exports) => {
1883
1883
  });
1884
1884
 
1885
1885
  // node_modules/fast-xml-parser/lib/fxp.cjs
1886
- var require_fxp = __commonJS((exports, module) => {
1886
+ var require_fxp = __commonJS(function(exports, module) {
1887
1887
  (() => {
1888
1888
  var t = { d: (e2, n2) => {
1889
1889
  for (var i2 in n2)
@@ -3685,7 +3685,7 @@ var require_fxp = __commonJS((exports, module) => {
3685
3685
  });
3686
3686
 
3687
3687
  // node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js
3688
- var require_nodable_entities = __commonJS((exports) => {
3688
+ var require_nodable_entities = __commonJS(function(exports) {
3689
3689
  Object.defineProperty(exports, "__esModule", { value: true });
3690
3690
  exports.EntityDecoderImpl = exports.CURRENCY = exports.COMMON_HTML = exports.XML = undefined;
3691
3691
  exports.XML = {
@@ -4016,7 +4016,7 @@ var require_nodable_entities = __commonJS((exports) => {
4016
4016
  });
4017
4017
 
4018
4018
  // node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js
4019
- var require_xml_parser = __commonJS((exports) => {
4019
+ var require_xml_parser = __commonJS(function(exports) {
4020
4020
  Object.defineProperty(exports, "__esModule", { value: true });
4021
4021
  exports.parseXML = parseXML;
4022
4022
  var fast_xml_parser_1 = require_fxp();
@@ -4069,7 +4069,7 @@ var require_xml_parser = __commonJS((exports) => {
4069
4069
  });
4070
4070
 
4071
4071
  // node_modules/@aws-sdk/xml-builder/dist-cjs/index.js
4072
- var require_dist_cjs3 = __commonJS((exports) => {
4072
+ var require_dist_cjs3 = __commonJS(function(exports) {
4073
4073
  var xmlParser = require_xml_parser();
4074
4074
  var ATTR_ESCAPE_RE = /[&<>"]/g;
4075
4075
  var ATTR_ESCAPE_MAP = {
@@ -4199,7 +4199,7 @@ var require_dist_cjs3 = __commonJS((exports) => {
4199
4199
  });
4200
4200
 
4201
4201
  // node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js
4202
- var require_protocols2 = __commonJS((exports) => {
4202
+ var require_protocols2 = __commonJS(function(exports) {
4203
4203
  var cbor = require_cbor();
4204
4204
  var schema = require_schema();
4205
4205
  var client = require_client();
@@ -4,16 +4,10 @@ import {
4
4
  import {
5
5
  resolveCodexPrompt
6
6
  } from "./cli-r94z9p1z.js";
7
- import {
8
- readPkgVersion
9
- } from "./cli-d6n0thxw.js";
10
7
  import {
11
8
  SessionErrorTracker,
12
9
  buildOtelTraceparentEnv
13
- } from "./cli-psrqtw2m.js";
14
- import {
15
- summarizeSession
16
- } from "./cli-w2wxd56v.js";
10
+ } from "./cli-a3pkfpqs.js";
17
11
  import {
18
12
  CTX_MODE_NUDGE_EVERY
19
13
  } from "./cli-zm7njwzd.js";
@@ -22,11 +16,17 @@ import {
22
16
  clampContextPercent,
23
17
  computeContextUsedUnified
24
18
  } from "./cli-cw70hymf.js";
19
+ import {
20
+ readPkgVersion
21
+ } from "./cli-f64gdfxc.js";
22
+ import {
23
+ summarizeSession
24
+ } from "./cli-4bc8vmhm.js";
25
25
  import {
26
26
  buildRatingsFromLlm,
27
27
  fetchRetrievalsForTask,
28
28
  postRatings
29
- } from "./cli-2wadx7p2.js";
29
+ } from "./cli-pt43pdp1.js";
30
30
  import {
31
31
  CodexOAuthRefreshError,
32
32
  credentialsToAuthJson,
@@ -35,16 +35,19 @@ import {
35
35
  import {
36
36
  applyReasoningEffort
37
37
  } from "./cli-8whqavk2.js";
38
+ import {
39
+ swarmRuntimeInstanceId
40
+ } from "./cli-qh4sqfws.js";
38
41
  import {
39
42
  getApiKey
40
43
  } from "./cli-f14fvzag.js";
41
44
  import {
42
45
  init_secret_scrubber,
43
46
  scrubSecrets
44
- } from "./cli-4j2mrzag.js";
47
+ } from "./cli-mkq1rk7b.js";
45
48
  import {
46
49
  __require
47
- } from "./cli-p9swy5t3.js";
50
+ } from "./cli-pq2ee5ja.js";
48
51
 
49
52
  // src/providers/codex-adapter.ts
50
53
  import { existsSync as nodeExistsSync } from "node:fs";
@@ -253774,12 +253777,14 @@ function buildPoolRevalidationFailureReason(err, slot) {
253774
253777
  }
253775
253778
  async function buildCodexConfig(config, model, emit) {
253776
253779
  const mcpServers = {};
253780
+ const runtimeInstanceId = swarmRuntimeInstanceId();
253777
253781
  mcpServers["agent-swarm"] = {
253778
253782
  url: `${config.apiUrl}/mcp`,
253779
253783
  http_headers: {
253780
253784
  Authorization: `Bearer ${config.apiKey}`,
253781
253785
  "X-Agent-ID": config.agentId,
253782
- "X-Source-Task-Id": config.taskId ?? ""
253786
+ "X-Source-Task-Id": config.taskId ?? "",
253787
+ ...runtimeInstanceId ? { "X-Runtime-Instance-ID": runtimeInstanceId } : {}
253783
253788
  },
253784
253789
  enabled: true,
253785
253790
  startup_timeout_sec: 30,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __toESM
4
- } from "./cli-p9swy5t3.js";
4
+ } from "./cli-pq2ee5ja.js";
5
5
 
6
6
  // node_modules/partial-json/dist/options.js
7
- var require_options = __commonJS((exports) => {
7
+ var require_options = __commonJS(function(exports) {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Allow = exports.ALL = exports.COLLECTION = exports.ATOM = exports.SPECIAL = exports.INF = exports._INFINITY = exports.INFINITY = exports.NAN = exports.BOOL = exports.NULL = exports.OBJ = exports.ARR = exports.NUM = exports.STR = undefined;
10
10
  exports.STR = 1;
@@ -26,7 +26,7 @@ var require_options = __commonJS((exports) => {
26
26
  });
27
27
 
28
28
  // node_modules/partial-json/dist/index.js
29
- var require_dist = __commonJS((exports) => {
29
+ var require_dist = __commonJS(function(exports) {
30
30
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
31
31
  if (k2 === undefined)
32
32
  k2 = k;
@@ -2,7 +2,7 @@ import {
2
2
  init_resolver,
3
3
  init_session_templates,
4
4
  resolveTemplateAsync
5
- } from "./cli-xpxde7rm.js";
5
+ } from "./cli-2wv4kj0e.js";
6
6
 
7
7
  // src/prompts/steering-delivery.ts
8
8
  init_session_templates();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __esm
3
- } from "./cli-p9swy5t3.js";
3
+ } from "./cli-pq2ee5ja.js";
4
4
 
5
5
  // src/workflows/event-bus.ts
6
6
  import { EventEmitter } from "node:events";
@@ -4,10 +4,10 @@ import {
4
4
  require_stream,
5
5
  require_websocket,
6
6
  require_websocket_server
7
- } from "./cli-e15jhafb.js";
7
+ } from "./cli-qntkxysp.js";
8
8
  import {
9
9
  __toESM
10
- } from "./cli-p9swy5t3.js";
10
+ } from "./cli-pq2ee5ja.js";
11
11
 
12
12
  // node_modules/ws/wrapper.mjs
13
13
  var import_stream = __toESM(require_stream(), 1);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __esm,
3
3
  __export
4
- } from "./cli-p9swy5t3.js";
4
+ } from "./cli-pq2ee5ja.js";
5
5
 
6
6
  // node_modules/chalk/source/vendor/ansi-styles/index.js
7
7
  function assembleStyles() {
@@ -350,19 +350,19 @@ var init_utilities = () => {};
350
350
  // node_modules/chalk/source/index.js
351
351
  var exports_source = {};
352
352
  __export(exports_source, {
353
- supportsColorStderr: () => stderrColor,
354
- supportsColor: () => stdoutColor,
355
- modifiers: () => modifierNames,
356
- modifierNames: () => modifierNames,
357
- foregroundColors: () => foregroundColorNames,
358
- foregroundColorNames: () => foregroundColorNames,
359
- default: () => source_default,
360
- colors: () => colorNames,
361
- colorNames: () => colorNames,
362
- chalkStderr: () => chalkStderr,
363
- backgroundColors: () => backgroundColorNames,
353
+ Chalk: () => Chalk,
364
354
  backgroundColorNames: () => backgroundColorNames,
365
- Chalk: () => Chalk
355
+ backgroundColors: () => backgroundColorNames,
356
+ chalkStderr: () => chalkStderr,
357
+ colorNames: () => colorNames,
358
+ colors: () => colorNames,
359
+ default: () => source_default,
360
+ foregroundColorNames: () => foregroundColorNames,
361
+ foregroundColors: () => foregroundColorNames,
362
+ modifierNames: () => modifierNames,
363
+ modifiers: () => modifierNames,
364
+ supportsColor: () => stdoutColor,
365
+ supportsColorStderr: () => stderrColor
366
366
  });
367
367
 
368
368
  class Chalk {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __esm
3
- } from "./cli-p9swy5t3.js";
3
+ } from "./cli-pq2ee5ja.js";
4
4
 
5
5
  // src/utils/constants.ts
6
6
  function getConfiguredAppUrls() {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  require_src
3
- } from "./cli-7zd05xb4.js";
3
+ } from "./cli-whrvct19.js";
4
4
  import {
5
5
  __toESM
6
- } from "./cli-p9swy5t3.js";
6
+ } from "./cli-pq2ee5ja.js";
7
7
 
8
8
  // src/utils/error-tracker.ts
9
9
  function parseRateLimitWindowTelemetry(json, lastSeenAt = new Date().toISOString()) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  require_token_error
3
- } from "./cli-n0krnc6d.js";
3
+ } from "./cli-rzhcrw2p.js";
4
4
  import {
5
5
  __commonJS,
6
6
  __require
7
- } from "./cli-p9swy5t3.js";
7
+ } from "./cli-pq2ee5ja.js";
8
8
 
9
9
  // node_modules/@vercel/oidc/dist/token-io.js
10
- var require_token_io = __commonJS((exports, module) => {
10
+ var require_token_io = __commonJS(function(exports, module) {
11
11
  var __create = Object.create;
12
12
  var __defProp = Object.defineProperty;
13
13
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -74,7 +74,7 @@ var require_token_io = __commonJS((exports, module) => {
74
74
  });
75
75
 
76
76
  // node_modules/@vercel/oidc/dist/auth-config.js
77
- var require_auth_config = __commonJS((exports, module) => {
77
+ var require_auth_config = __commonJS(function(exports, module) {
78
78
  var __create = Object.create;
79
79
  var __defProp = Object.defineProperty;
80
80
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -146,7 +146,7 @@ var require_auth_config = __commonJS((exports, module) => {
146
146
  });
147
147
 
148
148
  // node_modules/@vercel/oidc/dist/oauth.js
149
- var require_oauth = __commonJS((exports, module) => {
149
+ var require_oauth = __commonJS(function(exports, module) {
150
150
  var __defProp = Object.defineProperty;
151
151
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
152
152
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -232,7 +232,7 @@ var require_oauth = __commonJS((exports, module) => {
232
232
  });
233
233
 
234
234
  // node_modules/@vercel/oidc/dist/token-util.js
235
- var require_token_util = __commonJS((exports, module) => {
235
+ var require_token_util = __commonJS(function(exports, module) {
236
236
  var __create = Object.create;
237
237
  var __defProp = Object.defineProperty;
238
238
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-6dpytdr2.js";
4
+ } from "./cli-6x363v1z.js";
5
5
  import {
6
6
  rewriteSlackMentions
7
- } from "./cli-7dm2zqy2.js";
7
+ } from "./cli-g0j14czv.js";
8
8
  import {
9
9
  createTaskWithSiblingAwareness
10
- } from "./cli-2f07m0xr.js";
10
+ } from "./cli-wf86d5t7.js";
11
11
  import {
12
12
  buildBufferFlushBlocks,
13
13
  ensureSlackThreadTree,
@@ -16,7 +16,7 @@ import {
16
16
  getSlackApp,
17
17
  isSlackRenderV2Enabled,
18
18
  registerTreeMessage
19
- } from "./cli-rgrfzg8z.js";
19
+ } from "./cli-grt6qv91.js";
20
20
  import {
21
21
  createLogEntry,
22
22
  getAgentById,
@@ -29,13 +29,13 @@ import {
29
29
  init_steering,
30
30
  requestSteering,
31
31
  slackContextKey
32
- } from "./cli-50vbt00w.js";
32
+ } from "./cli-m07313tr.js";
33
33
  import {
34
34
  init_registry,
35
35
  init_steering_enabled,
36
36
  isSteeringEnabled,
37
37
  registerTemplate
38
- } from "./cli-xpxde7rm.js";
38
+ } from "./cli-2wv4kj0e.js";
39
39
 
40
40
  // src/slack/event-dedup.ts
41
41
  var DEFAULT_TTL_MS = 300000;
@@ -1,17 +1,23 @@
1
1
  import {
2
2
  REBOOT_RETRY_PIN_TAG,
3
+ agentsWithLiveRuntime,
4
+ countActiveRuntimeInstancesForAgent,
3
5
  createPoolStarvationDecisionTask,
4
6
  createRerouteDecisionTask,
5
7
  createResumeFollowUp,
8
+ expireStaleRuntimeInstances,
6
9
  getNextResumeGeneration,
7
10
  getPinCandidateAgent,
8
11
  getResumeGeneration,
9
12
  repointTrackerSyncBySwarmId
10
- } from "./cli-3ty0t082.js";
13
+ } from "./cli-43x36mty.js";
14
+ import {
15
+ isMultiRuntimeEnabled
16
+ } from "./cli-qh4sqfws.js";
11
17
  import {
12
18
  getExecutorRegistry,
13
19
  recoverIncompleteRuns
14
- } from "./cli-jbcva0xj.js";
20
+ } from "./cli-mrammd8c.js";
15
21
  import {
16
22
  MAX_EMPTY_POLLS,
17
23
  assignUnassignedTaskPending,
@@ -47,21 +53,22 @@ import {
47
53
  isPoolAffinityEnforcementEnabled,
48
54
  promotePendingSteeringForTask,
49
55
  releaseStaleMentionProcessing,
56
+ releaseStaleOfferedTasksForOfflineAgents,
50
57
  releaseStaleProcessingInbox,
51
58
  releaseStaleReviewingTasks,
52
59
  supersedeTask,
53
60
  updateAgentStatus
54
- } from "./cli-50vbt00w.js";
61
+ } from "./cli-m07313tr.js";
55
62
  import {
56
63
  init_registry,
57
64
  init_resolver,
58
65
  registerTemplate,
59
66
  resolveTemplate
60
- } from "./cli-xpxde7rm.js";
67
+ } from "./cli-2wv4kj0e.js";
61
68
  import {
62
69
  init_secret_scrubber,
63
70
  scrubSecrets
64
- } from "./cli-4j2mrzag.js";
71
+ } from "./cli-mkq1rk7b.js";
65
72
 
66
73
  // src/heartbeat/heartbeat.ts
67
74
  init_db();
@@ -244,9 +251,13 @@ async function codeLevelTriage() {
244
251
  reviewingTasks: 0,
245
252
  mentionProcessing: 0,
246
253
  inboxProcessing: 0,
247
- workflowRuns: 0
254
+ workflowRuns: 0,
255
+ staleRuntimes: 0,
256
+ staleOfferedTasks: 0
248
257
  }
249
258
  };
259
+ findings.staleCleanup.staleRuntimes = expireStaleRuntimeInstances().expired;
260
+ findings.staleCleanup.staleOfferedTasks = releaseStaleOfferedTasksForOfflineAgents();
250
261
  detectAndRemediateStalledTasks(findings);
251
262
  checkWorkerHealth(findings);
252
263
  autoAssignPoolTasks(findings);
@@ -313,7 +324,7 @@ function remediateCrashedWorkerTask(findings, task, opts) {
313
324
  console.log(`[Heartbeat] Workflow-step task ${task.id.slice(0, 8)} failed — engine will handle retry (${opts.shortLabel})`);
314
325
  const remaining2 = getActiveTaskCount(task.agentId);
315
326
  if (remaining2 === 0)
316
- updateAgentStatus(task.agentId, "idle");
327
+ restoreAgentIdleAfterRemediation(task.agentId);
317
328
  }
318
329
  return;
319
330
  }
@@ -330,7 +341,7 @@ function remediateCrashedWorkerTask(findings, task, opts) {
330
341
  console.log(`[Heartbeat] Auto-failed task ${task.id.slice(0, 8)} — ${opts.shortLabel} (${skipAutoResume ? "skipRetry taskType" : "resume already exists"})`);
331
342
  const remaining2 = getActiveTaskCount(task.agentId);
332
343
  if (remaining2 === 0)
333
- updateAgentStatus(task.agentId, "idle");
344
+ restoreAgentIdleAfterRemediation(task.agentId);
334
345
  }
335
346
  return;
336
347
  }
@@ -348,7 +359,7 @@ function remediateCrashedWorkerTask(findings, task, opts) {
348
359
  console.warn(`[Heartbeat] Auto-failed task ${task.id.slice(0, 8)} — ${RESUME_BUDGET_EXHAUSTED_REASON} (${opts.shortLabel})`);
349
360
  const remaining2 = getActiveTaskCount(task.agentId);
350
361
  if (remaining2 === 0)
351
- updateAgentStatus(task.agentId, "idle");
362
+ restoreAgentIdleAfterRemediation(task.agentId);
352
363
  }
353
364
  return;
354
365
  }
@@ -396,7 +407,7 @@ function remediateCrashedWorkerTask(findings, task, opts) {
396
407
  deleteActiveSession(task.id);
397
408
  const remaining = getActiveTaskCount(task.agentId);
398
409
  if (remaining === 0)
399
- updateAgentStatus(task.agentId, "idle");
410
+ restoreAgentIdleAfterRemediation(task.agentId);
400
411
  }
401
412
  function getBootEpochMs() {
402
413
  const gs = globalThis;
@@ -449,7 +460,7 @@ async function runRebootSweep() {
449
460
  if (!failed)
450
461
  continue;
451
462
  if (getActiveTaskCount(task.agentId) === 0) {
452
- updateAgentStatus(task.agentId, "idle");
463
+ restoreAgentIdleAfterRemediation(task.agentId);
453
464
  }
454
465
  if (SKIP_AUTO_RESUME_TYPES.has(task.taskType ?? "")) {
455
466
  rebootAffectedTasks.push({ original: failed, retryTaskId: null });
@@ -524,7 +535,9 @@ function checkWorkerHealth(findings) {
524
535
  }
525
536
  function autoAssignPoolTasks(findings) {
526
537
  getDb().transaction(() => {
527
- const idleWorkers = getIdleWorkersWithCapacity().filter((w) => (w.emptyPollCount ?? 0) < MAX_EMPTY_POLLS);
538
+ const multiRuntime = isMultiRuntimeEnabled();
539
+ const withLiveRuntime = multiRuntime ? agentsWithLiveRuntime() : null;
540
+ const idleWorkers = getIdleWorkersWithCapacity().filter((w) => (w.emptyPollCount ?? 0) < MAX_EMPTY_POLLS && (withLiveRuntime === null || withLiveRuntime.has(w.id)));
528
541
  if (idleWorkers.length === 0)
529
542
  return;
530
543
  const reservedByWorker = new Map;
@@ -638,6 +651,11 @@ function escalateStarvedPoolTasks(findings) {
638
651
  }
639
652
  }
640
653
  }
654
+ function restoreAgentIdleAfterRemediation(agentId) {
655
+ if (isMultiRuntimeEnabled() && countActiveRuntimeInstancesForAgent(agentId) === 0)
656
+ return;
657
+ updateAgentStatus(agentId, "idle");
658
+ }
641
659
  async function cleanupStaleResources(findings) {
642
660
  findings.staleCleanup.sessions = cleanupStaleSessions(STALE_CLEANUP_THRESHOLD_MINUTES);
643
661
  findings.staleCleanup.reviewingTasks = releaseStaleReviewingTasks(STALE_CLEANUP_THRESHOLD_MINUTES);
@@ -773,9 +791,10 @@ function gatherSystemStatus(options) {
773
791
  for (const status of ["pending", "offered"]) {
774
792
  const tasks = getTasksByStatus(status);
775
793
  for (const task of tasks) {
776
- if (!task.agentId)
794
+ const holderId = status === "offered" ? task.offeredTo : task.agentId;
795
+ if (!holderId)
777
796
  continue;
778
- const agent = agents.find((a) => a.id === task.agentId);
797
+ const agent = agents.find((a) => a.id === holderId);
779
798
  if (!agent || agent.status === "offline") {
780
799
  orphanedTasks.push(task);
781
800
  }
@@ -786,7 +805,8 @@ function gatherSystemStatus(options) {
786
805
  sections.push("## Orphaned Tasks [auto-generated, NEEDS ATTENTION]");
787
806
  sections.push("These tasks are pending/offered but assigned to workers that are offline:");
788
807
  for (const task of orphanedTasks) {
789
- const agentName = agents.find((a) => a.id === task.agentId)?.name ?? task.agentId ?? "?";
808
+ const holderId = task.status === "offered" ? task.offeredTo : task.agentId;
809
+ const agentName = agents.find((a) => a.id === holderId)?.name ?? holderId ?? "?";
790
810
  sections.push(`- [${task.id}] "${task.task.slice(0, 100)}" — status: ${task.status}, assigned to: ${agentName}`);
791
811
  }
792
812
  sections.push("");
@@ -848,9 +868,13 @@ async function runHeartbeatSweep() {
848
868
  reviewingTasks: 0,
849
869
  mentionProcessing: 0,
850
870
  inboxProcessing: 0,
851
- workflowRuns: 0
871
+ workflowRuns: 0,
872
+ staleRuntimes: 0,
873
+ staleOfferedTasks: 0
852
874
  }
853
875
  };
876
+ cleanupOnlyFindings.staleCleanup.staleRuntimes = expireStaleRuntimeInstances().expired;
877
+ cleanupOnlyFindings.staleCleanup.staleOfferedTasks = releaseStaleOfferedTasksForOfflineAgents();
854
878
  await cleanupStaleResources(cleanupOnlyFindings);
855
879
  logFindings(cleanupOnlyFindings);
856
880
  return;
@@ -884,11 +908,21 @@ function logFindings(findings) {
884
908
  if (findings.autoAssigned.length > 0) {
885
909
  parts.push(`auto_assigned=${findings.autoAssigned.length}`);
886
910
  }
887
- const { sessions, reviewingTasks, mentionProcessing, inboxProcessing, workflowRuns } = findings.staleCleanup;
911
+ const {
912
+ sessions,
913
+ reviewingTasks,
914
+ mentionProcessing,
915
+ inboxProcessing,
916
+ workflowRuns,
917
+ staleOfferedTasks
918
+ } = findings.staleCleanup;
888
919
  const totalCleanup = sessions + reviewingTasks + mentionProcessing + inboxProcessing + workflowRuns;
889
920
  if (totalCleanup > 0) {
890
921
  parts.push(`stale_cleanup=${totalCleanup}`);
891
922
  }
923
+ if (staleOfferedTasks > 0) {
924
+ parts.push(`stale_offers_released=${staleOfferedTasks}`);
925
+ }
892
926
  if (parts.length > 0) {
893
927
  console.log(`[Heartbeat] Sweep complete: ${parts.join(", ")}`);
894
928
  }
@@ -899,12 +933,11 @@ function startHeartbeat(intervalMs = defaultIntervalMs()) {
899
933
  return;
900
934
  }
901
935
  console.log(`[Heartbeat] Starting with ${intervalMs}ms interval`);
902
- setTimeout(async () => {
903
- await runRebootSweep();
904
- runHeartbeatSweep();
936
+ setTimeout(() => {
937
+ runRebootSweep().then(() => runHeartbeatSweep()).catch((err) => console.error("[Heartbeat] boot sweep failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
905
938
  }, 5000);
906
939
  heartbeatInterval = setInterval(() => {
907
- runHeartbeatSweep();
940
+ runHeartbeatSweep().catch((err) => console.error("[Heartbeat] sweep failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
908
941
  }, intervalMs);
909
942
  startHeartbeatChecklist();
910
943
  }
@@ -955,7 +988,7 @@ function startHeartbeatChecklist(intervalMs = HEARTBEAT_CHECKLIST_INTERVAL_MS) {
955
988
  console.log(`[Heartbeat] Checklist starting with ${intervalMs}ms interval`);
956
989
  setTimeout(() => createBootTriageTask(), 90000);
957
990
  checklistInterval = setInterval(() => {
958
- checkHeartbeatChecklist();
991
+ checkHeartbeatChecklist().catch((err) => console.error("[Heartbeat] checklist check failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
959
992
  }, intervalMs);
960
993
  }
961
994
  function stopHeartbeatChecklist() {