@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
package/src/http/users.ts CHANGED
@@ -269,6 +269,13 @@ const listUsers = route({
269
269
  auth: { apiKey: true },
270
270
  });
271
271
 
272
+ // User and identity admin can mint a grant-all admin (every new user gets the
273
+ // admin role) or bind a chat identity to one, so a scoped `user.manage` grant
274
+ // must not admit it. No verb keeps admission grant-all only, like the
275
+ // mcp-token routes.
276
+ const USER_ADMIN_UNGATED =
277
+ "creates users or binds identities, which can reach a grant-all admin (operator-only admission)";
278
+
272
279
  const createUserRoute = route({
273
280
  method: "post",
274
281
  path: "/api/users",
@@ -301,6 +308,7 @@ const createUserRoute = route({
301
308
  409: { description: "A user with this email already exists (user_exists)" },
302
309
  },
303
310
  auth: { apiKey: true },
311
+ rbac: { ungated: USER_ADMIN_UNGATED },
304
312
  });
305
313
 
306
314
  const listUnmapped = route({
@@ -356,6 +364,7 @@ const resolveUnmapped = route({
356
364
  404: { description: "Target user not found" },
357
365
  },
358
366
  auth: { apiKey: true },
367
+ rbac: { ungated: USER_ADMIN_UNGATED },
359
368
  });
360
369
 
361
370
  const DISMISS_RBAC = {
@@ -472,6 +481,7 @@ const updateUserRoute = route({
472
481
  404: { description: "User not found" },
473
482
  },
474
483
  auth: { apiKey: true },
484
+ rbac: { ungated: USER_ADMIN_UNGATED },
475
485
  });
476
486
 
477
487
  const mintUserMcpTokenRoute = route({
@@ -503,6 +513,10 @@ const mintUserMcpTokenRoute = route({
503
513
  404: { description: "User not found" },
504
514
  },
505
515
  auth: { apiKey: true },
516
+ rbac: {
517
+ ungated:
518
+ "mints another user's bearer token, so no scoped grant admits it (operator-only admission)",
519
+ },
506
520
  });
507
521
 
508
522
  const revokeUserMcpTokenRoute = route({
@@ -521,6 +535,7 @@ const revokeUserMcpTokenRoute = route({
521
535
  404: { description: "User or token not found" },
522
536
  },
523
537
  auth: { apiKey: true },
538
+ rbac: { ungated: "same posture as POST /api/users/{id}/mcp-tokens (operator-only admission)" },
524
539
  });
525
540
 
526
541
  const createConnectorCodeRoute = route({
@@ -710,6 +725,7 @@ const mergeUsersRoute = route({
710
725
  },
711
726
  },
712
727
  auth: { apiKey: true },
728
+ rbac: { ungated: USER_ADMIN_UNGATED },
713
729
  });
714
730
 
715
731
  const listMergeJobsRoute = route({
@@ -795,6 +811,7 @@ const addIdentityRoute = route({
795
811
  409: { description: "The (kind, externalId) identity is already linked (identity_taken)" },
796
812
  },
797
813
  auth: { apiKey: true },
814
+ rbac: { ungated: USER_ADMIN_UNGATED },
798
815
  });
799
816
 
800
817
  const deleteIdentityRoute = route({
@@ -813,6 +830,7 @@ const deleteIdentityRoute = route({
813
830
  404: { description: "User not found" },
814
831
  },
815
832
  auth: { apiKey: true },
833
+ rbac: { ungated: USER_ADMIN_UNGATED },
816
834
  });
817
835
 
818
836
  // ─── Helpers ─────────────────────────────────────────────────────────────────
@@ -198,6 +198,9 @@ const githubWebhook = route({
198
198
  401: { description: "Invalid signature" },
199
199
  503: { description: "GitHub integration not configured" },
200
200
  },
201
+ rbac: {
202
+ ungated: "inbound webhook: the provider signature is the credential, no bearer principal",
203
+ },
201
204
  });
202
205
 
203
206
  const gitlabWebhook = route({
@@ -212,6 +215,9 @@ const gitlabWebhook = route({
212
215
  401: { description: "Invalid token" },
213
216
  503: { description: "GitLab integration not configured" },
214
217
  },
218
+ rbac: {
219
+ ungated: "inbound webhook: the provider signature is the credential, no bearer principal",
220
+ },
215
221
  });
216
222
 
217
223
  const azureDevOpsWebhook = route({
@@ -266,6 +272,9 @@ const agentmailWebhook = route({
266
272
  401: { description: "Invalid signature" },
267
273
  503: { description: "AgentMail integration not configured or inbound archive unavailable" },
268
274
  },
275
+ rbac: {
276
+ ungated: "inbound webhook: the provider signature is the credential, no bearer principal",
277
+ },
269
278
  });
270
279
 
271
280
  const kapsoWebhook = route({
@@ -286,6 +295,9 @@ const kapsoWebhook = route({
286
295
  401: { description: "Invalid signature" },
287
296
  503: { description: "Kapso integration not configured" },
288
297
  },
298
+ rbac: {
299
+ ungated: "inbound webhook: the provider signature is the credential, no bearer principal",
300
+ },
289
301
  });
290
302
 
291
303
  const chatSdkWebhook = route({
@@ -2,6 +2,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
2
2
  import { z } from "zod";
3
3
  import { getWorkflowRun } from "../be/db";
4
4
  import { isReservedProviderEvent } from "../event-waits";
5
+ import { isExtensionBridgedEvent } from "../extensions/post-bridge";
5
6
  import { workflowEventBus } from "../workflows/event-bus";
6
7
  import { route } from "./route-def";
7
8
  import { jsonError } from "./utils";
@@ -40,10 +41,14 @@ const runScopedSignalRoute = route({
40
41
  }),
41
42
  },
42
43
  404: { description: "Workflow run not found" },
43
- 403: { description: "Event name is reserved for provider webhooks" },
44
+ 403: { description: "Event name is reserved for provider webhooks or server-emitted events" },
44
45
  400: { description: "Validation error" },
45
46
  },
46
47
  auth: { apiKey: true },
48
+ rbac: {
49
+ ungated:
50
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
51
+ },
47
52
  });
48
53
 
49
54
  /**
@@ -72,13 +77,26 @@ const globalSignalRoute = route({
72
77
  name: z.string(),
73
78
  }),
74
79
  },
75
- 403: { description: "Event name is reserved for provider webhooks" },
80
+ 403: { description: "Event name is reserved for provider webhooks or server-emitted events" },
76
81
  400: { description: "Validation error" },
77
82
  },
78
83
  auth: { apiKey: true },
84
+ rbac: {
85
+ ungated:
86
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
87
+ },
79
88
  });
80
89
 
81
90
  const RESERVED_EVENT_MESSAGE = "Event name is reserved for provider webhooks";
91
+ const SERVER_EVENT_MESSAGE = "Event name is reserved for server-emitted events";
92
+
93
+ /** The refusal message for a name only the server may emit, or null when callers may emit it. */
94
+ function reservedEventError(name: string): string | null {
95
+ if (isReservedProviderEvent(name)) return RESERVED_EVENT_MESSAGE;
96
+ // Extension handlers trust bridged payloads (approval outcomes, task and chat events).
97
+ if (isExtensionBridgedEvent(name)) return SERVER_EVENT_MESSAGE;
98
+ return null;
99
+ }
82
100
 
83
101
  // ─── Handler ─────────────────────────────────────────────────────────────────
84
102
 
@@ -93,8 +111,9 @@ export async function handleWorkflowEvents(
93
111
  const parsed = await runScopedSignalRoute.parse(req, res, pathSegments, queryParams);
94
112
  if (!parsed) return true;
95
113
 
96
- if (isReservedProviderEvent(parsed.body.name)) {
97
- jsonError(res, RESERVED_EVENT_MESSAGE, 403);
114
+ const reserved = reservedEventError(parsed.body.name);
115
+ if (reserved) {
116
+ jsonError(res, reserved, 403);
98
117
  return true;
99
118
  }
100
119
  const run = await getWorkflowRun(parsed.params.runId);
@@ -119,8 +138,9 @@ export async function handleWorkflowEvents(
119
138
  const parsed = await globalSignalRoute.parse(req, res, pathSegments, queryParams);
120
139
  if (!parsed) return true;
121
140
 
122
- if (isReservedProviderEvent(parsed.body.name)) {
123
- jsonError(res, RESERVED_EVENT_MESSAGE, 403);
141
+ const reserved = reservedEventError(parsed.body.name);
142
+ if (reserved) {
143
+ jsonError(res, reserved, 403);
124
144
  return true;
125
145
  }
126
146
  workflowEventBus.emit(parsed.body.name, parsed.body.payload ?? {});
@@ -199,6 +199,10 @@ const createWorkflowRoute = route({
199
199
  409: { description: "Idempotency-Key was already used for a different request" },
200
200
  410: { description: "The workflow created under this Idempotency-Key was deleted" },
201
201
  },
202
+ rbac: {
203
+ ungated:
204
+ "workflow definitions: open to agents like the workflow tools; no verb covers them, so user roles need admin",
205
+ },
202
206
  });
203
207
 
204
208
  const getWorkflowRoute = route({
@@ -255,6 +259,10 @@ const updateWorkflowRoute = route({
255
259
  403: { description: "Env var or secret input requires config.read.secrets" },
256
260
  404: { description: "Workflow not found" },
257
261
  },
262
+ rbac: {
263
+ ungated:
264
+ "workflow definitions: open to agents like the workflow tools; no verb covers them, so user roles need admin",
265
+ },
258
266
  });
259
267
 
260
268
  const patchWorkflowRoute = route({
@@ -274,6 +282,10 @@ const patchWorkflowRoute = route({
274
282
  403: { description: "Stored env var or secret input requires config.read.secrets" },
275
283
  404: { description: "Workflow not found" },
276
284
  },
285
+ rbac: {
286
+ ungated:
287
+ "workflow definitions: open to agents like the workflow tools; no verb covers them, so user roles need admin",
288
+ },
277
289
  });
278
290
 
279
291
  const patchWorkflowNodeRoute = route({
@@ -293,6 +305,10 @@ const patchWorkflowNodeRoute = route({
293
305
  403: { description: "Stored env var or secret input requires config.read.secrets" },
294
306
  404: { description: "Workflow or node not found" },
295
307
  },
308
+ rbac: {
309
+ ungated:
310
+ "workflow definitions: open to agents like the workflow tools; no verb covers them, so user roles need admin",
311
+ },
296
312
  });
297
313
 
298
314
  const deleteWorkflowRoute = route({
@@ -306,6 +322,10 @@ const deleteWorkflowRoute = route({
306
322
  204: { description: "Workflow deleted" },
307
323
  404: { description: "Workflow not found" },
308
324
  },
325
+ rbac: {
326
+ ungated:
327
+ "workflow definitions: open to agents like the workflow tools; no verb covers them, so user roles need admin",
328
+ },
309
329
  });
310
330
 
311
331
  const triggerWorkflowRoute = route({
@@ -338,6 +358,10 @@ const triggerWorkflowRoute = route({
338
358
  409: { description: "Idempotency-Key was already used for a different request" },
339
359
  410: { description: "The workflow triggered under this Idempotency-Key was deleted" },
340
360
  },
361
+ rbac: {
362
+ ungated:
363
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
364
+ },
341
365
  });
342
366
 
343
367
  const validateTriggerRoute = route({
@@ -355,6 +379,10 @@ const validateTriggerRoute = route({
355
379
  400: { description: "Payload failed validation; body matches the TriggerSchemaError contract" },
356
380
  404: { description: "Workflow not found" },
357
381
  },
382
+ rbac: {
383
+ ungated:
384
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
385
+ },
358
386
  });
359
387
 
360
388
  const listWorkflowRunsRoute = route({
@@ -441,6 +469,10 @@ const retryWorkflowRunRoute = route({
441
469
  400: { description: "Cannot retry" },
442
470
  404: { description: "Run not found" },
443
471
  },
472
+ rbac: {
473
+ ungated:
474
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
475
+ },
444
476
  });
445
477
 
446
478
  const cancelWorkflowRunRoute = route({
@@ -456,6 +488,10 @@ const cancelWorkflowRunRoute = route({
456
488
  400: { description: "Cannot cancel" },
457
489
  },
458
490
  auth: { apiKey: true },
491
+ rbac: {
492
+ ungated:
493
+ "workflow runs: open to agents like the workflow tools; no verb covers them, so user roles need admin",
494
+ },
459
495
  });
460
496
 
461
497
  const listExecutorTypesRoute = route({
@@ -517,6 +553,10 @@ const webhookTriggerRoute = route({
517
553
  401: { description: "Invalid signature" },
518
554
  404: { description: "Workflow not found" },
519
555
  },
556
+ rbac: {
557
+ ungated:
558
+ "inbound workflow webhook: the workflow's webhook secret is the credential, no bearer principal",
559
+ },
520
560
  });
521
561
 
522
562
  // ─── Version History Route Definitions ────────────────────────────────────────
package/src/http/x.ts CHANGED
@@ -102,6 +102,10 @@ const scriptApiRoute = route({
102
102
  },
103
103
  501: { description: "workspace-rw scripts are not supported" },
104
104
  },
105
+ rbac: {
106
+ ungated:
107
+ "external script endpoint: its per-endpoint bearer is the credential; script.api.* gates who exposes it",
108
+ },
105
109
  });
106
110
 
107
111
  function extractBearer(req: IncomingMessage): string | null {
package/src/linear/app.ts CHANGED
@@ -3,6 +3,7 @@ import { onAuthorizationRefreshed } from "../oauth/ensure-token";
3
3
  import { getPublicMcpBaseUrl } from "../utils/constants";
4
4
  import { isEnvFlagEnabled } from "../utils/env-flag";
5
5
  import { resetLinearClient } from "./client";
6
+ import { linearApiUrl, linearWebUrl } from "./host";
6
7
  import { initLinearOutboundSync, teardownLinearOutboundSync } from "./outbound";
7
8
 
8
9
  let initialized = false;
@@ -61,8 +62,8 @@ export async function initLinear(): Promise<boolean> {
61
62
  await upsertOAuthApp("linear", {
62
63
  clientId,
63
64
  clientSecret,
64
- authorizeUrl: "https://linear.app/oauth/authorize",
65
- tokenUrl: "https://api.linear.app/oauth/token",
65
+ authorizeUrl: linearWebUrl("/oauth/authorize"),
66
+ tokenUrl: linearApiUrl("/oauth/token"),
66
67
  redirectUri,
67
68
  scopes: "read,write,issues:create,comments:create,app:assignable,app:mentionable",
68
69
  // Linear requires comma-separated scopes in the authorize URL (RFC default
@@ -1,5 +1,6 @@
1
1
  import { LinearClient } from "@linear/sdk";
2
2
  import { getOAuthTokens } from "../be/db-queries/oauth";
3
+ import { linearApiUrl } from "./host";
3
4
 
4
5
  let linearClient: LinearClient | null = null;
5
6
 
@@ -8,7 +9,10 @@ export async function getLinearClient(): Promise<LinearClient | null> {
8
9
  if (!tokens) return null;
9
10
 
10
11
  if (!linearClient) {
11
- linearClient = new LinearClient({ accessToken: tokens.accessToken });
12
+ linearClient = new LinearClient({
13
+ accessToken: tokens.accessToken,
14
+ apiUrl: linearApiUrl("/graphql"),
15
+ });
12
16
  }
13
17
  return linearClient;
14
18
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Linear host resolver: the web base (OAuth consent page) and the API base (GraphQL,
3
+ * OAuth token and revoke).
4
+ *
5
+ * `LINEAR_URL` (default https://linear.app) and `LINEAR_API_URL` (default
6
+ * https://api.linear.app) exist so the black-box E2E suite can point the integration at a
7
+ * local Linear emulator. Both are deployment-env only (reserved in swarm-config-guard):
8
+ * the API base receives the OAuth client secret and every access token.
9
+ *
10
+ * Env is read on every call (no cache) so a restart with new env takes effect.
11
+ */
12
+
13
+ const DEFAULT_WEB_URL = "https://linear.app";
14
+ const DEFAULT_API_URL = "https://api.linear.app";
15
+
16
+ function base(name: "LINEAR_URL" | "LINEAR_API_URL", fallback: string): string {
17
+ const raw = process.env[name]?.trim();
18
+ if (!raw) return fallback;
19
+ try {
20
+ const url = new URL(raw);
21
+ if ((url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password) {
22
+ return raw.replace(/\/+$/, "");
23
+ }
24
+ } catch {}
25
+ // The raw value is never echoed: a mistyped URL can carry a token.
26
+ console.warn(
27
+ `[Linear] ${name} is not a valid http(s) URL without credentials; using ${fallback}`,
28
+ );
29
+ return fallback;
30
+ }
31
+
32
+ /** `path` starts with `/`, e.g. `linearApiUrl("/graphql")`. */
33
+ export function linearApiUrl(path: string): string {
34
+ return `${base("LINEAR_API_URL", DEFAULT_API_URL)}${path}`;
35
+ }
36
+
37
+ /** `path` starts with `/`, e.g. `linearWebUrl("/oauth/authorize")`. */
38
+ export function linearWebUrl(path: string): string {
39
+ return `${base("LINEAR_URL", DEFAULT_WEB_URL)}${path}`;
40
+ }
@@ -2,6 +2,7 @@ import { upsertKv } from "../be/db";
2
2
  import { getOAuthApp } from "../be/db-queries/oauth";
3
3
  import { oauthAppRowToProviderConfig } from "../oauth/ensure-token";
4
4
  import { buildAuthorizationUrl, type OAuthProviderConfig } from "../oauth/wrapper";
5
+ import { linearApiUrl } from "./host";
5
6
 
6
7
  /** kv namespace for the Linear bot's appUserId (Q21.C). Keyed by workspace ID. */
7
8
  const APP_USER_ID_NAMESPACE = "integration:linear:bot-app-user-id";
@@ -47,7 +48,7 @@ export async function getLinearAuthorizationUrl(
47
48
  */
48
49
  export async function captureLinearAppUserId(accessToken: string): Promise<void> {
49
50
  const query = `query { viewer { id organization { id } } }`;
50
- const res = await fetch("https://api.linear.app/graphql", {
51
+ const res = await fetch(linearApiUrl("/graphql"), {
51
52
  method: "POST",
52
53
  headers: {
53
54
  "Content-Type": "application/json",
@@ -89,7 +90,7 @@ export async function captureLinearAppUserId(accessToken: string): Promise<void>
89
90
  */
90
91
  export async function revokeLinearToken(accessToken: string): Promise<boolean> {
91
92
  try {
92
- const res = await fetch("https://api.linear.app/oauth/revoke", {
93
+ const res = await fetch(linearApiUrl("/oauth/revoke"), {
93
94
  method: "POST",
94
95
  headers: { Authorization: `Bearer ${accessToken}` },
95
96
  });
@@ -27,6 +27,7 @@ import {
27
27
  type LinearGateInput,
28
28
  shouldCreateTaskFromLinearEvent,
29
29
  } from "./gate";
30
+ import { linearApiUrl } from "./host";
30
31
  // Side-effect import: registers all Linear event templates in the in-memory registry
31
32
  import "./templates";
32
33
 
@@ -78,7 +79,7 @@ async function postAgentActivity(
78
79
  content,
79
80
  };
80
81
 
81
- const res = await fetch("https://api.linear.app/graphql", {
82
+ const res = await fetch(linearApiUrl("/graphql"), {
82
83
  method: "POST",
83
84
  headers: {
84
85
  "Content-Type": "application/json",
@@ -124,7 +125,7 @@ async function updateAgentSession(
124
125
  return false;
125
126
  }
126
127
 
127
- const res = await fetch("https://api.linear.app/graphql", {
128
+ const res = await fetch(linearApiUrl("/graphql"), {
128
129
  method: "POST",
129
130
  headers: {
130
131
  "Content-Type": "application/json",
@@ -309,7 +310,7 @@ export async function _fetchIssueGatingInfo(issueId: string): Promise<LinearGate
309
310
  );
310
311
  return { stateType: null, labelNames: [] };
311
312
  }
312
- const res = await fetch("https://api.linear.app/graphql", {
313
+ const res = await fetch(linearApiUrl("/graphql"), {
313
314
  method: "POST",
314
315
  headers: {
315
316
  "Content-Type": "application/json",
package/src/otel-impl.ts CHANGED
@@ -6,17 +6,18 @@ import {
6
6
  context,
7
7
  type Gauge,
8
8
  type Histogram,
9
+ logs,
9
10
  type Meter,
10
11
  metrics,
11
12
  propagation,
12
13
  ROOT_CONTEXT,
14
+ SeverityNumber,
13
15
  type Span,
14
16
  SpanKind,
15
17
  SpanStatusCode,
16
18
  type Tracer,
17
19
  trace,
18
20
  } from "@opentelemetry/api";
19
- import { logs, SeverityNumber } from "@opentelemetry/api-logs";
20
21
  import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
21
22
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
22
23
  import {
@@ -204,10 +205,12 @@ export async function boot(serviceRole: string, options: BootOptions = {}): Prom
204
205
  // the same resource (service.name, agentswarm.service.role, etc.). Temporality
205
206
  // is intentionally NOT hardcoded — operators should set
206
207
  // OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta for Datadog.
207
- metricReader: new PeriodicExportingMetricReader({
208
- exporter: new OTLPMetricExporter(),
209
- exportIntervalMillis: 60_000,
210
- }),
208
+ metricReaders: [
209
+ new PeriodicExportingMetricReader({
210
+ exporter: new OTLPMetricExporter(),
211
+ exportIntervalMillis: 60_000,
212
+ }),
213
+ ],
211
214
  });
212
215
 
213
216
  sdk.start();
@@ -47,7 +47,7 @@ import type {
47
47
  * default; the image installs exactly this version and the per-task settings
48
48
  * set `amp.updates.mode: "disabled"`. Bump it deliberately, with a live run.
49
49
  */
50
- export const AMP_PACKAGE = "@ampcode/cli@0.0.1795089646-g8be92a";
50
+ export const AMP_PACKAGE = "@ampcode/cli@0.0.1795176040-g0dd132";
51
51
 
52
52
  /** MCP server name. Amp exposes its tools as `agent_swarm` / `store_progress` (dashes become underscores). */
53
53
  const AMP_MCP_SERVER_NAME = "agent-swarm";
@@ -357,6 +357,8 @@ export const LEGACY_POLICY = {
357
357
  "design-system.write": anyAuthenticated,
358
358
  // Opening a page is a read. Writes from the page session keep their own verbs.
359
359
  "page.launch": anyAuthenticated,
360
+ // Global and repo overrides reach every agent's prompts, the lead's included.
361
+ "prompt-template.write": humanOrLeadOrResourceOwner,
360
362
  // Humans only: agents edit objects with the board-* and sheet-* tools as themselves.
361
363
  "objects.read": operatorOrUser,
362
364
  "objects.write": operatorOrUser,
@@ -387,6 +387,11 @@ export const PERMISSIONS = {
387
387
  description: "Open a public or authed page: mint its page-session cookie.",
388
388
  namespace: "page",
389
389
  },
390
+ "prompt-template.write": {
391
+ description:
392
+ "Create, change, reset or delete a prompt template override: any as lead, operator, or user; an agent-scope override only for the caller's own agent.",
393
+ namespace: "prompt-template",
394
+ },
390
395
  "objects.read": {
391
396
  description:
392
397
  "Read a board or sheet on the swarm's shared agent-fs drive through the object routes.",
@@ -23,6 +23,11 @@ export type QuickJSCompatFinding = {
23
23
  message: string;
24
24
  /** 1-based line in the script source, when the finding has one. */
25
25
  line?: number;
26
+ /**
27
+ * Every line the finding recurs on, ascending, starting with `line`. Present only
28
+ * when there is more than one: each call site needs its own fix.
29
+ */
30
+ lines?: number[];
26
31
  };
27
32
 
28
33
  export type QuickJSCompatReport = {
@@ -59,6 +64,8 @@ const FS_STDLIB = new Set(["glob", "grep"]);
59
64
  // ctx.swarm.config values that quickjs keeps host-side (see quickjs-runner.ts).
60
65
  const HOST_ONLY_CONFIG = new Set(["apiKey", "runtimeInstanceId"]);
61
66
  const MAX_FINDINGS = 20;
67
+ // shortcut: warnings list this many lines per finding; `lines` keeps them all.
68
+ const MAX_WARNING_LINES = 10;
62
69
 
63
70
  const SCRIPT_FILE = "user-script.ts";
64
71
 
@@ -243,6 +250,17 @@ function staticHostClass(hostname: string): "private" | "single-label" | null {
243
250
  return host !== "" && !host.includes(".") ? "single-label" : null;
244
251
  }
245
252
 
253
+ /** The method a call invokes: `x.name()` or `x["name"]()`; null for anything else. */
254
+ function calledMethodName(callee: ts.Expression): string | null {
255
+ const inner = unwrap(callee);
256
+ if (ts.isPropertyAccessExpression(inner)) return inner.name.text;
257
+ if (ts.isElementAccessExpression(inner)) {
258
+ const key = unwrap(inner.argumentExpression);
259
+ if (ts.isStringLiteral(key) || ts.isNoSubstitutionTemplateLiteral(key)) return key.text;
260
+ }
261
+ return null;
262
+ }
263
+
246
264
  /** The fetch-like call this callee names: fetch, globalThis.fetch, ctx.stdlib.fetch or fetchJson. */
247
265
  function fetchCallName(callee: ts.Expression): string | null {
248
266
  const inner = unwrap(callee);
@@ -323,15 +341,26 @@ export function checkQuickJSCompat(
323
341
  options: { fsMode?: string } = {},
324
342
  ): QuickJSCompatReport {
325
343
  const findings: QuickJSCompatFinding[] = [];
326
- const seen = new Set<string>();
344
+ const seen = new Map<string, QuickJSCompatFinding>();
327
345
  const { sourceFile, isLocal, constInitializer } = createScope(source);
346
+ // One finding per rule and message, collecting every line it recurs on: a repeat
347
+ // on another line is another call site to fix, not noise to drop.
328
348
  const add = (rule: QuickJSCompatRule, message: string, node?: ts.Node) => {
329
- if (seen.has(`${rule}:${message}`)) return;
330
- seen.add(`${rule}:${message}`);
331
349
  const line = node
332
350
  ? sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1
333
351
  : undefined;
334
- findings.push(line === undefined ? { rule, message } : { rule, message, line });
352
+ const existing = seen.get(`${rule}:${message}`);
353
+ if (existing) {
354
+ if (line === undefined || existing.line === undefined) return;
355
+ const lines = existing.lines ?? [existing.line];
356
+ // The walk is in source order, so lines arrive ascending.
357
+ if (lines.at(-1) !== line) existing.lines = [...lines, line];
358
+ return;
359
+ }
360
+ const finding: QuickJSCompatFinding =
361
+ line === undefined ? { rule, message } : { rule, message, line };
362
+ seen.set(`${rule}:${message}`, finding);
363
+ findings.push(finding);
335
364
  };
336
365
 
337
366
  if (options.fsMode === "workspace-rw") {
@@ -427,8 +456,8 @@ export function checkQuickJSCompat(
427
456
  if (ts.isIdentifier(callee) && callee.text === "require" && !isLocal(callee)) {
428
457
  add("require", "require() is not supported; use an import", node);
429
458
  }
430
- if (ts.isPropertyAccessExpression(callee)) {
431
- const method = callee.name.text;
459
+ const method = calledMethodName(callee);
460
+ if (method !== null) {
432
461
  if (RESPONSE_BODY_METHODS.has(method) && node.arguments.length === 0) {
433
462
  add(
434
463
  "responseBody",
@@ -456,8 +485,13 @@ export function checkQuickJSCompat(
456
485
  /** One human-readable line per finding, for `warnings` arrays. */
457
486
  export function quickJSCompatWarnings(report: QuickJSCompatReport, label?: string): string[] {
458
487
  const prefix = label ? `${label}: ` : "";
459
- return report.findings.map(
460
- (finding) =>
461
- `${prefix}quickjs compat (${finding.rule}${finding.line ? `, line ${finding.line}` : ""}): ${finding.message}`,
462
- );
488
+ return report.findings.map((finding) => {
489
+ const lines = finding.lines ?? (finding.line ? [finding.line] : []);
490
+ const shown = lines.slice(0, MAX_WARNING_LINES).join(", ");
491
+ const more =
492
+ lines.length > MAX_WARNING_LINES ? `, +${lines.length - MAX_WARNING_LINES} more` : "";
493
+ const where =
494
+ lines.length === 0 ? "" : `, ${lines.length === 1 ? "line" : "lines"} ${shown}${more}`;
495
+ return `${prefix}quickjs compat (${finding.rule}${where}): ${finding.message}`;
496
+ });
463
497
  }