@desplega.ai/agent-swarm 1.150.0 → 1.152.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 (311) hide show
  1. package/README.md +11 -0
  2. package/dist/{acp-adapter-d5mzggyk.js → acp-adapter-d05sg0q4.js} +5 -5
  3. package/dist/{actions-wn6ew0p7.js → actions-4sc0v342.js} +38 -11
  4. package/dist/{anthropic-messages-ec35ktvx.js → anthropic-messages-2y8nktar.js} +16 -16
  5. package/dist/{app-dty7p9hg.js → app-2d0v6kt6.js} +7 -7
  6. package/dist/{assistant-q4vhgjtx.js → assistant-zs6wdnrf.js} +41 -16
  7. package/dist/{azure-openai-responses-g85jv7m8.js → azure-openai-responses-f38x2avq.js} +13 -13
  8. package/dist/{boot-reembed-n15q6s9x.js → boot-reembed-3dwdnnsr.js} +13 -15
  9. package/dist/{boot-reembed-92292pgf.js → boot-reembed-vhh33520.js} +8 -8
  10. package/dist/{boot-scrub-logs-44pc955m.js → boot-scrub-logs-e1fnabcg.js} +5 -5
  11. package/dist/{claude-adapter-cjegjbje.js → claude-adapter-h58xqzzd.js} +12 -13
  12. package/dist/{claude-managed-adapter-p3ts5m9m.js → claude-managed-adapter-dsmkcrjy.js} +3 -3
  13. package/dist/{claude-sdk-session-7ywbn12v.js → claude-sdk-session-pbaczbgt.js} +12 -13
  14. package/dist/{cli-9gqddmxs.js → cli-4fqn2vpg.js} +8 -8
  15. package/dist/{cli-mzb0n642.js → cli-4wppfkcm.js} +350 -20
  16. package/dist/{cli-h505yhex.js → cli-5bqt4gwa.js} +2 -2
  17. package/dist/{cli-hbagregr.js → cli-5p007m2q.js} +88 -13
  18. package/dist/{cli-3ckzxdt1.js → cli-6k2athpf.js} +94 -81
  19. package/dist/{cli-3mh119qv.js → cli-72vksk1n.js} +9855 -693
  20. package/dist/{cli-taym3dmg.js → cli-87hdfyde.js} +13 -13
  21. package/dist/{cli-zthatyrx.js → cli-8fy9dmpv.js} +5 -5
  22. package/dist/{cli-asvrh7kj.js → cli-9xvdm3bx.js} +1 -1
  23. package/dist/{cli-72xdszyx.js → cli-awb59f08.js} +2 -2
  24. package/dist/{cli-vr6qj104.js → cli-cs9z1hw3.js} +1 -1
  25. package/dist/{cli-kt7wevqh.js → cli-cwvey7n1.js} +164 -56
  26. package/dist/{cli-5my3bjsd.js → cli-d3p82erb.js} +7 -7
  27. package/dist/{cli-7kwmt3r5.js → cli-evgy5w3y.js} +9 -3
  28. package/dist/{cli-111ey3ra.js → cli-f1f9n77e.js} +5 -5
  29. package/dist/{cli-ttje5a4z.js → cli-fhdssm2v.js} +105 -56
  30. package/dist/{cli-a45d5v9b.js → cli-fm4ytsdk.js} +2 -2
  31. package/dist/{cli-qp69dd5d.js → cli-gacq5hg8.js} +116 -14
  32. package/dist/{cli-hmyynq9b.js → cli-ht5rs63n.js} +1 -1
  33. package/dist/{cli-dyx0237s.js → cli-j4nv2wqy.js} +2 -4
  34. package/dist/{cli-gm0fhz13.js → cli-jh9txj4n.js} +2 -1
  35. package/dist/{cli-8chp8xab.js → cli-nd5s3m4y.js} +2 -2
  36. package/dist/{cli-zd21jrrc.js → cli-p2hx1pxm.js} +9872 -424
  37. package/dist/cli-pf9q3696.js +172 -0
  38. package/dist/{cli-7fesa1ky.js → cli-pgj4a5fb.js} +1 -1
  39. package/dist/{cli-07jd68a1.js → cli-re8z5p8p.js} +1 -1
  40. package/dist/{cli-ryz8q8p1.js → cli-t1mykkng.js} +40 -40
  41. package/dist/{cli-ck1vqzdj.js → cli-t6axtdcg.js} +9 -4
  42. package/dist/{cli-1mx65de9.js → cli-wbyk465z.js} +1 -1
  43. package/dist/{cli-kyysm7m3.js → cli-wp7cejrg.js} +1 -1
  44. package/dist/{cli-n75jt793.js → cli-z61ykvam.js} +6 -5
  45. package/dist/{cli-ceb5y160.js → cli-zdcdh02m.js} +1 -1
  46. package/dist/{cli-cmp8g3sw.js → cli-zfzznn7c.js} +45 -9
  47. package/dist/cli.js +22 -21
  48. package/dist/{codex-adapter-rn3aq7jm.js → codex-adapter-v3cz462q.js} +8 -9
  49. package/dist/{codex-hook-gthcmm0g.js → codex-hook-8jexc34x.js} +2 -2
  50. package/dist/{codex-session-runner-bge0cbsw.js → codex-session-runner-de1a5g5z.js} +8 -9
  51. package/dist/{commands-26phw0pc.js → commands-wfqqpn95.js} +5 -5
  52. package/dist/{db-jxjx6s1b.js → db-9zzv5y05.js} +5 -5
  53. package/dist/dispatcher-hfm1jbgx.js +74 -0
  54. package/dist/{google-generative-ai-tsskx7te.js → google-generative-ai-ndjmj5fa.js} +7 -7
  55. package/dist/{google-vertex-pkhpkbq9.js → google-vertex-fr665tqs.js} +10 -10
  56. package/dist/handlers-wrrhsack.js +65 -0
  57. package/dist/{hook-jw0ztn96.js → hook-9skye8zd.js} +9 -10
  58. package/dist/{hook-t6fqsggw.js → hook-fgjv62k5.js} +9 -10
  59. package/dist/{http-hyc7s57s.js → http-7grttjfq.js} +1434 -579
  60. package/dist/{index-bcyx5djw.js → index-29gxx9ar.js} +25 -17
  61. package/dist/{index-wtwpthe1.js → index-30pz2h9w.js} +25 -19
  62. package/dist/{index-1d9r6a74.js → index-4ek1df87.js} +26 -20
  63. package/dist/{index-sfhaq59d.js → index-myfwqqyq.js} +120 -102
  64. package/dist/index-pfhzrh1d.js +25 -0
  65. package/dist/{keepalive-fbsak4ya.js → keepalive-j75m2m7k.js} +7 -7
  66. package/dist/{lead-rdzdm627.js → lead-a1hpjt0a.js} +41 -49
  67. package/dist/{maintenance-25z1c1vf.js → maintenance-tngjzqdq.js} +8 -8
  68. package/dist/{node-209sxmg3.js → node-x1g4v0pq.js} +9 -9
  69. package/dist/{oauth-refresh-sweep-j3d7gtse.js → oauth-refresh-sweep-em1fn044.js} +6 -6
  70. package/dist/{onboard-dkcwrc75.js → onboard-fv7ezvwx.js} +13 -4
  71. package/dist/{openai-codex-responses-pm5gnyfa.js → openai-codex-responses-wy6a43wd.js} +11 -11
  72. package/dist/{openai-responses-vwvk1taj.js → openai-responses-6xwf7bzg.js} +13 -13
  73. package/dist/{opencode-adapter-dce4wskd.js → opencode-adapter-28axqa09.js} +4 -4
  74. package/dist/{otel-impl-8rgyy3j8.js → otel-impl-6vbb568y.js} +1 -1
  75. package/dist/{pi-mono-adapter-4s2bbkgq.js → pi-mono-adapter-jcqt71cg.js} +14 -16
  76. package/dist/{pricing-refresh-9cek71nq.js → pricing-refresh-nmm949an.js} +7 -7
  77. package/dist/{rbac-roles-vk8mqp9v.js → rbac-roles-0fz5qryx.js} +7 -7
  78. package/dist/{rbac-roles-z98s2ypy.js → rbac-roles-xtp05syf.js} +13 -9
  79. package/dist/{render-v2-3j26g0qh.js → render-v2-fpb8whme.js} +7 -7
  80. package/dist/{seed-pricing-7rxhcnzm.js → seed-pricing-zwa8bs3t.js} +6 -6
  81. package/dist/{setup-e2t7vz0c.js → setup-3ybwbdpd.js} +2 -2
  82. package/dist/{work-objects-8d3nd3x2.js → work-objects-rmayxcx7.js} +41 -16
  83. package/dist/{worker-0x9fn7nq.js → worker-rng4jhnh.js} +41 -49
  84. package/openapi.json +1351 -265
  85. package/package.json +2 -1
  86. package/src/agentmail/handlers.ts +95 -71
  87. package/src/be/db-client.ts +5 -0
  88. package/src/be/db.ts +12 -4
  89. package/src/be/extensions/db.ts +461 -0
  90. package/src/be/extensions/validate.ts +107 -0
  91. package/src/be/memory/boot-reembed.ts +17 -12
  92. package/src/be/memory/index.ts +12 -0
  93. package/src/be/memory/providers/openai-embedding.ts +4 -0
  94. package/src/be/memory/types.ts +2 -0
  95. package/src/be/migrations/155_extensions.sql +66 -0
  96. package/src/be/migrations/156_inbox_item_state_read_at.sql +7 -0
  97. package/src/be/rbac-roles.ts +3 -2
  98. package/src/be/scripts/typecheck.ts +56 -38
  99. package/src/be/seed-skills/index.ts +7 -0
  100. package/src/be/swarm-config-guard.ts +10 -2
  101. package/src/commands/onboard/compose-generator.ts +14 -2
  102. package/src/commands/onboard/env-generator.ts +7 -0
  103. package/src/commands/runner.ts +1 -1
  104. package/src/extensions/apply-task-create.ts +135 -0
  105. package/src/extensions/bundle-path.ts +10 -0
  106. package/src/extensions/contract-runtime.ts +7 -0
  107. package/src/extensions/contract-types.generated.ts +4 -0
  108. package/src/extensions/contract.ts +270 -0
  109. package/src/extensions/ctx.ts +186 -0
  110. package/src/extensions/dispatcher.ts +479 -0
  111. package/src/extensions/identity.ts +44 -0
  112. package/src/extensions/lifecycle.ts +303 -0
  113. package/src/extensions/loader.ts +207 -0
  114. package/src/extensions/post-bridge.ts +161 -0
  115. package/src/github/handlers.ts +185 -149
  116. package/src/gitlab/handlers.ts +97 -81
  117. package/src/heartbeat/heartbeat.ts +152 -83
  118. package/src/http/agents.ts +1 -1
  119. package/src/http/all-routes.ts +1 -0
  120. package/src/http/apps.ts +14 -10
  121. package/src/http/core.ts +34 -0
  122. package/src/http/extensions.ts +552 -0
  123. package/src/http/inbox-state.ts +2 -0
  124. package/src/http/index.ts +25 -0
  125. package/src/http/mcp-bridge.ts +96 -62
  126. package/src/http/mcp.ts +1 -1
  127. package/src/http/status.ts +6 -4
  128. package/src/http/tasks.ts +51 -35
  129. package/src/integrations/kapso/inbound.ts +15 -11
  130. package/src/jira/sync.ts +26 -18
  131. package/src/linear/sync.ts +26 -18
  132. package/src/prompts/session-templates.ts +5 -4
  133. package/src/rbac/admission.ts +1 -1
  134. package/src/rbac/elevated-agents.ts +24 -0
  135. package/src/rbac/legacy-policy.ts +47 -6
  136. package/src/rbac/permissions.ts +8 -0
  137. package/src/scheduler/deferred-task-waits.ts +133 -51
  138. package/src/scheduler/schedule-task.ts +50 -24
  139. package/src/scheduler/scheduler.ts +4 -2
  140. package/src/scripts-runtime/executors/native.ts +5 -1
  141. package/src/scripts-runtime/executors/types.ts +5 -0
  142. package/src/scripts-runtime/import-allowlist.ts +79 -19
  143. package/src/scripts-runtime/sdk-allowlist.ts +8 -0
  144. package/src/scripts-runtime/swarm-config.ts +8 -0
  145. package/src/scripts-runtime/swarm-sdk.ts +3 -0
  146. package/src/scripts-runtime/types/stdlib.d.ts +13 -0
  147. package/src/scripts-runtime/types/swarm-extension.d.ts +562 -0
  148. package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -0
  149. package/src/server.ts +18 -0
  150. package/src/slack/HEURISTICS.md +1 -1
  151. package/src/slack/actions.ts +21 -17
  152. package/src/slack/blocks.ts +1 -1
  153. package/src/slack/handlers.ts +98 -5
  154. package/src/slack/inbound-files.ts +6 -2
  155. package/src/slack/render-v2.ts +181 -39
  156. package/src/slack/responses.ts +7 -4
  157. package/src/slack/router.ts +13 -3
  158. package/src/slack/steering.ts +3 -3
  159. package/src/slack/task-output.ts +21 -0
  160. package/src/slack/watcher.ts +3 -2
  161. package/src/slack/work-objects.ts +2 -1
  162. package/src/tasks/errors.ts +9 -0
  163. package/src/tasks/sibling-awareness.ts +35 -1
  164. package/src/tasks/worker-follow-up.ts +64 -12
  165. package/src/tests/base-prompt.test.ts +1 -0
  166. package/src/tests/deferred-task-wake.test.ts +161 -9
  167. package/src/tests/docs-index-footprint.test.js +3 -3
  168. package/src/tests/env-flag.test.ts +1 -0
  169. package/src/tests/extensions-db.test.ts +216 -0
  170. package/src/tests/extensions-dispatcher.test.ts +275 -0
  171. package/src/tests/extensions-example-heartbeat-remediate.test.ts +69 -0
  172. package/src/tests/extensions-example-mcp-install.test.ts +63 -0
  173. package/src/tests/extensions-example-no-exclamation-marks.test.ts +72 -0
  174. package/src/tests/extensions-example-rewrite-and-suppress.test.ts +70 -0
  175. package/src/tests/extensions-example-route-slack-channel.test.ts +217 -0
  176. package/src/tests/extensions-heartbeat.test.ts +291 -0
  177. package/src/tests/extensions-http.test.ts +512 -0
  178. package/src/tests/extensions-lead-equivalence.test.ts +70 -0
  179. package/src/tests/extensions-lifecycle.test.ts +209 -0
  180. package/src/tests/extensions-loader.test.ts +95 -0
  181. package/src/tests/extensions-mcp-tools.test.ts +353 -0
  182. package/src/tests/extensions-pre-task.test.ts +487 -0
  183. package/src/tests/extensions-run-context.test.ts +41 -0
  184. package/src/tests/extensions-tool-call.test.ts +288 -0
  185. package/src/tests/extensions-validate.test.ts +196 -0
  186. package/src/tests/fixtures/extensions/bad-import/hooks.ts +8 -0
  187. package/src/tests/fixtures/extensions/bad-import/manifest.json +9 -0
  188. package/src/tests/fixtures/extensions/bad-return-shape/hooks.ts +10 -0
  189. package/src/tests/fixtures/extensions/bad-return-shape/manifest.json +9 -0
  190. package/src/tests/fixtures/extensions/block-tasks-from-source/hooks.ts +22 -0
  191. package/src/tests/fixtures/extensions/block-tasks-from-source/manifest.json +9 -0
  192. package/src/tests/fixtures/extensions/ignore-channel/hooks.ts +22 -0
  193. package/src/tests/fixtures/extensions/ignore-channel/manifest.json +9 -0
  194. package/src/tests/fixtures/extensions/load.ts +10 -0
  195. package/src/tests/fixtures/extensions/minimal/hooks.ts +7 -0
  196. package/src/tests/fixtures/extensions/minimal/manifest.json +9 -0
  197. package/src/tests/fixtures/extensions/never-fail-long-tasks/hooks.ts +11 -0
  198. package/src/tests/fixtures/extensions/never-fail-long-tasks/manifest.json +9 -0
  199. package/src/tests/fixtures/extensions/no-exclamation-marks/hooks.ts +23 -0
  200. package/src/tests/fixtures/extensions/no-exclamation-marks/manifest.json +9 -0
  201. package/src/tests/fixtures/extensions/post-logger/hooks.ts +9 -0
  202. package/src/tests/fixtures/extensions/post-logger/manifest.json +9 -0
  203. package/src/tests/fixtures/extensions/priority-a/hooks.ts +7 -0
  204. package/src/tests/fixtures/extensions/priority-a/manifest.json +9 -0
  205. package/src/tests/fixtures/extensions/priority-b/hooks.ts +7 -0
  206. package/src/tests/fixtures/extensions/priority-b/manifest.json +9 -0
  207. package/src/tests/fixtures/extensions/record-only-on-tag/hooks.ts +16 -0
  208. package/src/tests/fixtures/extensions/record-only-on-tag/manifest.json +9 -0
  209. package/src/tests/fixtures/extensions/reserved-assets/hooks.ts +5 -0
  210. package/src/tests/fixtures/extensions/reserved-assets/manifest.json +10 -0
  211. package/src/tests/fixtures/extensions/rewrite-progress-prefix/hooks.ts +22 -0
  212. package/src/tests/fixtures/extensions/rewrite-progress-prefix/manifest.json +9 -0
  213. package/src/tests/fixtures/extensions/rewrite-task-priority/hooks.ts +7 -0
  214. package/src/tests/fixtures/extensions/rewrite-task-priority/manifest.json +9 -0
  215. package/src/tests/fixtures/extensions/route-channel-to-agent/hooks.ts +26 -0
  216. package/src/tests/fixtures/extensions/route-channel-to-agent/manifest.json +9 -0
  217. package/src/tests/fixtures/extensions/slow/hooks.ts +10 -0
  218. package/src/tests/fixtures/extensions/slow/manifest.json +9 -0
  219. package/src/tests/fixtures/extensions/suppress-lead-follow-up/hooks.ts +12 -0
  220. package/src/tests/fixtures/extensions/suppress-lead-follow-up/manifest.json +9 -0
  221. package/src/tests/fixtures/extensions/throws/hooks.ts +12 -0
  222. package/src/tests/fixtures/extensions/throws/manifest.json +9 -0
  223. package/src/tests/fixtures/extensions/worker-runtime/hooks.ts +5 -0
  224. package/src/tests/fixtures/extensions/worker-runtime/manifest.json +9 -0
  225. package/src/tests/fixtures/store-progress-malformed-output.json +4 -0
  226. package/src/tests/memory-edit-authorization.test.ts +32 -0
  227. package/src/tests/multi-runtime-enabled-stats.test.ts +2 -2
  228. package/src/tests/multi-runtime-registration.test.ts +14 -14
  229. package/src/tests/onboard-compose.test.ts +44 -0
  230. package/src/tests/preload.ts +5 -0
  231. package/src/tests/rbac-admission-e2e.test.ts +35 -4
  232. package/src/tests/rbac-admission.test.ts +18 -3
  233. package/src/tests/rbac-e2e-helpers.ts +18 -0
  234. package/src/tests/rbac-engine.test.ts +39 -0
  235. package/src/tests/rbac-mcp-admission-e2e.test.ts +22 -4
  236. package/src/tests/realtime-room-auth.test.ts +1 -1
  237. package/src/tests/reload-config.test.ts +61 -0
  238. package/src/tests/routing-affinity-inventory.test.ts +1 -1
  239. package/src/tests/script-connections.test.ts +2 -0
  240. package/src/tests/scripts-boot-reembed.test.ts +4 -0
  241. package/src/tests/scripts-embeddings.test.ts +4 -0
  242. package/src/tests/scripts-import-allowlist.test.ts +44 -1
  243. package/src/tests/scripts-mcp-e2e.test.ts +80 -0
  244. package/src/tests/scripts-only-gating.test.ts +6 -0
  245. package/src/tests/scripts-runtime-identity.test.ts +1 -1
  246. package/src/tests/slack-blocks.test.ts +12 -1
  247. package/src/tests/slack-render-v2.test.ts +100 -5
  248. package/src/tests/slack-router.test.ts +17 -2
  249. package/src/tests/slack-steering.test.ts +19 -0
  250. package/src/tests/slack-task-output.test.ts +36 -0
  251. package/src/tests/status.test.ts +12 -0
  252. package/src/tests/steering-enabled.test.ts +6 -8
  253. package/src/tests/store-progress-attachments-handler.test.ts +100 -1
  254. package/src/tests/swarm-config-reserved-keys.test.ts +6 -1
  255. package/src/tests/task-tool-preload-mcp.test.ts +4 -1
  256. package/src/tests/tool-annotations.test.ts +1 -1
  257. package/src/tests/tool-registrar-no-input.test.ts +42 -1
  258. package/src/tools/defer-task.ts +1 -1
  259. package/src/tools/extension-activate-version.ts +38 -0
  260. package/src/tools/extension-common.ts +85 -0
  261. package/src/tools/extension-delete.ts +29 -0
  262. package/src/tools/extension-disable.ts +36 -0
  263. package/src/tools/extension-enable.ts +36 -0
  264. package/src/tools/extension-install.ts +65 -0
  265. package/src/tools/extension-list.ts +66 -0
  266. package/src/tools/script-common.ts +43 -18
  267. package/src/tools/send-task.ts +69 -107
  268. package/src/tools/store-progress.ts +30 -0
  269. package/src/tools/task-action.ts +43 -22
  270. package/src/tools/task-tool-ctx.ts +2 -0
  271. package/src/tools/tool-config.ts +7 -1
  272. package/src/tools/utils.ts +140 -16
  273. package/src/types.ts +133 -0
  274. package/src/utils/multi-runtime.ts +2 -2
  275. package/src/utils/steering-enabled.ts +4 -4
  276. package/src/workflows/executors/agent-task.ts +13 -3
  277. package/templates/extensions/README.md +17 -0
  278. package/templates/extensions/notify-on-complete/README.md +11 -0
  279. package/templates/extensions/notify-on-complete/hooks.ts +61 -0
  280. package/templates/extensions/notify-on-complete/manifest.json +7 -0
  281. package/templates/extensions/require-ticket-ref/README.md +11 -0
  282. package/templates/extensions/require-ticket-ref/hooks.ts +30 -0
  283. package/templates/extensions/require-ticket-ref/manifest.json +7 -0
  284. package/templates/extensions/require-verification-note/README.md +11 -0
  285. package/templates/extensions/require-verification-note/hooks.ts +32 -0
  286. package/templates/extensions/require-verification-note/manifest.json +7 -0
  287. package/templates/skills/agent-browser/SKILL.md +84 -0
  288. package/templates/skills/agent-browser/content.md +21 -0
  289. package/templates/skills/scheduling/content.md +2 -0
  290. package/templates/skills/swarm-extensions/config.json +14 -0
  291. package/templates/skills/swarm-extensions/content.md +120 -0
  292. package/dist/cli-b8x19vbh.js +0 -823
  293. package/dist/cli-n1yj5fd5.js +0 -164
  294. package/dist/cli-q04q68be.js +0 -3066
  295. package/dist/cli-qgm2pfpq.js +0 -6377
  296. package/dist/cli-rnsr8asm.js +0 -4323
  297. package/dist/cli-rwp3ksm7.js +0 -545
  298. package/dist/cli-xjb9wghj.js +0 -668
  299. package/dist/cli-xvkmedgn.js +0 -332
  300. package/dist/cli-ydk0wjj8.js +0 -338
  301. package/dist/handlers-vr1djg4n.js +0 -41
  302. package/dist/{claude-managed-setup-f5pmsyrp.js → claude-managed-setup-48dwg9bv.js} +3 -3
  303. package/dist/{cli-81r683bv.js → cli-ch38q5z4.js} +0 -0
  304. package/dist/{cli-wk0gjrn3.js → cli-kj76p1ez.js} +6 -6
  305. package/dist/{cli-c71mg51n.js → cli-r2fpe7cx.js} +5 -5
  306. package/dist/{cli-8qx7jnrk.js → cli-y6x0gqtg.js} +16 -16
  307. package/dist/{index-aa3sa6s8.js → index-2wsdsnmm.js} +1 -1
  308. package/dist/{mistral-conversations-4ryk7h83.js → mistral-conversations-qhr84ph3.js} +9 -9
  309. package/dist/{openai-completions-qdcmkfnr.js → openai-completions-32rdwmze.js} +17 -17
  310. package/dist/{openrouter-images-qx18fyp8.js → openrouter-images-9f9ek4rw.js} +3 -3
  311. package/dist/{pi-messages-79jvzz1d.js → pi-messages-b1mbr6gp.js} +4 -4
@@ -1,12 +1,9 @@
1
- import {
2
- resolveCodexPrompt
3
- } from "./cli-r94z9p1z.js";
4
1
  import {
5
2
  createSwarmEventHandler
6
3
  } from "./cli-hsxj0yar.js";
7
4
  import {
8
- readPkgVersion
9
- } from "./cli-2djtr51b.js";
5
+ resolveCodexPrompt
6
+ } from "./cli-r94z9p1z.js";
10
7
  import {
11
8
  SessionErrorTracker,
12
9
  buildOtelTraceparentEnv
@@ -14,14 +11,17 @@ import {
14
11
  import {
15
12
  CTX_MODE_NUDGE_EVERY
16
13
  } from "./cli-zm7njwzd.js";
17
- import {
18
- summarizeSession
19
- } from "./cli-dyx0237s.js";
20
14
  import {
21
15
  CONTEXT_FORMULA,
22
16
  clampContextPercent,
23
17
  computeContextUsedUnified
24
18
  } from "./cli-s25avqg9.js";
19
+ import {
20
+ readPkgVersion
21
+ } from "./cli-2djtr51b.js";
22
+ import {
23
+ summarizeSession
24
+ } from "./cli-j4nv2wqy.js";
25
25
  import {
26
26
  applyReasoningEffort
27
27
  } from "./cli-4yc5d8fk.js";
@@ -29,15 +29,15 @@ import {
29
29
  buildRatingsFromLlm,
30
30
  fetchRetrievalsForTask,
31
31
  postRatings
32
- } from "./cli-xvkmedgn.js";
33
- import {
34
- swarmRuntimeInstanceId
35
- } from "./cli-07jd68a1.js";
32
+ } from "./cli-4wppfkcm.js";
36
33
  import {
37
34
  CodexOAuthRefreshError,
38
35
  credentialsToAuthJson,
39
36
  getValidCodexOAuth
40
37
  } from "./cli-e7d20cty.js";
38
+ import {
39
+ swarmRuntimeInstanceId
40
+ } from "./cli-re8z5p8p.js";
41
41
  import {
42
42
  detachedProcessGroup,
43
43
  registerProcessGroup,
@@ -49,7 +49,7 @@ import {
49
49
  import {
50
50
  init_package,
51
51
  package_default
52
- } from "./cli-gm0fhz13.js";
52
+ } from "./cli-jh9txj4n.js";
53
53
  import {
54
54
  init_secret_scrubber,
55
55
  scrubSecrets
@@ -1,9 +1,9 @@
1
+ import {
2
+ runStopHookSessionSummarySubprocess
3
+ } from "./cli-f1f9n77e.js";
1
4
  import {
2
5
  fetchInstalledMcpServers
3
6
  } from "./cli-tng3131n.js";
4
- import {
5
- runStopHookSessionSummarySubprocess
6
- } from "./cli-111ey3ra.js";
7
7
  import {
8
8
  SessionErrorTracker,
9
9
  buildOtelTraceparentEnv,
@@ -29,7 +29,7 @@ import {
29
29
  } from "./cli-4yc5d8fk.js";
30
30
  import {
31
31
  swarmRuntimeInstanceId
32
- } from "./cli-07jd68a1.js";
32
+ } from "./cli-re8z5p8p.js";
33
33
  import {
34
34
  detachedProcessGroup,
35
35
  registerProcessGroup,
@@ -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-7ywbn12v.js") : undefined;
822
+ const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-pbaczbgt.js") : undefined;
823
823
  claudeSdk?.validateClaudeSdkAdditionalArgs([
824
824
  ...claudeBinaryArgv.slice(1),
825
825
  ...config.additionalArgs ?? []
@@ -3966,7 +3966,7 @@ _EnvironmentWorker_signal = new WeakMap, _EnvironmentWorker_instances = new Weak
3966
3966
  const ctrl = new AbortController;
3967
3967
  const detachExternal = linkAbort(externalSignal, ctrl);
3968
3968
  const lease = new Lease(ctrl);
3969
- const agentToolset = await import("./node-209sxmg3.js");
3969
+ const agentToolset = await import("./node-x1g4v0pq.js");
3970
3970
  let leaseTtlMs;
3971
3971
  let runner;
3972
3972
  const heartbeatPromise = heartbeatLoop(sessionClient, work, lease, log2, this.requestOptions, (ttlMs) => {
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-ydk0wjj8.js";
7
+ } from "./cli-72vksk1n.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-qp69dd5d.js";
12
+ } from "./cli-gacq5hg8.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();
@@ -7,7 +7,7 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-qp69dd5d.js";
10
+ } from "./cli-gacq5hg8.js";
11
11
  import {
12
12
  init_secret_scrubber,
13
13
  registerVolatileSecret,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  require_follow_redirects
3
3
  } from "./cli-q51yprfq.js";
4
- import {
5
- init_task_attachment_links,
6
- taskAttachmentDisplayUrl
7
- } from "./cli-2658f6at.js";
8
4
  import {
9
5
  require_jws,
10
6
  require_p_retry
11
7
  } from "./cli-yatxqynm.js";
8
+ import {
9
+ init_task_attachment_links,
10
+ taskAttachmentDisplayUrl
11
+ } from "./cli-2658f6at.js";
12
12
  import {
13
13
  SLACK_REACTION_CONFIG_KEYS,
14
14
  SLACK_REACTION_DEFAULTS,
@@ -49,7 +49,7 @@ import {
49
49
  setSlackMessageTracking,
50
50
  slackContextKey,
51
51
  updateSlackMessageRecord
52
- } from "./cli-qp69dd5d.js";
52
+ } from "./cli-gacq5hg8.js";
53
53
  import {
54
54
  getAppUrl,
55
55
  init_constants
@@ -54475,7 +54475,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
54475
54475
  return;
54476
54476
  initialized = true;
54477
54477
  try {
54478
- const impl = await import("./otel-impl-8rgyy3j8.js");
54478
+ const impl = await import("./otel-impl-6vbb568y.js");
54479
54479
  await impl.boot(serviceRole);
54480
54480
  realWithSpan = impl.withSpan;
54481
54481
  realStartSpan = impl.startSpan;
@@ -54845,9 +54845,9 @@ function collectAttachmentNodes(roots) {
54845
54845
  function buildTreeBlocks(roots) {
54846
54846
  console.log(`[Slack] Building tree blocks for ${roots.length} root(s): ${roots.map((r) => r.taskId.slice(0, 8)).join(", ")}`);
54847
54847
  const treeTexts = roots.map(renderTree);
54848
- const blocks = [sectionBlock(treeTexts.join(`
54848
+ const blocks = treeTexts.length > 0 ? [sectionBlock(treeTexts.join(`
54849
54849
 
54850
- `))];
54850
+ `))] : [];
54851
54851
  const attachmentNodes = collectAttachmentNodes(roots);
54852
54852
  const visibleAttachmentNodes = attachmentNodes.slice(0, SLACK_TREE_ATTACHMENT_BLOCKS_MAX);
54853
54853
  for (const node of visibleAttachmentNodes) {
@@ -54871,6 +54871,24 @@ function buildTreeBlocks(roots) {
54871
54871
 
54872
54872
  // src/slack/responses.ts
54873
54873
  init_db();
54874
+
54875
+ // src/slack/task-output.ts
54876
+ function slackTaskOutput(task) {
54877
+ const output = task.output ?? undefined;
54878
+ if (task.status !== "completed" || task.outputSchema || !task.tags?.includes("deferred")) {
54879
+ return output;
54880
+ }
54881
+ const notice = output?.match(/^Deferred until [^\n]+? \([^\n]+?\) -> (.*)$/);
54882
+ if (!notice)
54883
+ return output;
54884
+ const pending = notice[1]?.trim();
54885
+ return pending ? `Pending: ${pending}` : "";
54886
+ }
54887
+ function isSlackEtaOnlyNotice(task) {
54888
+ return !!task.output && slackTaskOutput(task) === "";
54889
+ }
54890
+
54891
+ // src/slack/responses.ts
54874
54892
  function classifySlackUpdateError(error) {
54875
54893
  const errorCode = error?.data?.error;
54876
54894
  if (errorCode === "message_not_found" || errorCode === "channel_not_found" || errorCode === "thread_not_found") {
@@ -54890,7 +54908,7 @@ function shouldPostInlineCompletionOutput(task) {
54890
54908
  return false;
54891
54909
  if (task.slackReplySent)
54892
54910
  return false;
54893
- const output = task.output?.trim();
54911
+ const output = slackTaskOutput(task)?.trim();
54894
54912
  return !!output && isTreeOutputTruncated(markdownToSlack(output));
54895
54913
  }
54896
54914
  function formatInlineCompletionOutputChunks(opts) {
@@ -54913,7 +54931,7 @@ async function sendInlineTaskOutput(task) {
54913
54931
  const chunks = formatInlineCompletionOutputChunks({
54914
54932
  agentName: agent.name,
54915
54933
  taskId: task.id,
54916
- output: task.output
54934
+ output: slackTaskOutput(task) ?? ""
54917
54935
  });
54918
54936
  try {
54919
54937
  for (let i = 0;i < chunks.length; i += MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE) {
@@ -54940,6 +54958,8 @@ async function sendInlineTaskOutput(task) {
54940
54958
  }
54941
54959
  }
54942
54960
  async function sendTaskResponse(task) {
54961
+ if (isSlackEtaOnlyNotice(task))
54962
+ return true;
54943
54963
  const app = getSlackApp();
54944
54964
  if (!app || !task.slackChannelId || !task.slackThreadTs) {
54945
54965
  return false;
@@ -54957,7 +54977,7 @@ async function sendTaskResponse(task) {
54957
54977
  const agentName = agent.name;
54958
54978
  try {
54959
54979
  if (task.status === "completed") {
54960
- const output = task.output || "Task completed.";
54980
+ const output = slackTaskOutput(task) || "Task completed.";
54961
54981
  const slackOutput = markdownToSlack(output);
54962
54982
  const attachmentsBlock = formatAttachmentsBlockForSlack(await getTaskAttachments(task.id));
54963
54983
  const body = slackOutput + attachmentsBlock;
@@ -55065,6 +55085,8 @@ async function updateProgressInPlace(task, progress, messageTs) {
55065
55085
  }
55066
55086
  }
55067
55087
  async function updateToFinal(task, messageTs) {
55088
+ if (isSlackEtaOnlyNotice(task))
55089
+ return "ok";
55068
55090
  const app = getSlackApp();
55069
55091
  if (!app || !task.slackChannelId || !task.agentId)
55070
55092
  return "failed";
@@ -55076,7 +55098,7 @@ async function updateToFinal(task, messageTs) {
55076
55098
  let text;
55077
55099
  let completionBlockBatches;
55078
55100
  if (task.status === "completed") {
55079
- const output = task.output || "Task completed.";
55101
+ const output = slackTaskOutput(task) || "Task completed.";
55080
55102
  const slackOutput = markdownToSlack(output);
55081
55103
  const attachmentsBlock = formatAttachmentsBlockForSlack(await getTaskAttachments(task.id));
55082
55104
  const body = slackOutput + attachmentsBlock;
@@ -55265,7 +55287,7 @@ async function buildTreeNodes(tree) {
55265
55287
  progress: child.progress ?? undefined,
55266
55288
  duration: childDuration,
55267
55289
  slackReplySent: child.slackReplySent,
55268
- output: child.output ?? undefined,
55290
+ output: slackTaskOutput(child),
55269
55291
  failureReason: child.failureReason ?? undefined,
55270
55292
  attachments: childAttachments,
55271
55293
  steered: childSteered,
@@ -55283,7 +55305,7 @@ async function buildTreeNodes(tree) {
55283
55305
  progress: task.progress ?? undefined,
55284
55306
  duration,
55285
55307
  slackReplySent: task.slackReplySent,
55286
- output: task.output ?? undefined,
55308
+ output: slackTaskOutput(task),
55287
55309
  failureReason: task.failureReason ?? undefined,
55288
55310
  attachments: rootAttachments,
55289
55311
  steered: rootSteered,
@@ -55793,15 +55815,15 @@ async function initSlackApp() {
55793
55815
  logLevel: import_bolt.LogLevel.DEBUG,
55794
55816
  ...slackApiUrl ? { clientOptions: { slackApiUrl } } : {}
55795
55817
  });
55796
- const { registerMessageHandler } = await import("./handlers-vr1djg4n.js");
55797
- const { registerCommandHandler } = await import("./commands-26phw0pc.js");
55798
- const { registerActionHandlers } = await import("./actions-wn6ew0p7.js");
55799
- const { registerWorkObjectHandlers } = await import("./work-objects-8d3nd3x2.js");
55818
+ const { registerMessageHandler } = await import("./handlers-wrrhsack.js");
55819
+ const { registerCommandHandler } = await import("./commands-wfqqpn95.js");
55820
+ const { registerActionHandlers } = await import("./actions-4sc0v342.js");
55821
+ const { registerWorkObjectHandlers } = await import("./work-objects-rmayxcx7.js");
55800
55822
  registerMessageHandler(app);
55801
55823
  registerCommandHandler(app);
55802
55824
  registerActionHandlers(app);
55803
55825
  registerWorkObjectHandlers(app);
55804
- const { createAssistant } = await import("./assistant-q4vhgjtx.js");
55826
+ const { createAssistant } = await import("./assistant-zs6wdnrf.js");
55805
55827
  app.assistant(createAssistant());
55806
55828
  return app;
55807
55829
  }
@@ -55810,7 +55832,7 @@ async function startSlackApp() {
55810
55832
  await initSlackApp();
55811
55833
  }
55812
55834
  if (app) {
55813
- const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-3j26g0qh.js");
55835
+ const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-fpb8whme.js");
55814
55836
  if (isSlackRenderV2Enabled2())
55815
55837
  await ensureSlackRenderV2Activation();
55816
55838
  await app.start();
@@ -55984,7 +56006,7 @@ var lastTreeText = new Map;
55984
56006
  var lastTreeUpdateAt = new Map;
55985
56007
  var cachedTeamId;
55986
56008
  function isSlackRenderV2Enabled() {
55987
- return isEnvFlagEnabled("SLACK_RENDER_V2", false);
56009
+ return isEnvFlagEnabled("SLACK_RENDER_V2", true);
55988
56010
  }
55989
56011
  function isSlackDelegationEnabled() {
55990
56012
  return isEnvFlagEnabled("SLACK_RENDER_V2_DELEGATION", false);
@@ -56013,6 +56035,61 @@ async function callSlackWithRetry(client, method, payload) {
56013
56035
  }
56014
56036
  }
56015
56037
  }
56038
+ var OUTCOME_DELIVERY_MAX_ATTEMPTS = 5;
56039
+ var OUTCOME_DELIVERY_BASE_DELAY_MS = 30000;
56040
+ var OUTCOME_DELIVERY_MAX_DELAY_MS = 30 * 60000;
56041
+ var outcomeDeliveryFailures = new Map;
56042
+ function outcomeDeliveryGate(taskId) {
56043
+ const state = outcomeDeliveryFailures.get(taskId);
56044
+ if (!state)
56045
+ return true;
56046
+ if (state.count >= OUTCOME_DELIVERY_MAX_ATTEMPTS)
56047
+ return false;
56048
+ return Date.now() >= state.nextAttemptAt;
56049
+ }
56050
+ function noteOutcomeDeliverySuccess(taskId) {
56051
+ outcomeDeliveryFailures.delete(taskId);
56052
+ }
56053
+ async function noteOutcomeDeliveryFailure(task, error) {
56054
+ const state = outcomeDeliveryFailures.get(task.id) ?? { count: 0, nextAttemptAt: 0 };
56055
+ state.count += 1;
56056
+ const delay = Math.min(OUTCOME_DELIVERY_BASE_DELAY_MS * 2 ** (state.count - 1), OUTCOME_DELIVERY_MAX_DELAY_MS);
56057
+ state.nextAttemptAt = Date.now() + delay;
56058
+ outcomeDeliveryFailures.set(task.id, state);
56059
+ console.error(`[Slack] Outcome delivery failed for task ${task.id} (attempt ${state.count}/${OUTCOME_DELIVERY_MAX_ATTEMPTS}):`, error);
56060
+ if (state.count >= OUTCOME_DELIVERY_MAX_ATTEMPTS) {
56061
+ console.error(`[Slack] Giving up on outcome delivery for task ${task.id} after ${state.count} attempts; surfacing failure and clearing the working indicator`);
56062
+ await surfaceOutcomeDeliveryGiveUp(task, error);
56063
+ }
56064
+ }
56065
+ async function surfaceOutcomeDeliveryGiveUp(task, error) {
56066
+ const app2 = getSlackApp();
56067
+ if (!app2 || !task.slackChannelId || !task.slackThreadTs)
56068
+ return;
56069
+ try {
56070
+ await app2.client.apiCall("chat.postMessage", {
56071
+ channel: task.slackChannelId,
56072
+ thread_ts: task.slackThreadTs,
56073
+ text: `⚠️ Couldn't deliver this task's reply after ${OUTCOME_DELIVERY_MAX_ATTEMPTS} attempts (${error instanceof Error ? error.message : String(error)}). See task ${getTaskLink(task.id)} for the result.`
56074
+ });
56075
+ } catch (postError) {
56076
+ console.error(`[Slack] Give-up notice failed to post for task ${task.id}:`, postError);
56077
+ }
56078
+ await clearAssistantStatus(app2.client, task.slackChannelId, task.slackThreadTs);
56079
+ }
56080
+ async function clearAssistantStatus(client, channelId, threadTs) {
56081
+ if (!channelId.startsWith("D"))
56082
+ return;
56083
+ try {
56084
+ await client.apiCall("assistant.threads.setStatus", {
56085
+ channel_id: channelId,
56086
+ thread_ts: threadTs,
56087
+ status: ""
56088
+ });
56089
+ } catch (error) {
56090
+ console.warn(`[Slack] Failed to clear assistant status for ${channelId}/${threadTs}:`, error);
56091
+ }
56092
+ }
56016
56093
  function slackTreeStallMinutes() {
56017
56094
  return Number(process.env.SLACK_TREE_STALL_MIN) || 15;
56018
56095
  }
@@ -56458,7 +56535,7 @@ ${outcomeText(task.failureReason, "Task was cancelled.")}`;
56458
56535
  }
56459
56536
  return `✅
56460
56537
 
56461
- ${outcomeText(task.output, "Task completed.")}`;
56538
+ ${outcomeText(slackTaskOutput(task), "Task completed.")}`;
56462
56539
  }
56463
56540
  async function agentDisplayNameFor(task) {
56464
56541
  return task.agentId ? (await getAgentById(task.agentId))?.name ?? "Agent" : "Agent";
@@ -56475,20 +56552,23 @@ ${outcomeText(task.failureReason, "Task failed.")}`;
56475
56552
  }
56476
56553
  return `↳ ✅ ${agentName} — result
56477
56554
 
56478
- ${outcomeText(task.output, "Task completed.")}`;
56555
+ ${outcomeText(slackTaskOutput(task), "Task completed.")}`;
56556
+ }
56557
+ function isSlackContinuation(task) {
56558
+ return task.source === "schedule" && task.taskType === "deferred" && !!task.slackChannelId && !!task.slackThreadTs;
56479
56559
  }
56480
56560
  function isChildCardCandidate(task, delegationActivatedAt) {
56481
- return task.source !== "slack" && !!task.slackChannelId && !!task.slackThreadTs && (task.status === "completed" || task.status === "failed") && task.taskType !== "follow-up" && task.taskType !== "reroute-decision" && task.createdAt >= delegationActivatedAt;
56561
+ return !isSlackEtaOnlyNotice(task) && task.source !== "slack" && !isSlackContinuation(task) && !!task.slackChannelId && !!task.slackThreadTs && (task.status === "completed" || task.status === "failed") && task.taskType !== "follow-up" && task.taskType !== "reroute-decision" && task.createdAt >= delegationActivatedAt;
56482
56562
  }
56483
- function taskNeedsAskOutcome(task, activatedAt) {
56484
- return task.source === "slack" && isAskOutcomeStatus(task.status) && task.createdAt >= activatedAt;
56563
+ function taskNeedsDirectOutcome(task, activatedAt) {
56564
+ return !isSlackEtaOnlyNotice(task) && (task.source === "slack" && isAskOutcomeStatus(task.status) || isSlackContinuation(task) && isOutcomeStatus(task.status)) && task.createdAt >= activatedAt;
56485
56565
  }
56486
56566
  async function conclusionResultsLines(closure) {
56487
56567
  const lines = [];
56488
56568
  for (const member of closure) {
56489
56569
  if (member.taskType === "follow-up" || member.taskType === "reroute-decision")
56490
56570
  continue;
56491
- if (!isOutcomeStatus(member.status))
56571
+ if (!isOutcomeStatus(member.status) || isSlackEtaOnlyNotice(member))
56492
56572
  continue;
56493
56573
  const glyph = await taskStateGlyph(member, new Date);
56494
56574
  const agentName = await agentDisplayNameFor(member);
@@ -56497,7 +56577,7 @@ async function conclusionResultsLines(closure) {
56497
56577
  lines.push(`↳ ${glyph} ${agentName} — ${card.permalink}`);
56498
56578
  continue;
56499
56579
  }
56500
- const raw = outcomeText(member.status === "failed" ? member.failureReason : member.output, "");
56580
+ const raw = outcomeText(member.status === "failed" ? member.failureReason : slackTaskOutput(member), "");
56501
56581
  const digest = raw.length > CONCLUSION_DIGEST_LENGTH ? `${raw.slice(0, CONCLUSION_DIGEST_LENGTH).trimEnd()}…` : raw;
56502
56582
  const label = digest ? `${agentName} — ${digest}` : agentName;
56503
56583
  lines.push(`↳ ${glyph} ${label} ${getTaskLink(member.id)}`);
@@ -56707,10 +56787,26 @@ async function streamOutcomeCard(task, tree, options) {
56707
56787
  reservationWasCreated = reserved.created;
56708
56788
  }
56709
56789
  let streamedFreshContent = false;
56790
+ let deliveredViaFallback = false;
56710
56791
  if (isPendingSlackMessage(outcome)) {
56711
56792
  const reconciled = reservationWasCreated ? undefined : await findReservedSlackMessage(app2.client, outcome, presentation);
56712
56793
  streamedFreshContent = !reconciled;
56713
- const started = reconciled ?? await callSlackWithRetry(app2.client, "chat.startStream", startPayload);
56794
+ let started = reconciled;
56795
+ if (!started) {
56796
+ try {
56797
+ started = await callSlackWithRetry(app2.client, "chat.startStream", startPayload);
56798
+ } catch (error) {
56799
+ console.error(`[Slack] chat.startStream failed for task ${task.id}; falling back to chat.postMessage:`, error);
56800
+ started = await callSlackWithRetry(app2.client, "chat.postMessage", {
56801
+ channel: task.slackChannelId,
56802
+ thread_ts: task.slackThreadTs,
56803
+ text: presentation,
56804
+ ...startPayload.username ? { username: startPayload.username } : {},
56805
+ ...startPayload.icon_emoji ? { icon_emoji: startPayload.icon_emoji } : {}
56806
+ });
56807
+ deliveredViaFallback = true;
56808
+ }
56809
+ }
56714
56810
  if (typeof started.ts !== "string" || !started.ts) {
56715
56811
  throw new Error("Slack did not return a timestamp for the outcome stream");
56716
56812
  }
@@ -56721,23 +56817,26 @@ async function streamOutcomeCard(task, tree, options) {
56721
56817
  throw new Error("Failed to persist the outcome stream timestamp");
56722
56818
  outcome = persisted;
56723
56819
  }
56724
- if (!streamedFreshContent) {
56725
- await callSlackWithRetry(app2.client, "chat.update", {
56726
- channel: task.slackChannelId,
56727
- ts: outcome.ts,
56728
- text: presentation
56729
- });
56730
- }
56731
- try {
56732
- await callSlackWithRetry(app2.client, "chat.stopStream", {
56733
- channel: task.slackChannelId,
56734
- ts: outcome.ts,
56735
- blocks: await outcomeFooter(task, tasks, duration)
56736
- });
56737
- } catch (error) {
56738
- if (!isStreamAlreadyStopped(error))
56739
- throw error;
56820
+ if (!deliveredViaFallback) {
56821
+ if (!streamedFreshContent) {
56822
+ await callSlackWithRetry(app2.client, "chat.update", {
56823
+ channel: task.slackChannelId,
56824
+ ts: outcome.ts,
56825
+ text: presentation
56826
+ });
56827
+ }
56828
+ try {
56829
+ await callSlackWithRetry(app2.client, "chat.stopStream", {
56830
+ channel: task.slackChannelId,
56831
+ ts: outcome.ts,
56832
+ blocks: await outcomeFooter(task, tasks, duration)
56833
+ });
56834
+ } catch (error) {
56835
+ if (!isStreamAlreadyStopped(error))
56836
+ throw error;
56837
+ }
56740
56838
  }
56839
+ await clearAssistantStatus(app2.client, task.slackChannelId, task.slackThreadTs);
56741
56840
  const permalink = await resolvePermalink(app2.client, task.slackChannelId, outcome.ts);
56742
56841
  return await updateSlackMessageRecord(outcome.id, {
56743
56842
  permalink,
@@ -56800,9 +56899,9 @@ async function processSlackRenderV2() {
56800
56899
  for (const task of tasks) {
56801
56900
  if ((await getSlackOutcomeMessage(task.id))?.finalizedAt)
56802
56901
  continue;
56803
- const isAskCandidate = taskNeedsAskOutcome(task, activatedAt) && isOutcomeStatus(task.status);
56902
+ const isDirectCandidate = taskNeedsDirectOutcome(task, activatedAt) && isOutcomeStatus(task.status);
56804
56903
  const isChildCandidate = delegationEnabled && delegationActivatedAt !== null && isChildCardCandidate(task, delegationActivatedAt) && !task.slackReplySent;
56805
- if (isAskCandidate || isChildCandidate) {
56904
+ if (isDirectCandidate || isChildCandidate) {
56806
56905
  needsOutcome = true;
56807
56906
  break;
56808
56907
  }
@@ -56876,9 +56975,12 @@ async function processSlackRenderV2() {
56876
56975
  continue;
56877
56976
  if (askId && await childCardCountFor(askId) >= CHILD_CARDS_PER_ASK)
56878
56977
  continue;
56978
+ if (!outcomeDeliveryGate(task.id))
56979
+ continue;
56879
56980
  try {
56880
56981
  const outcome = await streamOutcomeCard(task, tree, { buildContent: childOutcomeContent });
56881
56982
  if (outcome) {
56983
+ noteOutcomeDeliverySuccess(task.id);
56882
56984
  childCardsThisTick++;
56883
56985
  if (askId)
56884
56986
  childCardCounts.set(askId, (childCardCounts.get(askId) ?? 0) + 1);
@@ -56886,27 +56988,29 @@ async function processSlackRenderV2() {
56886
56988
  }
56887
56989
  outcomeCreated ||= !!outcome;
56888
56990
  } catch (error) {
56889
- console.error(`[Slack] Failed to stream child outcome for task ${task.id}:`, error);
56991
+ await noteOutcomeDeliveryFailure(task, error);
56890
56992
  }
56891
56993
  }
56892
56994
  for (const task of tasks) {
56893
56995
  if (!isSlackRenderV2Enabled())
56894
56996
  return;
56895
- if (task.source !== "slack")
56997
+ if (!taskNeedsDirectOutcome(task, activatedAt))
56896
56998
  continue;
56897
56999
  if ((await getSlackOutcomeMessage(task.id))?.finalizedAt)
56898
57000
  continue;
56899
- if (!isAskOutcomeStatus(task.status) || task.createdAt < activatedAt)
56900
- continue;
56901
- const deferByClosure = delegationEnabled && delegationActivatedAt !== null && task.createdAt >= delegationActivatedAt;
57001
+ const deferByClosure = task.source === "slack" && delegationEnabled && delegationActivatedAt !== null && task.createdAt >= delegationActivatedAt;
56902
57002
  if (!deferByClosure) {
57003
+ if (!outcomeDeliveryGate(task.id))
57004
+ continue;
56903
57005
  try {
56904
57006
  const outcome = await streamOutcomeCard(task, tree);
56905
- if (outcome)
57007
+ if (outcome) {
57008
+ noteOutcomeDeliverySuccess(task.id);
56906
57009
  await finalizeTerminalSlackReactions([task]);
57010
+ }
56907
57011
  outcomeCreated ||= !!outcome;
56908
57012
  } catch (error) {
56909
- console.error(`[Slack] Failed to stream outcome for task ${task.id}:`, error);
57013
+ await noteOutcomeDeliveryFailure(task, error);
56910
57014
  }
56911
57015
  continue;
56912
57016
  }
@@ -56928,12 +57032,15 @@ async function processSlackRenderV2() {
56928
57032
  const state = closureState(task, closure, new Date, settleSec, timeoutMin);
56929
57033
  if (state === "open")
56930
57034
  continue;
57035
+ if (!outcomeDeliveryGate(task.id))
57036
+ continue;
56931
57037
  try {
56932
57038
  const outcome = await streamOutcomeCard(task, tree, {
56933
57039
  buildContent: (_t, slackReplySent) => askConclusionContent(task, closure, state, slackReplySent),
56934
57040
  conclusionKind: state === "timedOut" ? "timeout" : "complete"
56935
57041
  });
56936
57042
  if (outcome) {
57043
+ noteOutcomeDeliverySuccess(task.id);
56937
57044
  const app3 = getSlackApp();
56938
57045
  if (app3 && task.slackChannelId && task.slackTriggerMessageTs) {
56939
57046
  const reaction = conclusionReactionChoice(state, task, closure);
@@ -56944,7 +57051,7 @@ async function processSlackRenderV2() {
56944
57051
  }
56945
57052
  outcomeCreated ||= !!outcome;
56946
57053
  } catch (error) {
56947
- console.error(`[Slack] Failed to stream ask conclusion for task ${task.id}:`, error);
57054
+ await noteOutcomeDeliveryFailure(task, error);
56948
57055
  }
56949
57056
  }
56950
57057
  try {
@@ -56963,6 +57070,7 @@ function _resetSlackRenderV2ForTests() {
56963
57070
  lastTreeUpdateAt.clear();
56964
57071
  treeUpdateTails.clear();
56965
57072
  cachedTeamId = undefined;
57073
+ outcomeDeliveryFailures.clear();
56966
57074
  }
56967
57075
 
56968
- export { initialize, ensure, require_dist7 as require_dist, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, recordDbRetentionSweep, recordDbRetentionStatement, ackSlackMessage, getTaskLink, getTaskUrl, markdownToSlack, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, getAgentDisplayName, getAgentEmoji, isSlackRenderV2Enabled, isSlackDelegationEnabled, callSlackWithRetry, formatV2Duration, renderThreadTree, ensureSlackThreadTree, childOutcomeContent, streamOutcomeCard, processSlackRenderV2, _resetSlackRenderV2ForTests, registerTreeMessage, getSlackApp, initSlackApp, startSlackApp, stopSlackApp };
57076
+ export { initialize, ensure, isPollTracingEnabled, initOtel, withSpan, startSpan, withSpanContext, withRemoteContext, injectTraceContext, recordSessionCost, recordDbRetentionSweep, recordDbRetentionStatement, require_dist7 as require_dist, ackSlackMessage, getTaskLink, getTaskUrl, markdownToSlack, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, slackTaskOutput, getAgentDisplayName, getAgentEmoji, isSlackRenderV2Enabled, isSlackDelegationEnabled, callSlackWithRetry, formatV2Duration, renderThreadTree, ensureSlackThreadTree, childOutcomeContent, streamOutcomeCard, processSlackRenderV2, _resetSlackRenderV2ForTests, registerTreeMessage, getSlackApp, initSlackApp, startSlackApp, stopSlackApp };
@@ -1,15 +1,12 @@
1
+ import {
2
+ fetchInstalledMcpServers
3
+ } from "./cli-tng3131n.js";
1
4
  import {
2
5
  require_cross_spawn
3
6
  } from "./cli-5bfdm1ah.js";
4
7
  import {
5
8
  resolveSlashSkillPrompt
6
9
  } from "./cli-r94z9p1z.js";
7
- import {
8
- readPkgVersion
9
- } from "./cli-2djtr51b.js";
10
- import {
11
- fetchInstalledMcpServers
12
- } from "./cli-tng3131n.js";
13
10
  import {
14
11
  CTX_MODE_NUDGE_EVERY
15
12
  } from "./cli-zm7njwzd.js";
@@ -18,12 +15,15 @@ import {
18
15
  clampContextPercent,
19
16
  getContextWindowSize
20
17
  } from "./cli-s25avqg9.js";
18
+ import {
19
+ readPkgVersion
20
+ } from "./cli-2djtr51b.js";
21
21
  import {
22
22
  applyReasoningEffort
23
23
  } from "./cli-4yc5d8fk.js";
24
24
  import {
25
25
  swarmRuntimeInstanceId
26
- } from "./cli-07jd68a1.js";
26
+ } from "./cli-re8z5p8p.js";
27
27
  import {
28
28
  DEFAULT_OPENROUTER_BASE_URL,
29
29
  getOpenRouterBaseUrl
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  contentSha256,
3
3
  init_profile_sync
4
- } from "./cli-a45d5v9b.js";
4
+ } from "./cli-fm4ytsdk.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-qp69dd5d.js";
14
+ } from "./cli-gacq5hg8.js";
15
15
  import {
16
16
  __esm,
17
17
  __export,
@@ -93,6 +93,9 @@ class OpenAIEmbeddingProvider {
93
93
  this.dimensions = config?.dimensions ?? EMBEDDING_DIMENSIONS;
94
94
  this.name = config?.model ? `openai/${config.model}` : process.env.EMBEDDING_MODEL ?? DEFAULT_EMBEDDING_MODEL;
95
95
  }
96
+ isConfigured() {
97
+ return !!this.apiKey;
98
+ }
96
99
  getClient() {
97
100
  if (!this.apiKey)
98
101
  return null;
@@ -1082,6 +1085,9 @@ function getEmbeddingProvider() {
1082
1085
  }
1083
1086
  return embeddingProvider;
1084
1087
  }
1088
+ function resetEmbeddingProvider() {
1089
+ embeddingProvider = null;
1090
+ }
1085
1091
  function getMemoryStore() {
1086
1092
  if (!memoryStore) {
1087
1093
  const { SqliteMemoryStore: SqliteMemoryStore2 } = (init_sqlite_store(), __toCommonJS(exports_sqlite_store));
@@ -1090,4 +1096,4 @@ function getMemoryStore() {
1090
1096
  return memoryStore;
1091
1097
  }
1092
1098
 
1093
- export { cosineSimilarity, serializeEmbedding, deserializeEmbedding, init_embedding, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, getMemoryStore };
1099
+ export { CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, cosineSimilarity, serializeEmbedding, deserializeEmbedding, init_embedding, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore };