@desplega.ai/agent-swarm 2.14.1 → 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 (346) hide show
  1. package/dist/{acp-adapter-7jv7w8jh.js → acp-adapter-q1vz4hh2.js} +8 -8
  2. package/dist/{acp-targets-0ebmg3et.js → acp-targets-d44eerh4.js} +7 -7
  3. package/dist/{actions-0ds9dx6c.js → actions-z4k4bvss.js} +27 -27
  4. package/dist/{agent-fs-provision-zpbxa9jc.js → agent-fs-provision-aan1cgpx.js} +4 -4
  5. package/dist/{amp-adapter-awh5nn7a.js → amp-adapter-wac3py0p.js} +1 -1
  6. package/dist/{anthropic-messages-gtgp9r85.js → anthropic-messages-njt2r5m4.js} +16 -15
  7. package/dist/{app-nzejkvpp.js → app-wax6qz5e.js} +9 -9
  8. package/dist/{approval-notifications-hbqtb2w3.js → approval-notifications-6fvkhnma.js} +10 -10
  9. package/dist/{assistant-1paft129.js → assistant-e8fe08zx.js} +25 -25
  10. package/dist/{azure-openai-responses-e76k86gf.js → azure-openai-responses-6ewf9rwp.js} +9 -9
  11. package/dist/{boot-args-schema-zs435mfx.js → boot-args-schema-rv97cmnt.js} +1 -1
  12. package/dist/{boot-reembed-91qrd4mz.js → boot-reembed-bcn7frk9.js} +1 -1
  13. package/dist/{boot-reembed-7xq2qgg4.js → boot-reembed-xakrdy6y.js} +1 -1
  14. package/dist/{boot-scrub-sweep-3h5xscw6.js → boot-scrub-sweep-20t8akhf.js} +2 -2
  15. package/dist/{boot-seeds-xkxqa8zc.js → boot-seeds-48rr6r29.js} +4 -4
  16. package/dist/{boxd-464x3w4m.js → boxd-tjpxwecx.js} +2 -2
  17. package/dist/{claude-adapter-6d8eyf2f.js → claude-adapter-0wzwntrj.js} +8 -8
  18. package/dist/{claude-managed-adapter-jzxcaf9m.js → claude-managed-adapter-4xcgt46w.js} +2 -2
  19. package/dist/{claude-managed-setup-5fcx0qh3.js → claude-managed-setup-91cyktw7.js} +5 -5
  20. package/dist/{claude-sdk-session-11vhz1hc.js → claude-sdk-session-ngj4dce5.js} +9658 -9634
  21. package/dist/{cli-hamdfjtx.js → cli-021hrewp.js} +1 -1
  22. package/dist/{cli-pgdqhdkw.js → cli-0kyjrbaa.js} +2 -2
  23. package/dist/{cli-132h67ps.js → cli-0nz04gqv.js} +48 -48
  24. package/dist/{cli-6a77m17n.js → cli-0rrft7s3.js} +2 -2
  25. package/dist/{cli-z0effej1.js → cli-1d9q7qrn.js} +5 -5
  26. package/dist/{cli-tdd9dvw6.js → cli-1t5vhrpv.js} +1 -1
  27. package/dist/{cli-zyf288rw.js → cli-2ja7eadd.js} +1 -1
  28. package/dist/{cli-k9m8fckz.js → cli-3ffzr65w.js} +4 -4
  29. package/dist/{cli-02ba8qx5.js → cli-3kdgm393.js} +4 -4
  30. package/dist/{cli-hh5m39pt.js → cli-3vc518cw.js} +1 -1
  31. package/dist/{cli-5pyes68e.js → cli-5188hq0a.js} +8 -8
  32. package/dist/{cli-zcghfsdg.js → cli-53gt8wfv.js} +1 -1
  33. package/dist/{cli-5t00r6c9.js → cli-5njmmmer.js} +2 -2
  34. package/dist/{cli-etykr11s.js → cli-5rw7nt99.js} +1 -1
  35. package/dist/{cli-6c61yjwy.js → cli-5xx353cy.js} +7554 -1534
  36. package/dist/{cli-by7s3n4p.js → cli-65k149j5.js} +2 -2
  37. package/dist/{cli-1e13gvfn.js → cli-6zpn5hmp.js} +11 -11
  38. package/dist/{cli-rb1z91g8.js → cli-7dpdq7yh.js} +1230 -540
  39. package/dist/{cli-3bagv8rt.js → cli-7wwewkf4.js} +1 -1
  40. package/dist/{cli-288k5ep1.js → cli-83hynhes.js} +15 -11
  41. package/dist/{cli-v84kb7af.js → cli-8ee7xt75.js} +11 -11
  42. package/dist/{cli-v3jxx8dv.js → cli-8ef94zm2.js} +2 -2
  43. package/dist/{cli-9fvk9mv8.js → cli-8gr1bg9t.js} +1 -1
  44. package/dist/{cli-vrb8pvrf.js → cli-9j1qcs0b.js} +6 -6
  45. package/dist/{cli-0dkpdvnn.js → cli-9mvfvggt.js} +5 -5
  46. package/dist/{cli-3bcsc3m7.js → cli-an8bpy60.js} +1 -1
  47. package/dist/{cli-6yhjqd6k.js → cli-azptj8xe.js} +810 -184
  48. package/dist/{cli-3a3hm1z8.js → cli-c0rt16vk.js} +2 -2
  49. package/dist/{cli-byzq8xht.js → cli-c6vhcknq.js} +6 -6
  50. package/dist/{cli-eaqxkeq0.js → cli-cczffwak.js} +8 -8
  51. package/dist/{cli-83kf2y60.js → cli-cgmka83w.js} +6 -6
  52. package/dist/{cli-5xjdft4s.js → cli-d13qgcct.js} +207 -142
  53. package/dist/{cli-k3facve0.js → cli-d5nvy1jy.js} +1 -1
  54. package/dist/{cli-zvsy4abb.js → cli-dev6f0px.js} +3 -3
  55. package/dist/{cli-e1wprqnd.js → cli-dzhht0vq.js} +2 -2
  56. package/dist/{cli-zdkcp8p0.js → cli-e13kbyq0.js} +1 -1
  57. package/dist/{cli-f07sgaax.js → cli-e2k0ej0d.js} +2 -2
  58. package/dist/{cli-dt931hb8.js → cli-ek8b88kv.js} +21 -21
  59. package/dist/{cli-20mkgwev.js → cli-ertcjw6z.js} +249 -19
  60. package/dist/{cli-0qyfna7a.js → cli-f3ta4e67.js} +4 -4
  61. package/dist/{cli-6xrbpj5j.js → cli-f4xv7s0t.js} +4 -4
  62. package/dist/{cli-d1zkys4j.js → cli-fdam1t9b.js} +29 -13
  63. package/dist/{cli-spfz393q.js → cli-feh37wgs.js} +598 -219
  64. package/dist/{cli-ebqx630g.js → cli-fjzjtqna.js} +35 -18
  65. package/dist/{cli-zgsd2w2k.js → cli-fs9t2m2k.js} +16 -16
  66. package/dist/{cli-trvtxwzt.js → cli-g03x26q6.js} +2 -2
  67. package/dist/{cli-0mq8kxfx.js → cli-gnkzh8ed.js} +3 -3
  68. package/dist/{cli-phantfg3.js → cli-gy0r7gb8.js} +40 -15
  69. package/dist/{cli-wsh5vfa7.js → cli-h364asjc.js} +2 -2
  70. package/dist/{cli-3ktfe5jx.js → cli-h3xcfp4c.js} +22 -7
  71. package/dist/{cli-976m0zcw.js → cli-h8k5801a.js} +49 -13
  72. package/dist/{cli-727sq1f9.js → cli-h96yp7xv.js} +2 -2
  73. package/dist/{cli-ytgtqsy9.js → cli-hab0bvrh.js} +1 -1
  74. package/dist/{cli-7dwsn9y5.js → cli-j3wqt73b.js} +4 -4
  75. package/dist/{cli-8kemtj1r.js → cli-jfgaz10x.js} +7 -7
  76. package/dist/{cli-wtwe8vng.js → cli-jrhvywah.js} +25 -24
  77. package/dist/{cli-tjrrabez.js → cli-jrxt5j0n.js} +3 -3
  78. package/dist/{cli-7b7rxz22.js → cli-jw7n9pct.js} +5 -2
  79. package/dist/{cli-k791mabe.js → cli-k9kfck3s.js} +5 -5
  80. package/dist/{cli-44r66df2.js → cli-kkwq5b12.js} +1 -1
  81. package/dist/{cli-e9p9h14n.js → cli-nc842kc9.js} +4 -4
  82. package/dist/{cli-3179w2rz.js → cli-nmj4phcg.js} +1 -1
  83. package/dist/{cli-ny8f5g7t.js → cli-praaw1wh.js} +1 -1
  84. package/dist/{cli-j8fmn3wv.js → cli-q44p4869.js} +7 -7
  85. package/dist/{cli-sq32dgfe.js → cli-q58qt9dw.js} +237 -57
  86. package/dist/{cli-2n7qdqfv.js → cli-qqz5z36e.js} +2 -2
  87. package/dist/{cli-b70cpf8f.js → cli-r7rpy2xz.js} +1 -1
  88. package/dist/{cli-1hj68b3h.js → cli-rcqgr0hs.js} +1 -1
  89. package/dist/{cli-ph95yejc.js → cli-rjc464jg.js} +2 -2
  90. package/dist/{cli-967jrz7j.js → cli-rw3m83j4.js} +15 -15
  91. package/dist/{cli-0vxbrxr3.js → cli-rwcj6wt3.js} +304 -19
  92. package/dist/{cli-yvnnyjxm.js → cli-ryn4y478.js} +1 -1
  93. package/dist/{cli-3g0vbq46.js → cli-s48k2rzx.js} +3 -3
  94. package/dist/{cli-98sea4d9.js → cli-s90wcbk9.js} +2 -2
  95. package/dist/{cli-e2wzzw17.js → cli-svcy72s5.js} +1 -1
  96. package/dist/{cli-643skca1.js → cli-swtwbg85.js} +17 -17
  97. package/dist/{cli-4y2bekkn.js → cli-t1bqpzgz.js} +2 -2
  98. package/dist/{cli-zmfs06hg.js → cli-t5jbjq61.js} +3 -3
  99. package/dist/{cli-mz7ycqn8.js → cli-td2h8zej.js} +6 -6
  100. package/dist/{cli-9t7syepg.js → cli-ttatvwn6.js} +1 -1
  101. package/dist/{cli-v1rhq77v.js → cli-txxcf9s1.js} +6 -6
  102. package/dist/{cli-q4z9s6zs.js → cli-v7az4d1g.js} +2 -2
  103. package/dist/cli-vqt44168.js +14 -0
  104. package/dist/{cli-tkrp183j.js → cli-vs9h3vw2.js} +5 -5
  105. package/dist/{cli-7abeph0b.js → cli-w2fg8kjc.js} +3 -3
  106. package/dist/{cli-sf5kp73f.js → cli-wz7qj1jy.js} +12 -12
  107. package/dist/{cli-ww8wxfzx.js → cli-x5t54ytt.js} +2 -2
  108. package/dist/{cli-nmdy8bzf.js → cli-xphbv66z.js} +1 -1
  109. package/dist/{cli-redtbppc.js → cli-xxgqn93n.js} +3753 -1186
  110. package/dist/{cli-s7bfz1ye.js → cli-z209g721.js} +109 -85
  111. package/dist/{cli-vp2ksaq9.js → cli-z5andw8k.js} +1 -1
  112. package/dist/{cli-xmc2nrtv.js → cli-zr2sc5tr.js} +1 -1
  113. package/dist/{cli-z0c98h7h.js → cli-zrm0610v.js} +61 -54
  114. package/dist/cli.js +41 -40
  115. package/dist/{cloudflare-workers-ai-system-one-w3m0fbf8.js → cloudflare-workers-ai-system-one-kb0tq22h.js} +2 -2
  116. package/dist/{codex-adapter-seht4h9t.js → codex-adapter-0c1ynrmt.js} +5 -5
  117. package/dist/{codex-session-runner-tq95x3gq.js → codex-session-runner-z4t9z7yy.js} +5 -5
  118. package/dist/{commands-0awwqxq5.js → commands-h0jxqdhk.js} +3 -3
  119. package/dist/{controller-hgjx521c.js → controller-4ygy66hv.js} +3 -3
  120. package/dist/{controllers-connect-j4kdmhfj.js → controllers-connect-ynbvv8pv.js} +26 -26
  121. package/dist/core-mj9fzrcm.js +41 -0
  122. package/dist/{cursor-adapter-0rg8wk6j.js → cursor-adapter-9e4d6658.js} +1 -1
  123. package/dist/{db-8xs2js3s.js → db-bg0hxjq1.js} +3 -3
  124. package/dist/{db-dd6hj211.js → db-q12gmpns.js} +2 -2
  125. package/dist/{devtools-b8qts77k.js → devtools-t8my9az6.js} +1 -1
  126. package/dist/{dispatcher-v7drd034.js → dispatcher-v5dbfscq.js} +23 -23
  127. package/dist/{dsh-adapter-ah8npj2x.js → dsh-adapter-z3fneea1.js} +1 -1
  128. package/dist/{e2b-z1g7vpz6.js → e2b-k3kb8b52.js} +3 -3
  129. package/dist/{e2b-hg80w0qr.js → e2b-p269awh6.js} +4 -4
  130. package/dist/{easter-egg-3d-8n4w3s9k.js → easter-egg-3d-y49v5z90.js} +1 -1
  131. package/dist/{embedding-space-0p921zt3.js → embedding-space-mjt5ksq0.js} +5 -5
  132. package/dist/{embeddings-9s7kbrc6.js → embeddings-td9hgnc5.js} +1 -1
  133. package/dist/{execute-x0fy9j0m.js → execute-z8nc8bba.js} +1 -1
  134. package/dist/{external-channel-ktfvn29c.js → external-channel-pjenc2ag.js} +2 -2
  135. package/dist/{fx-adapter-15vjxvgm.js → fx-adapter-pjeztp0n.js} +9 -9
  136. package/dist/getMachineId-bsd-hjs2tbdp.js +36 -0
  137. package/dist/getMachineId-darwin-kzbvr8s3.js +40 -0
  138. package/dist/getMachineId-linux-embmcq2c.js +26 -0
  139. package/dist/getMachineId-unsupported-jvznc6d4.js +20 -0
  140. package/dist/getMachineId-win-qr8z0b13.js +36 -0
  141. package/dist/{google-generative-ai-nzndg246.js → google-generative-ai-tf3w7557.js} +11 -16
  142. package/dist/{google-vertex-ragh3nnw.js → google-vertex-9pj87bd8.js} +15 -17
  143. package/dist/{grok-adapter-77httan0.js → grok-adapter-davbhx8t.js} +9 -9
  144. package/dist/handlers-rf130hnp.js +39 -0
  145. package/dist/{heartbeat-5yaj6dym.js → heartbeat-9hmvqxk0.js} +26 -26
  146. package/dist/{hook-c99nycyh.js → hook-0b1jqs2t.js} +6 -6
  147. package/dist/{hook-2jttae8s.js → hook-1n0sjv8p.js} +7 -7
  148. package/dist/{http-7y9dbfrr.js → http-vykejyjx.js} +412 -183
  149. package/dist/{index-tcegcysh.js → index-07d66kdm.js} +5 -5
  150. package/dist/{index-fqf82sbk.js → index-0hgjxqz8.js} +1 -1
  151. package/dist/{index-t274qhhs.js → index-0nt39qwy.js} +6 -6
  152. package/dist/{index-8p03vx1h.js → index-2xbxq71g.js} +8 -8
  153. package/dist/{index-jvfp0j47.js → index-3j8hffkb.js} +12038 -7667
  154. package/dist/index-8w09aggw.js +43 -0
  155. package/dist/{index-xhp7yp3t.js → index-b3wy4jzs.js} +1 -1
  156. package/dist/{index-6g9rdcrj.js → index-dt9vr7tb.js} +162 -57
  157. package/dist/{index-cw8nxnba.js → index-ezfas4jj.js} +1912 -346
  158. package/dist/index-g2jntx15.js +38 -0
  159. package/dist/{index-h9xnzfhx.js → index-j6sqtb83.js} +101 -72
  160. package/dist/{index-m6g8q65g.js → index-na0tczq0.js} +9268 -10220
  161. package/dist/{index-tn1m3q9b.js → index-p9dkwhwe.js} +3 -3
  162. package/dist/{index-g7rthzrv.js → index-pe2etczf.js} +8 -8
  163. package/dist/index-qffex5k4.js +41 -0
  164. package/dist/index-qrp11tp9.js +4 -0
  165. package/dist/{index-t4n9z755.js → index-ryyrg0d8.js} +406 -317
  166. package/dist/{index-t17p395x.js → index-sf06w57a.js} +13 -13
  167. package/dist/{index-qxcfv8vq.js → index-vybnwd5v.js} +1 -1
  168. package/dist/{index-dm7c6hw5.js → index-wsf1f5pe.js} +27 -27
  169. package/dist/{keepalive-7eyb8y4t.js → keepalive-86z0tzzf.js} +3 -3
  170. package/dist/lead-edmwagkn.js +81 -0
  171. package/dist/{llama-cpp-classify-yvb8vh7w.js → llama-cpp-classify-wd7htn1x.js} +2 -2
  172. package/dist/{maintenance-tdrd8nwv.js → maintenance-19h6tfwz.js} +1 -1
  173. package/dist/{mistral-conversations-w4bncwbt.js → mistral-conversations-txjmc64f.js} +7 -7
  174. package/dist/{module-ES6BEMUI-6htewwha.js → module-ES6BEMUI-44w9s1dx.js} +4 -4
  175. package/dist/{multipart-parser-xevcstye.js → multipart-parser-xqbgwrav.js} +1 -1
  176. package/dist/{oauth-refresh-sweep-f4c7g37h.js → oauth-refresh-sweep-6nmyrv32.js} +2 -2
  177. package/dist/{object-webhooks-p190rdxp.js → object-webhooks-2kynmdf8.js} +7 -7
  178. package/dist/{onboard-56h4sks6.js → onboard-zbpm96mn.js} +5 -5
  179. package/dist/{openai-codex-responses-z2h941b8.js → openai-codex-responses-6ckhys6r.js} +31 -25
  180. package/dist/{openai-completions-5bxdkeg9.js → openai-completions-c9dsq9jh.js} +17 -17
  181. package/dist/{openai-decisions-fyq1p9f9.js → openai-decisions-9vzvv10c.js} +2 -2
  182. package/dist/{openai-responses-dzf3e8r5.js → openai-responses-bhfmt9sa.js} +9 -9
  183. package/dist/{opencode-adapter-xg3yxfr0.js → opencode-adapter-fyqcbdra.js} +5 -5
  184. package/dist/{openrouter-images-0jj12a2q.js → openrouter-images-hkk5p580.js} +3 -3
  185. package/dist/otel-impl-txa20w1h.js +11178 -0
  186. package/dist/{pending-xgv316w0.js → pending-4rxawq8y.js} +24 -24
  187. package/dist/{pi-messages-zk3g4esn.js → pi-messages-py3f96p7.js} +5 -5
  188. package/dist/{pi-mono-adapter-txe0syzb.js → pi-mono-adapter-rnsed1xa.js} +14 -14
  189. package/dist/{pricing-refresh-041zpyhf.js → pricing-refresh-4314hwtw.js} +2 -2
  190. package/dist/{rbac-roles-8f3jbcaf.js → rbac-roles-fztcm8ky.js} +2 -2
  191. package/dist/{rbac-roles-cw7rrw5b.js → rbac-roles-msqt7a3k.js} +3 -3
  192. package/dist/{render-v2-2ezw4mzt.js → render-v2-w49wtecg.js} +9 -9
  193. package/dist/{resume-p14wdx8m.js → resume-gwgtp4m3.js} +12 -12
  194. package/dist/{runtime-he7c9g1r.js → runtime-kkebz8yq.js} +1 -1
  195. package/dist/{session-access-8jvq86fj.js → session-access-kjb19m2w.js} +5 -5
  196. package/dist/{session-source-backfill-6fe3hcgb.js → session-source-backfill-805p4wqr.js} +2 -2
  197. package/dist/{setup-6v0bn4r1.js → setup-q8y168c8.js} +3 -3
  198. package/dist/thread-buffer-yqbffd0t.js +40 -0
  199. package/dist/{tree-visibility-g1a8ff4r.js → tree-visibility-qj323994.js} +2 -2
  200. package/dist/{typesafe-system-one-qkvkgrcz.js → typesafe-system-one-avrdb4zm.js} +2 -2
  201. package/dist/{user-merge-jobs-vjsps179.js → user-merge-jobs-qfp40f2s.js} +3 -3
  202. package/dist/{virtual-modules-mreda4fp.js → virtual-modules-nzxegw0a.js} +7 -7
  203. package/dist/{work-objects-hfw15e35.js → work-objects-hs089w60.js} +25 -25
  204. package/dist/{worker-follow-up-gbaz2ydz.js → worker-follow-up-zwgg20sr.js} +23 -23
  205. package/dist/worker-kg4g7rnx.js +81 -0
  206. package/openapi.json +3 -3
  207. package/package.json +25 -24
  208. package/plugin/commands/create-pr.md +5 -2
  209. package/plugin/pi-skills/create-pr/SKILL.md +5 -2
  210. package/src/apps/sync.ts +7 -2
  211. package/src/be/db/workflow-runs.ts +12 -8
  212. package/src/be/db.ts +4 -1
  213. package/src/be/migrations/367_workflow_run_principal.sql +5 -0
  214. package/src/be/swarm-config-guard.ts +3 -0
  215. package/src/be/task-auto-title-listener.ts +2 -2
  216. package/src/commands/onboard/agent-fs-version.ts +1 -1
  217. package/src/extensions/post-bridge.ts +27 -28
  218. package/src/http/active-sessions.ts +7 -0
  219. package/src/http/agents.ts +7 -0
  220. package/src/http/api-keys.ts +7 -0
  221. package/src/http/approval-requests.ts +4 -0
  222. package/src/http/budgets.ts +2 -0
  223. package/src/http/codex-oauth-keep-warm.ts +6 -2
  224. package/src/http/config.ts +1 -0
  225. package/src/http/context.ts +4 -0
  226. package/src/http/db-query.ts +3 -0
  227. package/src/http/events.ts +2 -0
  228. package/src/http/fs.ts +1 -0
  229. package/src/http/integrations.ts +4 -0
  230. package/src/http/mcp-bridge.ts +1 -0
  231. package/src/http/memory.ts +3 -0
  232. package/src/http/metrics.ts +16 -0
  233. package/src/http/oauth-locks.ts +8 -0
  234. package/src/http/page-proxy.ts +16 -0
  235. package/src/http/pages.ts +9 -0
  236. package/src/http/poll.ts +1 -0
  237. package/src/http/pricing.ts +2 -0
  238. package/src/http/prompt-templates.ts +34 -0
  239. package/src/http/schedules.ts +10 -0
  240. package/src/http/script-runs.ts +24 -0
  241. package/src/http/scripts.ts +1 -0
  242. package/src/http/session-data.ts +2 -0
  243. package/src/http/status.ts +1 -0
  244. package/src/http/tasks.ts +17 -0
  245. package/src/http/trackers/jira.ts +2 -0
  246. package/src/http/trackers/linear.ts +4 -0
  247. package/src/http/users.ts +18 -0
  248. package/src/http/webhooks.ts +12 -0
  249. package/src/http/workflow-events.ts +26 -6
  250. package/src/http/workflows.ts +40 -0
  251. package/src/http/x.ts +4 -0
  252. package/src/linear/app.ts +3 -2
  253. package/src/linear/client.ts +5 -1
  254. package/src/linear/host.ts +40 -0
  255. package/src/linear/oauth.ts +3 -2
  256. package/src/linear/sync.ts +4 -3
  257. package/src/otel-impl.ts +8 -5
  258. package/src/providers/amp-adapter.ts +1 -1
  259. package/src/rbac/legacy-policy.ts +2 -0
  260. package/src/rbac/permissions.ts +5 -0
  261. package/src/scripts-runtime/quickjs-compat.ts +44 -10
  262. package/src/slack/render-v2.ts +50 -23
  263. package/src/slack/reviewed-deliverables.ts +251 -0
  264. package/src/tests/check-pr-body.test.ts +408 -93
  265. package/src/tests/compose-dev-object-store.test.ts +13 -0
  266. package/src/tests/compose-example-object-store.test.ts +67 -0
  267. package/src/tests/db-query.test.ts +8 -4
  268. package/src/tests/e2b-dispatch.test.ts +7 -1
  269. package/src/tests/otel-event-loop-and-logs.test.ts +1 -1
  270. package/src/tests/quickjs-compat.test.ts +40 -4
  271. package/src/tests/rbac-route-verbs-e2e.test.ts +142 -0
  272. package/src/tests/script-connections.test.ts +2 -0
  273. package/src/tests/slack-render-v2.test.ts +52 -8
  274. package/src/tests/workflow-definition-pinning.test.ts +2 -0
  275. package/src/tests/workflow-hitl-routing.test.ts +67 -5
  276. package/src/tests/workflow-replay.test.ts +13 -1
  277. package/src/tests/x402-client.test.ts +82 -0
  278. package/src/tools/memory-rate.ts +2 -2
  279. package/src/tools/prompt-templates/delete.ts +22 -1
  280. package/src/tools/prompt-templates/set.ts +15 -1
  281. package/src/utils/constants.ts +5 -4
  282. package/src/utils/task-citations.ts +11 -0
  283. package/src/workflows/engine.ts +5 -0
  284. package/src/workflows/executors/sub-workflow.ts +5 -7
  285. package/src/workflows/executors/swarm-script.ts +4 -5
  286. package/src/workflows/resume.ts +21 -4
  287. package/src/workflows/run-principal.ts +51 -0
  288. package/src/x402/client.ts +38 -17
  289. package/templates/skills/code-quality/content.md +1 -1
  290. package/templates/skills/pages/content.md +36 -12
  291. package/templates/skills/swarm-docs/content.md +46 -41
  292. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  293. package/templates/skills/swarm-scripts/content.md +1 -1
  294. package/dist/cli-547fsc36.js +0 -15
  295. package/dist/cli-dr6x9qdk.js +0 -15
  296. package/dist/cli-h5cveb69.js +0 -15
  297. package/dist/cli-jngvszex.js +0 -1514
  298. package/dist/cli-p0g0erm9.js +0 -15
  299. package/dist/cli-ph1jce1b.js +0 -16
  300. package/dist/cli-vxxdf2ma.js +0 -15
  301. package/dist/cli-x80zagf5.js +0 -15
  302. package/dist/core-8fw1gwg7.js +0 -41
  303. package/dist/getMachineId-bsd-2rd3pnz7.js +0 -36
  304. package/dist/getMachineId-bsd-3p48mkt1.js +0 -36
  305. package/dist/getMachineId-bsd-bk6tmeen.js +0 -36
  306. package/dist/getMachineId-bsd-pssqgwmm.js +0 -37
  307. package/dist/getMachineId-bsd-v218x3xd.js +0 -36
  308. package/dist/getMachineId-bsd-wbxcazef.js +0 -36
  309. package/dist/getMachineId-bsd-x0942pbz.js +0 -36
  310. package/dist/getMachineId-darwin-5qsy4qcg.js +0 -36
  311. package/dist/getMachineId-darwin-6v7zsshx.js +0 -37
  312. package/dist/getMachineId-darwin-fcc3fjag.js +0 -36
  313. package/dist/getMachineId-darwin-pg84hftj.js +0 -36
  314. package/dist/getMachineId-darwin-tyyevt26.js +0 -36
  315. package/dist/getMachineId-darwin-wagmbf0d.js +0 -36
  316. package/dist/getMachineId-darwin-zvkmwr3y.js +0 -36
  317. package/dist/getMachineId-linux-2ncg1epd.js +0 -29
  318. package/dist/getMachineId-linux-2tmt2ptc.js +0 -29
  319. package/dist/getMachineId-linux-empwyp2y.js +0 -29
  320. package/dist/getMachineId-linux-fanqd45b.js +0 -29
  321. package/dist/getMachineId-linux-h6fyga0x.js +0 -29
  322. package/dist/getMachineId-linux-tbhgz1k9.js +0 -29
  323. package/dist/getMachineId-linux-zrbyw7dt.js +0 -29
  324. package/dist/getMachineId-unsupported-29g9dkgv.js +0 -19
  325. package/dist/getMachineId-unsupported-8xfq8djv.js +0 -19
  326. package/dist/getMachineId-unsupported-8y9cag1p.js +0 -19
  327. package/dist/getMachineId-unsupported-a6sjrm02.js +0 -19
  328. package/dist/getMachineId-unsupported-bp3w7ds0.js +0 -19
  329. package/dist/getMachineId-unsupported-sj6fk8sw.js +0 -19
  330. package/dist/getMachineId-unsupported-v0p5gdxp.js +0 -19
  331. package/dist/getMachineId-win-hc996p0x.js +0 -38
  332. package/dist/getMachineId-win-msq9ad87.js +0 -38
  333. package/dist/getMachineId-win-tajyqwd6.js +0 -38
  334. package/dist/getMachineId-win-tzc163da.js +0 -38
  335. package/dist/getMachineId-win-xdaa0mgq.js +0 -38
  336. package/dist/getMachineId-win-xk6p98m5.js +0 -38
  337. package/dist/getMachineId-win-xtk658fm.js +0 -38
  338. package/dist/handlers-c1jp5b6h.js +0 -39
  339. package/dist/index-7dwh9kxh.js +0 -41
  340. package/dist/index-wp9tarbt.js +0 -43
  341. package/dist/index-z6np2405.js +0 -38
  342. package/dist/lead-50cgn8s1.js +0 -81
  343. package/dist/otel-impl-kepzgm4n.js +0 -55386
  344. package/dist/thread-buffer-8860v1ta.js +0 -40
  345. package/dist/worker-hkm8ftqp.js +0 -81
  346. /package/dist/{node-gbx1t3pa.js → node-q4628t0b.js} +0 -0
@@ -5,6 +5,8 @@ import { join } from "node:path";
5
5
  import {
6
6
  checkPrBody,
7
7
  isFixTitle,
8
+ leadChoices,
9
+ pendingPrBodyProblems,
8
10
  pickedChoices,
9
11
  prBodyWarnings,
10
12
  proseWordCount,
@@ -12,7 +14,7 @@ import {
12
14
  templateLeadLines,
13
15
  templateSections,
14
16
  } from "../../scripts/check-pr-body";
15
- import { runChild } from "./test-proc";
17
+ import { CHILD_PROCESS_TEST_BUDGET_MS, runChild } from "./test-proc";
16
18
 
17
19
  const TEMPLATE = `<!-- top comment -->
18
20
 
@@ -109,18 +111,21 @@ describe("check-pr-body", () => {
109
111
  test("the real template fails unedited and passes once every part is filled", async () => {
110
112
  const template = await Bun.file(".github/pull_request_template.md").text();
111
113
  const leads = templateLeadLines(template);
112
- expect(leads).toEqual(["Why", "Risk"]);
114
+ expect(leads).toEqual(["Why", "Risk", "Urgency"]);
113
115
  const sections = templateSections(template).filter((s) => s.when !== "optional");
114
116
  expect(sections.length).toBeGreaterThan(0);
115
- const all = { title: "fix: x", author: "desplega-bot", changedFiles: ["apps/ui/a.tsx"] };
117
+ // A date after the template's warn-only window, so that every rule applies.
118
+ const all = { title: "fix: x", author: "desplega-bot", today: "2099-01-01" };
116
119
  // Unknown risk keeps the outline required, so every section and lead line is reported.
117
120
  expect(checkPrBody(template, template, all)).toHaveLength(sections.length + leads.length);
118
121
 
119
122
  const filled = [
120
123
  "**Why:** because.",
121
124
  "**Risk:** medium",
125
+ "**Urgency:** nice to have",
122
126
  ...sections.map(
123
- (s) => `## ${s.heading}\n\n${s.choices.length ? `- [x] ${s.choices[0]}` : "filled"}\n`,
127
+ (s) =>
128
+ `## ${s.heading}\n\n${s.when === "evidence" ? "```diff\n+ new\n```" : s.when === "bot" ? "- [Task](https://example.com/task)" : s.choices.length ? `- [x] ${s.choices[0]}` : "- On main: it fails. filled"}\n`,
124
129
  ),
125
130
  ].join("\n");
126
131
  expect(checkPrBody(template, filled, all)).toEqual([]);
@@ -132,9 +137,7 @@ describe("check-pr-body", () => {
132
137
  expect(when).toMatchObject({
133
138
  "Review map": "always",
134
139
  "Change outline": "outline",
135
- "Before / after": "ui",
136
- Repro: "fix",
137
- Urgency: "always",
140
+ "Before / after": "evidence",
138
141
  "Swarm provenance": "bot",
139
142
  });
140
143
  });
@@ -151,10 +154,6 @@ describe("check-pr-body: lead lines, risk and conditional sections", () => {
151
154
 
152
155
  <!-- g -->
153
156
 
154
- ## Before / after <!-- ui -->
155
-
156
- <!-- g -->
157
-
158
157
  ## Swarm provenance <!-- bot -->
159
158
 
160
159
  <!-- g -->
@@ -203,30 +202,237 @@ describe("check-pr-body: lead lines, risk and conditional sections", () => {
203
202
  expect(checkPrBody(T, leads("low"), human)).toEqual([]);
204
203
  });
205
204
 
206
- test("Before / after is required only when the diff touches a UI app", () => {
207
- const body = `${leads("medium")}${outline}`;
208
- const missing = ["missing section: ## Before / after"];
209
- expect(checkPrBody(T, body, { ...human, changedFiles: ["apps/ui/src/App.tsx"] })).toEqual(
210
- missing,
211
- );
212
- expect(checkPrBody(T, body, { ...human, changedFiles: ["apps/templates-ui/x.ts"] })).toEqual(
213
- missing,
214
- );
215
- expect(checkPrBody(T, body, { ...human, changedFiles: ["src/apps/ui-thing.ts"] })).toEqual([]);
216
- expect(checkPrBody(T, body, human)).toEqual([]);
217
- });
218
-
219
205
  test("Swarm provenance is required for the bot and for a local run without an author", () => {
220
206
  const body = `${leads("medium")}${outline}`;
221
207
  const missing = ["missing section: ## Swarm provenance"];
222
208
  expect(checkPrBody(T, body, { author: "desplega-bot" })).toEqual(missing);
223
209
  expect(checkPrBody(T, body, {})).toEqual(missing);
224
210
  expect(checkPrBody(T, body, human)).toEqual([]);
225
- const withProvenance = `${body}\n## Swarm provenance\n- Task: link\n`;
211
+ const withProvenance = `${body}\n## Swarm provenance\n- [Task](https://example.com/task)\n`;
226
212
  expect(checkPrBody(T, withProvenance, { author: "desplega-bot" })).toEqual([]);
227
213
  });
228
214
  });
229
215
 
216
+ describe("check-pr-body: evidence", () => {
217
+ const template = "## Proof <!-- evidence -->";
218
+ test("evidence is always required and prose alone fails", () => {
219
+ expect(templateSections(template)).toEqual([
220
+ { heading: "Proof", when: "evidence", choices: [] },
221
+ ]);
222
+ expect(checkPrBody(template, "")).toEqual(["missing section: ## Proof"]);
223
+ for (const text of [
224
+ "",
225
+ "I tested it.",
226
+ "<!-- ``` -->",
227
+ "No visible change:",
228
+ "No visual change: ",
229
+ // Shapes with nothing in them are not evidence.
230
+ "```\n```",
231
+ "```diff\n \n```",
232
+ "| Before | After |\n|---|---|",
233
+ "<img>",
234
+ '<img alt="x">',
235
+ "![alt]()",
236
+ "Before: it failed.",
237
+ ]) {
238
+ expect(checkPrBody(template, `## Proof\n${text}`)).toEqual([
239
+ '## Proof: show a snippet, a table with a data row, an image or a video, write "Before: ... After: ...", or write "No visible change: <reason>"',
240
+ ]);
241
+ }
242
+ });
243
+ test.each([
244
+ "```diff\n+ new\n```",
245
+ "~~~text\nafter\n~~~",
246
+ "| Before | After |\n|---|---|\n| a | b |",
247
+ "![after](https://example.com/image.png)",
248
+ '<img src="https://example.com/a.png">',
249
+ '<video src="https://example.com/clip"></video>',
250
+ "https://example.com/a.mp4",
251
+ "https://example.com/a.mov",
252
+ "https://example.com/a.webm",
253
+ "https://github.com/user-attachments/assets/abc",
254
+ "No visible change: internal refactor.",
255
+ "NO VISUAL CHANGE: internal refactor.",
256
+ "Before: no setup guide. After: the guide covers eight clients.",
257
+ "Before: 201\nAfter: 400",
258
+ ])("accepts evidence: %s", (text) => {
259
+ expect(checkPrBody(template, `## Proof\n${text}`)).toEqual([]);
260
+ });
261
+ });
262
+
263
+ describe("check-pr-body: lead choices", () => {
264
+ const template =
265
+ "**Schedule:** <!-- one of: asap | this week | nice to have --> <!-- guidance -->";
266
+ test("a choice is an exact value, with an optional reason in parentheses", () => {
267
+ for (const value of ["ASAP", "this week (requested)", "**nice to have**", "`asap`"]) {
268
+ expect(checkPrBody(template, `**Schedule:** ${value}`)).toEqual([]);
269
+ }
270
+ // Free text after the value must not pick a choice: the value routes a review.
271
+ for (const value of [
272
+ "asapish",
273
+ "tomorrow",
274
+ "asap - actually nice to have",
275
+ "nice to have, please",
276
+ ]) {
277
+ expect(checkPrBody(template, `**Schedule:** ${value}`)).toEqual([
278
+ "**Schedule:** must be one of: asap, this week, nice to have (a reason in parentheses may follow)",
279
+ ]);
280
+ expect(leadChoices(template, `**Schedule:** ${value}`)).toEqual({});
281
+ }
282
+ expect(checkPrBody(template, "")).toEqual(["missing line: **Schedule:**"]);
283
+ expect(checkPrBody(template, "**Schedule:** <!-- g -->")).toEqual([
284
+ "empty line: **Schedule:**",
285
+ ]);
286
+ });
287
+ test("old checkbox sections provide a transition only when the lead is missing", () => {
288
+ const body = "## Schedule\n- [ ] asap\n- [x] THIS WEEK";
289
+ expect(checkPrBody(template, body)).toEqual([]);
290
+ expect(leadChoices(template, body)).toEqual({ schedule: "this week" });
291
+ for (const checks of ["- [x] tomorrow", "- [x] asap\n- [x] this week", "- [x] asap (please)"]) {
292
+ expect(checkPrBody(template, `## Schedule\n${checks}`)).toEqual([
293
+ "missing line: **Schedule:**",
294
+ ]);
295
+ expect(leadChoices(template, `## Schedule\n${checks}`)).toEqual({});
296
+ }
297
+ expect(checkPrBody(template, `**Schedule:** invalid\n${body}`)).toHaveLength(1);
298
+ });
299
+ test("leadChoices returns valid canonical values and ignores guidance", () => {
300
+ expect(leadChoices(template, "**Schedule:** ASAP (requested)")).toEqual({ schedule: "asap" });
301
+ expect(leadChoices(template, "**Schedule:** asapish")).toEqual({});
302
+ expect(leadChoices("**Why:** <!-- low | high -->", "**Why:** low")).toEqual({});
303
+ expect(checkPrBody("<!--\n**Hidden:** guidance\n-->\n**Why:**", "**Why:** reason")).toEqual([]);
304
+ });
305
+ });
306
+
307
+ describe("check-pr-body: bot content", () => {
308
+ const template = "## Links <!-- bot --> <!-- link: Task -->";
309
+ const LINKS_ONLY =
310
+ "## Links: links only, each as [label](url). Move other text to another section";
311
+ const TASK = "## Links: link the task as [Task](url)";
312
+ test.each([
313
+ "desplega-bot",
314
+ "someone",
315
+ undefined,
316
+ ])("validates present content for %s", (author) => {
317
+ const ctx = { author };
318
+ const bot = author !== "someone";
319
+ const task = bot ? [TASK] : [];
320
+ // One problem per root cause: a bare URL does not also report prose.
321
+ expect(
322
+ checkPrBody(template, "## Links\n- https://example.com/a\n* https://example.com/b", ctx),
323
+ ).toEqual(["## Links: write each link as [label](url), not as a bare URL"]);
324
+ // The old "Label: url" form is one root cause, so it gives one problem line.
325
+ expect(
326
+ checkPrBody(
327
+ template,
328
+ "## Links\n- Task: https://example.com/a · tree: https://example.com/b\n- Plan / research: https://example.com/c",
329
+ ctx,
330
+ ),
331
+ ).toEqual(["## Links: write each link as [label](url), not as a bare URL"]);
332
+ // Other text is still reported next to a bare URL.
333
+ expect(
334
+ checkPrBody(
335
+ template,
336
+ "## Links\n- Task: https://example.com/a\n\nSkipped/risk: untested.",
337
+ ctx,
338
+ ),
339
+ ).toEqual(["## Links: write each link as [label](url), not as a bare URL", LINKS_ONLY]);
340
+ expect(
341
+ checkPrBody(template, "## Links\n[Task](https://example.com/a)\nMore text", ctx),
342
+ ).toEqual([LINKS_ONLY]);
343
+ // Prose inside a list item, after its link.
344
+ expect(
345
+ checkPrBody(template, "## Links\n- [CI](https://example.com) Task link kept elsewhere.", ctx),
346
+ ).toEqual([LINKS_ONLY, ...task]);
347
+ expect(checkPrBody(template, "## Links\n- Task pending", ctx)).toEqual([LINKS_ONLY, ...task]);
348
+ // Another label is not the task, for the bot.
349
+ expect(checkPrBody(template, "## Links\n- [Workflow run](https://example.com/w)", ctx)).toEqual(
350
+ task,
351
+ );
352
+ for (const ok of [
353
+ "- [Task](https://example.com/a) · [tree](https://example.com/b)",
354
+ " - [task](https://example.com/a)",
355
+ "1. [Task](https://example.com/a)\n2. [Ask](https://example.com/b)",
356
+ "[Task](https://example.com/a)",
357
+ "<details><summary>Links https://example.com/hidden</summary>\n\n- [Task](https://example.com/a)\n* [Tree](https://example.com/b)\n\n</details><!-- ignored https://example.com/c -->",
358
+ ]) {
359
+ expect(checkPrBody(template, `## Links\n${ok}`, ctx)).toEqual([]);
360
+ }
361
+ });
362
+ test("without a link marker, no label is required", () => {
363
+ expect(
364
+ checkPrBody("## Links <!-- bot -->", "## Links\n- [Run](https://example.com/w)", {
365
+ author: "desplega-bot",
366
+ }),
367
+ ).toEqual([]);
368
+ });
369
+ });
370
+
371
+ describe("check-pr-body: fix control", () => {
372
+ const template = "## Checked <!-- fix mentions: main -->";
373
+ const problem = [
374
+ '## Checked: for a fix, show the control on "main" (the failure before the fix)',
375
+ ];
376
+ test("a fix title needs the word in the section", () => {
377
+ expect(checkPrBody(template, "## Checked\n- done", "fix: x")).toEqual(problem);
378
+ expect(
379
+ checkPrBody(template, "## Checked\n- On main@abc: `cmd` → fails", "fix(api): x"),
380
+ ).toEqual([]);
381
+ expect(checkPrBody(template, "## Checked\n- tests pass\n- On MAIN it fails", "fix: x")).toEqual(
382
+ [],
383
+ );
384
+ // "remains" does not contain the word "main".
385
+ expect(checkPrBody(template, "## Checked\n- the bug remains", "fix: x")).toEqual(problem);
386
+ });
387
+ test("other titles are not checked", () => {
388
+ expect(checkPrBody(template, "## Checked\n- done", "feat: x")).toEqual([]);
389
+ });
390
+ });
391
+
392
+ describe("check-pr-body: marker warnings", () => {
393
+ test("lead word limits warn only above the limit", () => {
394
+ const template = "**Reason:** <!-- max words: 2 -->";
395
+ expect(prBodyWarnings("**Reason:** one two <!-- three -->", template)).toEqual([]);
396
+ expect(prBodyWarnings("**Reason:** one two three", template)).toEqual([
397
+ "**Reason:** has 3 words. Target: 2 or fewer",
398
+ ]);
399
+ });
400
+ test("table row limits exclude headers and separators", () => {
401
+ const template = "## Data <!-- max rows: 1 -->";
402
+ const body = "## Data\n| A | B |\n|:---|---:|\n| a | b |";
403
+ expect(prBodyWarnings(body, template)).toEqual([]);
404
+ expect(prBodyWarnings(`${body}\n| c | d |`, template)).toEqual([
405
+ "## Data: 2 table rows. Target: 1 or fewer",
406
+ ]);
407
+ });
408
+ test("bullet limits exclude details, nested items, comments and code", () => {
409
+ const template = "## Notes <!-- max bullets: 1 -->";
410
+ const body =
411
+ "## Notes\n- first\n - nested\n<details open>\n- hidden\n</details>\n<!-- - guidance -->\n```\n- code\n```";
412
+ expect(prBodyWarnings(body, template)).toEqual([]);
413
+ expect(prBodyWarnings(`${body}\n* second`, template)).toEqual([
414
+ "## Notes: 2 bullets. Target: 1 or fewer",
415
+ ]);
416
+ });
417
+ test("code limits count fenced lines across fence styles", () => {
418
+ const template = "## Code <!-- max code lines: 2 -->";
419
+ const body = "## Code\n````md\n```\n````\n~~~\nsecond\n~~~";
420
+ expect(prBodyWarnings(body, template)).toEqual([]);
421
+ expect(prBodyWarnings(`${body}\n\`\`\`\nthird\n\`\`\``, template)).toEqual([
422
+ "## Code: 3 code lines. Target: 2 or fewer",
423
+ ]);
424
+ });
425
+ test("presigned links warn only with a template", () => {
426
+ const body = "https://example.com/a?X-Amz-Signature=abc";
427
+ expect(prBodyWarnings(body, "")).toEqual([
428
+ "a presigned link expires. Use a GitHub attachment for images and videos",
429
+ ]);
430
+ expect(prBodyWarnings("https://example.com/a", "")).toEqual([]);
431
+ expect(prBodyWarnings(body)).toEqual([]);
432
+ expect(prBodyWarnings(`${body} ${"word ".repeat(201)}`)).toHaveLength(1);
433
+ });
434
+ });
435
+
230
436
  describe("check-pr-body: prose budget", () => {
231
437
  test("code fences, tables, details, comments, headings and URLs do not count", () => {
232
438
  const body = [
@@ -245,87 +451,196 @@ describe("check-pr-body: prose budget", () => {
245
451
  expect(proseWordCount(body)).toBe(6);
246
452
  });
247
453
 
248
- test("a long body warns but never fails", () => {
249
- expect(prBodyWarnings("word ".repeat(300))).toEqual([]);
250
- expect(prBodyWarnings("word ".repeat(301))).toHaveLength(1);
454
+ test("a long body warns above the target and fails above the limit", () => {
455
+ expect(prBodyWarnings("word ".repeat(200))).toEqual([]);
456
+ expect(prBodyWarnings("word ".repeat(201))).toHaveLength(1);
457
+ expect(checkPrBody("", "word ".repeat(300))).toEqual([]);
458
+ // Above the limit the failure replaces the warning.
459
+ expect(prBodyWarnings("word ".repeat(301))).toEqual([]);
460
+ expect(checkPrBody("", "word ".repeat(301))).toEqual([
461
+ "about 301 prose words. Limit: 300. Move detail into a code block, a table or <details>",
462
+ ]);
463
+ });
464
+ test("a lead line warns above its target and fails above its hard limit", () => {
465
+ const template = "**Why:** <!-- max words: 3 --> <!-- hard max words: 5 -->";
466
+ const why = (n: number) => `**Why:** ${"word ".repeat(n)}`;
467
+ expect(checkPrBody(template, why(5))).toEqual([]);
468
+ expect(prBodyWarnings(why(5), template)).toEqual(["**Why:** has 5 words. Target: 3 or fewer"]);
469
+ expect(checkPrBody(template, why(6))).toEqual(["**Why:** has 6 words. Limit: 5 (target 3)"]);
470
+ expect(prBodyWarnings(why(6), template)).toEqual([]);
251
471
  });
252
472
  });
253
473
 
254
- describe("check-pr-body: PR_TEMPLATE_PATH", () => {
255
- // The org-wide check (desplega-ai/.github) runs this script against another
256
- // repo's template or the org default, so the CLI must honor the override.
257
- test("the CLI checks the body against the template the env names", async () => {
258
- const dir = await mkdtemp(join(tmpdir(), "pr-body-template-"));
259
- try {
260
- const templatePath = join(dir, "template.md");
261
- const bodyPath = join(dir, "body.md");
262
- await Bun.write(templatePath, "## Only section\n\n<!-- guidance -->\n");
263
- await Bun.write(bodyPath, "## Only section\n\nFilled.\n");
264
- const run = (env: Record<string, string>) =>
265
- runChild(["bun", "scripts/check-pr-body.ts", "--body-file", bodyPath], {
266
- env: {
267
- PATH: process.env.PATH,
268
- HOME: process.env.HOME,
269
- PR_TITLE: "chore: x",
270
- PR_AUTHOR: "someone",
271
- PR_CHANGED_FILES_FILE: bodyPath,
272
- ...env,
273
- },
274
- });
275
-
276
- const custom = await run({ PR_TEMPLATE_PATH: templatePath });
277
- expect(custom.stderr).not.toContain("does not match");
278
- expect(custom.exitCode).toBe(0);
279
-
280
- // Control: without the override, the repo template applies and this body fails it.
281
- const repoDefault = await run({});
282
- expect(repoDefault.exitCode).toBe(1);
283
- expect(repoDefault.stderr).toContain("does not match .github/pull_request_template.md");
284
- } finally {
285
- await rm(dir, { recursive: true, force: true });
286
- }
474
+ describe("check-pr-body: warn-only window", () => {
475
+ const template = [
476
+ "<!-- new rules fail from: 2026-11-26 -->",
477
+ "**Why:** <!-- hard max words: 2 -->",
478
+ "## Proof <!-- evidence -->",
479
+ "## Links <!-- bot --> <!-- link: Task -->",
480
+ "## Checked <!-- fix mentions: main -->",
481
+ ].join("\n");
482
+ const body = "**Why:** one two three\n## Links\n- https://example.com/a\n## Checked\n- done";
483
+ const fresh = [
484
+ "**Why:** has 3 words. Limit: 2",
485
+ "missing section: ## Proof",
486
+ "## Links: write each link as [label](url), not as a bare URL",
487
+ '## Checked: for a fix, show the control on "main" (the failure before the fix)',
488
+ ];
489
+ const ctx = (today: string) => ({ title: "fix: x", author: "desplega-bot", today });
490
+ test("before the date the newer rules only warn", () => {
491
+ expect(checkPrBody(template, body, ctx("2026-11-25"))).toEqual([]);
492
+ expect(pendingPrBodyProblems(template, body, ctx("2026-11-25"))).toEqual({
493
+ from: "2026-11-26",
494
+ problems: fresh,
495
+ });
496
+ });
497
+ test("from the date they fail, and nothing is pending", () => {
498
+ expect(checkPrBody(template, body, ctx("2026-11-26"))).toEqual(fresh);
499
+ expect(pendingPrBodyProblems(template, body, ctx("2026-11-26"))).toBeUndefined();
500
+ });
501
+ test("the older rules fail inside the window too", () => {
502
+ expect(
503
+ checkPrBody(template, "## Proof\n```\nx\n```\n## Checked\n- main", ctx("2026-11-25")),
504
+ ).toEqual(["missing line: **Why:**", "missing section: ## Links"]);
505
+ });
506
+ test("a template without the line has no window", () => {
507
+ const always = template.split("\n").slice(1).join("\n");
508
+ expect(checkPrBody(always, body, ctx("2020-01-01"))).toEqual(fresh);
509
+ expect(pendingPrBodyProblems(always, body, ctx("2020-01-01"))).toBeUndefined();
287
510
  });
288
511
  });
289
512
 
290
- describe("check-pr-body: PR_BODY_PROBLEMS_FILE", () => {
291
- // pr-body-comment.yml posts this file as the fork PR comment.
292
- test("a failing body writes its problems as a Markdown list; a passing body writes nothing", async () => {
293
- const dir = await mkdtemp(join(tmpdir(), "pr-body-problems-"));
294
- try {
295
- const templatePath = join(dir, "template.md");
296
- const bodyPath = join(dir, "body.md");
297
- const problemsPath = join(dir, "problems.md");
298
- await Bun.write(
299
- templatePath,
300
- "**Why:** <!-- one line -->\n\n## Only section\n\n<!-- guidance -->\n",
301
- );
302
- const run = (body: string) =>
303
- Bun.write(bodyPath, body).then(() =>
513
+ describe("check-pr-body: PR_TEMPLATE_PATH", () => {
514
+ // The org-wide check (desplega-ai/.github) runs this script against another
515
+ // repo's template or the org default, so the CLI must honor the override.
516
+ test(
517
+ "the CLI checks the body against the template the env names",
518
+ async () => {
519
+ const dir = await mkdtemp(join(tmpdir(), "pr-body-template-"));
520
+ try {
521
+ const templatePath = join(dir, "template.md");
522
+ const bodyPath = join(dir, "body.md");
523
+ await Bun.write(templatePath, "## Only section\n\n<!-- guidance -->\n");
524
+ await Bun.write(bodyPath, "## Only section\n\nFilled.\n");
525
+ const run = (env: Record<string, string>) =>
304
526
  runChild(["bun", "scripts/check-pr-body.ts", "--body-file", bodyPath], {
305
527
  env: {
306
528
  PATH: process.env.PATH,
307
529
  HOME: process.env.HOME,
308
530
  PR_TITLE: "chore: x",
309
531
  PR_AUTHOR: "someone",
310
- PR_CHANGED_FILES_FILE: bodyPath,
311
- PR_TEMPLATE_PATH: templatePath,
312
- PR_BODY_PROBLEMS_FILE: problemsPath,
532
+ ...env,
313
533
  },
314
- }),
534
+ });
535
+
536
+ const custom = await run({ PR_TEMPLATE_PATH: templatePath });
537
+ expect(custom.stderr).not.toContain("does not match");
538
+ expect(custom.exitCode).toBe(0);
539
+
540
+ // Control: without the override, the repo template applies and this body fails it.
541
+ const repoDefault = await run({});
542
+ expect(repoDefault.exitCode).toBe(1);
543
+ expect(repoDefault.stderr).toContain("does not match .github/pull_request_template.md");
544
+ } finally {
545
+ await rm(dir, { recursive: true, force: true });
546
+ }
547
+ },
548
+ CHILD_PROCESS_TEST_BUDGET_MS,
549
+ );
550
+ });
551
+
552
+ describe("check-pr-body: PR_BODY_PROBLEMS_FILE", () => {
553
+ // pr-body-comment.yml posts this file as the fork PR comment.
554
+ test(
555
+ "a failing body writes its problems as a Markdown list; a passing body writes nothing",
556
+ async () => {
557
+ const dir = await mkdtemp(join(tmpdir(), "pr-body-problems-"));
558
+ try {
559
+ const templatePath = join(dir, "template.md");
560
+ const bodyPath = join(dir, "body.md");
561
+ const problemsPath = join(dir, "problems.md");
562
+ await Bun.write(
563
+ templatePath,
564
+ "**Why:** <!-- one line -->\n\n## Only section\n\n<!-- guidance -->\n",
565
+ );
566
+ const run = (body: string) =>
567
+ Bun.write(bodyPath, body).then(() =>
568
+ runChild(["bun", "scripts/check-pr-body.ts", "--body-file", bodyPath], {
569
+ env: {
570
+ PATH: process.env.PATH,
571
+ HOME: process.env.HOME,
572
+ PR_TITLE: "chore: x",
573
+ PR_AUTHOR: "someone",
574
+ PR_TEMPLATE_PATH: templatePath,
575
+ PR_BODY_PROBLEMS_FILE: problemsPath,
576
+ },
577
+ }),
578
+ );
579
+
580
+ const failing = await run("## Summary\n\nWrote my own headings.\n");
581
+ expect(failing.exitCode).toBe(1);
582
+ expect(await Bun.file(problemsPath).text()).toBe(
583
+ "- missing line: **Why:**\n- missing section: ## Only section\n",
315
584
  );
316
585
 
317
- const failing = await run("## Summary\n\nWrote my own headings.\n");
318
- expect(failing.exitCode).toBe(1);
319
- expect(await Bun.file(problemsPath).text()).toBe(
320
- "- missing line: **Why:**\n- missing section: ## Only section\n",
321
- );
322
-
323
- await rm(problemsPath);
324
- const passing = await run("**Why:** reason.\n\n## Only section\n\nFilled.\n");
325
- expect(passing.exitCode).toBe(0);
326
- expect(await Bun.file(problemsPath).exists()).toBe(false);
327
- } finally {
328
- await rm(dir, { recursive: true, force: true });
329
- }
330
- });
586
+ await rm(problemsPath);
587
+ const passing = await run("**Why:** reason.\n\n## Only section\n\nFilled.\n");
588
+ expect(passing.exitCode).toBe(0);
589
+ expect(await Bun.file(problemsPath).exists()).toBe(false);
590
+ } finally {
591
+ await rm(dir, { recursive: true, force: true });
592
+ }
593
+ },
594
+ CHILD_PROCESS_TEST_BUDGET_MS,
595
+ );
596
+ });
597
+
598
+ describe("check-pr-body: CLI outputs", () => {
599
+ test(
600
+ "writes lead choices, section picks and risk while warnings do not fail",
601
+ async () => {
602
+ const dir = await mkdtemp(join(tmpdir(), "prb-output-"));
603
+ try {
604
+ const templatePath = join(dir, "template.txt");
605
+ const bodyPath = join(dir, "body.txt");
606
+ const outputPath = join(dir, "output.txt");
607
+ await Bun.write(
608
+ templatePath,
609
+ "**Why:** <!-- max words: 1 -->\n**Risk:**\n**Urgency:** <!-- one of: asap | later -->\n## Mode <!-- pick one -->\n- [ ] quick",
610
+ );
611
+ for (const urgency of ["**Urgency:** ASAP", "## Urgency\n- [x] asap"]) {
612
+ await Bun.write(outputPath, "");
613
+ await Bun.write(
614
+ bodyPath,
615
+ `**Why:** two words\n**Risk:** low\n${urgency}\n## Mode\n- [x] quick`,
616
+ );
617
+ const result = await runChild(
618
+ [
619
+ "bun",
620
+ "scripts/check-pr-body.ts",
621
+ "--title",
622
+ "feat: x",
623
+ "--body-file",
624
+ bodyPath,
625
+ "--author",
626
+ "someone",
627
+ ],
628
+ {
629
+ env: {
630
+ PATH: process.env.PATH,
631
+ PR_TEMPLATE_PATH: templatePath,
632
+ GITHUB_OUTPUT: outputPath,
633
+ },
634
+ },
635
+ );
636
+ expect(result.exitCode).toBe(0);
637
+ expect(result.stderr).toContain("**Why:** has 2 words. Target: 1 or fewer");
638
+ expect(await Bun.file(outputPath).text()).toBe("mode=quick\nurgency=asap\nrisk=low\n");
639
+ }
640
+ } finally {
641
+ await rm(dir, { recursive: true, force: true });
642
+ }
643
+ },
644
+ CHILD_PROCESS_TEST_BUDGET_MS,
645
+ );
331
646
  });
@@ -0,0 +1,13 @@
1
+ import { expect, test } from "bun:test";
2
+
3
+ for (const file of ["docker-compose.local.yml", "docker-compose.scripts-only.yml"]) {
4
+ test(`${file}: MinIO ports bind to loopback by default`, async () => {
5
+ const compose = Bun.YAML.parse(
6
+ await Bun.file(new URL(`../../${file}`, import.meta.url)).text(),
7
+ ) as { services: { minio: { ports: string[] } } };
8
+ expect(compose.services.minio.ports).toEqual([
9
+ `\${MINIO_BIND_ADDRESS:-127.0.0.1}:9000:9000`,
10
+ `\${MINIO_BIND_ADDRESS:-127.0.0.1}:9001:9001`,
11
+ ]);
12
+ });
13
+ }
@@ -0,0 +1,67 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { join } from "node:path";
3
+
4
+ // The reference compose file is the self-host deployment the docs copy unchanged.
5
+ // Its object store must not ship a fixed login, and its ports stay on loopback
6
+ // unless the operator opts in.
7
+ const COMPOSE_PATH = join(import.meta.dir, "..", "..", "docker-compose.example.yml");
8
+
9
+ type Service = {
10
+ environment?: Record<string, string> | string[];
11
+ entrypoint?: string | string[];
12
+ ports?: string[];
13
+ };
14
+
15
+ async function loadServices(): Promise<Record<string, Service>> {
16
+ const doc = Bun.YAML.parse(await Bun.file(COMPOSE_PATH).text()) as {
17
+ services: Record<string, Service>;
18
+ };
19
+ return doc.services;
20
+ }
21
+
22
+ function envOf(service: Service): Record<string, string> {
23
+ const env = service.environment ?? {};
24
+ if (!Array.isArray(env)) return env;
25
+ return Object.fromEntries(
26
+ env.map((entry) => {
27
+ const i = entry.indexOf("=");
28
+ return [entry.slice(0, i), entry.slice(i + 1)];
29
+ }),
30
+ );
31
+ }
32
+
33
+ /** `${NAME:?...}`: compose refuses to start until the operator sets NAME. */
34
+ const REQUIRED_VAR = /^\$\{[A-Z0-9_]+:\?[^}]*\}$/;
35
+
36
+ describe("docker-compose.example.yml object store", () => {
37
+ test("control: the file parses and the API key comes from the env", async () => {
38
+ const services = await loadServices();
39
+ expect(services.minio).toBeDefined();
40
+ expect(services["agent-fs"]).toBeDefined();
41
+ expect(envOf(services.api as Service).API_KEY).toMatch(/^\$\{API_KEY\}$/);
42
+ });
43
+
44
+ test("MinIO root login is a required env value, not a literal", async () => {
45
+ const env = envOf((await loadServices()).minio as Service);
46
+ expect(env.MINIO_ROOT_USER).toMatch(REQUIRED_VAR);
47
+ expect(env.MINIO_ROOT_PASSWORD).toMatch(REQUIRED_VAR);
48
+ });
49
+
50
+ test("agent-fs and minio-init take the login from the env", async () => {
51
+ const services = await loadServices();
52
+ const agentFs = envOf(services["agent-fs"] as Service);
53
+ expect(agentFs.S3_ACCESS_KEY_ID).toMatch(/^\$\{/);
54
+ expect(agentFs.S3_SECRET_ACCESS_KEY).toMatch(/^\$\{/);
55
+ const init = [services["minio-init"]?.entrypoint ?? ""].flat().join(" ");
56
+ expect(init).not.toContain("minioadmin");
57
+ });
58
+
59
+ test("MinIO ports bind to loopback by default", async () => {
60
+ const ports = (await loadServices()).minio?.ports ?? [];
61
+ expect(ports.length).toBeGreaterThan(0);
62
+ for (const port of ports) {
63
+ // host:hostPort:containerPort, host defaulting to 127.0.0.1
64
+ expect(port).toMatch(/^\$\{[A-Z0-9_]+:-127\.0\.0\.1\}:|^127\.0\.0\.1:/);
65
+ }
66
+ });
67
+ });