oh-my-copilot 5.18.2 → 5.19.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 (326) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +206 -104
  4. package/bridge/__pycache__/gyoshu_bridge.cpython-314.pyc +0 -0
  5. package/bridge/claude-md-coordinator.cjs +2 -2
  6. package/bridge/cli.cjs +7155 -4471
  7. package/bridge/mcp-server.cjs +2470 -1027
  8. package/bridge/runtime-cli.cjs +102 -12
  9. package/bridge/team-mcp.cjs +100 -11
  10. package/bridge/team.js +100 -11
  11. package/dist/budget/ledger.d.ts +5 -0
  12. package/dist/budget/ledger.d.ts.map +1 -1
  13. package/dist/budget/ledger.js +2 -1
  14. package/dist/budget/ledger.js.map +1 -1
  15. package/dist/cli/commands/__tests__/factory-forge-cli.test.js +3 -3
  16. package/dist/cli/commands/__tests__/factory-forge-cli.test.js.map +1 -1
  17. package/dist/cli/commands/__tests__/factory-init.test.js +239 -17
  18. package/dist/cli/commands/__tests__/factory-init.test.js.map +1 -1
  19. package/dist/cli/commands/__tests__/factory-run-cli.test.js +103 -2
  20. package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
  21. package/dist/cli/commands/factory-board.d.ts +9 -0
  22. package/dist/cli/commands/factory-board.d.ts.map +1 -0
  23. package/dist/cli/commands/factory-board.js +34 -0
  24. package/dist/cli/commands/factory-board.js.map +1 -0
  25. package/dist/cli/commands/factory-check.d.ts +1 -0
  26. package/dist/cli/commands/factory-check.d.ts.map +1 -1
  27. package/dist/cli/commands/factory-check.js +2 -1
  28. package/dist/cli/commands/factory-check.js.map +1 -1
  29. package/dist/cli/commands/factory-poll.d.ts +9 -0
  30. package/dist/cli/commands/factory-poll.d.ts.map +1 -0
  31. package/dist/cli/commands/factory-poll.js +34 -0
  32. package/dist/cli/commands/factory-poll.js.map +1 -0
  33. package/dist/cli/commands/factory-setup.d.ts +2 -0
  34. package/dist/cli/commands/factory-setup.d.ts.map +1 -1
  35. package/dist/cli/commands/factory-setup.js +9 -3
  36. package/dist/cli/commands/factory-setup.js.map +1 -1
  37. package/dist/cli/commands/factory.d.ts +61 -18
  38. package/dist/cli/commands/factory.d.ts.map +1 -1
  39. package/dist/cli/commands/factory.js +325 -53
  40. package/dist/cli/commands/factory.js.map +1 -1
  41. package/dist/factory/__tests__/check-run.test.js +37 -96
  42. package/dist/factory/__tests__/check-run.test.js.map +1 -1
  43. package/dist/factory/__tests__/enqueue-ado.test.d.ts +2 -0
  44. package/dist/factory/__tests__/enqueue-ado.test.d.ts.map +1 -0
  45. package/dist/factory/__tests__/enqueue-ado.test.js +375 -0
  46. package/dist/factory/__tests__/enqueue-ado.test.js.map +1 -0
  47. package/dist/factory/__tests__/enqueue.test.d.ts +2 -0
  48. package/dist/factory/__tests__/enqueue.test.d.ts.map +1 -0
  49. package/dist/factory/__tests__/enqueue.test.js +470 -0
  50. package/dist/factory/__tests__/enqueue.test.js.map +1 -0
  51. package/dist/factory/__tests__/heal-ado.test.d.ts +2 -0
  52. package/dist/factory/__tests__/heal-ado.test.d.ts.map +1 -0
  53. package/dist/factory/__tests__/heal-ado.test.js +237 -0
  54. package/dist/factory/__tests__/heal-ado.test.js.map +1 -0
  55. package/dist/factory/__tests__/listener.test.js +27 -9
  56. package/dist/factory/__tests__/listener.test.js.map +1 -1
  57. package/dist/factory/__tests__/map-frontier.test.js +68 -0
  58. package/dist/factory/__tests__/map-frontier.test.js.map +1 -1
  59. package/dist/factory/__tests__/map-ingest.test.js +4 -3
  60. package/dist/factory/__tests__/map-ingest.test.js.map +1 -1
  61. package/dist/factory/__tests__/poll-ado.test.d.ts +2 -0
  62. package/dist/factory/__tests__/poll-ado.test.d.ts.map +1 -0
  63. package/dist/factory/__tests__/poll-ado.test.js +263 -0
  64. package/dist/factory/__tests__/poll-ado.test.js.map +1 -0
  65. package/dist/factory/__tests__/poll.test.d.ts +2 -0
  66. package/dist/factory/__tests__/poll.test.d.ts.map +1 -0
  67. package/dist/factory/__tests__/poll.test.js +748 -0
  68. package/dist/factory/__tests__/poll.test.js.map +1 -0
  69. package/dist/factory/board/__tests__/board-ado.test.d.ts +2 -0
  70. package/dist/factory/board/__tests__/board-ado.test.d.ts.map +1 -0
  71. package/dist/factory/board/__tests__/board-ado.test.js +194 -0
  72. package/dist/factory/board/__tests__/board-ado.test.js.map +1 -0
  73. package/dist/factory/board/__tests__/board.test.d.ts +2 -0
  74. package/dist/factory/board/__tests__/board.test.d.ts.map +1 -0
  75. package/dist/factory/board/__tests__/board.test.js +287 -0
  76. package/dist/factory/board/__tests__/board.test.js.map +1 -0
  77. package/dist/factory/board/collect.d.ts +145 -0
  78. package/dist/factory/board/collect.d.ts.map +1 -0
  79. package/dist/factory/board/collect.js +330 -0
  80. package/dist/factory/board/collect.js.map +1 -0
  81. package/dist/factory/board/render.d.ts +12 -0
  82. package/dist/factory/board/render.d.ts.map +1 -0
  83. package/dist/factory/board/render.js +93 -0
  84. package/dist/factory/board/render.js.map +1 -0
  85. package/dist/factory/check/__tests__/ado.test.js +14 -1
  86. package/dist/factory/check/__tests__/ado.test.js.map +1 -1
  87. package/dist/factory/check/__tests__/cli.test.js +38 -0
  88. package/dist/factory/check/__tests__/cli.test.js.map +1 -1
  89. package/dist/factory/check/__tests__/rules.test.js +72 -2
  90. package/dist/factory/check/__tests__/rules.test.js.map +1 -1
  91. package/dist/factory/check/cli.d.ts +34 -6
  92. package/dist/factory/check/cli.d.ts.map +1 -1
  93. package/dist/factory/check/cli.js +56 -34
  94. package/dist/factory/check/cli.js.map +1 -1
  95. package/dist/factory/check/rules.d.ts +11 -3
  96. package/dist/factory/check/rules.d.ts.map +1 -1
  97. package/dist/factory/check/rules.js +18 -5
  98. package/dist/factory/check/rules.js.map +1 -1
  99. package/dist/factory/check/score.d.ts +22 -2
  100. package/dist/factory/check/score.d.ts.map +1 -1
  101. package/dist/factory/check/score.js +55 -1
  102. package/dist/factory/check/score.js.map +1 -1
  103. package/dist/factory/enqueue.d.ts +195 -0
  104. package/dist/factory/enqueue.d.ts.map +1 -0
  105. package/dist/factory/enqueue.js +788 -0
  106. package/dist/factory/enqueue.js.map +1 -0
  107. package/dist/factory/heal/cli.d.ts +34 -2
  108. package/dist/factory/heal/cli.d.ts.map +1 -1
  109. package/dist/factory/heal/cli.js +88 -19
  110. package/dist/factory/heal/cli.js.map +1 -1
  111. package/dist/factory/heal/history.d.ts +12 -6
  112. package/dist/factory/heal/history.d.ts.map +1 -1
  113. package/dist/factory/heal/history.js +16 -6
  114. package/dist/factory/heal/history.js.map +1 -1
  115. package/dist/factory/heal/implement.d.ts +3 -1
  116. package/dist/factory/heal/implement.d.ts.map +1 -1
  117. package/dist/factory/heal/implement.js +1 -0
  118. package/dist/factory/heal/implement.js.map +1 -1
  119. package/dist/factory/heal/run.d.ts +3 -0
  120. package/dist/factory/heal/run.d.ts.map +1 -1
  121. package/dist/factory/heal/run.js +1 -1
  122. package/dist/factory/heal/run.js.map +1 -1
  123. package/dist/factory/listener.d.ts +13 -17
  124. package/dist/factory/listener.d.ts.map +1 -1
  125. package/dist/factory/listener.js +37 -63
  126. package/dist/factory/listener.js.map +1 -1
  127. package/dist/factory/map-frontier.d.ts +8 -1
  128. package/dist/factory/map-frontier.d.ts.map +1 -1
  129. package/dist/factory/map-frontier.js +65 -5
  130. package/dist/factory/map-frontier.js.map +1 -1
  131. package/dist/factory/map-ingest.d.ts.map +1 -1
  132. package/dist/factory/map-ingest.js +12 -1
  133. package/dist/factory/map-ingest.js.map +1 -1
  134. package/dist/factory/poll.d.ts +308 -0
  135. package/dist/factory/poll.d.ts.map +1 -0
  136. package/dist/factory/poll.js +677 -0
  137. package/dist/factory/poll.js.map +1 -0
  138. package/dist/factory/run/__tests__/engine.ado.test.js +157 -8
  139. package/dist/factory/run/__tests__/engine.ado.test.js.map +1 -1
  140. package/dist/factory/run/__tests__/engine.outcome.test.d.ts +2 -0
  141. package/dist/factory/run/__tests__/engine.outcome.test.d.ts.map +1 -0
  142. package/dist/factory/run/__tests__/engine.outcome.test.js +223 -0
  143. package/dist/factory/run/__tests__/engine.outcome.test.js.map +1 -0
  144. package/dist/factory/run/__tests__/engine.test.js +91 -0
  145. package/dist/factory/run/__tests__/engine.test.js.map +1 -1
  146. package/dist/factory/run/__tests__/units.test.js +299 -2
  147. package/dist/factory/run/__tests__/units.test.js.map +1 -1
  148. package/dist/factory/run/engine.d.ts +11 -3
  149. package/dist/factory/run/engine.d.ts.map +1 -1
  150. package/dist/factory/run/engine.js +145 -22
  151. package/dist/factory/run/engine.js.map +1 -1
  152. package/dist/factory/run/exec.d.ts +32 -4
  153. package/dist/factory/run/exec.d.ts.map +1 -1
  154. package/dist/factory/run/exec.js +120 -15
  155. package/dist/factory/run/exec.js.map +1 -1
  156. package/dist/factory/run/outcome.d.ts +31 -0
  157. package/dist/factory/run/outcome.d.ts.map +1 -0
  158. package/dist/factory/run/outcome.js +70 -0
  159. package/dist/factory/run/outcome.js.map +1 -0
  160. package/dist/factory/run/review-output.d.ts +6 -1
  161. package/dist/factory/run/review-output.d.ts.map +1 -1
  162. package/dist/factory/run/review-output.js +13 -3
  163. package/dist/factory/run/review-output.js.map +1 -1
  164. package/dist/factory/run/state.d.ts +2 -0
  165. package/dist/factory/run/state.d.ts.map +1 -1
  166. package/dist/factory/run/state.js.map +1 -1
  167. package/dist/factory/setup/__tests__/pipeline-pick.test.d.ts +2 -0
  168. package/dist/factory/setup/__tests__/pipeline-pick.test.d.ts.map +1 -0
  169. package/dist/factory/setup/__tests__/pipeline-pick.test.js +84 -0
  170. package/dist/factory/setup/__tests__/pipeline-pick.test.js.map +1 -0
  171. package/dist/factory/setup/__tests__/setup.test.js +1 -0
  172. package/dist/factory/setup/__tests__/setup.test.js.map +1 -1
  173. package/dist/factory/setup/detect.js +1 -1
  174. package/dist/factory/setup/detect.js.map +1 -1
  175. package/dist/factory/setup/pipeline-pick.d.ts +25 -0
  176. package/dist/factory/setup/pipeline-pick.d.ts.map +1 -0
  177. package/dist/factory/setup/pipeline-pick.js +55 -0
  178. package/dist/factory/setup/pipeline-pick.js.map +1 -0
  179. package/dist/factory/setup/write.d.ts +6 -0
  180. package/dist/factory/setup/write.d.ts.map +1 -1
  181. package/dist/factory/setup/write.js +3 -1
  182. package/dist/factory/setup/write.js.map +1 -1
  183. package/dist/factory/watchdog.d.ts +3 -2
  184. package/dist/factory/watchdog.d.ts.map +1 -1
  185. package/dist/factory/watchdog.js +5 -4
  186. package/dist/factory/watchdog.js.map +1 -1
  187. package/dist/factory/watchdog.test.js +19 -4
  188. package/dist/factory/watchdog.test.js.map +1 -1
  189. package/dist/forge/__tests__/config.test.js +51 -0
  190. package/dist/forge/__tests__/config.test.js.map +1 -1
  191. package/dist/forge/__tests__/gh-argv-baseline.chain.test.js +2 -2
  192. package/dist/forge/__tests__/gh-argv-baseline.chain.test.js.map +1 -1
  193. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +6 -4
  194. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
  195. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.d.ts +2 -0
  196. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.d.ts.map +1 -0
  197. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js +100 -0
  198. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js.map +1 -0
  199. package/dist/forge/ado/__tests__/acceptance-scripts.test.js +360 -30
  200. package/dist/forge/ado/__tests__/acceptance-scripts.test.js.map +1 -1
  201. package/dist/forge/ado/__tests__/adapter.test.js +18 -3
  202. package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
  203. package/dist/forge/ado/__tests__/ci.test.d.ts +2 -0
  204. package/dist/forge/ado/__tests__/ci.test.d.ts.map +1 -0
  205. package/dist/forge/ado/__tests__/ci.test.js +271 -0
  206. package/dist/forge/ado/__tests__/ci.test.js.map +1 -0
  207. package/dist/forge/ado/__tests__/routes.test.js +24 -5
  208. package/dist/forge/ado/__tests__/routes.test.js.map +1 -1
  209. package/dist/forge/ado/__tests__/tracker-writes.test.d.ts +8 -0
  210. package/dist/forge/ado/__tests__/tracker-writes.test.d.ts.map +1 -0
  211. package/dist/forge/ado/__tests__/tracker-writes.test.js +377 -0
  212. package/dist/forge/ado/__tests__/tracker-writes.test.js.map +1 -0
  213. package/dist/forge/ado/__tests__/world.d.ts +4 -0
  214. package/dist/forge/ado/__tests__/world.d.ts.map +1 -1
  215. package/dist/forge/ado/__tests__/world.js +3 -2
  216. package/dist/forge/ado/__tests__/world.js.map +1 -1
  217. package/dist/forge/ado/checks.d.ts +25 -2
  218. package/dist/forge/ado/checks.d.ts.map +1 -1
  219. package/dist/forge/ado/checks.js +47 -23
  220. package/dist/forge/ado/checks.js.map +1 -1
  221. package/dist/forge/ado/ci.d.ts +13 -0
  222. package/dist/forge/ado/ci.d.ts.map +1 -0
  223. package/dist/forge/ado/ci.js +134 -0
  224. package/dist/forge/ado/ci.js.map +1 -0
  225. package/dist/forge/ado/guard.d.ts +19 -6
  226. package/dist/forge/ado/guard.d.ts.map +1 -1
  227. package/dist/forge/ado/guard.js +52 -11
  228. package/dist/forge/ado/guard.js.map +1 -1
  229. package/dist/forge/ado/index.d.ts +7 -1
  230. package/dist/forge/ado/index.d.ts.map +1 -1
  231. package/dist/forge/ado/index.js +16 -3
  232. package/dist/forge/ado/index.js.map +1 -1
  233. package/dist/forge/ado/reviews.d.ts +9 -1
  234. package/dist/forge/ado/reviews.d.ts.map +1 -1
  235. package/dist/forge/ado/reviews.js +45 -1
  236. package/dist/forge/ado/reviews.js.map +1 -1
  237. package/dist/forge/ado/routes.d.ts +35 -5
  238. package/dist/forge/ado/routes.d.ts.map +1 -1
  239. package/dist/forge/ado/routes.js +181 -9
  240. package/dist/forge/ado/routes.js.map +1 -1
  241. package/dist/forge/ado/tracker.d.ts +13 -2
  242. package/dist/forge/ado/tracker.d.ts.map +1 -1
  243. package/dist/forge/ado/tracker.js +139 -3
  244. package/dist/forge/ado/tracker.js.map +1 -1
  245. package/dist/forge/ado/wiql.d.ts +2 -0
  246. package/dist/forge/ado/wiql.d.ts.map +1 -1
  247. package/dist/forge/ado/wiql.js +6 -0
  248. package/dist/forge/ado/wiql.js.map +1 -1
  249. package/dist/forge/body-file.d.ts +17 -0
  250. package/dist/forge/body-file.d.ts.map +1 -0
  251. package/dist/forge/body-file.js +59 -0
  252. package/dist/forge/body-file.js.map +1 -0
  253. package/dist/forge/config.d.ts +3 -1
  254. package/dist/forge/config.d.ts.map +1 -1
  255. package/dist/forge/config.js +37 -2
  256. package/dist/forge/config.js.map +1 -1
  257. package/dist/forge/github/__tests__/argv-parity.test.js +17 -1
  258. package/dist/forge/github/__tests__/argv-parity.test.js.map +1 -1
  259. package/dist/forge/github/gh.d.ts +6 -0
  260. package/dist/forge/github/gh.d.ts.map +1 -1
  261. package/dist/forge/github/gh.js +2 -0
  262. package/dist/forge/github/gh.js.map +1 -1
  263. package/dist/forge/github/reviews.d.ts +2 -0
  264. package/dist/forge/github/reviews.d.ts.map +1 -1
  265. package/dist/forge/github/reviews.js +6 -0
  266. package/dist/forge/github/reviews.js.map +1 -1
  267. package/dist/forge/github/tracker.d.ts +20 -4
  268. package/dist/forge/github/tracker.d.ts.map +1 -1
  269. package/dist/forge/github/tracker.js +59 -5
  270. package/dist/forge/github/tracker.js.map +1 -1
  271. package/dist/forge/types.d.ts +108 -2
  272. package/dist/forge/types.d.ts.map +1 -1
  273. package/dist/forge/types.js +8 -0
  274. package/dist/forge/types.js.map +1 -1
  275. package/dist/graph/schema.d.ts +10 -10
  276. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js +156 -35
  277. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js.map +1 -1
  278. package/dist/hooks/session-end/__tests__/check-evidence.test.js +4 -4
  279. package/dist/hooks/session-end/__tests__/check-evidence.test.js.map +1 -1
  280. package/dist/hooks/session-end/__tests__/copilot-liveness.test.js +3 -3
  281. package/dist/hooks/session-end/__tests__/copilot-liveness.test.js.map +1 -1
  282. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js +3 -3
  283. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js.map +1 -1
  284. package/dist/hooks/session-end/__tests__/routing.test.js +36 -1
  285. package/dist/hooks/session-end/__tests__/routing.test.js.map +1 -1
  286. package/dist/hooks/session-end/__tests__/spawn-next.test.js +96 -5
  287. package/dist/hooks/session-end/__tests__/spawn-next.test.js.map +1 -1
  288. package/dist/hooks/session-end/__tests__/worker.test.js +38 -2
  289. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  290. package/dist/hooks/session-end/chain-enqueuer.d.ts.map +1 -1
  291. package/dist/hooks/session-end/chain-enqueuer.js +22 -2
  292. package/dist/hooks/session-end/chain-enqueuer.js.map +1 -1
  293. package/dist/hooks/session-end/routing.d.ts +14 -0
  294. package/dist/hooks/session-end/routing.d.ts.map +1 -1
  295. package/dist/hooks/session-end/routing.js +25 -0
  296. package/dist/hooks/session-end/routing.js.map +1 -1
  297. package/dist/hooks/session-end/spawn-next.d.ts +20 -2
  298. package/dist/hooks/session-end/spawn-next.d.ts.map +1 -1
  299. package/dist/hooks/session-end/spawn-next.js +72 -5
  300. package/dist/hooks/session-end/spawn-next.js.map +1 -1
  301. package/dist/smoke/__tests__/copilot-chain-scenario.test.js +2 -1
  302. package/dist/smoke/__tests__/copilot-chain-scenario.test.js.map +1 -1
  303. package/dist/smoke/copilot-chain-scenario.d.ts.map +1 -1
  304. package/dist/smoke/copilot-chain-scenario.js +5 -1
  305. package/dist/smoke/copilot-chain-scenario.js.map +1 -1
  306. package/dist/team/__tests__/worker-launch-ack.test.js +134 -5
  307. package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
  308. package/dist/team/worker-launch-ack.d.ts.map +1 -1
  309. package/dist/team/worker-launch-ack.js +19 -4
  310. package/dist/team/worker-launch-ack.js.map +1 -1
  311. package/docs/CLAUDE.md +1 -1
  312. package/docs/MIGRATION.md +26 -0
  313. package/docs/REFERENCE.md +187 -20
  314. package/docs/design/FACTORY-FINAL-DESIGN.md +1 -1
  315. package/docs/shipyard.md +17 -1
  316. package/package.json +2 -2
  317. package/plugin.json +1 -1
  318. package/scripts/ado-acceptance.mjs +309 -70
  319. package/scripts/lib/backlog-to-workitems.mjs +24 -21
  320. package/skills/ask-navigator/SKILL.md +5 -2
  321. package/skills/drydock/SKILL.md +2 -1
  322. package/skills/harbor/SKILL.md +17 -2
  323. package/skills/intent/SKILL.md +4 -0
  324. package/skills/launch/SKILL.md +35 -2
  325. package/skills/map/SKILL.md +2 -1
  326. package/skills/refit/SKILL.md +1 -0
@@ -8817,7 +8817,7 @@ function buildWindowsSupervisorSource() {
8817
8817
  // The start identity is read while the provider is still suspended: a
8818
8818
  // short-lived provider can exit before a slow host reaches the ready
8819
8819
  // frame, and Get-Process on an exited PID throws, killing the supervisor.
8820
- `public static class O { [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct STARTUPINFO { public int cb; public IntPtr lpReserved; public IntPtr lpDesktop; public IntPtr lpTitle; public int dwX; public int dwY; public int dwXSize; public int dwYSize; public int dwXCountChars; public int dwYCountChars; public int dwFillAttribute; public int dwFlags; public short wShowWindow; public short cbReserved2; public IntPtr lpReserved2; public IntPtr hStdInput; public IntPtr hStdOutput; public IntPtr hStdError; } [StructLayout(LayoutKind.Sequential)] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public uint dwProcessId; public uint dwThreadId; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_BASIC_LIMIT_INFORMATION { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity; public uint PriorityClass; public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] public struct IO_COUNTERS { public ulong ReadOperationCount; public ulong WriteOperationCount; public ulong OtherOperationCount; public ulong ReadTransferCount; public ulong WriteTransferCount; public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public IO_COUNTERS IoInfo; public UIntPtr ProcessMemoryLimit; public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; } [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern bool CreateProcessW(string app, StringBuilder cmd, IntPtr pa, IntPtr ta, bool inherit, uint flags, IntPtr env, string dir, ref STARTUPINFO si, out PROCESS_INFORMATION pi); [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr CreateJobObjectW(IntPtr a, string n); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetInformationJobObject(IntPtr j, int c, IntPtr i, uint l); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool AssignProcessToJobObject(IntPtr j, IntPtr p); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint ResumeThread(IntPtr h); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateJobObject(IntPtr j, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateProcess(IntPtr p, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint WaitForSingleObject(IntPtr h, uint ms); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool GetExitCodeProcess(IntPtr h, out uint code); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr h); [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern IntPtr CreateFileW(string n, uint a, uint s, IntPtr sa, uint d, uint f, IntPtr t); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetHandleInformation(IntPtr h, uint m, uint f); public static string Quote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2 + 1); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCommandLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(Quote(argv[i])); } return b.ToString(); } public static string CmdQuote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c < ' ') throw new ArgumentException("worker_launch_provider_argv_invalid"); if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2); b.Append('"'); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCmdLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(CmdQuote(argv[i])); } if (b.Length > ${WINDOWS_PROVIDER_LINE_MAX}) throw new ArgumentException("worker_launch_provider_argv_too_long"); return b.ToString(); } }`,
8820
+ `public static class O { [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct STARTUPINFO { public int cb; public IntPtr lpReserved; public IntPtr lpDesktop; public IntPtr lpTitle; public int dwX; public int dwY; public int dwXSize; public int dwYSize; public int dwXCountChars; public int dwYCountChars; public int dwFillAttribute; public int dwFlags; public short wShowWindow; public short cbReserved2; public IntPtr lpReserved2; public IntPtr hStdInput; public IntPtr hStdOutput; public IntPtr hStdError; } [StructLayout(LayoutKind.Sequential)] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public uint dwProcessId; public uint dwThreadId; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_BASIC_LIMIT_INFORMATION { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity; public uint PriorityClass; public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] public struct IO_COUNTERS { public ulong ReadOperationCount; public ulong WriteOperationCount; public ulong OtherOperationCount; public ulong ReadTransferCount; public ulong WriteTransferCount; public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public IO_COUNTERS IoInfo; public UIntPtr ProcessMemoryLimit; public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; } [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern bool CreateProcessW(string app, StringBuilder cmd, IntPtr pa, IntPtr ta, bool inherit, uint flags, IntPtr env, string dir, ref STARTUPINFO si, out PROCESS_INFORMATION pi); [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr CreateJobObjectW(IntPtr a, string n); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetInformationJobObject(IntPtr j, int c, IntPtr i, uint l); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool AssignProcessToJobObject(IntPtr j, IntPtr p); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint ResumeThread(IntPtr h); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateJobObject(IntPtr j, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateProcess(IntPtr p, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint WaitForSingleObject(IntPtr h, uint ms); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool GetExitCodeProcess(IntPtr h, out uint code); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr h); [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern IntPtr CreateFileW(string n, uint a, uint s, IntPtr sa, uint d, uint f, IntPtr t); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetHandleInformation(IntPtr h, uint m, uint f); public static string Quote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2 + 1); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCommandLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(Quote(argv[i])); } return b.ToString(); } public static string CmdQuote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c < ' ') throw new ArgumentException("worker_launch_provider_argv_invalid"); if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2); b.Append('"'); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCmdLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(CmdQuote(argv[i])); } if (b.Length > ${WINDOWS_PROVIDER_LINE_MAX}) throw new ArgumentException("worker_launch_provider_argv_too_long"); return b.ToString(); } public static void RequireProviderExecutable(string app) { if (String.IsNullOrWhiteSpace(app) || !System.Text.RegularExpressions.Regex.IsMatch(app, @"^(?:[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+[\\\\/])") || !System.IO.File.Exists(app)) throw new ArgumentException("worker_launch_provider_executable_invalid"); } }`,
8821
8821
  '"@',
8822
8822
  "$pi = New-Object O+PROCESS_INFORMATION; $job = [IntPtr]::Zero; $envPtr = [IntPtr]::Zero; $cmd = $null; $conIn = [IntPtr]::Zero; $conOut = [IntPtr]::Zero",
8823
8823
  "try {",
@@ -8825,9 +8825,14 @@ function buildWindowsSupervisorSource() {
8825
8825
  // it through cmd.exe with the MSVC-quoted line (CVE-2024-27980). cmd.exe
8826
8826
  // itself is started instead and expands the cmd-quoted line once from
8827
8827
  // its environment block, clearing the variable before the provider runs.
8828
- " $argv = [string[]]$payload.provider_argv; $app = [NullString]::Value; $providerLine = $null",
8828
+ // Every argv[0] must be an existing fully qualified path (CreateProcessW
8829
+ // searches the cwd for a bare name), and every provider gets
8830
+ // NoDefaultCurrentDirectoryInExePath (a provider value is dropped) so
8831
+ // neither an npm shim's bare `"%_prog%"` (node) nor a child's bare `git`
8832
+ // runs a program planted in the cwd.
8833
+ " $argv = [string[]]$payload.provider_argv; [O]::RequireProviderExecutable($argv[0]); $app = [NullString]::Value; $providerLine = $null",
8829
8834
  ` if ($argv[0] -match '\\.(cmd|bat)[. ]*$') { $providerLine = [O]::BuildCmdLine($argv); $app = Join-Path ([Environment]::SystemDirectory) 'cmd.exe'; $cmd = '"' + $app + '" /d /v:off /s /c "set "${PROVIDER_LINE_VAR}=" & %${PROVIDER_LINE_VAR}%"' } else { $cmd = [O]::BuildCommandLine($argv) }`,
8830
- ` $envPairs = @($payload.provider_env.psobject.Properties | Where-Object { $_.Name -ne '${PROVIDER_LINE_VAR}' } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; Value = $_.Value } }); if ($null -ne $providerLine) { $envPairs += [pscustomobject]@{ Name = '${PROVIDER_LINE_VAR}'; Value = $providerLine } }; $envPairs = @($envPairs | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }); $envText = (($envPairs -join [char]0) + [char]0 + [char]0); $envBytes = [Text.Encoding]::Unicode.GetBytes($envText); $envPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($envBytes.Length); [Runtime.InteropServices.Marshal]::Copy($envBytes, 0, $envPtr, $envBytes.Length)`,
8835
+ ` $envPairs = @($payload.provider_env.psobject.Properties | Where-Object { $_.Name -ne '${PROVIDER_LINE_VAR}' -and $_.Name -ne 'NoDefaultCurrentDirectoryInExePath' } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; Value = $_.Value } }); if ($null -ne $providerLine) { $envPairs += [pscustomobject]@{ Name = '${PROVIDER_LINE_VAR}'; Value = $providerLine } }; $envPairs += [pscustomobject]@{ Name = 'NoDefaultCurrentDirectoryInExePath'; Value = '1' }; $envPairs = @($envPairs | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }); $envText = (($envPairs -join [char]0) + [char]0 + [char]0); $envBytes = [Text.Encoding]::Unicode.GetBytes($envText); $envPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($envBytes.Length); [Runtime.InteropServices.Marshal]::Copy($envBytes, 0, $envPtr, $envBytes.Length)`,
8831
8836
  ` $conIn = [O]::CreateFileW('CONIN$', [uint32]3221225472, 3, [IntPtr]::Zero, 3, 0, [IntPtr]::Zero); $conOut = [O]::CreateFileW('CONOUT$', [uint32]3221225472, 3, [IntPtr]::Zero, 3, 0, [IntPtr]::Zero); if ($conIn -eq [IntPtr]::Zero -or $conIn -eq [IntPtr]::new(-1) -or $conOut -eq [IntPtr]::Zero -or $conOut -eq [IntPtr]::new(-1)) { $conIn = [IntPtr]::Zero; $conOut = [IntPtr]::Zero; throw "worker_launch_console_unavailable" }; if (-not [O]::SetHandleInformation($conIn, 1, 1) -or -not [O]::SetHandleInformation($conOut, 1, 1)) { throw "worker_launch_console_unavailable" }; $si = New-Object O+STARTUPINFO; $si.cb = [Runtime.InteropServices.Marshal]::SizeOf($si); $si.dwFlags = 0x00000100; $si.hStdInput = $conIn; $si.hStdOutput = $conOut; $si.hStdError = $conOut; $flags = 0x00000004 -bor 0x00000400; if (-not [O]::CreateProcessW($app, $cmd, [IntPtr]::Zero, [IntPtr]::Zero, $true, $flags, $envPtr, $payload.cwd, [ref]$si, [ref]$pi)) { throw "worker_launch_create_process_failed" }`,
8832
8837
  ' $job = [O]::CreateJobObjectW([IntPtr]::Zero, [NullString]::Value); if ($job -eq [IntPtr]::Zero) { throw "worker_launch_create_job_failed" }; $info = New-Object O+JOBOBJECT_EXTENDED_LIMIT_INFORMATION; $info.BasicLimitInformation.LimitFlags = 0x2000; $ptr = [Runtime.InteropServices.Marshal]::AllocHGlobal([Runtime.InteropServices.Marshal]::SizeOf($info)); try { [Runtime.InteropServices.Marshal]::StructureToPtr($info, $ptr, $false); if (-not [O]::SetInformationJobObject($job, 9, $ptr, [Runtime.InteropServices.Marshal]::SizeOf($info))) { throw "worker_launch_job_config_failed" } } finally { [Runtime.InteropServices.Marshal]::FreeHGlobal($ptr) }; if (-not [O]::AssignProcessToJobObject($job, $pi.hProcess)) { throw "worker_launch_assign_job_failed" }; $ticks = ([DateTime]((Get-Process -Id $pi.dwProcessId).StartTime)).ToUniversalTime().Ticks; if ([O]::ResumeThread($pi.hThread) -eq [uint32]::MaxValue) { throw "worker_launch_resume_failed" }',
8833
8838
  ' $ready = @{ protocol="' + WINDOWS_SUPERVISOR_PROTOCOL + '"; kind="ready"; attempt_id=$payload.identity.attempt_id; instance_id=$payload.identity.instance_id; authority_digest=$payload.authority_digest; containment_nonce=$payload.containment_nonce; pid=$pi.dwProcessId; process_start_identity=("ticks:" + $ticks) } | ConvertTo-Json -Compress; [Console]::Out.WriteLine($ready); [Console]::Out.Flush()',
@@ -8953,6 +8958,11 @@ function buildProviderEnvironment(providerEnv, sourceEnv = process.env, platform
8953
8958
  const baselineKey = Object.keys(baseline).find((candidate) => candidate.toUpperCase() === key.toUpperCase());
8954
8959
  if (baselineKey) delete baseline[baselineKey];
8955
8960
  }
8961
+ const merged = { ...baseline, ...normalized };
8962
+ for (const key of Object.keys(merged)) {
8963
+ if (key.toUpperCase() === "NODEFAULTCURRENTDIRECTORYINEXEPATH") delete merged[key];
8964
+ }
8965
+ return { ...merged, NoDefaultCurrentDirectoryInExePath: "1" };
8956
8966
  }
8957
8967
  return { ...baseline, ...normalized };
8958
8968
  }
@@ -10102,7 +10112,8 @@ function buildProviderSpawnInvocation(providerArgv, platform = process.platform,
10102
10112
  command: comSpec,
10103
10113
  args: ["/d", "/v:off", "/s", "/c"],
10104
10114
  batchScript,
10105
- env: { [lineVar]: buildWindowsBatchProviderLine(providerArgv) }
10115
+ // cmd.exe searches the cwd before PATH; npm shims run a bare `node`.
10116
+ env: { [lineVar]: buildWindowsBatchProviderLine(providerArgv), NoDefaultCurrentDirectoryInExePath: "1" }
10106
10117
  };
10107
10118
  }
10108
10119
  return { command, args };
@@ -19587,7 +19598,7 @@ var init_remote_url = __esm({
19587
19598
  });
19588
19599
 
19589
19600
  // src/forge/ado/routes.ts
19590
- var STABLE, TEXT_CHARS, TEXT, text, BRANCH_REF, route, ADO_ROUTES, ADO_WRITE_ALLOWLIST;
19601
+ var STABLE, TEXT_CHARS, TEXT, text, BRANCH_REF, TITLE, ADAPTER_HTML, AREA_PATH, ADO_TRACKER_RELATIONS, RELATION, PRIORITY, route, ADO_ROUTES, ADO_WRITE_ALLOWLIST;
19591
19602
  var init_routes = __esm({
19592
19603
  "src/forge/ado/routes.ts"() {
19593
19604
  "use strict";
@@ -19596,6 +19607,24 @@ var init_routes = __esm({
19596
19607
  TEXT = { type: "string", pattern: TEXT_CHARS };
19597
19608
  text = (maxLength) => ({ type: "string", pattern: TEXT_CHARS, maxLength });
19598
19609
  BRANCH_REF = { type: "string", pattern: /^refs\/heads\/(?!.*\.\.)[^\s\p{Cc}~^:?*[\\]+$/u, maxLength: 400 };
19610
+ TITLE = { type: "string", pattern: /^(?!-)[^\p{Cc}\p{Cf}]+$/u, maxLength: 255 };
19611
+ ADAPTER_HTML = {
19612
+ type: "string",
19613
+ pattern: /^(?:[^<>&\p{Cc}\p{Bidi_Control}]|\t|<\/?(?:div|ul|li)>|<br>|&(?:amp|lt|gt|quot|#39);)+$/u,
19614
+ maxLength: 262144
19615
+ };
19616
+ AREA_PATH = { type: "string", pattern: /^(?!@)[^\p{Cc}\p{Cf}/$?*:"&<>#%|+]+$/u, maxLength: 4e3 };
19617
+ ADO_TRACKER_RELATIONS = ["System.LinkTypes.Hierarchy-Reverse", "System.LinkTypes.Dependency-Reverse"];
19618
+ RELATION = {
19619
+ type: "object",
19620
+ shape: {
19621
+ kind: "object",
19622
+ keys: ["rel", "url"],
19623
+ required: ["rel", "url"],
19624
+ values: { rel: { enum: ADO_TRACKER_RELATIONS }, url: { type: "string", pattern: /^https:\/\/dev\.azure\.com\/[^/\s]+\/_apis\/wit\/workItems\/[1-9]\d{0,9}$/, maxLength: 400 } }
19625
+ }
19626
+ };
19627
+ PRIORITY = { enum: [1, 2, 3, 4] };
19599
19628
  route = (r) => Object.freeze(r);
19600
19629
  ADO_ROUTES = Object.freeze([
19601
19630
  // Setup probes.
@@ -19603,7 +19632,7 @@ var init_routes = __esm({
19603
19632
  route({ id: "core.teams.GET", area: "core", resource: "teams", method: "GET", apiVersion: STABLE, routeParams: ["projectId"], queryParams: ["$top", "$skip"] }),
19604
19633
  route({ id: "git.repositories.GET", area: "git", resource: "repositories", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId"], queryParams: [] }),
19605
19634
  // Work items (intake, check, progress).
19606
- route({ id: "wit.workItems.GET", area: "wit", resource: "workItems", method: "GET", apiVersion: STABLE, routeParams: ["project", "id"], queryParams: ["$expand"] }),
19635
+ route({ id: "wit.workItems.GET", area: "wit", resource: "workItems", method: "GET", apiVersion: STABLE, routeParams: ["project", "id"], queryParams: ["$expand", "ids", "fields", "errorPolicy"] }),
19607
19636
  route({
19608
19637
  id: "wit.workItems.PATCH",
19609
19638
  area: "wit",
@@ -19613,17 +19642,53 @@ var init_routes = __esm({
19613
19642
  routeParams: ["project", "id"],
19614
19643
  queryParams: [],
19615
19644
  mediaType: "application/json-patch+json",
19616
- // test /rev guards a concurrent edit; tags, state and the board's Kanban column field are the only writes.
19645
+ // test /rev guards a concurrent edit; tags, state and the board's Kanban column field are the only engine writes.
19646
+ // `add` on a field sets it; `add` on /relations/- appends a link; no op removes or replaces anything.
19647
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-7.1 ("Add a link", "Add a tag")
19617
19648
  body: {
19618
19649
  kind: "json-patch",
19619
19650
  ops: ["test", "add"],
19620
19651
  paths: [
19621
19652
  { path: /^\/rev$/, value: { type: "integer", min: 1 } },
19622
- { path: /^\/fields\/System\.Tags$/, value: TEXT },
19653
+ // With the tracker write context, a tag write is a test of the current list, then an add editing allowlisted tags only.
19654
+ { path: /^\/fields\/System\.Tags$/, value: TEXT, configured: "tags" },
19623
19655
  // Also one of the configured progress-mapping states (validateAdoBody's allowedStates, design §7).
19624
19656
  { path: /^\/fields\/System\.State$/, value: TEXT, configured: "states" },
19625
19657
  // A column move can change System.State too, so it is held to the configured progress columns (critic amendments §A.14).
19626
- { path: /^\/fields\/WEF_[0-9A-F]{32}_Kanban\.Column$/, value: TEXT, configured: "columns" }
19658
+ { path: /^\/fields\/WEF_[0-9A-F]{32}_Kanban\.Column$/, value: TEXT, configured: "columns" },
19659
+ // Tracker writes (enqueue's update and link): title, description, AC, priority, and a parent or predecessor link.
19660
+ { path: /^\/fields\/System\.Title$/, value: TITLE, tracker: true },
19661
+ { path: /^\/fields\/System\.Description$/, value: ADAPTER_HTML, tracker: true },
19662
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.AcceptanceCriteria$/, value: ADAPTER_HTML, tracker: true },
19663
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.Priority$/, value: PRIORITY, tracker: true },
19664
+ { path: /^\/relations\/-$/, value: RELATION, configured: "relation", tracker: true }
19665
+ ]
19666
+ }
19667
+ }),
19668
+ // Create one work item (POST {project}/_apis/wit/workitems/${type}: the `$` is in the route template, the parameter is the type name).
19669
+ // Fields only: links go through the PATCH above once every id is known. Enqueue only (tracker: true).
19670
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.1
19671
+ route({
19672
+ id: "wit.workItems.POST",
19673
+ area: "wit",
19674
+ resource: "workItems",
19675
+ method: "POST",
19676
+ apiVersion: STABLE,
19677
+ routeParams: ["project", "type"],
19678
+ queryParams: [],
19679
+ mediaType: "application/json-patch+json",
19680
+ tracker: true,
19681
+ body: {
19682
+ kind: "json-patch",
19683
+ ops: ["add"],
19684
+ paths: [
19685
+ { path: /^\/fields\/System\.Title$/, value: TITLE },
19686
+ { path: /^\/fields\/System\.Description$/, value: ADAPTER_HTML },
19687
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.AcceptanceCriteria$/, value: ADAPTER_HTML },
19688
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.Priority$/, value: PRIORITY },
19689
+ // Every tag on the tracker write allowlist.
19690
+ { path: /^\/fields\/System\.Tags$/, value: TEXT, configured: "tags" },
19691
+ { path: /^\/fields\/System\.AreaPath$/, value: AREA_PATH, configured: "areaPath" }
19627
19692
  ]
19628
19693
  }
19629
19694
  }),
@@ -19664,7 +19729,7 @@ var init_routes = __esm({
19664
19729
  method: "GET",
19665
19730
  apiVersion: STABLE,
19666
19731
  routeParams: ["project", "repositoryId", "pullRequestId"],
19667
- queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "$top"]
19732
+ queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "searchCriteria.targetRefName", "$top"]
19668
19733
  }),
19669
19734
  route({
19670
19735
  id: "git.pullRequests.POST",
@@ -19729,20 +19794,45 @@ var init_routes = __esm({
19729
19794
  }
19730
19795
  }
19731
19796
  }),
19797
+ // `omg factory poll`'s open human threads (ADO parity design §2.2).
19798
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-threads/list?view=azure-devops-rest-7.1
19799
+ route({ id: "git.pullRequestThreads.GET", area: "git", resource: "pullRequestThreads", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19732
19800
  route({ id: "git.pullRequestIterations.GET", area: "git", resource: "pullRequestIterations", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19733
19801
  route({ id: "git.pullRequestStatuses.GET", area: "git", resource: "pullRequestStatuses", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19734
19802
  // Policy (gates) and builds.
19735
19803
  route({ id: "policy.evaluations.GET", area: "policy", resource: "evaluations", method: "GET", apiVersion: "7.1-preview.1", routeParams: ["project"], queryParams: ["artifactId", "includeNotApplicable", "$top", "$skip"] }),
19736
19804
  // Requeue one evaluation (rerun a flaky or expired build); the REST call has no body.
19737
19805
  route({ id: "policy.evaluations.PATCH", area: "policy", resource: "evaluations", method: "PATCH", apiVersion: "7.1-preview.1", routeParams: ["project", "evaluationId"], queryParams: [], body: { kind: "none" } }),
19738
- // By id, or the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2).
19739
- route({ id: "build.builds.GET", area: "build", resource: "builds", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: ["branchName", "reasonFilter", "queryOrder", "$top"] }),
19806
+ // By id, the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2), or heal's pipeline history (ci.ts, ADO parity design §3.3).
19807
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-7.1
19808
+ route({
19809
+ id: "build.builds.GET",
19810
+ area: "build",
19811
+ resource: "builds",
19812
+ method: "GET",
19813
+ apiVersion: STABLE,
19814
+ routeParams: ["project", "buildId"],
19815
+ queryParams: ["branchName", "reasonFilter", "queryOrder", "$top", "definitions", "statusFilter", "resultFilter", "minTime"]
19816
+ }),
19817
+ // The heal pipeline pick (ADO parity design §3.2).
19818
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/build/definitions/list?view=azure-devops-rest-7.1
19819
+ route({
19820
+ id: "build.definitions.GET",
19821
+ area: "build",
19822
+ resource: "definitions",
19823
+ method: "GET",
19824
+ apiVersion: STABLE,
19825
+ routeParams: ["project", "definitionId"],
19826
+ queryParams: ["name", "repositoryId", "repositoryType", "includeAllProperties", "$top"]
19827
+ }),
19740
19828
  route({ id: "build.timeline.GET", area: "build", resource: "timeline", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: [] }),
19741
19829
  // Read as JSON ({ count, value: [lines] }): az devops invoke refuses a non-JSON response without --out-file, which the guard never allows.
19742
19830
  route({ id: "build.logs.GET", area: "build", resource: "logs", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId", "logId"], queryParams: [] })
19743
19831
  ]);
19744
19832
  ADO_WRITE_ALLOWLIST = Object.freeze([
19745
19833
  ["wit", "workItems", "PATCH"],
19834
+ // Enqueue only (the route's `tracker` flag).
19835
+ ["wit", "workItems", "POST"],
19746
19836
  ["wit", "comments", "POST"],
19747
19837
  ["wit", "wiql", "POST"],
19748
19838
  ["git", "pullRequests", "POST"],
@@ -13200,7 +13200,7 @@ function buildWindowsSupervisorSource() {
13200
13200
  // The start identity is read while the provider is still suspended: a
13201
13201
  // short-lived provider can exit before a slow host reaches the ready
13202
13202
  // frame, and Get-Process on an exited PID throws, killing the supervisor.
13203
- `public static class O { [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct STARTUPINFO { public int cb; public IntPtr lpReserved; public IntPtr lpDesktop; public IntPtr lpTitle; public int dwX; public int dwY; public int dwXSize; public int dwYSize; public int dwXCountChars; public int dwYCountChars; public int dwFillAttribute; public int dwFlags; public short wShowWindow; public short cbReserved2; public IntPtr lpReserved2; public IntPtr hStdInput; public IntPtr hStdOutput; public IntPtr hStdError; } [StructLayout(LayoutKind.Sequential)] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public uint dwProcessId; public uint dwThreadId; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_BASIC_LIMIT_INFORMATION { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity; public uint PriorityClass; public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] public struct IO_COUNTERS { public ulong ReadOperationCount; public ulong WriteOperationCount; public ulong OtherOperationCount; public ulong ReadTransferCount; public ulong WriteTransferCount; public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public IO_COUNTERS IoInfo; public UIntPtr ProcessMemoryLimit; public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; } [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern bool CreateProcessW(string app, StringBuilder cmd, IntPtr pa, IntPtr ta, bool inherit, uint flags, IntPtr env, string dir, ref STARTUPINFO si, out PROCESS_INFORMATION pi); [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr CreateJobObjectW(IntPtr a, string n); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetInformationJobObject(IntPtr j, int c, IntPtr i, uint l); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool AssignProcessToJobObject(IntPtr j, IntPtr p); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint ResumeThread(IntPtr h); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateJobObject(IntPtr j, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateProcess(IntPtr p, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint WaitForSingleObject(IntPtr h, uint ms); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool GetExitCodeProcess(IntPtr h, out uint code); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr h); [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern IntPtr CreateFileW(string n, uint a, uint s, IntPtr sa, uint d, uint f, IntPtr t); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetHandleInformation(IntPtr h, uint m, uint f); public static string Quote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2 + 1); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCommandLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(Quote(argv[i])); } return b.ToString(); } public static string CmdQuote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c < ' ') throw new ArgumentException("worker_launch_provider_argv_invalid"); if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2); b.Append('"'); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCmdLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(CmdQuote(argv[i])); } if (b.Length > ${WINDOWS_PROVIDER_LINE_MAX}) throw new ArgumentException("worker_launch_provider_argv_too_long"); return b.ToString(); } }`,
13203
+ `public static class O { [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct STARTUPINFO { public int cb; public IntPtr lpReserved; public IntPtr lpDesktop; public IntPtr lpTitle; public int dwX; public int dwY; public int dwXSize; public int dwYSize; public int dwXCountChars; public int dwYCountChars; public int dwFillAttribute; public int dwFlags; public short wShowWindow; public short cbReserved2; public IntPtr lpReserved2; public IntPtr hStdInput; public IntPtr hStdOutput; public IntPtr hStdError; } [StructLayout(LayoutKind.Sequential)] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public uint dwProcessId; public uint dwThreadId; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_BASIC_LIMIT_INFORMATION { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity; public uint PriorityClass; public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] public struct IO_COUNTERS { public ulong ReadOperationCount; public ulong WriteOperationCount; public ulong OtherOperationCount; public ulong ReadTransferCount; public ulong WriteTransferCount; public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public IO_COUNTERS IoInfo; public UIntPtr ProcessMemoryLimit; public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; } [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern bool CreateProcessW(string app, StringBuilder cmd, IntPtr pa, IntPtr ta, bool inherit, uint flags, IntPtr env, string dir, ref STARTUPINFO si, out PROCESS_INFORMATION pi); [DllImport("kernel32.dll", SetLastError=true)] public static extern IntPtr CreateJobObjectW(IntPtr a, string n); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetInformationJobObject(IntPtr j, int c, IntPtr i, uint l); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool AssignProcessToJobObject(IntPtr j, IntPtr p); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint ResumeThread(IntPtr h); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateJobObject(IntPtr j, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool TerminateProcess(IntPtr p, uint c); [DllImport("kernel32.dll", SetLastError=true)] public static extern uint WaitForSingleObject(IntPtr h, uint ms); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool GetExitCodeProcess(IntPtr h, out uint code); [DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr h); [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] public static extern IntPtr CreateFileW(string n, uint a, uint s, IntPtr sa, uint d, uint f, IntPtr t); [DllImport("kernel32.dll", SetLastError=true)] public static extern bool SetHandleInformation(IntPtr h, uint m, uint f); public static string Quote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2 + 1); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCommandLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(Quote(argv[i])); } return b.ToString(); } public static string CmdQuote(string value) { var b = new StringBuilder(); b.Append('"'); int slashes = 0; foreach (var c in value) { if (c < ' ') throw new ArgumentException("worker_launch_provider_argv_invalid"); if (c == '\\\\') { slashes++; continue; } if (c == '"') { b.Append('\\\\', slashes * 2); b.Append('"'); b.Append('"'); slashes = 0; continue; } b.Append('\\\\', slashes); slashes = 0; b.Append(c); } b.Append('\\\\', slashes * 2); b.Append('"'); return b.ToString(); } public static string BuildCmdLine(string[] argv) { var b = new StringBuilder(); for (var i = 0; i < argv.Length; i++) { if (i != 0) b.Append(' '); b.Append(CmdQuote(argv[i])); } if (b.Length > ${WINDOWS_PROVIDER_LINE_MAX}) throw new ArgumentException("worker_launch_provider_argv_too_long"); return b.ToString(); } public static void RequireProviderExecutable(string app) { if (String.IsNullOrWhiteSpace(app) || !System.Text.RegularExpressions.Regex.IsMatch(app, @"^(?:[A-Za-z]:[\\\\/]|\\\\\\\\[^\\\\/]+[\\\\/][^\\\\/]+[\\\\/])") || !System.IO.File.Exists(app)) throw new ArgumentException("worker_launch_provider_executable_invalid"); } }`,
13204
13204
  '"@',
13205
13205
  "$pi = New-Object O+PROCESS_INFORMATION; $job = [IntPtr]::Zero; $envPtr = [IntPtr]::Zero; $cmd = $null; $conIn = [IntPtr]::Zero; $conOut = [IntPtr]::Zero",
13206
13206
  "try {",
@@ -13208,9 +13208,14 @@ function buildWindowsSupervisorSource() {
13208
13208
  // it through cmd.exe with the MSVC-quoted line (CVE-2024-27980). cmd.exe
13209
13209
  // itself is started instead and expands the cmd-quoted line once from
13210
13210
  // its environment block, clearing the variable before the provider runs.
13211
- " $argv = [string[]]$payload.provider_argv; $app = [NullString]::Value; $providerLine = $null",
13211
+ // Every argv[0] must be an existing fully qualified path (CreateProcessW
13212
+ // searches the cwd for a bare name), and every provider gets
13213
+ // NoDefaultCurrentDirectoryInExePath (a provider value is dropped) so
13214
+ // neither an npm shim's bare `"%_prog%"` (node) nor a child's bare `git`
13215
+ // runs a program planted in the cwd.
13216
+ " $argv = [string[]]$payload.provider_argv; [O]::RequireProviderExecutable($argv[0]); $app = [NullString]::Value; $providerLine = $null",
13212
13217
  ` if ($argv[0] -match '\\.(cmd|bat)[. ]*$') { $providerLine = [O]::BuildCmdLine($argv); $app = Join-Path ([Environment]::SystemDirectory) 'cmd.exe'; $cmd = '"' + $app + '" /d /v:off /s /c "set "${PROVIDER_LINE_VAR}=" & %${PROVIDER_LINE_VAR}%"' } else { $cmd = [O]::BuildCommandLine($argv) }`,
13213
- ` $envPairs = @($payload.provider_env.psobject.Properties | Where-Object { $_.Name -ne '${PROVIDER_LINE_VAR}' } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; Value = $_.Value } }); if ($null -ne $providerLine) { $envPairs += [pscustomobject]@{ Name = '${PROVIDER_LINE_VAR}'; Value = $providerLine } }; $envPairs = @($envPairs | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }); $envText = (($envPairs -join [char]0) + [char]0 + [char]0); $envBytes = [Text.Encoding]::Unicode.GetBytes($envText); $envPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($envBytes.Length); [Runtime.InteropServices.Marshal]::Copy($envBytes, 0, $envPtr, $envBytes.Length)`,
13218
+ ` $envPairs = @($payload.provider_env.psobject.Properties | Where-Object { $_.Name -ne '${PROVIDER_LINE_VAR}' -and $_.Name -ne 'NoDefaultCurrentDirectoryInExePath' } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; Value = $_.Value } }); if ($null -ne $providerLine) { $envPairs += [pscustomobject]@{ Name = '${PROVIDER_LINE_VAR}'; Value = $providerLine } }; $envPairs += [pscustomobject]@{ Name = 'NoDefaultCurrentDirectoryInExePath'; Value = '1' }; $envPairs = @($envPairs | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }); $envText = (($envPairs -join [char]0) + [char]0 + [char]0); $envBytes = [Text.Encoding]::Unicode.GetBytes($envText); $envPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($envBytes.Length); [Runtime.InteropServices.Marshal]::Copy($envBytes, 0, $envPtr, $envBytes.Length)`,
13214
13219
  ` $conIn = [O]::CreateFileW('CONIN$', [uint32]3221225472, 3, [IntPtr]::Zero, 3, 0, [IntPtr]::Zero); $conOut = [O]::CreateFileW('CONOUT$', [uint32]3221225472, 3, [IntPtr]::Zero, 3, 0, [IntPtr]::Zero); if ($conIn -eq [IntPtr]::Zero -or $conIn -eq [IntPtr]::new(-1) -or $conOut -eq [IntPtr]::Zero -or $conOut -eq [IntPtr]::new(-1)) { $conIn = [IntPtr]::Zero; $conOut = [IntPtr]::Zero; throw "worker_launch_console_unavailable" }; if (-not [O]::SetHandleInformation($conIn, 1, 1) -or -not [O]::SetHandleInformation($conOut, 1, 1)) { throw "worker_launch_console_unavailable" }; $si = New-Object O+STARTUPINFO; $si.cb = [Runtime.InteropServices.Marshal]::SizeOf($si); $si.dwFlags = 0x00000100; $si.hStdInput = $conIn; $si.hStdOutput = $conOut; $si.hStdError = $conOut; $flags = 0x00000004 -bor 0x00000400; if (-not [O]::CreateProcessW($app, $cmd, [IntPtr]::Zero, [IntPtr]::Zero, $true, $flags, $envPtr, $payload.cwd, [ref]$si, [ref]$pi)) { throw "worker_launch_create_process_failed" }`,
13215
13220
  ' $job = [O]::CreateJobObjectW([IntPtr]::Zero, [NullString]::Value); if ($job -eq [IntPtr]::Zero) { throw "worker_launch_create_job_failed" }; $info = New-Object O+JOBOBJECT_EXTENDED_LIMIT_INFORMATION; $info.BasicLimitInformation.LimitFlags = 0x2000; $ptr = [Runtime.InteropServices.Marshal]::AllocHGlobal([Runtime.InteropServices.Marshal]::SizeOf($info)); try { [Runtime.InteropServices.Marshal]::StructureToPtr($info, $ptr, $false); if (-not [O]::SetInformationJobObject($job, 9, $ptr, [Runtime.InteropServices.Marshal]::SizeOf($info))) { throw "worker_launch_job_config_failed" } } finally { [Runtime.InteropServices.Marshal]::FreeHGlobal($ptr) }; if (-not [O]::AssignProcessToJobObject($job, $pi.hProcess)) { throw "worker_launch_assign_job_failed" }; $ticks = ([DateTime]((Get-Process -Id $pi.dwProcessId).StartTime)).ToUniversalTime().Ticks; if ([O]::ResumeThread($pi.hThread) -eq [uint32]::MaxValue) { throw "worker_launch_resume_failed" }',
13216
13221
  ' $ready = @{ protocol="' + WINDOWS_SUPERVISOR_PROTOCOL + '"; kind="ready"; attempt_id=$payload.identity.attempt_id; instance_id=$payload.identity.instance_id; authority_digest=$payload.authority_digest; containment_nonce=$payload.containment_nonce; pid=$pi.dwProcessId; process_start_identity=("ticks:" + $ticks) } | ConvertTo-Json -Compress; [Console]::Out.WriteLine($ready); [Console]::Out.Flush()',
@@ -13316,6 +13321,11 @@ function buildProviderEnvironment(providerEnv, sourceEnv = process.env, platform
13316
13321
  const baselineKey = Object.keys(baseline).find((candidate) => candidate.toUpperCase() === key.toUpperCase());
13317
13322
  if (baselineKey) delete baseline[baselineKey];
13318
13323
  }
13324
+ const merged = { ...baseline, ...normalized };
13325
+ for (const key of Object.keys(merged)) {
13326
+ if (key.toUpperCase() === "NODEFAULTCURRENTDIRECTORYINEXEPATH") delete merged[key];
13327
+ }
13328
+ return { ...merged, NoDefaultCurrentDirectoryInExePath: "1" };
13319
13329
  }
13320
13330
  return { ...baseline, ...normalized };
13321
13331
  }
@@ -19447,7 +19457,7 @@ var init_remote_url = __esm({
19447
19457
  });
19448
19458
 
19449
19459
  // src/forge/ado/routes.ts
19450
- var STABLE, TEXT_CHARS, TEXT, text, BRANCH_REF, route, ADO_ROUTES, ADO_WRITE_ALLOWLIST;
19460
+ var STABLE, TEXT_CHARS, TEXT, text, BRANCH_REF, TITLE, ADAPTER_HTML, AREA_PATH, ADO_TRACKER_RELATIONS, RELATION, PRIORITY, route, ADO_ROUTES, ADO_WRITE_ALLOWLIST;
19451
19461
  var init_routes = __esm({
19452
19462
  "src/forge/ado/routes.ts"() {
19453
19463
  "use strict";
@@ -19456,6 +19466,24 @@ var init_routes = __esm({
19456
19466
  TEXT = { type: "string", pattern: TEXT_CHARS };
19457
19467
  text = (maxLength) => ({ type: "string", pattern: TEXT_CHARS, maxLength });
19458
19468
  BRANCH_REF = { type: "string", pattern: /^refs\/heads\/(?!.*\.\.)[^\s\p{Cc}~^:?*[\\]+$/u, maxLength: 400 };
19469
+ TITLE = { type: "string", pattern: /^(?!-)[^\p{Cc}\p{Cf}]+$/u, maxLength: 255 };
19470
+ ADAPTER_HTML = {
19471
+ type: "string",
19472
+ pattern: /^(?:[^<>&\p{Cc}\p{Bidi_Control}]|\t|<\/?(?:div|ul|li)>|<br>|&(?:amp|lt|gt|quot|#39);)+$/u,
19473
+ maxLength: 262144
19474
+ };
19475
+ AREA_PATH = { type: "string", pattern: /^(?!@)[^\p{Cc}\p{Cf}/$?*:"&<>#%|+]+$/u, maxLength: 4e3 };
19476
+ ADO_TRACKER_RELATIONS = ["System.LinkTypes.Hierarchy-Reverse", "System.LinkTypes.Dependency-Reverse"];
19477
+ RELATION = {
19478
+ type: "object",
19479
+ shape: {
19480
+ kind: "object",
19481
+ keys: ["rel", "url"],
19482
+ required: ["rel", "url"],
19483
+ values: { rel: { enum: ADO_TRACKER_RELATIONS }, url: { type: "string", pattern: /^https:\/\/dev\.azure\.com\/[^/\s]+\/_apis\/wit\/workItems\/[1-9]\d{0,9}$/, maxLength: 400 } }
19484
+ }
19485
+ };
19486
+ PRIORITY = { enum: [1, 2, 3, 4] };
19459
19487
  route = (r) => Object.freeze(r);
19460
19488
  ADO_ROUTES = Object.freeze([
19461
19489
  // Setup probes.
@@ -19463,7 +19491,7 @@ var init_routes = __esm({
19463
19491
  route({ id: "core.teams.GET", area: "core", resource: "teams", method: "GET", apiVersion: STABLE, routeParams: ["projectId"], queryParams: ["$top", "$skip"] }),
19464
19492
  route({ id: "git.repositories.GET", area: "git", resource: "repositories", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId"], queryParams: [] }),
19465
19493
  // Work items (intake, check, progress).
19466
- route({ id: "wit.workItems.GET", area: "wit", resource: "workItems", method: "GET", apiVersion: STABLE, routeParams: ["project", "id"], queryParams: ["$expand"] }),
19494
+ route({ id: "wit.workItems.GET", area: "wit", resource: "workItems", method: "GET", apiVersion: STABLE, routeParams: ["project", "id"], queryParams: ["$expand", "ids", "fields", "errorPolicy"] }),
19467
19495
  route({
19468
19496
  id: "wit.workItems.PATCH",
19469
19497
  area: "wit",
@@ -19473,17 +19501,53 @@ var init_routes = __esm({
19473
19501
  routeParams: ["project", "id"],
19474
19502
  queryParams: [],
19475
19503
  mediaType: "application/json-patch+json",
19476
- // test /rev guards a concurrent edit; tags, state and the board's Kanban column field are the only writes.
19504
+ // test /rev guards a concurrent edit; tags, state and the board's Kanban column field are the only engine writes.
19505
+ // `add` on a field sets it; `add` on /relations/- appends a link; no op removes or replaces anything.
19506
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-7.1 ("Add a link", "Add a tag")
19477
19507
  body: {
19478
19508
  kind: "json-patch",
19479
19509
  ops: ["test", "add"],
19480
19510
  paths: [
19481
19511
  { path: /^\/rev$/, value: { type: "integer", min: 1 } },
19482
- { path: /^\/fields\/System\.Tags$/, value: TEXT },
19512
+ // With the tracker write context, a tag write is a test of the current list, then an add editing allowlisted tags only.
19513
+ { path: /^\/fields\/System\.Tags$/, value: TEXT, configured: "tags" },
19483
19514
  // Also one of the configured progress-mapping states (validateAdoBody's allowedStates, design §7).
19484
19515
  { path: /^\/fields\/System\.State$/, value: TEXT, configured: "states" },
19485
19516
  // A column move can change System.State too, so it is held to the configured progress columns (critic amendments §A.14).
19486
- { path: /^\/fields\/WEF_[0-9A-F]{32}_Kanban\.Column$/, value: TEXT, configured: "columns" }
19517
+ { path: /^\/fields\/WEF_[0-9A-F]{32}_Kanban\.Column$/, value: TEXT, configured: "columns" },
19518
+ // Tracker writes (enqueue's update and link): title, description, AC, priority, and a parent or predecessor link.
19519
+ { path: /^\/fields\/System\.Title$/, value: TITLE, tracker: true },
19520
+ { path: /^\/fields\/System\.Description$/, value: ADAPTER_HTML, tracker: true },
19521
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.AcceptanceCriteria$/, value: ADAPTER_HTML, tracker: true },
19522
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.Priority$/, value: PRIORITY, tracker: true },
19523
+ { path: /^\/relations\/-$/, value: RELATION, configured: "relation", tracker: true }
19524
+ ]
19525
+ }
19526
+ }),
19527
+ // Create one work item (POST {project}/_apis/wit/workitems/${type}: the `$` is in the route template, the parameter is the type name).
19528
+ // Fields only: links go through the PATCH above once every id is known. Enqueue only (tracker: true).
19529
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.1
19530
+ route({
19531
+ id: "wit.workItems.POST",
19532
+ area: "wit",
19533
+ resource: "workItems",
19534
+ method: "POST",
19535
+ apiVersion: STABLE,
19536
+ routeParams: ["project", "type"],
19537
+ queryParams: [],
19538
+ mediaType: "application/json-patch+json",
19539
+ tracker: true,
19540
+ body: {
19541
+ kind: "json-patch",
19542
+ ops: ["add"],
19543
+ paths: [
19544
+ { path: /^\/fields\/System\.Title$/, value: TITLE },
19545
+ { path: /^\/fields\/System\.Description$/, value: ADAPTER_HTML },
19546
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.AcceptanceCriteria$/, value: ADAPTER_HTML },
19547
+ { path: /^\/fields\/Microsoft\.VSTS\.Common\.Priority$/, value: PRIORITY },
19548
+ // Every tag on the tracker write allowlist.
19549
+ { path: /^\/fields\/System\.Tags$/, value: TEXT, configured: "tags" },
19550
+ { path: /^\/fields\/System\.AreaPath$/, value: AREA_PATH, configured: "areaPath" }
19487
19551
  ]
19488
19552
  }
19489
19553
  }),
@@ -19524,7 +19588,7 @@ var init_routes = __esm({
19524
19588
  method: "GET",
19525
19589
  apiVersion: STABLE,
19526
19590
  routeParams: ["project", "repositoryId", "pullRequestId"],
19527
- queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "$top"]
19591
+ queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "searchCriteria.targetRefName", "$top"]
19528
19592
  }),
19529
19593
  route({
19530
19594
  id: "git.pullRequests.POST",
@@ -19589,20 +19653,45 @@ var init_routes = __esm({
19589
19653
  }
19590
19654
  }
19591
19655
  }),
19656
+ // `omg factory poll`'s open human threads (ADO parity design §2.2).
19657
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-threads/list?view=azure-devops-rest-7.1
19658
+ route({ id: "git.pullRequestThreads.GET", area: "git", resource: "pullRequestThreads", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19592
19659
  route({ id: "git.pullRequestIterations.GET", area: "git", resource: "pullRequestIterations", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19593
19660
  route({ id: "git.pullRequestStatuses.GET", area: "git", resource: "pullRequestStatuses", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
19594
19661
  // Policy (gates) and builds.
19595
19662
  route({ id: "policy.evaluations.GET", area: "policy", resource: "evaluations", method: "GET", apiVersion: "7.1-preview.1", routeParams: ["project"], queryParams: ["artifactId", "includeNotApplicable", "$top", "$skip"] }),
19596
19663
  // Requeue one evaluation (rerun a flaky or expired build); the REST call has no body.
19597
19664
  route({ id: "policy.evaluations.PATCH", area: "policy", resource: "evaluations", method: "PATCH", apiVersion: "7.1-preview.1", routeParams: ["project", "evaluationId"], queryParams: [], body: { kind: "none" } }),
19598
- // By id, or the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2).
19599
- route({ id: "build.builds.GET", area: "build", resource: "builds", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: ["branchName", "reasonFilter", "queryOrder", "$top"] }),
19665
+ // By id, the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2), or heal's pipeline history (ci.ts, ADO parity design §3.3).
19666
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-7.1
19667
+ route({
19668
+ id: "build.builds.GET",
19669
+ area: "build",
19670
+ resource: "builds",
19671
+ method: "GET",
19672
+ apiVersion: STABLE,
19673
+ routeParams: ["project", "buildId"],
19674
+ queryParams: ["branchName", "reasonFilter", "queryOrder", "$top", "definitions", "statusFilter", "resultFilter", "minTime"]
19675
+ }),
19676
+ // The heal pipeline pick (ADO parity design §3.2).
19677
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/build/definitions/list?view=azure-devops-rest-7.1
19678
+ route({
19679
+ id: "build.definitions.GET",
19680
+ area: "build",
19681
+ resource: "definitions",
19682
+ method: "GET",
19683
+ apiVersion: STABLE,
19684
+ routeParams: ["project", "definitionId"],
19685
+ queryParams: ["name", "repositoryId", "repositoryType", "includeAllProperties", "$top"]
19686
+ }),
19600
19687
  route({ id: "build.timeline.GET", area: "build", resource: "timeline", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: [] }),
19601
19688
  // Read as JSON ({ count, value: [lines] }): az devops invoke refuses a non-JSON response without --out-file, which the guard never allows.
19602
19689
  route({ id: "build.logs.GET", area: "build", resource: "logs", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId", "logId"], queryParams: [] })
19603
19690
  ]);
19604
19691
  ADO_WRITE_ALLOWLIST = Object.freeze([
19605
19692
  ["wit", "workItems", "PATCH"],
19693
+ // Enqueue only (the route's `tracker` flag).
19694
+ ["wit", "workItems", "POST"],
19606
19695
  ["wit", "comments", "POST"],
19607
19696
  ["wit", "wiql", "POST"],
19608
19697
  ["git", "pullRequests", "POST"],