@desplega.ai/agent-swarm 2.13.4 → 2.13.5

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 (307) hide show
  1. package/dist/acp-adapter-tbt61zkm.js +17 -0
  2. package/dist/{acp-targets-zrk9k0n7.js → acp-targets-w8dbs4nr.js} +7 -7
  3. package/dist/{actions-acqqj9jn.js → actions-8zrcbjrx.js} +26 -26
  4. package/dist/{agent-fs-provision-zmaykqnd.js → agent-fs-provision-cbt2ttds.js} +4 -4
  5. package/dist/{amp-adapter-a7ts8tmw.js → amp-adapter-8x6zp8w4.js} +2 -2
  6. package/dist/{anthropic-messages-88b7s3n9.js → anthropic-messages-vdd1zmha.js} +10 -10
  7. package/dist/{app-tmwa442h.js → app-zfa9dwjw.js} +6 -6
  8. package/dist/{approval-notifications-6psaaaye.js → approval-notifications-rv92zmza.js} +7 -7
  9. package/dist/{assistant-564v6emv.js → assistant-q7s7rm1q.js} +24 -24
  10. package/dist/{boot-args-schema-n099e0f2.js → boot-args-schema-g27kpzr1.js} +1 -1
  11. package/dist/{boot-reembed-epvg4fp9.js → boot-reembed-1mjs52nt.js} +1 -1
  12. package/dist/{boot-reembed-chx66qfk.js → boot-reembed-m62dpdkg.js} +1 -1
  13. package/dist/{boot-scrub-sweep-dhkfp0a7.js → boot-scrub-sweep-ss1vcamw.js} +2 -2
  14. package/dist/{boot-seeds-m74fc07r.js → boot-seeds-hwnvgbb3.js} +4 -4
  15. package/dist/{boxd-451q55ys.js → boxd-y0szhp0g.js} +1 -1
  16. package/dist/{claude-adapter-hw63yj3j.js → claude-adapter-0rjmbhjk.js} +7 -7
  17. package/dist/{claude-managed-adapter-z5s7fx6p.js → claude-managed-adapter-6k032agg.js} +3 -3
  18. package/dist/{claude-managed-setup-wee1762m.js → claude-managed-setup-6czvve8q.js} +4 -4
  19. package/dist/{claude-sdk-session-cktyqkpk.js → claude-sdk-session-pr0znb81.js} +12667 -11881
  20. package/dist/{cli-0fgvnb0x.js → cli-0qt3epg4.js} +3 -3
  21. package/dist/{cli-ka48vpev.js → cli-19d6v8er.js} +3 -3
  22. package/dist/{cli-zexwhj3f.js → cli-1jq2em7b.js} +3 -3
  23. package/dist/{cli-5rgm8p39.js → cli-2wzkvfgm.js} +2 -2
  24. package/dist/{cli-x2cem5vy.js → cli-34fygf87.js} +2 -2
  25. package/dist/{cli-tsc3pdfd.js → cli-3860pmrq.js} +3 -3
  26. package/dist/{cli-hhtbandk.js → cli-3vw6dd4g.js} +2 -2
  27. package/dist/{cli-qzz6tz8s.js → cli-4gaf3tx5.js} +1 -1
  28. package/dist/{cli-9ah37a8a.js → cli-55h8m1x3.js} +8 -5
  29. package/dist/{cli-7gbff32z.js → cli-5n9w2xzx.js} +1 -1
  30. package/dist/{cli-p436yrzp.js → cli-5tq15aa7.js} +1 -1
  31. package/dist/{cli-jyhbvdga.js → cli-5web09sb.js} +2 -2
  32. package/dist/{cli-3zrwrnz7.js → cli-69zzpjgh.js} +1 -1
  33. package/dist/{cli-7g3fg4gf.js → cli-6msnpj1z.js} +6 -6
  34. package/dist/{cli-azj9t1f9.js → cli-7r9tvk8v.js} +41 -3
  35. package/dist/{cli-4fpa0zns.js → cli-7ypg8hka.js} +3 -3
  36. package/dist/{cli-8cas2xvp.js → cli-887vhew6.js} +2 -2
  37. package/dist/{cli-t0jmkcah.js → cli-8pd1t17c.js} +7 -7
  38. package/dist/{cli-h9d3sdnc.js → cli-94mxerrp.js} +1 -1
  39. package/dist/{cli-bv4vvnmg.js → cli-9n6g14vs.js} +2 -2
  40. package/dist/{cli-5ashycw3.js → cli-abby987g.js} +2 -2
  41. package/dist/{cli-kj84fqxz.js → cli-avax5mp9.js} +1 -1
  42. package/dist/{cli-ea7nz50q.js → cli-b42yfn17.js} +11 -11
  43. package/dist/{cli-ysv0k1we.js → cli-b9ygp1kz.js} +1 -1
  44. package/dist/{cli-3bxrrh53.js → cli-bvamr9g0.js} +2 -2
  45. package/dist/{cli-gse7bp3z.js → cli-ced4azn1.js} +10 -9
  46. package/dist/{cli-7by7vp6m.js → cli-cmbb2t8a.js} +2 -2
  47. package/dist/{cli-0p76my9q.js → cli-cp163xga.js} +10 -10
  48. package/dist/{cli-jzerrzgc.js → cli-ebpq3c5z.js} +8 -8
  49. package/dist/{cli-p3knvk62.js → cli-ehg90jd1.js} +113 -39
  50. package/dist/{cli-jg5txpm6.js → cli-emdfd8fh.js} +75 -1
  51. package/dist/{cli-d5pc8ep0.js → cli-evy3egte.js} +7 -7
  52. package/dist/{cli-60dwk8tx.js → cli-ewk3sg68.js} +2 -2
  53. package/dist/{cli-nc4pbwmp.js → cli-f7b9nyvk.js} +4 -4
  54. package/dist/{cli-29h5239w.js → cli-f9xw9pr4.js} +4 -4
  55. package/dist/{cli-3tzmh38q.js → cli-ffn0a515.js} +7 -7
  56. package/dist/{cli-dqgnbnxs.js → cli-grbngev5.js} +6 -1
  57. package/dist/{cli-cq4am6vg.js → cli-hd5bm1e1.js} +4 -4
  58. package/dist/{cli-akm6y2a8.js → cli-htb5bpz2.js} +1 -1
  59. package/dist/{cli-tr19nyn9.js → cli-j69pzrrz.js} +6 -6
  60. package/dist/{cli-hdhpdrka.js → cli-jdq3jmny.js} +3 -3
  61. package/dist/{cli-ja450998.js → cli-ks06cd0n.js} +1 -1
  62. package/dist/{cli-pz1dp12c.js → cli-kwj3131p.js} +1 -1
  63. package/dist/{cli-1vmhnncj.js → cli-m8f4379k.js} +3 -3
  64. package/dist/{cli-jbrc98qb.js → cli-n79j1vxc.js} +2 -2
  65. package/dist/{cli-b768ek79.js → cli-nrt048ys.js} +1 -0
  66. package/dist/{cli-93n305hm.js → cli-pedm2kht.js} +1 -1
  67. package/dist/{cli-eds5xnsz.js → cli-phmy14hb.js} +2 -2
  68. package/dist/{cli-n1kjs58m.js → cli-prz1p3ft.js} +3 -3
  69. package/dist/{cli-pz1nq5xm.js → cli-q1h041y8.js} +3 -3
  70. package/dist/{cli-cah298e5.js → cli-q41qar56.js} +104 -119
  71. package/dist/{cli-4pbwg7sn.js → cli-qmx8bnt4.js} +1 -1
  72. package/dist/{cli-944w9wb4.js → cli-qrvk9nka.js} +18 -13
  73. package/dist/{cli-gtj12v95.js → cli-r3dxpmyt.js} +1 -1
  74. package/dist/{cli-phdzn699.js → cli-ryem5cfq.js} +7 -7
  75. package/dist/{cli-49aq3cyn.js → cli-s8dhq7rj.js} +4 -4
  76. package/dist/{cli-fkpnx3vf.js → cli-sejvnjvw.js} +3 -2
  77. package/dist/{cli-m1sns1da.js → cli-srre41gb.js} +2 -2
  78. package/dist/{cli-5rxsb3wq.js → cli-t0n9svkb.js} +3 -3
  79. package/dist/{cli-tzw1jr2t.js → cli-t879ww0y.js} +2 -2
  80. package/dist/{cli-xwsm6xkr.js → cli-tgc1kgg3.js} +1 -1
  81. package/dist/{cli-404am6f3.js → cli-tt7dkwjj.js} +6 -6
  82. package/dist/{cli-zjdhrzm0.js → cli-tvyt8w6n.js} +2 -2
  83. package/dist/{cli-hyqksecw.js → cli-v09eza21.js} +9 -9
  84. package/dist/{cli-rv3y60bt.js → cli-vbge4rsp.js} +4 -4
  85. package/dist/{cli-bzcwwebm.js → cli-vcpyttcw.js} +1 -1
  86. package/dist/{cli-904wk98s.js → cli-wzecestt.js} +338 -98
  87. package/dist/{cli-gkv0r2hq.js → cli-x2adbg4j.js} +70 -8
  88. package/dist/{cli-4q2c8rxw.js → cli-z3x7h79n.js} +12 -6
  89. package/dist/{cli-s33bzmk0.js → cli-z40t85ms.js} +1 -1
  90. package/dist/{cli-rmgvwcmy.js → cli-zbbtp02a.js} +98 -21
  91. package/dist/{cli-3xqad83h.js → cli-zntvmqmm.js} +1 -1
  92. package/dist/{cli-zhwjdhjr.js → cli-zxa1vmx7.js} +1 -1
  93. package/dist/{cli-50wa8k4h.js → cli-zy9bb22b.js} +1 -2
  94. package/dist/{cli-ts5yv7dn.js → cli-zzq96q57.js} +123 -33
  95. package/dist/cli.js +18 -18
  96. package/dist/{codex-adapter-2fs2c0n6.js → codex-adapter-bn7eaxk5.js} +6 -6
  97. package/dist/{codex-hook-jxjv6dy5.js → codex-hook-nnmezjg9.js} +2 -2
  98. package/dist/{codex-session-runner-r55tmx4c.js → codex-session-runner-j1e9hffc.js} +6 -6
  99. package/dist/{commands-0mxdy9x8.js → commands-amhpafrr.js} +3 -3
  100. package/dist/{controller-g3vkfhr4.js → controller-tw7g10j2.js} +3 -3
  101. package/dist/{controllers-connect-4wdmncqt.js → controllers-connect-2ssqz7f4.js} +23 -23
  102. package/dist/{core-gsvj5f3z.js → core-bwp98v4w.js} +21 -21
  103. package/dist/{cursor-adapter-t9qb96q2.js → cursor-adapter-d6knjmwa.js} +1 -1
  104. package/dist/{db-487vvyv9.js → db-fd6xxm77.js} +3 -3
  105. package/dist/{db-76p7w3gr.js → db-sc59379z.js} +2 -2
  106. package/dist/{dispatcher-64rp6w67.js → dispatcher-a2gdqz8c.js} +21 -21
  107. package/dist/{dsh-adapter-8abzqk5c.js → dsh-adapter-43ygwqn7.js} +1 -1
  108. package/dist/{e2b-dc8f6ctq.js → e2b-cn7cvjqy.js} +1 -1
  109. package/dist/{e2b-3ykbe805.js → e2b-qnxyfea6.js} +1 -1
  110. package/dist/{easter-egg-3d-jrrwyf55.js → easter-egg-3d-a0pphy71.js} +1 -1
  111. package/dist/{embedding-space-001hhhpk.js → embedding-space-qepzrach.js} +6 -6
  112. package/dist/{embeddings-esj19cnw.js → embeddings-d7vr881x.js} +1 -1
  113. package/dist/{execute-301hkxqg.js → execute-6afts2bn.js} +1 -1
  114. package/dist/{external-channel-w10e2j05.js → external-channel-881zq1x4.js} +2 -2
  115. package/dist/fx-adapter-cr2hq17y.js +20 -0
  116. package/dist/{grok-adapter-3a0ezfee.js → grok-adapter-ayddnbsc.js} +9 -9
  117. package/dist/handlers-7ghs84x2.js +41 -0
  118. package/dist/{heartbeat-tbrj7vhq.js → heartbeat-4c022m6a.js} +24 -24
  119. package/dist/{hook-3am1sq68.js → hook-4k84x499.js} +5 -5
  120. package/dist/{hook-tx917rqw.js → hook-a7eh6zty.js} +7 -7
  121. package/dist/{http-3rmemtqy.js → http-6aw5wanc.js} +180 -94
  122. package/dist/index-dtt0d634.js +44 -0
  123. package/dist/index-hmszyqkk.js +42 -0
  124. package/dist/index-j6rm1rtn.js +39 -0
  125. package/dist/{index-aetfyx6p.js → index-rwwhsmjg.js} +1 -1
  126. package/dist/{index-s7xtvc0f.js → index-xhad0n8m.js} +1 -1
  127. package/dist/{index-2jw11t8s.js → index-yq9hhhhy.js} +25 -25
  128. package/dist/{index-gfnq66t1.js → index-z2g9469g.js} +202 -17
  129. package/dist/{keepalive-9px3t7qj.js → keepalive-zhbmztqw.js} +4 -4
  130. package/dist/lead-g2j4q39z.js +83 -0
  131. package/dist/{maintenance-vwqjwst6.js → maintenance-rsp0591h.js} +1 -1
  132. package/dist/{node-2wfcey7d.js → node-0as4n1ef.js} +3 -3
  133. package/dist/{node-zd6shky9.js → node-dhxbt01p.js} +3 -3
  134. package/dist/{node-z67yjre7.js → node-rxte5hc6.js} +290 -70
  135. package/dist/{node-hjn5n1yp.js → node-t0ct2zpw.js} +3 -5
  136. package/dist/{oauth-refresh-sweep-yqry3wn4.js → oauth-refresh-sweep-w3cqmxq7.js} +3 -3
  137. package/dist/{object-webhooks-8s1wtths.js → object-webhooks-331hay92.js} +7 -7
  138. package/dist/{onboard-hb8czx0p.js → onboard-n2w80m2n.js} +3 -3
  139. package/dist/{opencode-adapter-djd6m6dk.js → opencode-adapter-z98127cz.js} +6 -6
  140. package/dist/{otel-impl-2ymwyczz.js → otel-impl-xsk35tvf.js} +1 -1
  141. package/dist/{pending-nxavtvx7.js → pending-2e6trkxd.js} +22 -22
  142. package/dist/{pi-mono-adapter-d2cpmcy4.js → pi-mono-adapter-wh6yndtm.js} +8 -8
  143. package/dist/{pricing-refresh-1yz8jkqv.js → pricing-refresh-9355dj1t.js} +2 -2
  144. package/dist/{rbac-roles-dbpx0x9v.js → rbac-roles-58y3m912.js} +3 -3
  145. package/dist/{rbac-roles-7s6m31xw.js → rbac-roles-8eajw4s6.js} +2 -2
  146. package/dist/{render-v2-7y20rjrn.js → render-v2-7gskkmd4.js} +6 -6
  147. package/dist/{resume-wz546x47.js → resume-0drnmpja.js} +9 -9
  148. package/dist/{runtime-cb5bd9tz.js → runtime-d2tcmqte.js} +1 -1
  149. package/dist/{session-access-4vcft8kq.js → session-access-0ztys6bd.js} +5 -5
  150. package/dist/{session-source-backfill-57b50tpw.js → session-source-backfill-cdm5s046.js} +2 -2
  151. package/dist/{setup-e1tevjyj.js → setup-pqwb9tcc.js} +1 -1
  152. package/dist/thread-buffer-epx3san4.js +42 -0
  153. package/dist/{tree-visibility-07wf1nct.js → tree-visibility-rwz67mje.js} +2 -2
  154. package/dist/{user-merge-jobs-n20qpv6s.js → user-merge-jobs-mxrhamwt.js} +3 -3
  155. package/dist/{virtual-modules-6fxmn1yv.js → virtual-modules-71y1gsmg.js} +3 -3
  156. package/dist/{work-objects-eg7y48pe.js → work-objects-3k4ykt9j.js} +24 -24
  157. package/dist/worker-09gqn9xy.js +83 -0
  158. package/dist/{worker-follow-up-jnvnnf2b.js → worker-follow-up-y0h64xpr.js} +21 -21
  159. package/openapi.json +387 -6
  160. package/package.json +4 -4
  161. package/src/apps/sync.ts +20 -5
  162. package/src/azure-devops/boards-sync.ts +1 -1
  163. package/src/be/db/slack-trees.ts +12 -1
  164. package/src/be/db/tasks/read.ts +25 -1
  165. package/src/be/db/tasks/write.ts +47 -12
  166. package/src/be/db/users/avatar.ts +12 -0
  167. package/src/be/db.ts +78 -5
  168. package/src/be/migrations/344_user_avatar.sql +4 -0
  169. package/src/be/migrations/345_task_status_kind.sql +6 -0
  170. package/src/be/primitives/object-embed.ts +2 -2
  171. package/src/be/primitives/objects.ts +2 -2
  172. package/src/be/runtime-pools/supervisor.ts +1 -0
  173. package/src/be/scripts/typecheck.ts +1 -1
  174. package/src/be/swarm-config-guard.ts +4 -0
  175. package/src/bitbucket/handlers.ts +1 -1
  176. package/src/commands/credential-outcome-report.ts +96 -0
  177. package/src/commands/onboard/agent-fs-version.ts +1 -1
  178. package/src/commands/runner.ts +49 -3
  179. package/src/event-waits/github.ts +39 -6
  180. package/src/event-waits/index.ts +4 -2
  181. package/src/event-waits/types.ts +10 -3
  182. package/src/extensions/contract-types.generated.ts +1 -1
  183. package/src/github/app.ts +177 -13
  184. package/src/github/handlers.ts +7 -2
  185. package/src/github/pull-request-state.ts +100 -11
  186. package/src/gitlab/handlers.ts +2 -2
  187. package/src/heartbeat/heartbeat.ts +6 -1
  188. package/src/http/api-keys.ts +26 -0
  189. package/src/http/asset-key-write.ts +45 -0
  190. package/src/http/assets.ts +4 -3
  191. package/src/http/github-token.ts +27 -6
  192. package/src/http/pages.ts +4 -10
  193. package/src/http/schedules.ts +6 -6
  194. package/src/http/sessions.ts +7 -2
  195. package/src/http/tasks.ts +23 -5
  196. package/src/http/users.ts +5 -0
  197. package/src/http/webhooks.ts +19 -1
  198. package/src/http/workflows.ts +5 -10
  199. package/src/integrations/chat-sdk/commands.ts +3 -1
  200. package/src/jira/sync.ts +1 -1
  201. package/src/linear/sync.ts +5 -3
  202. package/src/prompts/session-templates.ts +1 -0
  203. package/src/providers/acp-targets.ts +2 -2
  204. package/src/providers/amp-adapter.ts +1 -1
  205. package/src/providers/claude-adapter.ts +5 -0
  206. package/src/providers/claude-sdk-session.ts +5 -0
  207. package/src/providers/runtime-dependencies.ts +1 -1
  208. package/src/scheduler/deferred-task-waits.ts +74 -13
  209. package/src/scripts-runtime/swarm-sdk.ts +8 -1
  210. package/src/scripts-runtime/types/stdlib.d.ts +8 -1
  211. package/src/scripts-runtime/types/swarm-extension.d.ts +19 -2
  212. package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -1
  213. package/src/slack/actions.ts +1 -1
  214. package/src/slack/render-v2.ts +148 -7
  215. package/src/tests/api-drain-worker-e2e.test.ts +0 -2
  216. package/src/tests/approval-auto-cancellation-migration.test.ts +8 -19
  217. package/src/tests/approval-card-resolution.test.ts +2 -17
  218. package/src/tests/approval-requests-notifications.test.ts +41 -27
  219. package/src/tests/approval-requests.test.ts +137 -369
  220. package/src/tests/apps-sync-engine.test.ts +5 -3
  221. package/src/tests/apps-table-filters-migration.test.ts +44 -25
  222. package/src/tests/bitbucket-handlers.test.ts +2 -0
  223. package/src/tests/chat-sdk-commands.test.ts +1 -0
  224. package/src/tests/claude-adapter.test.ts +35 -0
  225. package/src/tests/codex-adapter.test.ts +3 -92
  226. package/src/tests/codex-gpt6-release.test.ts +0 -9
  227. package/src/tests/codex-oauth-credential-info.test.ts +35 -18
  228. package/src/tests/codex-oauth.test.ts +0 -6
  229. package/src/tests/codex-pool.test.ts +5 -214
  230. package/src/tests/codex-rate-limit-parse.test.ts +0 -7
  231. package/src/tests/codex-swarm-events.test.ts +11 -54
  232. package/src/tests/db-client-busy-retry.test.ts +49 -16
  233. package/src/tests/defer-task.test.ts +1 -0
  234. package/src/tests/e2e-shards.test.ts +9 -9
  235. package/src/tests/enabled-tools.test.ts +0 -2
  236. package/src/tests/fixtures/base-prompt-baseline.json +6 -6
  237. package/src/tests/github-app-worker-auth-helper.test.ts +147 -1
  238. package/src/tests/gitlab-handlers.test.ts +2 -0
  239. package/src/tests/heartbeat-jev-gate.test.ts +9 -241
  240. package/src/tests/heartbeat-reroute-decision.test.ts +2 -0
  241. package/src/tests/heartbeat-supersede-resume.test.ts +2 -0
  242. package/src/tests/heartbeat.test.ts +1 -0
  243. package/src/tests/key-usage-selection.test.ts +302 -0
  244. package/src/tests/memory-e2e.test.ts +34 -103
  245. package/src/tests/memory-key-paths.test.ts +5 -0
  246. package/src/tests/memory-rater-llm.test.ts +33 -149
  247. package/src/tests/memory-store.test.ts +24 -125
  248. package/src/tests/memory.test.ts +31 -100
  249. package/src/tests/merge-gate-detect-changes.test.ts +108 -2
  250. package/src/tests/otel-service-name.test.ts +0 -9
  251. package/src/tests/otel-session-cost-metrics.test.ts +1 -38
  252. package/src/tests/pool-session-logs.test.ts +8 -42
  253. package/src/tests/pre-push-affected-tests.test.ts +106 -0
  254. package/src/tests/prompt-template-session.test.ts +3 -0
  255. package/src/tests/runner-api-drain.test.ts +2 -17
  256. package/src/tests/runner-terminal-window-report.test.ts +132 -0
  257. package/src/tests/runtime-supervisor-failures.test.ts +1 -0
  258. package/src/tests/sandboxed-process.test.ts +26 -21
  259. package/src/tests/schedule-http-triage-tools.test.ts +12 -9
  260. package/src/tests/scheduled-tasks.test.ts +14 -51
  261. package/src/tests/script-executor-conformance.test.ts +4 -48
  262. package/src/tests/script-executor-quickjs-pool.test.ts +9 -7
  263. package/src/tests/script-native-startup.test.ts +21 -25
  264. package/src/tests/secret-rules.test.ts +4 -2
  265. package/src/tests/session-logs.test.ts +1 -260
  266. package/src/tests/slack-render-v2.test.ts +5 -148
  267. package/src/tests/task-cascade-fail.test.ts +1 -0
  268. package/src/tests/task-supersede-resume.test.ts +1 -0
  269. package/src/tests/test-proc.ts +5 -2
  270. package/src/tests/window-stream-reporter.test.ts +122 -0
  271. package/src/tests/workflow-agent-task-retry.test.ts +1 -3
  272. package/src/tests/workflow-cascade-cancel.test.ts +1 -0
  273. package/src/tests/workflow-retry-v2.test.ts +34 -43
  274. package/src/tests/workflow-retry-validation.test.ts +8 -48
  275. package/src/tests/worktree-reaper.test.ts +2 -2
  276. package/src/tools/cancel-task.ts +2 -2
  277. package/src/tools/defer-task.ts +7 -2
  278. package/src/tools/get-task-details.ts +8 -4
  279. package/src/tools/get-tasks.ts +13 -2
  280. package/src/tools/manage-user.ts +9 -0
  281. package/src/tools/store-progress.ts +5 -3
  282. package/src/types.ts +93 -0
  283. package/src/utils/constants.ts +12 -0
  284. package/src/utils/credentials.ts +42 -5
  285. package/src/utils/error-tracker.ts +6 -0
  286. package/src/utils/key-usage.ts +114 -0
  287. package/src/utils/sandboxed-process.ts +1 -0
  288. package/src/workflows/resume.ts +5 -2
  289. package/templates/skills/apps/SKILL.md +2 -0
  290. package/templates/skills/apps/content.md +2 -0
  291. package/templates/skills/boards-and-sheets/content.md +4 -2
  292. package/templates/skills/pages/content.md +7 -0
  293. package/templates/skills/swarm-docs/content.md +1 -0
  294. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  295. package/templates/skills/swarm-scripts/content.md +1 -0
  296. package/dist/acp-adapter-mr4temec.js +0 -17
  297. package/dist/fx-adapter-4sjrbdne.js +0 -20
  298. package/dist/handlers-ef3k11hb.js +0 -41
  299. package/dist/index-e6bq0exk.js +0 -42
  300. package/dist/index-hf2k1vge.js +0 -39
  301. package/dist/index-taxmejj3.js +0 -44
  302. package/dist/lead-5vt6f174.js +0 -83
  303. package/dist/thread-buffer-686pa1p1.js +0 -42
  304. package/dist/worker-4vp616ms.js +0 -83
  305. package/src/tests/apps-table-selection-migration.test.ts +0 -95
  306. package/src/tests/extensions-example-heartbeat-remediate.test.ts +0 -69
  307. package/src/tests/extensions-example-rewrite-and-suppress.test.ts +0 -70
@@ -11,32 +11,32 @@ import {
11
11
  createRerouteDecisionTask2,
12
12
  createPoolStarvationDecisionTask2,
13
13
  init_worker_follow_up
14
- } from "./cli-904wk98s.js";
15
- import"./cli-4fpa0zns.js";
16
- import"./cli-93n305hm.js";
17
- import"./cli-gse7bp3z.js";
18
- import"./cli-jyhbvdga.js";
19
- import"./cli-tr19nyn9.js";
20
- import"./cli-zhwjdhjr.js";
14
+ } from "./cli-wzecestt.js";
15
+ import"./cli-7ypg8hka.js";
16
+ import"./cli-pedm2kht.js";
17
+ import"./cli-ced4azn1.js";
18
+ import"./cli-5web09sb.js";
19
+ import"./cli-j69pzrrz.js";
20
+ import"./cli-zxa1vmx7.js";
21
21
  import"./cli-y260hgep.js";
22
- import"./cli-gtj12v95.js";
23
- import"./cli-9ah37a8a.js";
24
- import"./cli-0p76my9q.js";
25
- import"./cli-d5pc8ep0.js";
26
- import"./cli-404am6f3.js";
27
- import"./cli-29h5239w.js";
28
- import"./cli-rmgvwcmy.js";
29
- import"./cli-qzz6tz8s.js";
30
- import"./cli-7gbff32z.js";
22
+ import"./cli-r3dxpmyt.js";
23
+ import"./cli-55h8m1x3.js";
24
+ import"./cli-cp163xga.js";
25
+ import"./cli-evy3egte.js";
26
+ import"./cli-tt7dkwjj.js";
27
+ import"./cli-f9xw9pr4.js";
28
+ import"./cli-zbbtp02a.js";
29
+ import"./cli-4gaf3tx5.js";
30
+ import"./cli-5n9w2xzx.js";
31
31
  import"./cli-r8ddn0hf.js";
32
32
  import"./cli-b0m3bg0f.js";
33
33
  import"./cli-vr4eyq6p.js";
34
- import"./cli-pz1dp12c.js";
34
+ import"./cli-kwj3131p.js";
35
35
  import"./cli-ybte1fqc.js";
36
- import"./cli-ysv0k1we.js";
37
- import"./cli-x2cem5vy.js";
38
- import"./cli-kj84fqxz.js";
39
- import"./cli-ts5yv7dn.js";
36
+ import"./cli-b9ygp1kz.js";
37
+ import"./cli-34fygf87.js";
38
+ import"./cli-avax5mp9.js";
39
+ import"./cli-zzq96q57.js";
40
40
  init_worker_follow_up();
41
41
 
42
42
  export {
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "2.13.4",
5
+ "version": "2.13.5",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
@@ -258,6 +258,27 @@
258
258
  "type": "string",
259
259
  "format": "date-time"
260
260
  },
261
+ "statusKind": {
262
+ "type": "string",
263
+ "enum": [
264
+ "agent",
265
+ "runner",
266
+ "deferred",
267
+ "error",
268
+ "cascade",
269
+ "external",
270
+ "user",
271
+ "workflow",
272
+ "system",
273
+ "graceful_shutdown",
274
+ "context_limits",
275
+ "manual_supersede",
276
+ "crash_recovery",
277
+ "provider_fallback",
278
+ "workflow_retry"
279
+ ],
280
+ "description": "Why the task reached its terminal status, e.g. `failed` + `agent` (the agent chose to fail) vs `failed` + `error` (rate limit, crash, exit code). Absent while open and on rows finished before the field existed."
281
+ },
261
282
  "failureReason": {
262
283
  "type": "string"
263
284
  },
@@ -5685,6 +5706,82 @@
5685
5706
  "null"
5686
5707
  ]
5687
5708
  },
5709
+ "avatar": {
5710
+ "oneOf": [
5711
+ {
5712
+ "type": "object",
5713
+ "properties": {
5714
+ "type": {
5715
+ "type": "string",
5716
+ "enum": [
5717
+ "lucide"
5718
+ ]
5719
+ },
5720
+ "icon": {
5721
+ "type": "string",
5722
+ "maxLength": 64,
5723
+ "pattern": "^[a-z0-9-]+$"
5724
+ },
5725
+ "color": {
5726
+ "type": "string",
5727
+ "pattern": "^#[0-9a-fA-F]{6}$"
5728
+ }
5729
+ },
5730
+ "required": [
5731
+ "type",
5732
+ "icon"
5733
+ ]
5734
+ },
5735
+ {
5736
+ "type": "object",
5737
+ "properties": {
5738
+ "type": {
5739
+ "type": "string",
5740
+ "enum": [
5741
+ "url"
5742
+ ]
5743
+ },
5744
+ "url": {
5745
+ "type": "string",
5746
+ "maxLength": 2048,
5747
+ "format": "uri"
5748
+ }
5749
+ },
5750
+ "required": [
5751
+ "type",
5752
+ "url"
5753
+ ]
5754
+ },
5755
+ {
5756
+ "type": "object",
5757
+ "properties": {
5758
+ "type": {
5759
+ "type": "string",
5760
+ "enum": [
5761
+ "agent-fs"
5762
+ ]
5763
+ },
5764
+ "path": {
5765
+ "type": "string",
5766
+ "minLength": 2,
5767
+ "maxLength": 1024
5768
+ },
5769
+ "orgId": {
5770
+ "type": "string",
5771
+ "minLength": 1
5772
+ },
5773
+ "driveId": {
5774
+ "type": "string",
5775
+ "minLength": 1
5776
+ }
5777
+ },
5778
+ "required": [
5779
+ "type",
5780
+ "path"
5781
+ ]
5782
+ }
5783
+ ]
5784
+ },
5688
5785
  "createdAt": {
5689
5786
  "type": "string",
5690
5787
  "format": "date-time"
@@ -21260,6 +21357,32 @@
21260
21357
  },
21261
21358
  "authFailureFence": {
21262
21359
  "type": "integer"
21360
+ },
21361
+ "keyUsage": {
21362
+ "type": "array",
21363
+ "items": {
21364
+ "type": "number"
21365
+ }
21366
+ },
21367
+ "keyPace": {
21368
+ "type": "array",
21369
+ "items": {
21370
+ "type": "number"
21371
+ }
21372
+ },
21373
+ "selectionStrategy": {
21374
+ "type": "string",
21375
+ "enum": [
21376
+ "pace",
21377
+ "usage"
21378
+ ]
21379
+ },
21380
+ "activeSessions": {
21381
+ "type": "array",
21382
+ "items": {
21383
+ "type": "integer",
21384
+ "minimum": 0
21385
+ }
21263
21386
  }
21264
21387
  },
21265
21388
  "required": [
@@ -21267,7 +21390,11 @@
21267
21390
  "availableIndices",
21268
21391
  "totalKeys",
21269
21392
  "spendCappedIndices",
21270
- "authFailureFence"
21393
+ "authFailureFence",
21394
+ "keyUsage",
21395
+ "keyPace",
21396
+ "selectionStrategy",
21397
+ "activeSessions"
21271
21398
  ]
21272
21399
  }
21273
21400
  }
@@ -27071,7 +27198,7 @@
27071
27198
  "/api/github/installation-token": {
27072
27199
  "post": {
27073
27200
  "summary": "Mint a GitHub App installation token for worker git and gh",
27074
- "description": "Internal worker endpoint. Returns a short-lived installation token for the installation in `GITHUB_APP_INSTALLATION_ID`, minted with the API server's GitHub App credentials. The caller cannot choose the installation. Only a registered agent (swarm API key plus X-Agent-ID, or an agent or runtime token) may call it; user, guest and ACP task tokens are refused. 404 when the App or the installation id is not configured, so workers fall back to `GITHUB_TOKEN`.",
27201
+ "description": "Internal worker endpoint. Returns a short-lived installation token for worker `git` and `gh`. With a `repo` (`owner/name`) whose owner is listed in the deployment env `GITHUB_APP_REPO_OWNERS`, the API resolves that repository's App installation with the App JWT and mints for it; the repository must also be registered in `swarm_repos` on the configured GitHub host (403 otherwise). Any other call mints for the installation in `GITHUB_APP_INSTALLATION_ID`, so single-installation deployments are unchanged and a caller never picks an installation the operator did not list. Only a registered agent (swarm API key plus X-Agent-ID, or an agent or runtime token) may call it; user, guest and ACP task tokens are refused. 404 when the App is not configured, so workers fall back to `GITHUB_TOKEN`.",
27075
27202
  "tags": [
27076
27203
  "GitHub"
27077
27204
  ],
@@ -27085,7 +27212,13 @@
27085
27212
  "application/json": {
27086
27213
  "schema": {
27087
27214
  "type": "object",
27088
- "properties": {}
27215
+ "properties": {
27216
+ "repo": {
27217
+ "type": "string",
27218
+ "maxLength": 200,
27219
+ "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$"
27220
+ }
27221
+ }
27089
27222
  }
27090
27223
  }
27091
27224
  }
@@ -27114,7 +27247,7 @@
27114
27247
  }
27115
27248
  },
27116
27249
  "403": {
27117
- "description": "Caller is not a registered agent",
27250
+ "description": "Caller is not a registered agent, or the repo of a listed owner is not registered in the swarm",
27118
27251
  "content": {
27119
27252
  "application/json": {
27120
27253
  "schema": {
@@ -27134,7 +27267,7 @@
27134
27267
  }
27135
27268
  },
27136
27269
  "502": {
27137
- "description": "GitHub refused or failed to mint the token",
27270
+ "description": "GitHub refused or failed to mint the token, or the repo has no App installation",
27138
27271
  "content": {
27139
27272
  "application/json": {
27140
27273
  "schema": {
@@ -39449,6 +39582,33 @@
39449
39582
  "name": "status",
39450
39583
  "in": "query"
39451
39584
  },
39585
+ {
39586
+ "schema": {
39587
+ "type": "string",
39588
+ "enum": [
39589
+ "agent",
39590
+ "runner",
39591
+ "deferred",
39592
+ "error",
39593
+ "cascade",
39594
+ "external",
39595
+ "user",
39596
+ "workflow",
39597
+ "system",
39598
+ "graceful_shutdown",
39599
+ "context_limits",
39600
+ "manual_supersede",
39601
+ "crash_recovery",
39602
+ "provider_fallback",
39603
+ "workflow_retry"
39604
+ ],
39605
+ "description": "Why the task ended, e.g. `status=failed&statusKind=error` (crash, rate limit, exit code) vs `statusKind=agent` (the agent chose to fail). Valid kinds per status: TASK_STATUS_KINDS in src/types.ts."
39606
+ },
39607
+ "required": false,
39608
+ "description": "Why the task ended, e.g. `status=failed&statusKind=error` (crash, rate limit, exit code) vs `statusKind=agent` (the agent chose to fail). Valid kinds per status: TASK_STATUS_KINDS in src/types.ts.",
39609
+ "name": "statusKind",
39610
+ "in": "query"
39611
+ },
39452
39612
  {
39453
39613
  "schema": {
39454
39614
  "type": "string"
@@ -39836,6 +39996,27 @@
39836
39996
  "type": "string",
39837
39997
  "format": "date-time"
39838
39998
  },
39999
+ "statusKind": {
40000
+ "type": "string",
40001
+ "enum": [
40002
+ "agent",
40003
+ "runner",
40004
+ "deferred",
40005
+ "error",
40006
+ "cascade",
40007
+ "external",
40008
+ "user",
40009
+ "workflow",
40010
+ "system",
40011
+ "graceful_shutdown",
40012
+ "context_limits",
40013
+ "manual_supersede",
40014
+ "crash_recovery",
40015
+ "provider_fallback",
40016
+ "workflow_retry"
40017
+ ],
40018
+ "description": "Why the task reached its terminal status, e.g. `failed` + `agent` (the agent chose to fail) vs `failed` + `error` (rate limit, crash, exit code). Absent while open and on rows finished before the field existed."
40019
+ },
39839
40020
  "peakContextPercent": {
39840
40021
  "type": "number",
39841
40022
  "minimum": 0,
@@ -41504,6 +41685,27 @@
41504
41685
  "type": "string",
41505
41686
  "format": "date-time"
41506
41687
  },
41688
+ "statusKind": {
41689
+ "type": "string",
41690
+ "enum": [
41691
+ "agent",
41692
+ "runner",
41693
+ "deferred",
41694
+ "error",
41695
+ "cascade",
41696
+ "external",
41697
+ "user",
41698
+ "workflow",
41699
+ "system",
41700
+ "graceful_shutdown",
41701
+ "context_limits",
41702
+ "manual_supersede",
41703
+ "crash_recovery",
41704
+ "provider_fallback",
41705
+ "workflow_retry"
41706
+ ],
41707
+ "description": "Why the task reached its terminal status, e.g. `failed` + `agent` (the agent chose to fail) vs `failed` + `error` (rate limit, crash, exit code). Absent while open and on rows finished before the field existed."
41708
+ },
41507
41709
  "peakContextPercent": {
41508
41710
  "type": "number",
41509
41711
  "minimum": 0,
@@ -60173,6 +60375,27 @@
60173
60375
  "type": "string",
60174
60376
  "format": "date-time"
60175
60377
  },
60378
+ "statusKind": {
60379
+ "type": "string",
60380
+ "enum": [
60381
+ "agent",
60382
+ "runner",
60383
+ "deferred",
60384
+ "error",
60385
+ "cascade",
60386
+ "external",
60387
+ "user",
60388
+ "workflow",
60389
+ "system",
60390
+ "graceful_shutdown",
60391
+ "context_limits",
60392
+ "manual_supersede",
60393
+ "crash_recovery",
60394
+ "provider_fallback",
60395
+ "workflow_retry"
60396
+ ],
60397
+ "description": "Why the task reached its terminal status, e.g. `failed` + `agent` (the agent chose to fail) vs `failed` + `error` (rate limit, crash, exit code). Absent while open and on rows finished before the field existed."
60398
+ },
60176
60399
  "peakContextPercent": {
60177
60400
  "type": "number",
60178
60401
  "minimum": 0,
@@ -70750,6 +70973,85 @@
70750
70973
  "suspended"
70751
70974
  ]
70752
70975
  },
70976
+ "avatar": {
70977
+ "oneOf": [
70978
+ {
70979
+ "type": "object",
70980
+ "properties": {
70981
+ "type": {
70982
+ "type": "string",
70983
+ "enum": [
70984
+ "lucide"
70985
+ ]
70986
+ },
70987
+ "icon": {
70988
+ "type": "string",
70989
+ "maxLength": 64,
70990
+ "pattern": "^[a-z0-9-]+$"
70991
+ },
70992
+ "color": {
70993
+ "type": "string",
70994
+ "pattern": "^#[0-9a-fA-F]{6}$"
70995
+ }
70996
+ },
70997
+ "required": [
70998
+ "type",
70999
+ "icon"
71000
+ ]
71001
+ },
71002
+ {
71003
+ "type": "object",
71004
+ "properties": {
71005
+ "type": {
71006
+ "type": "string",
71007
+ "enum": [
71008
+ "url"
71009
+ ]
71010
+ },
71011
+ "url": {
71012
+ "type": "string",
71013
+ "maxLength": 2048,
71014
+ "format": "uri"
71015
+ }
71016
+ },
71017
+ "required": [
71018
+ "type",
71019
+ "url"
71020
+ ]
71021
+ },
71022
+ {
71023
+ "type": "object",
71024
+ "properties": {
71025
+ "type": {
71026
+ "type": "string",
71027
+ "enum": [
71028
+ "agent-fs"
71029
+ ]
71030
+ },
71031
+ "path": {
71032
+ "type": "string",
71033
+ "minLength": 2,
71034
+ "maxLength": 1024
71035
+ },
71036
+ "orgId": {
71037
+ "type": "string",
71038
+ "minLength": 1
71039
+ },
71040
+ "driveId": {
71041
+ "type": "string",
71042
+ "minLength": 1
71043
+ }
71044
+ },
71045
+ "required": [
71046
+ "type",
71047
+ "path"
71048
+ ]
71049
+ },
71050
+ {
71051
+ "type": "null"
71052
+ }
71053
+ ]
71054
+ },
70753
71055
  "identities": {
70754
71056
  "type": "array",
70755
71057
  "items": {
@@ -71783,6 +72085,85 @@
71783
72085
  "suspended"
71784
72086
  ]
71785
72087
  },
72088
+ "avatar": {
72089
+ "oneOf": [
72090
+ {
72091
+ "type": "object",
72092
+ "properties": {
72093
+ "type": {
72094
+ "type": "string",
72095
+ "enum": [
72096
+ "lucide"
72097
+ ]
72098
+ },
72099
+ "icon": {
72100
+ "type": "string",
72101
+ "maxLength": 64,
72102
+ "pattern": "^[a-z0-9-]+$"
72103
+ },
72104
+ "color": {
72105
+ "type": "string",
72106
+ "pattern": "^#[0-9a-fA-F]{6}$"
72107
+ }
72108
+ },
72109
+ "required": [
72110
+ "type",
72111
+ "icon"
72112
+ ]
72113
+ },
72114
+ {
72115
+ "type": "object",
72116
+ "properties": {
72117
+ "type": {
72118
+ "type": "string",
72119
+ "enum": [
72120
+ "url"
72121
+ ]
72122
+ },
72123
+ "url": {
72124
+ "type": "string",
72125
+ "maxLength": 2048,
72126
+ "format": "uri"
72127
+ }
72128
+ },
72129
+ "required": [
72130
+ "type",
72131
+ "url"
72132
+ ]
72133
+ },
72134
+ {
72135
+ "type": "object",
72136
+ "properties": {
72137
+ "type": {
72138
+ "type": "string",
72139
+ "enum": [
72140
+ "agent-fs"
72141
+ ]
72142
+ },
72143
+ "path": {
72144
+ "type": "string",
72145
+ "minLength": 2,
72146
+ "maxLength": 1024
72147
+ },
72148
+ "orgId": {
72149
+ "type": "string",
72150
+ "minLength": 1
72151
+ },
72152
+ "driveId": {
72153
+ "type": "string",
72154
+ "minLength": 1
72155
+ }
72156
+ },
72157
+ "required": [
72158
+ "type",
72159
+ "path"
72160
+ ]
72161
+ },
72162
+ {
72163
+ "type": "null"
72164
+ }
72165
+ ]
72166
+ },
71786
72167
  "identities": {
71787
72168
  "type": "array",
71788
72169
  "items": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "2.13.4",
3
+ "version": "2.13.5",
4
4
  "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.",
5
5
  "keywords": [
6
6
  "agent-swarm.dev",
@@ -209,8 +209,8 @@
209
209
  "dependencies": {
210
210
  "@agentclientprotocol/sdk": "2.7.0",
211
211
  "@ai-sdk/openai": "^3.0.41",
212
- "@anthropic-ai/claude-agent-sdk": "0.3.325",
213
- "@anthropic-ai/sdk": "^1.8.0",
212
+ "@anthropic-ai/claude-agent-sdk": "0.3.326",
213
+ "@anthropic-ai/sdk": "^1.9.0",
214
214
  "@asteasolutions/zod-to-openapi": "^8.0.0",
215
215
  "@aws-sdk/client-bedrock": "3.1048.0",
216
216
  "@boxd-sh/sdk": "0.2.20",
@@ -220,7 +220,7 @@
220
220
  "@chat-adapter/teams": "4.45.0",
221
221
  "@chat-adapter/telegram": "4.45.0",
222
222
  "@cursor/sdk": "1.4.0",
223
- "@desplega.ai/agent-fs-just-bash": "0.18.32",
223
+ "@desplega.ai/agent-fs-just-bash": "0.18.33",
224
224
  "@desplega.ai/business-use": "^0.4.2",
225
225
  "@earendil-works/pi-agent-core": "^1.5.2",
226
226
  "@earendil-works/pi-ai": "^1.5.2",
package/src/apps/sync.ts CHANGED
@@ -764,6 +764,7 @@ function reconcile(args: {
764
764
 
765
765
  /** In-process single-flight guard, keyed `<appId>:<model>:<source>`. */
766
766
  const inFlight = new Map<string, Promise<SyncPassResult>>();
767
+ const SYNC_PASS_CONCURRENCY = 3;
767
768
 
768
769
  function passBase(args: {
769
770
  model: string;
@@ -935,7 +936,8 @@ function noPairIssue(input: { model?: string; source?: string }): AppValidationI
935
936
  }
936
937
 
937
938
  /**
938
- * Run every `(model x source)` pair the input selects, sequentially. Each pass
939
+ * Run every `(model x source)` pair the input selects, up to
940
+ * `SYNC_PASS_CONCURRENCY` at a time. Each pass
939
941
  * pulls outside the per-(app, model) mutation lock and reconciles inside it.
940
942
  */
941
943
  export async function runAppSync(input: {
@@ -977,9 +979,22 @@ export async function runAppSync(input: {
977
979
  return { ok: false, passes: [], issues: [noPairIssue(input)] };
978
980
  }
979
981
 
980
- const passes: SyncPassResult[] = [];
981
- for (const pair of pairs) {
982
- passes.push(await runPass({ appId: app.id, ...pair, invokedBy: input.invokedBy }));
983
- }
982
+ // Passes pull outside the per-(app, model) lock and reconcile inside it, so
983
+ // they overlap safely; results stay in `pairs` order.
984
+ // shortcut: fixed limit of 3 script subprocesses per sync call, make it
985
+ // configurable if one app's passes need more or fewer.
986
+ const passes: SyncPassResult[] = new Array(pairs.length);
987
+ let next = 0;
988
+ const worker = async () => {
989
+ while (next < pairs.length) {
990
+ const i = next++;
991
+ passes[i] = await runPass({
992
+ appId: app.id,
993
+ ...(pairs[i] as (typeof pairs)[number]),
994
+ invokedBy: input.invokedBy,
995
+ });
996
+ }
997
+ };
998
+ await Promise.all(Array.from({ length: Math.min(SYNC_PASS_CONCURRENCY, pairs.length) }, worker));
984
999
  return { ok: passes.every((pass) => pass.error === undefined), passes };
985
1000
  }
@@ -676,7 +676,7 @@ export async function handleWorkItemDeleted(event: WorkItemDeletedEvent): Promis
676
676
  const task =
677
677
  sync.swarmId && !sync.swarmId.startsWith("pending:") ? await getTaskById(sync.swarmId) : null;
678
678
  if (task && !isTerminalTaskStatus(task.status)) {
679
- await cancelTask(task.id, DELETED_REASON);
679
+ await cancelTask(task.id, DELETED_REASON, { statusKind: "external" });
680
680
  console.log(`[AzureDevOps] Cancelled task ${task.id} (work item #${item.id} deleted)`);
681
681
  }
682
682
  await markTrackerDelivery(PROVIDER, "task", externalId, event.id);
@@ -138,6 +138,16 @@ export type SlackOutcomeWindow = {
138
138
  delegationEnabled: boolean;
139
139
  };
140
140
 
141
+ /**
142
+ * A Lead follow-up or resume task that may owe an outcome card. Needs alias
143
+ * `task`. Over-selects on purpose: the renderer's isSlackLeadFollowUp also
144
+ * checks the Slack ask ancestor and the channel, which SQL cannot cheaply do.
145
+ */
146
+ const SLACK_LEAD_FOLLOW_UP_SQL = `(task.source = 'system'
147
+ AND task.taskType IN ('follow-up', 'resume') AND task.slackReplySent = 0
148
+ AND task.status IN ('completed', 'failed', 'cancelled')
149
+ AND EXISTS (SELECT 1 FROM agents lead WHERE lead.id = task.agentId AND lead.isLead = 1))`;
150
+
141
151
  /**
142
152
  * Needs aliases `task` and `state` in scope. Params: slackOutcomeWindowParams.
143
153
  * shortcut: thread activity stands in for closure activity, so an expired
@@ -204,7 +214,7 @@ export async function slackThreadHasOutcomeWork(
204
214
  SELECT 1 FROM agent_tasks task, slack_render_v2_state state
205
215
  WHERE state.id = 1
206
216
  AND task.slackChannelId = ? AND task.slackThreadTs = ?
207
- AND task.source = 'slack'
217
+ AND (task.source = 'slack' OR ${SLACK_LEAD_FOLLOW_UP_SQL})
208
218
  AND task.createdAt >= state.activated_at
209
219
  AND task.status IN ('completed', 'failed', 'cancelled')
210
220
  AND ${SLACK_OUTCOME_WINDOW_SQL}
@@ -310,6 +320,7 @@ export async function getSlackProcessingThreads(
310
320
  (task.createdAt >= state.activated_at
311
321
  AND (task.source = 'slack'
312
322
  OR (task.source = 'schedule' AND task.taskType = 'deferred')
323
+ OR ${SLACK_LEAD_FOLLOW_UP_SQL}
313
324
  OR (? = 1 AND task.parentTaskId IS NOT NULL AND task.createdAt >= state.delegation_activated_at
314
325
  AND task.status IN ('completed', 'failed') AND task.slackReplySent = 0
315
326
  AND COALESCE(task.taskType, '') NOT IN ('follow-up', 'reroute-decision')))