@desplega.ai/agent-swarm 1.160.0 → 1.162.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/README.md +4 -3
  2. package/dist/{acp-adapter-2mjwcsfh.js → acp-adapter-74m73ae9.js} +163 -49
  3. package/dist/{actions-e43rxskr.js → actions-4sr14gnt.js} +42 -38
  4. package/dist/{anthropic-messages-5qx80j9k.js → anthropic-messages-8xxrzky9.js} +22 -26
  5. package/dist/{app-mc7xfagn.js → app-pt68fbwp.js} +17 -14
  6. package/dist/{artifact-3v5t9jtg.js → artifact-fey7dvj9.js} +3 -2
  7. package/dist/{assistant-sedkzv3b.js → assistant-cv3jytks.js} +43 -39
  8. package/dist/{azure-openai-responses-nfb21z9a.js → azure-openai-responses-f5cqsyj8.js} +15 -10
  9. package/dist/{boot-reembed-m3656j2n.js → boot-reembed-4ht4gqth.js} +17 -14
  10. package/dist/{boot-reembed-cqz9swn5.js → boot-reembed-nxpcvpj9.js} +16 -13
  11. package/dist/{boot-scrub-logs-xbxf5d7w.js → boot-scrub-logs-k93kyw8k.js} +13 -10
  12. package/dist/boot-seeds-1skcrs0e.js +32 -0
  13. package/dist/{claude-adapter-dc6289mc.js → claude-adapter-r5g0tzge.js} +39 -30
  14. package/dist/{claude-managed-adapter-naaw51me.js → claude-managed-adapter-yxkfxg8j.js} +6 -5
  15. package/dist/{claude-managed-setup-eacvchx0.js → claude-managed-setup-pkyrgshb.js} +27 -27
  16. package/dist/{claude-sdk-session-bqp2xvym.js → claude-sdk-session-jxyxnrwd.js} +8041 -7910
  17. package/dist/{cli-4derpgyk.js → cli-2hhfhfq5.js} +6 -1
  18. package/dist/{cli-rykfmgwg.js → cli-2x0e561b.js} +1 -1
  19. package/dist/{cli-tzx2ke1v.js → cli-2zy95vhm.js} +137 -64
  20. package/dist/{cli-0x01kwrd.js → cli-4cwxn7gp.js} +47 -186
  21. package/dist/{cli-xjcywfsf.js → cli-4dcpaefp.js} +12 -11
  22. package/dist/{cli-v7fn5gms.js → cli-4x0csdjq.js} +164 -76
  23. package/dist/{cli-12tszpk9.js → cli-5bcd7sfy.js} +91 -29
  24. package/dist/{cli-jz4w45qt.js → cli-5k6k8ta3.js} +190 -50
  25. package/dist/{cli-tpq83z89.js → cli-5xhpb3kv.js} +20 -19
  26. package/dist/{cli-r1mxd1xh.js → cli-7af8yhav.js} +6 -179
  27. package/dist/{cli-jajnsm8q.js → cli-7tre70zp.js} +18160 -31345
  28. package/dist/{cli-447dt1h3.js → cli-8ev9xqnx.js} +218 -25
  29. package/dist/cli-bsky8g7w.js +449 -0
  30. package/dist/{cli-0z2v4nhw.js → cli-cat6h73s.js} +1 -1
  31. package/dist/{cli-25fcq4b4.js → cli-cebmgwsc.js} +15 -11
  32. package/dist/{cli-shkxm1vn.js → cli-cvatsam7.js} +189 -13
  33. package/dist/{cli-2658f6at.js → cli-cvk6yzw5.js} +6 -8
  34. package/dist/cli-dbmwby6a.js +9 -0
  35. package/dist/{cli-ptr8h7kp.js → cli-eg0b3p0k.js} +5 -218
  36. package/dist/cli-f9w1semm.js +413 -0
  37. package/dist/{cli-523679eh.js → cli-g739zqzt.js} +6 -5
  38. package/dist/{cli-dv6cdjs2.js → cli-gd4favx9.js} +28 -7
  39. package/dist/{cli-c8a36vcc.js → cli-gpqpmns7.js} +2 -2
  40. package/dist/{cli-5nbmpy8w.js → cli-hb5c2x5y.js} +1 -1
  41. package/dist/{cli-741yb0xx.js → cli-hmsw1gpy.js} +55 -169
  42. package/dist/{cli-qydf22qq.js → cli-jf7wmv1r.js} +2562 -735
  43. package/dist/{cli-mfe5btp9.js → cli-jxs2ygaw.js} +317 -121
  44. package/dist/{cli-kmcpfwn2.js → cli-jyy6pm2f.js} +19 -3
  45. package/dist/cli-kdkwd3yr.js +615 -0
  46. package/dist/{cli-6cs6wzxt.js → cli-kh04eqwe.js} +2 -2
  47. package/dist/{cli-9hsgwz4w.js → cli-kp42yek0.js} +1309 -391
  48. package/dist/cli-ma3zvh39.js +10404 -0
  49. package/dist/{cli-ybgv4kw2.js → cli-mbssg1xv.js} +9 -2
  50. package/dist/{cli-jsp14b6c.js → cli-mzfth0bp.js} +38 -1
  51. package/dist/{cli-r2ap2czm.js → cli-nexqx4ve.js} +6 -0
  52. package/dist/{cli-f8gy6r2r.js → cli-nq7yqw7b.js} +19 -8
  53. package/dist/{cli-10nhj6xq.js → cli-nt8hecg9.js} +34 -33
  54. package/dist/cli-p0r8sxj5.js +303 -0
  55. package/dist/{cli-58e8yr0d.js → cli-pkd6s2wy.js} +4 -2
  56. package/dist/{cli-a8dvhzrt.js → cli-q24re23n.js} +7 -5
  57. package/dist/cli-qjjvzwzd.js +222 -0
  58. package/dist/cli-qrgt5bqf.js +189 -0
  59. package/dist/{cli-et8m9xsv.js → cli-rfjw9jw2.js} +22 -10
  60. package/dist/{cli-7e398j1h.js → cli-rj0gqwwp.js} +3 -3
  61. package/dist/{cli-btfv8y88.js → cli-rnyzn44p.js} +2 -2
  62. package/dist/{cli-d5czme6m.js → cli-s3hwpt9v.js} +4754 -4945
  63. package/dist/{cli-0jwe9034.js → cli-sptrj5f5.js} +3 -3
  64. package/dist/{cli-0q3avq3s.js → cli-sqvfa090.js} +19 -11
  65. package/dist/{cli-azhgzetg.js → cli-swfmp1fx.js} +27 -27
  66. package/dist/{cli-jyk0ynw2.js → cli-t845n9xk.js} +23 -10
  67. package/dist/{cli-zpep9q5e.js → cli-tcen9p5w.js} +20 -15
  68. package/dist/{cli-74h9hscv.js → cli-tre4bdgq.js} +1 -1
  69. package/dist/{cli-pm1rst0h.js → cli-twrh04ap.js} +30 -15
  70. package/dist/{cli-phsaj4xq.js → cli-v0pvvhfq.js} +1 -1
  71. package/dist/{cli-ydmcgve1.js → cli-vc9bp061.js} +5 -5
  72. package/dist/{cli-g2whhdrf.js → cli-vxe6qa4h.js} +1 -1
  73. package/dist/{cli-vctdqs5h.js → cli-vy3ed88x.js} +15 -2
  74. package/dist/{cli-br0qdrnp.js → cli-vyqs9ya8.js} +18 -18
  75. package/dist/{cli-cpvsaqsw.js → cli-w0bwte75.js} +8 -5
  76. package/dist/cli-wbvnn6tk.js +861 -0
  77. package/dist/{cli-r94z9p1z.js → cli-wgbezhw2.js} +3 -0
  78. package/dist/{cli-evvtk35y.js → cli-wjgs5wxe.js} +7 -7
  79. package/dist/cli-wxkkd0e0.js +33 -0
  80. package/dist/{cli-0wgxmwf6.js → cli-xk79303e.js} +20 -7
  81. package/dist/{cli-ktmyrtpn.js → cli-xqpk3rp7.js} +33 -10
  82. package/dist/{cli-ygwm91nt.js → cli-yy6dew39.js} +1 -1
  83. package/dist/cli-zp38xvtm.js +9487 -0
  84. package/dist/{cli-tfky2838.js → cli-zvhd3f64.js} +4 -4
  85. package/dist/{cli-jayjpjmb.js → cli-zxqx25nz.js} +66 -23
  86. package/dist/cli.js +40 -32
  87. package/dist/{cloudflare-workers-ai-system-one-k6fbxw9d.js → cloudflare-workers-ai-system-one-k8ddqjkq.js} +8 -6
  88. package/dist/{codex-adapter-nmxcatww.js → codex-adapter-esvmnhn7.js} +24 -23
  89. package/dist/{codex-hook-20me6byw.js → codex-hook-m73jmqgx.js} +19 -3
  90. package/dist/{codex-login-w6fz4xbz.js → codex-login-cf7mzsgg.js} +2 -2
  91. package/dist/{codex-session-runner-90aa80ev.js → codex-session-runner-ban9excr.js} +24 -23
  92. package/dist/{commands-8wcq1kn7.js → commands-75413p2n.js} +13 -10
  93. package/dist/{db-j40kc4se.js → db-7f5pecwg.js} +17 -10
  94. package/dist/{dispatcher-4zqy768d.js → dispatcher-fh9at8nz.js} +41 -37
  95. package/dist/dsh-adapter-wpze65d4.js +24 -0
  96. package/dist/{e2b-ez07znam.js → e2b-gjgdjp91.js} +12 -9
  97. package/dist/easter-egg-3d-3w5c2n4c.js +1057 -0
  98. package/dist/{execute-6e7qeyk4.js → execute-f50wg9nh.js} +203 -49
  99. package/dist/{google-generative-ai-k6n5nbpp.js → google-generative-ai-jxxpnegy.js} +2 -2
  100. package/dist/{google-vertex-44xxtcvp.js → google-vertex-x7q1angm.js} +5 -5
  101. package/dist/{handlers-kjdce1w5.js → handlers-w13787bb.js} +44 -40
  102. package/dist/{hook-r2t4bqfg.js → hook-46g1jrvx.js} +34 -20
  103. package/dist/{hook-czx13n12.js → hook-4tpts2ry.js} +25 -21
  104. package/dist/{http-3bbb19be.js → http-19pzbfrt.js} +1440 -283
  105. package/dist/{index-668me3f0.js → index-8fd4dm4h.js} +42 -38
  106. package/dist/{index-fg0dsp6c.js → index-dqmp15bq.js} +41 -37
  107. package/dist/{index-kkv84jq9.js → index-qb4q1y3e.js} +41 -37
  108. package/dist/index-s75wc4wd.js +33 -0
  109. package/dist/{index-zg7vp46x.js → index-scptvdxg.js} +64 -38
  110. package/dist/{keepalive-yra8dy57.js → keepalive-xa5ts9cd.js} +15 -12
  111. package/dist/{lead-va0pad2c.js → lead-qp4xkvjq.js} +59 -54
  112. package/dist/{maintenance-hqewtmyg.js → maintenance-rm5885hm.js} +17 -14
  113. package/dist/{mistral-conversations-pc3ntnxt.js → mistral-conversations-rw7fbt22.js} +4 -4
  114. package/dist/{node-a5e00qhp.js → node-8zkdq42h.js} +834 -833
  115. package/dist/node-f0ykebbv.js +2107 -0
  116. package/dist/node-wyamey5r.js +19 -0
  117. package/dist/{oauth-refresh-sweep-7rdt1m9n.js → oauth-refresh-sweep-1csdfebf.js} +14 -11
  118. package/dist/{onboard-j6ms6d0x.js → onboard-r6b78cs4.js} +10 -10
  119. package/dist/{openai-codex-responses-bbancrr0.js → openai-codex-responses-efvrgrq3.js} +4 -4
  120. package/dist/{openai-completions-jpaj5g2b.js → openai-completions-bbbrrz4z.js} +12 -8
  121. package/dist/{openai-responses-200k1wx4.js → openai-responses-9jjyrcm1.js} +15 -10
  122. package/dist/{opencode-adapter-89rabkw2.js → opencode-adapter-kb3g6pkf.js} +12 -9
  123. package/dist/{otel-impl-a792rjz0.js → otel-impl-0y9knpky.js} +6 -6
  124. package/dist/{pi-mono-adapter-g7qzvr3v.js → pi-mono-adapter-z6s1bme2.js} +128 -37
  125. package/dist/{pricing-refresh-wx0tp7cb.js → pricing-refresh-mth26tgp.js} +15 -12
  126. package/dist/{rbac-roles-8tzawacv.js → rbac-roles-kwntb23q.js} +17 -12
  127. package/dist/rbac-roles-vpk4ebm8.js +45 -0
  128. package/dist/{registry-v5wytg0s.js → registry-km6t1jd2.js} +1 -1
  129. package/dist/{render-v2-mm7zswb8.js → render-v2-hcm7h00y.js} +17 -14
  130. package/dist/{runtime-zyssgse0.js → runtime-vfjsfsc5.js} +5 -4
  131. package/dist/{setup-8y70ys6t.js → setup-hbyzd65h.js} +2 -2
  132. package/dist/{virtual-modules-6nmk7h3n.js → virtual-modules-9bv7ry91.js} +9 -7
  133. package/dist/{work-objects-fg6xkb0n.js → work-objects-m09sxnhe.js} +44 -40
  134. package/dist/{worker-wmwhxsph.js → worker-0h35rvk4.js} +59 -54
  135. package/dist/{x-n3e0v3xa.js → x-f1gt1pz3.js} +2 -2
  136. package/openapi.json +699 -26
  137. package/package.json +19 -11
  138. package/src/azure-devops/api.ts +121 -0
  139. package/src/azure-devops/auth.ts +78 -0
  140. package/src/azure-devops/handlers.ts +413 -0
  141. package/src/azure-devops/index.ts +27 -0
  142. package/src/azure-devops/templates.ts +108 -0
  143. package/src/azure-devops/types.ts +90 -0
  144. package/src/be/api-drain.ts +184 -0
  145. package/src/be/db/tasks/read.ts +32 -7
  146. package/src/be/db/tasks/write.ts +21 -4
  147. package/src/be/db-client.ts +11 -2
  148. package/src/be/db-retention.ts +95 -32
  149. package/src/be/db.ts +44 -19
  150. package/src/be/memory/constants.ts +16 -0
  151. package/src/be/memory/graph-expansion.ts +8 -1
  152. package/src/be/memory/index-content.ts +20 -1
  153. package/src/be/memory/key-guard.ts +93 -0
  154. package/src/be/memory/key-paths.ts +103 -0
  155. package/src/be/memory/link-resolver.ts +29 -3
  156. package/src/be/memory/providers/sqlite-store.ts +152 -45
  157. package/src/be/memory/raters/llm-summarizer.ts +10 -4
  158. package/src/be/memory/raters/llm.ts +15 -5
  159. package/src/be/memory/raters/store.ts +6 -3
  160. package/src/be/memory/raters/types.ts +11 -0
  161. package/src/be/memory/reranker.ts +38 -7
  162. package/src/be/memory/types.ts +12 -1
  163. package/src/be/migrations/190_memory_rating_model.sql +7 -0
  164. package/src/be/migrations/191_context_versions_previous_index.sql +8 -0
  165. package/src/be/migrations/192_favorites_agent_fs_path.sql +36 -0
  166. package/src/be/onboarding.ts +7 -1
  167. package/src/be/pricing-normalize.ts +4 -2
  168. package/src/be/scripts/typecheck.ts +4 -3
  169. package/src/be/seed-pricing.ts +16 -0
  170. package/src/be/seed-prompt-templates.ts +1 -0
  171. package/src/be/swarm-config-guard.ts +46 -17
  172. package/src/be/task-citations.ts +11 -5
  173. package/src/be/users.ts +3 -0
  174. package/src/cli.tsx +3 -2
  175. package/src/comb/agent-fs.ts +39 -0
  176. package/src/comb/config.ts +37 -0
  177. package/src/comb/markers.ts +37 -0
  178. package/src/comb/review-batch.ts +486 -0
  179. package/src/comb/templates.ts +88 -0
  180. package/src/commands/claude-managed-setup.ts +33 -31
  181. package/src/commands/context-preamble.ts +4 -1
  182. package/src/commands/hook.ts +2 -1
  183. package/src/commands/provider-credentials.ts +28 -15
  184. package/src/commands/runner.ts +458 -110
  185. package/src/commands/templates.ts +10 -0
  186. package/src/e2b/env.ts +2 -0
  187. package/src/extensions/catalog.generated.json +17 -0
  188. package/src/extensions/contract-types.generated.ts +1 -1
  189. package/src/fs/agent-fs-provider.ts +106 -2
  190. package/src/github/handlers.ts +10 -74
  191. package/src/github/reactions.ts +119 -138
  192. package/src/github/task-reactions.ts +34 -11
  193. package/src/heartbeat/heartbeat.ts +4 -0
  194. package/src/hooks/codex-hook.ts +25 -1
  195. package/src/hooks/hook.ts +14 -1
  196. package/src/hooks/pr-body-guard.ts +983 -0
  197. package/src/http/agents.ts +1 -1
  198. package/src/http/all-routes.ts +1 -0
  199. package/src/http/assets.ts +5 -17
  200. package/src/http/comb.ts +131 -0
  201. package/src/http/core.ts +14 -1
  202. package/src/http/extensions.ts +51 -27
  203. package/src/http/fs.ts +9 -17
  204. package/src/http/index.ts +27 -9
  205. package/src/http/mcp-user.ts +8 -13
  206. package/src/http/mcp.ts +19 -12
  207. package/src/http/memory.ts +80 -14
  208. package/src/http/onboarding.ts +21 -2
  209. package/src/http/poll.ts +30 -3
  210. package/src/http/realtime.ts +62 -0
  211. package/src/http/request-principal.ts +22 -0
  212. package/src/http/session-data.ts +6 -4
  213. package/src/http/stats.ts +1 -0
  214. package/src/http/status.ts +34 -2
  215. package/src/http/tasks.ts +17 -3
  216. package/src/http/users.ts +1 -1
  217. package/src/http/webhooks.ts +120 -2
  218. package/src/kv-reserved-namespaces.ts +10 -5
  219. package/src/providers/claude-adapter.ts +84 -16
  220. package/src/providers/claude-managed-adapter.ts +29 -2
  221. package/src/providers/codex-adapter.ts +1 -1
  222. package/src/providers/codex-skill-resolver.ts +6 -0
  223. package/src/providers/dsh-adapter.ts +204 -7
  224. package/src/providers/opencode-adapter.ts +24 -3
  225. package/src/providers/pi-mono-adapter.ts +154 -5
  226. package/src/providers/pi-mono-extension.ts +1 -1
  227. package/src/providers/pricing-sources.md +5 -1
  228. package/src/providers/reasoning-effort.ts +10 -2
  229. package/src/providers/types.ts +1 -1
  230. package/src/rbac/legacy-policy.ts +3 -0
  231. package/src/rbac/permissions.ts +14 -0
  232. package/src/realtime/auth.ts +63 -1
  233. package/src/realtime/tickets.ts +52 -0
  234. package/src/realtime/transport.ts +51 -22
  235. package/src/scripts-runtime/types/stdlib.d.ts +13 -5
  236. package/src/scripts-runtime/types/swarm-extension.d.ts +7 -3
  237. package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -5
  238. package/src/tasks/context-key.ts +38 -1
  239. package/src/telemetry-context.ts +175 -0
  240. package/src/telemetry-contract/EVENTS.md +81 -0
  241. package/src/telemetry-contract/SOURCE.json +9 -0
  242. package/src/telemetry-contract/catalog.json +1335 -0
  243. package/src/telemetry-contract/index.ts +60 -0
  244. package/src/telemetry-contract/types.gen.ts +1971 -0
  245. package/src/telemetry-identity.ts +129 -0
  246. package/src/telemetry-snapshot.ts +211 -0
  247. package/src/telemetry-trigger.ts +125 -0
  248. package/src/telemetry-types.typetest.ts +40 -0
  249. package/src/telemetry.ts +271 -67
  250. package/src/tests/api-drain-e2e.test.ts +249 -0
  251. package/src/tests/api-drain-worker-e2e.test.ts +216 -0
  252. package/src/tests/api-drain.test.ts +351 -0
  253. package/src/tests/azure-devops-auth.test.ts +100 -0
  254. package/src/tests/azure-devops-handlers.test.ts +324 -0
  255. package/src/tests/azure-devops-webhook-malformed.test.ts +96 -0
  256. package/src/tests/claude-default-route.test.ts +260 -0
  257. package/src/tests/claude-managed-adapter.test.ts +47 -0
  258. package/src/tests/claude-managed-setup.test.ts +48 -0
  259. package/src/tests/claude-prompt-body-once.test.ts +117 -0
  260. package/src/tests/claude-routes-e2e.test.ts +316 -0
  261. package/src/tests/comb-config-guard.test.ts +38 -0
  262. package/src/tests/comb-links.test.ts +162 -0
  263. package/src/tests/comb-markers.test.ts +68 -0
  264. package/src/tests/comb-review-batch.test.ts +770 -0
  265. package/src/tests/comb-status.test.ts +152 -0
  266. package/src/tests/context-versions-retention.test.ts +314 -0
  267. package/src/tests/core-auth.test.ts +7 -0
  268. package/src/tests/db-retention.test.ts +14 -14
  269. package/src/tests/db-task-read-contract.test.ts +3 -0
  270. package/src/tests/db-task-write-contract.test.ts +3 -0
  271. package/src/tests/docs-index-footprint.test.js +3 -3
  272. package/src/tests/dsh-adapter.test.ts +134 -2
  273. package/src/tests/dsh-usage.test.ts +153 -0
  274. package/src/tests/extensions-catalog.test.ts +1 -0
  275. package/src/tests/extensions-example-deploy-awareness.test.ts +301 -0
  276. package/src/tests/extensions-http.test.ts +137 -10
  277. package/src/tests/extensions-mcp-tools.test.ts +28 -0
  278. package/src/tests/favorites-agent-fs-path.test.ts +226 -0
  279. package/src/tests/fetch-resolved-env.test.ts +24 -0
  280. package/src/tests/fixtures/azure-devops/pull-request-commented.json +129 -0
  281. package/src/tests/fixtures/azure-devops/pull-request-created.json +88 -0
  282. package/src/tests/fixtures/fake-claude-routes.ts +229 -0
  283. package/src/tests/github-handlers-reactions.test.ts +486 -0
  284. package/src/tests/github-reactions.test.ts +280 -0
  285. package/src/tests/harness-cli-version.test.ts +62 -0
  286. package/src/tests/http-api-integration.test.ts +21 -0
  287. package/src/tests/http-task-write-ownership.test.ts +24 -1
  288. package/src/tests/internal-ai/complete-structured.test.ts +94 -0
  289. package/src/tests/internal-ai/credentials.test.ts +22 -0
  290. package/src/tests/internal-ai/models.test.ts +36 -2
  291. package/src/tests/internal-ai/schema-parity.test.ts +25 -1
  292. package/src/tests/internal-ai/summarize-session.test.ts +23 -7
  293. package/src/tests/mcp-user-route.test.ts +133 -0
  294. package/src/tests/memory-key-paths.test.ts +1055 -0
  295. package/src/tests/memory-link-resolver.test.ts +34 -0
  296. package/src/tests/memory-rate-endpoint.test.ts +66 -0
  297. package/src/tests/memory-rater-llm-summarizer.test.ts +2 -1
  298. package/src/tests/memory-rater-llm.test.ts +73 -0
  299. package/src/tests/memory-rater-store.test.ts +31 -0
  300. package/src/tests/memory-reranker.test.ts +40 -0
  301. package/src/tests/onboarding.test.ts +108 -0
  302. package/src/tests/opencode-adapter.test.ts +57 -0
  303. package/src/tests/opencode-plugin.test.ts +4 -0
  304. package/src/tests/pi-codemode.test.ts +82 -4
  305. package/src/tests/pi-mono-adapter.test.ts +265 -2
  306. package/src/tests/pr-body-leaks.test.ts +789 -0
  307. package/src/tests/preload.ts +14 -0
  308. package/src/tests/provider-registration.test.ts +0 -2
  309. package/src/tests/providers/pi-cost.test.ts +190 -4
  310. package/src/tests/rbac-engine.test.ts +25 -1
  311. package/src/tests/realtime-room-auth.test.ts +104 -1
  312. package/src/tests/realtime-tickets.test.ts +74 -0
  313. package/src/tests/realtime-transport.test.ts +131 -4
  314. package/src/tests/runner-api-drain.test.ts +301 -0
  315. package/src/tests/runner-fallback-output.test.ts +61 -0
  316. package/src/tests/runner-fenced-json-output.test.ts +178 -0
  317. package/src/tests/runner-slot-reconcile.test.ts +199 -0
  318. package/src/tests/script-connections.test.ts +6 -0
  319. package/src/tests/send-task-requested-by.test.ts +133 -15
  320. package/src/tests/session-costs-recompute-all-providers.test.ts +23 -0
  321. package/src/tests/task-lifecycle-telemetry.test.ts +8 -3
  322. package/src/tests/task-reactions.test.ts +29 -6
  323. package/src/tests/telemetry-context.test.ts +314 -0
  324. package/src/tests/telemetry-init.test.ts +51 -19
  325. package/src/tests/telemetry-snapshot.test.ts +229 -0
  326. package/src/tests/telemetry-trigger.test.ts +200 -0
  327. package/src/tests/template-registry-helpers.ts +1 -0
  328. package/src/tests/vcs-azure-devops.test.ts +73 -0
  329. package/src/tests/webhooks-task-blocked.test.ts +23 -0
  330. package/src/tests/workflow-agent-task-retry.test.ts +363 -0
  331. package/src/tests/workflow-definition-telemetry.test.ts +4 -4
  332. package/src/tests/workflow-llm.test.ts +14 -0
  333. package/src/tools/context-diff.ts +20 -0
  334. package/src/tools/extension-install.ts +27 -16
  335. package/src/tools/memory-edit.ts +47 -3
  336. package/src/tools/memory-search.ts +13 -1
  337. package/src/tools/memory-store.ts +55 -3
  338. package/src/tools/poll-task.ts +20 -1
  339. package/src/tools/send-task.ts +9 -1
  340. package/src/tools/task-action.ts +11 -0
  341. package/src/types.ts +45 -8
  342. package/src/utils/api-drain.ts +24 -0
  343. package/src/utils/constants.ts +57 -16
  344. package/src/utils/credentials.test.ts +31 -1
  345. package/src/utils/credentials.ts +20 -9
  346. package/src/utils/dsh-usage.ts +53 -0
  347. package/src/utils/harness-cli-version.ts +6 -4
  348. package/src/utils/internal-ai/complete-structured.ts +26 -3
  349. package/src/utils/internal-ai/credentials.ts +23 -9
  350. package/src/utils/internal-ai/index.ts +8 -1
  351. package/src/utils/internal-ai/models.ts +34 -8
  352. package/src/utils/internal-ai/summarize-session.ts +22 -8
  353. package/src/utils/pr-body-leaks.ts +172 -0
  354. package/src/utils/secret-scrubber.ts +8 -0
  355. package/src/utils/task-attachment-links.ts +14 -8
  356. package/src/vcs/azure-devops.ts +80 -0
  357. package/src/vcs/index.ts +5 -1
  358. package/src/vcs/types.ts +2 -2
  359. package/src/workflows/recovery.ts +26 -1
  360. package/src/workflows/resume.ts +31 -4
  361. package/src/workflows/task-step-routing.ts +75 -2
  362. package/templates/community/open-prompt-showreel/PLAYBOOK.md +336 -0
  363. package/templates/community/open-prompt-showreel/README.md +33 -0
  364. package/templates/community/open-prompt-showreel/example/tla-races/facts.ts +145 -0
  365. package/templates/community/open-prompt-showreel/example/tla-races/facts.v3.json +140 -0
  366. package/templates/community/open-prompt-showreel/example/tla-races/music.mist-city.json +8 -0
  367. package/templates/community/open-prompt-showreel/example/tla-races/reel.html +805 -0
  368. package/templates/community/open-prompt-showreel/example/tla-races/smoke.sh +48 -0
  369. package/templates/community/open-prompt-showreel/lead-prompt.md +89 -0
  370. package/templates/community/open-prompt-showreel/setup.sh +167 -0
  371. package/templates/community/open-prompt-showreel/skills/motion-design-replication/SKILL.md +85 -0
  372. package/templates/community/open-prompt-showreel/skills/motion-design-video-analysis/SKILL.md +115 -0
  373. package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +147 -0
  374. package/templates/community/open-prompt-showreel/skills/video-generation/SKILL.md +195 -0
  375. package/templates/community/open-prompt-showreel/tools/fetch-music.sh +65 -0
  376. package/templates/community/open-prompt-showreel/tools/music-analyze.py +69 -0
  377. package/templates/community/open-prompt-showreel/tools/music-current.sh +34 -0
  378. package/templates/community/open-prompt-showreel/tools/music-cut.sh +36 -0
  379. package/templates/community/open-prompt-showreel/tools/music-refine.py +39 -0
  380. package/templates/community/open-prompt-showreel/tools/render.mjs +157 -0
  381. package/templates/community/open-prompt-showreel/tools/sheet.sh +44 -0
  382. package/templates/community/open-prompt-showreel/tools/web-compress.sh +17 -0
  383. package/templates/community/open-prompt-showreel/tools/x-reencode.sh +21 -0
  384. package/templates/extensions/README.md +1 -0
  385. package/templates/extensions/deploy-awareness/README.md +28 -0
  386. package/templates/extensions/deploy-awareness/hooks.ts +152 -0
  387. package/templates/extensions/deploy-awareness/manifest.json +8 -0
  388. package/templates/skills/memory/config.json +2 -2
  389. package/templates/skills/memory/content.md +59 -5
  390. package/templates/skills/swarm-extensions/config.json +1 -1
  391. package/templates/skills/swarm-extensions/content.md +28 -5
  392. package/tsconfig.json +3 -0
  393. package/dist/boot-seeds-gsetbs5y.js +0 -28
  394. package/dist/cli-j490egb5.js +0 -5632
  395. package/dist/cli-tjf4cn8z.js +0 -9119
  396. package/dist/cli-tmqt7dpj.js +0 -572
  397. package/dist/dsh-adapter-mpnzgztj.js +0 -19
  398. package/dist/index-7aj368tw.js +0 -30
@@ -15,6 +15,7 @@
15
15
 
16
16
  import {
17
17
  claudeCatalogModelId,
18
+ dshCatalogRef,
18
19
  REASONING_EFFORT_LEVELS,
19
20
  type ReasoningEffortLevel,
20
21
  reasoningLevelsFor,
@@ -25,8 +26,8 @@ import { runtimeCatalogModel, runtimeCatalogSection } from "../utils/runtime-mod
25
26
  export { REASONING_EFFORT_LEVELS };
26
27
  export type ReasoningEffort = ReasoningEffortLevel;
27
28
 
28
- /** The four local harnesses this feature covers (Devin / claude-managed are out of scope). */
29
- export type ReasoningHarness = "claude" | "codex" | "pi" | "opencode";
29
+ /** The local harnesses this feature covers (Devin / claude-managed / ACP are out of scope). */
30
+ export type ReasoningHarness = "claude" | "codex" | "pi" | "opencode" | "dsh";
30
31
 
31
32
  export interface ReasoningCapability {
32
33
  supported: boolean;
@@ -50,6 +51,7 @@ export type ReasoningEffortApplication =
50
51
  modelId: string;
51
52
  options: Record<string, unknown>;
52
53
  }
54
+ | { kind: "dsh-effort"; reasoningEffort: ReasoningEffort }
53
55
  | { kind: "noop" };
54
56
 
55
57
  // --- Capability lookup --------------------------------------------------------
@@ -81,6 +83,8 @@ function lookupModel(
81
83
  } else if (harness === "codex") {
82
84
  providerId = "openai";
83
85
  modelId = model;
86
+ } else if (harness === "dsh") {
87
+ ({ providerId, modelId } = dshCatalogRef(model));
84
88
  } else {
85
89
  ({ providerId, modelId } = splitProviderModel(model));
86
90
  if (!providerId) return undefined;
@@ -201,6 +205,10 @@ export function applyReasoningEffort(
201
205
  return applyPiEffort(level);
202
206
  case "opencode":
203
207
  return applyOpencodeEffort(model, level);
208
+ case "dsh":
209
+ // dsh's own level names match the normalized enum; the adapter decides
210
+ // the per-route transport (see `src/providers/dsh-adapter.ts`).
211
+ return { kind: "dsh-effort", reasoningEffort: level };
204
212
  default: {
205
213
  const _exhaustive: never = harness;
206
214
  return _exhaustive;
@@ -46,7 +46,7 @@ export interface CostData {
46
46
  * for every provider with seeded pricing rows, so every adapter should
47
47
  * populate this field.
48
48
  */
49
- provider?: "claude" | "claude-managed" | "codex" | "pi" | "opencode" | "devin" | "acp";
49
+ provider?: "claude" | "claude-managed" | "codex" | "pi" | "opencode" | "devin" | "acp" | "dsh";
50
50
  }
51
51
 
52
52
  import type { ProviderName, SteerMode } from "../types";
@@ -267,6 +267,7 @@ export const LEGACY_POLICY = {
267
267
  "favorite.write.own": anyAuthenticated,
268
268
  "memory.learning.inject": leadOnly,
269
269
  "memory.edit.any": leadOrResourceOwner,
270
+ "memory.write.consolidated": leadOnly,
270
271
  "memory.delete.any": memoryOwnerOrLeadSwarm,
271
272
  "channel.delete": leadOnly,
272
273
  "integration.kapso.manage": leadOnly,
@@ -304,6 +305,7 @@ export const LEGACY_POLICY = {
304
305
  "mcp-server.read.secrets": leadOnly,
305
306
  "mcp-oauth.authorize.any": anyAuthenticated,
306
307
  "kv.write.any": leadOrOwnNamespace,
308
+ "comb.presence": operatorOrUser,
307
309
  "page.delete.any": leadOrResourceOwner,
308
310
  "app.manage": anyAuthenticated,
309
311
  "app.use": anyAuthenticated,
@@ -317,4 +319,5 @@ export const LEGACY_POLICY = {
317
319
  "script.api.delete": leadOnly,
318
320
  "extension.write": extensionWrite,
319
321
  "extension.activate": extensionActivation,
322
+ "extension.install.inline": leadOrOperatorOrUser,
320
323
  } as const satisfies Record<PermissionVerb, LegacyRule>;
@@ -82,6 +82,11 @@ export const PERMISSIONS = {
82
82
  description: "Edit a memory entry (own entries, or any scope as lead).",
83
83
  namespace: "memory",
84
84
  },
85
+ "memory.write.consolidated": {
86
+ description:
87
+ "Write or move a memory key under a lead-maintained /longterm root (company-story, entities, timeline).",
88
+ namespace: "memory",
89
+ },
85
90
  "memory.delete.any": {
86
91
  description: "Delete a memory entry (own entries, or swarm-scoped entries as lead).",
87
92
  namespace: "memory",
@@ -232,6 +237,10 @@ export const PERMISSIONS = {
232
237
  description: "Write another agent's task:agent: KV namespace.",
233
238
  namespace: "kv",
234
239
  },
240
+ "comb.presence": {
241
+ description: "Use dashboard presence rooms for Comb drives.",
242
+ namespace: "comb",
243
+ },
235
244
  "page.delete.any": {
236
245
  description: "Delete a page the caller does not own.",
237
246
  namespace: "page",
@@ -284,6 +293,11 @@ export const PERMISSIONS = {
284
293
  description: "Enable, disable, or activate a version of a swarm extension.",
285
294
  namespace: "extension",
286
295
  },
296
+ "extension.install.inline": {
297
+ description:
298
+ "Install a swarm extension from an inline manifest and files instead of the catalog.",
299
+ namespace: "extension",
300
+ },
287
301
  } as const satisfies Record<string, { description: string; namespace: string }>;
288
302
 
289
303
  export type PermissionVerb = keyof typeof PERMISSIONS;
@@ -1,6 +1,7 @@
1
1
  import type { IncomingMessage } from "node:http";
2
2
  import { getAgentById, getTaskById } from "../be/db";
3
3
  import { getUserGrant } from "../be/rbac-roles";
4
+ import { getCombConfig } from "../comb/config";
4
5
  import { mcpOverflowAuthError } from "../kv-overflow";
5
6
  import { reservedNamespaceError } from "../kv-reserved-namespaces";
6
7
  import { can, isRbacEnabled } from "../rbac";
@@ -24,6 +25,20 @@ export type ResolvedRoomNamespace = {
24
25
  source: "page" | "explicit" | "task" | "agent";
25
26
  };
26
27
 
28
+ export type RoomNamespaceOperation =
29
+ | "join"
30
+ | "leave"
31
+ | "update"
32
+ | "change"
33
+ | "reset"
34
+ | "presence"
35
+ | "subscribe"
36
+ | "unsubscribe"
37
+ | "publish";
38
+
39
+ const COMB_PRESENCE_NAMESPACE = /^presence:comb:[A-Za-z0-9_-]{1,64}:[A-Za-z0-9_-]{1,64}$/;
40
+ const COMB_PRESENCE_OPERATIONS = new Set<RoomNamespaceOperation>(["join", "leave", "presence"]);
41
+
27
42
  function pageNamespace(pageId: string): string | null {
28
43
  try {
29
44
  return pageContextKey({ pageId });
@@ -86,14 +101,61 @@ export function roomRequestInfo(
86
101
  export async function authorizeRoomNamespace(
87
102
  namespace: string,
88
103
  info: RoomAuthorizationInfo,
89
- write: boolean,
104
+ access: boolean | RoomNamespaceOperation,
90
105
  ): Promise<string | null> {
91
106
  const overflowError = mcpOverflowAuthError(namespace, info.agentId);
92
107
  if (overflowError) return overflowError;
93
108
 
109
+ if (namespace.startsWith("presence:comb:")) {
110
+ if (!COMB_PRESENCE_NAMESPACE.test(namespace)) {
111
+ return "invalid Comb presence namespace";
112
+ }
113
+ // Presence is for the swarm's shared Comb drive only, and only while Comb is on.
114
+ const comb = getCombConfig();
115
+ if (!comb.enabled) return "Comb is off";
116
+ if (
117
+ !comb.orgId ||
118
+ !comb.driveId ||
119
+ namespace !== `presence:comb:${comb.orgId}:${comb.driveId}`
120
+ ) {
121
+ return "Comb presence is only available for the configured Comb drive";
122
+ }
123
+ if (info.pageId || info.agentId || (!info.isOperator && !info.userId)) {
124
+ return "Comb presence requires dashboard authentication";
125
+ }
126
+ if (typeof access !== "string" || !COMB_PRESENCE_OPERATIONS.has(access)) {
127
+ return "Comb presence rooms only allow join, leave, and presence";
128
+ }
129
+
130
+ const principal = info.isOperator
131
+ ? ({ kind: "operator" } as const)
132
+ : ({ kind: "user", userId: info.userId! } as const);
133
+ if (
134
+ !can({
135
+ principal,
136
+ verb: "comb.presence",
137
+ resource: { kind: "kv-namespace", namespace },
138
+ source: info.callOrigin === "mcp" ? "mcp" : "http",
139
+ }).allow
140
+ ) {
141
+ return "Comb presence requires the comb.presence permission";
142
+ }
143
+ if (info.userId && isRbacEnabled()) {
144
+ const grant = await getUserGrant(info.userId);
145
+ if (!grant.grantsAll && !grant.verbs.has("comb.presence")) {
146
+ return "Comb presence requires the comb.presence permission";
147
+ }
148
+ }
149
+ return null;
150
+ }
151
+
94
152
  const reservedError = reservedNamespaceError(namespace);
95
153
  if (reservedError) return reservedError;
96
154
 
155
+ const write =
156
+ typeof access === "boolean"
157
+ ? access
158
+ : ["update", "change", "reset", "presence", "publish"].includes(access);
97
159
  if (!write) return null;
98
160
 
99
161
  if (info.userId && !info.isOperator && isRbacEnabled()) {
@@ -0,0 +1,52 @@
1
+ import type { HttpRequestAuth } from "../utils/request-auth-context";
2
+
3
+ export const REALTIME_TICKET_TTL_MS = 60_000;
4
+ export const REALTIME_TICKET_CAPACITY = 10_000;
5
+
6
+ export type RealtimeTicketAuth = Extract<HttpRequestAuth, { kind: "operator" | "user" }>;
7
+
8
+ type StoredTicket = {
9
+ auth: RealtimeTicketAuth;
10
+ expiresAt: number;
11
+ };
12
+
13
+ const tickets = new Map<string, StoredTicket>();
14
+
15
+ export function sweepRealtimeTickets(now = Date.now()): number {
16
+ let removed = 0;
17
+ for (const [ticket, entry] of tickets) {
18
+ if (entry.expiresAt > now) continue;
19
+ tickets.delete(ticket);
20
+ removed++;
21
+ }
22
+ return removed;
23
+ }
24
+
25
+ export function issueRealtimeTicket(
26
+ auth: RealtimeTicketAuth,
27
+ now = Date.now(),
28
+ ): { ticket: string; expiresAt: number } {
29
+ sweepRealtimeTickets(now);
30
+ while (tickets.size >= REALTIME_TICKET_CAPACITY) {
31
+ const oldest = tickets.keys().next().value;
32
+ if (oldest === undefined) break;
33
+ tickets.delete(oldest);
34
+ }
35
+
36
+ let ticket: string;
37
+ do {
38
+ const bytes = crypto.getRandomValues(new Uint8Array(24));
39
+ ticket = Buffer.from(bytes).toString("base64url");
40
+ } while (tickets.has(ticket));
41
+
42
+ const expiresAt = now + REALTIME_TICKET_TTL_MS;
43
+ tickets.set(ticket, { auth, expiresAt });
44
+ return { ticket, expiresAt };
45
+ }
46
+
47
+ export function redeemRealtimeTicket(ticket: string, now = Date.now()): RealtimeTicketAuth | null {
48
+ const entry = tickets.get(ticket);
49
+ if (!entry) return null;
50
+ tickets.delete(ticket);
51
+ return entry.expiresAt > now ? entry.auth : null;
52
+ }
@@ -7,6 +7,7 @@ import { findUserById } from "../be/users";
7
7
  import { resolveHttpRequestAuth } from "../http/auth";
8
8
  import { getApiKey } from "../utils/api-key";
9
9
  import { extractAndVerifyCookie } from "../utils/page-session";
10
+ import type { HttpRequestAuth } from "../utils/request-auth-context";
10
11
  import { scrubSecrets } from "../utils/secret-scrubber";
11
12
  import { authorizeRoomNamespace, resolveRoomNamespace } from "./auth";
12
13
  import { realtimeBus } from "./bus";
@@ -20,6 +21,7 @@ import {
20
21
  roomTopic,
21
22
  roomView,
22
23
  } from "./rooms";
24
+ import { redeemRealtimeTicket } from "./tickets";
23
25
 
24
26
  const nameSchema = z.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
25
27
  const messageSchema = z.object({
@@ -56,14 +58,47 @@ type Identity = {
56
58
  isOperator?: boolean;
57
59
  };
58
60
  type Viewer = { userId: string; name: string; kind: "user" | "guest" | "agent" };
61
+ type AuthenticatedConnection = {
62
+ identity: Identity;
63
+ me: Viewer;
64
+ expiresAt: number | undefined;
65
+ };
59
66
 
60
67
  function header(req: IncomingMessage, name: string): string | undefined {
61
68
  const value = req.headers[name];
62
69
  return Array.isArray(value) ? value[0] : value;
63
70
  }
64
71
 
65
- async function authenticate(req: IncomingMessage) {
72
+ function identityFromHttpAuth(
73
+ req: IncomingMessage,
74
+ auth: HttpRequestAuth,
75
+ ): AuthenticatedConnection {
76
+ const agentId = auth.kind === "operator" ? header(req, "x-agent-id") : undefined;
77
+ const guestId = `guest-${crypto.randomUUID()}`;
78
+ return {
79
+ identity: {
80
+ agentId,
81
+ sourceTaskId: header(req, "x-source-task-id"),
82
+ userId: auth.kind === "user" ? auth.userId : undefined,
83
+ isOperator: auth.kind === "operator",
84
+ } satisfies Identity,
85
+ me: {
86
+ userId: auth.kind === "user" ? auth.userId : (agentId ?? guestId),
87
+ name: auth.kind === "user" ? auth.user.name : (agentId ?? `Guest ${guestId.slice(-6)}`),
88
+ kind: auth.kind === "user" ? "user" : agentId ? "agent" : "guest",
89
+ } as Viewer,
90
+ expiresAt: undefined,
91
+ };
92
+ }
93
+
94
+ async function authenticate(req: IncomingMessage): Promise<AuthenticatedConnection> {
66
95
  const url = new URL(req.url ?? "/", "http://localhost");
96
+ const ticket = url.searchParams.get("ticket");
97
+ if (ticket) {
98
+ const auth = redeemRealtimeTicket(ticket);
99
+ if (!auth) throw new Error("Authentication required");
100
+ return identityFromHttpAuth(req, auth);
101
+ }
67
102
  const pageId = url.searchParams.get("pageId");
68
103
  if (pageId) {
69
104
  // Browser credentials must never authorize cross-origin socket requests.
@@ -90,22 +125,7 @@ async function authenticate(req: IncomingMessage) {
90
125
  }
91
126
  const auth = await resolveHttpRequestAuth(req, getApiKey());
92
127
  if (!auth) throw new Error("Authentication required");
93
- const agentId = auth.kind === "operator" ? header(req, "x-agent-id") : undefined;
94
- const guestId = `guest-${crypto.randomUUID()}`;
95
- return {
96
- identity: {
97
- agentId,
98
- sourceTaskId: header(req, "x-source-task-id"),
99
- userId: auth.kind === "user" ? auth.userId : undefined,
100
- isOperator: auth.kind === "operator",
101
- } satisfies Identity,
102
- me: {
103
- userId: auth.kind === "user" ? auth.userId : (agentId ?? guestId),
104
- name: auth.kind === "user" ? auth.user.name : (agentId ?? `Guest ${guestId.slice(-6)}`),
105
- kind: auth.kind === "user" ? "user" : agentId ? "agent" : "guest",
106
- } as Viewer,
107
- expiresAt: undefined,
108
- };
128
+ return identityFromHttpAuth(req, auth);
109
129
  }
110
130
 
111
131
  function channelTopic(namespace: string, name: string): string {
@@ -116,11 +136,12 @@ export function attachRealtimeTransport(server: Server): () => void {
116
136
  const wss = new WebSocketServer({ noServer: true, maxPayload: 3 * 1024 * 1024 });
117
137
  let pendingUpgrades = 0;
118
138
  let closing = false;
119
- // The dedicated path bypasses HTTP proxying. Authentication precedes upgrade.
139
+ // Authentication precedes upgrade on both direct and proxied paths.
120
140
  const onUpgrade = (req: IncomingMessage, socket: import("node:stream").Duplex, head: Buffer) => {
141
+ const path = req.url?.split("?")[0];
121
142
  if (
122
143
  closing ||
123
- req.url?.split("?")[0] !== "/@swarm/realtime" ||
144
+ (path !== "/@swarm/realtime" && path !== "/api/realtime") ||
124
145
  wss.clients.size + pendingUpgrades >= 1000
125
146
  ) {
126
147
  socket.destroy();
@@ -227,8 +248,10 @@ function connect(ws: WebSocket, auth: Awaited<ReturnType<typeof authenticate>>):
227
248
  const resolved = await resolveRoomNamespace(msg.namespace, auth.identity);
228
249
  if ("error" in resolved) throw new Error(resolved.error);
229
250
  const namespace = resolved.namespace;
230
- const write = ["update", "change", "reset", "presence", "publish"].includes(msg.op);
231
- const denied = await authorizeRoomNamespace(namespace, auth.identity, write);
251
+ if (namespace.startsWith("presence:comb:") && msg.name !== "default") {
252
+ throw new Error("Comb presence uses the default room");
253
+ }
254
+ const denied = await authorizeRoomNamespace(namespace, auth.identity, msg.op);
232
255
  if (denied) throw new Error(typeof denied === "string" ? denied : "Forbidden");
233
256
  if (closed) return;
234
257
  const key = roomTopic(namespace, msg.name);
@@ -261,7 +284,13 @@ function connect(ws: WebSocket, auth: Awaited<ReturnType<typeof authenticate>>):
261
284
  room = await getRoom(namespace, msg.name, msg.schemaVersion, { create: false });
262
285
  } catch (error) {
263
286
  if (!(error instanceof Error) || error.message !== "room does not exist") throw error;
264
- const creationDenied = await authorizeRoomNamespace(namespace, auth.identity, true);
287
+ // Creating a room is a write. Comb presence rooms take only presence
288
+ // operations, so they check creation as a join.
289
+ const creationDenied = await authorizeRoomNamespace(
290
+ namespace,
291
+ auth.identity,
292
+ namespace.startsWith("presence:comb:") ? "join" : true,
293
+ );
265
294
  if (creationDenied) throw new Error(creationDenied);
266
295
  if (closed) return;
267
296
  room = await getRoom(namespace, msg.name, msg.schemaVersion);
@@ -175,6 +175,7 @@ declare module "swarm-sdk" {
175
175
  scope?: "all" | "agent" | "swarm";
176
176
  limit?: number;
177
177
  source?: string;
178
+ keyPrefix?: string;
178
179
  }): Promise<unknown>;
179
180
  memory_get(args: { memoryId: string; intent: string }): Promise<unknown>;
180
181
  memory_rate(args: { id: string; useful: boolean; note?: string }): Promise<unknown>;
@@ -392,6 +393,7 @@ declare module "swarm-sdk" {
392
393
  tags?: string[];
393
394
  taskId?: string;
394
395
  intent?: string;
396
+ key?: string;
395
397
  }): Promise<unknown>;
396
398
  memory_edit(args: {
397
399
  memoryId?: string;
@@ -403,6 +405,7 @@ declare module "swarm-sdk" {
403
405
  newString?: string;
404
406
  intent: string;
405
407
  expectedVersion?: number;
408
+ newKey?: string;
406
409
  }): Promise<unknown>;
407
410
  inject_learning(args: {
408
411
  content: string;
@@ -534,11 +537,16 @@ declare module "swarm-sdk" {
534
537
 
535
538
  // --- write: extensions ---
536
539
  extension_catalog(args?: Record<string, never>): Promise<unknown>;
537
- extension_install(args: {
538
- template: string;
539
- priority?: number;
540
- config?: Record<string, unknown>;
541
- }): Promise<unknown>;
540
+ extension_install(
541
+ args:
542
+ | { template: string; priority?: number; config?: Record<string, unknown> }
543
+ | {
544
+ manifest: Record<string, unknown>;
545
+ files: Record<string, string>;
546
+ priority?: number;
547
+ config?: Record<string, unknown>;
548
+ },
549
+ ): Promise<unknown>;
542
550
  extension_list(args?: { enabledOnly?: boolean }): Promise<unknown>;
543
551
  extension_delete(args: { id: string }): Promise<unknown>;
544
552
  extension_enable(args: { id: string }): Promise<unknown>;
@@ -14,9 +14,11 @@ declare module "swarm-extension" {
14
14
  | "ui"
15
15
  | "github"
16
16
  | "gitlab"
17
+ | "azure-devops"
17
18
  | "system"
18
19
  | "linear"
19
20
  | "jira"
21
+ | "comb"
20
22
  | undefined;
21
23
  routingReason?:
22
24
  | "skill"
@@ -38,7 +40,7 @@ declare module "swarm-extension" {
38
40
  slackTriggerMessageTs?: string | undefined;
39
41
  slackUserId?: string | undefined;
40
42
  overrideSlackContext?: boolean | undefined;
41
- vcsProvider?: "github" | "gitlab" | undefined;
43
+ vcsProvider?: "github" | "gitlab" | "azure-devops" | undefined;
42
44
  vcsRepo?: string | undefined;
43
45
  vcsEventType?: string | undefined;
44
46
  vcsNumber?: number | undefined;
@@ -123,9 +125,11 @@ declare module "swarm-extension" {
123
125
  | "ui"
124
126
  | "github"
125
127
  | "gitlab"
128
+ | "azure-devops"
126
129
  | "system"
127
130
  | "linear"
128
- | "jira";
131
+ | "jira"
132
+ | "comb";
129
133
  tags: string[];
130
134
  priority: number;
131
135
  dependsOn: string[];
@@ -160,7 +164,7 @@ declare module "swarm-extension" {
160
164
  slackUserId?: string | undefined;
161
165
  slackProgressMessageTs?: string | undefined;
162
166
  slackTreeRootMessageTs?: string | undefined;
163
- vcsProvider?: "github" | "gitlab" | undefined;
167
+ vcsProvider?: "github" | "gitlab" | "azure-devops" | undefined;
164
168
  vcsRepo?: string | undefined;
165
169
  vcsEventType?: string | undefined;
166
170
  vcsNumber?: number | undefined;
@@ -157,6 +157,7 @@ declare module "swarm-sdk" {
157
157
  scope?: "all" | "agent" | "swarm";
158
158
  limit?: number;
159
159
  source?: string;
160
+ keyPrefix?: string;
160
161
  }): Promise<unknown>;
161
162
  memory_get(args: { memoryId: string; intent: string }): Promise<unknown>;
162
163
  memory_rate(args: { id: string; useful: boolean; note?: string }): Promise<unknown>;
@@ -374,6 +375,7 @@ declare module "swarm-sdk" {
374
375
  tags?: string[];
375
376
  taskId?: string;
376
377
  intent?: string;
378
+ key?: string;
377
379
  }): Promise<unknown>;
378
380
  memory_edit(args: {
379
381
  memoryId?: string;
@@ -385,6 +387,7 @@ declare module "swarm-sdk" {
385
387
  newString?: string;
386
388
  intent: string;
387
389
  expectedVersion?: number;
390
+ newKey?: string;
388
391
  }): Promise<unknown>;
389
392
  inject_learning(args: {
390
393
  content: string;
@@ -516,11 +519,16 @@ declare module "swarm-sdk" {
516
519
 
517
520
  // --- write: extensions ---
518
521
  extension_catalog(args?: Record<string, never>): Promise<unknown>;
519
- extension_install(args: {
520
- template: string;
521
- priority?: number;
522
- config?: Record<string, unknown>;
523
- }): Promise<unknown>;
522
+ extension_install(
523
+ args:
524
+ | { template: string; priority?: number; config?: Record<string, unknown> }
525
+ | {
526
+ manifest: Record<string, unknown>;
527
+ files: Record<string, string>;
528
+ priority?: number;
529
+ config?: Record<string, unknown>;
530
+ },
531
+ ): Promise<unknown>;
524
532
  extension_list(args?: { enabledOnly?: boolean }): Promise<unknown>;
525
533
  extension_delete(args: { id: string }): Promise<unknown>;
526
534
  extension_enable(args: { id: string }): Promise<unknown>;
@@ -16,6 +16,7 @@
16
16
  * task:agentmail:{threadId}
17
17
  * task:trackers:github:{owner}:{repo}:{issue|pr}:{number}
18
18
  * task:trackers:gitlab:{projectId}:{mr|issue}:{iid}
19
+ * task:trackers:azure-devops:{repositoryId}:pr:{pullRequestId}
19
20
  * task:trackers:linear:{issueIdentifier} (e.g. DES-42 — case preserved)
20
21
  * task:trackers:jira:{issueIdentifier} (e.g. PROJ-123 — case preserved)
21
22
  * task:schedule:{scheduleId}
@@ -39,7 +40,7 @@ const SEPARATOR = ":";
39
40
 
40
41
  export type ContextKeyFamily = "slack" | "agentmail" | "trackers" | "schedule" | "workflow";
41
42
 
42
- export type TrackerProvider = "github" | "gitlab" | "linear" | "jira";
43
+ export type TrackerProvider = "github" | "gitlab" | "azure-devops" | "linear" | "jira";
43
44
 
44
45
  export type ParsedContextKey =
45
46
  | { family: "slack"; parts: { channelId: string; threadTs: string } }
@@ -54,6 +55,11 @@ export type ParsedContextKey =
54
55
  subFamily: "gitlab";
55
56
  parts: { projectId: string; kind: "mr" | "issue"; iid: number };
56
57
  }
58
+ | {
59
+ family: "trackers";
60
+ subFamily: "azure-devops";
61
+ parts: { repositoryId: string; kind: "pr"; pullRequestId: number };
62
+ }
57
63
  | {
58
64
  family: "trackers";
59
65
  subFamily: "linear";
@@ -138,6 +144,20 @@ export function gitlabContextKey(input: {
138
144
  return ["task", "trackers", "gitlab", projectId, kind, iid].join(SEPARATOR);
139
145
  }
140
146
 
147
+ export function azureDevOpsContextKey(input: {
148
+ repositoryId: string;
149
+ pullRequestId: number;
150
+ }): string {
151
+ const repositoryId = assertSafePart(input.repositoryId, "repositoryId");
152
+ const pullRequestId = assertSafePart(input.pullRequestId, "pullRequestId");
153
+ if (!/^\d+$/.test(pullRequestId)) {
154
+ throw new Error(
155
+ `context-key: azure-devops "pullRequestId" must be a positive integer (got ${JSON.stringify(pullRequestId)})`,
156
+ );
157
+ }
158
+ return ["task", "trackers", "azure-devops", repositoryId, "pr", pullRequestId].join(SEPARATOR);
159
+ }
160
+
141
161
  export function linearContextKey(input: { issueIdentifier: string }): string {
142
162
  const issueIdentifier = assertSafePart(input.issueIdentifier, "issueIdentifier");
143
163
  return ["task", "trackers", "linear", issueIdentifier].join(SEPARATOR);
@@ -272,6 +292,23 @@ export function parseContextKey(key: string): ParsedContextKey {
272
292
  parts: { projectId, kind, iid },
273
293
  };
274
294
  }
295
+ if (subFamily === "azure-devops") {
296
+ if (parts.length !== 6 || parts[4] !== "pr") {
297
+ throw new Error(`context-key: malformed azure-devops key: ${JSON.stringify(key)}`);
298
+ }
299
+ const idStr = parts[5] as string;
300
+ const pullRequestId = Number.parseInt(idStr, 10);
301
+ if (!Number.isFinite(pullRequestId)) {
302
+ throw new Error(
303
+ `context-key: malformed azure-devops pullRequestId "${idStr}": ${JSON.stringify(key)}`,
304
+ );
305
+ }
306
+ return {
307
+ family: "trackers",
308
+ subFamily: "azure-devops",
309
+ parts: { repositoryId: parts[3] as string, kind: "pr", pullRequestId },
310
+ };
311
+ }
275
312
  if (subFamily === "linear") {
276
313
  if (parts.length !== 4) {
277
314
  throw new Error(`context-key: malformed linear key: ${JSON.stringify(key)}`);