@desplega.ai/agent-swarm 2.14.0 → 2.14.2

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 (411) hide show
  1. package/dist/acp-adapter-q1vz4hh2.js +17 -0
  2. package/dist/{acp-targets-23exz4z4.js → acp-targets-d44eerh4.js} +10 -10
  3. package/dist/{actions-zcr25x27.js → actions-z4k4bvss.js} +28 -28
  4. package/dist/{agent-fs-provision-7fa9e12e.js → agent-fs-provision-aan1cgpx.js} +4 -4
  5. package/dist/{amp-adapter-s7ytmv6b.js → amp-adapter-wac3py0p.js} +3 -3
  6. package/dist/{anthropic-messages-vdd1zmha.js → anthropic-messages-njt2r5m4.js} +28 -27
  7. package/dist/{app-5d3sz1hy.js → app-wax6qz5e.js} +10 -10
  8. package/dist/{approval-notifications-7qgkzkzx.js → approval-notifications-6fvkhnma.js} +11 -11
  9. package/dist/{assistant-p2yvhc3j.js → assistant-e8fe08zx.js} +29 -29
  10. package/dist/{azure-openai-responses-jeaas6x0.js → azure-openai-responses-6ewf9rwp.js} +6 -6
  11. package/dist/{boot-args-schema-ry6cb0p7.js → boot-args-schema-rv97cmnt.js} +1 -1
  12. package/dist/{boot-reembed-c9643ms3.js → boot-reembed-bcn7frk9.js} +1 -1
  13. package/dist/{boot-reembed-2hkm3vz2.js → boot-reembed-xakrdy6y.js} +1 -1
  14. package/dist/{boot-scrub-sweep-3ycxr51t.js → boot-scrub-sweep-20t8akhf.js} +2 -2
  15. package/dist/{boot-seeds-2hzvvzg0.js → boot-seeds-48rr6r29.js} +4 -4
  16. package/dist/{boxd-9py3x0jb.js → boxd-tjpxwecx.js} +3 -3
  17. package/dist/{claude-adapter-dnkww93e.js → claude-adapter-0wzwntrj.js} +12 -13
  18. package/dist/{claude-managed-adapter-yk0cr5x6.js → claude-managed-adapter-4xcgt46w.js} +4 -4
  19. package/dist/{claude-managed-setup-4byxpp47.js → claude-managed-setup-91cyktw7.js} +7 -7
  20. package/dist/{claude-sdk-session-4wf3dbvs.js → claude-sdk-session-ngj4dce5.js} +11144 -12464
  21. package/dist/{cli-gcyws2bp.js → cli-021hrewp.js} +2 -2
  22. package/dist/{cli-wvgg7r4j.js → cli-08gfvs58.js} +2 -2
  23. package/dist/{cli-2zjxake1.js → cli-0kyjrbaa.js} +4 -4
  24. package/dist/{cli-rp1n2xpd.js → cli-0nvqg1hb.js} +1 -1
  25. package/dist/{cli-vxmmttmt.js → cli-0nz04gqv.js} +50 -50
  26. package/dist/{cli-vr4eyq6p.js → cli-0rrft7s3.js} +538 -410
  27. package/dist/{cli-mw1tmn3x.js → cli-1d9q7qrn.js} +7 -7
  28. package/dist/{cli-84xn7bgz.js → cli-1t5vhrpv.js} +1 -1
  29. package/dist/{cli-hzhv7yac.js → cli-1zbj28py.js} +1 -1
  30. package/dist/{cli-z8t4485r.js → cli-2ja7eadd.js} +2 -2
  31. package/dist/{cli-r04ve9xw.js → cli-2r62jy9s.js} +1 -1
  32. package/dist/{cli-9fwznq4p.js → cli-3ffzr65w.js} +7 -7
  33. package/dist/{cli-2ckwgs7q.js → cli-3kdgm393.js} +5 -5
  34. package/dist/{cli-jwnac23b.js → cli-3vc518cw.js} +1 -1
  35. package/dist/{cli-6p8p2e6r.js → cli-5188hq0a.js} +1286 -31
  36. package/dist/{cli-zcghfsdg.js → cli-53gt8wfv.js} +1 -1
  37. package/dist/{cli-930zbczq.js → cli-5njmmmer.js} +3 -3
  38. package/dist/{cli-dw9rtjm3.js → cli-5rw7nt99.js} +3061 -727
  39. package/dist/{cli-6c61yjwy.js → cli-5xx353cy.js} +7554 -1534
  40. package/dist/{cli-2ap1the6.js → cli-65k149j5.js} +2 -2
  41. package/dist/{cli-v41kn3cd.js → cli-6prwz0zn.js} +4427 -5566
  42. package/dist/{cli-yd7e590v.js → cli-6zpn5hmp.js} +12 -12
  43. package/dist/{cli-ty3gha1p.js → cli-7b9bwrfg.js} +2 -2
  44. package/dist/{cli-2414h5r9.js → cli-7dpdq7yh.js} +11428 -1914
  45. package/dist/{cli-r9d2tya0.js → cli-7qkbab03.js} +5 -5
  46. package/dist/{cli-7ca8hczj.js → cli-7svwhw1a.js} +1 -1
  47. package/dist/cli-7wwewkf4.js +37 -0
  48. package/dist/{cli-ejnhs815.js → cli-83hynhes.js} +17 -13
  49. package/dist/{cli-rs1rzwp4.js → cli-8crn0510.js} +1 -1
  50. package/dist/{cli-f2rwt43y.js → cli-8ee7xt75.js} +13 -13
  51. package/dist/{cli-9j47sgzy.js → cli-8ef94zm2.js} +2 -2
  52. package/dist/{cli-9fvk9mv8.js → cli-8gr1bg9t.js} +1 -1
  53. package/dist/{cli-b0m3bg0f.js → cli-9j1qcs0b.js} +1 -1
  54. package/dist/{cli-ad00h1st.js → cli-9mvfvggt.js} +7 -7
  55. package/dist/{cli-xh5fpmg8.js → cli-9txap41q.js} +101 -18
  56. package/dist/{cli-24wervhz.js → cli-aktk3qt6.js} +3 -3
  57. package/dist/{cli-6ajyhxh7.js → cli-an8bpy60.js} +2 -2
  58. package/dist/{cli-meydjstb.js → cli-azptj8xe.js} +5591 -69
  59. package/dist/cli-c0rt16vk.js +15 -0
  60. package/dist/{cli-w4bvtxet.js → cli-c6vhcknq.js} +7 -7
  61. package/dist/{cli-2savn6mm.js → cli-cczffwak.js} +7 -7
  62. package/dist/{cli-ze1ndjs4.js → cli-cgmka83w.js} +3 -3
  63. package/dist/{cli-kc7vd07m.js → cli-d13qgcct.js} +3699 -1733
  64. package/dist/{cli-k3facve0.js → cli-d5nvy1jy.js} +1 -1
  65. package/dist/{cli-edxfzgah.js → cli-dev6f0px.js} +4 -4
  66. package/dist/{cli-0e914dp9.js → cli-dzhht0vq.js} +3 -3
  67. package/dist/{cli-m0ea8ggd.js → cli-e13kbyq0.js} +2 -2
  68. package/dist/{cli-73rmgm45.js → cli-e2k0ej0d.js} +2 -2
  69. package/dist/cli-ek8b88kv.js +9740 -0
  70. package/dist/{cli-0k7ppk9k.js → cli-ertcjw6z.js} +281 -46
  71. package/dist/{cli-qrwjk4xy.js → cli-f3ta4e67.js} +5 -5
  72. package/dist/{cli-1nfabrt4.js → cli-f4xv7s0t.js} +7 -7
  73. package/dist/{cli-phe2vcw5.js → cli-fdam1t9b.js} +171 -104
  74. package/dist/{cli-gc6b94tj.js → cli-fe8he9cy.js} +2 -2
  75. package/dist/{cli-spfz393q.js → cli-feh37wgs.js} +598 -219
  76. package/dist/{cli-ebqx630g.js → cli-fjzjtqna.js} +35 -18
  77. package/dist/{cli-37p61fcg.js → cli-fs9t2m2k.js} +18 -20
  78. package/dist/{cli-7w1fs01q.js → cli-g03x26q6.js} +2 -2
  79. package/dist/{cli-879txsac.js → cli-gnkzh8ed.js} +4 -4
  80. package/dist/{cli-v4z5v3jd.js → cli-gy0r7gb8.js} +514 -337
  81. package/dist/{cli-s4pccby1.js → cli-h0edykd1.js} +1 -1
  82. package/dist/{cli-pq0kv31y.js → cli-h364asjc.js} +9 -9
  83. package/dist/{cli-69szn7w7.js → cli-h3xcfp4c.js} +93 -54
  84. package/dist/{cli-jcnc5ret.js → cli-h8k5801a.js} +73 -27
  85. package/dist/{cli-6yy4fepf.js → cli-h96yp7xv.js} +4 -4
  86. package/dist/{cli-q5n3deaf.js → cli-hab0bvrh.js} +1 -1
  87. package/dist/{cli-g6a696c0.js → cli-j3wqt73b.js} +4 -4
  88. package/dist/{cli-wym6rxgt.js → cli-jfgaz10x.js} +10 -15
  89. package/dist/{cli-shyhb4t5.js → cli-jrhvywah.js} +53 -52
  90. package/dist/{cli-qkbevqer.js → cli-jrxt5j0n.js} +3 -3
  91. package/dist/{cli-7b7rxz22.js → cli-jw7n9pct.js} +5 -2
  92. package/dist/{cli-8vbxjzk0.js → cli-k9kfck3s.js} +3 -3
  93. package/dist/{cli-yjb3cddd.js → cli-kkwq5b12.js} +1 -1
  94. package/dist/{cli-39t9d248.js → cli-kz8rar0g.js} +1 -1
  95. package/dist/{cli-rzbsh6bw.js → cli-n15fhd43.js} +1 -1
  96. package/dist/{cli-1jx0srjt.js → cli-nc842kc9.js} +1921 -80
  97. package/dist/{cli-9j1t3kf6.js → cli-nmj4phcg.js} +2 -2
  98. package/dist/{cli-t9pzz2eq.js → cli-ntmjzyte.js} +4 -1
  99. package/dist/{cli-adzmmcvf.js → cli-praaw1wh.js} +2 -2
  100. package/dist/{cli-f9g96z28.js → cli-q44p4869.js} +11 -11
  101. package/dist/{cli-fww016hh.js → cli-q58qt9dw.js} +1711 -7287
  102. package/dist/{cli-njvpngc6.js → cli-qqz5z36e.js} +3 -3
  103. package/dist/{cli-096aftq6.js → cli-r7rpy2xz.js} +7 -7
  104. package/dist/cli-rcqgr0hs.js +30 -0
  105. package/dist/{cli-ph95yejc.js → cli-rjc464jg.js} +2 -2
  106. package/dist/{cli-md4tn21h.js → cli-rw3m83j4.js} +40 -26
  107. package/dist/cli-rwcj6wt3.js +1291 -0
  108. package/dist/{cli-srq69pn1.js → cli-ryn4y478.js} +1 -1
  109. package/dist/{cli-jgq9xptq.js → cli-s48k2rzx.js} +4 -4
  110. package/dist/{cli-cbg0j1yt.js → cli-s90wcbk9.js} +3 -3
  111. package/dist/{cli-2ayk9gn8.js → cli-svcy72s5.js} +2 -2
  112. package/dist/{cli-4dyzzkfb.js → cli-swtwbg85.js} +944 -170
  113. package/dist/{cli-mv8ft7b0.js → cli-t1bqpzgz.js} +3 -3
  114. package/dist/{cli-tc165vrb.js → cli-t5jbjq61.js} +4 -3
  115. package/dist/{cli-enavhq6r.js → cli-tbrjvrrg.js} +1 -1
  116. package/dist/{cli-mz7ycqn8.js → cli-td2h8zej.js} +6 -6
  117. package/dist/{cli-9t7syepg.js → cli-ttatvwn6.js} +1 -1
  118. package/dist/{cli-ayxxkk3p.js → cli-txxcf9s1.js} +8 -8
  119. package/dist/{cli-q4z9s6zs.js → cli-v7az4d1g.js} +2 -2
  120. package/dist/cli-vqt44168.js +14 -0
  121. package/dist/{cli-q457ga28.js → cli-vs9h3vw2.js} +14 -14
  122. package/dist/{cli-snxhtehz.js → cli-w2fg8kjc.js} +7 -8
  123. package/dist/{cli-wd7b5hgc.js → cli-w81s97bn.js} +1 -1
  124. package/dist/{cli-bqfx72e6.js → cli-wkzrknpt.js} +1 -1
  125. package/dist/{cli-cg1q8ymp.js → cli-wqpvfq2m.js} +1 -1
  126. package/dist/{cli-kg63yp1r.js → cli-wz7qj1jy.js} +19 -19
  127. package/dist/{cli-3wsabyt0.js → cli-x5t54ytt.js} +2 -2
  128. package/dist/{cli-r495stwd.js → cli-xd6ntv7x.js} +2 -2
  129. package/dist/{cli-wvbaq052.js → cli-xphbv66z.js} +10 -3
  130. package/dist/{cli-a49frv85.js → cli-xxgqn93n.js} +3753 -1186
  131. package/dist/{cli-91amj3md.js → cli-z209g721.js} +111 -87
  132. package/dist/{cli-3mhdmcd4.js → cli-z5andw8k.js} +1 -1
  133. package/dist/{cli-7g5qj2ca.js → cli-zcb64xzv.js} +1 -1
  134. package/dist/{cli-0h6m6z5g.js → cli-zr2sc5tr.js} +1 -1
  135. package/dist/{cli-krk8y8c7.js → cli-zrm0610v.js} +1833 -518
  136. package/dist/cli.js +73 -73
  137. package/dist/{cloudflare-workers-ai-system-one-w3m0fbf8.js → cloudflare-workers-ai-system-one-kb0tq22h.js} +2 -2
  138. package/dist/{codex-adapter-eq61radw.js → codex-adapter-0c1ynrmt.js} +9 -9
  139. package/dist/{codex-hook-8nmepvz6.js → codex-hook-w5nmtrn2.js} +2 -2
  140. package/dist/{codex-login-vbd9707w.js → codex-login-67qarfcg.js} +1 -1
  141. package/dist/{codex-session-runner-rfx355h4.js → codex-session-runner-z4t9z7yy.js} +10 -10
  142. package/dist/{commands-d1z0sx62.js → commands-h0jxqdhk.js} +3 -3
  143. package/dist/{controller-9hz6d8x3.js → controller-4ygy66hv.js} +4 -4
  144. package/dist/{controllers-connect-tz07d2xr.js → controllers-connect-ynbvv8pv.js} +28 -28
  145. package/dist/core-mj9fzrcm.js +41 -0
  146. package/dist/{cursor-adapter-ef22ze3j.js → cursor-adapter-9e4d6658.js} +2 -2
  147. package/dist/{db-gd81d68c.js → db-bg0hxjq1.js} +3 -3
  148. package/dist/{db-vrckks6q.js → db-q12gmpns.js} +2 -2
  149. package/dist/{devin-adapter-kdt6a2bh.js → devin-adapter-tn1twrha.js} +1 -1
  150. package/dist/{devtools-qxfgbsqz.js → devtools-t8my9az6.js} +1 -1
  151. package/dist/{dispatcher-76as8w2t.js → dispatcher-v5dbfscq.js} +24 -24
  152. package/dist/{docker-51ta7jsh.js → docker-6007r2fj.js} +2 -2
  153. package/dist/{dsh-adapter-ypfvcdyz.js → dsh-adapter-z3fneea1.js} +2 -2
  154. package/dist/{e2b-05kn3kpq.js → e2b-k3kb8b52.js} +4 -4
  155. package/dist/{e2b-dm9r8hpy.js → e2b-p269awh6.js} +5 -5
  156. package/dist/{easter-egg-3d-sg21j15g.js → easter-egg-3d-y49v5z90.js} +1 -1
  157. package/dist/{embedding-space-zsdw37bb.js → embedding-space-mjt5ksq0.js} +5 -5
  158. package/dist/{embeddings-p4e3e1m6.js → embeddings-td9hgnc5.js} +1 -1
  159. package/dist/emscripten-module-Q67P5WYC-3sde6cre.js +2458 -0
  160. package/dist/{event-bus-tvf2grf4.js → event-bus-pawddp92.js} +1 -1
  161. package/dist/{execute-nztd0af0.js → execute-z8nc8bba.js} +1 -1
  162. package/dist/{external-channel-717yzn4d.js → external-channel-pjenc2ag.js} +2 -2
  163. package/dist/ffi-cbfmmtqk.js +85 -0
  164. package/dist/fx-adapter-pjeztp0n.js +20 -0
  165. package/dist/getMachineId-bsd-hjs2tbdp.js +36 -0
  166. package/dist/getMachineId-darwin-kzbvr8s3.js +40 -0
  167. package/dist/getMachineId-linux-embmcq2c.js +26 -0
  168. package/dist/getMachineId-unsupported-jvznc6d4.js +20 -0
  169. package/dist/getMachineId-win-qr8z0b13.js +36 -0
  170. package/dist/{google-generative-ai-sw77egmr.js → google-generative-ai-tf3w7557.js} +11 -16
  171. package/dist/{google-vertex-rrw93g8h.js → google-vertex-9pj87bd8.js} +15 -17
  172. package/dist/grok-adapter-davbhx8t.js +20 -0
  173. package/dist/handlers-rf130hnp.js +39 -0
  174. package/dist/heartbeat-9hmvqxk0.js +49 -0
  175. package/dist/hook-0b1jqs2t.js +21 -0
  176. package/dist/{hook-ctz0xmp3.js → hook-1n0sjv8p.js} +10 -11
  177. package/dist/{http-zregegrx.js → http-vykejyjx.js} +432 -170
  178. package/dist/{index-7dgxveck.js → index-07d66kdm.js} +3 -3
  179. package/dist/index-0hgjxqz8.js +10584 -0
  180. package/dist/{index-rz8ve510.js → index-0nt39qwy.js} +2 -2
  181. package/dist/{index-ym9fgxad.js → index-2xbxq71g.js} +2 -2
  182. package/dist/{index-42jq9yy3.js → index-3j8hffkb.js} +12327 -7450
  183. package/dist/index-8w09aggw.js +43 -0
  184. package/dist/{index-5kx15d19.js → index-b3wy4jzs.js} +1 -1
  185. package/dist/{index-kzdqn3dd.js → index-dt9vr7tb.js} +3143 -760
  186. package/dist/{index-maddg9ys.js → index-ezfas4jj.js} +5858 -15337
  187. package/dist/index-g2jntx15.js +38 -0
  188. package/dist/{index-x9qf8dg7.js → index-j6sqtb83.js} +105 -75
  189. package/dist/{index-m6g8q65g.js → index-na0tczq0.js} +9268 -10220
  190. package/dist/{index-whysn1wf.js → index-p9dkwhwe.js} +1 -1
  191. package/dist/{index-126v2d0t.js → index-pe2etczf.js} +6 -2918
  192. package/dist/{index-mtnbhe12.js → index-q60mhcpd.js} +23631 -19921
  193. package/dist/index-qffex5k4.js +41 -0
  194. package/dist/index-qrp11tp9.js +4 -0
  195. package/dist/{index-kdmkfjt7.js → index-ryyrg0d8.js} +3426 -2333
  196. package/dist/{index-t17p395x.js → index-sf06w57a.js} +13 -13
  197. package/dist/{index-evay0xyk.js → index-vybnwd5v.js} +1 -1
  198. package/dist/{index-fdym6ryb.js → index-wsf1f5pe.js} +28 -28
  199. package/dist/{k8s-ejkk0aw7.js → k8s-mr1r12th.js} +2 -2
  200. package/dist/{keepalive-zdqay870.js → keepalive-86z0tzzf.js} +4 -4
  201. package/dist/lead-edmwagkn.js +81 -0
  202. package/dist/{llama-cpp-classify-yvb8vh7w.js → llama-cpp-classify-wd7htn1x.js} +2 -2
  203. package/dist/{maintenance-t5ndg11m.js → maintenance-19h6tfwz.js} +1 -1
  204. package/dist/{mistral-conversations-w4bncwbt.js → mistral-conversations-txjmc64f.js} +7 -7
  205. package/dist/module-ES6BEMUI-44w9s1dx.js +1210 -0
  206. package/dist/{multipart-parser-xevcstye.js → multipart-parser-xqbgwrav.js} +1 -1
  207. package/dist/{node-0as4n1ef.js → node-q4628t0b.js} +1 -1
  208. package/dist/{oauth-refresh-sweep-y9zyd7t6.js → oauth-refresh-sweep-6nmyrv32.js} +3 -3
  209. package/dist/{object-webhooks-mkca91s0.js → object-webhooks-2kynmdf8.js} +7 -7
  210. package/dist/{onboard-ss995244.js → onboard-zbpm96mn.js} +7 -7
  211. package/dist/{openai-codex-responses-70g39cgz.js → openai-codex-responses-6ckhys6r.js} +35 -29
  212. package/dist/{openai-completions-cv3hp4h5.js → openai-completions-c9dsq9jh.js} +15 -15
  213. package/dist/{openai-decisions-fyq1p9f9.js → openai-decisions-9vzvv10c.js} +2 -2
  214. package/dist/{openai-responses-trsvnks6.js → openai-responses-bhfmt9sa.js} +6 -6
  215. package/dist/{opencode-adapter-mwpz0278.js → opencode-adapter-fyqcbdra.js} +8 -8
  216. package/dist/{openrouter-images-0jj12a2q.js → openrouter-images-hkk5p580.js} +3 -3
  217. package/dist/otel-impl-txa20w1h.js +11178 -0
  218. package/dist/{pending-2sxh1t6j.js → pending-4rxawq8y.js} +25 -25
  219. package/dist/{pi-messages-zk3g4esn.js → pi-messages-py3f96p7.js} +5 -5
  220. package/dist/{pi-mono-adapter-sfb7zy43.js → pi-mono-adapter-rnsed1xa.js} +24 -27
  221. package/dist/{pricing-refresh-h79bg4cf.js → pricing-refresh-4314hwtw.js} +2 -2
  222. package/dist/{rbac-roles-ckq0czp4.js → rbac-roles-fztcm8ky.js} +2 -2
  223. package/dist/{rbac-roles-jg2e260w.js → rbac-roles-msqt7a3k.js} +3 -3
  224. package/dist/{render-v2-ymbshmn0.js → render-v2-w49wtecg.js} +10 -10
  225. package/dist/{resume-jdhnt4jk.js → resume-gwgtp4m3.js} +13 -13
  226. package/dist/{runtime-y28jhhnf.js → runtime-kkebz8yq.js} +1 -1
  227. package/dist/{session-access-k4ta5hvp.js → session-access-kjb19m2w.js} +5 -5
  228. package/dist/{session-source-backfill-528j4s8j.js → session-source-backfill-805p4wqr.js} +3 -3
  229. package/dist/{setup-d6pj82fr.js → setup-q8y168c8.js} +3 -3
  230. package/dist/thread-buffer-yqbffd0t.js +40 -0
  231. package/dist/{token-util-pjgekqxr.js → token-util-hnzceyn9.js} +1 -1
  232. package/dist/{token-pgr2w4s3.js → token-xnc02n6w.js} +21 -14
  233. package/dist/{tree-visibility-kjxv3nxk.js → tree-visibility-qj323994.js} +2 -2
  234. package/dist/{typesafe-system-one-qkvkgrcz.js → typesafe-system-one-avrdb4zm.js} +2 -2
  235. package/dist/{user-merge-jobs-rabbncf6.js → user-merge-jobs-qfp40f2s.js} +3 -3
  236. package/dist/{virtual-modules-22k51txd.js → virtual-modules-nzxegw0a.js} +7 -7
  237. package/dist/{work-objects-xtjbar3r.js → work-objects-hs089w60.js} +26 -26
  238. package/dist/{worker-follow-up-fg48vk6d.js → worker-follow-up-zwgg20sr.js} +24 -24
  239. package/dist/worker-kg4g7rnx.js +81 -0
  240. package/dist/{x-vfsqypht.js → x-k29vmskt.js} +2 -2
  241. package/openapi.json +59 -3
  242. package/package.json +53 -52
  243. package/plugin/commands/create-pr.md +5 -2
  244. package/plugin/pi-skills/create-pr/SKILL.md +5 -2
  245. package/src/apps/sync.ts +7 -2
  246. package/src/be/db/model-profiles.ts +103 -12
  247. package/src/be/db/tasks/read.ts +5 -0
  248. package/src/be/db/workflow-runs.ts +12 -8
  249. package/src/be/db.ts +18 -5
  250. package/src/be/migrations/367_workflow_run_principal.sql +5 -0
  251. package/src/be/model-group-resolution.ts +134 -0
  252. package/src/be/model-tier-resolution.ts +120 -17
  253. package/src/be/model-validation.ts +9 -1
  254. package/src/be/runtime-pools/routing.ts +22 -8
  255. package/src/be/scripts/extract-schema.ts +7 -0
  256. package/src/be/swarm-config-guard.ts +20 -7
  257. package/src/be/task-auto-title-listener.ts +2 -2
  258. package/src/commands/onboard/agent-fs-version.ts +1 -1
  259. package/src/extensions/contract-types.generated.ts +1 -1
  260. package/src/extensions/post-bridge.ts +27 -28
  261. package/src/http/active-sessions.ts +7 -0
  262. package/src/http/agents.ts +7 -0
  263. package/src/http/api-keys.ts +7 -0
  264. package/src/http/approval-requests.ts +4 -0
  265. package/src/http/budgets.ts +2 -0
  266. package/src/http/codex-oauth-keep-warm.ts +6 -2
  267. package/src/http/config.ts +1 -0
  268. package/src/http/context.ts +4 -0
  269. package/src/http/db-query.ts +11 -2
  270. package/src/http/events.ts +2 -0
  271. package/src/http/fs.ts +1 -0
  272. package/src/http/integrations.ts +4 -0
  273. package/src/http/mcp-bridge.ts +1 -0
  274. package/src/http/memory.ts +3 -0
  275. package/src/http/metrics.ts +16 -0
  276. package/src/http/oauth-locks.ts +8 -0
  277. package/src/http/operator-actor.ts +3 -8
  278. package/src/http/page-proxy.ts +16 -0
  279. package/src/http/pages.ts +9 -0
  280. package/src/http/poll.ts +21 -1
  281. package/src/http/pricing.ts +2 -0
  282. package/src/http/prompt-templates.ts +34 -0
  283. package/src/http/repos.ts +3 -1
  284. package/src/http/schedules.ts +33 -3
  285. package/src/http/script-runs.ts +24 -0
  286. package/src/http/scripts.ts +1 -0
  287. package/src/http/session-data.ts +2 -0
  288. package/src/http/status.ts +1 -0
  289. package/src/http/tasks.ts +28 -1
  290. package/src/http/trackers/jira.ts +2 -0
  291. package/src/http/trackers/linear.ts +4 -0
  292. package/src/http/users.ts +18 -0
  293. package/src/http/webhooks.ts +12 -0
  294. package/src/http/workflow-events.ts +26 -6
  295. package/src/http/workflows.ts +40 -0
  296. package/src/http/x.ts +4 -0
  297. package/src/linear/app.ts +3 -2
  298. package/src/linear/client.ts +5 -1
  299. package/src/linear/host.ts +40 -0
  300. package/src/linear/oauth.ts +3 -2
  301. package/src/linear/sync.ts +4 -3
  302. package/src/otel-impl.ts +8 -5
  303. package/src/prompts/base-prompt.ts +10 -6
  304. package/src/prompts/session-templates.ts +3 -3
  305. package/src/providers/acp-targets.ts +1 -1
  306. package/src/providers/amp-adapter.ts +11 -9
  307. package/src/providers/cursor-adapter.ts +1 -1
  308. package/src/rbac/legacy-policy.ts +2 -0
  309. package/src/rbac/permissions.ts +5 -0
  310. package/src/realtime/browser.generated.txt +1 -1
  311. package/src/scheduler/schedule-task.ts +1 -0
  312. package/src/scripts-runtime/quickjs-compat.ts +44 -10
  313. package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
  314. package/src/slack/config.ts +4 -0
  315. package/src/slack/render-v2.ts +52 -24
  316. package/src/slack/responses.ts +2 -1
  317. package/src/slack/reviewed-deliverables.ts +251 -0
  318. package/src/tasks/follow-up-gate.ts +142 -38
  319. package/src/tasks/worker-follow-up.ts +126 -37
  320. package/src/tests/amp-adapter.test.ts +57 -9
  321. package/src/tests/base-prompt.test.ts +36 -2
  322. package/src/tests/check-pr-body.test.ts +408 -93
  323. package/src/tests/compose-dev-object-store.test.ts +13 -0
  324. package/src/tests/compose-example-object-store.test.ts +67 -0
  325. package/src/tests/db-query.test.ts +8 -4
  326. package/src/tests/db-retention-defaults.test.ts +28 -3
  327. package/src/tests/e2b-dispatch.test.ts +7 -1
  328. package/src/tests/entrypoint-repo-autoclone-args.test.ts +10 -0
  329. package/src/tests/follow-up-gate-shadow.test.ts +268 -10
  330. package/src/tests/linear-outbound-sync.test.ts +59 -25
  331. package/src/tests/operator-actor-keyless.test.ts +103 -0
  332. package/src/tests/otel-event-loop-and-logs.test.ts +1 -1
  333. package/src/tests/profile-tier-alias.test.ts +9 -3
  334. package/src/tests/quickjs-compat.test.ts +40 -4
  335. package/src/tests/rbac-route-verbs-e2e.test.ts +142 -0
  336. package/src/tests/runner-repo-clone-args.test.ts +15 -6
  337. package/src/tests/script-connections.test.ts +2 -0
  338. package/src/tests/slack-render-v2.test.ts +52 -8
  339. package/src/tests/workflow-definition-pinning.test.ts +2 -0
  340. package/src/tests/workflow-hitl-routing.test.ts +67 -5
  341. package/src/tests/workflow-replay.test.ts +13 -1
  342. package/src/tests/workflow-system-one-extraction.test.ts +21 -0
  343. package/src/tests/workflow-wait-filter.test.ts +7 -7
  344. package/src/tests/worktree-reaper.test.ts +15 -4
  345. package/src/tests/x402-client.test.ts +82 -0
  346. package/src/tools/memory-rate.ts +2 -2
  347. package/src/tools/prompt-templates/delete.ts +22 -1
  348. package/src/tools/prompt-templates/set.ts +15 -1
  349. package/src/tools/schedules/create-schedule.ts +20 -3
  350. package/src/tools/schedules/patch-schedule.ts +30 -4
  351. package/src/tools/schedules/update-schedule.ts +30 -4
  352. package/src/tools/send-task.ts +17 -3
  353. package/src/tools/slack-post.ts +7 -2
  354. package/src/tools/slack-reply.ts +6 -2
  355. package/src/tools/task-action.ts +16 -3
  356. package/src/tools/utils.ts +1 -1
  357. package/src/types.ts +10 -0
  358. package/src/utils/amp-models.ts +20 -4
  359. package/src/utils/constants.ts +5 -4
  360. package/src/utils/secret-scrubber.ts +6 -4
  361. package/src/utils/task-citations.ts +11 -0
  362. package/src/workflows/engine.ts +41 -8
  363. package/src/workflows/executors/agent-task.ts +13 -2
  364. package/src/workflows/executors/code-match.ts +11 -31
  365. package/src/workflows/executors/script.ts +13 -0
  366. package/src/workflows/executors/sub-workflow.ts +5 -7
  367. package/src/workflows/executors/swarm-script.ts +4 -5
  368. package/src/workflows/executors/system-one-extraction.ts +9 -6
  369. package/src/workflows/executors/wait.ts +1 -1
  370. package/src/workflows/foreach-driver.ts +5 -1
  371. package/src/workflows/model-validation.ts +13 -1
  372. package/src/workflows/predicate-sandbox.ts +171 -0
  373. package/src/workflows/resume.ts +21 -4
  374. package/src/workflows/retry-poller.ts +1 -1
  375. package/src/workflows/run-principal.ts +51 -0
  376. package/src/workflows/wait-filter.ts +14 -192
  377. package/src/x402/client.ts +38 -17
  378. package/templates/skills/code-quality/content.md +1 -1
  379. package/templates/skills/heartbeat-runbook/content.md +1 -0
  380. package/templates/skills/pages/content.md +36 -12
  381. package/templates/skills/slack-interaction/content.md +4 -0
  382. package/templates/skills/swarm-docs/content.md +47 -41
  383. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  384. package/templates/skills/swarm-scripts/content.md +1 -1
  385. package/dist/acp-adapter-99n6z9ky.js +0 -17
  386. package/dist/cli-5ss6qqt9.js +0 -45
  387. package/dist/cli-dzzh58sy.js +0 -6996
  388. package/dist/cli-e8trbfx1.js +0 -15
  389. package/dist/cli-j9ccfveb.js +0 -1849
  390. package/dist/cli-mna6pmfx.js +0 -1485
  391. package/dist/cli-r8ddn0hf.js +0 -25583
  392. package/dist/core-dynsv289.js +0 -41
  393. package/dist/fx-adapter-9k0hptnz.js +0 -20
  394. package/dist/getMachineId-bsd-637a7rbk.js +0 -36
  395. package/dist/getMachineId-darwin-9vytrcnn.js +0 -36
  396. package/dist/getMachineId-linux-mkzsvyyz.js +0 -29
  397. package/dist/getMachineId-unsupported-4cfs2n11.js +0 -19
  398. package/dist/getMachineId-win-154s3qma.js +0 -38
  399. package/dist/grok-adapter-skdj2pce.js +0 -20
  400. package/dist/handlers-5btjqkz6.js +0 -39
  401. package/dist/heartbeat-vfb1gy84.js +0 -49
  402. package/dist/hook-eh52p7yd.js +0 -22
  403. package/dist/index-7w8p6em0.js +0 -41
  404. package/dist/index-t56y945n.js +0 -4
  405. package/dist/index-vfemrwwk.js +0 -10002
  406. package/dist/index-vz4semsx.js +0 -38
  407. package/dist/index-y3s0xp2v.js +0 -43
  408. package/dist/lead-6cscw8a5.js +0 -82
  409. package/dist/otel-impl-6n6vva3x.js +0 -28205
  410. package/dist/thread-buffer-9w6x5zec.js +0 -40
  411. package/dist/worker-g4aj93dt.js +0 -82
@@ -11,6 +11,7 @@ import {
11
11
  } from "../linear/outbound";
12
12
  import { taskSessionMap } from "../linear/sync";
13
13
  import { workflowEventBus } from "../workflows/event-bus";
14
+ import { waitUntil } from "./workflow-wait";
14
15
 
15
16
  const TEST_DB_PATH = "./test-linear-outbound-sync.sqlite";
16
17
 
@@ -48,6 +49,44 @@ afterAll(async () => {
48
49
  await unlink(`${TEST_DB_PATH}-shm`).catch(() => {});
49
50
  });
50
51
 
52
+ // The bus fires outbound handlers without awaiting them, so each test waits on a real
53
+ // effect instead of a clock. task.progress and task.created post before their first
54
+ // await, so their calls are already recorded when emit returns.
55
+
56
+ /** The task.completed/failed handlers end by writing lastSyncOrigin "swarm" to the row. */
57
+ async function waitForSwarmSync(swarmId: string): Promise<void> {
58
+ await waitUntil(
59
+ async () => (await getTrackerSync("linear", "task", swarmId))?.lastSyncOrigin === "swarm",
60
+ () => `tracker_sync for ${swarmId} never reached lastSyncOrigin "swarm"`,
61
+ );
62
+ }
63
+
64
+ /**
65
+ * An absence has nothing to poll. Emit a mapped sentinel task after the case under test:
66
+ * its handler runs the same awaits, started later, so once its sync write lands the earlier
67
+ * handler is past every point where it could have commented. Returns the sentinel issue id.
68
+ */
69
+ async function emitSentinelAndWait(): Promise<string> {
70
+ const swarmId = `outbound-sentinel-${crypto.randomUUID()}`;
71
+ const externalId = `LIN-${swarmId}`;
72
+ await createTrackerSync({
73
+ provider: "linear",
74
+ entityType: "task",
75
+ swarmId,
76
+ externalId,
77
+ syncDirection: "bidirectional",
78
+ });
79
+ workflowEventBus.emit("task.completed", { taskId: swarmId, output: "sentinel" });
80
+ await waitForSwarmSync(swarmId);
81
+ return externalId;
82
+ }
83
+
84
+ function commentedIssueIds(): string[] {
85
+ return mockCreateComment.mock.calls.map(
86
+ (call) => ((call as unknown[])[0] as { issueId: string }).issueId,
87
+ );
88
+ }
89
+
51
90
  describe("Linear Outbound Sync", () => {
52
91
  beforeEach(() => {
53
92
  mockCreateComment.mockClear();
@@ -78,8 +117,7 @@ describe("Linear Outbound Sync", () => {
78
117
  output: "All done!",
79
118
  });
80
119
 
81
- // Allow async handler to run
82
- await new Promise((resolve) => setTimeout(resolve, 10));
120
+ await waitForSwarmSync("outbound-task-completed");
83
121
 
84
122
  expect(mockCreateComment).toHaveBeenCalledTimes(1);
85
123
  const callArgs = mockCreateComment.mock.calls[0] as unknown[];
@@ -111,7 +149,7 @@ describe("Linear Outbound Sync", () => {
111
149
  });
112
150
 
113
151
  workflowEventBus.emit("task.completed", { taskId: task.id, output: "All done!" });
114
- await new Promise((resolve) => setTimeout(resolve, 10));
152
+ await waitForSwarmSync(task.id);
115
153
 
116
154
  expect(mockCreateComment).toHaveBeenCalledTimes(1);
117
155
  const arg = (mockCreateComment.mock.calls[0] as unknown[])[0] as { body: string };
@@ -135,7 +173,7 @@ describe("Linear Outbound Sync", () => {
135
173
  failureReason: "Build error in module X",
136
174
  });
137
175
 
138
- await new Promise((resolve) => setTimeout(resolve, 10));
176
+ await waitForSwarmSync("outbound-task-failed");
139
177
 
140
178
  expect(mockCreateComment).toHaveBeenCalledTimes(1);
141
179
  const callArgs = mockCreateComment.mock.calls[0] as unknown[];
@@ -158,7 +196,7 @@ describe("Linear Outbound Sync", () => {
158
196
  const output = `## Answer\n\n${"x".repeat(5000)}`;
159
197
 
160
198
  workflowEventBus.emit("task.completed", { taskId, output });
161
- await new Promise((resolve) => setTimeout(resolve, 10));
199
+ await waitForSwarmSync(taskId);
162
200
 
163
201
  expect(mockEndAgentSession).toHaveBeenCalledTimes(1);
164
202
  expect(mockEndAgentSession.mock.calls[0] as unknown[]).toEqual([
@@ -182,7 +220,7 @@ describe("Linear Outbound Sync", () => {
182
220
  taskSessionMap.set(taskId, "session-failed");
183
221
 
184
222
  workflowEventBus.emit("task.failed", { taskId, failureReason: "tsc:check failed" });
185
- await new Promise((resolve) => setTimeout(resolve, 10));
223
+ await waitForSwarmSync(taskId);
186
224
 
187
225
  expect(mockEndAgentSession).toHaveBeenCalledTimes(1);
188
226
  expect(mockEndAgentSession.mock.calls[0] as unknown[]).toEqual([
@@ -205,7 +243,7 @@ describe("Linear Outbound Sync", () => {
205
243
  taskSessionMap.set(taskId, "session-empty");
206
244
 
207
245
  workflowEventBus.emit("task.completed", { taskId, output: " " });
208
- await new Promise((resolve) => setTimeout(resolve, 10));
246
+ await waitForSwarmSync(taskId);
209
247
 
210
248
  expect(mockEndAgentSession.mock.calls[0] as unknown[]).toEqual([
211
249
  "session-empty",
@@ -261,9 +299,9 @@ describe("Linear Outbound Sync", () => {
261
299
  output: "done",
262
300
  });
263
301
 
264
- await new Promise((resolve) => setTimeout(resolve, 10));
302
+ const sentinel = await emitSentinelAndWait();
265
303
 
266
- expect(mockCreateComment).not.toHaveBeenCalled();
304
+ expect(commentedIssueIds()).toEqual([sentinel]);
267
305
  });
268
306
 
269
307
  test("loop prevention: skips if lastSyncOrigin is external and recent", async () => {
@@ -286,9 +324,9 @@ describe("Linear Outbound Sync", () => {
286
324
  output: "done",
287
325
  });
288
326
 
289
- await new Promise((resolve) => setTimeout(resolve, 10));
327
+ const sentinel = await emitSentinelAndWait();
290
328
 
291
- expect(mockCreateComment).not.toHaveBeenCalled();
329
+ expect(commentedIssueIds()).toEqual([sentinel]);
292
330
  });
293
331
 
294
332
  test("allows sync when lastSyncOrigin is external but old", async () => {
@@ -311,7 +349,7 @@ describe("Linear Outbound Sync", () => {
311
349
  output: "done",
312
350
  });
313
351
 
314
- await new Promise((resolve) => setTimeout(resolve, 10));
352
+ await waitForSwarmSync("outbound-task-old-external");
315
353
 
316
354
  expect(mockCreateComment).toHaveBeenCalledTimes(1);
317
355
  });
@@ -335,7 +373,11 @@ describe("Linear Outbound Sync", () => {
335
373
  output: "done",
336
374
  });
337
375
 
338
- await new Promise((resolve) => setTimeout(resolve, 10));
376
+ // The row already reads "swarm", so wait for the comment itself.
377
+ await waitUntil(
378
+ () => mockCreateComment.mock.calls.length > 0,
379
+ () => "the swarm-origin task was never commented",
380
+ );
339
381
 
340
382
  expect(mockCreateComment).toHaveBeenCalledTimes(1);
341
383
  });
@@ -349,8 +391,6 @@ describe("Linear Outbound Sync", () => {
349
391
  progress: "📋 Reviewing task details",
350
392
  });
351
393
 
352
- await new Promise((resolve) => setTimeout(resolve, 10));
353
-
354
394
  // Posts as `action` so the update renders as a structured card in Linear's AgentSession
355
395
  // panel. Linear's spec requires BOTH `action` AND `parameter` for action-type activities;
356
396
  // the original bug was calling postAgentSessionAction with only a single string (parameter
@@ -376,8 +416,6 @@ describe("Linear Outbound Sync", () => {
376
416
  const longProgress = "x".repeat(5000);
377
417
  workflowEventBus.emit("task.progress", { taskId, progress: longProgress });
378
418
 
379
- await new Promise((resolve) => setTimeout(resolve, 10));
380
-
381
419
  expect(mockPostAgentSessionAction).toHaveBeenCalledTimes(1);
382
420
  const args = mockPostAgentSessionAction.mock.calls[0] as unknown[];
383
421
  expect((args[2] as string).length).toBe(2000);
@@ -389,8 +427,6 @@ describe("Linear Outbound Sync", () => {
389
427
  progress: "should be dropped",
390
428
  });
391
429
 
392
- await new Promise((resolve) => setTimeout(resolve, 10));
393
-
394
430
  expect(mockPostAgentSessionThought).not.toHaveBeenCalled();
395
431
  expect(mockPostAgentSessionAction).not.toHaveBeenCalled();
396
432
  });
@@ -402,8 +438,6 @@ describe("Linear Outbound Sync", () => {
402
438
  taskId: "outbound-task-progress-empty",
403
439
  });
404
440
 
405
- await new Promise((resolve) => setTimeout(resolve, 10));
406
-
407
441
  expect(mockPostAgentSessionThought).not.toHaveBeenCalled();
408
442
  expect(mockPostAgentSessionAction).not.toHaveBeenCalled();
409
443
  });
@@ -417,8 +451,6 @@ describe("Linear Outbound Sync", () => {
417
451
  source: "linear",
418
452
  });
419
453
 
420
- await new Promise((resolve) => setTimeout(resolve, 10));
421
-
422
454
  expect(mockPostAgentSessionAction).toHaveBeenCalledTimes(1);
423
455
  expect(mockPostAgentSessionThought).not.toHaveBeenCalled();
424
456
 
@@ -446,8 +478,10 @@ describe("Linear Outbound Sync", () => {
446
478
  output: "done",
447
479
  });
448
480
 
449
- await new Promise((resolve) => setTimeout(resolve, 10));
481
+ // A listener left attached would comment on the teardown task and run the sentinel twice.
482
+ initLinearOutboundSync();
483
+ const sentinel = await emitSentinelAndWait();
450
484
 
451
- expect(mockCreateComment).not.toHaveBeenCalled();
485
+ expect(commentedIssueIds()).toEqual([sentinel]);
452
486
  });
453
487
  });
@@ -0,0 +1,103 @@
1
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2
+ import { createServer, type IncomingMessage, type Server, type ServerResponse } from "node:http";
3
+ import { closeDb, createAgent, createUser, initDb } from "../be/db";
4
+ import { mintScriptRunToken } from "../be/users";
5
+ import { handleCore } from "../http/core";
6
+ import { handleUsers } from "../http/users";
7
+ import { getPathSegments, parseQueryParams } from "../http/utils";
8
+ import { listenOnFreePort } from "./test-net";
9
+
10
+ // Identity routes resolve the caller through getOperatorActor. With no swarm
11
+ // key configured, an agent session token must not be promoted to operator.
12
+
13
+ const ORIGINAL_SWARM_KEY = process.env.AGENT_SWARM_API_KEY;
14
+ const ORIGINAL_LEGACY_KEY = process.env.API_KEY;
15
+ const DUMMY_KEY = "example-operator-actor-key";
16
+
17
+ let serverKey = "";
18
+ let server: Server;
19
+ let baseUrl: string;
20
+ let agentBearer: string;
21
+ let targetUserId: string;
22
+
23
+ function setEnvKey(value: string | undefined): void {
24
+ if (value === undefined) {
25
+ delete process.env.AGENT_SWARM_API_KEY;
26
+ delete process.env.API_KEY;
27
+ } else {
28
+ process.env.AGENT_SWARM_API_KEY = value;
29
+ }
30
+ }
31
+
32
+ async function dispatch(req: IncomingMessage, res: ServerResponse): Promise<void> {
33
+ if (await handleCore(req, res, req.headers["x-agent-id"] as string | undefined, serverKey)) {
34
+ return;
35
+ }
36
+ const ok = await handleUsers(
37
+ req,
38
+ res,
39
+ getPathSegments(req.url ?? ""),
40
+ parseQueryParams(req.url ?? ""),
41
+ );
42
+ if (!ok) res.writeHead(404).end();
43
+ }
44
+
45
+ async function post(path: string, bearer: string, body: unknown): Promise<number> {
46
+ const res = await fetch(`${baseUrl}${path}`, {
47
+ method: "POST",
48
+ headers: { Authorization: `Bearer ${bearer}`, "Content-Type": "application/json" },
49
+ body: JSON.stringify(body),
50
+ });
51
+ await res.text();
52
+ return res.status;
53
+ }
54
+
55
+ beforeAll(async () => {
56
+ initDb(":memory:");
57
+ const agent = await createAgent({ name: "keyless-worker", isLead: false, status: "idle" });
58
+ agentBearer = (await mintScriptRunToken(agent.id, 60_000)).plaintext;
59
+ targetUserId = (await createUser({ name: "Target", email: "target@example.com" })).id;
60
+ server = createServer((req, res) => {
61
+ void dispatch(req, res).catch(() => res.writeHead(500).end());
62
+ });
63
+ baseUrl = `http://127.0.0.1:${await listenOnFreePort(server)}`;
64
+ });
65
+
66
+ afterAll(async () => {
67
+ await new Promise<void>((resolve) => server.close(() => resolve()));
68
+ closeDb();
69
+ if (ORIGINAL_SWARM_KEY === undefined) delete process.env.AGENT_SWARM_API_KEY;
70
+ else process.env.AGENT_SWARM_API_KEY = ORIGINAL_SWARM_KEY;
71
+ if (ORIGINAL_LEGACY_KEY === undefined) delete process.env.API_KEY;
72
+ else process.env.API_KEY = ORIGINAL_LEGACY_KEY;
73
+ });
74
+
75
+ describe("getOperatorActor without a configured swarm key", () => {
76
+ test("an agent session token cannot mint a user MCP token", async () => {
77
+ serverKey = "";
78
+ setEnvKey(undefined);
79
+ const status = await post(`/api/users/${targetUserId}/mcp-tokens`, agentBearer, {});
80
+ expect(status).toBe(401);
81
+ });
82
+
83
+ test("an agent session token cannot create a user", async () => {
84
+ serverKey = "";
85
+ setEnvKey(undefined);
86
+ const status = await post("/api/users", agentBearer, { name: "New", email: "n@example.com" });
87
+ expect(status).toBe(401);
88
+ });
89
+
90
+ test("control: with a key configured, the same agent token is refused", async () => {
91
+ serverKey = DUMMY_KEY;
92
+ setEnvKey(DUMMY_KEY);
93
+ const status = await post(`/api/users/${targetUserId}/mcp-tokens`, agentBearer, {});
94
+ expect(status).toBe(401);
95
+ });
96
+
97
+ test("control: with a key configured, the operator key mints a token", async () => {
98
+ serverKey = DUMMY_KEY;
99
+ setEnvKey(DUMMY_KEY);
100
+ const status = await post(`/api/users/${targetUserId}/mcp-tokens`, DUMMY_KEY, {});
101
+ expect(status).toBe(200);
102
+ });
103
+ });
@@ -1,5 +1,5 @@
1
1
  import { afterEach, describe, expect, mock, test } from "bun:test";
2
- import { type LogRecord, logs, SeverityNumber } from "@opentelemetry/api-logs";
2
+ import { type LogRecord, logs, SeverityNumber } from "@opentelemetry/api";
3
3
  import { MeterProvider, MetricReader } from "@opentelemetry/sdk-metrics";
4
4
  import {
5
5
  installConsoleLogBridge,
@@ -342,7 +342,9 @@ describe("deprecation note on tools that receive modelTier", () => {
342
342
  const s = result.structuredContent as Structured;
343
343
  expect(s.success).toBe(true);
344
344
  expect(s.modelTierDeprecated).toEqual({ tier: "smart", suggestedProfile: "claude-smart" });
345
- expect(s.nudge).toBe('modelTier is deprecated: pass profile "claude-smart" (same model).');
345
+ expect(s.nudge).toBe(
346
+ 'modelTier is deprecated: pass modelGroup "smart" (the tier\'s group) or profile "claude-smart" (same model).',
347
+ );
346
348
  });
347
349
 
348
350
  test("send-task to the pool has no harness to suggest", async () => {
@@ -354,7 +356,9 @@ describe("deprecation note on tools that receive modelTier", () => {
354
356
  const s = result.structuredContent as Structured;
355
357
  expect(s.success).toBe(true);
356
358
  expect(s.modelTierDeprecated).toEqual({ tier: "regular", suggestedProfile: null });
357
- expect(s.nudge).toBe('modelTier is deprecated: pass profile "<harness>-regular" (same model).');
359
+ expect(s.nudge).toBe(
360
+ 'modelTier is deprecated: pass modelGroup "regular" (the tier\'s group) or profile "<harness>-regular" (same model).',
361
+ );
358
362
  });
359
363
 
360
364
  test("send-task without modelTier carries no note", async () => {
@@ -377,6 +381,8 @@ describe("deprecation note on tools that receive modelTier", () => {
377
381
  const s = result.structuredContent as Structured;
378
382
  expect(s.success).toBe(true);
379
383
  expect(s.modelTierDeprecated).toEqual({ tier: "smol", suggestedProfile: "codex-smol" });
380
- expect(s.nudge).toBe('modelTier is deprecated: pass profile "codex-smol" (same model).');
384
+ expect(s.nudge).toBe(
385
+ 'modelTier is deprecated: pass modelGroup "smol" (the tier\'s group) or profile "codex-smol" (same model).',
386
+ );
381
387
  });
382
388
  });
@@ -108,7 +108,10 @@ const bytes = new TextEncoder().encode(url.href);
108
108
  const id = setInterval(() => {}, 10);
109
109
  clearInterval(id);
110
110
  await fetch(url, { method: "POST", body: bytes });
111
- return structuredClone([new TextDecoder().decode(bytes), crypto.randomUUID(), crypto.getRandomValues(new Uint8Array(4))]);`);
111
+ const res = await fetch(url);
112
+ const body = new TextEncoder().encode(await res.text()).buffer;
113
+ const parsed = await (await fetch(url))["json"]();
114
+ return structuredClone([new TextDecoder().decode(bytes), body.byteLength, parsed, crypto.randomUUID(), crypto.getRandomValues(new Uint8Array(4))]);`);
112
115
  expect(checkQuickJSCompat(source)).toEqual({ compatible: true, findings: [] });
113
116
  });
114
117
 
@@ -199,15 +202,48 @@ export default async () => { const process = { env: {} }; return [decode({ from:
199
202
  );
200
203
  });
201
204
 
202
- test("reports each rule and name once, with its first line", () => {
205
+ test("reports each rule and name once, with every line it recurs on", () => {
203
206
  const report = checkQuickJSCompat(wrap("Bun.sleep(1);\nBun.sleep(2);\nreturn process.pid;"));
204
207
  expect(report.findings).toEqual([
205
- { rule: "bunGlobal", message: "Bun.* is not available under quickjs", line: 2 },
208
+ {
209
+ rule: "bunGlobal",
210
+ message: "Bun.* is not available under quickjs",
211
+ line: 2,
212
+ lines: [2, 3],
213
+ },
206
214
  { rule: "process", message: "process is not available under quickjs", line: 4 },
207
215
  ]);
208
216
  expect(quickJSCompatWarnings(report, "actions.sync")).toEqual([
209
- "actions.sync: quickjs compat (bunGlobal, line 2): Bun.* is not available under quickjs",
217
+ "actions.sync: quickjs compat (bunGlobal, lines 2, 3): Bun.* is not available under quickjs",
210
218
  "actions.sync: quickjs compat (process, line 4): process is not available under quickjs",
211
219
  ]);
220
+
221
+ // A zip reader: arrayBuffer() on a Response and later on a fetch result. Before,
222
+ // the second call site was dropped as a duplicate of the first.
223
+ const zip = wrap(`const stream = new Blob([args.data]).stream();
224
+ const inflated = new Uint8Array(await new Response(stream).arrayBuffer());
225
+ const res = await fetch(args.url);
226
+ const buf = new Uint8Array(await res.arrayBuffer());
227
+ const raw = await (await fetch(args.url))["blob"]();
228
+ return [inflated, buf, raw];`);
229
+ expect(checkQuickJSCompat(zip).findings.filter((f) => f.rule === "responseBody")).toEqual([
230
+ {
231
+ rule: "responseBody",
232
+ message:
233
+ ".arrayBuffer() on a fetch Response is not available under quickjs (text() and json() are)",
234
+ line: 3,
235
+ lines: [3, 5],
236
+ },
237
+ {
238
+ rule: "responseBody",
239
+ message:
240
+ ".blob() on a fetch Response is not available under quickjs (text() and json() are)",
241
+ line: 6,
242
+ },
243
+ ]);
244
+ const many = wrap(Array.from({ length: 12 }, () => "Bun.sleep(1);").join("\n"));
245
+ expect(quickJSCompatWarnings(checkQuickJSCompat(many))).toEqual([
246
+ "quickjs compat (bunGlobal, lines 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, +2 more): Bun.* is not available under quickjs",
247
+ ]);
212
248
  });
213
249
  });
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Admission for routes that left the RBAC backlog, over real HTTP.
3
+ *
4
+ * A custom role can only be created in the database (no public route makes
5
+ * one), so this boots the real server on a scratch DB and writes the role
6
+ * rows directly, like rbac-admission-e2e.test.ts.
7
+ *
8
+ * 1. A route that got an existing verb admits a custom role holding it and
9
+ * refuses one without it.
10
+ * 2. A custom role holding `user.manage` still cannot bind its chat identity
11
+ * onto a grant-all admin: user and identity admin stay operator-only.
12
+ */
13
+ import { Database } from "bun:sqlite";
14
+ import { afterAll, describe, expect, setDefaultTimeout, test } from "bun:test";
15
+ import { join } from "node:path";
16
+ import {
17
+ api,
18
+ makeScratchDir,
19
+ registerAgent,
20
+ removeScratchDir,
21
+ type SwarmServer,
22
+ spawnSwarmServer,
23
+ WORKER_A,
24
+ } from "./rbac-e2e-helpers";
25
+
26
+ setDefaultTimeout(120_000);
27
+
28
+ let dir: string | undefined;
29
+ let server: SwarmServer | undefined;
30
+
31
+ /** Replace the user's roles with one custom role holding exactly `verbs`. */
32
+ function setCustomRole(dbPath: string, userId: string, roleId: string, verbs: string[]): void {
33
+ const db = new Database(dbPath);
34
+ try {
35
+ db.run("PRAGMA busy_timeout = 5000");
36
+ db.transaction(() => {
37
+ db.prepare(
38
+ `INSERT OR IGNORE INTO roles (id, name, description, isBuiltin, grantsAll)
39
+ VALUES (?, ?, 'test custom role', 0, 0)`,
40
+ ).run(roleId, roleId);
41
+ for (const verb of verbs) {
42
+ db.prepare("INSERT OR IGNORE INTO role_permissions (roleId, verb) VALUES (?, ?)").run(
43
+ roleId,
44
+ verb,
45
+ );
46
+ }
47
+ db.prepare(
48
+ "DELETE FROM principal_roles WHERE principalType = 'user' AND principalId = ?",
49
+ ).run(userId);
50
+ db.prepare(
51
+ "INSERT INTO principal_roles (principalType, principalId, roleId) VALUES ('user', ?, ?)",
52
+ ).run(userId, roleId);
53
+ })();
54
+ } finally {
55
+ db.close();
56
+ }
57
+ }
58
+
59
+ describe("RBAC admission for routes that left the backlog", () => {
60
+ afterAll(async () => {
61
+ await server?.stop();
62
+ server = undefined;
63
+ if (dir) await removeScratchDir(dir);
64
+ });
65
+
66
+ test("verb admits a custom role, missing verb is 403, user.manage cannot rebind onto an admin", async () => {
67
+ dir = await makeScratchDir();
68
+ const dbPath = join(dir, "route-verbs.sqlite");
69
+ server = await spawnSwarmServer({
70
+ dbPath,
71
+ logPath: join(dir, "server.log"),
72
+ env: { RBAC_ENABLED: "true" },
73
+ });
74
+ await registerAgent(server.base, WORKER_A, "rbac-route-verbs-worker", false);
75
+
76
+ const admin = await api(server.base, "POST", "/api/users", {
77
+ body: { name: "route-verbs-admin", email: "rbac-route-verbs-admin@example.com" },
78
+ });
79
+ expect(admin.status).toBe(200);
80
+ const adminId = admin.body.user.id as string;
81
+
82
+ const user = await api(server.base, "POST", "/api/users", {
83
+ body: {
84
+ name: "route-verbs-user",
85
+ email: "rbac-route-verbs-user@example.com",
86
+ identities: [{ kind: "slack", externalId: "U-ROUTE-VERBS" }],
87
+ },
88
+ });
89
+ expect(user.status).toBe(200);
90
+ const userId = user.body.user.id as string;
91
+
92
+ const minted = await api(server.base, "POST", `/api/users/${userId}/mcp-tokens`, { body: {} });
93
+ expect(minted.status).toBe(200);
94
+ const bearer = minted.body.plaintext as string;
95
+
96
+ // 1. PUT /api/agents/{id}/name declares agent.profile.update.any.
97
+ setCustomRole(dbPath, userId, "rbac-test-no-verbs", ["favorite.write.own"]);
98
+ const denied = await api(server.base, "PUT", `/api/agents/${WORKER_A}/name`, {
99
+ bearer,
100
+ body: { name: "renamed-denied" },
101
+ });
102
+ expect(denied.status).toBe(403);
103
+ expect(denied.body.error).toContain("missing permission 'agent.profile.update.any'");
104
+
105
+ setCustomRole(dbPath, userId, "rbac-test-profile-editor", ["agent.profile.update.any"]);
106
+ const allowed = await api(server.base, "PUT", `/api/agents/${WORKER_A}/name`, {
107
+ bearer,
108
+ body: { name: "renamed-allowed" },
109
+ });
110
+ expect(allowed.status).toBe(200);
111
+ expect(allowed.body.name).toBe("renamed-allowed");
112
+
113
+ // 2. user.manage does not admit identity moves: unbinding its own Slack id
114
+ // and binding it onto the grant-all admin are both refused.
115
+ setCustomRole(dbPath, userId, "rbac-test-user-manager", ["user.manage"]);
116
+ const unbind = await api(
117
+ server.base,
118
+ "DELETE",
119
+ `/api/users/${userId}/identities/slack/U-ROUTE-VERBS`,
120
+ { bearer },
121
+ );
122
+ expect(unbind.status).toBe(403);
123
+ expect(unbind.body.error).toContain("route has no permission verb (operator-only)");
124
+
125
+ const rebind = await api(server.base, "POST", `/api/users/${adminId}/identities`, {
126
+ bearer,
127
+ body: { kind: "slack", externalId: "U-ROUTE-VERBS-2" },
128
+ });
129
+ expect(rebind.status).toBe(403);
130
+ expect(rebind.body.error).toContain("route has no permission verb (operator-only)");
131
+
132
+ const mintAdmin = await api(server.base, "POST", "/api/users", {
133
+ bearer,
134
+ body: { name: "minted-admin" },
135
+ });
136
+ expect(mintAdmin.status).toBe(403);
137
+
138
+ const adminIdentities = await api(server.base, "GET", `/api/users/${adminId}`);
139
+ expect(adminIdentities.status).toBe(200);
140
+ expect(JSON.stringify(adminIdentities.body)).not.toContain("U-ROUTE-VERBS");
141
+ });
142
+ });
@@ -80,19 +80,28 @@ describe("repo clone arguments and hook install", () => {
80
80
  CHILD_PROCESS_TEST_BUDGET_MS,
81
81
  );
82
82
 
83
- test(
84
- "installs Husky hooks without running lifecycle scripts",
85
- async () => {
83
+ test.each([
84
+ ["8.0.3", ".husky"],
85
+ ["9.1.7", ".husky/_"],
86
+ ])(
87
+ "installs Husky %s hooks without running lifecycle scripts",
88
+ async (version, hooksPath) => {
86
89
  const marker = join(tempRoot, "lifecycle-ran");
87
90
  const upstream = await makeUpstream({
88
91
  ".husky/pre-commit": "echo pre-commit\n",
89
92
  "fake-husky/package.json": JSON.stringify({
90
93
  name: "husky",
91
- version: "9.0.0",
94
+ version,
92
95
  bin: { husky: "bin.sh" },
93
96
  scripts: { install: `touch ${marker}` },
94
97
  }),
95
- "fake-husky/bin.sh": "#!/bin/sh\ngit config core.hooksPath .husky/_\n",
98
+ "fake-husky/bin.sh": `#!/bin/sh
99
+ case "$#:$*" in
100
+ 0:) git config core.hooksPath .husky/_ ;;
101
+ 1:install) git config core.hooksPath .husky ;;
102
+ *) exit 1 ;;
103
+ esac
104
+ `,
96
105
  "package.json": JSON.stringify({
97
106
  name: "fixture",
98
107
  version: "1.0.0",
@@ -109,7 +118,7 @@ describe("repo clone arguments and hook install", () => {
109
118
  expectChildOk(result, "install-repo-hooks.sh");
110
119
 
111
120
  expect(existsSync(marker)).toBe(false);
112
- expect((await git(upstream, ["config", "--get", "core.hooksPath"])).trim()).toBe(".husky/_");
121
+ expect((await git(upstream, ["config", "--get", "core.hooksPath"])).trim()).toBe(hooksPath);
113
122
  },
114
123
  CHILD_PROCESS_TEST_BUDGET_MS,
115
124
  );
@@ -734,6 +734,8 @@ describe("script connections", () => {
734
734
  markMigrationApplied(database, "354_durable_objects.sql");
735
735
  // 362 rebuilds user_favorites, which this fixture does not create (see 301).
736
736
  markMigrationApplied(database, "362_favorites_app.sql");
737
+ // 367 alters workflow_runs, which this fixture does not create.
738
+ markMigrationApplied(database, "367_workflow_run_principal.sql");
737
739
 
738
740
  const id = crypto.randomUUID();
739
741
  const now = new Date().toISOString();