@desplega.ai/agent-swarm 2.7.8 → 2.7.9

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 (309) hide show
  1. package/dist/acp-adapter-dn4gdsgr.js +16 -0
  2. package/dist/{actions-4m1ct4nh.js → actions-g563mbn2.js} +19 -19
  3. package/dist/{amp-adapter-txqh7eqj.js → amp-adapter-q61w05eb.js} +3 -3
  4. package/dist/{anthropic-messages-xey2skwx.js → anthropic-messages-jkva0zps.js} +68 -78
  5. package/dist/{app-e00m45gn.js → app-a66ssc4k.js} +3 -3
  6. package/dist/{assistant-gd08kr9e.js → assistant-p477rjwj.js} +21 -21
  7. package/dist/{azure-openai-responses-26t7j9ra.js → azure-openai-responses-wgtqkbr3.js} +5 -10
  8. package/dist/{boot-args-schema-tjrkpbvm.js → boot-args-schema-h4qj462e.js} +1 -1
  9. package/dist/{boot-reembed-21hbck22.js → boot-reembed-n1ehfbsw.js} +1 -1
  10. package/dist/{boot-reembed-mdxd3wgp.js → boot-reembed-qw4mc0pt.js} +1 -1
  11. package/dist/{boot-scrub-sweep-qy0zr9t2.js → boot-scrub-sweep-9w9jp4sm.js} +4 -4
  12. package/dist/{boot-seeds-n46eaxdv.js → boot-seeds-qdaf3sdy.js} +5 -4
  13. package/dist/{boxd-nv507va8.js → boxd-qbkxy6ap.js} +1 -1
  14. package/dist/{claude-adapter-j37w2eds.js → claude-adapter-348p5hx9.js} +8 -8
  15. package/dist/{claude-managed-adapter-8jvcma9a.js → claude-managed-adapter-h74d06yz.js} +4 -4
  16. package/dist/{claude-managed-setup-rzkjmgc1.js → claude-managed-setup-7787fxtp.js} +4 -4
  17. package/dist/{claude-sdk-session-4k7w73t0.js → claude-sdk-session-hbszbt8a.js} +7901 -7718
  18. package/dist/{cli-sq4n7af4.js → cli-09kmfkmq.js} +4 -6
  19. package/dist/{cli-p3vsj0d3.js → cli-0whpms1z.js} +15 -10
  20. package/dist/{cli-4t50yq3j.js → cli-12xyjhws.js} +29 -12
  21. package/dist/{cli-snpj5zbj.js → cli-1z4qggfe.js} +9 -36
  22. package/dist/{cli-bb0mmdk8.js → cli-21159vea.js} +35 -12
  23. package/dist/{cli-s0qnd4wv.js → cli-28fq781p.js} +1 -1
  24. package/dist/{cli-rjknb2ae.js → cli-2a8py3sx.js} +6 -6
  25. package/dist/{cli-tpksw2nr.js → cli-2ccpqyyf.js} +397 -105
  26. package/dist/{cli-1p89xny0.js → cli-2r0jcc3k.js} +1 -1
  27. package/dist/{cli-rvtm68yy.js → cli-2xv18ywz.js} +2 -2
  28. package/dist/{cli-5xaqj21p.js → cli-3kd08rej.js} +1 -1
  29. package/dist/{cli-bbw9wj9m.js → cli-3tqcamp6.js} +12 -12
  30. package/dist/{cli-ae7mrdf9.js → cli-3vjhs18n.js} +4 -6
  31. package/dist/{cli-ssnjfg5p.js → cli-3xcwp3z8.js} +8 -10
  32. package/dist/{cli-az48n0nr.js → cli-4caa1x7d.js} +67 -64
  33. package/dist/{cli-269q28a1.js → cli-4t0fmf3z.js} +27 -6
  34. package/dist/{cli-1cxrbkk6.js → cli-530hkwdy.js} +7 -9
  35. package/dist/{cli-pz4rk021.js → cli-54vrpgm0.js} +1 -1
  36. package/dist/{cli-eyg1pa00.js → cli-587857ys.js} +7 -7
  37. package/dist/{cli-r9jqcehk.js → cli-5mpy301f.js} +38 -2
  38. package/dist/{cli-xq9r2wtt.js → cli-605nn699.js} +47 -34
  39. package/dist/{cli-msg9m2ny.js → cli-650zv9q9.js} +8 -10
  40. package/dist/cli-6pzk82fd.js +778 -0
  41. package/dist/{cli-84rj785g.js → cli-715t1gx6.js} +9 -9
  42. package/dist/{cli-btfsp3mv.js → cli-9aezs55w.js} +9 -11
  43. package/dist/{cli-dq8x79v8.js → cli-9r5gtwjr.js} +2 -2
  44. package/dist/{cli-jdv6ypxs.js → cli-a0657jmf.js} +2 -2
  45. package/dist/{cli-bshb7jas.js → cli-agyaeef4.js} +3 -3
  46. package/dist/cli-b932gexn.js +5266 -0
  47. package/dist/{cli-gvx71kqv.js → cli-bc779n4v.js} +3 -3
  48. package/dist/{cli-z1srzaf6.js → cli-btc9cb4c.js} +70 -5
  49. package/dist/{cli-s4ss5g59.js → cli-btf6fw39.js} +5 -5
  50. package/dist/{cli-fzachfnf.js → cli-cseh6f8w.js} +5 -5
  51. package/dist/{cli-5j0m12ns.js → cli-cvs2r2vq.js} +13 -11
  52. package/dist/{cli-njwac61j.js → cli-cyn9v8zr.js} +12 -2
  53. package/dist/{cli-a22h291q.js → cli-d6521kb5.js} +1 -1
  54. package/dist/{cli-1b7btd38.js → cli-d84byzn8.js} +869 -5
  55. package/dist/{cli-wx3rhnm0.js → cli-eddnyg3t.js} +1 -1
  56. package/dist/{cli-7axf41jq.js → cli-ejkvvqbe.js} +40 -42
  57. package/dist/{cli-mthwvjre.js → cli-f2zenhja.js} +1 -1
  58. package/dist/{cli-8sdejs1f.js → cli-fayav105.js} +538 -205
  59. package/dist/{cli-ferkkrg9.js → cli-fjggej24.js} +2 -2
  60. package/dist/{cli-g7s47cc5.js → cli-fsgttth8.js} +123 -102
  61. package/dist/{cli-9m8hdawy.js → cli-gce09r66.js} +4 -4
  62. package/dist/{cli-mkk9rnzz.js → cli-gxy8y1dt.js} +51 -4
  63. package/dist/{cli-85gzce7b.js → cli-hae9j8sv.js} +287 -75
  64. package/dist/{cli-agfm16v9.js → cli-hg42n3hx.js} +12 -12
  65. package/dist/{cli-8rpcng8j.js → cli-hwprv9e4.js} +8 -10
  66. package/dist/{cli-yndmfxb3.js → cli-hxpyc9sn.js} +3 -3
  67. package/dist/{cli-ppjxh6ah.js → cli-jfx48xrj.js} +10 -12
  68. package/dist/{cli-5ja3b75e.js → cli-jrp1dt73.js} +1 -1
  69. package/dist/{cli-98rw5dt5.js → cli-jrzkw01m.js} +2 -2
  70. package/dist/{cli-ga786dzg.js → cli-k70e3x9e.js} +18 -17
  71. package/dist/{cli-583frbyr.js → cli-kchjb7qy.js} +1 -1
  72. package/dist/{cli-fmjd0t1y.js → cli-m0cy2vyf.js} +2 -2
  73. package/dist/{cli-c0kqky8y.js → cli-m5akxq8q.js} +1 -1
  74. package/dist/{cli-ycscb2ar.js → cli-m88rpzkh.js} +2 -2
  75. package/dist/{cli-m0hmeqma.js → cli-mnrkgg60.js} +4 -4
  76. package/dist/{cli-yqefz277.js → cli-ms5m5r1y.js} +1 -1
  77. package/dist/{cli-fy6x31ps.js → cli-n5yexkdg.js} +1 -0
  78. package/dist/{cli-w4xnbm46.js → cli-neyag5p6.js} +53 -39
  79. package/dist/cli-p0m0p34z.js +9321 -0
  80. package/dist/{cli-gazw7kpa.js → cli-p17970qv.js} +8 -10
  81. package/dist/{cli-6vcp76qk.js → cli-p74md7t8.js} +42 -23
  82. package/dist/{cli-rjcbm574.js → cli-pr0eze3x.js} +2 -2
  83. package/dist/{cli-3e4snnzf.js → cli-qkdmz8c8.js} +1 -1
  84. package/dist/{cli-0ykgn1h5.js → cli-qmd3mse0.js} +2 -2
  85. package/dist/{cli-t60ajbbp.js → cli-qzt90yze.js} +20 -20
  86. package/dist/cli-rkc97c6a.js +39 -0
  87. package/dist/{cli-qd57hhhh.js → cli-rvhdmjvt.js} +6 -10
  88. package/dist/{cli-kyr67fgx.js → cli-rwymrnaz.js} +18608 -9089
  89. package/dist/{cli-8h0ayw8c.js → cli-serm8zrx.js} +6 -6
  90. package/dist/{cli-66ww7fer.js → cli-sgs5k6yd.js} +1 -1
  91. package/dist/{cli-nbsf8yvn.js → cli-sya22y84.js} +9 -9
  92. package/dist/{cli-318r69gq.js → cli-t73cas91.js} +440 -9
  93. package/dist/{cli-zkky4t5g.js → cli-tqq0hspb.js} +2 -2
  94. package/dist/{cli-z75yxkjh.js → cli-v3cf1ts9.js} +3 -3
  95. package/dist/{cli-xr8908my.js → cli-varqt4d1.js} +26 -14
  96. package/dist/{cli-q4ebh7h7.js → cli-vxh6acp7.js} +6 -6
  97. package/dist/{cli-g83s9ewh.js → cli-xfjrc279.js} +1 -1
  98. package/dist/{cli-32m9eda8.js → cli-xk879m3k.js} +111 -109
  99. package/dist/{cli-7cx2m6t2.js → cli-y5rbvxhc.js} +2 -2
  100. package/dist/{cli-fyhr5h4s.js → cli-y8nbefpb.js} +13 -13
  101. package/dist/{cli-81p9jd57.js → cli-yab6sh8p.js} +9 -3
  102. package/dist/{cli-srye3vdt.js → cli-ybjdc978.js} +1 -1
  103. package/dist/{cli-k5671be5.js → cli-zcfpsfzf.js} +5 -5
  104. package/dist/{cli-vf078p3e.js → cli-zfqg6fzn.js} +1 -1
  105. package/dist/{cli-wemma3jd.js → cli-zgv8gxgs.js} +7 -7
  106. package/dist/cli.js +31 -51
  107. package/dist/{cloudflare-workers-ai-system-one-ef2a980q.js → cloudflare-workers-ai-system-one-9y1zx3pt.js} +2 -2
  108. package/dist/{codex-adapter-88z6psm4.js → codex-adapter-ysq6bzha.js} +7 -7
  109. package/dist/{codex-login-74wa4hmq.js → codex-login-bcda78ge.js} +2 -2
  110. package/dist/{codex-session-runner-zwbcwzvx.js → codex-session-runner-qakzfx93.js} +8 -8
  111. package/dist/{commands-7amxs716.js → commands-rs7hkv9r.js} +3 -3
  112. package/dist/{controller-5rkkc37m.js → controller-r5x9bg6e.js} +4 -4
  113. package/dist/{controllers-connect-m7d4vxxb.js → controllers-connect-498hrxvk.js} +24 -24
  114. package/dist/{cursor-adapter-x1q18693.js → cursor-adapter-d46qszer.js} +2 -2
  115. package/dist/{db-athc68zt.js → db-pm96nhdb.js} +4 -2
  116. package/dist/{db-h2fsfve3.js → db-s13dqhr6.js} +3 -3
  117. package/dist/{devin-adapter-r9phbnc9.js → devin-adapter-z46ep5ph.js} +1 -1
  118. package/dist/{dispatcher-b1yz2bnn.js → dispatcher-j3h81t7m.js} +18 -18
  119. package/dist/{docker-c1a3gqmf.js → docker-866qpzt9.js} +2 -2
  120. package/dist/{dsh-adapter-e33bkxq9.js → dsh-adapter-rw0d5rc4.js} +2 -2
  121. package/dist/{e2b-fr12yccx.js → e2b-jkwfhbcv.js} +2 -2
  122. package/dist/{e2b-x6ywzak3.js → e2b-s16txnpx.js} +2 -3
  123. package/dist/{easter-egg-3d-pv5qnzc8.js → easter-egg-3d-qtgfxgze.js} +1 -1
  124. package/dist/{embedding-space-b4txbwrk.js → embedding-space-xh8p4q4x.js} +6 -6
  125. package/dist/{embeddings-m6zn6tad.js → embeddings-wp745m91.js} +1 -1
  126. package/dist/{event-bus-g0ka3pbw.js → event-bus-e66gh7cc.js} +1 -1
  127. package/dist/{execute-68nwny8m.js → execute-2fzb9z74.js} +1 -1
  128. package/dist/{external-channel-gkckmhzh.js → external-channel-ys21h3sy.js} +2 -2
  129. package/dist/fx-adapter-vz0b9z3g.js +19 -0
  130. package/dist/{google-generative-ai-v94hr7h0.js → google-generative-ai-ytpgncx9.js} +7 -12
  131. package/dist/{google-vertex-g7vr6cf8.js → google-vertex-tqhze5j7.js} +7 -12
  132. package/dist/grok-adapter-spea7zkj.js +19 -0
  133. package/dist/handlers-crckt5dq.js +32 -0
  134. package/dist/{heartbeat-6c2y3267.js → heartbeat-8phn1kdq.js} +21 -21
  135. package/dist/{hook-q5fv0jy2.js → hook-amcj4s10.js} +16 -11
  136. package/dist/{hook-w0q2wcrv.js → hook-bc6n49qn.js} +5 -5
  137. package/dist/{http-bxat8dg3.js → http-7374brv5.js} +642 -260
  138. package/dist/index-4x08sjtk.js +30 -0
  139. package/dist/{index-6cxzwfen.js → index-5a9jtqde.js} +26 -26
  140. package/dist/index-8ybffts4.js +37 -0
  141. package/dist/{index-bxrexmfy.js → index-c9y31ytf.js} +13 -13
  142. package/dist/{index-h39zbx67.js → index-hsad2t3r.js} +31 -31
  143. package/dist/index-nfy4kkg5.js +33 -0
  144. package/dist/{index-cqhqpgrv.js → index-p4hjwbvw.js} +1 -1
  145. package/dist/{index-k7fj52d3.js → index-q5cmtbz5.js} +6 -6
  146. package/dist/{index-fm0czesf.js → index-w4m9z29z.js} +1 -1
  147. package/dist/{keepalive-qnt21cv0.js → keepalive-wy29kbrg.js} +4 -4
  148. package/dist/lead-zdqxsvjn.js +71 -0
  149. package/dist/{llama-cpp-classify-s5c47rwh.js → llama-cpp-classify-nfgswa1m.js} +2 -2
  150. package/dist/{maintenance-btdr68y4.js → maintenance-h2ds9w6c.js} +1 -1
  151. package/dist/{mistral-conversations-3gjpdb4b.js → mistral-conversations-a45tx39a.js} +29 -51
  152. package/dist/{oauth-refresh-sweep-vczabeh4.js → oauth-refresh-sweep-q7mtbyp3.js} +3 -3
  153. package/dist/{onboard-k33ezyq8.js → onboard-vw8r2fdw.js} +68 -16
  154. package/dist/{openai-codex-responses-8pbxq9h5.js → openai-codex-responses-k9gapdze.js} +7 -11
  155. package/dist/{openai-completions-rm00s912.js → openai-completions-xd579js7.js} +50 -58
  156. package/dist/{openai-decisions-8v957r2r.js → openai-decisions-q3hh60wr.js} +2 -2
  157. package/dist/{openai-responses-agxpf96k.js → openai-responses-4d5dx3c7.js} +5 -10
  158. package/dist/{opencode-adapter-3dst2ka7.js → opencode-adapter-mtb0953j.js} +6 -6
  159. package/dist/{openrouter-images-3ecegv0d.js → openrouter-images-xr9gme9x.js} +4 -3
  160. package/dist/{otel-impl-13am7a65.js → otel-impl-j42czw3r.js} +2 -2
  161. package/dist/{pi-messages-pchtw4he.js → pi-messages-hjbv8v10.js} +28 -12
  162. package/dist/{pi-mono-adapter-c53de1gd.js → pi-mono-adapter-zk8pg9jr.js} +23 -26
  163. package/dist/{pricing-refresh-9fcbnq3f.js → pricing-refresh-x7nhv23d.js} +3 -3
  164. package/dist/{rbac-roles-gw0p9h3j.js → rbac-roles-9044425x.js} +16 -2
  165. package/dist/{rbac-roles-66j5h4y5.js → rbac-roles-bzvee6cf.js} +12 -3
  166. package/dist/{render-v2-fg8bmdn4.js → render-v2-t7bn4skz.js} +3 -3
  167. package/dist/{resume-1c8kr3nh.js → resume-x94gemep.js} +7 -7
  168. package/dist/{runtime-tzf9j7tc.js → runtime-breq6fmv.js} +1 -1
  169. package/dist/{session-access-d0atq10j.js → session-access-q7dmqjvt.js} +4 -4
  170. package/dist/{session-source-backfill-0vscqmsa.js → session-source-backfill-440ysamr.js} +3 -3
  171. package/dist/{setup-tvfa7rwe.js → setup-07n4727s.js} +1 -1
  172. package/dist/{typesafe-system-one-0bmqcxfg.js → typesafe-system-one-f2en2knd.js} +2 -2
  173. package/dist/virtual-modules-z5h6mcyf.js +362 -0
  174. package/dist/{work-objects-ks71xqeb.js → work-objects-pnq5y534.js} +21 -21
  175. package/dist/{worker-follow-up-bfx0h9hg.js → worker-follow-up-7z1gfkr8.js} +18 -18
  176. package/dist/worker-y62rvvq3.js +71 -0
  177. package/dist/{x-vmmye1kb.js → x-2fyrt5pp.js} +2 -2
  178. package/openapi.json +1169 -257
  179. package/package.json +8 -10
  180. package/src/apps/catalog.generated.json +299 -82
  181. package/src/apps/page-validator.ts +115 -2
  182. package/src/be/connector-codes.ts +21 -6
  183. package/src/be/db/tasks/read.ts +22 -0
  184. package/src/be/db.ts +4 -2
  185. package/src/be/improvements.ts +416 -0
  186. package/src/be/migrations/274_improvements.sql +27 -0
  187. package/src/be/migrations/275_task_dispatched_by.sql +8 -0
  188. package/src/be/rbac-roles.ts +123 -1
  189. package/src/be/swarm-config-guard.ts +1 -0
  190. package/src/be/users.ts +58 -1
  191. package/src/cli.tsx +5 -25
  192. package/src/commands/codex-login.ts +1 -1
  193. package/src/commands/e2b.ts +0 -1
  194. package/src/commands/onboard/agent-fs-version.ts +1 -1
  195. package/src/commands/onboard/compose-generator.ts +0 -1
  196. package/src/commands/onboard/dashboard-url.ts +31 -0
  197. package/src/commands/onboard/steps/generate.tsx +17 -1
  198. package/src/commands/onboard/steps/post-dashboard.tsx +9 -3
  199. package/src/commands/onboard.tsx +19 -6
  200. package/src/commands/runner.ts +117 -96
  201. package/src/extensions/contract-types.generated.ts +1 -1
  202. package/src/hooks/hook.ts +13 -5
  203. package/src/http/all-routes.ts +1 -0
  204. package/src/http/approval-requests.ts +2 -44
  205. package/src/http/auth.ts +5 -4
  206. package/src/http/codex-oauth-accounts.ts +31 -23
  207. package/src/http/codex-oauth-device.ts +1 -1
  208. package/src/http/codex-oauth-keep-warm.ts +1 -1
  209. package/src/http/improvements.ts +317 -0
  210. package/src/http/index.ts +2 -0
  211. package/src/http/operator-actor.ts +2 -1
  212. package/src/http/person-responder.ts +66 -0
  213. package/src/http/sessions.ts +49 -7
  214. package/src/http/tasks.ts +1 -1
  215. package/src/http/user-roles.ts +11 -2
  216. package/src/http/users.ts +194 -104
  217. package/src/providers/acp-targets.ts +1 -1
  218. package/src/providers/amp-adapter.ts +1 -1
  219. package/src/providers/codex-adapter.ts +8 -1
  220. package/src/providers/codex-models.ts +4 -3
  221. package/src/providers/codex-oauth/auth-json.ts +14 -18
  222. package/src/providers/codex-oauth/storage.ts +2 -2
  223. package/src/rbac/legacy-policy.ts +2 -0
  224. package/src/rbac/permissions.ts +10 -0
  225. package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
  226. package/src/server.ts +2 -0
  227. package/src/slack/ack.ts +20 -14
  228. package/src/slack/render-v2.ts +42 -17
  229. package/src/tests/api-drain-worker-e2e.test.ts +69 -2
  230. package/src/tests/apps-catalog-drift.test.ts +35 -0
  231. package/src/tests/apps-catalog-table.test.ts +203 -0
  232. package/src/tests/apps-element-assembly.test.ts +28 -0
  233. package/src/tests/apps-smart-links.test.ts +151 -0
  234. package/src/tests/apps-table-filters-migration.test.ts +96 -0
  235. package/src/tests/apps-table-selection-migration.test.ts +95 -0
  236. package/src/tests/chatgpt-subscription-session-bench.test.ts +2 -2
  237. package/src/tests/claude-worker-parity.test.ts +2 -2
  238. package/src/tests/codex-adapter.test.ts +30 -0
  239. package/src/tests/codex-login.test.ts +2 -2
  240. package/src/tests/codex-oauth-accounts.test.ts +48 -12
  241. package/src/tests/codex-oauth-credential-info.test.ts +77 -1
  242. package/src/tests/codex-oauth-device.test.ts +1 -1
  243. package/src/tests/codex-oauth-keep-warm.test.ts +2 -2
  244. package/src/tests/codex-oauth.test.ts +25 -4
  245. package/src/tests/codex-pool.test.ts +2 -2
  246. package/src/tests/db-task-read-contract.test.ts +2 -0
  247. package/src/tests/db-task-write-contract.test.ts +1 -0
  248. package/src/tests/deploy-one-box.test.ts +39 -1
  249. package/src/tests/docs-index-footprint.test.js +3 -3
  250. package/src/tests/fixtures/onboard/content.compose.yml.txt +0 -4
  251. package/src/tests/fixtures/onboard/dev.compose.yml.txt +0 -3
  252. package/src/tests/fixtures/onboard/full-all.compose.yml.txt +0 -11
  253. package/src/tests/fixtures/onboard/full.compose.yml.txt +0 -11
  254. package/src/tests/fixtures/onboard/research.compose.yml.txt +0 -3
  255. package/src/tests/fixtures/onboard/solo.compose.yml.txt +0 -1
  256. package/src/tests/fixtures/prs-app-definition.json.txt +784 -0
  257. package/src/tests/fixtures/prs-filters-migration.patch.json.txt +318 -0
  258. package/src/tests/fixtures/prs-selection-migration.patch.json.txt +373 -0
  259. package/src/tests/fixtures/runner-identity-refresh.ts +3 -0
  260. package/src/tests/fixtures/runner-legacy-resume-prompt.ts +3 -0
  261. package/src/tests/fixtures/runner-task-start-reads.ts +140 -0
  262. package/src/tests/hook-ping-me-order.test.ts +85 -0
  263. package/src/tests/improvements-payload.test.ts +200 -0
  264. package/src/tests/improvements-route.test.ts +419 -0
  265. package/src/tests/install-sh-setup-url.test.ts +190 -0
  266. package/src/tests/onboard-dashboard-output.test.ts +109 -0
  267. package/src/tests/onboard-dashboard-url.test.ts +83 -0
  268. package/src/tests/operator-granted-credentials.test.ts +561 -0
  269. package/src/tests/operator-granted-role-wire.test.ts +222 -0
  270. package/src/tests/rbac-engine.test.ts +2 -0
  271. package/src/tests/runner-context-usage.test.ts +0 -1
  272. package/src/tests/runner-legacy-options.test.ts +55 -0
  273. package/src/tests/runner-slot-reconcile.test.ts +38 -0
  274. package/src/tests/runner-task-start-reads.test.ts +58 -0
  275. package/src/tests/send-task-dispatched-by.test.ts +129 -0
  276. package/src/tests/session-dispatched-tasks.test.ts +115 -0
  277. package/src/tests/session-sharing.test.ts +198 -9
  278. package/src/tests/slack-file-tools-attachments.test.ts +95 -3
  279. package/src/tests/slack-reaction-config.test.ts +39 -0
  280. package/src/tests/slack-render-v2.test.ts +47 -0
  281. package/src/tests/submit-improvement-tool.test.ts +82 -0
  282. package/src/tests/tool-annotations.test.ts +1 -1
  283. package/src/tools/manage-user.ts +88 -58
  284. package/src/tools/send-task.ts +3 -0
  285. package/src/tools/slack-read.ts +61 -33
  286. package/src/tools/submit-improvement.ts +68 -0
  287. package/src/tools/tool-config.ts +3 -0
  288. package/src/types.ts +5 -0
  289. package/src/utils/request-auth-context.ts +6 -1
  290. package/templates/skills/apps/SKILL.md +22 -11
  291. package/templates/skills/apps/content.md +22 -11
  292. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  293. package/templates/skills/swarm-scripts/content.md +1 -1
  294. package/templates/skills/work-on-task/SKILL.md +1 -1
  295. package/templates/skills/work-on-task/content.md +1 -1
  296. package/dist/acp-adapter-vg5hqkvj.js +0 -16
  297. package/dist/cli-5c4hjzne.js +0 -873
  298. package/dist/cli-ae0dnfee.js +0 -20222
  299. package/dist/cli-nn3ysbqk.js +0 -428
  300. package/dist/cli-pc5znp64.js +0 -364
  301. package/dist/fx-adapter-m5jbgd5q.js +0 -19
  302. package/dist/grok-adapter-csvv7sac.js +0 -19
  303. package/dist/handlers-8x5gfbzx.js +0 -32
  304. package/dist/index-hpfte8jd.js +0 -33
  305. package/dist/index-ncf7yb5s.js +0 -30
  306. package/dist/index-vte6dyeh.js +0 -37
  307. package/dist/lead-4bvftzm6.js +0 -71
  308. package/dist/virtual-modules-efxcp740.js +0 -59
  309. package/dist/worker-e7v2bvm9.js +0 -71
@@ -45,6 +45,28 @@ import {
45
45
  getDb2,
46
46
  getDbClient2,
47
47
  init_runtime2,
48
+ CHAT_SDK_ADAPTER_NAMES,
49
+ CHAT_SDK_ADAPTER_SCHEMAS,
50
+ ChatSdkAdaptersDraftSchema,
51
+ firstIssueText,
52
+ isAdapterEntryEnabled,
53
+ init_schema,
54
+ API_DRAIN_MAX_MS_LIMIT,
55
+ init_api_drain2,
56
+ parseEnabledTools,
57
+ init_enabled_tools,
58
+ parseFollowUpGateScheduleIds,
59
+ isFollowUpGateScheduleId,
60
+ init_follow_up_gate_schedule_ids,
61
+ tierConfigKey,
62
+ init_model_tier_keys,
63
+ isInternalConfigKey,
64
+ internalConfigKeyError,
65
+ isReservedConfigKey,
66
+ reservedKeyError,
67
+ validateConfigValue,
68
+ validateExportToEnv,
69
+ init_swarm_config_guard,
48
70
  isEffectiveOutputSchema,
49
71
  init_output_schema,
50
72
  isRuntimePoolsEnabled,
@@ -107,28 +129,6 @@ import {
107
129
  init_model_profiles,
108
130
  onTaskStarted,
109
131
  init_task_lifecycle_events,
110
- CHAT_SDK_ADAPTER_NAMES,
111
- CHAT_SDK_ADAPTER_SCHEMAS,
112
- ChatSdkAdaptersDraftSchema,
113
- firstIssueText,
114
- isAdapterEntryEnabled,
115
- init_schema,
116
- API_DRAIN_MAX_MS_LIMIT,
117
- init_api_drain2,
118
- parseEnabledTools,
119
- init_enabled_tools,
120
- parseFollowUpGateScheduleIds,
121
- isFollowUpGateScheduleId,
122
- init_follow_up_gate_schedule_ids,
123
- tierConfigKey,
124
- init_model_tier_keys,
125
- isInternalConfigKey,
126
- internalConfigKeyError,
127
- isReservedConfigKey,
128
- reservedKeyError,
129
- validateConfigValue,
130
- validateExportToEnv,
131
- init_swarm_config_guard,
132
132
  getOAuthApp,
133
133
  getOAuthAppById,
134
134
  getOAuthAppIdByProvider,
@@ -357,17 +357,18 @@ import {
357
357
  recordInlineScriptRun2,
358
358
  exports_db,
359
359
  init_db4
360
- } from "./cli-w4xnbm46.js";
360
+ } from "./cli-neyag5p6.js";
361
361
  import {
362
+ assertMayActOnOperatorGrantedTarget2,
362
363
  getUserGrant2,
363
364
  init_rbac_roles
364
- } from "./cli-z1srzaf6.js";
365
+ } from "./cli-btc9cb4c.js";
365
366
  import {
366
367
  ensurePricingSeeded2,
367
368
  ensureRbacSeeded2,
368
369
  ensureModelProfilesSeeded2,
369
370
  init_boot_seeds
370
- } from "./cli-rjknb2ae.js";
371
+ } from "./cli-2a8py3sx.js";
371
372
  import {
372
373
  buildCatalogEntries,
373
374
  listModelCatalog,
@@ -379,11 +380,11 @@ import {
379
380
  requestModelCatalogRefresh2,
380
381
  startPricingRefreshLoop2,
381
382
  init_pricing_refresh
382
- } from "./cli-1cxrbkk6.js";
383
+ } from "./cli-530hkwdy.js";
383
384
  import {
384
385
  workflowEventBus2,
385
386
  init_event_bus
386
- } from "./cli-wx3rhnm0.js";
387
+ } from "./cli-eddnyg3t.js";
387
388
  import {
388
389
  slackCode,
389
390
  slackMissingScopeMessage,
@@ -392,7 +393,7 @@ import {
392
393
  externalChannelToolError2,
393
394
  getChannelBlockReason2,
394
395
  init_external_channel
395
- } from "./cli-0ykgn1h5.js";
396
+ } from "./cli-qmd3mse0.js";
396
397
  import {
397
398
  noteSlackInboundSideEffect,
398
399
  init_inbound_dispatch,
@@ -429,7 +430,7 @@ import {
429
430
  startSlackApp2,
430
431
  stopSlackApp2,
431
432
  init_app3
432
- } from "./cli-xq9r2wtt.js";
433
+ } from "./cli-605nn699.js";
433
434
  import {
434
435
  shapeApprovalResolution,
435
436
  init_approval_resolution,
@@ -453,7 +454,7 @@ import {
453
454
  resumeFromChildRun2,
454
455
  initWaitBusSubscriptions2,
455
456
  init_resume
456
- } from "./cli-nbsf8yvn.js";
457
+ } from "./cli-sya22y84.js";
457
458
  import {
458
459
  FilesError,
459
460
  providerPath,
@@ -467,7 +468,7 @@ import {
467
468
  import {
468
469
  getRuntimePool2,
469
470
  init_db2
470
- } from "./cli-eyg1pa00.js";
471
+ } from "./cli-587857ys.js";
471
472
  import {
472
473
  duplicateGuardedQueryKey,
473
474
  parseQueryParams,
@@ -500,23 +501,23 @@ import {
500
501
  findRoute,
501
502
  route,
502
503
  init_route_def
503
- } from "./cli-fyhr5h4s.js";
504
+ } from "./cli-y8nbefpb.js";
504
505
  import {
505
506
  COMPOSIO_HTTP_METHODS,
506
507
  executeComposioRequest,
507
508
  composioArgsFromParts,
508
509
  init_composio
509
- } from "./cli-s0qnd4wv.js";
510
+ } from "./cli-28fq781p.js";
510
511
  import {
511
512
  ampPinProviderError,
512
513
  ampPinCatalogError,
513
514
  ampModelError,
514
515
  init_amp_models
515
- } from "./cli-3e4snnzf.js";
516
+ } from "./cli-qkdmz8c8.js";
516
517
  import {
517
518
  object,
518
519
  init_v4_mini
519
- } from "./cli-vf078p3e.js";
520
+ } from "./cli-zfqg6fzn.js";
520
521
  import {
521
522
  addMinutes,
522
523
  init_date_fns
@@ -529,11 +530,11 @@ import {
529
530
  init_types2,
530
531
  LlmRater,
531
532
  init_llm
532
- } from "./cli-rvtm68yy.js";
533
+ } from "./cli-2xv18ywz.js";
533
534
  import {
534
535
  loadModelsDevCache,
535
536
  init_modelsdev_cache
536
- } from "./cli-jdv6ypxs.js";
537
+ } from "./cli-a0657jmf.js";
537
538
  import {
538
539
  require_dist2,
539
540
  ConnectionAuthInputSchema,
@@ -612,7 +613,7 @@ import {
612
613
  init_typecheck,
613
614
  parseSkillContent,
614
615
  init_skill_parser
615
- } from "./cli-tpksw2nr.js";
616
+ } from "./cli-2ccpqyyf.js";
616
617
  import {
617
618
  detachedProcessGroup,
618
619
  registerProcessGroup,
@@ -627,7 +628,7 @@ import {
627
628
  ensureToken,
628
629
  ensureTokenOrThrow,
629
630
  init_ensure_token
630
- } from "./cli-fzachfnf.js";
631
+ } from "./cli-cseh6f8w.js";
631
632
  import {
632
633
  require_fast_deep_equal
633
634
  } from "./cli-bhp11egn.js";
@@ -722,7 +723,7 @@ import {
722
723
  validateDefinition,
723
724
  applyDefinitionPatch,
724
725
  init_definition2
725
- } from "./cli-7axf41jq.js";
726
+ } from "./cli-ejkvvqbe.js";
726
727
  import {
727
728
  isMultiRuntimeEnabled,
728
729
  init_multi_runtime2
@@ -734,7 +735,7 @@ import {
734
735
  } from "./cli-ytyvpye5.js";
735
736
  import {
736
737
  init_v4
737
- } from "./cli-5xaqj21p.js";
738
+ } from "./cli-3kd08rej.js";
738
739
  import {
739
740
  require_dist3
740
741
  } from "./cli-k28wkapa.js";
@@ -743,15 +744,24 @@ import {
743
744
  isSlackLeaveThreadDisabled,
744
745
  leaveSlackThread,
745
746
  init_left_threads
746
- } from "./cli-66ww7fer.js";
747
+ } from "./cli-sgs5k6yd.js";
747
748
  import {
748
749
  publicEndpointSsrfOptions,
749
750
  init_mcp_wrapper
750
- } from "./cli-s4ss5g59.js";
751
+ } from "./cli-btf6fw39.js";
751
752
  import {
752
753
  canProvisionKind,
753
754
  init_runtime_providers
754
- } from "./cli-yndmfxb3.js";
755
+ } from "./cli-hxpyc9sn.js";
756
+ import {
757
+ isRbacEnabled,
758
+ decideAdmission,
759
+ grantLeadEquivalence,
760
+ revokeLeadEquivalence,
761
+ init_elevated_agents,
762
+ can,
763
+ init_rbac
764
+ } from "./cli-cyn9v8zr.js";
755
765
  import {
756
766
  findUserById,
757
767
  findUserByExternalId,
@@ -762,20 +772,11 @@ import {
762
772
  findOrCreateUserByEmail,
763
773
  linkIdentity,
764
774
  unlinkIdentity,
765
- resolveUserByToken,
775
+ resolveUserToken,
766
776
  resolveSessionToken,
767
777
  fingerprintApiKey,
768
778
  init_users
769
- } from "./cli-269q28a1.js";
770
- import {
771
- isRbacEnabled,
772
- decideAdmission,
773
- grantLeadEquivalence,
774
- revokeLeadEquivalence,
775
- init_elevated_agents,
776
- can,
777
- init_rbac
778
- } from "./cli-njwac61j.js";
779
+ } from "./cli-4t0fmf3z.js";
779
780
  import {
780
781
  normalizeAssetKey,
781
782
  sessionGroupKey,
@@ -791,7 +792,7 @@ import {
791
792
  init_import,
792
793
  $OpenAPIRegistry,
793
794
  $OpenApiGeneratorV31,
794
- init_dist6,
795
+ init_dist7,
795
796
  init_zod_openapi,
796
797
  AssetKeySchema,
797
798
  ModelTierSchema,
@@ -843,7 +844,7 @@ import {
843
844
  KvNamespaceSchema,
844
845
  KvKeySchema,
845
846
  init_types4
846
- } from "./cli-5j0m12ns.js";
847
+ } from "./cli-cvs2r2vq.js";
847
848
  import {
848
849
  generateDefaultClaudeMd2,
849
850
  generateDefaultSoulMd2,
@@ -854,7 +855,7 @@ import {
854
855
  init_task_attachment_links,
855
856
  contentSha256,
856
857
  init_profile_sync
857
- } from "./cli-dq8x79v8.js";
858
+ } from "./cli-9r5gtwjr.js";
858
859
  import {
859
860
  getSlackConfiguration,
860
861
  init_config4
@@ -866,7 +867,7 @@ import {
866
867
  import {
867
868
  selectCredential,
868
869
  init_credentials2
869
- } from "./cli-g83s9ewh.js";
870
+ } from "./cli-xfjrc279.js";
870
871
  import {
871
872
  findInterpolationTokens,
872
873
  interpolate,
@@ -879,7 +880,7 @@ import {
879
880
  } from "./cli-kf3pxxdg.js";
880
881
  import {
881
882
  init_zod
882
- } from "./cli-k5671be5.js";
883
+ } from "./cli-zcfpsfzf.js";
883
884
  import {
884
885
  safeParse,
885
886
  safeParseAsync,
@@ -894,7 +895,7 @@ import {
894
895
  array2,
895
896
  object2,
896
897
  looseObject,
897
- union2,
898
+ union3,
898
899
  discriminatedUnion,
899
900
  intersection,
900
901
  record2,
@@ -907,11 +908,11 @@ import {
907
908
  ZodIssueCode,
908
909
  datetime,
909
910
  number3
910
- } from "./cli-agfm16v9.js";
911
+ } from "./cli-hg42n3hx.js";
911
912
  import {
912
913
  init_package,
913
914
  package_default
914
- } from "./cli-msg9m2ny.js";
915
+ } from "./cli-650zv9q9.js";
915
916
  import {
916
917
  realtimeBus,
917
918
  init_bus
@@ -943,15 +944,6 @@ import {
943
944
  getApiKey,
944
945
  init_api_key
945
946
  } from "./cli-pax9q4ff.js";
946
- import {
947
- scrubSecrets,
948
- scrubObject,
949
- createValueScrubber,
950
- refreshSecretScrubberCache,
951
- registerVolatileSecret,
952
- registerSensitiveKeyName,
953
- init_secret_scrubber
954
- } from "./cli-1b7btd38.js";
955
947
  import {
956
948
  chatgptSubscriptionModelId,
957
949
  isAlias,
@@ -965,8 +957,15 @@ import {
965
957
  harnessModelMismatch,
966
958
  openAICompatibleProviderIds,
967
959
  claudeCatalogModelId,
968
- init_src2
969
- } from "./cli-5c4hjzne.js";
960
+ init_src2,
961
+ scrubSecrets,
962
+ scrubObject,
963
+ createValueScrubber,
964
+ refreshSecretScrubberCache,
965
+ registerVolatileSecret,
966
+ registerSensitiveKeyName,
967
+ init_secret_scrubber
968
+ } from "./cli-d84byzn8.js";
970
969
  import {
971
970
  __toESM,
972
971
  __commonJS,
@@ -1157,7 +1156,7 @@ var init_types = __esm(() => {
1157
1156
  init_v4();
1158
1157
  SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
1159
1158
  AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
1160
- ProgressTokenSchema = union2([string2(), number2().int()]);
1159
+ ProgressTokenSchema = union3([string2(), number2().int()]);
1161
1160
  CursorSchema = string2();
1162
1161
  TaskCreationParamsSchema = looseObject({
1163
1162
  ttl: number2().optional(),
@@ -1193,7 +1192,7 @@ var init_types = __esm(() => {
1193
1192
  ResultSchema = looseObject({
1194
1193
  _meta: RequestMetaSchema.optional()
1195
1194
  });
1196
- RequestIdSchema = union2([string2(), number2().int()]);
1195
+ RequestIdSchema = union3([string2(), number2().int()]);
1197
1196
  JSONRPCRequestSchema = object2({
1198
1197
  jsonrpc: literal2(JSONRPC_VERSION),
1199
1198
  id: RequestIdSchema,
@@ -1227,13 +1226,13 @@ var init_types = __esm(() => {
1227
1226
  data: unknown().optional()
1228
1227
  })
1229
1228
  }).strict();
1230
- JSONRPCMessageSchema = union2([
1229
+ JSONRPCMessageSchema = union3([
1231
1230
  JSONRPCRequestSchema,
1232
1231
  JSONRPCNotificationSchema,
1233
1232
  JSONRPCResultResponseSchema,
1234
1233
  JSONRPCErrorResponseSchema
1235
1234
  ]);
1236
- JSONRPCResponseSchema = union2([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
1235
+ JSONRPCResponseSchema = union3([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
1237
1236
  EmptyResultSchema = ResultSchema.strict();
1238
1237
  CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
1239
1238
  requestId: RequestIdSchema.optional(),
@@ -1378,7 +1377,7 @@ var init_types = __esm(() => {
1378
1377
  TaskSchema = object2({
1379
1378
  taskId: string2(),
1380
1379
  status: TaskStatusSchema,
1381
- ttl: union2([number2(), _null()]),
1380
+ ttl: union3([number2(), _null()]),
1382
1381
  createdAt: string2(),
1383
1382
  lastUpdatedAt: string2(),
1384
1383
  pollInterval: optional2(number2()),
@@ -1484,7 +1483,7 @@ var init_types = __esm(() => {
1484
1483
  params: ReadResourceRequestParamsSchema
1485
1484
  });
1486
1485
  ReadResourceResultSchema = ResultSchema.extend({
1487
- contents: array2(union2([TextResourceContentsSchema, BlobResourceContentsSchema]))
1486
+ contents: array2(union3([TextResourceContentsSchema, BlobResourceContentsSchema]))
1488
1487
  });
1489
1488
  ResourceListChangedNotificationSchema = NotificationSchema.extend({
1490
1489
  method: literal2("notifications/resources/list_changed"),
@@ -1562,14 +1561,14 @@ var init_types = __esm(() => {
1562
1561
  });
1563
1562
  EmbeddedResourceSchema = object2({
1564
1563
  type: literal2("resource"),
1565
- resource: union2([TextResourceContentsSchema, BlobResourceContentsSchema]),
1564
+ resource: union3([TextResourceContentsSchema, BlobResourceContentsSchema]),
1566
1565
  annotations: AnnotationsSchema.optional(),
1567
1566
  _meta: record2(string2(), unknown()).optional()
1568
1567
  });
1569
1568
  ResourceLinkSchema = ResourceSchema.extend({
1570
1569
  type: literal2("resource_link")
1571
1570
  });
1572
- ContentBlockSchema = union2([
1571
+ ContentBlockSchema = union3([
1573
1572
  TextContentSchema,
1574
1573
  ImageContentSchema,
1575
1574
  AudioContentSchema,
@@ -1693,7 +1692,7 @@ var init_types = __esm(() => {
1693
1692
  ]);
1694
1693
  SamplingMessageSchema = object2({
1695
1694
  role: RoleSchema,
1696
- content: union2([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)]),
1695
+ content: union3([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)]),
1697
1696
  _meta: record2(string2(), unknown()).optional()
1698
1697
  });
1699
1698
  CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
@@ -1722,7 +1721,7 @@ var init_types = __esm(() => {
1722
1721
  model: string2(),
1723
1722
  stopReason: optional2(_enum2(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())),
1724
1723
  role: RoleSchema,
1725
- content: union2([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)])
1724
+ content: union3([SamplingMessageContentBlockSchema, array2(SamplingMessageContentBlockSchema)])
1726
1725
  });
1727
1726
  BooleanSchemaSchema = object2({
1728
1727
  type: literal2("boolean"),
@@ -1772,7 +1771,7 @@ var init_types = __esm(() => {
1772
1771
  enumNames: array2(string2()).optional(),
1773
1772
  default: string2().optional()
1774
1773
  });
1775
- SingleSelectEnumSchemaSchema = union2([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
1774
+ SingleSelectEnumSchemaSchema = union3([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
1776
1775
  UntitledMultiSelectEnumSchemaSchema = object2({
1777
1776
  type: literal2("array"),
1778
1777
  title: string2().optional(),
@@ -1799,9 +1798,9 @@ var init_types = __esm(() => {
1799
1798
  }),
1800
1799
  default: array2(string2()).optional()
1801
1800
  });
1802
- MultiSelectEnumSchemaSchema = union2([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
1803
- EnumSchemaSchema = union2([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
1804
- PrimitiveSchemaDefinitionSchema = union2([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
1801
+ MultiSelectEnumSchemaSchema = union3([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
1802
+ EnumSchemaSchema = union3([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
1803
+ PrimitiveSchemaDefinitionSchema = union3([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
1805
1804
  ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
1806
1805
  mode: literal2("form").optional(),
1807
1806
  message: string2(),
@@ -1817,7 +1816,7 @@ var init_types = __esm(() => {
1817
1816
  elicitationId: string2(),
1818
1817
  url: string2().url()
1819
1818
  });
1820
- ElicitRequestParamsSchema = union2([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
1819
+ ElicitRequestParamsSchema = union3([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
1821
1820
  ElicitRequestSchema = RequestSchema.extend({
1822
1821
  method: literal2("elicitation/create"),
1823
1822
  params: ElicitRequestParamsSchema
@@ -1831,7 +1830,7 @@ var init_types = __esm(() => {
1831
1830
  });
1832
1831
  ElicitResultSchema = ResultSchema.extend({
1833
1832
  action: _enum2(["accept", "decline", "cancel"]),
1834
- content: preprocess((val) => val === null ? undefined : val, record2(string2(), union2([string2(), number2(), boolean(), array2(string2())])).optional())
1833
+ content: preprocess((val) => val === null ? undefined : val, record2(string2(), union3([string2(), number2(), boolean(), array2(string2())])).optional())
1835
1834
  });
1836
1835
  ResourceTemplateReferenceSchema = object2({
1837
1836
  type: literal2("ref/resource"),
@@ -1842,7 +1841,7 @@ var init_types = __esm(() => {
1842
1841
  name: string2()
1843
1842
  });
1844
1843
  CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
1845
- ref: union2([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
1844
+ ref: union3([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
1846
1845
  argument: object2({
1847
1846
  name: string2(),
1848
1847
  value: string2()
@@ -1878,7 +1877,7 @@ var init_types = __esm(() => {
1878
1877
  method: literal2("notifications/roots/list_changed"),
1879
1878
  params: NotificationsParamsSchema.optional()
1880
1879
  });
1881
- ClientRequestSchema = union2([
1880
+ ClientRequestSchema = union3([
1882
1881
  PingRequestSchema,
1883
1882
  InitializeRequestSchema,
1884
1883
  CompleteRequestSchema,
@@ -1897,14 +1896,14 @@ var init_types = __esm(() => {
1897
1896
  ListTasksRequestSchema,
1898
1897
  CancelTaskRequestSchema
1899
1898
  ]);
1900
- ClientNotificationSchema = union2([
1899
+ ClientNotificationSchema = union3([
1901
1900
  CancelledNotificationSchema,
1902
1901
  ProgressNotificationSchema,
1903
1902
  InitializedNotificationSchema,
1904
1903
  RootsListChangedNotificationSchema,
1905
1904
  TaskStatusNotificationSchema
1906
1905
  ]);
1907
- ClientResultSchema = union2([
1906
+ ClientResultSchema = union3([
1908
1907
  EmptyResultSchema,
1909
1908
  CreateMessageResultSchema,
1910
1909
  CreateMessageResultWithToolsSchema,
@@ -1914,7 +1913,7 @@ var init_types = __esm(() => {
1914
1913
  ListTasksResultSchema,
1915
1914
  CreateTaskResultSchema
1916
1915
  ]);
1917
- ServerRequestSchema = union2([
1916
+ ServerRequestSchema = union3([
1918
1917
  PingRequestSchema,
1919
1918
  CreateMessageRequestSchema,
1920
1919
  ElicitRequestSchema,
@@ -1924,7 +1923,7 @@ var init_types = __esm(() => {
1924
1923
  ListTasksRequestSchema,
1925
1924
  CancelTaskRequestSchema
1926
1925
  ]);
1927
- ServerNotificationSchema = union2([
1926
+ ServerNotificationSchema = union3([
1928
1927
  CancelledNotificationSchema,
1929
1928
  ProgressNotificationSchema,
1930
1929
  LoggingMessageNotificationSchema,
@@ -1935,7 +1934,7 @@ var init_types = __esm(() => {
1935
1934
  TaskStatusNotificationSchema,
1936
1935
  ElicitationCompleteNotificationSchema
1937
1936
  ]);
1938
- ServerResultSchema = union2([
1937
+ ServerResultSchema = union3([
1939
1938
  EmptyResultSchema,
1940
1939
  InitializeResultSchema,
1941
1940
  CompleteResultSchema,
@@ -20908,7 +20907,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
20908
20907
  if (!waiting)
20909
20908
  continue;
20910
20909
  if (result.waitFor === "workflow.child.finished") {
20911
- const { resumeFromChildRun } = await import("./resume-1c8kr3nh.js");
20910
+ const { resumeFromChildRun } = await import("./resume-x94gemep.js");
20912
20911
  await resumeFromChildRun(step.id, registry);
20913
20912
  }
20914
20913
  } else {
@@ -21621,7 +21620,7 @@ var init_notify = __esm(() => {
21621
21620
  }
21622
21621
  }
21623
21622
  case "slack": {
21624
- const { getSlackApp } = await import("./app-e00m45gn.js");
21623
+ const { getSlackApp } = await import("./app-a66ssc4k.js");
21625
21624
  const app = getSlackApp();
21626
21625
  if (!app) {
21627
21626
  return {
@@ -21739,7 +21738,7 @@ var init_property_match = __esm(() => {
21739
21738
  async function executeRawLlm(config) {
21740
21739
  let modelName = config.model ?? "google/gemini-3-flash-preview";
21741
21740
  try {
21742
- const { createOpenAI } = await import("./index-h39zbx67.js");
21741
+ const { createOpenAI } = await import("./index-hsad2t3r.js");
21743
21742
  const llmConfig = await resolveWorkflowLlmConfig(config.model);
21744
21743
  modelName = llmConfig.model;
21745
21744
  const provider = createOpenAI({
@@ -21749,7 +21748,7 @@ async function executeRawLlm(config) {
21749
21748
  });
21750
21749
  const model = provider(llmConfig.model);
21751
21750
  if (config.schema) {
21752
- const { generateObject, jsonSchema } = await import("./index-6cxzwfen.js");
21751
+ const { generateObject, jsonSchema } = await import("./index-5a9jtqde.js");
21753
21752
  const { object } = await generateObject({
21754
21753
  model,
21755
21754
  schema: jsonSchema(config.schema),
@@ -21763,7 +21762,7 @@ async function executeRawLlm(config) {
21763
21762
  output: { result: object, model: modelName }
21764
21763
  };
21765
21764
  }
21766
- const { generateText } = await import("./index-6cxzwfen.js");
21765
+ const { generateText } = await import("./index-5a9jtqde.js");
21767
21766
  const { text } = await generateText({
21768
21767
  model,
21769
21768
  prompt: config.prompt
@@ -22320,8 +22319,8 @@ var init_validate2 = __esm(() => {
22320
22319
  const interpolatedPrompt = this.deps.interpolate(prompt, context);
22321
22320
  const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
22322
22321
  try {
22323
- const { createOpenAI } = await import("./index-h39zbx67.js");
22324
- const { generateObject, jsonSchema } = await import("./index-6cxzwfen.js");
22322
+ const { createOpenAI } = await import("./index-hsad2t3r.js");
22323
+ const { generateObject, jsonSchema } = await import("./index-5a9jtqde.js");
22325
22324
  const llmConfig = await resolveWorkflowLlmConfig();
22326
22325
  const provider = createOpenAI({
22327
22326
  baseURL: llmConfig.baseURL,
@@ -22395,7 +22394,7 @@ var init_vcs = __esm(() => {
22395
22394
  });
22396
22395
  VcsOutputSchema = object2({
22397
22396
  url: string2(),
22398
- id: union2([string2(), number2()])
22397
+ id: union3([string2(), number2()])
22399
22398
  });
22400
22399
  VcsExecutor = class VcsExecutor extends BaseExecutor {
22401
22400
  type = "vcs";
@@ -25016,7 +25015,7 @@ function setPreloadedTools(server, names) {
25016
25015
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
25017
25016
  if (requestInfo.callOrigin !== "mcp")
25018
25017
  return { args };
25019
- const dispatcher = await import("./dispatcher-b1yz2bnn.js");
25018
+ const dispatcher = await import("./dispatcher-j3h81t7m.js");
25020
25019
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
25021
25020
  validateModify: async (data) => {
25022
25021
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -35995,7 +35994,7 @@ async function notifySlack(text) {
35995
35994
  return;
35996
35995
  }
35997
35996
  try {
35998
- const { getSlackApp } = await import("./app-e00m45gn.js");
35997
+ const { getSlackApp } = await import("./app-a66ssc4k.js");
35999
35998
  const app = getSlackApp();
36000
35999
  if (!app) {
36001
36000
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -36066,7 +36065,7 @@ async function deleteJiraWebhook(webhookId) {
36066
36065
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
36067
36066
  }
36068
36067
  async function overwriteWebhookIds(next) {
36069
- const { getDbClient } = await import("./db-athc68zt.js");
36068
+ const { getDbClient } = await import("./db-pm96nhdb.js");
36070
36069
  await getDbClient().transaction(async (tx) => {
36071
36070
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
36072
36071
  if (!row) {
@@ -109373,9 +109372,10 @@ async function resolveHttpRequestAuth(req, apiKey, options = {}) {
109373
109372
  return { kind: "operator", fingerprint: fingerprintApiKey(bearer) };
109374
109373
  }
109375
109374
  if (bearer.startsWith("aswt_")) {
109376
- const user = await resolveUserByToken(bearer);
109377
- if (isActiveUser(user)) {
109378
- return { kind: "user", userId: user.id, user };
109375
+ const resolved = await resolveUserToken(bearer);
109376
+ const user = resolved?.user ?? null;
109377
+ if (resolved && isActiveUser(user)) {
109378
+ return { kind: "user", userId: user.id, user, tokenId: resolved.tokenId };
109379
109379
  }
109380
109380
  }
109381
109381
  if (bearer.startsWith("aseph_")) {
@@ -109506,7 +109506,7 @@ var ErrorResponseSchema, cachedSpec = null, SCALAR_HTML = `<!DOCTYPE html>
109506
109506
  </body>
109507
109507
  </html>`;
109508
109508
  var init_openapi = __esm(() => {
109509
- init_dist6();
109509
+ init_dist7();
109510
109510
  init_constants3();
109511
109511
  init_zod_openapi();
109512
109512
  init_route_def();
@@ -109560,7 +109560,7 @@ async function reloadGlobalConfigsAndIntegrations() {
109560
109560
  return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
109561
109561
  }
109562
109562
  async function reloadGlobalConfigsAndIntegrationsInner() {
109563
- const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-cqhqpgrv.js");
109563
+ const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-p4hjwbvw.js");
109564
109564
  const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
109565
109565
  const updated = await loadGlobalConfigsIntoEnv(true);
109566
109566
  await syncTelemetryEnabled("settings").catch((err) => {
@@ -109576,7 +109576,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
109576
109576
  integrations.push("embeddings");
109577
109577
  }
109578
109578
  if (isEmbeddingsConfigured) {
109579
- import("./embedding-space-b4txbwrk.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109579
+ import("./embedding-space-xh8p4q4x.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109580
109580
  console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
109581
109581
  });
109582
109582
  }
@@ -111098,10 +111098,10 @@ var init_sync3 = __esm(() => {
111098
111098
  TransformError = class TransformError extends Error {
111099
111099
  };
111100
111100
  SourceRecordSchema = object2({
111101
- key: union2([string2().min(1), number2()]).transform(String),
111101
+ key: union3([string2().min(1), number2()]).transform(String),
111102
111102
  fields: record2(string2(), unknown())
111103
111103
  });
111104
- PullPayloadSchema = union2([
111104
+ PullPayloadSchema = union3([
111105
111105
  array2(SourceRecordSchema),
111106
111106
  object2({ records: array2(SourceRecordSchema), complete: boolean().optional() })
111107
111107
  ]);
@@ -111925,14 +111925,14 @@ var init_schema_migrate = __esm(() => {
111925
111925
  init_format_upgrades();
111926
111926
  init_row_store();
111927
111927
  init_sync3();
111928
- MigrationValueSchema = union2([
111928
+ MigrationValueSchema = union3([
111929
111929
  string2(),
111930
111930
  number2(),
111931
111931
  boolean(),
111932
111932
  record2(string2(), unknown()),
111933
111933
  array2(unknown())
111934
111934
  ]);
111935
- AppMigrationDirectiveSchema = union2([
111935
+ AppMigrationDirectiveSchema = union3([
111936
111936
  object2({ set: MigrationValueSchema }).strict(),
111937
111937
  object2({
111938
111938
  from: AppNameSchema,
@@ -113410,7 +113410,7 @@ var init_apps = __esm(() => {
113410
113410
  });
113411
113411
  valuesSchema = record2(string2(), unknown());
113412
113412
  AppValidationIssueSchema = object2({ path: string2(), message: string2() });
113413
- JsonValueSchema = union2([
113413
+ JsonValueSchema = union3([
113414
113414
  record2(string2(), unknown()),
113415
113415
  array2(unknown()),
113416
113416
  string2(),
@@ -113477,10 +113477,10 @@ var init_apps = __esm(() => {
113477
113477
  markedStale: number2(),
113478
113478
  error: string2().optional()
113479
113479
  });
113480
- UserConfigValuesSchema = record2(string2(), union2([string2(), number2(), boolean(), _null()]));
113480
+ UserConfigValuesSchema = record2(string2(), union3([string2(), number2(), boolean(), _null()]));
113481
113481
  AppUserConfigFieldSchema = object2({
113482
113482
  kind: ScalarColumnKindSchema,
113483
- default: union2([string2(), number2(), boolean()]).optional(),
113483
+ default: union3([string2(), number2(), boolean()]).optional(),
113484
113484
  enum: array2(string2()).optional(),
113485
113485
  label: string2().optional()
113486
113486
  });
@@ -113834,7 +113834,7 @@ var init_apps = __esm(() => {
113834
113834
  error: string2().optional(),
113835
113835
  durationMs: number2()
113836
113836
  });
113837
- runActionResultSchema = union2([
113837
+ runActionResultSchema = union3([
113838
113838
  runActionScriptResultSchema,
113839
113839
  runActionTaskResultSchema,
113840
113840
  runActionSyncResultSchema
@@ -113958,7 +113958,7 @@ ${JSON.stringify(syncStatus, null, 2)}` : JSON.stringify(app, null, 2);
113958
113958
  inputSchema: object2({
113959
113959
  appId: string2().min(1).describe("App ID containing the named query."),
113960
113960
  query: string2().min(1).describe("Declared query name."),
113961
- params: record2(string2(), union2([string2(), number2(), boolean()])).optional().describe("Values for any $param filters declared by the named query.")
113961
+ params: record2(string2(), union3([string2(), number2(), boolean()])).optional().describe("Values for any $param filters declared by the named query.")
113962
113962
  }),
113963
113963
  outputSchema: swarmToolOutputSchema({
113964
113964
  rows: array2(looseObject({})).optional(),
@@ -114480,7 +114480,7 @@ var init_app_rows = __esm(() => {
114480
114480
  base = { appId: string2().min(1), model: AppNameSchema };
114481
114481
  rowId = string2().min(1);
114482
114482
  values = record2(string2(), unknown());
114483
- equals = record2(string2(), union2([string2(), number2(), boolean()]));
114483
+ equals = record2(string2(), union3([string2(), number2(), boolean()]));
114484
114484
  limit = number2().int().min(1).max(1000);
114485
114485
  rowOutput = { row: looseObject({}).optional() };
114486
114486
  rowsOutput = { rows: array2(looseObject({})).optional() };
@@ -122039,21 +122039,25 @@ var userOutputShape, IdentityEntry, InputSchema, registerManageUserTool = (serve
122039
122039
  }
122040
122040
  try {
122041
122041
  const metadata = mergeComms(input.metadata, input.comms) ?? undefined;
122042
- const user = await createUser2({
122043
- name: input.name,
122044
- email: input.email,
122045
- role: input.role,
122046
- notes: input.notes,
122047
- emailAliases: input.emailAliases,
122048
- preferredChannel: input.preferredChannel,
122049
- timezone: input.timezone,
122050
- dailyBudgetUsd: input.dailyBudgetUsd ?? undefined,
122051
- status: input.status,
122052
- metadata
122042
+ const name = input.name;
122043
+ const user = await getDbClient2().transaction(async () => {
122044
+ const created = await createUser2({
122045
+ name,
122046
+ email: input.email,
122047
+ role: input.role,
122048
+ notes: input.notes,
122049
+ emailAliases: input.emailAliases,
122050
+ preferredChannel: input.preferredChannel,
122051
+ timezone: input.timezone,
122052
+ dailyBudgetUsd: input.dailyBudgetUsd ?? undefined,
122053
+ status: input.status,
122054
+ metadata
122055
+ });
122056
+ for (const ident of input.identities ?? []) {
122057
+ await linkIdentity(created.id, ident.kind, ident.externalId, operatorActor);
122058
+ }
122059
+ return created;
122053
122060
  });
122054
- for (const ident of input.identities ?? []) {
122055
- await linkIdentity(user.id, ident.kind, ident.externalId, operatorActor);
122056
- }
122057
122061
  return toolOk(`User created: "${user.name}" (${user.id}).`, {
122058
122062
  details: JSON.stringify(user, null, 2),
122059
122063
  data: { user }
@@ -122073,46 +122077,56 @@ var userOutputShape, IdentityEntry, InputSchema, registerManageUserTool = (serve
122073
122077
  return toolErr(`User ${input.userId} not found.`);
122074
122078
  }
122075
122079
  const metadata = mergeComms(input.comms !== undefined && input.metadata === undefined ? before.metadata : input.metadata, input.comms);
122076
- const user = await updateUser2(input.userId, {
122077
- name: input.name,
122078
- email: input.email,
122079
- role: input.role,
122080
- notes: input.notes,
122081
- emailAliases: input.emailAliases,
122082
- preferredChannel: input.preferredChannel,
122083
- timezone: input.timezone,
122084
- dailyBudgetUsd: input.dailyBudgetUsd,
122085
- status: input.status,
122086
- metadata
122087
- });
122088
- if (!user) {
122089
- return toolErr(`User ${input.userId} not found.`);
122090
- }
122091
- if (input.identities !== undefined) {
122092
- const current = await getUserIdentities(input.userId);
122093
- const currentSet = new Set(current.map((i) => `${i.kind}:${i.externalId}`));
122094
- const desiredSet = new Set(input.identities.map((i) => `${i.kind}:${i.externalId}`));
122095
- for (const ident of input.identities) {
122096
- if (!currentSet.has(`${ident.kind}:${ident.externalId}`)) {
122097
- await linkIdentity(input.userId, ident.kind, ident.externalId, operatorActor);
122098
- }
122080
+ const userId = input.userId;
122081
+ const bindsIdentity = input.identities !== undefined || input.email !== undefined || input.emailAliases !== undefined;
122082
+ const user = await getDbClient2().transaction(async () => {
122083
+ if (bindsIdentity) {
122084
+ await assertMayActOnOperatorGrantedTarget2({ kind: "agent", id: callerAgent.id }, userId);
122099
122085
  }
122100
- for (const ident of current) {
122101
- if (!desiredSet.has(`${ident.kind}:${ident.externalId}`)) {
122102
- await unlinkIdentity(input.userId, ident.kind, ident.externalId, operatorActor);
122086
+ const updated = await updateUser2(userId, {
122087
+ name: input.name,
122088
+ email: input.email,
122089
+ role: input.role,
122090
+ notes: input.notes,
122091
+ emailAliases: input.emailAliases,
122092
+ preferredChannel: input.preferredChannel,
122093
+ timezone: input.timezone,
122094
+ dailyBudgetUsd: input.dailyBudgetUsd,
122095
+ status: input.status,
122096
+ metadata
122097
+ });
122098
+ if (!updated)
122099
+ return null;
122100
+ if (input.identities !== undefined) {
122101
+ const current = await getUserIdentities(userId);
122102
+ const currentSet = new Set(current.map((i) => `${i.kind}:${i.externalId}`));
122103
+ const desiredSet = new Set(input.identities.map((i) => `${i.kind}:${i.externalId}`));
122104
+ for (const ident of input.identities) {
122105
+ if (!currentSet.has(`${ident.kind}:${ident.externalId}`)) {
122106
+ await linkIdentity(userId, ident.kind, ident.externalId, operatorActor);
122107
+ }
122108
+ }
122109
+ for (const ident of current) {
122110
+ if (!desiredSet.has(`${ident.kind}:${ident.externalId}`)) {
122111
+ await unlinkIdentity(userId, ident.kind, ident.externalId, operatorActor);
122112
+ }
122103
122113
  }
122104
122114
  }
122105
- }
122106
- if (input.emailAliases !== undefined) {
122107
- const { added, removed } = diffAliases(before.emailAliases, input.emailAliases);
122108
- for (const alias of added) {
122109
- await recordIdentityEvent(input.userId, "email_added", operatorActor, null, {
122110
- alias
122111
- });
122112
- }
122113
- for (const alias of removed) {
122114
- await recordIdentityEvent(input.userId, "email_removed", operatorActor, { alias }, null);
122115
+ if (input.emailAliases !== undefined) {
122116
+ const { added, removed } = diffAliases(before.emailAliases, input.emailAliases);
122117
+ for (const alias of added) {
122118
+ await recordIdentityEvent(userId, "email_added", operatorActor, null, {
122119
+ alias
122120
+ });
122121
+ }
122122
+ for (const alias of removed) {
122123
+ await recordIdentityEvent(userId, "email_removed", operatorActor, { alias }, null);
122124
+ }
122115
122125
  }
122126
+ return updated;
122127
+ });
122128
+ if (!user) {
122129
+ return toolErr(`User ${input.userId} not found.`);
122116
122130
  }
122117
122131
  return toolOk(`User updated: "${user.name}" (${user.id}).`, {
122118
122132
  details: JSON.stringify(user, null, 2),
@@ -122138,6 +122152,7 @@ var userOutputShape, IdentityEntry, InputSchema, registerManageUserTool = (serve
122138
122152
  var init_manage_user = __esm(() => {
122139
122153
  init_zod();
122140
122154
  init_db4();
122155
+ init_rbac_roles();
122141
122156
  init_users();
122142
122157
  init_rbac();
122143
122158
  init_utils();
@@ -123477,7 +123492,7 @@ var registerMemoryStoreTool = (server) => {
123477
123492
  content: string2().min(1).describe("The memory body. Markdown is fine. State the fact, the context it applies to, and the evidence."),
123478
123493
  name: string2().min(1).max(200).optional().describe("Short title used in search results and the UI. Defaults to the first non-empty content line (up to 200 characters). A name that starts with /longterm/ is also used as the key when no key is given."),
123479
123494
  scope: AgentMemoryScopeSchema.default("agent").describe("'agent' (default): only you can recall it. 'swarm': every agent can recall it."),
123480
- tags: union2([array2(string2()), string2()]).optional().describe("Free-form tags as an array or a comma-separated string, for example a repo name or a topic."),
123495
+ tags: union3([array2(string2()), string2()]).optional().describe("Free-form tags as an array or a comma-separated string, for example a repo name or a topic."),
123481
123496
  taskId: uuid().optional().describe("The task this learning came from, when there is one."),
123482
123497
  intent: string2().min(1).optional().describe("Why this is worth remembering. Kept in the audit trail."),
123483
123498
  key: string2().max(MEMORY_KEY_MAX_LENGTH).regex(MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE).optional().describe("Optional logical path for this memory, for example '/longterm/facts/swarm-runtime/sqlite-busy-retry'. Lowercase segments joined by '/', starting with '/'. Search it with memory-search keyPrefix and move it with memory-edit newKey. Fails when you already have a memory with this key in this scope. A key under /longterm marks the memory as curated: it never expires and is protected from cleanup. It must start with /longterm/company-story, /longterm/entities/people, /longterm/entities/customers, /longterm/facts, /longterm/decisions, /longterm/workstreams or /longterm/timeline. Paths under /longterm/company-story, /longterm/entities and /longterm/timeline are lead-only. Defaults to an auto key, which makes the memory inbox material.")
@@ -131176,7 +131191,7 @@ var init_document = __esm(() => {
131176
131191
  init_yjs();
131177
131192
  init_zod();
131178
131193
  UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
131179
- pathSegmentSchema = union2([
131194
+ pathSegmentSchema = union3([
131180
131195
  string2().min(1).max(512).refine((value) => !UNSAFE_KEYS.has(value), "unsafe path key"),
131181
131196
  number2().int().nonnegative()
131182
131197
  ]);
@@ -134646,6 +134661,7 @@ async function sendTaskHandler(ctx, {
134646
134661
  requestedByUserId,
134647
134662
  source: "mcp",
134648
134663
  sourceTaskId,
134664
+ dispatchedByTaskId: sourceTaskId,
134649
134665
  taskType,
134650
134666
  tags,
134651
134667
  priority,
@@ -137089,7 +137105,7 @@ var init_slack_post = __esm(() => {
137089
137105
  });
137090
137106
 
137091
137107
  // src/tools/slack-read.ts
137092
- var AUTO_DOWNLOAD_DIR = "/app/shared/downloads/slack", SlackFileSchema, SlackMessageSchema, registerSlackReadTool = (server) => {
137108
+ var AUTO_DOWNLOAD_DIR = "/app/shared/downloads/slack", USERS_INFO_CONCURRENCY = 4, SlackFileSchema, SlackMessageSchema, registerSlackReadTool = (server) => {
137093
137109
  createToolRegistrar(server)("slack-read", {
137094
137110
  title: "Read Slack thread/channel history",
137095
137111
  description: "Read messages from a Slack thread or channel. Use inboxMessageId or taskId to read from a thread you have context for, or provide channelId directly for channel history (leads only). From a task, files in the messages are stored as attachments of that task, each with a ready-to-run `fetchCommand`.",
@@ -137180,31 +137196,34 @@ var AUTO_DOWNLOAD_DIR = "/app/shared/downloads/slack", SlackFileSchema, SlackMes
137180
137196
  });
137181
137197
  }
137182
137198
  try {
137199
+ let getUserDisplayName = function(userId) {
137200
+ let name = userNameCache.get(userId);
137201
+ if (!name) {
137202
+ name = client.users.info({ user: userId }).then((result) => result.user?.profile?.display_name || result.user?.real_name || userId).catch(() => userId);
137203
+ userNameCache.set(userId, name);
137204
+ }
137205
+ return name;
137206
+ };
137183
137207
  const client = app.client;
137184
- let rawMessages = [];
137185
- if (slackThreadTs) {
137186
- const result = await withAutoJoin(client, slackChannelId, () => client.conversations.replies({ channel: slackChannelId, ts: slackThreadTs, limit }));
137187
- rawMessages = result.messages || [];
137188
- } else {
137189
- const result = await withAutoJoin(client, slackChannelId, () => client.conversations.history({ channel: slackChannelId, limit }));
137190
- rawMessages = result.messages || [];
137191
- }
137192
- const authResult = await client.auth.test();
137193
- const botUserId = authResult.user_id;
137208
+ const [fetchedSettled, authSettled] = await Promise.allSettled([
137209
+ slackThreadTs ? withAutoJoin(client, slackChannelId, () => client.conversations.replies({ channel: slackChannelId, ts: slackThreadTs, limit })) : withAutoJoin(client, slackChannelId, () => client.conversations.history({ channel: slackChannelId, limit })),
137210
+ client.auth.test()
137211
+ ]);
137212
+ if (fetchedSettled.status === "rejected")
137213
+ throw fetchedSettled.reason;
137214
+ if (authSettled.status === "rejected")
137215
+ throw authSettled.reason;
137216
+ const rawMessages = fetchedSettled.value.messages || [];
137217
+ const botUserId = authSettled.value.user_id;
137194
137218
  const userNameCache = new Map;
137195
- async function getUserDisplayName(userId) {
137196
- if (userNameCache.has(userId)) {
137197
- return userNameCache.get(userId);
137198
- }
137199
- try {
137200
- const result = await client.users.info({ user: userId });
137201
- const name = result.user?.profile?.display_name || result.user?.real_name || userId;
137202
- userNameCache.set(userId, name);
137203
- return name;
137204
- } catch {
137205
- return userId;
137219
+ const authorIds = [
137220
+ ...new Set(rawMessages.flatMap((m) => m.user && m.user !== botUserId && m.bot_id === undefined && m.subtype !== "bot_message" && (extractSlackMessageText(m) || collectSlackMessageFiles(m).length > 0) ? [m.user] : []))
137221
+ ];
137222
+ await Promise.all(Array.from({ length: Math.min(USERS_INFO_CONCURRENCY, authorIds.length) }, async () => {
137223
+ for (let id = authorIds.shift();id; id = authorIds.shift()) {
137224
+ await getUserDisplayName(id);
137206
137225
  }
137207
- }
137226
+ }));
137208
137227
  const token = process.env.SLACK_BOT_TOKEN;
137209
137228
  const attachTo = contextTask ?? await attachableTask(agent.id, taskId ?? requestInfo.sourceTaskId);
137210
137229
  if (taskId && !attachTo) {
@@ -138175,7 +138194,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138175
138194
  failureReason: string2().optional().describe("The reason for failure (used when failing), or the one-line reason for a skip (required with status 'skipped')."),
138176
138195
  attachments: array2(AttachmentInputSchema).max(20).optional().describe("Pointer-based artifacts produced by this step — agent-fs path, URL, shared-fs path, or swarm Page. No inline file data; upload to agent-fs first and attach by path. Agent-fs pointers are verified before task state changes, using the explicit org/drive pair or the registering agent's configured defaults. May be sent on any call (progress or completion) and accumulates across calls; duplicates are de-duped by sha256 (when present) or by (kind, pointer, name)."),
138177
138196
  citations: array2(CitationInputSchema).max(MAX_TASK_CITATIONS).catch([]).optional().describe('Claim sources, upserted by index across calls. Use only for factual claims the reader cannot already see in the thread or task tree, 1-2 sources; none on delegation, routing, acks, or status replies. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.'),
138178
- learning: union2([
138197
+ learning: union3([
138179
138198
  string2(),
138180
138199
  object2({
138181
138200
  text: string2(),
@@ -138568,6 +138587,318 @@ var init_store_progress = __esm(() => {
138568
138587
  });
138569
138588
  });
138570
138589
 
138590
+ // src/be/improvements.ts
138591
+ function isValidImprovementEmail(value) {
138592
+ const trimmed = value?.trim() ?? "";
138593
+ return trimmed.length > 0 && trimmed.length <= EMAIL_MAX && VALID_EMAIL_RE.test(trimmed);
138594
+ }
138595
+ function toImprovement(row) {
138596
+ return {
138597
+ id: row.id,
138598
+ text: row.text,
138599
+ email: row.email,
138600
+ status: row.status,
138601
+ source: row.source,
138602
+ requestedByAgentId: row.requested_by_agent_id,
138603
+ approvedBy: row.approved_by,
138604
+ approvedAt: row.approved_at,
138605
+ sentAt: row.sent_at,
138606
+ proxyStatus: row.proxy_status,
138607
+ proxyId: row.proxy_id,
138608
+ proxyError: row.proxy_error,
138609
+ createdAt: row.created_at,
138610
+ updatedAt: row.updated_at
138611
+ };
138612
+ }
138613
+ async function globalValue(key) {
138614
+ const stored = (await getSwarmConfigs2({ scope: "global", key }))?.[0]?.value;
138615
+ return (stored ?? process.env[key])?.trim() || undefined;
138616
+ }
138617
+ async function isImprovementsEnabled() {
138618
+ return parseEnvFlag(await globalValue(IMPROVEMENTS_ENABLED_KEY), true);
138619
+ }
138620
+ async function assertEnabled() {
138621
+ if (!await isImprovementsEnabled()) {
138622
+ throw new ImprovementError("improvements_disabled", "Improvements are turned off (IMPROVEMENTS_ENABLED=false).");
138623
+ }
138624
+ }
138625
+ function buildImprovementPayload(input) {
138626
+ return { install_id: input.installId, text: input.text, email: input.email };
138627
+ }
138628
+ async function improvementInstallId() {
138629
+ return getDbClient2().transaction(async () => {
138630
+ const existing = await globalValue(INSTALL_ID_KEY);
138631
+ if (existing)
138632
+ return existing;
138633
+ const minted = `install_${crypto.randomUUID().replace(/-/g, "").slice(0, 16)}`;
138634
+ await upsertSwarmConfig2({ scope: "global", key: INSTALL_ID_KEY, value: minted });
138635
+ return minted;
138636
+ });
138637
+ }
138638
+ async function getImprovement(id) {
138639
+ const row = await getDbClient2().get("SELECT * FROM improvements WHERE id = ?", [
138640
+ id
138641
+ ]);
138642
+ return row ? toImprovement(row) : null;
138643
+ }
138644
+ async function listImprovements(historyLimit = 100) {
138645
+ const rows = await getDbClient2().query(`SELECT * FROM improvements WHERE status IN ('pending_approval', 'failed')
138646
+ UNION ALL
138647
+ SELECT * FROM (
138648
+ SELECT * FROM improvements WHERE status NOT IN ('pending_approval', 'failed')
138649
+ ORDER BY created_at DESC, id DESC LIMIT ?
138650
+ )
138651
+ ORDER BY created_at DESC, id DESC`, [historyLimit]);
138652
+ return rows.map(toImprovement);
138653
+ }
138654
+ async function createImprovement(input) {
138655
+ await assertEnabled();
138656
+ const trimmed = input.text.trim();
138657
+ const scrubbed = scrubSecrets(trimmed);
138658
+ if (scrubbed.length === 0 || scrubbed.length > IMPROVEMENT_TEXT_MAX) {
138659
+ throw new ImprovementError("invalid_text", `Text must be 1 to ${IMPROVEMENT_TEXT_MAX} characters after trimming.`);
138660
+ }
138661
+ const id = crypto.randomUUID();
138662
+ const now = new Date().toISOString();
138663
+ await getDbClient2().run(`INSERT INTO improvements
138664
+ (id, text, status, source, requested_by_agent_id, created_at, updated_at, created_by, updated_by)
138665
+ VALUES (?, ?, 'pending_approval', ?, ?, ?, ?, ?, ?)`, [
138666
+ id,
138667
+ scrubbed,
138668
+ input.source,
138669
+ input.requestedByAgentId ?? null,
138670
+ now,
138671
+ now,
138672
+ input.createdBy ?? null,
138673
+ input.createdBy ?? null
138674
+ ]);
138675
+ const improvement = await getImprovement(id);
138676
+ if (!improvement)
138677
+ throw new Error(`Improvement ${id} vanished after insert`);
138678
+ return { improvement, scrubChanged: scrubbed !== trimmed };
138679
+ }
138680
+ async function approveAndSend(id, approval) {
138681
+ await assertEnabled();
138682
+ if (!isValidImprovementEmail(approval.email)) {
138683
+ throw new ImprovementError("invalid_email", "A valid email is required to send.");
138684
+ }
138685
+ const email = approval.email.trim();
138686
+ const installId = await improvementInstallId();
138687
+ const approvedAt = new Date().toISOString();
138688
+ const claimed = await getDbClient2().transaction(async (tx) => {
138689
+ const result = await tx.run(`UPDATE improvements
138690
+ SET status = 'sending', approved_by = ?, approved_at = ?, email = ?,
138691
+ proxy_status = NULL, proxy_id = NULL, proxy_error = NULL,
138692
+ updated_at = ?, updated_by = ?
138693
+ WHERE id = ? AND status IN ('pending_approval', 'failed')`, [approval.approvedBy, approvedAt, email, approvedAt, approval.updatedBy ?? null, id]);
138694
+ if (result.changes === 1) {
138695
+ return tx.get("SELECT * FROM improvements WHERE id = ?", [id]);
138696
+ }
138697
+ return null;
138698
+ });
138699
+ if (!claimed) {
138700
+ const existing = await getImprovement(id);
138701
+ if (!existing)
138702
+ throw new ImprovementError("not_found", `Improvement ${id} not found.`);
138703
+ throw new ImprovementError("conflict", `Improvement ${id} is ${existing.status}; only pending or failed improvements can be approved.`);
138704
+ }
138705
+ const payload = buildImprovementPayload({
138706
+ installId,
138707
+ text: claimed.text,
138708
+ email
138709
+ });
138710
+ let proxyStatus = null;
138711
+ let proxyId = null;
138712
+ let proxyError = null;
138713
+ try {
138714
+ const response = await fetch(approval.endpoint, {
138715
+ method: "POST",
138716
+ headers: { "Content-Type": "application/json" },
138717
+ body: JSON.stringify(payload),
138718
+ signal: AbortSignal.timeout(SEND_TIMEOUT_MS)
138719
+ });
138720
+ proxyStatus = response.status;
138721
+ const body = await response.text().catch(() => "");
138722
+ if (response.ok) {
138723
+ try {
138724
+ const parsed = JSON.parse(body);
138725
+ proxyId = typeof parsed.id === "string" ? parsed.id : null;
138726
+ } catch {
138727
+ proxyId = null;
138728
+ }
138729
+ } else {
138730
+ proxyError = body || `HTTP ${response.status}`;
138731
+ }
138732
+ } catch (error) {
138733
+ proxyError = error instanceof Error ? error.message : String(error);
138734
+ }
138735
+ const sent = proxyStatus !== null && proxyStatus >= 200 && proxyStatus < 300;
138736
+ const finishedAt = new Date().toISOString();
138737
+ await getDbClient2().run(`UPDATE improvements
138738
+ SET status = ?, sent_at = ?, proxy_status = ?, proxy_id = ?, proxy_error = ?, updated_at = ?
138739
+ WHERE id = ?`, [
138740
+ sent ? "sent" : "failed",
138741
+ sent ? finishedAt : null,
138742
+ proxyStatus,
138743
+ proxyId,
138744
+ proxyError ? scrubSecrets(proxyError).slice(0, PROXY_ERROR_MAX) : null,
138745
+ finishedAt,
138746
+ id
138747
+ ]);
138748
+ const finished = await getImprovement(id);
138749
+ if (!finished)
138750
+ throw new Error(`Improvement ${id} vanished after send`);
138751
+ return finished;
138752
+ }
138753
+ async function discardImprovement(id, options) {
138754
+ await assertEnabled();
138755
+ const now = new Date().toISOString();
138756
+ const result = await getDbClient2().run(`UPDATE improvements SET status = 'discarded', updated_at = ?, updated_by = ?
138757
+ WHERE id = ? AND status IN ('pending_approval', 'failed')`, [now, options?.updatedBy ?? null, id]);
138758
+ const existing = await getImprovement(id);
138759
+ if (!existing)
138760
+ throw new ImprovementError("not_found", `Improvement ${id} not found.`);
138761
+ if (result.changes !== 1) {
138762
+ throw new ImprovementError("conflict", `Improvement ${id} is ${existing.status}; only pending or failed improvements can be discarded.`);
138763
+ }
138764
+ return existing;
138765
+ }
138766
+ function hostOf(value) {
138767
+ if (!value)
138768
+ return null;
138769
+ try {
138770
+ return new URL(value.includes("://") ? value : `https://${value}`).host || null;
138771
+ } catch {
138772
+ return null;
138773
+ }
138774
+ }
138775
+ async function improvementLeakHints(text) {
138776
+ const client = getDbClient2();
138777
+ const [agents, repos, users] = await Promise.all([
138778
+ client.query("SELECT name FROM agents"),
138779
+ client.query("SELECT name, url FROM swarm_repos"),
138780
+ client.query("SELECT email FROM users WHERE email IS NOT NULL")
138781
+ ]);
138782
+ const terms = new Set;
138783
+ const add = (value) => {
138784
+ const trimmed = value?.trim();
138785
+ if (trimmed && trimmed.length >= 3)
138786
+ terms.add(trimmed);
138787
+ };
138788
+ for (const agent of agents)
138789
+ add(agent.name);
138790
+ for (const repo of repos) {
138791
+ add(repo.name);
138792
+ add(repo.url);
138793
+ }
138794
+ for (const user of users)
138795
+ add(user.email);
138796
+ add(hostOf(process.env.MCP_BASE_URL));
138797
+ add(hostOf(process.env.APP_URL));
138798
+ const orgName = await globalValue("SWARM_ORG_NAME");
138799
+ const orgWebsite = await globalValue("SWARM_ORG_WEBSITE");
138800
+ add(orgName);
138801
+ add(orgWebsite);
138802
+ add(hostOf(orgWebsite));
138803
+ const hits = [];
138804
+ const seen = new Set;
138805
+ const push = (hit) => {
138806
+ const key = hit.toLowerCase();
138807
+ if (seen.has(key) || hits.length >= LEAK_HINTS_MAX)
138808
+ return;
138809
+ seen.add(key);
138810
+ hits.push(hit);
138811
+ };
138812
+ const lower = text.toLowerCase();
138813
+ for (const term of terms) {
138814
+ const at = lower.indexOf(term.toLowerCase());
138815
+ if (at >= 0)
138816
+ push(text.slice(at, at + term.length));
138817
+ }
138818
+ for (const match of text.matchAll(URL_RE))
138819
+ push(match[0]);
138820
+ for (const match of text.matchAll(EMAIL_RE))
138821
+ push(match[0]);
138822
+ return hits;
138823
+ }
138824
+ var IMPROVEMENTS_ENABLED_KEY = "IMPROVEMENTS_ENABLED", IMPROVEMENT_TEXT_MAX = 4000, SEND_TIMEOUT_MS = 1e4, PROXY_ERROR_MAX = 1024, LEAK_HINTS_MAX = 50, INSTALL_ID_KEY = "telemetry_installation_id", EMAIL_MAX = 320, VALID_EMAIL_RE, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, URL_RE, EMAIL_RE;
138825
+ var init_improvements = __esm(() => {
138826
+ init_env_flag();
138827
+ init_secret_scrubber();
138828
+ init_db4();
138829
+ VALID_EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
138830
+ IMPROVEMENT_STATUSES = [
138831
+ "pending_approval",
138832
+ "sending",
138833
+ "sent",
138834
+ "failed",
138835
+ "discarded"
138836
+ ];
138837
+ IMPROVEMENT_SOURCES = ["mcp", "api", "ui"];
138838
+ ImprovementError = class ImprovementError extends Error {
138839
+ code;
138840
+ constructor(code, message) {
138841
+ super(message);
138842
+ this.code = code;
138843
+ this.name = "ImprovementError";
138844
+ }
138845
+ };
138846
+ URL_RE = /\bhttps?:\/\/[^\s<>"')]+/gi;
138847
+ EMAIL_RE = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
138848
+ });
138849
+
138850
+ // src/tools/submit-improvement.ts
138851
+ var submitImprovementInputSchema, submitImprovementOutputSchema, registerSubmitImprovementTool = (server) => {
138852
+ createToolRegistrar(server)("submit-improvement", {
138853
+ title: "Draft a product improvement",
138854
+ description: "Draft a short product improvement for the agent-swarm team at desplega. It is stored as a pending draft and is never sent by this tool: a person must approve it from the Improvements button in the dashboard header. Only the text you write, the install id and the approver's email are sent.",
138855
+ annotations: { destructiveHint: false },
138856
+ inputSchema: submitImprovementInputSchema,
138857
+ outputSchema: submitImprovementOutputSchema
138858
+ }, async ({ text }, info) => {
138859
+ if (info.callOrigin === "script-sdk" || info.callOrigin === "extension") {
138860
+ return toolErr("Scripts and extensions cannot draft improvements.");
138861
+ }
138862
+ if (!info.agentId) {
138863
+ return toolErr('Agent ID not found. Set the "X-Agent-ID" header.');
138864
+ }
138865
+ const agent = await getAgentById2(info.agentId);
138866
+ const decision = can({
138867
+ principal: { kind: "agent", agentId: info.agentId, isLead: agent?.isLead ?? false },
138868
+ verb: "improvement.submit",
138869
+ source: "mcp"
138870
+ });
138871
+ if (!decision.allow)
138872
+ return toolErr(decision.reason);
138873
+ try {
138874
+ const { improvement } = await createImprovement({
138875
+ text,
138876
+ source: "mcp",
138877
+ requestedByAgentId: info.agentId
138878
+ });
138879
+ return toolOk(`Drafted improvement ${improvement.id}. A person must approve it from the Improvements button in the dashboard header before anything is sent.`, { data: { id: improvement.id, status: improvement.status } });
138880
+ } catch (error) {
138881
+ if (error instanceof ImprovementError)
138882
+ return toolErr(error.message);
138883
+ throw error;
138884
+ }
138885
+ });
138886
+ };
138887
+ var init_submit_improvement = __esm(() => {
138888
+ init_zod();
138889
+ init_db4();
138890
+ init_improvements();
138891
+ init_rbac();
138892
+ init_utils();
138893
+ submitImprovementInputSchema = object2({
138894
+ text: string2().min(1).max(IMPROVEMENT_TEXT_MAX).describe("The product improvement for desplega, in plain words. Do not include names, repos, hosts, customer details or secrets.")
138895
+ });
138896
+ submitImprovementOutputSchema = swarmToolOutputSchema({
138897
+ id: string2().optional(),
138898
+ status: string2().optional()
138899
+ });
138900
+ });
138901
+
138571
138902
  // src/tools/swarm-config/delete-config.ts
138572
138903
  var registerDeleteConfigTool = (server) => {
138573
138904
  createToolRegistrar(server)("delete-config", {
@@ -139031,7 +139362,7 @@ var init_swarm_x = __esm(() => {
139031
139362
  init_zod();
139032
139363
  init_composio();
139033
139364
  init_utils();
139034
- primitiveQueryValueSchema = union2([string2(), number2(), boolean()]);
139365
+ primitiveQueryValueSchema = union3([string2(), number2(), boolean()]);
139035
139366
  });
139036
139367
 
139037
139368
  // src/tools/system-one-decide.ts
@@ -139043,7 +139374,7 @@ var registerSystemOneDecideTool = (server) => {
139043
139374
  inputSchema: object2({
139044
139375
  provider: _enum2(SYSTEM_ONE_PROVIDER_IDS).optional().describe("Decision host (default: the SYSTEM_ONE_DEFAULT_PROVIDER global config, typesafe when unset)"),
139045
139376
  model: string2().min(1).optional().describe("Provider model id (default: the provider's)"),
139046
- state: union2([string2(), array2(string2()), record2(string2(), unknown())]).describe("The state to decide on"),
139377
+ state: union3([string2(), array2(string2()), record2(string2(), unknown())]).describe("The state to decide on"),
139047
139378
  questions: record2(string2(), record2(string2(), unknown())).describe("Questions by id, each `{ type: 'noul' | 'choice' | 'score', instructions, criteria }`"),
139048
139379
  timeoutMs: number2().int().optional().describe("Time budget for the call, retries included (default 30000)"),
139049
139380
  maxRetries: number2().int().optional().describe("Retries on transient failures inside the time budget (default 2)")
@@ -139218,7 +139549,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
139218
139549
  console.warn(`[budget-refusal-notify] Failed to create follow-up task for budget refusal (task=${ctx.task.id.slice(0, 8)}): ${err}`);
139219
139550
  }
139220
139551
  }
139221
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
139552
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
139222
139553
  workflowEventBus.emit("task.budget_refused", {
139223
139554
  taskId: ctx.task.id,
139224
139555
  agentId: ctx.agentId,
@@ -140737,7 +141068,7 @@ var registerPatchWorkflowTool = (server) => {
140737
141068
  type: string2(),
140738
141069
  config: record2(string2(), unknown()),
140739
141070
  label: string2().optional(),
140740
- next: union2([string2(), array2(string2()), record2(string2(), string2())]).optional(),
141071
+ next: union3([string2(), array2(string2()), record2(string2(), string2())]).optional(),
140741
141072
  inputs: record2(string2(), string2()).optional()
140742
141073
  })).optional().describe("New nodes to add"),
140743
141074
  onNodeFailure: _enum2(["fail", "continue"]).optional().describe("Update onNodeFailure behavior"),
@@ -141352,6 +141683,7 @@ async function createServer(opts = {}) {
141352
141683
  registerStoreProgressTool(server);
141353
141684
  registerMyAgentInfoTool(server);
141354
141685
  registerCancelTaskTool(server);
141686
+ registerSubmitImprovementTool(server);
141355
141687
  registerResolveUserTool(server);
141356
141688
  registerManageUserTool(server);
141357
141689
  registerDbQueryTool(server);
@@ -141671,6 +142003,7 @@ var init_server = __esm(() => {
141671
142003
  init_slack_upload_file();
141672
142004
  init_steer_task();
141673
142005
  init_store_progress();
142006
+ init_submit_improvement();
141674
142007
  init_swarm_config2();
141675
142008
  init_swarm_x();
141676
142009
  init_system_one_decide();
@@ -141728,4 +142061,4 @@ var init_server = __esm(() => {
141728
142061
  loggedToolAllowlistWarnings = new Set;
141729
142062
  });
141730
142063
 
141731
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, taskModelPin, resumedTaskModelSelection, init_model_pin, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation2, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
142064
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, taskModelPin, resumedTaskModelSelection, init_model_pin, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation2, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };