oh-my-copilot 5.19.7 → 5.22.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 (1274) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +40 -5
  3. package/README.md +1 -1
  4. package/bridge/claude-md-coordinator.cjs +2 -2
  5. package/bridge/cli.cjs +9606 -4235
  6. package/bridge/mcp-server.cjs +4648 -1542
  7. package/bridge/runtime-cli.cjs +914 -518
  8. package/bridge/team-mcp.cjs +284 -245
  9. package/bridge/team.js +495 -78
  10. package/dist/__tests__/cli-config-stop-callback.test.js +52 -2
  11. package/dist/__tests__/cli-config-stop-callback.test.js.map +1 -1
  12. package/dist/__tests__/hud/copilot-host-visibility.test.js +7 -1
  13. package/dist/__tests__/hud/copilot-host-visibility.test.js.map +1 -1
  14. package/dist/__tests__/hud-windows.test.js +12 -0
  15. package/dist/__tests__/hud-windows.test.js.map +1 -1
  16. package/dist/__tests__/plugin-skill-budget.test.js +8 -6
  17. package/dist/__tests__/plugin-skill-budget.test.js.map +1 -1
  18. package/dist/__tests__/preemptive-compaction-hook.test.js +5 -1
  19. package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
  20. package/dist/__tests__/run-cjs-session-end-budget.test.js +39 -15
  21. package/dist/__tests__/run-cjs-session-end-budget.test.js.map +1 -1
  22. package/dist/__tests__/session-end-process-exit.test.js +13 -3
  23. package/dist/__tests__/session-end-process-exit.test.js.map +1 -1
  24. package/dist/__tests__/skills.test.js +49 -14
  25. package/dist/__tests__/skills.test.js.map +1 -1
  26. package/dist/alias-retirement/__tests__/registry.test.js +11 -3
  27. package/dist/alias-retirement/__tests__/registry.test.js.map +1 -1
  28. package/dist/budget/__tests__/budget.test.js +7 -0
  29. package/dist/budget/__tests__/budget.test.js.map +1 -1
  30. package/dist/budget/__tests__/ledger.tags.test.d.ts +2 -0
  31. package/dist/budget/__tests__/ledger.tags.test.d.ts.map +1 -0
  32. package/dist/budget/__tests__/ledger.tags.test.js +76 -0
  33. package/dist/budget/__tests__/ledger.tags.test.js.map +1 -0
  34. package/dist/budget/governor.d.ts.map +1 -1
  35. package/dist/budget/governor.js +3 -1
  36. package/dist/budget/governor.js.map +1 -1
  37. package/dist/budget/ledger.d.ts +27 -0
  38. package/dist/budget/ledger.d.ts.map +1 -1
  39. package/dist/budget/ledger.js +53 -1
  40. package/dist/budget/ledger.js.map +1 -1
  41. package/dist/cli/__tests__/team-resume-v2.test.d.ts +2 -0
  42. package/dist/cli/__tests__/team-resume-v2.test.d.ts.map +1 -0
  43. package/dist/cli/__tests__/team-resume-v2.test.js +149 -0
  44. package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -0
  45. package/dist/cli/__tests__/team.test.js +2 -1
  46. package/dist/cli/__tests__/team.test.js.map +1 -1
  47. package/dist/cli/commands/__tests__/budget-by-role.test.d.ts +2 -0
  48. package/dist/cli/commands/__tests__/budget-by-role.test.d.ts.map +1 -0
  49. package/dist/cli/commands/__tests__/budget-by-role.test.js +76 -0
  50. package/dist/cli/commands/__tests__/budget-by-role.test.js.map +1 -0
  51. package/dist/cli/commands/__tests__/factory-forge-cli.test.js +32 -4
  52. package/dist/cli/commands/__tests__/factory-forge-cli.test.js.map +1 -1
  53. package/dist/cli/commands/__tests__/factory-poll-local-sync.test.d.ts +2 -0
  54. package/dist/cli/commands/__tests__/factory-poll-local-sync.test.d.ts.map +1 -0
  55. package/dist/cli/commands/__tests__/factory-poll-local-sync.test.js +286 -0
  56. package/dist/cli/commands/__tests__/factory-poll-local-sync.test.js.map +1 -0
  57. package/dist/cli/commands/__tests__/factory-pr.test.d.ts +2 -0
  58. package/dist/cli/commands/__tests__/factory-pr.test.d.ts.map +1 -0
  59. package/dist/cli/commands/__tests__/factory-pr.test.js +154 -0
  60. package/dist/cli/commands/__tests__/factory-pr.test.js.map +1 -0
  61. package/dist/cli/commands/__tests__/factory-run-cli.test.js +217 -6
  62. package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
  63. package/dist/cli/commands/__tests__/factory-run-next-local.test.d.ts +2 -0
  64. package/dist/cli/commands/__tests__/factory-run-next-local.test.d.ts.map +1 -0
  65. package/dist/cli/commands/__tests__/factory-run-next-local.test.js +97 -0
  66. package/dist/cli/commands/__tests__/factory-run-next-local.test.js.map +1 -0
  67. package/dist/cli/commands/__tests__/ship-cli.test.js +14 -2
  68. package/dist/cli/commands/__tests__/ship-cli.test.js.map +1 -1
  69. package/dist/cli/commands/__tests__/team-lifecycle-output.test.d.ts +2 -0
  70. package/dist/cli/commands/__tests__/team-lifecycle-output.test.d.ts.map +1 -0
  71. package/dist/cli/commands/__tests__/team-lifecycle-output.test.js +113 -0
  72. package/dist/cli/commands/__tests__/team-lifecycle-output.test.js.map +1 -0
  73. package/dist/cli/commands/__tests__/team-role-shorthand.test.js +2 -1
  74. package/dist/cli/commands/__tests__/team-role-shorthand.test.js.map +1 -1
  75. package/dist/cli/commands/__tests__/team-status-json.test.js +47 -1
  76. package/dist/cli/commands/__tests__/team-status-json.test.js.map +1 -1
  77. package/dist/cli/commands/budget.d.ts +1 -0
  78. package/dist/cli/commands/budget.d.ts.map +1 -1
  79. package/dist/cli/commands/budget.js +18 -3
  80. package/dist/cli/commands/budget.js.map +1 -1
  81. package/dist/cli/commands/factory-board.js +3 -3
  82. package/dist/cli/commands/factory-board.js.map +1 -1
  83. package/dist/cli/commands/factory-check.d.ts.map +1 -1
  84. package/dist/cli/commands/factory-check.js +4 -4
  85. package/dist/cli/commands/factory-check.js.map +1 -1
  86. package/dist/cli/commands/factory-poll.d.ts.map +1 -1
  87. package/dist/cli/commands/factory-poll.js +6 -4
  88. package/dist/cli/commands/factory-poll.js.map +1 -1
  89. package/dist/cli/commands/factory-pr.d.ts +38 -0
  90. package/dist/cli/commands/factory-pr.d.ts.map +1 -0
  91. package/dist/cli/commands/factory-pr.js +185 -0
  92. package/dist/cli/commands/factory-pr.js.map +1 -0
  93. package/dist/cli/commands/factory-setup.d.ts +29 -0
  94. package/dist/cli/commands/factory-setup.d.ts.map +1 -1
  95. package/dist/cli/commands/factory-setup.js +183 -34
  96. package/dist/cli/commands/factory-setup.js.map +1 -1
  97. package/dist/cli/commands/factory-triage.d.ts +9 -0
  98. package/dist/cli/commands/factory-triage.d.ts.map +1 -0
  99. package/dist/cli/commands/factory-triage.js +42 -0
  100. package/dist/cli/commands/factory-triage.js.map +1 -0
  101. package/dist/cli/commands/factory.d.ts +59 -6
  102. package/dist/cli/commands/factory.d.ts.map +1 -1
  103. package/dist/cli/commands/factory.js +360 -83
  104. package/dist/cli/commands/factory.js.map +1 -1
  105. package/dist/cli/commands/ship.d.ts.map +1 -1
  106. package/dist/cli/commands/ship.js +7 -3
  107. package/dist/cli/commands/ship.js.map +1 -1
  108. package/dist/cli/commands/team.d.ts +13 -0
  109. package/dist/cli/commands/team.d.ts.map +1 -1
  110. package/dist/cli/commands/team.js +63 -6
  111. package/dist/cli/commands/team.js.map +1 -1
  112. package/dist/cli/index.d.ts.map +1 -1
  113. package/dist/cli/index.js +26 -5
  114. package/dist/cli/index.js.map +1 -1
  115. package/dist/cli/team.d.ts.map +1 -1
  116. package/dist/cli/team.js +23 -0
  117. package/dist/cli/team.js.map +1 -1
  118. package/dist/copilot-run/__tests__/sandbox.state-deny.test.d.ts +2 -0
  119. package/dist/copilot-run/__tests__/sandbox.state-deny.test.d.ts.map +1 -0
  120. package/dist/copilot-run/__tests__/sandbox.state-deny.test.js +95 -0
  121. package/dist/copilot-run/__tests__/sandbox.state-deny.test.js.map +1 -0
  122. package/dist/copilot-run/__tests__/sandbox.test.js +2 -0
  123. package/dist/copilot-run/__tests__/sandbox.test.js.map +1 -1
  124. package/dist/copilot-run/job.d.ts +3 -0
  125. package/dist/copilot-run/job.d.ts.map +1 -1
  126. package/dist/copilot-run/job.js +2 -0
  127. package/dist/copilot-run/job.js.map +1 -1
  128. package/dist/copilot-run/sandbox.d.ts +2 -0
  129. package/dist/copilot-run/sandbox.d.ts.map +1 -1
  130. package/dist/copilot-run/sandbox.js +41 -10
  131. package/dist/copilot-run/sandbox.js.map +1 -1
  132. package/dist/factory/__tests__/enqueue-local.test.d.ts +2 -0
  133. package/dist/factory/__tests__/enqueue-local.test.d.ts.map +1 -0
  134. package/dist/factory/__tests__/enqueue-local.test.js +66 -0
  135. package/dist/factory/__tests__/enqueue-local.test.js.map +1 -0
  136. package/dist/factory/__tests__/offline-e2e.test.d.ts +2 -0
  137. package/dist/factory/__tests__/offline-e2e.test.d.ts.map +1 -0
  138. package/dist/factory/__tests__/offline-e2e.test.js +360 -0
  139. package/dist/factory/__tests__/offline-e2e.test.js.map +1 -0
  140. package/dist/factory/__tests__/poll-ado.test.js +10 -8
  141. package/dist/factory/__tests__/poll-ado.test.js.map +1 -1
  142. package/dist/factory/__tests__/poll-local.test.d.ts +2 -0
  143. package/dist/factory/__tests__/poll-local.test.d.ts.map +1 -0
  144. package/dist/factory/__tests__/poll-local.test.js +86 -0
  145. package/dist/factory/__tests__/poll-local.test.js.map +1 -0
  146. package/dist/factory/__tests__/poll.test.js +90 -2
  147. package/dist/factory/__tests__/poll.test.js.map +1 -1
  148. package/dist/factory/__tests__/status.test.js +10 -3
  149. package/dist/factory/__tests__/status.test.js.map +1 -1
  150. package/dist/factory/__tests__/triage-ado.test.d.ts +7 -0
  151. package/dist/factory/__tests__/triage-ado.test.d.ts.map +1 -0
  152. package/dist/factory/__tests__/triage-ado.test.js +67 -0
  153. package/dist/factory/__tests__/triage-ado.test.js.map +1 -0
  154. package/dist/factory/__tests__/triage-github.test.d.ts +2 -0
  155. package/dist/factory/__tests__/triage-github.test.d.ts.map +1 -0
  156. package/dist/factory/__tests__/triage-github.test.js +246 -0
  157. package/dist/factory/__tests__/triage-github.test.js.map +1 -0
  158. package/dist/factory/__tests__/triage-local.test.d.ts +7 -0
  159. package/dist/factory/__tests__/triage-local.test.d.ts.map +1 -0
  160. package/dist/factory/__tests__/triage-local.test.js +51 -0
  161. package/dist/factory/__tests__/triage-local.test.js.map +1 -0
  162. package/dist/factory/board/__tests__/board-local.test.d.ts +2 -0
  163. package/dist/factory/board/__tests__/board-local.test.d.ts.map +1 -0
  164. package/dist/factory/board/__tests__/board-local.test.js +47 -0
  165. package/dist/factory/board/__tests__/board-local.test.js.map +1 -0
  166. package/dist/factory/board/__tests__/board.test.js +15 -3
  167. package/dist/factory/board/__tests__/board.test.js.map +1 -1
  168. package/dist/factory/board/collect.d.ts +8 -0
  169. package/dist/factory/board/collect.d.ts.map +1 -1
  170. package/dist/factory/board/collect.js +28 -2
  171. package/dist/factory/board/collect.js.map +1 -1
  172. package/dist/factory/board/render.d.ts.map +1 -1
  173. package/dist/factory/board/render.js +2 -0
  174. package/dist/factory/board/render.js.map +1 -1
  175. package/dist/factory/check/__tests__/cli-local.test.d.ts +2 -0
  176. package/dist/factory/check/__tests__/cli-local.test.d.ts.map +1 -0
  177. package/dist/factory/check/__tests__/cli-local.test.js +229 -0
  178. package/dist/factory/check/__tests__/cli-local.test.js.map +1 -0
  179. package/dist/factory/check/__tests__/cli.test.js +4 -2
  180. package/dist/factory/check/__tests__/cli.test.js.map +1 -1
  181. package/dist/factory/check/__tests__/local-repo.d.ts +44 -0
  182. package/dist/factory/check/__tests__/local-repo.d.ts.map +1 -0
  183. package/dist/factory/check/__tests__/local-repo.js +74 -0
  184. package/dist/factory/check/__tests__/local-repo.js.map +1 -0
  185. package/dist/factory/check/__tests__/rules.test.js +22 -0
  186. package/dist/factory/check/__tests__/rules.test.js.map +1 -1
  187. package/dist/factory/check/cli.d.ts +43 -2
  188. package/dist/factory/check/cli.d.ts.map +1 -1
  189. package/dist/factory/check/cli.js +146 -16
  190. package/dist/factory/check/cli.js.map +1 -1
  191. package/dist/factory/check/rules.d.ts +4 -2
  192. package/dist/factory/check/rules.d.ts.map +1 -1
  193. package/dist/factory/check/rules.js +19 -3
  194. package/dist/factory/check/rules.js.map +1 -1
  195. package/dist/factory/enqueue.d.ts +2 -1
  196. package/dist/factory/enqueue.d.ts.map +1 -1
  197. package/dist/factory/enqueue.js +56 -24
  198. package/dist/factory/enqueue.js.map +1 -1
  199. package/dist/factory/heal/__tests__/cli.test.js +52 -2
  200. package/dist/factory/heal/__tests__/cli.test.js.map +1 -1
  201. package/dist/factory/heal/cli.d.ts.map +1 -1
  202. package/dist/factory/heal/cli.js +84 -31
  203. package/dist/factory/heal/cli.js.map +1 -1
  204. package/dist/factory/heal/implement.d.ts +3 -1
  205. package/dist/factory/heal/implement.d.ts.map +1 -1
  206. package/dist/factory/heal/implement.js +1 -0
  207. package/dist/factory/heal/implement.js.map +1 -1
  208. package/dist/factory/poll.d.ts +27 -2
  209. package/dist/factory/poll.d.ts.map +1 -1
  210. package/dist/factory/poll.js +95 -32
  211. package/dist/factory/poll.js.map +1 -1
  212. package/dist/factory/run/__tests__/claims.test.d.ts +2 -0
  213. package/dist/factory/run/__tests__/claims.test.d.ts.map +1 -0
  214. package/dist/factory/run/__tests__/claims.test.js +335 -0
  215. package/dist/factory/run/__tests__/claims.test.js.map +1 -0
  216. package/dist/factory/run/__tests__/engine-local-harness.d.ts +42 -0
  217. package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -0
  218. package/dist/factory/run/__tests__/engine-local-harness.js +88 -0
  219. package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -0
  220. package/dist/factory/run/__tests__/engine.ado.heal.test.js +2 -2
  221. package/dist/factory/run/__tests__/engine.ado.heal.test.js.map +1 -1
  222. package/dist/factory/run/__tests__/engine.local.dogfood.test.d.ts +2 -0
  223. package/dist/factory/run/__tests__/engine.local.dogfood.test.d.ts.map +1 -0
  224. package/dist/factory/run/__tests__/engine.local.dogfood.test.js +275 -0
  225. package/dist/factory/run/__tests__/engine.local.dogfood.test.js.map +1 -0
  226. package/dist/factory/run/__tests__/engine.local.test.d.ts +2 -0
  227. package/dist/factory/run/__tests__/engine.local.test.d.ts.map +1 -0
  228. package/dist/factory/run/__tests__/engine.local.test.js +236 -0
  229. package/dist/factory/run/__tests__/engine.local.test.js.map +1 -0
  230. package/dist/factory/run/__tests__/engine.resume.test.js +2 -1
  231. package/dist/factory/run/__tests__/engine.resume.test.js.map +1 -1
  232. package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
  233. package/dist/factory/run/__tests__/fake-lanes.js +11 -1
  234. package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
  235. package/dist/factory/run/__tests__/forge-roots.test.js +116 -2
  236. package/dist/factory/run/__tests__/forge-roots.test.js.map +1 -1
  237. package/dist/factory/run/__tests__/lane.test.js +14 -0
  238. package/dist/factory/run/__tests__/lane.test.js.map +1 -1
  239. package/dist/factory/run/__tests__/local-forge-units.test.d.ts +2 -0
  240. package/dist/factory/run/__tests__/local-forge-units.test.d.ts.map +1 -0
  241. package/dist/factory/run/__tests__/local-forge-units.test.js +549 -0
  242. package/dist/factory/run/__tests__/local-forge-units.test.js.map +1 -0
  243. package/dist/factory/run/__tests__/local-gate.orphans.test.d.ts +2 -0
  244. package/dist/factory/run/__tests__/local-gate.orphans.test.d.ts.map +1 -0
  245. package/dist/factory/run/__tests__/local-gate.orphans.test.js +230 -0
  246. package/dist/factory/run/__tests__/local-gate.orphans.test.js.map +1 -0
  247. package/dist/factory/run/__tests__/local-gate.sources.test.d.ts +2 -0
  248. package/dist/factory/run/__tests__/local-gate.sources.test.d.ts.map +1 -0
  249. package/dist/factory/run/__tests__/local-gate.sources.test.js +88 -0
  250. package/dist/factory/run/__tests__/local-gate.sources.test.js.map +1 -0
  251. package/dist/factory/run/__tests__/prepare-gates.crash.test.js +24 -1
  252. package/dist/factory/run/__tests__/prepare-gates.crash.test.js.map +1 -1
  253. package/dist/factory/run/__tests__/prepare-gates.test.js +11 -1
  254. package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
  255. package/dist/factory/run/__tests__/prompts.test.d.ts +4 -0
  256. package/dist/factory/run/__tests__/prompts.test.d.ts.map +1 -0
  257. package/dist/factory/run/__tests__/prompts.test.js +61 -0
  258. package/dist/factory/run/__tests__/prompts.test.js.map +1 -0
  259. package/dist/factory/run/__tests__/review-guard.test.js +15 -0
  260. package/dist/factory/run/__tests__/review-guard.test.js.map +1 -1
  261. package/dist/factory/run/__tests__/units.test.js +63 -0
  262. package/dist/factory/run/__tests__/units.test.js.map +1 -1
  263. package/dist/factory/run/budget.d.ts.map +1 -1
  264. package/dist/factory/run/budget.js +8 -2
  265. package/dist/factory/run/budget.js.map +1 -1
  266. package/dist/factory/run/claims.d.ts +123 -0
  267. package/dist/factory/run/claims.d.ts.map +1 -0
  268. package/dist/factory/run/claims.js +377 -0
  269. package/dist/factory/run/claims.js.map +1 -0
  270. package/dist/factory/run/clean.d.ts +4 -2
  271. package/dist/factory/run/clean.d.ts.map +1 -1
  272. package/dist/factory/run/clean.js +32 -11
  273. package/dist/factory/run/clean.js.map +1 -1
  274. package/dist/factory/run/engine.d.ts +31 -19
  275. package/dist/factory/run/engine.d.ts.map +1 -1
  276. package/dist/factory/run/engine.js +545 -257
  277. package/dist/factory/run/engine.js.map +1 -1
  278. package/dist/factory/run/exec.d.ts +112 -5
  279. package/dist/factory/run/exec.d.ts.map +1 -1
  280. package/dist/factory/run/exec.js +235 -16
  281. package/dist/factory/run/exec.js.map +1 -1
  282. package/dist/factory/run/forge-roots.d.ts +63 -1
  283. package/dist/factory/run/forge-roots.d.ts.map +1 -1
  284. package/dist/factory/run/forge-roots.js +245 -13
  285. package/dist/factory/run/forge-roots.js.map +1 -1
  286. package/dist/factory/run/gate-procs.d.ts +74 -0
  287. package/dist/factory/run/gate-procs.d.ts.map +1 -0
  288. package/dist/factory/run/gate-procs.js +204 -0
  289. package/dist/factory/run/gate-procs.js.map +1 -0
  290. package/dist/factory/run/lane.d.ts +5 -0
  291. package/dist/factory/run/lane.d.ts.map +1 -1
  292. package/dist/factory/run/lane.js +1 -1
  293. package/dist/factory/run/lane.js.map +1 -1
  294. package/dist/factory/run/local-gate.d.ts +161 -0
  295. package/dist/factory/run/local-gate.d.ts.map +1 -0
  296. package/dist/factory/run/local-gate.js +475 -0
  297. package/dist/factory/run/local-gate.js.map +1 -0
  298. package/dist/factory/run/prepare.d.ts +8 -0
  299. package/dist/factory/run/prepare.d.ts.map +1 -1
  300. package/dist/factory/run/prepare.js +28 -1
  301. package/dist/factory/run/prepare.js.map +1 -1
  302. package/dist/factory/run/prompts.d.ts +32 -0
  303. package/dist/factory/run/prompts.d.ts.map +1 -0
  304. package/dist/factory/run/prompts.js +186 -0
  305. package/dist/factory/run/prompts.js.map +1 -0
  306. package/dist/factory/run/reset.d.ts +48 -0
  307. package/dist/factory/run/reset.d.ts.map +1 -0
  308. package/dist/factory/run/reset.js +174 -0
  309. package/dist/factory/run/reset.js.map +1 -0
  310. package/dist/factory/run/review-guard.d.ts +8 -0
  311. package/dist/factory/run/review-guard.d.ts.map +1 -1
  312. package/dist/factory/run/review-guard.js +2 -0
  313. package/dist/factory/run/review-guard.js.map +1 -1
  314. package/dist/factory/run/state.d.ts +133 -14
  315. package/dist/factory/run/state.d.ts.map +1 -1
  316. package/dist/factory/run/state.js +185 -27
  317. package/dist/factory/run/state.js.map +1 -1
  318. package/dist/factory/setup/__tests__/intake-pick-local.test.d.ts +2 -0
  319. package/dist/factory/setup/__tests__/intake-pick-local.test.d.ts.map +1 -0
  320. package/dist/factory/setup/__tests__/intake-pick-local.test.js +13 -0
  321. package/dist/factory/setup/__tests__/intake-pick-local.test.js.map +1 -0
  322. package/dist/factory/setup/__tests__/pipeline-pick.test.js +1 -1
  323. package/dist/factory/setup/__tests__/pipeline-pick.test.js.map +1 -1
  324. package/dist/factory/setup/__tests__/setup-local.test.d.ts +2 -0
  325. package/dist/factory/setup/__tests__/setup-local.test.d.ts.map +1 -0
  326. package/dist/factory/setup/__tests__/setup-local.test.js +158 -0
  327. package/dist/factory/setup/__tests__/setup-local.test.js.map +1 -0
  328. package/dist/factory/setup/__tests__/setup.test.js.map +1 -1
  329. package/dist/factory/setup/__tests__/workflows.test.d.ts +2 -0
  330. package/dist/factory/setup/__tests__/workflows.test.d.ts.map +1 -0
  331. package/dist/factory/setup/__tests__/workflows.test.js +410 -0
  332. package/dist/factory/setup/__tests__/workflows.test.js.map +1 -0
  333. package/dist/factory/setup/__tests__/write.test.js +11 -0
  334. package/dist/factory/setup/__tests__/write.test.js.map +1 -1
  335. package/dist/factory/setup/detect.d.ts +5 -3
  336. package/dist/factory/setup/detect.d.ts.map +1 -1
  337. package/dist/factory/setup/detect.js +21 -6
  338. package/dist/factory/setup/detect.js.map +1 -1
  339. package/dist/factory/setup/guard.d.ts.map +1 -1
  340. package/dist/factory/setup/guard.js +6 -1
  341. package/dist/factory/setup/guard.js.map +1 -1
  342. package/dist/factory/setup/intake-pick.d.ts.map +1 -1
  343. package/dist/factory/setup/intake-pick.js +16 -0
  344. package/dist/factory/setup/intake-pick.js.map +1 -1
  345. package/dist/factory/setup/workflows.d.ts +46 -0
  346. package/dist/factory/setup/workflows.d.ts.map +1 -0
  347. package/dist/factory/setup/workflows.js +175 -0
  348. package/dist/factory/setup/workflows.js.map +1 -0
  349. package/dist/factory/setup/write.d.ts +14 -1
  350. package/dist/factory/setup/write.d.ts.map +1 -1
  351. package/dist/factory/setup/write.js +58 -9
  352. package/dist/factory/setup/write.js.map +1 -1
  353. package/dist/factory/triage/__tests__/rules.test.d.ts +2 -0
  354. package/dist/factory/triage/__tests__/rules.test.d.ts.map +1 -0
  355. package/dist/factory/triage/__tests__/rules.test.js +68 -0
  356. package/dist/factory/triage/__tests__/rules.test.js.map +1 -0
  357. package/dist/factory/triage/cli.d.ts +67 -0
  358. package/dist/factory/triage/cli.d.ts.map +1 -0
  359. package/dist/factory/triage/cli.js +228 -0
  360. package/dist/factory/triage/cli.js.map +1 -0
  361. package/dist/factory/triage/guard.d.ts +29 -0
  362. package/dist/factory/triage/guard.d.ts.map +1 -0
  363. package/dist/factory/triage/guard.js +52 -0
  364. package/dist/factory/triage/guard.js.map +1 -0
  365. package/dist/factory/triage/rules.d.ts +51 -0
  366. package/dist/factory/triage/rules.d.ts.map +1 -0
  367. package/dist/factory/triage/rules.js +111 -0
  368. package/dist/factory/triage/rules.js.map +1 -0
  369. package/dist/features/__tests__/jev-model-routing.test.js +20 -1
  370. package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
  371. package/dist/features/index.d.ts +2 -0
  372. package/dist/features/index.d.ts.map +1 -1
  373. package/dist/features/index.js +4 -0
  374. package/dist/features/index.js.map +1 -1
  375. package/dist/features/jev-model-routing.d.ts.map +1 -1
  376. package/dist/features/jev-model-routing.js +6 -0
  377. package/dist/features/jev-model-routing.js.map +1 -1
  378. package/dist/features/jev-slop-warning.d.ts.map +1 -1
  379. package/dist/features/jev-slop-warning.js +1 -0
  380. package/dist/features/jev-slop-warning.js.map +1 -1
  381. package/dist/features/model-routing/__tests__/profiles.test.d.ts +2 -0
  382. package/dist/features/model-routing/__tests__/profiles.test.d.ts.map +1 -0
  383. package/dist/features/model-routing/__tests__/profiles.test.js +32 -0
  384. package/dist/features/model-routing/__tests__/profiles.test.js.map +1 -0
  385. package/dist/features/model-routing/profiles.d.ts +17 -0
  386. package/dist/features/model-routing/profiles.d.ts.map +1 -0
  387. package/dist/features/model-routing/profiles.js +53 -0
  388. package/dist/features/model-routing/profiles.js.map +1 -0
  389. package/dist/features/verification-ledger/__tests__/ledger.test.d.ts +2 -0
  390. package/dist/features/verification-ledger/__tests__/ledger.test.d.ts.map +1 -0
  391. package/dist/features/verification-ledger/__tests__/ledger.test.js +163 -0
  392. package/dist/features/verification-ledger/__tests__/ledger.test.js.map +1 -0
  393. package/dist/features/verification-ledger/index.d.ts +8 -0
  394. package/dist/features/verification-ledger/index.d.ts.map +1 -0
  395. package/dist/features/verification-ledger/index.js +8 -0
  396. package/dist/features/verification-ledger/index.js.map +1 -0
  397. package/dist/features/verification-ledger/ledger.d.ts +61 -0
  398. package/dist/features/verification-ledger/ledger.d.ts.map +1 -0
  399. package/dist/features/verification-ledger/ledger.js +141 -0
  400. package/dist/features/verification-ledger/ledger.js.map +1 -0
  401. package/dist/features/watch-pr/__tests__/policy.test.d.ts +2 -0
  402. package/dist/features/watch-pr/__tests__/policy.test.d.ts.map +1 -0
  403. package/dist/features/watch-pr/__tests__/policy.test.js +128 -0
  404. package/dist/features/watch-pr/__tests__/policy.test.js.map +1 -0
  405. package/dist/features/watch-pr/index.d.ts +9 -0
  406. package/dist/features/watch-pr/index.d.ts.map +1 -0
  407. package/dist/features/watch-pr/index.js +9 -0
  408. package/dist/features/watch-pr/index.js.map +1 -0
  409. package/dist/features/watch-pr/policy.d.ts +66 -0
  410. package/dist/features/watch-pr/policy.d.ts.map +1 -0
  411. package/dist/features/watch-pr/policy.js +118 -0
  412. package/dist/features/watch-pr/policy.js.map +1 -0
  413. package/dist/forge/__tests__/config.test.js +104 -0
  414. package/dist/forge/__tests__/config.test.js.map +1 -1
  415. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +27 -0
  416. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
  417. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js +19 -2
  418. package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js.map +1 -1
  419. package/dist/forge/__tests__/no-spawn.test.js +71 -1
  420. package/dist/forge/__tests__/no-spawn.test.js.map +1 -1
  421. package/dist/forge/__tests__/review-feedback.test.d.ts +2 -0
  422. package/dist/forge/__tests__/review-feedback.test.d.ts.map +1 -0
  423. package/dist/forge/__tests__/review-feedback.test.js +49 -0
  424. package/dist/forge/__tests__/review-feedback.test.js.map +1 -0
  425. package/dist/forge/ado/__tests__/reviews-feedback.test.d.ts +2 -0
  426. package/dist/forge/ado/__tests__/reviews-feedback.test.d.ts.map +1 -0
  427. package/dist/forge/ado/__tests__/reviews-feedback.test.js +111 -0
  428. package/dist/forge/ado/__tests__/reviews-feedback.test.js.map +1 -0
  429. package/dist/forge/ado/index.js +1 -1
  430. package/dist/forge/ado/index.js.map +1 -1
  431. package/dist/forge/ado/reviews.d.ts +23 -2
  432. package/dist/forge/ado/reviews.d.ts.map +1 -1
  433. package/dist/forge/ado/reviews.js +87 -1
  434. package/dist/forge/ado/reviews.js.map +1 -1
  435. package/dist/forge/ado/routes.d.ts +2 -0
  436. package/dist/forge/ado/routes.d.ts.map +1 -1
  437. package/dist/forge/ado/routes.js +4 -0
  438. package/dist/forge/ado/routes.js.map +1 -1
  439. package/dist/forge/ado/tracker.d.ts.map +1 -1
  440. package/dist/forge/ado/tracker.js +22 -0
  441. package/dist/forge/ado/tracker.js.map +1 -1
  442. package/dist/forge/config.d.ts +30 -4
  443. package/dist/forge/config.d.ts.map +1 -1
  444. package/dist/forge/config.js +144 -20
  445. package/dist/forge/config.js.map +1 -1
  446. package/dist/forge/github/__tests__/coding-agent.test.d.ts +2 -0
  447. package/dist/forge/github/__tests__/coding-agent.test.d.ts.map +1 -0
  448. package/dist/forge/github/__tests__/coding-agent.test.js +623 -0
  449. package/dist/forge/github/__tests__/coding-agent.test.js.map +1 -0
  450. package/dist/forge/github/__tests__/reviews-feedback.test.d.ts +2 -0
  451. package/dist/forge/github/__tests__/reviews-feedback.test.d.ts.map +1 -0
  452. package/dist/forge/github/__tests__/reviews-feedback.test.js +357 -0
  453. package/dist/forge/github/__tests__/reviews-feedback.test.js.map +1 -0
  454. package/dist/forge/github/coding-agent.d.ts +274 -0
  455. package/dist/forge/github/coding-agent.d.ts.map +1 -0
  456. package/dist/forge/github/coding-agent.js +459 -0
  457. package/dist/forge/github/coding-agent.js.map +1 -0
  458. package/dist/forge/github/graphql.d.ts +56 -0
  459. package/dist/forge/github/graphql.d.ts.map +1 -0
  460. package/dist/forge/github/graphql.js +247 -0
  461. package/dist/forge/github/graphql.js.map +1 -0
  462. package/dist/forge/github/index.js +1 -1
  463. package/dist/forge/github/index.js.map +1 -1
  464. package/dist/forge/github/reviews.d.ts +16 -2
  465. package/dist/forge/github/reviews.d.ts.map +1 -1
  466. package/dist/forge/github/reviews.js +30 -1
  467. package/dist/forge/github/reviews.js.map +1 -1
  468. package/dist/forge/github/tracker.d.ts +6 -1
  469. package/dist/forge/github/tracker.d.ts.map +1 -1
  470. package/dist/forge/github/tracker.js +10 -0
  471. package/dist/forge/github/tracker.js.map +1 -1
  472. package/dist/forge/index.d.ts.map +1 -1
  473. package/dist/forge/index.js +3 -0
  474. package/dist/forge/index.js.map +1 -1
  475. package/dist/forge/local/__tests__/backlog.test.d.ts +2 -0
  476. package/dist/forge/local/__tests__/backlog.test.d.ts.map +1 -0
  477. package/dist/forge/local/__tests__/backlog.test.js +122 -0
  478. package/dist/forge/local/__tests__/backlog.test.js.map +1 -0
  479. package/dist/forge/local/__tests__/checks.test.d.ts +2 -0
  480. package/dist/forge/local/__tests__/checks.test.d.ts.map +1 -0
  481. package/dist/forge/local/__tests__/checks.test.js +90 -0
  482. package/dist/forge/local/__tests__/checks.test.js.map +1 -0
  483. package/dist/forge/local/__tests__/git-fixture.d.ts +29 -0
  484. package/dist/forge/local/__tests__/git-fixture.d.ts.map +1 -0
  485. package/dist/forge/local/__tests__/git-fixture.js +54 -0
  486. package/dist/forge/local/__tests__/git-fixture.js.map +1 -0
  487. package/dist/forge/local/__tests__/index.test.d.ts +2 -0
  488. package/dist/forge/local/__tests__/index.test.d.ts.map +1 -0
  489. package/dist/forge/local/__tests__/index.test.js +100 -0
  490. package/dist/forge/local/__tests__/index.test.js.map +1 -0
  491. package/dist/forge/local/__tests__/mirror.test.d.ts +2 -0
  492. package/dist/forge/local/__tests__/mirror.test.d.ts.map +1 -0
  493. package/dist/forge/local/__tests__/mirror.test.js +74 -0
  494. package/dist/forge/local/__tests__/mirror.test.js.map +1 -0
  495. package/dist/forge/local/__tests__/reviews-playback.test.d.ts +2 -0
  496. package/dist/forge/local/__tests__/reviews-playback.test.d.ts.map +1 -0
  497. package/dist/forge/local/__tests__/reviews-playback.test.js +89 -0
  498. package/dist/forge/local/__tests__/reviews-playback.test.js.map +1 -0
  499. package/dist/forge/local/__tests__/reviews.test.d.ts +2 -0
  500. package/dist/forge/local/__tests__/reviews.test.d.ts.map +1 -0
  501. package/dist/forge/local/__tests__/reviews.test.js +110 -0
  502. package/dist/forge/local/__tests__/reviews.test.js.map +1 -0
  503. package/dist/forge/local/__tests__/store-memo.test.d.ts +2 -0
  504. package/dist/forge/local/__tests__/store-memo.test.d.ts.map +1 -0
  505. package/dist/forge/local/__tests__/store-memo.test.js +43 -0
  506. package/dist/forge/local/__tests__/store-memo.test.js.map +1 -0
  507. package/dist/forge/local/__tests__/store.locks.test.d.ts +2 -0
  508. package/dist/forge/local/__tests__/store.locks.test.d.ts.map +1 -0
  509. package/dist/forge/local/__tests__/store.locks.test.js +79 -0
  510. package/dist/forge/local/__tests__/store.locks.test.js.map +1 -0
  511. package/dist/forge/local/__tests__/store.test.d.ts +2 -0
  512. package/dist/forge/local/__tests__/store.test.d.ts.map +1 -0
  513. package/dist/forge/local/__tests__/store.test.js +149 -0
  514. package/dist/forge/local/__tests__/store.test.js.map +1 -0
  515. package/dist/forge/local/__tests__/tracker.reopen.test.d.ts +2 -0
  516. package/dist/forge/local/__tests__/tracker.reopen.test.d.ts.map +1 -0
  517. package/dist/forge/local/__tests__/tracker.reopen.test.js +50 -0
  518. package/dist/forge/local/__tests__/tracker.reopen.test.js.map +1 -0
  519. package/dist/forge/local/__tests__/tracker.test.d.ts +2 -0
  520. package/dist/forge/local/__tests__/tracker.test.d.ts.map +1 -0
  521. package/dist/forge/local/__tests__/tracker.test.js +192 -0
  522. package/dist/forge/local/__tests__/tracker.test.js.map +1 -0
  523. package/dist/forge/local/__tests__/tracker.working.test.d.ts +2 -0
  524. package/dist/forge/local/__tests__/tracker.working.test.d.ts.map +1 -0
  525. package/dist/forge/local/__tests__/tracker.working.test.js +42 -0
  526. package/dist/forge/local/__tests__/tracker.working.test.js.map +1 -0
  527. package/dist/forge/local/backlog.d.ts +57 -0
  528. package/dist/forge/local/backlog.d.ts.map +1 -0
  529. package/dist/forge/local/backlog.js +190 -0
  530. package/dist/forge/local/backlog.js.map +1 -0
  531. package/dist/forge/local/checks.d.ts +41 -0
  532. package/dist/forge/local/checks.d.ts.map +1 -0
  533. package/dist/forge/local/checks.js +138 -0
  534. package/dist/forge/local/checks.js.map +1 -0
  535. package/dist/forge/local/index.d.ts +25 -0
  536. package/dist/forge/local/index.d.ts.map +1 -0
  537. package/dist/forge/local/index.js +107 -0
  538. package/dist/forge/local/index.js.map +1 -0
  539. package/dist/forge/local/merge.d.ts +8 -0
  540. package/dist/forge/local/merge.d.ts.map +1 -0
  541. package/dist/forge/local/merge.js +18 -0
  542. package/dist/forge/local/merge.js.map +1 -0
  543. package/dist/forge/local/mirror.d.ts +55 -0
  544. package/dist/forge/local/mirror.d.ts.map +1 -0
  545. package/dist/forge/local/mirror.js +96 -0
  546. package/dist/forge/local/mirror.js.map +1 -0
  547. package/dist/forge/local/reviews.d.ts +39 -0
  548. package/dist/forge/local/reviews.d.ts.map +1 -0
  549. package/dist/forge/local/reviews.js +158 -0
  550. package/dist/forge/local/reviews.js.map +1 -0
  551. package/dist/forge/local/store.d.ts +106 -0
  552. package/dist/forge/local/store.d.ts.map +1 -0
  553. package/dist/forge/local/store.js +286 -0
  554. package/dist/forge/local/store.js.map +1 -0
  555. package/dist/forge/local/tracker.d.ts +41 -0
  556. package/dist/forge/local/tracker.d.ts.map +1 -0
  557. package/dist/forge/local/tracker.js +344 -0
  558. package/dist/forge/local/tracker.js.map +1 -0
  559. package/dist/forge/review-feedback.d.ts +45 -0
  560. package/dist/forge/review-feedback.d.ts.map +1 -0
  561. package/dist/forge/review-feedback.js +79 -0
  562. package/dist/forge/review-feedback.js.map +1 -0
  563. package/dist/forge/terms.d.ts +18 -0
  564. package/dist/forge/terms.d.ts.map +1 -0
  565. package/dist/forge/terms.js +14 -0
  566. package/dist/forge/terms.js.map +1 -0
  567. package/dist/forge/types.d.ts +104 -2
  568. package/dist/forge/types.d.ts.map +1 -1
  569. package/dist/forge/types.js.map +1 -1
  570. package/dist/graph/schema.d.ts +6 -6
  571. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
  572. package/dist/hooks/code-simplifier/jev-shadow.js +1 -0
  573. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
  574. package/dist/hooks/jev/__tests__/active-mode.test.js +3 -1
  575. package/dist/hooks/jev/__tests__/active-mode.test.js.map +1 -1
  576. package/dist/hooks/jev/__tests__/resolver.test.js +33 -1
  577. package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
  578. package/dist/hooks/jev/points.d.ts +7 -1
  579. package/dist/hooks/jev/points.d.ts.map +1 -1
  580. package/dist/hooks/jev/points.js +20 -3
  581. package/dist/hooks/jev/points.js.map +1 -1
  582. package/dist/hooks/jev/resolver.d.ts +20 -0
  583. package/dist/hooks/jev/resolver.d.ts.map +1 -1
  584. package/dist/hooks/jev/resolver.js +50 -11
  585. package/dist/hooks/jev/resolver.js.map +1 -1
  586. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +23 -1
  587. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
  588. package/dist/hooks/keyword-detector/index.d.ts +1 -1
  589. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  590. package/dist/hooks/keyword-detector/index.js +7 -1
  591. package/dist/hooks/keyword-detector/index.js.map +1 -1
  592. package/dist/hooks/keyword-detector/jev-shadow.d.ts.map +1 -1
  593. package/dist/hooks/keyword-detector/jev-shadow.js +2 -0
  594. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
  595. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +2 -2
  596. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
  597. package/dist/hooks/learner/jev-shadow.d.ts.map +1 -1
  598. package/dist/hooks/learner/jev-shadow.js +1 -0
  599. package/dist/hooks/learner/jev-shadow.js.map +1 -1
  600. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +109 -9
  601. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
  602. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
  603. package/dist/hooks/persistent-mode/jev-shadow.js +17 -0
  604. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
  605. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js +50 -4
  606. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js.map +1 -1
  607. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts +14 -5
  608. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts.map +1 -1
  609. package/dist/hooks/preemptive-compaction/jev-shadow.js +39 -11
  610. package/dist/hooks/preemptive-compaction/jev-shadow.js.map +1 -1
  611. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +105 -0
  612. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
  613. package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
  614. package/dist/hooks/ralph/feedback-baseline.js +7 -0
  615. package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
  616. package/dist/hooks/ralph/jev-shadow.d.ts.map +1 -1
  617. package/dist/hooks/ralph/jev-shadow.js +1 -0
  618. package/dist/hooks/ralph/jev-shadow.js.map +1 -1
  619. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +5 -1
  620. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
  621. package/dist/hooks/session-end/__tests__/foreground-budget.test.d.ts +2 -0
  622. package/dist/hooks/session-end/__tests__/foreground-budget.test.d.ts.map +1 -0
  623. package/dist/hooks/session-end/__tests__/foreground-budget.test.js +81 -0
  624. package/dist/hooks/session-end/__tests__/foreground-budget.test.js.map +1 -0
  625. package/dist/hooks/session-end/__tests__/orphaned-actions.test.d.ts +2 -0
  626. package/dist/hooks/session-end/__tests__/orphaned-actions.test.d.ts.map +1 -0
  627. package/dist/hooks/session-end/__tests__/orphaned-actions.test.js +75 -0
  628. package/dist/hooks/session-end/__tests__/orphaned-actions.test.js.map +1 -0
  629. package/dist/hooks/session-end/__tests__/worker.test.js +25 -1
  630. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  631. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  632. package/dist/hooks/session-end/cleanup-manifest.js +10 -1
  633. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  634. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  635. package/dist/hooks/session-end/worker.js +20 -1
  636. package/dist/hooks/session-end/worker.js.map +1 -1
  637. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +1 -1
  638. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
  639. package/dist/hooks/task-size-detector/jev-shadow.d.ts.map +1 -1
  640. package/dist/hooks/task-size-detector/jev-shadow.js +1 -0
  641. package/dist/hooks/task-size-detector/jev-shadow.js.map +1 -1
  642. package/dist/hooks/team-leader-nudge-hook.d.ts +4 -0
  643. package/dist/hooks/team-leader-nudge-hook.d.ts.map +1 -1
  644. package/dist/hooks/team-leader-nudge-hook.js +41 -43
  645. package/dist/hooks/team-leader-nudge-hook.js.map +1 -1
  646. package/dist/hud/__tests__/account.test.d.ts +2 -0
  647. package/dist/hud/__tests__/account.test.d.ts.map +1 -0
  648. package/dist/hud/__tests__/account.test.js +165 -0
  649. package/dist/hud/__tests__/account.test.js.map +1 -0
  650. package/dist/hud/elements/account.d.ts +27 -0
  651. package/dist/hud/elements/account.d.ts.map +1 -0
  652. package/dist/hud/elements/account.js +285 -0
  653. package/dist/hud/elements/account.js.map +1 -0
  654. package/dist/hud/elements/index.d.ts +1 -0
  655. package/dist/hud/elements/index.d.ts.map +1 -1
  656. package/dist/hud/elements/index.js +1 -0
  657. package/dist/hud/elements/index.js.map +1 -1
  658. package/dist/hud/mission-board.d.ts.map +1 -1
  659. package/dist/hud/mission-board.js +3 -2
  660. package/dist/hud/mission-board.js.map +1 -1
  661. package/dist/hud/render.d.ts.map +1 -1
  662. package/dist/hud/render.js +6 -0
  663. package/dist/hud/render.js.map +1 -1
  664. package/dist/hud/types.d.ts +2 -1
  665. package/dist/hud/types.d.ts.map +1 -1
  666. package/dist/hud/types.js +9 -2
  667. package/dist/hud/types.js.map +1 -1
  668. package/dist/installer/__tests__/copilot-agent-models.test.js +112 -7
  669. package/dist/installer/__tests__/copilot-agent-models.test.js.map +1 -1
  670. package/dist/installer/copilot-agent-models.d.ts +26 -4
  671. package/dist/installer/copilot-agent-models.d.ts.map +1 -1
  672. package/dist/installer/copilot-agent-models.js +94 -16
  673. package/dist/installer/copilot-agent-models.js.map +1 -1
  674. package/dist/installer/index.d.ts.map +1 -1
  675. package/dist/installer/index.js +9 -4
  676. package/dist/installer/index.js.map +1 -1
  677. package/dist/shared/types.d.ts +16 -1
  678. package/dist/shared/types.d.ts.map +1 -1
  679. package/dist/shared/types.js.map +1 -1
  680. package/dist/ship/__tests__/gates.test.js +3 -3
  681. package/dist/ship/__tests__/git-trust.test.js +5 -0
  682. package/dist/ship/__tests__/git-trust.test.js.map +1 -1
  683. package/dist/ship/__tests__/prepare-merge.test.js +150 -4
  684. package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
  685. package/dist/ship/__tests__/safety-state.test.js +1 -1
  686. package/dist/ship/__tests__/safety-state.test.js.map +1 -1
  687. package/dist/ship/config.d.ts +14 -1
  688. package/dist/ship/config.d.ts.map +1 -1
  689. package/dist/ship/config.js +20 -1
  690. package/dist/ship/config.js.map +1 -1
  691. package/dist/ship/prepare.d.ts +62 -4
  692. package/dist/ship/prepare.d.ts.map +1 -1
  693. package/dist/ship/prepare.js +111 -14
  694. package/dist/ship/prepare.js.map +1 -1
  695. package/dist/team/__tests__/capped-status.test.d.ts +2 -0
  696. package/dist/team/__tests__/capped-status.test.d.ts.map +1 -0
  697. package/dist/team/__tests__/capped-status.test.js +60 -0
  698. package/dist/team/__tests__/capped-status.test.js.map +1 -0
  699. package/dist/team/__tests__/git-worktree.test.js +107 -0
  700. package/dist/team/__tests__/git-worktree.test.js.map +1 -1
  701. package/dist/team/__tests__/issue-4816-isCmuxSurfaceTarget.test.d.ts +2 -0
  702. package/dist/team/__tests__/issue-4816-isCmuxSurfaceTarget.test.d.ts.map +1 -0
  703. package/dist/team/__tests__/issue-4816-isCmuxSurfaceTarget.test.js +36 -0
  704. package/dist/team/__tests__/issue-4816-isCmuxSurfaceTarget.test.js.map +1 -0
  705. package/dist/team/__tests__/leader-inbox-unanswered.test.d.ts +6 -0
  706. package/dist/team/__tests__/leader-inbox-unanswered.test.d.ts.map +1 -0
  707. package/dist/team/__tests__/leader-inbox-unanswered.test.js +72 -0
  708. package/dist/team/__tests__/leader-inbox-unanswered.test.js.map +1 -0
  709. package/dist/team/__tests__/leader-nudge-guidance.test.js +45 -0
  710. package/dist/team/__tests__/leader-nudge-guidance.test.js.map +1 -1
  711. package/dist/team/__tests__/model-contract.test.js +24 -0
  712. package/dist/team/__tests__/model-contract.test.js.map +1 -1
  713. package/dist/team/__tests__/runtime-v2.monitor.test.js +88 -8
  714. package/dist/team/__tests__/runtime-v2.monitor.test.js.map +1 -1
  715. package/dist/team/__tests__/runtime-v2.sdk-defaults.test.d.ts +6 -0
  716. package/dist/team/__tests__/runtime-v2.sdk-defaults.test.d.ts.map +1 -0
  717. package/dist/team/__tests__/runtime-v2.sdk-defaults.test.js +69 -0
  718. package/dist/team/__tests__/runtime-v2.sdk-defaults.test.js.map +1 -0
  719. package/dist/team/__tests__/runtime-v2.shutdown.test.js +36 -1
  720. package/dist/team/__tests__/runtime-v2.shutdown.test.js.map +1 -1
  721. package/dist/team/__tests__/sdk-host-turn-usage.test.d.ts +2 -0
  722. package/dist/team/__tests__/sdk-host-turn-usage.test.d.ts.map +1 -0
  723. package/dist/team/__tests__/sdk-host-turn-usage.test.js +40 -0
  724. package/dist/team/__tests__/sdk-host-turn-usage.test.js.map +1 -0
  725. package/dist/team/__tests__/sdk-launch-progress.test.d.ts +2 -0
  726. package/dist/team/__tests__/sdk-launch-progress.test.d.ts.map +1 -0
  727. package/dist/team/__tests__/sdk-launch-progress.test.js +131 -0
  728. package/dist/team/__tests__/sdk-launch-progress.test.js.map +1 -0
  729. package/dist/team/__tests__/sdk-transport.runtime.test.js +1 -1
  730. package/dist/team/__tests__/sdk-transport.test.js +5 -0
  731. package/dist/team/__tests__/sdk-transport.test.js.map +1 -1
  732. package/dist/team/__tests__/team-leader-nudge-sdk-blocker.test.d.ts +7 -0
  733. package/dist/team/__tests__/team-leader-nudge-sdk-blocker.test.d.ts.map +1 -0
  734. package/dist/team/__tests__/team-leader-nudge-sdk-blocker.test.js +70 -0
  735. package/dist/team/__tests__/team-leader-nudge-sdk-blocker.test.js.map +1 -0
  736. package/dist/team/__tests__/tmux-session.spawn.test.js +5 -0
  737. package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -1
  738. package/dist/team/__tests__/worker-bootstrap.test.js +57 -0
  739. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  740. package/dist/team/api-interop.d.ts.map +1 -1
  741. package/dist/team/api-interop.js +4 -0
  742. package/dist/team/api-interop.js.map +1 -1
  743. package/dist/team/contracts.d.ts +2 -1
  744. package/dist/team/contracts.d.ts.map +1 -1
  745. package/dist/team/contracts.js +5 -3
  746. package/dist/team/contracts.js.map +1 -1
  747. package/dist/team/leader-nudge-guidance.d.ts +7 -1
  748. package/dist/team/leader-nudge-guidance.d.ts.map +1 -1
  749. package/dist/team/leader-nudge-guidance.js +18 -0
  750. package/dist/team/leader-nudge-guidance.js.map +1 -1
  751. package/dist/team/mailbox-outstanding.d.ts +21 -0
  752. package/dist/team/mailbox-outstanding.d.ts.map +1 -1
  753. package/dist/team/mailbox-outstanding.js +63 -0
  754. package/dist/team/mailbox-outstanding.js.map +1 -1
  755. package/dist/team/model-contract.d.ts.map +1 -1
  756. package/dist/team/model-contract.js +6 -0
  757. package/dist/team/model-contract.js.map +1 -1
  758. package/dist/team/runtime-cli.d.ts.map +1 -1
  759. package/dist/team/runtime-cli.js +3 -1
  760. package/dist/team/runtime-cli.js.map +1 -1
  761. package/dist/team/runtime-v2.d.ts +53 -3
  762. package/dist/team/runtime-v2.d.ts.map +1 -1
  763. package/dist/team/runtime-v2.js +231 -21
  764. package/dist/team/runtime-v2.js.map +1 -1
  765. package/dist/team/sdk-host.d.ts +26 -1
  766. package/dist/team/sdk-host.d.ts.map +1 -1
  767. package/dist/team/sdk-host.js +30 -0
  768. package/dist/team/sdk-host.js.map +1 -1
  769. package/dist/team/sdk-launch-progress.d.ts +31 -0
  770. package/dist/team/sdk-launch-progress.d.ts.map +1 -0
  771. package/dist/team/sdk-launch-progress.js +124 -0
  772. package/dist/team/sdk-launch-progress.js.map +1 -0
  773. package/dist/team/tmux-session.d.ts +5 -0
  774. package/dist/team/tmux-session.d.ts.map +1 -1
  775. package/dist/team/tmux-session.js +13 -2
  776. package/dist/team/tmux-session.js.map +1 -1
  777. package/dist/team/worker-bootstrap.d.ts +7 -0
  778. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  779. package/dist/team/worker-bootstrap.js +44 -1
  780. package/dist/team/worker-bootstrap.js.map +1 -1
  781. package/dist/workflow/__tests__/projections.test.js +6 -4
  782. package/dist/workflow/__tests__/projections.test.js.map +1 -1
  783. package/dist/workflow/__tests__/registry.test.js +5 -4
  784. package/dist/workflow/__tests__/registry.test.js.map +1 -1
  785. package/dist/workflow/registry.d.ts.map +1 -1
  786. package/dist/workflow/registry.js +36 -1
  787. package/dist/workflow/registry.js.map +1 -1
  788. package/docs/ARCHITECTURE.md +1 -1
  789. package/docs/CLAUDE.md +1 -1
  790. package/docs/CREDITS.md +63 -0
  791. package/docs/FACTORY-OFFLINE.md +257 -0
  792. package/docs/FEATURES.md +59 -0
  793. package/docs/HOOKS.md +56 -7
  794. package/docs/REFERENCE.md +291 -39
  795. package/docs/TEAM-WORKTREE-MODE.md +14 -1
  796. package/package.json +4 -3
  797. package/plugin.json +1 -1
  798. package/scripts/check-omc-playbooks.mjs +277 -0
  799. package/scripts/jev-resolve.mjs +37 -4
  800. package/scripts/keyword-detector.mjs +97 -4
  801. package/scripts/lib/hud-wrapper-template.txt +4 -0
  802. package/scripts/lib/jev-shadow.mjs +3 -1
  803. package/scripts/lib/run-reaper.mjs +37 -1
  804. package/scripts/lib/state-root.mjs +12 -1
  805. package/scripts/persistent-mode.mjs +136 -19
  806. package/scripts/post-tool-verifier.mjs +28 -7
  807. package/scripts/pre-tool-enforcer.mjs +67 -13
  808. package/scripts/run.cjs +19 -14
  809. package/scripts/stale-run-reporter.mjs +26 -8
  810. package/skills/AGENTS.md +1 -1
  811. package/skills/architect/SKILL.md +55 -0
  812. package/skills/architect/references/design-red-flags.md +43 -0
  813. package/skills/architect/references/rationale-template.md +44 -0
  814. package/skills/arena/SKILL.md +114 -0
  815. package/skills/babysit/SKILL.md +139 -0
  816. package/skills/babysit/references/bugbot-triage.md +48 -0
  817. package/skills/babysit/references/merge-safety.md +22 -0
  818. package/skills/benchmark-checklist/SKILL.md +75 -0
  819. package/skills/blast-radius/SKILL.md +51 -0
  820. package/skills/bro/SKILL.md +29 -0
  821. package/skills/correct/SKILL.md +64 -0
  822. package/skills/create-formal-verification-skill/SKILL.md +86 -0
  823. package/skills/create-verification-skill/SKILL.md +70 -0
  824. package/skills/figure-it-out/SKILL.md +95 -0
  825. package/skills/fix-ci/SKILL.md +61 -0
  826. package/skills/fix-merge-conflicts/SKILL.md +72 -0
  827. package/skills/get-pr-comments/SKILL.md +57 -0
  828. package/skills/harbor/SKILL.md +1 -0
  829. package/skills/hillclimb/SKILL.md +61 -0
  830. package/skills/how/SKILL.md +44 -0
  831. package/skills/how/references/explainer-prompt.md +23 -0
  832. package/skills/how/references/explorer-prompt.md +34 -0
  833. package/skills/in-your-own-words/SKILL.md +41 -0
  834. package/skills/interrogate/SKILL.md +107 -0
  835. package/skills/interrogate/references/lead-judgment.md +55 -0
  836. package/skills/interrogate/references/reviewer-prompt.md +38 -0
  837. package/skills/interrogate/references/rubric.md +78 -0
  838. package/skills/ketchup/SKILL.md +36 -0
  839. package/skills/ketchup-video/SKILL.md +37 -0
  840. package/skills/maintain-formal-verification-skill/SKILL.md +60 -0
  841. package/skills/maintain-verification-skill/SKILL.md +59 -0
  842. package/skills/map/SKILL.md +26 -0
  843. package/skills/models/SKILL.md +90 -0
  844. package/skills/personal-mode/SKILL.md +70 -0
  845. package/skills/principles/SKILL.md +229 -0
  846. package/skills/recall/SKILL.md +52 -0
  847. package/skills/reflect/SKILL.md +73 -0
  848. package/skills/reflect/references/reviewer-lenses.md +55 -0
  849. package/skills/sharpen/SKILL.md +56 -0
  850. package/skills/show-me-your-work/SKILL.md +63 -0
  851. package/skills/stacked-delivery/SKILL.md +65 -0
  852. package/skills/statechart/SKILL.md +90 -0
  853. package/skills/statechart/references/render.md +93 -0
  854. package/skills/statechart/scripts/backends/cfg.ts +33 -0
  855. package/skills/statechart/scripts/backends/mermaid.ts +201 -0
  856. package/skills/statechart/scripts/backends/plain-text.ts +72 -0
  857. package/skills/statechart/scripts/backends/report.ts +177 -0
  858. package/skills/statechart/scripts/frontends/config.ts +276 -0
  859. package/skills/statechart/scripts/frontends/dot.ts +74 -0
  860. package/skills/statechart/scripts/frontends/marks.ts +93 -0
  861. package/skills/statechart/scripts/frontends/messages.ts +52 -0
  862. package/skills/statechart/scripts/frontends/spec.ts +114 -0
  863. package/skills/statechart/scripts/frontends/trace.ts +24 -0
  864. package/skills/statechart/scripts/frontends/value.ts +178 -0
  865. package/skills/statechart/scripts/frontends/verdict.ts +42 -0
  866. package/skills/statechart/scripts/frontends/view.ts +126 -0
  867. package/skills/statechart/scripts/ir.ts +554 -0
  868. package/skills/statechart/scripts/janitor.ts +18 -0
  869. package/skills/statechart/scripts/package.json +11 -0
  870. package/skills/statechart/scripts/passes/annotate.ts +128 -0
  871. package/skills/statechart/scripts/passes/label.ts +269 -0
  872. package/skills/statechart/scripts/passes/lift.ts +85 -0
  873. package/skills/statechart/scripts/passes/loop-check.ts +68 -0
  874. package/skills/statechart/scripts/passes/paths.ts +60 -0
  875. package/skills/statechart/scripts/passes/reach.ts +135 -0
  876. package/skills/statechart/scripts/passes/region-check.ts +97 -0
  877. package/skills/statechart/scripts/passes/regions.ts +295 -0
  878. package/skills/statechart/scripts/pipeline.ts +76 -0
  879. package/skills/statechart/scripts/run.ts +550 -0
  880. package/skills/statechart/scripts/statechart +50 -0
  881. package/skills/statechart/scripts/statechart.ts +206 -0
  882. package/skills/statechart/scripts/test/ConfigOracle.java +63 -0
  883. package/skills/statechart/scripts/test/chart.test.ts +1210 -0
  884. package/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
  885. package/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
  886. package/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
  887. package/skills/statechart/scripts/test/cli.test.ts +1326 -0
  888. package/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
  889. package/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
  890. package/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
  891. package/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
  892. package/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
  893. package/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
  894. package/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
  895. package/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
  896. package/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
  897. package/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
  898. package/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
  899. package/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
  900. package/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
  901. package/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
  902. package/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
  903. package/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
  904. package/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
  905. package/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
  906. package/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
  907. package/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
  908. package/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
  909. package/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
  910. package/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
  911. package/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
  912. package/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
  913. package/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
  914. package/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
  915. package/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
  916. package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
  917. package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
  918. package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
  919. package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
  920. package/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
  921. package/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
  922. package/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
  923. package/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
  924. package/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
  925. package/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
  926. package/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
  927. package/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
  928. package/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
  929. package/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
  930. package/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
  931. package/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
  932. package/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
  933. package/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
  934. package/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
  935. package/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
  936. package/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
  937. package/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
  938. package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
  939. package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
  940. package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
  941. package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
  942. package/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
  943. package/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
  944. package/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
  945. package/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
  946. package/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
  947. package/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
  948. package/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
  949. package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
  950. package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
  951. package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
  952. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
  953. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
  954. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
  955. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
  956. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
  957. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
  958. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
  959. package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
  960. package/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
  961. package/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
  962. package/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
  963. package/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
  964. package/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
  965. package/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
  966. package/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
  967. package/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
  968. package/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
  969. package/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
  970. package/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
  971. package/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
  972. package/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
  973. package/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
  974. package/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
  975. package/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
  976. package/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
  977. package/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
  978. package/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
  979. package/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
  980. package/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
  981. package/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
  982. package/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
  983. package/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
  984. package/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
  985. package/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
  986. package/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
  987. package/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
  988. package/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
  989. package/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
  990. package/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
  991. package/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
  992. package/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
  993. package/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
  994. package/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
  995. package/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
  996. package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
  997. package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
  998. package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
  999. package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
  1000. package/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
  1001. package/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
  1002. package/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
  1003. package/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
  1004. package/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
  1005. package/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
  1006. package/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
  1007. package/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
  1008. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
  1009. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
  1010. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
  1011. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
  1012. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
  1013. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
  1014. package/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
  1015. package/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
  1016. package/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
  1017. package/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
  1018. package/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
  1019. package/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
  1020. package/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
  1021. package/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
  1022. package/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
  1023. package/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
  1024. package/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
  1025. package/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
  1026. package/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
  1027. package/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
  1028. package/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
  1029. package/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
  1030. package/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
  1031. package/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
  1032. package/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
  1033. package/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
  1034. package/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
  1035. package/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
  1036. package/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
  1037. package/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
  1038. package/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
  1039. package/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
  1040. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
  1041. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
  1042. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
  1043. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
  1044. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
  1045. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
  1046. package/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
  1047. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
  1048. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
  1049. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
  1050. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
  1051. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
  1052. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
  1053. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
  1054. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
  1055. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
  1056. package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
  1057. package/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
  1058. package/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
  1059. package/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
  1060. package/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
  1061. package/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
  1062. package/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
  1063. package/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
  1064. package/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
  1065. package/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
  1066. package/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
  1067. package/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
  1068. package/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
  1069. package/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
  1070. package/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
  1071. package/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
  1072. package/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
  1073. package/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
  1074. package/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
  1075. package/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
  1076. package/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
  1077. package/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
  1078. package/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
  1079. package/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
  1080. package/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
  1081. package/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
  1082. package/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
  1083. package/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
  1084. package/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
  1085. package/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
  1086. package/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
  1087. package/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
  1088. package/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
  1089. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
  1090. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
  1091. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
  1092. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
  1093. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
  1094. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
  1095. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
  1096. package/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
  1097. package/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
  1098. package/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
  1099. package/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
  1100. package/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
  1101. package/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
  1102. package/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
  1103. package/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
  1104. package/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
  1105. package/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
  1106. package/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
  1107. package/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
  1108. package/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
  1109. package/skills/statechart/scripts/test/corpus/Login/chart.mmd +27 -0
  1110. package/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
  1111. package/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
  1112. package/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
  1113. package/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
  1114. package/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
  1115. package/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
  1116. package/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
  1117. package/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
  1118. package/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
  1119. package/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
  1120. package/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
  1121. package/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
  1122. package/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
  1123. package/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
  1124. package/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
  1125. package/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
  1126. package/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
  1127. package/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
  1128. package/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
  1129. package/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
  1130. package/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
  1131. package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
  1132. package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
  1133. package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
  1134. package/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
  1135. package/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
  1136. package/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
  1137. package/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
  1138. package/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
  1139. package/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
  1140. package/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
  1141. package/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
  1142. package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
  1143. package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
  1144. package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
  1145. package/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
  1146. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
  1147. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
  1148. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
  1149. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
  1150. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
  1151. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
  1152. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
  1153. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
  1154. package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
  1155. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
  1156. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
  1157. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
  1158. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
  1159. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
  1160. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
  1161. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
  1162. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
  1163. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
  1164. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
  1165. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
  1166. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
  1167. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
  1168. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
  1169. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
  1170. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
  1171. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
  1172. package/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
  1173. package/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
  1174. package/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
  1175. package/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
  1176. package/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
  1177. package/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
  1178. package/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
  1179. package/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
  1180. package/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
  1181. package/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
  1182. package/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
  1183. package/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
  1184. package/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
  1185. package/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
  1186. package/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
  1187. package/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
  1188. package/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
  1189. package/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
  1190. package/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
  1191. package/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
  1192. package/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
  1193. package/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
  1194. package/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
  1195. package/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
  1196. package/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
  1197. package/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
  1198. package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
  1199. package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
  1200. package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
  1201. package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
  1202. package/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
  1203. package/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
  1204. package/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
  1205. package/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
  1206. package/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
  1207. package/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
  1208. package/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
  1209. package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
  1210. package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
  1211. package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
  1212. package/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
  1213. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
  1214. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
  1215. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
  1216. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
  1217. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
  1218. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
  1219. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
  1220. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
  1221. package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
  1222. package/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
  1223. package/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
  1224. package/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
  1225. package/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
  1226. package/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
  1227. package/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
  1228. package/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
  1229. package/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
  1230. package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
  1231. package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
  1232. package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
  1233. package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
  1234. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
  1235. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
  1236. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
  1237. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
  1238. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
  1239. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
  1240. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
  1241. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
  1242. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
  1243. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
  1244. package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
  1245. package/skills/statechart/scripts/test/corpus.test.ts +403 -0
  1246. package/skills/statechart/scripts/test/differential.test.ts +565 -0
  1247. package/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
  1248. package/skills/statechart/scripts/test/grid/Grid.tla +9 -0
  1249. package/skills/statechart/scripts/test/grid/sany.out +2 -0
  1250. package/skills/statechart/scripts/test/java.ts +63 -0
  1251. package/skills/statechart/scripts/test/labels.ts +643 -0
  1252. package/skills/statechart/scripts/test/messages.test.ts +227 -0
  1253. package/skills/statechart/scripts/test/pipeline.test.ts +309 -0
  1254. package/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
  1255. package/skills/statechart/scripts/test/render.test.ts +81 -0
  1256. package/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
  1257. package/skills/statechart/scripts/test/tlc.ts +158 -0
  1258. package/skills/statechart/scripts/tsconfig.json +11 -0
  1259. package/skills/statechart/scripts/worker.ts +47 -0
  1260. package/skills/teach/SKILL.md +39 -0
  1261. package/skills/technical-writing/SKILL.md +51 -0
  1262. package/skills/typescript-best-practices/SKILL.md +39 -0
  1263. package/skills/typescript-best-practices/references/patterns.md +84 -0
  1264. package/skills/what-did-i-get-done/SKILL.md +42 -0
  1265. package/skills/why/SKILL.md +62 -0
  1266. package/skills/why/references/epistemics.md +108 -0
  1267. package/skills/why/references/investigator-prompt.md +30 -0
  1268. package/skills/why/references/source-playbooks.md +41 -0
  1269. package/skills/why/references/synthesizer-prompt.md +25 -0
  1270. package/templates/hooks/lib/state-root.mjs +12 -1
  1271. package/templates/pipelines/omg-factory-heartbeat.azure-pipelines.yml +55 -0
  1272. package/templates/pipelines/omg-factory-heartbeat.triage-step.yml +11 -0
  1273. package/templates/workflows/omg-factory-heartbeat.triage-step.yml +20 -0
  1274. package/templates/workflows/omg-factory-heartbeat.yml +88 -0
@@ -1530,6 +1530,50 @@ async function countOutstandingForWorker(mailboxDir, workerName) {
1530
1530
  const scanned = await scanMailboxOutstanding(mailboxDir);
1531
1531
  return scanned[workerName] ?? ZERO_OUTSTANDING;
1532
1532
  }
1533
+ function messageField(message, key) {
1534
+ if (!message || typeof message !== "object") return "";
1535
+ return safeString(message[key]).trim();
1536
+ }
1537
+ function isBlockerMessageBody(body) {
1538
+ return /^\s*blocker\s*:/i.test(body);
1539
+ }
1540
+ async function readLeaderInbox(mailboxDir, leaderName = "leader-fixed") {
1541
+ const inbox = [
1542
+ ...await readMailboxFileMessages((0, import_path4.join)(mailboxDir, `${leaderName}.json`)),
1543
+ ...await readMailboxFileMessagesJsonl((0, import_path4.join)(mailboxDir, `${leaderName}.jsonl`))
1544
+ ];
1545
+ const latestReplyBySender = /* @__PURE__ */ new Map();
1546
+ const unread = [];
1547
+ for (const message of inbox) {
1548
+ if (!isUndelivered(message) || messageToWorker(message) !== leaderName) continue;
1549
+ if (!isBlockerMessageBody(safeString(message.body))) continue;
1550
+ const from = messageFromWorker(message);
1551
+ if (!from || from === leaderName) continue;
1552
+ if (!latestReplyBySender.has(from)) {
1553
+ const replies = [
1554
+ ...await readMailboxFileMessages((0, import_path4.join)(mailboxDir, `${from}.json`)),
1555
+ ...await readMailboxFileMessagesJsonl((0, import_path4.join)(mailboxDir, `${from}.jsonl`))
1556
+ ];
1557
+ let latest = Number.NEGATIVE_INFINITY;
1558
+ for (const reply of replies) {
1559
+ if (messageFromWorker(reply) !== leaderName || messageToWorker(reply) !== from) continue;
1560
+ const at = Date.parse(messageField(reply, "created_at"));
1561
+ if (Number.isFinite(at) && at > latest) latest = at;
1562
+ }
1563
+ latestReplyBySender.set(from, latest);
1564
+ }
1565
+ const createdAt = messageField(message, "created_at");
1566
+ const createdMs = Date.parse(createdAt);
1567
+ if (Number.isFinite(createdMs) && createdMs <= latestReplyBySender.get(from)) continue;
1568
+ unread.push({
1569
+ message_id: messageField(message, "message_id"),
1570
+ from,
1571
+ created_at: createdAt,
1572
+ body: safeString(message.body)
1573
+ });
1574
+ }
1575
+ return unread.sort((a, b) => (Date.parse(a.created_at) || 0) - (Date.parse(b.created_at) || 0));
1576
+ }
1533
1577
  var import_promises2, import_fs2, import_path4, ZERO_OUTSTANDING;
1534
1578
  var init_mailbox_outstanding = __esm({
1535
1579
  "src/team/mailbox-outstanding.ts"() {
@@ -3023,14 +3067,15 @@ var init_contracts = __esm({
3023
3067
  TEAM_NAME_SAFE_PATTERN = /^[a-z0-9][a-z0-9-]{0,29}$/;
3024
3068
  WORKER_NAME_SAFE_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
3025
3069
  TASK_ID_SAFE_PATTERN = /^\d{1,20}$/;
3026
- TEAM_TASK_STATUSES = ["pending", "blocked", "in_progress", "completed", "failed"];
3027
- TEAM_TERMINAL_TASK_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
3070
+ TEAM_TASK_STATUSES = ["pending", "blocked", "in_progress", "completed", "failed", "capped"];
3071
+ TEAM_TERMINAL_TASK_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "capped"]);
3028
3072
  TEAM_TASK_STATUS_TRANSITIONS = {
3029
3073
  pending: [],
3030
3074
  blocked: [],
3031
- in_progress: ["completed", "failed"],
3075
+ in_progress: ["completed", "failed", "capped"],
3032
3076
  completed: [],
3033
- failed: []
3077
+ failed: [],
3078
+ capped: []
3034
3079
  };
3035
3080
  }
3036
3081
  });
@@ -3095,10 +3140,10 @@ function parseRecord(path5, expectedEpoch) {
3095
3140
  }
3096
3141
  function darwinProcessStartFromKinfo(raw, nowSeconds = Math.floor(Date.now() / 1e3)) {
3097
3142
  if (raw.length < 16) return null;
3098
- const seconds = raw.readBigUInt64LE(0);
3143
+ const seconds2 = raw.readBigUInt64LE(0);
3099
3144
  const micros = raw.readBigUInt64LE(8);
3100
- if (seconds < 946684800n || seconds > BigInt(nowSeconds + 86400) || micros >= 1000000n) return null;
3101
- return `${seconds}:${micros}`;
3145
+ if (seconds2 < 946684800n || seconds2 > BigInt(nowSeconds + 86400) || micros >= 1000000n) return null;
3146
+ return `${seconds2}:${micros}`;
3102
3147
  }
3103
3148
  function processStartIdentityForPlatform(pid, platform = process.platform, exec2 = import_node_child_process.execFileSync) {
3104
3149
  return probeProcessStartIdentityForPlatform(pid, platform, exec2, import_fs11.readFileSync, false).identity;
@@ -6109,6 +6154,9 @@ var init_keyword_detector = __esm({
6109
6154
  "deepsearch",
6110
6155
  "analyze",
6111
6156
  "deep-interview",
6157
+ "ultragoal",
6158
+ "ai-slop-cleaner",
6159
+ "wiki",
6112
6160
  "codex",
6113
6161
  "gemini",
6114
6162
  "cursor",
@@ -6139,7 +6187,7 @@ function skillTriggerCriteria() {
6139
6187
  const priority = Array.isArray(KEYWORD_PRIORITY) ? KEYWORD_PRIORITY : [];
6140
6188
  return {
6141
6189
  ...Object.fromEntries(
6142
- priority.filter((type) => type !== "team").slice(0, 12).map((type) => [type, `The prompt explicitly invokes the ${type} trigger.`])
6190
+ priority.filter((type) => type !== "team").map((type) => [type, `The prompt explicitly invokes the ${type} trigger.`])
6143
6191
  ),
6144
6192
  none: "No trigger fires; handle the prompt without a mode or skill."
6145
6193
  };
@@ -6204,6 +6252,16 @@ var init_points = __esm({
6204
6252
  sonnet: "Standard coding and orchestration work",
6205
6253
  opus: "Complex architecture and deep analysis"
6206
6254
  }
6255
+ },
6256
+ effort: {
6257
+ type: "score",
6258
+ instructions: "How much reasoning effort does this delegated task need?",
6259
+ criteria: {
6260
+ trivial: "Trivial: the answer or action is obvious, no thinking needed",
6261
+ some: "Some thought: a few straightforward steps",
6262
+ careful: "Careful multi-step reasoning: several dependent steps or things to check",
6263
+ deep: "Deep reasoning: many tradeoffs, hidden pitfalls, or easy to get subtly wrong"
6264
+ }
6207
6265
  }
6208
6266
  };
6209
6267
  STALENESS_QUESTIONS = {
@@ -6582,6 +6640,12 @@ function getTrustedPrefixes() {
6582
6640
  localAppData ? flavor.join(localAppData, "npm") : void 0,
6583
6641
  localAppData ? flavor.join(localAppData, "Programs") : void 0,
6584
6642
  localAppData ? flavor.join(localAppData, "Yarn", "bin") : void 0,
6643
+ // WinGet: per-user installs and their PATH links live under LOCALAPPDATA,
6644
+ // machine-wide (--scope machine) installs under ProgramFiles.
6645
+ localAppData ? flavor.join(localAppData, "Microsoft", "WinGet", "Packages") : void 0,
6646
+ localAppData ? flavor.join(localAppData, "Microsoft", "WinGet", "Links") : void 0,
6647
+ programFiles ? flavor.join(programFiles, "WinGet", "Packages") : void 0,
6648
+ programFiles ? flavor.join(programFiles, "WinGet", "Links") : void 0,
6585
6649
  programFiles ? flavor.join(programFiles, "nodejs") : void 0,
6586
6650
  programFilesX86 ? flavor.join(programFilesX86, "nodejs") : void 0,
6587
6651
  home ? flavor.join(home, ".cargo", "bin") : void 0,
@@ -11360,6 +11424,7 @@ __export(tmux_session_exports, {
11360
11424
  getWorkerLiveness: () => getWorkerLiveness,
11361
11425
  injectToLeaderPane: () => injectToLeaderPane,
11362
11426
  invokeDirectMailboxEffect: () => invokeDirectMailboxEffect,
11427
+ isCmuxSurfaceTarget: () => isCmuxSurfaceTarget,
11363
11428
  isPosixTmuxSession: () => isPosixTmuxSession,
11364
11429
  isSessionAlive: () => isSessionAlive,
11365
11430
  isUnixLikeOnWindows: () => isUnixLikeOnWindows,
@@ -11825,7 +11890,11 @@ function isCmuxContext() {
11825
11890
  return detectTeamMultiplexerContext() === "cmux";
11826
11891
  }
11827
11892
  function isCmuxSurfaceTarget(value) {
11828
- return typeof value === "string" && value.trim().length > 0 && !value.trim().startsWith("%");
11893
+ if (typeof value !== "string") return false;
11894
+ const trimmed = value.trim();
11895
+ if (trimmed.length === 0 || trimmed.startsWith("%")) return false;
11896
+ if (/^w[0-9A-Za-z]+:p[0-9A-Za-z]+$/.test(trimmed)) return false;
11897
+ return isCmuxContext();
11829
11898
  }
11830
11899
  async function cmuxExecAsync(args) {
11831
11900
  const result = await execFileAsync2("cmux", args, { encoding: "utf-8" });
@@ -15013,7 +15082,7 @@ function agentTypeGuidance(agentType, reviewerRole = false) {
15013
15082
  return [
15014
15083
  "### Agent-Type Guidance (claude)",
15015
15084
  "- Keep reasoning focused on assigned task IDs and send concise progress acks to leader-fixed.",
15016
- "- Before any risky command, send a blocker/proposal message to leader-fixed and wait for updated inbox instructions."
15085
+ "- Before any risky command, send `BLOCKER: <proposal>` to leader-fixed and wait for updated inbox instructions."
15017
15086
  ].join("\n");
15018
15087
  }
15019
15088
  }
@@ -15042,9 +15111,53 @@ function generateWorkerOverlay(params) {
15042
15111
  const checkpointTaskCommand = formatOmcCliInvocation(`team api write-task-checkpoint --input "{\\"team_name\\":\\"${teamName}\\",\\"task_id\\":\\"<id>\\",\\"worker\\":\\"${workerName}\\",\\"claim_token\\":\\"<claim_token>\\",\\"task_version\\":<current_task_version>,\\"sequence\\":<next_sequence>,\\"resume_payload\\":<safe_boundary_json>}" --json`);
15043
15112
  const teamApiCommand = formatOmcCliInvocation("team api");
15044
15113
  const teamCommand = formatOmcCliInvocation("team");
15114
+ const sendMessageCommand = formatOmcCliInvocation(`team api send-message --input "{\\"team_name\\":\\"${teamName}\\",\\"from_worker\\":\\"${workerName}\\",\\"to_worker\\":\\"leader-fixed\\",\\"body\\":\\"<message>\\"}" --json`);
15045
15115
  const taskList = sanitizedTasks.length > 0 ? sanitizedTasks.map((t) => `- **Task ${t.id}**: ${t.subject}
15046
15116
  Description: ${t.description}
15047
15117
  Status: pending`).join("\n") : "- No tasks assigned yet. Check your inbox for assignments.";
15118
+ if (params.compactProtocol === true && agentType !== "cursor") {
15119
+ return `# Team Worker Protocol (sdk)
15120
+
15121
+ You are a **team worker**, not the leader. Team ${teamName}, worker ${workerName}, agent ${agentType}, OMC_TEAM_WORKER=${teamName}/${workerName}. Preserve the exact \`OMC_WORKER_LAUNCH_ATTEMPT_ID\` value in task claims and status updates.
15122
+
15123
+ ## Workflow (in order)
15124
+ Recovery task adopted from an owner: skip steps 1-2 and resume from Recovery Continuation with its \`claim_token\`. No task assigned: wait for one; never invent a task.
15125
+ 1. **Claim** first: \`${claimTaskCommand}\`
15126
+ Save \`claim_token\`. If the claim fails, do not ACK or start work; report the failure to leader-fixed and wait.
15127
+ 2. **ACK once** (never again for later tasks): \`${sendAckCommand}\`
15128
+ 3. **Do the work** in your task description. Edit only the paths it names.
15129
+ 4. **Commit**: in a team worktree, commit the finished change on its branch before step 5 (never push), so it survives the worker stopping.
15130
+ 5. **Transition** (REQUIRED before you stop):
15131
+ - Success: \`${completeTaskCommand}\`
15132
+ The \`result\` MUST hold the summary, the verification you ran and the subagent skip reason; without it completion is rejected (\`missing_delegation_compliance_evidence\`).
15133
+ - Failure: \`${failTaskCommand}\`
15134
+ Before failing, send the leader what failed and why (exact error text).
15135
+ 6. Replies and ACKs are not a stop signal: keep going until the task is completed or failed.
15136
+ 7. **Blocked**: if you cannot proceed, send \`BLOCKER: <what you need>\` to leader-fixed and wait for the reply. Only a body starting with \`BLOCKER:\` reaches the leader as a blocker.
15137
+
15138
+ ## Your Tasks
15139
+ ${taskList}
15140
+
15141
+ ## Task API (never edit task files directly)
15142
+ - Read task: \`${readTaskCommand}\` (task_id is "1", not "task-1")
15143
+ - Release claim: \`${releaseClaimCommand}\`
15144
+ - Checkpoint before a risky step or stopping: \`${checkpointTaskCommand}\` (a completed safe boundary and the next action; no credentials)
15145
+
15146
+ ## Mailbox and status
15147
+ - Inbox: ${inboxPath}. Mailbox: \`${mailboxListCommand}\`; mark read: \`${mailboxDeliveredCommand}\`
15148
+ - To leader: \`${sendMessageCommand}\`
15149
+ - Blocked: write {"state":"blocked","reason":"...","launch_attempt_id":"<id>","updated_at":"<iso>"} to ${statusPath} and message the leader.
15150
+ - State root: \`OMC_TEAM_STATE_ROOT\` when set (already team-specific; do not append \`team/${teamName}\`), else ${params.cwd}/.omg/state/team/${teamName}. Never use a worktree-local \`.omg/state\`.
15151
+ - Shutdown request in the inbox: write {"status":"accept"|"reject","reason":"...","updated_at":"<iso>"} to ${shutdownAckPath}; forced shutdown cannot be rejected.
15152
+
15153
+ ## Rules
15154
+ - No sub-agents, no team or orchestration commands (\`${teamCommand} ...\`, \`$team\`, \`$autopilot\`, \`$ralph\`). Your only control surface is \`${teamApiCommand} ... --json\`.
15155
+ - ${renderWorkerExitContract(agentType, false)}
15156
+
15157
+ ${bootstrapInstructions ? `## Role Context
15158
+ ${bootstrapInstructions}
15159
+ ` : ""}`;
15160
+ }
15048
15161
  const cursorReviewer = agentType === "cursor" && reviewerRole === true;
15049
15162
  const persistentCursor = agentType === "cursor" && !cursorReviewer;
15050
15163
  const mandatoryWorkflow = cursorReviewer ? [
@@ -15144,6 +15257,7 @@ Send messages via CLI API:
15144
15257
  - To leader: \`${formatOmcCliInvocation(`team api send-message --input "{\\"team_name\\":\\"${teamName}\\",\\"from_worker\\":\\"${workerName}\\",\\"to_worker\\":\\"leader-fixed\\",\\"body\\":\\"<message>\\"}" --json`)}\`
15145
15258
  - Check mailbox: \`${mailboxListCommand}\`
15146
15259
  - Mark delivered: \`${mailboxDeliveredCommand}\`
15260
+ - Blocked: if you cannot proceed, send \`BLOCKER: <what you need>\` to leader-fixed and wait for the reply. Only a body starting with \`BLOCKER:\` reaches the leader as a blocker; ACKs and progress reports do not.
15147
15261
 
15148
15262
  ## Shutdown Protocol
15149
15263
  When you see a shutdown request in your inbox:
@@ -16440,125 +16554,477 @@ var init_mcp_comm = __esm({
16440
16554
  }
16441
16555
  });
16442
16556
 
16443
- // src/lib/worktree-cleanup-safety.ts
16444
- function realpathOrResolve(path5) {
16557
+ // src/team/sdk-transport.ts
16558
+ function isSdkTarget(value) {
16559
+ return typeof value === "string" && value.startsWith(SDK_TARGET_PREFIX);
16560
+ }
16561
+ function sdkTeamTarget(teamName) {
16562
+ return `${SDK_TARGET_PREFIX}${teamName}`;
16563
+ }
16564
+ function sdkPaneId(workerName) {
16565
+ return `${SDK_TARGET_PREFIX}${workerName}`;
16566
+ }
16567
+ function sdkWorkerFiles(stateRoot, workerName) {
16568
+ const dir = (0, import_node_path9.join)(stateRoot, "workers", workerName);
16569
+ return {
16570
+ dir,
16571
+ spec: (0, import_node_path9.join)(dir, "sdk-host-spec.json"),
16572
+ doorbell: (0, import_node_path9.join)(dir, "sdk-doorbell.jsonl"),
16573
+ session: (0, import_node_path9.join)(dir, "sdk-session.json"),
16574
+ probe: (0, import_node_path9.join)(dir, "sdk-probe.json"),
16575
+ events: (0, import_node_path9.join)(dir, "sdk-events.jsonl"),
16576
+ log: (0, import_node_path9.join)(dir, "sdk-host.log"),
16577
+ home: (0, import_node_path9.join)(dir, "copilot-home"),
16578
+ bin: (0, import_node_path9.join)(dir, "bin"),
16579
+ shutdownAck: (0, import_node_path9.join)(dir, "shutdown-ack.json")
16580
+ };
16581
+ }
16582
+ function ringDoorbell(stateRoot, workerName, entry) {
16583
+ const files = sdkWorkerFiles(stateRoot, workerName);
16584
+ (0, import_node_fs8.mkdirSync)(files.dir, { recursive: true });
16585
+ const id = entry.id ?? (0, import_node_crypto8.randomUUID)();
16586
+ const line = { ...entry, id, at: (/* @__PURE__ */ new Date()).toISOString() };
16587
+ (0, import_node_fs8.appendFileSync)(files.doorbell, `${JSON.stringify(line)}
16588
+ `);
16589
+ return id;
16590
+ }
16591
+ function readSdkSession(stateRoot, workerName) {
16445
16592
  try {
16446
- return (0, import_node_fs8.realpathSync)(path5);
16593
+ const parsed = JSON.parse((0, import_node_fs8.readFileSync)(sdkWorkerFiles(stateRoot, workerName).session, "utf8"));
16594
+ return parsed && parsed.schema_version === 1 ? parsed : null;
16447
16595
  } catch {
16448
- return (0, import_node_path9.resolve)(path5);
16449
- }
16450
- }
16451
- function assertSafeBoundary(path5, label) {
16452
- const trimmed = path5.trim();
16453
- if (trimmed.length === 0) {
16454
- throw new Error(`${label}_empty`);
16455
- }
16456
- if (trimmed.includes("\0")) {
16457
- throw new Error(`${label}_contains_nul`);
16458
- }
16459
- const resolved = realpathOrResolve(trimmed);
16460
- const root = (0, import_node_path9.parse)(resolved).root;
16461
- const home = realpathOrResolve((0, import_node_os2.homedir)());
16462
- if (resolved === root) {
16463
- throw new Error(`${label}_is_filesystem_root:${resolved}`);
16464
- }
16465
- if (resolved === home) {
16466
- throw new Error(`${label}_is_home_directory:${resolved}`);
16596
+ return null;
16467
16597
  }
16468
- return resolved;
16469
16598
  }
16470
- function isInside(parent, child) {
16471
- const rel = (0, import_node_path9.relative)(parent, child);
16472
- return rel.length > 0 && !rel.startsWith("..") && !(0, import_node_path9.isAbsolute)(rel);
16599
+ function hostSpawnEnv(env) {
16600
+ return Object.fromEntries(Object.entries(env).filter(([key]) => !isCredentialEnvKey(key)));
16473
16601
  }
16474
- function validateWorktreeRemovalTarget(options) {
16475
- const { candidatePath, expectedRoots, mainRepoRoots = [], requireExisting = true } = options;
16476
- if (expectedRoots.length === 0) {
16477
- throw new Error("expected_worktree_roots_empty");
16478
- }
16479
- const rawCandidate = candidatePath.trim();
16480
- if (rawCandidate.length === 0) {
16481
- throw new Error("worktree_path_empty");
16602
+ function hostCredentialHandoff(env) {
16603
+ const out = {};
16604
+ for (const [key, value] of isReplayEnv(env) ? [] : Object.entries(env)) {
16605
+ const upper = key.toUpperCase();
16606
+ if (HOST_CREDENTIAL_ENV.includes(upper) && value && !(upper in out)) out[upper] = value;
16482
16607
  }
16483
- if (rawCandidate.includes("\0")) {
16484
- throw new Error("worktree_path_contains_nul");
16608
+ return `${JSON.stringify(out)}
16609
+ `;
16610
+ }
16611
+ function spawnDetachedHost(cliPath, specPath, logPath, cwd, env = process.env) {
16612
+ (0, import_node_fs8.mkdirSync)((0, import_node_path9.dirname)(logPath), { recursive: true });
16613
+ const fd = (0, import_node_fs8.openSync)(logPath, "a");
16614
+ try {
16615
+ const child = (0, import_node_child_process3.spawn)(process.execPath, [cliPath, "team", "sdk-host", "--spec", specPath], {
16616
+ cwd,
16617
+ detached: true,
16618
+ windowsHide: true,
16619
+ stdio: ["pipe", fd, fd],
16620
+ env: hostSpawnEnv(env)
16621
+ });
16622
+ child.stdin?.on("error", () => void 0);
16623
+ child.stdin?.end(hostCredentialHandoff(env));
16624
+ child.unref();
16625
+ return child.pid;
16626
+ } finally {
16627
+ (0, import_node_fs8.closeSync)(fd);
16485
16628
  }
16486
- if (rawCandidate === "." || rawCandidate === ".." || rawCandidate === "~") {
16487
- throw new Error(`worktree_path_suspicious:${rawCandidate}`);
16629
+ }
16630
+ async function launchSdkHost(input) {
16631
+ const paneId = sdkPaneId(input.workerName);
16632
+ const runtimeCliPath = resolveRuntimeCliPath();
16633
+ const attempt = await prepareWorkerLaunchAttempt({
16634
+ cwd: input.leaderCwd,
16635
+ teamName: input.teamName,
16636
+ workerName: input.workerName,
16637
+ instanceId: input.instanceId,
16638
+ paneId,
16639
+ provider: "copilot",
16640
+ runtimeCliPath,
16641
+ context: { kind: "initial" }
16642
+ });
16643
+ const files = sdkWorkerFiles(input.stateRoot, input.workerName);
16644
+ (0, import_node_fs8.mkdirSync)(files.dir, { recursive: true });
16645
+ const cliPath = (0, import_node_path9.join)((0, import_node_path9.dirname)(runtimeCliPath), "cli.cjs");
16646
+ const spec = {
16647
+ schema_version: 1,
16648
+ leader_cwd: input.leaderCwd,
16649
+ team_name: input.teamName,
16650
+ worker_name: input.workerName,
16651
+ instance_id: input.instanceId,
16652
+ attempt_id: attempt.attempt_id,
16653
+ pane_id: paneId,
16654
+ runtime_cli_path: runtimeCliPath,
16655
+ worker_cwd: input.workerCwd,
16656
+ state_root: input.stateRoot,
16657
+ plugin_root: input.pluginRoot,
16658
+ copilot_bin: input.copilotBin,
16659
+ ...input.model ? { model: input.model } : {},
16660
+ max_credits: input.maxCredits,
16661
+ worker_env: { ...input.workerEnv, OMC_WORKER_LAUNCH_ATTEMPT_ID: attempt.attempt_id },
16662
+ deny_tools: input.denyTools,
16663
+ deny_urls: input.denyUrls,
16664
+ mcp_server: input.mcpServer ?? "t",
16665
+ omg_cli_path: cliPath,
16666
+ node_path: process.execPath,
16667
+ user_config_dir: input.userConfigDir,
16668
+ ...input.inProcessTools ? { in_process_tools: true } : {}
16669
+ };
16670
+ (0, import_node_fs8.writeFileSync)(files.spec, `${JSON.stringify(spec, null, 2)}
16671
+ `);
16672
+ (0, import_node_fs8.writeFileSync)(files.doorbell, "");
16673
+ const hostPid = (input.spawnHost ?? spawnDetachedHost)(cliPath, files.spec, files.log, input.workerCwd);
16674
+ const kill = async () => {
16675
+ if (hostPid && isProcessAlive(hostPid)) await killProcessTree(hostPid, "SIGKILL").catch(() => void 0);
16676
+ };
16677
+ const timeoutMs = input.ackTimeoutMs ?? 3e4;
16678
+ const ack = await awaitWorkerLaunchAcknowledgement(attempt, { timeoutMs });
16679
+ if (!ack.ok) {
16680
+ await kill();
16681
+ return { ok: false, attempt, reason: `sdk_host_ack_${ack.reason}`, ...hostPid ? { hostPid } : {} };
16488
16682
  }
16489
- const lexicalPath = (0, import_node_path9.resolve)(rawCandidate);
16490
- if (!(0, import_node_fs8.existsSync)(lexicalPath)) {
16491
- if (requireExisting) {
16492
- throw new Error(`worktree_path_missing:${lexicalPath}`);
16493
- }
16494
- } else {
16495
- const stat2 = (0, import_node_fs8.lstatSync)(lexicalPath);
16496
- if (stat2.isSymbolicLink()) {
16497
- throw new Error(`worktree_path_is_symlink:${lexicalPath}`);
16683
+ const startDeadline = Date.now() + timeoutMs;
16684
+ for (; ; ) {
16685
+ const sliceMs = Math.max(1, Math.min(1e3, startDeadline - Date.now()));
16686
+ if (await awaitWorkerLaunchProviderStarted(attempt, { timeoutMs: sliceMs })) break;
16687
+ const exited = (0, import_node_fs8.existsSync)(`${attempt.startedPath}.terminal`) || (0, import_node_fs8.existsSync)(`${attempt.decisionPath}.retired`) || hostPid !== void 0 && !isProcessAlive(hostPid);
16688
+ if (exited || failedThisAttempt(attempt, input.stateRoot)) {
16689
+ const graceUntil = Date.now() + SDK_LAUNCH_FAILURE_GRACE_MS;
16690
+ while (!failedThisAttempt(attempt, input.stateRoot) && Date.now() < graceUntil) {
16691
+ await new Promise((r) => setTimeout(r, SDK_LAUNCH_POLL_MS));
16692
+ }
16693
+ await kill();
16694
+ const error = (failedThisAttempt(attempt, input.stateRoot) ? readSdkSession(input.stateRoot, input.workerName)?.last_error : null) ?? "unknown";
16695
+ const phase = (0, import_node_fs8.existsSync)(attempt.startedPath) ? "at_start" : "before_start";
16696
+ return { ok: false, attempt, reason: `sdk_host_failed_${phase}:${error}`, ...hostPid ? { hostPid } : {} };
16498
16697
  }
16499
- if (!stat2.isDirectory()) {
16500
- throw new Error(`worktree_path_not_directory:${lexicalPath}`);
16698
+ if (Date.now() >= startDeadline) {
16699
+ await kill();
16700
+ return { ok: false, attempt, reason: "sdk_host_provider_not_started", ...hostPid ? { hostPid } : {} };
16501
16701
  }
16702
+ await new Promise((r) => setTimeout(r, SDK_LAUNCH_POLL_MS));
16502
16703
  }
16503
- const resolvedPath = assertSafeBoundary(candidatePath, "worktree_path");
16504
- const matchedRoot = expectedRoots.map((root) => assertSafeBoundary(root, "worktree_root")).find((root) => isInside(root, resolvedPath));
16505
- if (!matchedRoot) {
16506
- throw new Error(`worktree_path_outside_expected_roots:${resolvedPath}`);
16704
+ return { ok: true, attempt, hostPid, paneId };
16705
+ }
16706
+ async function isTargetGone(target) {
16707
+ if (!target.identity) return !isProcessAlive(target.pid);
16708
+ const liveness = await isProcessIdentityLive(target.pid, target.identity);
16709
+ return liveness === "dead" || liveness === "mismatch";
16710
+ }
16711
+ function failedBeforeProviderStarted(attempt, stateRoot) {
16712
+ return !(0, import_node_fs8.existsSync)(attempt.startedPath) && failedThisAttempt(attempt, stateRoot);
16713
+ }
16714
+ function failedThisAttempt(attempt, stateRoot) {
16715
+ const session = readSdkSession(stateRoot, attempt.worker_name);
16716
+ return session?.attempt_id === attempt.attempt_id && session.state === "failed";
16717
+ }
16718
+ async function stopSdkHost(attempt, stateRoot, opts = {}) {
16719
+ const pollMs = opts.pollMs ?? 250;
16720
+ const exited = async () => failedBeforeProviderStarted(attempt, stateRoot) || await observeWorkerLaunchProvider(attempt) === "dead";
16721
+ if (await exited()) return true;
16722
+ ringDoorbell(stateRoot, attempt.worker_name, { kind: opts.kind ?? "stop", from: "leader-fixed" });
16723
+ const deadline = Date.now() + (opts.timeoutMs ?? 45e3);
16724
+ while (Date.now() < deadline) {
16725
+ if (await exited()) return true;
16726
+ await new Promise((r) => setTimeout(r, pollMs));
16507
16727
  }
16508
- for (const repoRoot of mainRepoRoots) {
16509
- if (repoRoot.trim().length === 0) continue;
16510
- const resolvedRepoRoot = realpathOrResolve(repoRoot);
16511
- if (resolvedPath === resolvedRepoRoot) {
16512
- throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
16513
- }
16728
+ const started = readStartedRecord(attempt);
16729
+ const session = readSdkSession(stateRoot, attempt.worker_name);
16730
+ const targets = [];
16731
+ if (started) targets.push({ pid: started.pid, identity: started.process_start_identity });
16732
+ if (session?.attempt_id === attempt.attempt_id && session.runtime_pid && session.runtime_pid > 0) {
16733
+ targets.push({ pid: session.runtime_pid, identity: session.runtime_start_identity ?? null });
16514
16734
  }
16515
- if ((0, import_node_fs8.existsSync)((0, import_node_path9.join)(resolvedPath, ".git"))) {
16516
- const gitStat = (0, import_node_fs8.lstatSync)((0, import_node_path9.join)(resolvedPath, ".git"));
16517
- if (gitStat.isDirectory()) {
16518
- throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
16735
+ for (const target of targets) {
16736
+ if (target.identity && await isProcessIdentityLive(target.pid, target.identity) === "live") {
16737
+ await killProcessTree(target.pid, "SIGKILL").catch(() => void 0);
16519
16738
  }
16520
16739
  }
16521
- return { resolvedPath, matchedRoot };
16522
- }
16523
- var import_node_fs8, import_node_os2, import_node_path9;
16524
- var init_worktree_cleanup_safety = __esm({
16525
- "src/lib/worktree-cleanup-safety.ts"() {
16526
- "use strict";
16527
- import_node_fs8 = require("node:fs");
16528
- import_node_os2 = require("node:os");
16529
- import_node_path9 = require("node:path");
16740
+ const killDeadline = Date.now() + 5e3;
16741
+ for (; ; ) {
16742
+ if ((await Promise.all(targets.map(isTargetGone))).every(Boolean)) {
16743
+ if (started) writeTerminationComplete(attempt, started.pid, started.process_start_identity);
16744
+ return true;
16745
+ }
16746
+ if (Date.now() >= killDeadline) return false;
16747
+ await new Promise((r) => setTimeout(r, pollMs));
16530
16748
  }
16531
- });
16532
-
16533
- // src/team/git-worktree.ts
16534
- function getWorktreePath(repoRoot, teamName, workerName) {
16535
- return (0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees", sanitizeName(workerName));
16536
- }
16537
- function getBranchName(teamName, workerName) {
16538
- return `omc-team/${sanitizeName(teamName)}/${sanitizeName(workerName)}`;
16539
16749
  }
16540
- function hostHooksDir() {
16750
+ function readStartedRecord(attempt) {
16541
16751
  try {
16542
- if (emptyHooksDir && (0, import_node_fs9.readdirSync)(emptyHooksDir).length === 0) return emptyHooksDir;
16752
+ const record = JSON.parse((0, import_node_fs8.readFileSync)(attempt.startedPath, "utf8"));
16753
+ return typeof record.pid === "number" && record.pid > 0 && typeof record.process_start_identity === "string" ? { pid: record.pid, process_start_identity: record.process_start_identity } : null;
16543
16754
  } catch {
16755
+ return null;
16544
16756
  }
16545
- emptyHooksDir = (0, import_node_fs9.mkdtempSync)((0, import_node_path10.join)((0, import_node_os3.tmpdir)(), "omg-host-git-nohooks-"));
16546
- return emptyHooksDir;
16547
16757
  }
16548
- function hostGitHardeningArgs() {
16549
- return [
16550
- "-c",
16758
+ function writeTerminationComplete(attempt, pid, startIdentity) {
16759
+ const path5 = `${attempt.startedPath}.termination-complete`;
16760
+ if ((0, import_node_fs8.existsSync)(path5)) return;
16761
+ try {
16762
+ (0, import_node_fs8.writeFileSync)(path5, JSON.stringify({
16763
+ schema_version: attempt.schema_version,
16764
+ attempt_id: attempt.attempt_id,
16765
+ nonce: attempt.nonce,
16766
+ instance_id: attempt.instance_id,
16767
+ team_name: attempt.team_name,
16768
+ worker_name: attempt.worker_name,
16769
+ pane_id: attempt.pane_id,
16770
+ provider: attempt.provider,
16771
+ created_at: attempt.created_at,
16772
+ kind: "worker_launch_termination_complete",
16773
+ cleanup_verified: true,
16774
+ pid,
16775
+ process_start_identity: startIdentity,
16776
+ ...process.platform === "win32" ? {} : { process_group_id: pid },
16777
+ written_at: (/* @__PURE__ */ new Date()).toISOString()
16778
+ }), { flag: "wx" });
16779
+ } catch {
16780
+ }
16781
+ }
16782
+ var import_node_child_process3, import_node_crypto8, import_node_fs8, import_node_path9, SDK_TARGET_PREFIX, SDK_LAUNCH_POLL_MS, SDK_LAUNCH_FAILURE_GRACE_MS, HOST_CREDENTIAL_ENV, SDK_HOST_STOP_FLOOR_MS;
16783
+ var init_sdk_transport = __esm({
16784
+ "src/team/sdk-transport.ts"() {
16785
+ "use strict";
16786
+ import_node_child_process3 = require("node:child_process");
16787
+ import_node_crypto8 = require("node:crypto");
16788
+ import_node_fs8 = require("node:fs");
16789
+ import_node_path9 = require("node:path");
16790
+ init_process_utils();
16791
+ init_copilot_session_env();
16792
+ init_runtime_owner_client();
16793
+ init_worker_launch_ack();
16794
+ SDK_TARGET_PREFIX = "sdk:";
16795
+ SDK_LAUNCH_POLL_MS = 25;
16796
+ SDK_LAUNCH_FAILURE_GRACE_MS = 1500;
16797
+ HOST_CREDENTIAL_ENV = ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"];
16798
+ SDK_HOST_STOP_FLOOR_MS = 5e3;
16799
+ }
16800
+ });
16801
+
16802
+ // src/team/sdk-launch-progress.ts
16803
+ function readLaunchSession(stateRoot, workerName) {
16804
+ try {
16805
+ return JSON.parse((0, import_node_fs9.readFileSync)(sdkWorkerFiles(stateRoot, workerName).session, "utf8"));
16806
+ } catch {
16807
+ return null;
16808
+ }
16809
+ }
16810
+ function lastSdkLaunchPhase(session) {
16811
+ const timeline = session?.timeline ?? {};
16812
+ let last = -1;
16813
+ SDK_LAUNCH_PHASES.forEach((phase, i) => {
16814
+ if (timeline[phase.mark]) last = i;
16815
+ });
16816
+ return last;
16817
+ }
16818
+ function formatSdkLaunchBreakdown(session) {
16819
+ const timeline = session?.timeline ?? {};
16820
+ const parts = [];
16821
+ let previous = null;
16822
+ for (const phase of SDK_LAUNCH_PHASES) {
16823
+ const at = timeline[phase.mark] ? Date.parse(timeline[phase.mark]) : NaN;
16824
+ if (!Number.isFinite(at)) continue;
16825
+ if (previous !== null) parts.push(`${phase.span} ${seconds(at - previous)}`);
16826
+ previous = at;
16827
+ }
16828
+ return parts.join(", ");
16829
+ }
16830
+ function startSdkLaunchProgress(stateRoot, workerName, write, options = {}) {
16831
+ const now = options.now ?? Date.now;
16832
+ const read = options.readSession ?? readLaunchSession;
16833
+ const heartbeatMs = options.heartbeatMs ?? 15e3;
16834
+ const startedAt = now();
16835
+ const prefix = `[omg team] ${workerName}:`;
16836
+ const emit = (line) => {
16837
+ try {
16838
+ write(`${prefix} ${line}`);
16839
+ } catch {
16840
+ }
16841
+ };
16842
+ let reported = -1;
16843
+ let lastLineAt = startedAt;
16844
+ let done = false;
16845
+ const timer = {};
16846
+ const finish = (line) => {
16847
+ if (done) return;
16848
+ done = true;
16849
+ if (timer.handle !== void 0) (options.clearInterval ?? ((h) => clearInterval(h)))(timer.handle);
16850
+ emit(line);
16851
+ };
16852
+ const tick = () => {
16853
+ if (done) return;
16854
+ const session = read(stateRoot, workerName);
16855
+ const elapsed = seconds(now() - startedAt);
16856
+ const breakdown = formatSdkLaunchBreakdown(session);
16857
+ if (session?.timeline?.[READY]) {
16858
+ finish(`ready in ${elapsed}${breakdown ? ` (${breakdown})` : ""}`);
16859
+ return;
16860
+ }
16861
+ if (session?.state === "failed") {
16862
+ finish(`host failed after ${elapsed}${session.last_error ? `: ${session.last_error}` : ""}`);
16863
+ return;
16864
+ }
16865
+ const phase = lastSdkLaunchPhase(session);
16866
+ if (phase > reported) {
16867
+ reported = phase;
16868
+ lastLineAt = now();
16869
+ emit(`${elapsed}, ${SDK_LAUNCH_PHASES[phase].label}`);
16870
+ } else if (now() - lastLineAt >= heartbeatMs) {
16871
+ lastLineAt = now();
16872
+ const state = phase >= 0 ? `${SDK_LAUNCH_PHASES[phase].label}, ${SDK_LAUNCH_PHASES[phase].next}` : "waiting for the sdk host";
16873
+ emit(`${elapsed}, ${state}`);
16874
+ }
16875
+ };
16876
+ const every = options.setInterval ?? ((fn, ms) => {
16877
+ const timer2 = setInterval(fn, ms);
16878
+ timer2.unref?.();
16879
+ return timer2;
16880
+ });
16881
+ timer.handle = every(tick, options.pollMs ?? 1e3);
16882
+ return () => {
16883
+ if (done) return;
16884
+ tick();
16885
+ if (done) return;
16886
+ const breakdown = formatSdkLaunchBreakdown(read(stateRoot, workerName));
16887
+ finish(`launch wait ended after ${seconds(now() - startedAt)}${breakdown ? ` (${breakdown})` : ""}`);
16888
+ };
16889
+ }
16890
+ var import_node_fs9, SDK_LAUNCH_PHASES, READY, seconds;
16891
+ var init_sdk_launch_progress = __esm({
16892
+ "src/team/sdk-launch-progress.ts"() {
16893
+ "use strict";
16894
+ import_node_fs9 = require("node:fs");
16895
+ init_sdk_transport();
16896
+ SDK_LAUNCH_PHASES = [
16897
+ { mark: "host_started_at", label: "host started", next: "starting the copilot runtime", span: "host" },
16898
+ { mark: "client_started_at", label: "runtime started", next: "creating the session", span: "runtime" },
16899
+ { mark: "session_created_at", label: "session created", next: "waiting for the bootstrap prompt", span: "session" },
16900
+ { mark: "first_send_at", label: "bootstrap sent", next: "waiting for the first turn", span: "bootstrap" },
16901
+ { mark: "turn_started_at", label: "first turn started", next: "waiting for first model reply", span: "first turn" },
16902
+ { mark: "first_message_at", label: "ready", next: "", span: "first reply" }
16903
+ ];
16904
+ READY = "first_message_at";
16905
+ seconds = (ms) => `${Math.max(0, Math.round(ms / 1e3))}s`;
16906
+ }
16907
+ });
16908
+
16909
+ // src/lib/worktree-cleanup-safety.ts
16910
+ function realpathOrResolve(path5) {
16911
+ try {
16912
+ return (0, import_node_fs10.realpathSync)(path5);
16913
+ } catch {
16914
+ return (0, import_node_path10.resolve)(path5);
16915
+ }
16916
+ }
16917
+ function assertSafeBoundary(path5, label) {
16918
+ const trimmed = path5.trim();
16919
+ if (trimmed.length === 0) {
16920
+ throw new Error(`${label}_empty`);
16921
+ }
16922
+ if (trimmed.includes("\0")) {
16923
+ throw new Error(`${label}_contains_nul`);
16924
+ }
16925
+ const resolved = realpathOrResolve(trimmed);
16926
+ const root = (0, import_node_path10.parse)(resolved).root;
16927
+ const home = realpathOrResolve((0, import_node_os2.homedir)());
16928
+ if (resolved === root) {
16929
+ throw new Error(`${label}_is_filesystem_root:${resolved}`);
16930
+ }
16931
+ if (resolved === home) {
16932
+ throw new Error(`${label}_is_home_directory:${resolved}`);
16933
+ }
16934
+ return resolved;
16935
+ }
16936
+ function isInside(parent, child) {
16937
+ const rel = (0, import_node_path10.relative)(parent, child);
16938
+ return rel.length > 0 && !rel.startsWith("..") && !(0, import_node_path10.isAbsolute)(rel);
16939
+ }
16940
+ function validateWorktreeRemovalTarget(options) {
16941
+ const { candidatePath, expectedRoots, mainRepoRoots = [], requireExisting = true } = options;
16942
+ if (expectedRoots.length === 0) {
16943
+ throw new Error("expected_worktree_roots_empty");
16944
+ }
16945
+ const rawCandidate = candidatePath.trim();
16946
+ if (rawCandidate.length === 0) {
16947
+ throw new Error("worktree_path_empty");
16948
+ }
16949
+ if (rawCandidate.includes("\0")) {
16950
+ throw new Error("worktree_path_contains_nul");
16951
+ }
16952
+ if (rawCandidate === "." || rawCandidate === ".." || rawCandidate === "~") {
16953
+ throw new Error(`worktree_path_suspicious:${rawCandidate}`);
16954
+ }
16955
+ const lexicalPath = (0, import_node_path10.resolve)(rawCandidate);
16956
+ if (!(0, import_node_fs10.existsSync)(lexicalPath)) {
16957
+ if (requireExisting) {
16958
+ throw new Error(`worktree_path_missing:${lexicalPath}`);
16959
+ }
16960
+ } else {
16961
+ const stat2 = (0, import_node_fs10.lstatSync)(lexicalPath);
16962
+ if (stat2.isSymbolicLink()) {
16963
+ throw new Error(`worktree_path_is_symlink:${lexicalPath}`);
16964
+ }
16965
+ if (!stat2.isDirectory()) {
16966
+ throw new Error(`worktree_path_not_directory:${lexicalPath}`);
16967
+ }
16968
+ }
16969
+ const resolvedPath = assertSafeBoundary(candidatePath, "worktree_path");
16970
+ const matchedRoot = expectedRoots.map((root) => assertSafeBoundary(root, "worktree_root")).find((root) => isInside(root, resolvedPath));
16971
+ if (!matchedRoot) {
16972
+ throw new Error(`worktree_path_outside_expected_roots:${resolvedPath}`);
16973
+ }
16974
+ for (const repoRoot of mainRepoRoots) {
16975
+ if (repoRoot.trim().length === 0) continue;
16976
+ const resolvedRepoRoot = realpathOrResolve(repoRoot);
16977
+ if (resolvedPath === resolvedRepoRoot) {
16978
+ throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
16979
+ }
16980
+ }
16981
+ if ((0, import_node_fs10.existsSync)((0, import_node_path10.join)(resolvedPath, ".git"))) {
16982
+ const gitStat = (0, import_node_fs10.lstatSync)((0, import_node_path10.join)(resolvedPath, ".git"));
16983
+ if (gitStat.isDirectory()) {
16984
+ throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
16985
+ }
16986
+ }
16987
+ return { resolvedPath, matchedRoot };
16988
+ }
16989
+ var import_node_fs10, import_node_os2, import_node_path10;
16990
+ var init_worktree_cleanup_safety = __esm({
16991
+ "src/lib/worktree-cleanup-safety.ts"() {
16992
+ "use strict";
16993
+ import_node_fs10 = require("node:fs");
16994
+ import_node_os2 = require("node:os");
16995
+ import_node_path10 = require("node:path");
16996
+ }
16997
+ });
16998
+
16999
+ // src/team/git-worktree.ts
17000
+ function getWorktreePath(repoRoot, teamName, workerName) {
17001
+ return (0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees", sanitizeName(workerName));
17002
+ }
17003
+ function getBranchName(teamName, workerName) {
17004
+ return `omc-team/${sanitizeName(teamName)}/${sanitizeName(workerName)}`;
17005
+ }
17006
+ function hostHooksDir() {
17007
+ try {
17008
+ if (emptyHooksDir && (0, import_node_fs11.readdirSync)(emptyHooksDir).length === 0) return emptyHooksDir;
17009
+ } catch {
17010
+ }
17011
+ emptyHooksDir = (0, import_node_fs11.mkdtempSync)((0, import_node_path11.join)((0, import_node_os3.tmpdir)(), "omg-host-git-nohooks-"));
17012
+ return emptyHooksDir;
17013
+ }
17014
+ function hostGitHardeningArgs() {
17015
+ return [
17016
+ "-c",
16551
17017
  `core.hooksPath=${hostHooksDir()}`,
16552
17018
  ...EXEC_KEY_OVERRIDES.flatMap((kv) => ["-c", kv])
16553
17019
  ];
16554
17020
  }
16555
17021
  function hostAttributesFile() {
16556
17022
  try {
16557
- if (emptyAttributesFile && (0, import_node_fs9.readFileSync)(emptyAttributesFile, "utf-8") === "") return emptyAttributesFile;
17023
+ if (emptyAttributesFile && (0, import_node_fs11.readFileSync)(emptyAttributesFile, "utf-8") === "") return emptyAttributesFile;
16558
17024
  } catch {
16559
17025
  }
16560
- emptyAttributesFile = (0, import_node_path10.join)((0, import_node_fs9.mkdtempSync)((0, import_node_path10.join)((0, import_node_os3.tmpdir)(), "omg-host-git-noattrs-")), "attributes");
16561
- (0, import_node_fs9.writeFileSync)(emptyAttributesFile, "");
17026
+ emptyAttributesFile = (0, import_node_path11.join)((0, import_node_fs11.mkdtempSync)((0, import_node_path11.join)((0, import_node_os3.tmpdir)(), "omg-host-git-noattrs-")), "attributes");
17027
+ (0, import_node_fs11.writeFileSync)(emptyAttributesFile, "");
16562
17028
  return emptyAttributesFile;
16563
17029
  }
16564
17030
  function gitSubcommandIndex(args) {
@@ -16575,16 +17041,16 @@ function hostGitEnv(args, base = process.env) {
16575
17041
  };
16576
17042
  const gitDir = valueOf("--git-dir");
16577
17043
  if (!gitDir) return { ...base, GIT_LFS_SKIP_SMUDGE: "1" };
16578
- const env = { ...base, GIT_DIR: (0, import_node_path10.resolve)(gitDir), GIT_LFS_SKIP_SMUDGE: "1" };
17044
+ const env = { ...base, GIT_DIR: (0, import_node_path11.resolve)(gitDir), GIT_LFS_SKIP_SMUDGE: "1" };
16579
17045
  const workTree = valueOf("--work-tree");
16580
- if (workTree) env.GIT_WORK_TREE = (0, import_node_path10.resolve)(workTree);
16581
- if ((0, import_node_path10.basename)((0, import_node_path10.dirname)((0, import_node_path10.resolve)(gitDir))) === "worktrees") env.GIT_COMMON_DIR = (0, import_node_path10.dirname)((0, import_node_path10.dirname)((0, import_node_path10.resolve)(gitDir)));
17046
+ if (workTree) env.GIT_WORK_TREE = (0, import_node_path11.resolve)(workTree);
17047
+ if ((0, import_node_path11.basename)((0, import_node_path11.dirname)((0, import_node_path11.resolve)(gitDir))) === "worktrees") env.GIT_COMMON_DIR = (0, import_node_path11.dirname)((0, import_node_path11.dirname)((0, import_node_path11.resolve)(gitDir)));
16582
17048
  return env;
16583
17049
  }
16584
17050
  function hostGitDriverOverrides(cwd, env, timeout) {
16585
17051
  let out;
16586
17052
  try {
16587
- out = (0, import_node_child_process3.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), "config", "--null", "--show-scope", "--name-only", "--get-regexp", "^(filter|diff)\\."], { cwd, env, encoding: "utf8", stdio: "pipe", windowsHide: true, timeout });
17053
+ out = (0, import_node_child_process4.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), "config", "--null", "--show-scope", "--name-only", "--get-regexp", "^(filter|diff)\\."], { cwd, env, encoding: "utf8", stdio: "pipe", windowsHide: true, timeout });
16588
17054
  } catch (err) {
16589
17055
  return err.status === 1 ? [] : null;
16590
17056
  }
@@ -16634,38 +17100,38 @@ function runHostGit(cwd, args, timeout, baseEnv = process.env) {
16634
17100
  tree = [...tree, ...LANE_SUBMODULE_OVERRIDES.flatMap((kv) => ["-c", kv])];
16635
17101
  if (IGNORE_SUBMODULES_SUBCOMMANDS.has(subcommand)) finalArgs = [...args.slice(0, at + 1), "--ignore-submodules=all", ...args.slice(at + 1)];
16636
17102
  }
16637
- return (0, import_node_child_process3.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...tree, ...finalArgs], { cwd, env, encoding: "utf-8", stdio: "pipe", windowsHide: true, timeout });
17103
+ return (0, import_node_child_process4.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...tree, ...finalArgs], { cwd, env, encoding: "utf-8", stdio: "pipe", windowsHide: true, timeout });
16638
17104
  }
16639
17105
  function git(repoRoot, args, cwd = repoRoot) {
16640
17106
  return runHostGit(cwd, args).trim();
16641
17107
  }
16642
17108
  function readPlainFile(path5) {
16643
17109
  try {
16644
- return (0, import_node_fs9.lstatSync)(path5).isFile() ? (0, import_node_fs9.readFileSync)(path5, "utf-8") : null;
17110
+ return (0, import_node_fs11.lstatSync)(path5).isFile() ? (0, import_node_fs11.readFileSync)(path5, "utf-8") : null;
16645
17111
  } catch {
16646
17112
  return null;
16647
17113
  }
16648
17114
  }
16649
17115
  function readWorktreeGitLinks(wtPath) {
16650
- const dotGit = readPlainFile((0, import_node_path10.join)(wtPath, ".git"));
17116
+ const dotGit = readPlainFile((0, import_node_path11.join)(wtPath, ".git"));
16651
17117
  const match = dotGit === null ? null : /^gitdir: (.+?)\r?\n?$/.exec(dotGit);
16652
17118
  if (!dotGit || !match) return null;
16653
- const adminDir = (0, import_node_path10.resolve)(wtPath, match[1]);
17119
+ const adminDir = (0, import_node_path11.resolve)(wtPath, match[1]);
16654
17120
  try {
16655
- if (!(0, import_node_fs9.lstatSync)(adminDir).isDirectory()) return null;
17121
+ if (!(0, import_node_fs11.lstatSync)(adminDir).isDirectory()) return null;
16656
17122
  } catch {
16657
17123
  return null;
16658
17124
  }
16659
- const gitdir = readPlainFile((0, import_node_path10.join)(adminDir, "gitdir"));
16660
- const commondir = readPlainFile((0, import_node_path10.join)(adminDir, "commondir"));
17125
+ const gitdir = readPlainFile((0, import_node_path11.join)(adminDir, "gitdir"));
17126
+ const commondir = readPlainFile((0, import_node_path11.join)(adminDir, "commondir"));
16661
17127
  const configWorktree = configWorktreeState(adminDir);
16662
17128
  if (gitdir === null || commondir === null || configWorktree === null) return null;
16663
17129
  return { adminDir, dotGit, gitdir, commondir, configWorktree };
16664
17130
  }
16665
17131
  function configWorktreeState(adminDir) {
16666
- const path5 = (0, import_node_path10.join)(adminDir, "config.worktree");
17132
+ const path5 = (0, import_node_path11.join)(adminDir, "config.worktree");
16667
17133
  try {
16668
- return (0, import_node_fs9.lstatSync)(path5).isFile() ? (0, import_node_crypto8.createHash)("sha256").update((0, import_node_fs9.readFileSync)(path5)).digest("hex") : null;
17134
+ return (0, import_node_fs11.lstatSync)(path5).isFile() ? (0, import_node_crypto9.createHash)("sha256").update((0, import_node_fs11.readFileSync)(path5)).digest("hex") : null;
16669
17135
  } catch (err) {
16670
17136
  return err.code === "ENOENT" ? "absent" : null;
16671
17137
  }
@@ -16677,24 +17143,24 @@ function recordedEntry(wtPath) {
16677
17143
  return [...recordedGitDirs.values()].find((e) => pathKey(e.wtPath) === pathKey(wtPath));
16678
17144
  }
16679
17145
  function recordWorktreeGitLinks(wtPath, links) {
16680
- const existing = recordedEntry(wtPath) ?? recordedGitDirs.get((0, import_node_path10.resolve)(links.adminDir));
17146
+ const existing = recordedEntry(wtPath) ?? recordedGitDirs.get((0, import_node_path11.resolve)(links.adminDir));
16681
17147
  if (existing) {
16682
17148
  if (pathKey(existing.wtPath) === pathKey(wtPath) && sameGitLinks(existing.links, links)) return;
16683
17149
  throw new Error(`sandbox-escaped: other git links are already recorded for ${wtPath}; the record is never replaced`);
16684
17150
  }
16685
17151
  const args = ["--git-dir", links.adminDir, "--work-tree", wtPath];
16686
- const format = (0, import_node_child_process3.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...args, "rev-parse", "--show-object-format"], { cwd: wtPath, env: hostGitEnv(args), encoding: "utf-8", stdio: "pipe", windowsHide: true }).trim();
17152
+ const format = (0, import_node_child_process4.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...args, "rev-parse", "--show-object-format"], { cwd: wtPath, env: hostGitEnv(args), encoding: "utf-8", stdio: "pipe", windowsHide: true }).trim();
16687
17153
  const emptyTree = EMPTY_TREE[format];
16688
17154
  if (!emptyTree) throw new Error(`host git: unknown object format ${JSON.stringify(format)} in ${wtPath}`);
16689
- recordedGitDirs.set((0, import_node_path10.resolve)(links.adminDir), { wtPath, links, emptyTree });
17155
+ recordedGitDirs.set((0, import_node_path11.resolve)(links.adminDir), { wtPath, links, emptyTree });
16690
17156
  }
16691
17157
  function forgetWorktreeGitLinks(wtPath) {
16692
17158
  const entry = recordedEntry(wtPath);
16693
- if (entry) recordedGitDirs.delete((0, import_node_path10.resolve)(entry.links.adminDir));
17159
+ if (entry) recordedGitDirs.delete((0, import_node_path11.resolve)(entry.links.adminDir));
16694
17160
  }
16695
17161
  function isAdminDirOf(commonGitDir, adminDir) {
16696
- const rel = (0, import_node_path10.relative)((0, import_node_path10.resolve)(commonGitDir, "worktrees"), adminDir);
16697
- return rel !== "" && !rel.startsWith("..") && !(0, import_node_path10.isAbsolute)(rel) && !rel.includes(import_node_path10.sep);
17162
+ const rel = (0, import_node_path11.relative)((0, import_node_path11.resolve)(commonGitDir, "worktrees"), adminDir);
17163
+ return rel !== "" && !rel.startsWith("..") && !(0, import_node_path11.isAbsolute)(rel) && !rel.includes(import_node_path11.sep);
16698
17164
  }
16699
17165
  function worktreeGitLinksIntact(wtPath, expected, commonGitDir) {
16700
17166
  return isAdminDirOf(commonGitDir, expected.adminDir) && sameGitLinks(readWorktreeGitLinks(wtPath), expected);
@@ -16721,20 +17187,20 @@ function assertCleanLeaderWorktree(repoRoot) {
16721
17187
  }
16722
17188
  }
16723
17189
  function canonicalPathForComparison(path5) {
16724
- let existing = (0, import_node_path10.resolve)(path5);
17190
+ let existing = (0, import_node_path11.resolve)(path5);
16725
17191
  const missingTail = [];
16726
17192
  let canonical;
16727
17193
  for (; ; ) {
16728
17194
  try {
16729
- canonical = (0, import_node_path10.join)(import_node_fs9.realpathSync.native(existing), ...missingTail);
17195
+ canonical = (0, import_node_path11.join)(import_node_fs11.realpathSync.native(existing), ...missingTail);
16730
17196
  break;
16731
17197
  } catch {
16732
- const parent = (0, import_node_path10.dirname)(existing);
17198
+ const parent = (0, import_node_path11.dirname)(existing);
16733
17199
  if (parent === existing) {
16734
- canonical = (0, import_node_path10.resolve)(path5);
17200
+ canonical = (0, import_node_path11.resolve)(path5);
16735
17201
  break;
16736
17202
  }
16737
- missingTail.unshift((0, import_node_path10.basename)(existing));
17203
+ missingTail.unshift((0, import_node_path11.basename)(existing));
16738
17204
  existing = parent;
16739
17205
  }
16740
17206
  }
@@ -16810,10 +17276,10 @@ function statusEntryPath(line) {
16810
17276
  return normalizeStatusPath(renameIndex >= 0 ? payload.slice(renameIndex + renameSeparator.length) : payload);
16811
17277
  }
16812
17278
  function worktreeRuntimeStatePrefixes(wtPath) {
16813
- const root = (0, import_node_path10.resolve)(wtPath);
16814
- const omcRel = (0, import_node_path10.relative)(root, (0, import_node_path10.resolve)(getOmcRoot(wtPath))).split(import_node_path10.sep).join("/");
16815
- if (!omcRel || omcRel.startsWith("..") || (0, import_node_path10.isAbsolute)(omcRel) || omcRel.includes("/")) return [];
16816
- return WORKTREE_RUNTIME_STATE_DIRS.map(([dir, rest]) => [`${(0, import_node_path10.relative)(root, resolveOmcPath(dir, wtPath)).split(import_node_path10.sep).join("/")}/`, rest]);
17279
+ const root = (0, import_node_path11.resolve)(wtPath);
17280
+ const omcRel = (0, import_node_path11.relative)(root, (0, import_node_path11.resolve)(getOmcRoot(wtPath))).split(import_node_path11.sep).join("/");
17281
+ if (!omcRel || omcRel.startsWith("..") || (0, import_node_path11.isAbsolute)(omcRel) || omcRel.includes("/")) return [];
17282
+ return WORKTREE_RUNTIME_STATE_DIRS.map(([dir, rest]) => [`${(0, import_node_path11.relative)(root, resolveOmcPath(dir, wtPath)).split(import_node_path11.sep).join("/")}/`, rest]);
16817
17283
  }
16818
17284
  function isWorktreeDirtyExcept(wtPath, ignoredRootPaths = [], gitDirArgs = []) {
16819
17285
  try {
@@ -16837,7 +17303,7 @@ function removeRuntimeLeftover(wtPath, retryMs = RUNTIME_LEFTOVER_RETRY_MS) {
16837
17303
  const deadline = Date.now() + retryMs;
16838
17304
  for (; ; ) {
16839
17305
  try {
16840
- (0, import_node_fs9.rmSync)(wtPath, { recursive: true, force: true });
17306
+ (0, import_node_fs11.rmSync)(wtPath, { recursive: true, force: true });
16841
17307
  return;
16842
17308
  } catch (err) {
16843
17309
  if (Date.now() >= deadline) {
@@ -16851,33 +17317,33 @@ function removeRuntimeLeftover(wtPath, retryMs = RUNTIME_LEFTOVER_RETRY_MS) {
16851
17317
  }
16852
17318
  function unlinkUntrackedWorktreeLinks(wtPath, gitDirArgs = [], keepTracked = true) {
16853
17319
  const tracked = new Set(
16854
- (keepTracked ? gitOrNull([...gitDirArgs, "ls-files", "-z", "--stage"], wtPath) ?? "" : "").split("\0").filter((entry) => entry.startsWith("120000 ")).map((entry) => (0, import_node_path10.resolve)(wtPath, entry.slice(entry.indexOf(" ") + 1)))
17320
+ (keepTracked ? gitOrNull([...gitDirArgs, "ls-files", "-z", "--stage"], wtPath) ?? "" : "").split("\0").filter((entry) => entry.startsWith("120000 ")).map((entry) => (0, import_node_path11.resolve)(wtPath, entry.slice(entry.indexOf(" ") + 1)))
16855
17321
  );
16856
17322
  const pending = [wtPath];
16857
17323
  while (pending.length > 0) {
16858
17324
  const dir = pending.pop();
16859
17325
  let entries;
16860
17326
  try {
16861
- entries = (0, import_node_fs9.readdirSync)(dir, { withFileTypes: true });
17327
+ entries = (0, import_node_fs11.readdirSync)(dir, { withFileTypes: true });
16862
17328
  } catch {
16863
17329
  continue;
16864
17330
  }
16865
17331
  for (const entry of entries) {
16866
- const path5 = (0, import_node_path10.join)(dir, entry.name);
17332
+ const path5 = (0, import_node_path11.join)(dir, entry.name);
16867
17333
  if (keepTracked && dir === wtPath && entry.name === ".git") continue;
16868
17334
  let stat2;
16869
17335
  try {
16870
- stat2 = (0, import_node_fs9.lstatSync)(path5);
17336
+ stat2 = (0, import_node_fs11.lstatSync)(path5);
16871
17337
  } catch {
16872
17338
  continue;
16873
17339
  }
16874
17340
  if (stat2.isSymbolicLink()) {
16875
- if (tracked.has((0, import_node_path10.resolve)(path5))) continue;
17341
+ if (tracked.has((0, import_node_path11.resolve)(path5))) continue;
16876
17342
  try {
16877
- (0, import_node_fs9.unlinkSync)(path5);
17343
+ (0, import_node_fs11.unlinkSync)(path5);
16878
17344
  } catch {
16879
17345
  try {
16880
- (0, import_node_fs9.rmdirSync)(path5);
17346
+ (0, import_node_fs11.rmdirSync)(path5);
16881
17347
  } catch (err) {
16882
17348
  const error = new Error(`worktree_link_unremovable: preserving worker worktree at ${wtPath}; cannot unlink ${path5}: ${err instanceof Error ? err.message : String(err)}`);
16883
17349
  error.code = "worktree_link_unremovable";
@@ -16908,10 +17374,10 @@ function commitCheckFailedError(message) {
16908
17374
  function branchRefStored(repoRoot, branch) {
16909
17375
  const commonDir = gitOrNull(["rev-parse", "--git-common-dir"], repoRoot);
16910
17376
  if (!commonDir) throw commitCheckFailedError(`keeping worker branch ${branch} (cannot locate the git directory)`);
16911
- const gitDir = (0, import_node_path10.resolve)(repoRoot, commonDir);
16912
- if ((0, import_node_fs9.existsSync)((0, import_node_path10.join)(gitDir, "refs", "heads", ...branch.split("/")))) return true;
17377
+ const gitDir = (0, import_node_path11.resolve)(repoRoot, commonDir);
17378
+ if ((0, import_node_fs11.existsSync)((0, import_node_path11.join)(gitDir, "refs", "heads", ...branch.split("/")))) return true;
16913
17379
  try {
16914
- return (0, import_node_fs9.readFileSync)((0, import_node_path10.join)(gitDir, "packed-refs"), "utf-8").split("\n").some((line) => line.trimEnd().endsWith(` refs/heads/${branch}`));
17380
+ return (0, import_node_fs11.readFileSync)((0, import_node_path11.join)(gitDir, "packed-refs"), "utf-8").split("\n").some((line) => line.trimEnd().endsWith(` refs/heads/${branch}`));
16915
17381
  } catch (err) {
16916
17382
  if (err.code === "ENOENT") return false;
16917
17383
  throw commitCheckFailedError(`keeping worker branch ${branch} (cannot read packed-refs)`);
@@ -16955,16 +17421,16 @@ function countUnmergedCommits(repoRoot, head, baseCommit, contained = []) {
16955
17421
  }
16956
17422
  function hasInitializedSubmodules(wtPath, gitDirArgs = []) {
16957
17423
  const modulesDir = gitOrNull([...gitDirArgs, "rev-parse", "--git-path", "modules"], wtPath);
16958
- if (modulesDir && (0, import_node_fs9.existsSync)((0, import_node_path10.resolve)(wtPath, modulesDir))) return true;
17424
+ if (modulesDir && (0, import_node_fs11.existsSync)((0, import_node_path11.resolve)(wtPath, modulesDir))) return true;
16959
17425
  const staged = gitOrNull([...gitDirArgs, "ls-files", "--stage"], wtPath) ?? "";
16960
17426
  return staged.split("\n").some((line) => {
16961
17427
  if (!line.startsWith("160000 ")) return false;
16962
17428
  const tab = line.indexOf(" ");
16963
- return tab >= 0 && (0, import_node_fs9.existsSync)((0, import_node_path10.join)(wtPath, normalizeStatusPath(line.slice(tab + 1)), ".git"));
17429
+ return tab >= 0 && (0, import_node_fs11.existsSync)((0, import_node_path11.join)(wtPath, normalizeStatusPath(line.slice(tab + 1)), ".git"));
16964
17430
  });
16965
17431
  }
16966
17432
  function unmergedCommitsError(info) {
16967
- const what = (0, import_node_fs9.existsSync)(info.path) ? `worker worktree at ${info.path}` : `worker branch of the removed worktree ${info.path}`;
17433
+ const what = (0, import_node_fs11.existsSync)(info.path) ? `worker worktree at ${info.path}` : `worker branch of the removed worktree ${info.path}`;
16968
17434
  const error = new Error(
16969
17435
  `worktree_unmerged_commits: preserving ${what} with ${info.commits} commit(s) not merged into the leader HEAD${info.branch ? ` (branch ${info.branch})` : " (detached)"}`
16970
17436
  );
@@ -16972,34 +17438,34 @@ function unmergedCommitsError(info) {
16972
17438
  return error;
16973
17439
  }
16974
17440
  function getPreservedWorktreesRecordPath(repoRoot, teamName) {
16975
- return (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees", `${sanitizeName(teamName)}.json`);
17441
+ return (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees", `${sanitizeName(teamName)}.json`);
16976
17442
  }
16977
17443
  function writePreservedWorktreesRecord(repoRoot, teamName, preserved) {
16978
17444
  const recordPath = getPreservedWorktreesRecordPath(repoRoot, teamName);
16979
17445
  if (preserved.length === 0) {
16980
- (0, import_node_fs9.rmSync)(recordPath, { force: true });
17446
+ (0, import_node_fs11.rmSync)(recordPath, { force: true });
16981
17447
  return;
16982
17448
  }
16983
- ensureDirWithMode((0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees"));
17449
+ ensureDirWithMode((0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees"));
16984
17450
  atomicWriteJson2(recordPath, { team: teamName, recorded_at: (/* @__PURE__ */ new Date()).toISOString(), preserved_worktrees: preserved });
16985
17451
  }
16986
17452
  function getMetadataPath(repoRoot, teamName) {
16987
- return (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "worktrees.json");
17453
+ return (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "worktrees.json");
16988
17454
  }
16989
17455
  function getLegacyMetadataPath(repoRoot, teamName) {
16990
- return (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team-bridge", sanitizeName(teamName), "worktrees.json");
17456
+ return (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team-bridge", sanitizeName(teamName), "worktrees.json");
16991
17457
  }
16992
17458
  function getWorkerStateDir(repoRoot, teamName, workerName) {
16993
- return (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers", sanitizeName(workerName));
17459
+ return (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers", sanitizeName(workerName));
16994
17460
  }
16995
17461
  function getRootAgentsBackupPath(repoRoot, teamName, workerName) {
16996
- return (0, import_node_path10.join)(getWorkerStateDir(repoRoot, teamName, workerName), "worktree-root-agents.json");
17462
+ return (0, import_node_path11.join)(getWorkerStateDir(repoRoot, teamName, workerName), "worktree-root-agents.json");
16997
17463
  }
16998
17464
  function readRootAgentsBackup(repoRoot, teamName, workerName) {
16999
17465
  const backupPath = getRootAgentsBackupPath(repoRoot, teamName, workerName);
17000
- if (!(0, import_node_fs9.existsSync)(backupPath)) return null;
17466
+ if (!(0, import_node_fs11.existsSync)(backupPath)) return null;
17001
17467
  try {
17002
- return JSON.parse((0, import_node_fs9.readFileSync)(backupPath, "utf-8"));
17468
+ return JSON.parse((0, import_node_fs11.readFileSync)(backupPath, "utf-8"));
17003
17469
  } catch (err) {
17004
17470
  const msg = err instanceof Error ? err.message : String(err);
17005
17471
  process.stderr.write(`[omc] warning: worktree root AGENTS backup parse error: ${msg}
@@ -17012,13 +17478,13 @@ function readRootAgentsBackup(repoRoot, teamName, workerName) {
17012
17478
  function installWorktreeRootAgents(teamName, workerName, repoRoot, worktreePath, overlayContent) {
17013
17479
  const omcRoot = getOmcRoot(repoRoot);
17014
17480
  validateResolvedPath(worktreePath, omcRoot);
17015
- const agentsPath = (0, import_node_path10.join)(worktreePath, "AGENTS.md");
17481
+ const agentsPath = (0, import_node_path11.join)(worktreePath, "AGENTS.md");
17016
17482
  validateResolvedPath(agentsPath, worktreePath);
17017
17483
  const backupPath = getRootAgentsBackupPath(repoRoot, teamName, workerName);
17018
17484
  validateResolvedPath(backupPath, omcRoot);
17019
17485
  ensureDirWithMode(getWorkerStateDir(repoRoot, teamName, workerName));
17020
17486
  const previous = readRootAgentsBackup(repoRoot, teamName, workerName);
17021
- const currentContent = (0, import_node_fs9.existsSync)(agentsPath) ? (0, import_node_fs9.readFileSync)(agentsPath, "utf-8") : void 0;
17487
+ const currentContent = (0, import_node_fs11.existsSync)(agentsPath) ? (0, import_node_fs11.readFileSync)(agentsPath, "utf-8") : void 0;
17022
17488
  if (previous && currentContent !== void 0 && currentContent !== previous.installedContent) {
17023
17489
  const error = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${agentsPath}`);
17024
17490
  error.code = "agents_dirty";
@@ -17032,7 +17498,7 @@ function installWorktreeRootAgents(teamName, workerName, repoRoot, worktreePath,
17032
17498
  installedAt: (/* @__PURE__ */ new Date()).toISOString()
17033
17499
  };
17034
17500
  atomicWriteJson2(backupPath, backup);
17035
- (0, import_node_fs9.writeFileSync)(agentsPath, overlayContent, "utf-8");
17501
+ (0, import_node_fs11.writeFileSync)(agentsPath, overlayContent, "utf-8");
17036
17502
  }
17037
17503
  function restoreWorktreeRootAgents(teamName, workerName, repoRoot, worktreePath) {
17038
17504
  const omcRoot = getOmcRoot(repoRoot);
@@ -17042,27 +17508,27 @@ function restoreWorktreeRootAgents(teamName, workerName, repoRoot, worktreePath)
17042
17508
  if (!backup) return { restored: false, reason: "no_backup" };
17043
17509
  const resolvedWorktreePath = worktreePath ?? backup.worktreePath;
17044
17510
  validateResolvedPath(resolvedWorktreePath, omcRoot);
17045
- if (!(0, import_node_fs9.existsSync)(resolvedWorktreePath)) {
17511
+ if (!(0, import_node_fs11.existsSync)(resolvedWorktreePath)) {
17046
17512
  try {
17047
- (0, import_node_fs9.unlinkSync)(backupPath);
17513
+ (0, import_node_fs11.unlinkSync)(backupPath);
17048
17514
  } catch {
17049
17515
  }
17050
17516
  return { restored: false, reason: "worktree_missing" };
17051
17517
  }
17052
- const agentsPath = (0, import_node_path10.join)(resolvedWorktreePath, "AGENTS.md");
17518
+ const agentsPath = (0, import_node_path11.join)(resolvedWorktreePath, "AGENTS.md");
17053
17519
  validateResolvedPath(agentsPath, resolvedWorktreePath);
17054
- const currentContent = (0, import_node_fs9.existsSync)(agentsPath) ? (0, import_node_fs9.readFileSync)(agentsPath, "utf-8") : void 0;
17520
+ const currentContent = (0, import_node_fs11.existsSync)(agentsPath) ? (0, import_node_fs11.readFileSync)(agentsPath, "utf-8") : void 0;
17055
17521
  const isPartialInstallOriginal = backup.hadOriginal && currentContent === (backup.originalContent ?? "");
17056
17522
  if (currentContent !== void 0 && currentContent !== backup.installedContent && !isPartialInstallOriginal) {
17057
17523
  return { restored: false, reason: "agents_dirty" };
17058
17524
  }
17059
17525
  if (backup.hadOriginal) {
17060
- (0, import_node_fs9.writeFileSync)(agentsPath, backup.originalContent ?? "", "utf-8");
17061
- } else if ((0, import_node_fs9.existsSync)(agentsPath)) {
17062
- (0, import_node_fs9.unlinkSync)(agentsPath);
17526
+ (0, import_node_fs11.writeFileSync)(agentsPath, backup.originalContent ?? "", "utf-8");
17527
+ } else if ((0, import_node_fs11.existsSync)(agentsPath)) {
17528
+ (0, import_node_fs11.unlinkSync)(agentsPath);
17063
17529
  }
17064
17530
  try {
17065
- (0, import_node_fs9.unlinkSync)(backupPath);
17531
+ (0, import_node_fs11.unlinkSync)(backupPath);
17066
17532
  } catch {
17067
17533
  }
17068
17534
  return { restored: true };
@@ -17072,9 +17538,9 @@ function readMetadataResult(repoRoot, teamName) {
17072
17538
  const byWorker = /* @__PURE__ */ new Map();
17073
17539
  const issues = [];
17074
17540
  for (const metaPath of paths) {
17075
- if (!(0, import_node_fs9.existsSync)(metaPath)) continue;
17541
+ if (!(0, import_node_fs11.existsSync)(metaPath)) continue;
17076
17542
  try {
17077
- const entries = JSON.parse((0, import_node_fs9.readFileSync)(metaPath, "utf-8"));
17543
+ const entries = JSON.parse((0, import_node_fs11.readFileSync)(metaPath, "utf-8"));
17078
17544
  for (const entry of entries) byWorker.set(entry.workerName, entry);
17079
17545
  } catch (err) {
17080
17546
  const message = err instanceof Error ? err.message : String(err);
@@ -17089,15 +17555,15 @@ function readMetadata(repoRoot, teamName) {
17089
17555
  return readMetadataResult(repoRoot, teamName).entries;
17090
17556
  }
17091
17557
  function listRootAgentsBackupIssues(repoRoot, teamName, entries) {
17092
- const workersDir = (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers");
17093
- if (!(0, import_node_fs9.existsSync)(workersDir)) return [];
17558
+ const workersDir = (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers");
17559
+ if (!(0, import_node_fs11.existsSync)(workersDir)) return [];
17094
17560
  const knownWorkers = new Set(entries.map((entry) => sanitizeName(entry.workerName)));
17095
17561
  const issues = [];
17096
- for (const workerName of (0, import_node_fs9.readdirSync)(workersDir)) {
17097
- const backupPath = (0, import_node_path10.join)(workersDir, workerName, "worktree-root-agents.json");
17098
- if (!(0, import_node_fs9.existsSync)(backupPath)) continue;
17562
+ for (const workerName of (0, import_node_fs11.readdirSync)(workersDir)) {
17563
+ const backupPath = (0, import_node_path11.join)(workersDir, workerName, "worktree-root-agents.json");
17564
+ if (!(0, import_node_fs11.existsSync)(backupPath)) continue;
17099
17565
  try {
17100
- JSON.parse((0, import_node_fs9.readFileSync)(backupPath, "utf-8"));
17566
+ JSON.parse((0, import_node_fs11.readFileSync)(backupPath, "utf-8"));
17101
17567
  } catch (error) {
17102
17568
  const message = error instanceof Error ? error.message : String(error);
17103
17569
  issues.push({ path: backupPath, message: `worktree_root_agents_backup_unreadable:${workerName}:${message}` });
@@ -17114,8 +17580,8 @@ function listRootAgentsBackupIssues(repoRoot, teamName, entries) {
17114
17580
  }
17115
17581
  function writeMetadata(repoRoot, teamName, entries) {
17116
17582
  const metaPath = getMetadataPath(repoRoot, teamName);
17117
- validateResolvedPath(metaPath, (0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team"));
17118
- ensureDirWithMode((0, import_node_path10.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName)));
17583
+ validateResolvedPath(metaPath, (0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team"));
17584
+ ensureDirWithMode((0, import_node_path11.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName)));
17119
17585
  atomicWriteJson2(metaPath, entries);
17120
17586
  }
17121
17587
  function recordMetadata(repoRoot, teamName, info) {
@@ -17170,12 +17636,12 @@ function ensureWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17170
17636
  }
17171
17637
  const wtPath = getWorktreePath(repoRoot, teamName, workerName);
17172
17638
  const branch = mode === "named" ? getBranchName(teamName, workerName) : "HEAD";
17173
- validateResolvedPath(wtPath, (0, import_node_path10.join)(getOmcRoot(repoRoot), "team"));
17639
+ validateResolvedPath(wtPath, (0, import_node_path11.join)(getOmcRoot(repoRoot), "team"));
17174
17640
  try {
17175
17641
  runHostGit(repoRoot, ["worktree", "prune"]);
17176
17642
  } catch {
17177
17643
  }
17178
- if ((0, import_node_fs9.existsSync)(wtPath)) {
17644
+ if ((0, import_node_fs11.existsSync)(wtPath)) {
17179
17645
  assertCompatibleExistingWorktree(repoRoot, wtPath, branch, mode);
17180
17646
  const previousBase = readMetadata(repoRoot, teamName).find((entry) => entry.workerName === workerName)?.baseCommit;
17181
17647
  const info2 = {
@@ -17194,10 +17660,10 @@ function ensureWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17194
17660
  recordMetadata(repoRoot, teamName, info2);
17195
17661
  return info2;
17196
17662
  }
17197
- const wtDir = (0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees");
17663
+ const wtDir = (0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees");
17198
17664
  ensureDirWithMode(wtDir);
17199
17665
  const args = mode === "named" ? ["worktree", "add", "-b", branch, wtPath, options.baseRef ?? "HEAD"] : ["worktree", "add", "--detach", wtPath, options.baseRef ?? "HEAD"];
17200
- (0, import_node_child_process3.execFileSync)(hostGitExe(), args, { cwd: repoRoot, stdio: "pipe", windowsHide: true });
17666
+ (0, import_node_child_process4.execFileSync)(hostGitExe(), args, { cwd: repoRoot, stdio: "pipe", windowsHide: true });
17201
17667
  const baseCommit = gitOrNull(["rev-parse", "HEAD"], wtPath);
17202
17668
  const info = {
17203
17669
  ...baseCommit ? { baseCommit } : {},
@@ -17218,17 +17684,17 @@ function ensureWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17218
17684
  function checkWorkerWorktreeRemovalSafety(teamName, workerName, repoRoot, worktreePath, gitDirArgs = []) {
17219
17685
  const wtPath = worktreePath ?? getWorktreePath(repoRoot, teamName, workerName);
17220
17686
  const backup = readRootAgentsBackup(repoRoot, teamName, workerName);
17221
- if (!(0, import_node_fs9.existsSync)(wtPath)) return;
17687
+ if (!(0, import_node_fs11.existsSync)(wtPath)) return;
17222
17688
  validateWorktreeRemovalTarget({
17223
17689
  candidatePath: wtPath,
17224
- expectedRoots: [(0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17690
+ expectedRoots: [(0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17225
17691
  mainRepoRoots: [repoRoot]
17226
17692
  });
17227
17693
  let ignoreRootAgents = false;
17228
17694
  if (backup) {
17229
- const agentsPath = (0, import_node_path10.join)(wtPath, "AGENTS.md");
17695
+ const agentsPath = (0, import_node_path11.join)(wtPath, "AGENTS.md");
17230
17696
  validateResolvedPath(agentsPath, wtPath);
17231
- const currentContent = (0, import_node_fs9.existsSync)(agentsPath) ? (0, import_node_fs9.readFileSync)(agentsPath, "utf-8") : void 0;
17697
+ const currentContent = (0, import_node_fs11.existsSync)(agentsPath) ? (0, import_node_fs11.readFileSync)(agentsPath, "utf-8") : void 0;
17232
17698
  const isPartialInstallOriginal = backup.hadOriginal && currentContent === (backup.originalContent ?? "");
17233
17699
  if (currentContent !== void 0 && currentContent !== backup.installedContent && !isPartialInstallOriginal) {
17234
17700
  const error = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${agentsPath}`);
@@ -17249,7 +17715,7 @@ function prepareWorkerWorktreeForRemoval(teamName, workerName, repoRoot, worktre
17249
17715
  checkWorkerWorktreeRemovalSafety(teamName, workerName, repoRoot, wtPath, gitDirArgs);
17250
17716
  const agentsRestore = restoreWorktreeRootAgents(teamName, workerName, repoRoot, wtPath);
17251
17717
  if (agentsRestore.reason === "agents_dirty") {
17252
- const error = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${(0, import_node_path10.join)(wtPath, "AGENTS.md")}`);
17718
+ const error = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${(0, import_node_path11.join)(wtPath, "AGENTS.md")}`);
17253
17719
  error.code = "agents_dirty";
17254
17720
  throw error;
17255
17721
  }
@@ -17284,7 +17750,7 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17284
17750
  throw commitCheckFailedError(`preserving worker worktree at ${wtPath} (cannot list git worktrees)`);
17285
17751
  }
17286
17752
  const wasRegisteredWorktree = registered !== null;
17287
- if (registered && (0, import_node_fs9.existsSync)(wtPath)) {
17753
+ if (registered && (0, import_node_fs11.existsSync)(wtPath)) {
17288
17754
  const toplevel = gitOrNull([...gitDirArgs, "rev-parse", "--show-toplevel"], wtPath);
17289
17755
  if (!toplevel || canonicalPathForComparison(toplevel) !== canonicalPathForComparison(wtPath)) {
17290
17756
  throw commitCheckFailedError(`preserving worker worktree at ${wtPath} (git does not resolve it to its own worktree)`);
@@ -17303,21 +17769,21 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17303
17769
  if (commits === null) throw commitCheckFailedError(`keeping worker branch ${branch} (cannot count its commits against the leader HEAD)`);
17304
17770
  if (commits > 0) throw unmergedCommitsError({ workerName, path: wtPath, branch, commits });
17305
17771
  }
17306
- const runtimeOnly = (0, import_node_fs9.existsSync)(wtPath) && isWorktreeDirtyExcept(wtPath, ["AGENTS.md"], gitDirArgs).runtimeState;
17307
- const submodules = (0, import_node_fs9.existsSync)(wtPath) && hasInitializedSubmodules(wtPath, gitDirArgs);
17772
+ const runtimeOnly = (0, import_node_fs11.existsSync)(wtPath) && isWorktreeDirtyExcept(wtPath, ["AGENTS.md"], gitDirArgs).runtimeState;
17773
+ const submodules = (0, import_node_fs11.existsSync)(wtPath) && hasInitializedSubmodules(wtPath, gitDirArgs);
17308
17774
  const force = runtimeOnly && !submodules;
17309
17775
  if (wasRegisteredWorktree && submodules) {
17310
17776
  const error = new Error(`worktree_remove_failed: preserving metadata for registered worker worktree at ${wtPath}: initialized submodules`);
17311
17777
  error.code = "worktree_remove_failed";
17312
17778
  throw error;
17313
17779
  }
17314
- if ((0, import_node_fs9.existsSync)(wtPath)) unlinkUntrackedWorktreeLinks(wtPath, gitDirArgs);
17780
+ if ((0, import_node_fs11.existsSync)(wtPath)) unlinkUntrackedWorktreeLinks(wtPath, gitDirArgs);
17315
17781
  try {
17316
17782
  if (options.gitLinks && laneCommonDir) {
17317
- if ((0, import_node_fs9.existsSync)(wtPath)) {
17783
+ if ((0, import_node_fs11.existsSync)(wtPath)) {
17318
17784
  validateWorktreeRemovalTarget({
17319
17785
  candidatePath: wtPath,
17320
- expectedRoots: [(0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17786
+ expectedRoots: [(0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17321
17787
  mainRepoRoots: [repoRoot]
17322
17788
  });
17323
17789
  }
@@ -17344,14 +17810,14 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17344
17810
  } catch {
17345
17811
  }
17346
17812
  if (branchHead) deleteWorkerBranchAt(repoRoot, branch, branchHead);
17347
- if ((0, import_node_fs9.existsSync)(wtPath) && !isRegisteredWorktreePath(repoRoot, wtPath)) {
17813
+ if ((0, import_node_fs11.existsSync)(wtPath) && !isRegisteredWorktreePath(repoRoot, wtPath)) {
17348
17814
  validateWorktreeRemovalTarget({
17349
17815
  candidatePath: wtPath,
17350
- expectedRoots: [(0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17816
+ expectedRoots: [(0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17351
17817
  mainRepoRoots: [repoRoot]
17352
17818
  });
17353
17819
  if (force) removeRuntimeLeftover(wtPath);
17354
- else (0, import_node_fs9.rmSync)(wtPath, { recursive: true, force: true });
17820
+ else (0, import_node_fs11.rmSync)(wtPath, { recursive: true, force: true });
17355
17821
  }
17356
17822
  forgetMetadataUnlocked(repoRoot, teamName, workerName);
17357
17823
  forgetWorktreeGitLinks(wtPath);
@@ -17361,27 +17827,27 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
17361
17827
  function removeTreeByPath(dir) {
17362
17828
  let stat2;
17363
17829
  try {
17364
- stat2 = (0, import_node_fs9.lstatSync)(dir);
17830
+ stat2 = (0, import_node_fs11.lstatSync)(dir);
17365
17831
  } catch {
17366
17832
  return;
17367
17833
  }
17368
17834
  if (stat2.isSymbolicLink()) {
17369
17835
  try {
17370
- (0, import_node_fs9.unlinkSync)(dir);
17836
+ (0, import_node_fs11.unlinkSync)(dir);
17371
17837
  } catch {
17372
- (0, import_node_fs9.rmdirSync)(dir);
17838
+ (0, import_node_fs11.rmdirSync)(dir);
17373
17839
  }
17374
17840
  return;
17375
17841
  }
17376
17842
  unlinkUntrackedWorktreeLinks(dir, [], false);
17377
- (0, import_node_fs9.rmSync)(dir, { recursive: true, force: true });
17843
+ (0, import_node_fs11.rmSync)(dir, { recursive: true, force: true });
17378
17844
  }
17379
17845
  function removeTamperedWorktree(repoRoot, teamName, workerName, wtPath, links, commonDir) {
17380
17846
  const removeTree = removeTreeByPath;
17381
- if ((0, import_node_fs9.existsSync)(wtPath)) {
17847
+ if ((0, import_node_fs11.existsSync)(wtPath)) {
17382
17848
  validateWorktreeRemovalTarget({
17383
17849
  candidatePath: wtPath,
17384
- expectedRoots: [(0, import_node_path10.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17850
+ expectedRoots: [(0, import_node_path11.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
17385
17851
  mainRepoRoots: [repoRoot]
17386
17852
  });
17387
17853
  }
@@ -17441,15 +17907,15 @@ function cleanupTeamWorktrees(teamName, repoRoot) {
17441
17907
  }
17442
17908
  return { removed, preserved, retained };
17443
17909
  }
17444
- var import_node_fs9, import_node_os3, import_node_path10, import_node_child_process3, import_node_crypto8, emptyHooksDir, EXEC_KEY_OVERRIDES, emptyAttributesFile, WORK_TREE_SUBCOMMANDS, GLOBAL_OPTIONS_WITH_VALUE, LANE_SUBMODULE_OVERRIDES, IGNORE_SUBMODULES_SUBCOMMANDS, EMPTY_TREE, recordedGitDirs, pathKey, UNTRACKED_OMC_STATE, WORKTREE_RUNTIME_STATE_DIRS, RUNTIME_LEFTOVER_RETRY_MS;
17910
+ var import_node_fs11, import_node_os3, import_node_path11, import_node_child_process4, import_node_crypto9, emptyHooksDir, EXEC_KEY_OVERRIDES, emptyAttributesFile, WORK_TREE_SUBCOMMANDS, GLOBAL_OPTIONS_WITH_VALUE, LANE_SUBMODULE_OVERRIDES, IGNORE_SUBMODULES_SUBCOMMANDS, EMPTY_TREE, recordedGitDirs, pathKey, UNTRACKED_OMC_STATE, WORKTREE_RUNTIME_STATE_DIRS, RUNTIME_LEFTOVER_RETRY_MS;
17445
17911
  var init_git_worktree = __esm({
17446
17912
  "src/team/git-worktree.ts"() {
17447
17913
  "use strict";
17448
- import_node_fs9 = require("node:fs");
17914
+ import_node_fs11 = require("node:fs");
17449
17915
  import_node_os3 = require("node:os");
17450
- import_node_path10 = require("node:path");
17451
- import_node_child_process3 = require("node:child_process");
17452
- import_node_crypto8 = require("node:crypto");
17916
+ import_node_path11 = require("node:path");
17917
+ import_node_child_process4 = require("node:child_process");
17918
+ import_node_crypto9 = require("node:crypto");
17453
17919
  init_windows_search();
17454
17920
  init_fs_utils();
17455
17921
  init_worktree_cleanup_safety();
@@ -17501,7 +17967,7 @@ var init_git_worktree = __esm({
17501
17967
  sha256: "6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321"
17502
17968
  };
17503
17969
  recordedGitDirs = /* @__PURE__ */ new Map();
17504
- pathKey = (path5) => process.platform === "win32" ? (0, import_node_path10.resolve)(path5).toLowerCase() : (0, import_node_path10.resolve)(path5);
17970
+ pathKey = (path5) => process.platform === "win32" ? (0, import_node_path11.resolve)(path5).toLowerCase() : (0, import_node_path11.resolve)(path5);
17505
17971
  UNTRACKED_OMC_STATE = new RegExp(
17506
17972
  `^\\?\\? ${OmcPaths.ROOT.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:/|$)`
17507
17973
  );
@@ -17996,24 +18462,24 @@ function validateBranchName(branch) {
17996
18462
  }
17997
18463
  }
17998
18464
  function configureHarnessMergeAttributes(repoRoot) {
17999
- (0, import_node_child_process4.execFileSync)("git", ["config", "merge.ours.driver", "true"], {
18465
+ (0, import_node_child_process5.execFileSync)("git", ["config", "merge.ours.driver", "true"], {
18000
18466
  cwd: repoRoot,
18001
18467
  stdio: "pipe",
18002
18468
  windowsHide: true
18003
18469
  });
18004
- const commonDir = (0, import_node_child_process4.execFileSync)("git", ["rev-parse", "--git-common-dir"], {
18470
+ const commonDir = (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--git-common-dir"], {
18005
18471
  cwd: repoRoot,
18006
18472
  encoding: "utf-8",
18007
18473
  stdio: "pipe",
18008
18474
  windowsHide: true
18009
18475
  }).trim();
18010
- const resolvedCommonDir = (0, import_node_path11.isAbsolute)(commonDir) ? commonDir : (0, import_node_path11.join)(repoRoot, commonDir);
18011
- const infoDir = (0, import_node_path11.join)(resolvedCommonDir, "info");
18012
- (0, import_node_fs10.mkdirSync)(infoDir, { recursive: true });
18013
- const attrPath = (0, import_node_path11.join)(infoDir, "attributes");
18476
+ const resolvedCommonDir = (0, import_node_path12.isAbsolute)(commonDir) ? commonDir : (0, import_node_path12.join)(repoRoot, commonDir);
18477
+ const infoDir = (0, import_node_path12.join)(resolvedCommonDir, "info");
18478
+ (0, import_node_fs12.mkdirSync)(infoDir, { recursive: true });
18479
+ const attrPath = (0, import_node_path12.join)(infoDir, "attributes");
18014
18480
  let existing = "";
18015
18481
  try {
18016
- existing = (0, import_node_fs10.readFileSync)(attrPath, "utf-8");
18482
+ existing = (0, import_node_fs12.readFileSync)(attrPath, "utf-8");
18017
18483
  } catch {
18018
18484
  }
18019
18485
  const existingLines = new Set(existing.split("\n").map((l) => l.trim()));
@@ -18022,14 +18488,14 @@ function configureHarnessMergeAttributes(repoRoot) {
18022
18488
  );
18023
18489
  if (missing.length === 0) return;
18024
18490
  const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
18025
- (0, import_node_fs10.appendFileSync)(attrPath, `${prefix}${missing.join("\n")}
18491
+ (0, import_node_fs12.appendFileSync)(attrPath, `${prefix}${missing.join("\n")}
18026
18492
  `, "utf-8");
18027
18493
  }
18028
18494
  function checkMergeConflicts(workerBranch, baseBranch, repoRoot) {
18029
18495
  validateBranchName(workerBranch);
18030
18496
  validateBranchName(baseBranch);
18031
18497
  try {
18032
- (0, import_node_child_process4.execFileSync)(
18498
+ (0, import_node_child_process5.execFileSync)(
18033
18499
  "git",
18034
18500
  ["merge-tree", "--write-tree", baseBranch, workerBranch],
18035
18501
  { cwd: repoRoot, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], windowsHide: true }
@@ -18049,17 +18515,17 @@ function checkMergeConflicts(workerBranch, baseBranch, repoRoot) {
18049
18515
  return conflicts.length > 0 ? conflicts : ["(merge-tree reported conflicts)"];
18050
18516
  }
18051
18517
  }
18052
- const mergeBase = (0, import_node_child_process4.execFileSync)(
18518
+ const mergeBase = (0, import_node_child_process5.execFileSync)(
18053
18519
  "git",
18054
18520
  ["merge-base", baseBranch, workerBranch],
18055
18521
  { cwd: repoRoot, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], windowsHide: true }
18056
18522
  ).trim();
18057
- const baseDiff = (0, import_node_child_process4.execFileSync)(
18523
+ const baseDiff = (0, import_node_child_process5.execFileSync)(
18058
18524
  "git",
18059
18525
  ["diff", "--name-only", mergeBase, baseBranch],
18060
18526
  { cwd: repoRoot, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], windowsHide: true }
18061
18527
  ).trim();
18062
- const workerDiff = (0, import_node_child_process4.execFileSync)(
18528
+ const workerDiff = (0, import_node_child_process5.execFileSync)(
18063
18529
  "git",
18064
18530
  ["diff", "--name-only", mergeBase, workerBranch],
18065
18531
  { cwd: repoRoot, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], windowsHide: true }
@@ -18077,7 +18543,7 @@ function mergeWorkerBranch(workerBranch, baseBranch, repoRoot) {
18077
18543
  const workerName = workerBranch.split("/").pop() || workerBranch;
18078
18544
  try {
18079
18545
  try {
18080
- (0, import_node_child_process4.execFileSync)("git", ["diff-index", "--quiet", "HEAD", "--"], {
18546
+ (0, import_node_child_process5.execFileSync)("git", ["diff-index", "--quiet", "HEAD", "--"], {
18081
18547
  cwd: repoRoot,
18082
18548
  stdio: "pipe",
18083
18549
  windowsHide: true
@@ -18085,17 +18551,17 @@ function mergeWorkerBranch(workerBranch, baseBranch, repoRoot) {
18085
18551
  } catch {
18086
18552
  throw new Error("Working tree has uncommitted changes \u2014 commit or stash before merging");
18087
18553
  }
18088
- (0, import_node_child_process4.execFileSync)("git", ["checkout", baseBranch], {
18554
+ (0, import_node_child_process5.execFileSync)("git", ["checkout", baseBranch], {
18089
18555
  cwd: repoRoot,
18090
18556
  stdio: "pipe",
18091
18557
  windowsHide: true
18092
18558
  });
18093
- (0, import_node_child_process4.execFileSync)("git", ["merge", "--no-ff", "-m", `Merge ${workerBranch} into ${baseBranch}`, workerBranch], {
18559
+ (0, import_node_child_process5.execFileSync)("git", ["merge", "--no-ff", "-m", `Merge ${workerBranch} into ${baseBranch}`, workerBranch], {
18094
18560
  cwd: repoRoot,
18095
18561
  stdio: "pipe",
18096
18562
  windowsHide: true
18097
18563
  });
18098
- const mergeCommit = (0, import_node_child_process4.execFileSync)("git", ["rev-parse", "HEAD"], {
18564
+ const mergeCommit = (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "HEAD"], {
18099
18565
  cwd: repoRoot,
18100
18566
  encoding: "utf-8",
18101
18567
  stdio: "pipe",
@@ -18110,7 +18576,7 @@ function mergeWorkerBranch(workerBranch, baseBranch, repoRoot) {
18110
18576
  };
18111
18577
  } catch (_err) {
18112
18578
  try {
18113
- (0, import_node_child_process4.execFileSync)("git", ["merge", "--abort"], { cwd: repoRoot, stdio: "pipe", windowsHide: true });
18579
+ (0, import_node_child_process5.execFileSync)("git", ["merge", "--abort"], { cwd: repoRoot, stdio: "pipe", windowsHide: true });
18114
18580
  } catch {
18115
18581
  }
18116
18582
  const conflicts = checkMergeConflicts(workerBranch, baseBranch, repoRoot);
@@ -18122,13 +18588,13 @@ function mergeWorkerBranch(workerBranch, baseBranch, repoRoot) {
18122
18588
  };
18123
18589
  }
18124
18590
  }
18125
- var import_node_child_process4, import_node_fs10, import_node_path11, BRANCH_NAME_RE, HARNESS_MERGE_PATHS;
18591
+ var import_node_child_process5, import_node_fs12, import_node_path12, BRANCH_NAME_RE, HARNESS_MERGE_PATHS;
18126
18592
  var init_merge_coordinator = __esm({
18127
18593
  "src/team/merge-coordinator.ts"() {
18128
18594
  "use strict";
18129
- import_node_child_process4 = require("node:child_process");
18130
- import_node_fs10 = require("node:fs");
18131
- import_node_path11 = require("node:path");
18595
+ import_node_child_process5 = require("node:child_process");
18596
+ import_node_fs12 = require("node:fs");
18597
+ import_node_path12 = require("node:path");
18132
18598
  init_git_worktree();
18133
18599
  BRANCH_NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9/_.-]*$/;
18134
18600
  HARNESS_MERGE_PATHS = ["AGENTS.md", ".claude/**"];
@@ -18421,10 +18887,10 @@ var init_worker_commit_cadence = __esm({
18421
18887
 
18422
18888
  // src/team/merge-orchestrator.ts
18423
18889
  function mergerWorktreePathFor(repoRoot, teamName) {
18424
- return (0, import_node_path12.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "merger");
18890
+ return (0, import_node_path13.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "merger");
18425
18891
  }
18426
18892
  function persistedStatePath(repoRoot, teamName) {
18427
- return (0, import_node_path12.join)(
18893
+ return (0, import_node_path13.join)(
18428
18894
  getOmcRoot(repoRoot),
18429
18895
  "state",
18430
18896
  "team",
@@ -18433,7 +18899,7 @@ function persistedStatePath(repoRoot, teamName) {
18433
18899
  );
18434
18900
  }
18435
18901
  function teardownAuditPath(repoRoot, teamName) {
18436
- return (0, import_node_path12.join)(
18902
+ return (0, import_node_path13.join)(
18437
18903
  getOmcRoot(repoRoot),
18438
18904
  "state",
18439
18905
  "team",
@@ -18442,7 +18908,7 @@ function teardownAuditPath(repoRoot, teamName) {
18442
18908
  );
18443
18909
  }
18444
18910
  function orchestratorEventLogPath(repoRoot, teamName) {
18445
- return (0, import_node_path12.join)(
18911
+ return (0, import_node_path13.join)(
18446
18912
  getOmcRoot(repoRoot),
18447
18913
  "state",
18448
18914
  "team",
@@ -18463,7 +18929,7 @@ function assertRuntimeV2Gate() {
18463
18929
  }
18464
18930
  async function appendEvent(repoRoot, teamName, event) {
18465
18931
  const path5 = orchestratorEventLogPath(repoRoot, teamName);
18466
- await (0, import_promises16.mkdir)((0, import_node_path12.dirname)(path5), { recursive: true });
18932
+ await (0, import_promises16.mkdir)((0, import_node_path13.dirname)(path5), { recursive: true });
18467
18933
  const full = {
18468
18934
  ts: (/* @__PURE__ */ new Date()).toISOString(),
18469
18935
  team: teamName,
@@ -18481,7 +18947,7 @@ function createMutex() {
18481
18947
  };
18482
18948
  }
18483
18949
  function gitRevParseHead(repoRoot, branch) {
18484
- return (0, import_node_child_process5.execFileSync)("git", ["rev-parse", `refs/heads/${branch}`], {
18950
+ return (0, import_node_child_process6.execFileSync)("git", ["rev-parse", `refs/heads/${branch}`], {
18485
18951
  cwd: repoRoot,
18486
18952
  encoding: "utf-8",
18487
18953
  stdio: "pipe",
@@ -18490,7 +18956,7 @@ function gitRevParseHead(repoRoot, branch) {
18490
18956
  }
18491
18957
  function gitPath(worktreePath, gitPathName) {
18492
18958
  try {
18493
- const resolved = (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--git-path", gitPathName], {
18959
+ const resolved = (0, import_node_child_process6.execFileSync)("git", ["rev-parse", "--git-path", gitPathName], {
18494
18960
  cwd: worktreePath,
18495
18961
  encoding: "utf-8",
18496
18962
  stdio: "pipe",
@@ -18499,14 +18965,14 @@ function gitPath(worktreePath, gitPathName) {
18499
18965
  if (resolved) return resolved;
18500
18966
  } catch {
18501
18967
  }
18502
- return (0, import_node_path12.join)(worktreePath, ".git", gitPathName);
18968
+ return (0, import_node_path13.join)(worktreePath, ".git", gitPathName);
18503
18969
  }
18504
18970
  function isRebaseInProgress(worktreePath) {
18505
- return (0, import_node_fs11.existsSync)(gitPath(worktreePath, "rebase-merge"));
18971
+ return (0, import_node_fs13.existsSync)(gitPath(worktreePath, "rebase-merge"));
18506
18972
  }
18507
18973
  function isWorktreeRegistered(repoRoot, wtPath) {
18508
18974
  try {
18509
- const out = (0, import_node_child_process5.execFileSync)("git", ["worktree", "list", "--porcelain"], {
18975
+ const out = (0, import_node_child_process6.execFileSync)("git", ["worktree", "list", "--porcelain"], {
18510
18976
  cwd: repoRoot,
18511
18977
  encoding: "utf-8",
18512
18978
  stdio: "pipe",
@@ -18522,11 +18988,11 @@ function isWorktreeRegistered(repoRoot, wtPath) {
18522
18988
  return false;
18523
18989
  }
18524
18990
  function ensureMergerWorktree(repoRoot, mergerPath, leaderBranch) {
18525
- ensureDirWithMode((0, import_node_path12.dirname)(mergerPath));
18526
- if ((0, import_node_fs11.existsSync)(mergerPath) && isWorktreeRegistered(repoRoot, mergerPath)) {
18991
+ ensureDirWithMode((0, import_node_path13.dirname)(mergerPath));
18992
+ if ((0, import_node_fs13.existsSync)(mergerPath) && isWorktreeRegistered(repoRoot, mergerPath)) {
18527
18993
  return;
18528
18994
  }
18529
- (0, import_node_child_process5.execFileSync)("git", ["worktree", "add", "--force", mergerPath, leaderBranch], {
18995
+ (0, import_node_child_process6.execFileSync)("git", ["worktree", "add", "--force", mergerPath, leaderBranch], {
18530
18996
  cwd: repoRoot,
18531
18997
  stdio: "pipe",
18532
18998
  windowsHide: true
@@ -18534,14 +19000,14 @@ function ensureMergerWorktree(repoRoot, mergerPath, leaderBranch) {
18534
19000
  }
18535
19001
  function preflightMergerWorktree(mergerPath, leaderBranch) {
18536
19002
  try {
18537
- (0, import_node_child_process5.execFileSync)("git", ["fetch", "--no-tags", "origin", leaderBranch], {
19003
+ (0, import_node_child_process6.execFileSync)("git", ["fetch", "--no-tags", "origin", leaderBranch], {
18538
19004
  cwd: mergerPath,
18539
19005
  stdio: "pipe",
18540
19006
  windowsHide: true
18541
19007
  });
18542
19008
  } catch {
18543
19009
  }
18544
- (0, import_node_child_process5.execFileSync)("git", ["reset", "--hard", leaderBranch], {
19010
+ (0, import_node_child_process6.execFileSync)("git", ["reset", "--hard", leaderBranch], {
18545
19011
  cwd: mergerPath,
18546
19012
  stdio: "pipe",
18547
19013
  windowsHide: true
@@ -18563,16 +19029,16 @@ async function startMergeOrchestrator(config) {
18563
19029
  const pollIntervalMs = config.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
18564
19030
  const drainTimeoutMs = config.drainTimeoutMs ?? DEFAULT_DRAIN_TIMEOUT_MS;
18565
19031
  const mergerPath = mergerWorktreePathFor(config.repoRoot, config.teamName);
18566
- validateResolvedPath(mergerPath, (0, import_node_path12.join)(getOmcRoot(config.repoRoot), "team"));
19032
+ validateResolvedPath(mergerPath, (0, import_node_path13.join)(getOmcRoot(config.repoRoot), "team"));
18567
19033
  ensureMergerWorktree(config.repoRoot, mergerPath, config.leaderBranch);
18568
19034
  await ensureLeaderInbox(config.teamName, config.cwd);
18569
19035
  configureHarnessMergeAttributes(config.repoRoot);
18570
19036
  const persistedPath = persistedStatePath(config.repoRoot, config.teamName);
18571
19037
  let persisted = { lastShas: {} };
18572
- if ((0, import_node_fs11.existsSync)(persistedPath)) {
19038
+ if ((0, import_node_fs13.existsSync)(persistedPath)) {
18573
19039
  try {
18574
- const { readFileSync: readFileSync31 } = await import("node:fs");
18575
- persisted = JSON.parse(readFileSync31(persistedPath, "utf-8"));
19040
+ const { readFileSync: readFileSync32 } = await import("node:fs");
19041
+ persisted = JSON.parse(readFileSync32(persistedPath, "utf-8"));
18576
19042
  } catch {
18577
19043
  persisted = { lastShas: {} };
18578
19044
  }
@@ -18616,7 +19082,7 @@ async function startMergeOrchestrator(config) {
18616
19082
  await pauseHookViaSentinel(wtPath);
18617
19083
  pausedWorkers.add(other.workerName);
18618
19084
  try {
18619
- (0, import_node_child_process5.execFileSync)("git", ["fetch", "--no-tags", "origin", config.leaderBranch], {
19085
+ (0, import_node_child_process6.execFileSync)("git", ["fetch", "--no-tags", "origin", config.leaderBranch], {
18620
19086
  cwd: wtPath,
18621
19087
  stdio: "pipe",
18622
19088
  windowsHide: true
@@ -18624,7 +19090,7 @@ async function startMergeOrchestrator(config) {
18624
19090
  } catch {
18625
19091
  }
18626
19092
  try {
18627
- (0, import_node_child_process5.execFileSync)("git", ["rebase", config.leaderBranch], {
19093
+ (0, import_node_child_process6.execFileSync)("git", ["rebase", config.leaderBranch], {
18628
19094
  cwd: wtPath,
18629
19095
  stdio: "pipe",
18630
19096
  windowsHide: true
@@ -18638,7 +19104,7 @@ async function startMergeOrchestrator(config) {
18638
19104
  } catch {
18639
19105
  let conflictingFiles = [];
18640
19106
  try {
18641
- const status = (0, import_node_child_process5.execFileSync)("git", ["status", "--porcelain"], {
19107
+ const status = (0, import_node_child_process6.execFileSync)("git", ["status", "--porcelain"], {
18642
19108
  cwd: wtPath,
18643
19109
  encoding: "utf-8",
18644
19110
  stdio: "pipe",
@@ -18650,7 +19116,7 @@ async function startMergeOrchestrator(config) {
18650
19116
  }
18651
19117
  const baseSha = (() => {
18652
19118
  try {
18653
- return (0, import_node_child_process5.execFileSync)("git", ["rev-parse", `refs/heads/${config.leaderBranch}`], {
19119
+ return (0, import_node_child_process6.execFileSync)("git", ["rev-parse", `refs/heads/${config.leaderBranch}`], {
18654
19120
  cwd: config.repoRoot,
18655
19121
  encoding: "utf-8",
18656
19122
  stdio: "pipe",
@@ -18709,7 +19175,7 @@ async function startMergeOrchestrator(config) {
18709
19175
  if (conflicts.length > 0) {
18710
19176
  let mergeBaseSha = "unknown";
18711
19177
  try {
18712
- mergeBaseSha = (0, import_node_child_process5.execFileSync)(
19178
+ mergeBaseSha = (0, import_node_child_process6.execFileSync)(
18713
19179
  "git",
18714
19180
  ["merge-base", config.leaderBranch, entry.workerBranch],
18715
19181
  { cwd: mergerPath, encoding: "utf-8", stdio: "pipe", windowsHide: true }
@@ -18828,7 +19294,7 @@ async function startMergeOrchestrator(config) {
18828
19294
  async function handleRebaseResolution(entry) {
18829
19295
  pausedWorkers.delete(entry.workerName);
18830
19296
  try {
18831
- const status = (0, import_node_child_process5.execFileSync)("git", ["status", "--porcelain"], {
19297
+ const status = (0, import_node_child_process6.execFileSync)("git", ["status", "--porcelain"], {
18832
19298
  cwd: entry.workerWorktreePath,
18833
19299
  encoding: "utf-8",
18834
19300
  stdio: "pipe",
@@ -18975,7 +19441,7 @@ ${dirtyFiles.map((f) => `- \`${f}\``).join("\n")}`;
18975
19441
  } catch {
18976
19442
  }
18977
19443
  const auditPath = teardownAuditPath(config.repoRoot, config.teamName);
18978
- await (0, import_promises16.mkdir)((0, import_node_path12.dirname)(auditPath), { recursive: true });
19444
+ await (0, import_promises16.mkdir)((0, import_node_path13.dirname)(auditPath), { recursive: true });
18979
19445
  for (const u of unmerged) {
18980
19446
  const row = JSON.stringify({
18981
19447
  type: "unmerged_at_shutdown",
@@ -19015,10 +19481,10 @@ ${unmerged.map((u) => `- ${u.workerName}: ${u.reason}`).join("\n")}`;
19015
19481
  async function recoverFromRestart(config) {
19016
19482
  const persistedPath = persistedStatePath(config.repoRoot, config.teamName);
19017
19483
  let persistedShasLoaded = 0;
19018
- if ((0, import_node_fs11.existsSync)(persistedPath)) {
19484
+ if ((0, import_node_fs13.existsSync)(persistedPath)) {
19019
19485
  try {
19020
- const { readFileSync: readFileSync31 } = await import("node:fs");
19021
- const persisted = JSON.parse(readFileSync31(persistedPath, "utf-8"));
19486
+ const { readFileSync: readFileSync32 } = await import("node:fs");
19487
+ const persisted = JSON.parse(readFileSync32(persistedPath, "utf-8"));
19022
19488
  persistedShasLoaded = Object.keys(persisted.lastShas ?? {}).length;
19023
19489
  } catch {
19024
19490
  persistedShasLoaded = 0;
@@ -19061,14 +19527,14 @@ Cadence resumes once the git rebase state is gone.`;
19061
19527
  }
19062
19528
  return { orphanedRebases, persistedShasLoaded };
19063
19529
  }
19064
- var import_node_child_process5, import_node_fs11, import_promises16, import_node_path12, liveServiceOwners, DEFAULT_POLL_INTERVAL_MS2, DEFAULT_DRAIN_TIMEOUT_MS, UNMERGED_STATUS;
19530
+ var import_node_child_process6, import_node_fs13, import_promises16, import_node_path13, liveServiceOwners, DEFAULT_POLL_INTERVAL_MS2, DEFAULT_DRAIN_TIMEOUT_MS, UNMERGED_STATUS;
19065
19531
  var init_merge_orchestrator = __esm({
19066
19532
  "src/team/merge-orchestrator.ts"() {
19067
19533
  "use strict";
19068
- import_node_child_process5 = require("node:child_process");
19069
- import_node_fs11 = require("node:fs");
19534
+ import_node_child_process6 = require("node:child_process");
19535
+ import_node_fs13 = require("node:fs");
19070
19536
  import_promises16 = require("node:fs/promises");
19071
- import_node_path12 = require("node:path");
19537
+ import_node_path13 = require("node:path");
19072
19538
  init_fs_utils();
19073
19539
  init_worktree_paths();
19074
19540
  init_runtime_flags();
@@ -19086,251 +19552,6 @@ var init_merge_orchestrator = __esm({
19086
19552
  }
19087
19553
  });
19088
19554
 
19089
- // src/team/sdk-transport.ts
19090
- function isSdkTarget(value) {
19091
- return typeof value === "string" && value.startsWith(SDK_TARGET_PREFIX);
19092
- }
19093
- function sdkTeamTarget(teamName) {
19094
- return `${SDK_TARGET_PREFIX}${teamName}`;
19095
- }
19096
- function sdkPaneId(workerName) {
19097
- return `${SDK_TARGET_PREFIX}${workerName}`;
19098
- }
19099
- function sdkWorkerFiles(stateRoot, workerName) {
19100
- const dir = (0, import_node_path13.join)(stateRoot, "workers", workerName);
19101
- return {
19102
- dir,
19103
- spec: (0, import_node_path13.join)(dir, "sdk-host-spec.json"),
19104
- doorbell: (0, import_node_path13.join)(dir, "sdk-doorbell.jsonl"),
19105
- session: (0, import_node_path13.join)(dir, "sdk-session.json"),
19106
- probe: (0, import_node_path13.join)(dir, "sdk-probe.json"),
19107
- events: (0, import_node_path13.join)(dir, "sdk-events.jsonl"),
19108
- log: (0, import_node_path13.join)(dir, "sdk-host.log"),
19109
- home: (0, import_node_path13.join)(dir, "copilot-home"),
19110
- bin: (0, import_node_path13.join)(dir, "bin"),
19111
- shutdownAck: (0, import_node_path13.join)(dir, "shutdown-ack.json")
19112
- };
19113
- }
19114
- function ringDoorbell(stateRoot, workerName, entry) {
19115
- const files = sdkWorkerFiles(stateRoot, workerName);
19116
- (0, import_node_fs12.mkdirSync)(files.dir, { recursive: true });
19117
- const id = entry.id ?? (0, import_node_crypto9.randomUUID)();
19118
- const line = { ...entry, id, at: (/* @__PURE__ */ new Date()).toISOString() };
19119
- (0, import_node_fs12.appendFileSync)(files.doorbell, `${JSON.stringify(line)}
19120
- `);
19121
- return id;
19122
- }
19123
- function readSdkSession(stateRoot, workerName) {
19124
- try {
19125
- const parsed = JSON.parse((0, import_node_fs12.readFileSync)(sdkWorkerFiles(stateRoot, workerName).session, "utf8"));
19126
- return parsed && parsed.schema_version === 1 ? parsed : null;
19127
- } catch {
19128
- return null;
19129
- }
19130
- }
19131
- function hostSpawnEnv(env) {
19132
- return Object.fromEntries(Object.entries(env).filter(([key]) => !isCredentialEnvKey(key)));
19133
- }
19134
- function hostCredentialHandoff(env) {
19135
- const out = {};
19136
- for (const [key, value] of isReplayEnv(env) ? [] : Object.entries(env)) {
19137
- const upper = key.toUpperCase();
19138
- if (HOST_CREDENTIAL_ENV.includes(upper) && value && !(upper in out)) out[upper] = value;
19139
- }
19140
- return `${JSON.stringify(out)}
19141
- `;
19142
- }
19143
- function spawnDetachedHost(cliPath, specPath, logPath, cwd, env = process.env) {
19144
- (0, import_node_fs12.mkdirSync)((0, import_node_path13.dirname)(logPath), { recursive: true });
19145
- const fd = (0, import_node_fs12.openSync)(logPath, "a");
19146
- try {
19147
- const child = (0, import_node_child_process6.spawn)(process.execPath, [cliPath, "team", "sdk-host", "--spec", specPath], {
19148
- cwd,
19149
- detached: true,
19150
- windowsHide: true,
19151
- stdio: ["pipe", fd, fd],
19152
- env: hostSpawnEnv(env)
19153
- });
19154
- child.stdin?.on("error", () => void 0);
19155
- child.stdin?.end(hostCredentialHandoff(env));
19156
- child.unref();
19157
- return child.pid;
19158
- } finally {
19159
- (0, import_node_fs12.closeSync)(fd);
19160
- }
19161
- }
19162
- async function launchSdkHost(input) {
19163
- const paneId = sdkPaneId(input.workerName);
19164
- const runtimeCliPath = resolveRuntimeCliPath();
19165
- const attempt = await prepareWorkerLaunchAttempt({
19166
- cwd: input.leaderCwd,
19167
- teamName: input.teamName,
19168
- workerName: input.workerName,
19169
- instanceId: input.instanceId,
19170
- paneId,
19171
- provider: "copilot",
19172
- runtimeCliPath,
19173
- context: { kind: "initial" }
19174
- });
19175
- const files = sdkWorkerFiles(input.stateRoot, input.workerName);
19176
- (0, import_node_fs12.mkdirSync)(files.dir, { recursive: true });
19177
- const cliPath = (0, import_node_path13.join)((0, import_node_path13.dirname)(runtimeCliPath), "cli.cjs");
19178
- const spec = {
19179
- schema_version: 1,
19180
- leader_cwd: input.leaderCwd,
19181
- team_name: input.teamName,
19182
- worker_name: input.workerName,
19183
- instance_id: input.instanceId,
19184
- attempt_id: attempt.attempt_id,
19185
- pane_id: paneId,
19186
- runtime_cli_path: runtimeCliPath,
19187
- worker_cwd: input.workerCwd,
19188
- state_root: input.stateRoot,
19189
- plugin_root: input.pluginRoot,
19190
- copilot_bin: input.copilotBin,
19191
- ...input.model ? { model: input.model } : {},
19192
- max_credits: input.maxCredits,
19193
- worker_env: { ...input.workerEnv, OMC_WORKER_LAUNCH_ATTEMPT_ID: attempt.attempt_id },
19194
- deny_tools: input.denyTools,
19195
- deny_urls: input.denyUrls,
19196
- mcp_server: input.mcpServer ?? "t",
19197
- omg_cli_path: cliPath,
19198
- node_path: process.execPath,
19199
- user_config_dir: input.userConfigDir,
19200
- ...input.inProcessTools ? { in_process_tools: true } : {}
19201
- };
19202
- (0, import_node_fs12.writeFileSync)(files.spec, `${JSON.stringify(spec, null, 2)}
19203
- `);
19204
- (0, import_node_fs12.writeFileSync)(files.doorbell, "");
19205
- const hostPid = (input.spawnHost ?? spawnDetachedHost)(cliPath, files.spec, files.log, input.workerCwd);
19206
- const kill = async () => {
19207
- if (hostPid && isProcessAlive(hostPid)) await killProcessTree(hostPid, "SIGKILL").catch(() => void 0);
19208
- };
19209
- const timeoutMs = input.ackTimeoutMs ?? 3e4;
19210
- const ack = await awaitWorkerLaunchAcknowledgement(attempt, { timeoutMs });
19211
- if (!ack.ok) {
19212
- await kill();
19213
- return { ok: false, attempt, reason: `sdk_host_ack_${ack.reason}`, ...hostPid ? { hostPid } : {} };
19214
- }
19215
- const startDeadline = Date.now() + timeoutMs;
19216
- for (; ; ) {
19217
- const sliceMs = Math.max(1, Math.min(1e3, startDeadline - Date.now()));
19218
- if (await awaitWorkerLaunchProviderStarted(attempt, { timeoutMs: sliceMs })) break;
19219
- const exited = (0, import_node_fs12.existsSync)(`${attempt.startedPath}.terminal`) || (0, import_node_fs12.existsSync)(`${attempt.decisionPath}.retired`) || hostPid !== void 0 && !isProcessAlive(hostPid);
19220
- if (exited || failedThisAttempt(attempt, input.stateRoot)) {
19221
- const graceUntil = Date.now() + SDK_LAUNCH_FAILURE_GRACE_MS;
19222
- while (!failedThisAttempt(attempt, input.stateRoot) && Date.now() < graceUntil) {
19223
- await new Promise((r) => setTimeout(r, SDK_LAUNCH_POLL_MS));
19224
- }
19225
- await kill();
19226
- const error = (failedThisAttempt(attempt, input.stateRoot) ? readSdkSession(input.stateRoot, input.workerName)?.last_error : null) ?? "unknown";
19227
- const phase = (0, import_node_fs12.existsSync)(attempt.startedPath) ? "at_start" : "before_start";
19228
- return { ok: false, attempt, reason: `sdk_host_failed_${phase}:${error}`, ...hostPid ? { hostPid } : {} };
19229
- }
19230
- if (Date.now() >= startDeadline) {
19231
- await kill();
19232
- return { ok: false, attempt, reason: "sdk_host_provider_not_started", ...hostPid ? { hostPid } : {} };
19233
- }
19234
- await new Promise((r) => setTimeout(r, SDK_LAUNCH_POLL_MS));
19235
- }
19236
- return { ok: true, attempt, hostPid, paneId };
19237
- }
19238
- async function isTargetGone(target) {
19239
- if (!target.identity) return !isProcessAlive(target.pid);
19240
- const liveness = await isProcessIdentityLive(target.pid, target.identity);
19241
- return liveness === "dead" || liveness === "mismatch";
19242
- }
19243
- function failedBeforeProviderStarted(attempt, stateRoot) {
19244
- return !(0, import_node_fs12.existsSync)(attempt.startedPath) && failedThisAttempt(attempt, stateRoot);
19245
- }
19246
- function failedThisAttempt(attempt, stateRoot) {
19247
- const session = readSdkSession(stateRoot, attempt.worker_name);
19248
- return session?.attempt_id === attempt.attempt_id && session.state === "failed";
19249
- }
19250
- async function stopSdkHost(attempt, stateRoot, opts = {}) {
19251
- const pollMs = opts.pollMs ?? 250;
19252
- const exited = async () => failedBeforeProviderStarted(attempt, stateRoot) || await observeWorkerLaunchProvider(attempt) === "dead";
19253
- if (await exited()) return true;
19254
- ringDoorbell(stateRoot, attempt.worker_name, { kind: opts.kind ?? "stop", from: "leader-fixed" });
19255
- const deadline = Date.now() + (opts.timeoutMs ?? 45e3);
19256
- while (Date.now() < deadline) {
19257
- if (await exited()) return true;
19258
- await new Promise((r) => setTimeout(r, pollMs));
19259
- }
19260
- const started = readStartedRecord(attempt);
19261
- const session = readSdkSession(stateRoot, attempt.worker_name);
19262
- const targets = [];
19263
- if (started) targets.push({ pid: started.pid, identity: started.process_start_identity });
19264
- if (session?.attempt_id === attempt.attempt_id && session.runtime_pid && session.runtime_pid > 0) {
19265
- targets.push({ pid: session.runtime_pid, identity: session.runtime_start_identity ?? null });
19266
- }
19267
- for (const target of targets) {
19268
- if (target.identity && await isProcessIdentityLive(target.pid, target.identity) === "live") {
19269
- await killProcessTree(target.pid, "SIGKILL").catch(() => void 0);
19270
- }
19271
- }
19272
- const killDeadline = Date.now() + 5e3;
19273
- for (; ; ) {
19274
- if ((await Promise.all(targets.map(isTargetGone))).every(Boolean)) {
19275
- if (started) writeTerminationComplete(attempt, started.pid, started.process_start_identity);
19276
- return true;
19277
- }
19278
- if (Date.now() >= killDeadline) return false;
19279
- await new Promise((r) => setTimeout(r, pollMs));
19280
- }
19281
- }
19282
- function readStartedRecord(attempt) {
19283
- try {
19284
- const record = JSON.parse((0, import_node_fs12.readFileSync)(attempt.startedPath, "utf8"));
19285
- return typeof record.pid === "number" && record.pid > 0 && typeof record.process_start_identity === "string" ? { pid: record.pid, process_start_identity: record.process_start_identity } : null;
19286
- } catch {
19287
- return null;
19288
- }
19289
- }
19290
- function writeTerminationComplete(attempt, pid, startIdentity) {
19291
- const path5 = `${attempt.startedPath}.termination-complete`;
19292
- if ((0, import_node_fs12.existsSync)(path5)) return;
19293
- try {
19294
- (0, import_node_fs12.writeFileSync)(path5, JSON.stringify({
19295
- schema_version: attempt.schema_version,
19296
- attempt_id: attempt.attempt_id,
19297
- nonce: attempt.nonce,
19298
- instance_id: attempt.instance_id,
19299
- team_name: attempt.team_name,
19300
- worker_name: attempt.worker_name,
19301
- pane_id: attempt.pane_id,
19302
- provider: attempt.provider,
19303
- created_at: attempt.created_at,
19304
- kind: "worker_launch_termination_complete",
19305
- cleanup_verified: true,
19306
- pid,
19307
- process_start_identity: startIdentity,
19308
- ...process.platform === "win32" ? {} : { process_group_id: pid },
19309
- written_at: (/* @__PURE__ */ new Date()).toISOString()
19310
- }), { flag: "wx" });
19311
- } catch {
19312
- }
19313
- }
19314
- var import_node_child_process6, import_node_crypto9, import_node_fs12, import_node_path13, SDK_TARGET_PREFIX, SDK_LAUNCH_POLL_MS, SDK_LAUNCH_FAILURE_GRACE_MS, HOST_CREDENTIAL_ENV, SDK_HOST_STOP_FLOOR_MS;
19315
- var init_sdk_transport = __esm({
19316
- "src/team/sdk-transport.ts"() {
19317
- "use strict";
19318
- import_node_child_process6 = require("node:child_process");
19319
- import_node_crypto9 = require("node:crypto");
19320
- import_node_fs12 = require("node:fs");
19321
- import_node_path13 = require("node:path");
19322
- init_process_utils();
19323
- init_copilot_session_env();
19324
- init_runtime_owner_client();
19325
- init_worker_launch_ack();
19326
- SDK_TARGET_PREFIX = "sdk:";
19327
- SDK_LAUNCH_POLL_MS = 25;
19328
- SDK_LAUNCH_FAILURE_GRACE_MS = 1500;
19329
- HOST_CREDENTIAL_ENV = ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"];
19330
- SDK_HOST_STOP_FLOOR_MS = 5e3;
19331
- }
19332
- });
19333
-
19334
19555
  // src/team/scaling.ts
19335
19556
  function scaleUpFenceBlocks(config) {
19336
19557
  const attempt = config.active_scale_up;
@@ -20067,7 +20288,8 @@ var init_config2 = __esm({
20067
20288
  "Base Branch Check",
20068
20289
  "Size Check",
20069
20290
  "Draft PR Check",
20070
- "omg update + session-start hook"
20291
+ "omg update + session-start hook",
20292
+ "Statechart suite (Node 24)"
20071
20293
  ],
20072
20294
  knownFlakyFile: ".github/known-flaky-tests.json",
20073
20295
  maxFixRounds: 2,
@@ -20137,6 +20359,8 @@ var init_sandbox = __esm({
20137
20359
  init_copilot_session_env();
20138
20360
  init_sdk_policy();
20139
20361
  init_jsonc();
20362
+ init_worktree_paths();
20363
+ init_paths();
20140
20364
  init_windows_search();
20141
20365
  DEFAULT_SANDBOX_SETTINGS = Object.freeze({
20142
20366
  enabled: true,
@@ -22701,6 +22925,37 @@ async function runBoundedLaunches(jobs, concurrency, launch, record) {
22701
22925
  for (const outcome of outcomes) if (outcome) record(outcome.value);
22702
22926
  return { errors };
22703
22927
  }
22928
+ function inspectLeaderCheckoutForWorktrees(cwd) {
22929
+ const run = (args) => (0, import_node_child_process8.execFileSync)("git", args, {
22930
+ cwd,
22931
+ encoding: "utf-8",
22932
+ stdio: ["ignore", "pipe", "ignore"],
22933
+ windowsHide: true
22934
+ });
22935
+ try {
22936
+ run(["rev-parse", "--verify", "HEAD"]);
22937
+ } catch {
22938
+ return "not_git";
22939
+ }
22940
+ try {
22941
+ const dirty = run(["status", "--porcelain"]).split("\n").filter((line) => line.trim() !== "" && !line.startsWith(`?? ${OmcPaths.ROOT}/`) && line !== `?? ${OmcPaths.ROOT}`);
22942
+ return dirty.length > 0 ? "dirty" : "ready";
22943
+ } catch {
22944
+ return "not_git";
22945
+ }
22946
+ }
22947
+ function resolveSdkDefaultWorktreeMode(input) {
22948
+ const explicitlySet = typeof input.explicit === "string" && input.explicit.trim() !== "";
22949
+ if (!input.sdk || explicitlySet || input.current !== "disabled") return { mode: input.current };
22950
+ const leader = input.leader();
22951
+ if (leader === "ready") {
22952
+ return { mode: "named", notice: "sdk workers use branch worktrees (set team.ops.worktreeMode to change)" };
22953
+ }
22954
+ if (leader === "dirty") {
22955
+ return { mode: "disabled", notice: "sdk workers share the leader checkout and commit on its branch: it has uncommitted changes (commit them for branch worktrees, or set team.ops.worktreeMode)" };
22956
+ }
22957
+ return { mode: "disabled" };
22958
+ }
22704
22959
  function resolveSdkTeamSettings(pluginCfg) {
22705
22960
  const sdk = pluginCfg.team?.sdk ?? {};
22706
22961
  const envNumber = (key) => {
@@ -22719,6 +22974,10 @@ function resolveSdkTeamSettings(pluginCfg) {
22719
22974
  if (configInProcess !== void 0 && typeof configInProcess !== "boolean") {
22720
22975
  throw new Error(`invalid_team_sdk_config:inProcessTools must be a boolean (got ${JSON.stringify(configInProcess)})`);
22721
22976
  }
22977
+ const configCompact = sdk.compactProtocol;
22978
+ if (configCompact !== void 0 && typeof configCompact !== "boolean") {
22979
+ throw new Error(`invalid_team_sdk_config:compactProtocol must be a boolean (got ${JSON.stringify(configCompact)})`);
22980
+ }
22722
22981
  const rawEnvInProcess = process.env.OMC_TEAM_SDK_INPROCESS_TOOLS?.trim().toLowerCase();
22723
22982
  const envInProcess = rawEnvInProcess === "1" || rawEnvInProcess === "true" ? "1" : rawEnvInProcess === "0" || rawEnvInProcess === "false" ? "0" : void 0;
22724
22983
  if (rawEnvInProcess && !envInProcess) {
@@ -22728,8 +22987,9 @@ function resolveSdkTeamSettings(pluginCfg) {
22728
22987
  const model = process.env.OMC_TEAM_SDK_MODEL?.trim() || sdk.model?.trim();
22729
22988
  return {
22730
22989
  inProcessTools: envInProcess === "1" ? true : envInProcess === "0" ? false : configInProcess ?? false,
22990
+ compactProtocol: configCompact ?? false,
22731
22991
  launchConcurrency: (envConcurrency !== void 0 ? Math.max(1, Math.floor(envConcurrency)) : void 0) ?? configConcurrency ?? DEFAULT_SDK_LAUNCH_CONCURRENCY,
22732
- maxCreditsPerWorker: envNumber("OMC_TEAM_SDK_MAX_CREDITS") ?? configCap ?? 10,
22992
+ maxCreditsPerWorker: envNumber("OMC_TEAM_SDK_MAX_CREDITS") ?? configCap ?? DEFAULT_SDK_MAX_CREDITS_PER_WORKER,
22733
22993
  ...model ? { model } : {},
22734
22994
  startupEvidenceMs: envNumber("OMC_TEAM_SDK_STARTUP_EVIDENCE_MS") ?? sdk.startupEvidenceMs ?? 18e4,
22735
22995
  denyTools: pluginCfg.permissions?.workerDenyTools ?? [],
@@ -22794,6 +23054,8 @@ async function spawnSdkV2Worker(opts, sdk) {
22794
23054
  };
22795
23055
  }
22796
23056
  const attempt = launch.attempt;
23057
+ const stopLaunchProgress = startSdkLaunchProgress(stateRoot, opts.workerName, (line) => process.stderr.write(`${line}
23058
+ `));
22797
23059
  const triggerMessage = `${generateTriggerMessage(opts.teamName, opts.workerName, workerInstructionStateRoot(opts.cwd, opts.teamName))} [launch:${attempt.attempt_id.slice(0, 12)}]`;
22798
23060
  const fenced = await withWorkerLaunchAttemptFence(attempt, () => queueInboxInstruction({
22799
23061
  teamName: opts.teamName,
@@ -22821,7 +23083,7 @@ async function spawnSdkV2Worker(opts, sdk) {
22821
23083
  return settled ? { ok: true, transport: "prompt_stdin", reason: "sdk_worker_startup_confirmed" } : { ok: false, transport: "prompt_stdin", reason: "copilot_sdk_startup_evidence_missing" };
22822
23084
  },
22823
23085
  deps: { writeWorkerInbox }
22824
- }));
23086
+ })).finally(stopLaunchProgress);
22825
23087
  const outcome = fenced.ok ? fenced.value : { ok: false, reason: "worker_launch_attempt_superseded" };
22826
23088
  if (!outcome.ok) {
22827
23089
  const session = readSdkSession(stateRoot, opts.workerName);
@@ -24930,7 +25192,6 @@ async function startTeamV2(config) {
24930
25192
  worktreeMode = "named";
24931
25193
  }
24932
25194
  }
24933
- const workspaceMode = worktreeMode === "disabled" ? "single" : "worktree";
24934
25195
  const agentTypes = config.agentTypes;
24935
25196
  const externalModelsDefaults = resolveExternalModelsDefaults(pluginCfg.externalModels?.defaults, process.env);
24936
25197
  const resolveDefaultModel = (agentType) => {
@@ -25009,6 +25270,16 @@ async function startTeamV2(config) {
25009
25270
  }
25010
25271
  const sdkMode = transportDecision.transport === "sdk";
25011
25272
  const sdkSettings = sdkMode ? resolveSdkTeamSettings(pluginCfg) : null;
25273
+ const sdkWorktreeDefault = resolveSdkDefaultWorktreeMode({
25274
+ sdk: sdkMode,
25275
+ explicit: process.env.OMC_TEAM_WORKTREE_MODE ?? pluginCfg.team?.ops?.worktreeMode,
25276
+ current: worktreeMode,
25277
+ leader: () => inspectLeaderCheckoutForWorktrees(leaderCwd)
25278
+ });
25279
+ if (sdkWorktreeDefault.notice) process.stderr.write(`[omg team] ${sdkWorktreeDefault.notice}
25280
+ `);
25281
+ worktreeMode = sdkWorktreeDefault.mode;
25282
+ const workspaceMode = worktreeMode === "disabled" ? "single" : "worktree";
25012
25283
  if (sdkMode) {
25013
25284
  for (const [workerName, role] of inferredContractRoles) {
25014
25285
  process.stderr.write(`[omg team] sdk transport: inferred role "${role}" for worker ${workerName} would require a verdict contract the sdk transport cannot process; running as a plain executor instead (an explicitly assigned contract role is still rejected)
@@ -25173,7 +25444,8 @@ async function startTeamV2(config) {
25173
25444
  cwd: leaderCwd,
25174
25445
  ...bootstrapInstructions ? { bootstrapInstructions } : {},
25175
25446
  instructionStateRoot: workerInstructionStateRoot(leaderCwd, sanitized),
25176
- ...prepared.role && shouldInjectContract(prepared.role, prepared.agentType) ? { reviewerRole: true } : {}
25447
+ ...prepared.role && shouldInjectContract(prepared.role, prepared.agentType) ? { reviewerRole: true } : {},
25448
+ ...sdkMode && sdkSettings?.compactProtocol ? { compactProtocol: true } : {}
25177
25449
  });
25178
25450
  const worktree = workerWorktrees.get(wName);
25179
25451
  if (worktree) {
@@ -25687,7 +25959,7 @@ async function processCliWorkerVerdictsUnderLock(teamName, cwd, expectedInstance
25687
25959
  ).catch(logCursorTransitionMarkerFailure);
25688
25960
  };
25689
25961
  const { rename: rename8 } = await import("fs/promises");
25690
- const { renameSync: renameSync5, readFileSync: readFileSync31, existsSync: fsExistsSync } = await import("fs");
25962
+ const { renameSync: renameSync5, readFileSync: readFileSync32, existsSync: fsExistsSync } = await import("fs");
25691
25963
  const { withFileLockSync: withFileLockSync2 } = await Promise.resolve().then(() => (init_file_lock(), file_lock_exports));
25692
25964
  const quarantineNonCursorVerdict = async (outputFile, artifactFingerprint, workerName, taskId, taskVersion, reason) => {
25693
25965
  const stalePath = nonCursorVerdictStalePath(outputFile, artifactFingerprint);
@@ -25768,7 +26040,7 @@ async function processCliWorkerVerdictsUnderLock(teamName, cwd, expectedInstance
25768
26040
  return;
25769
26041
  }
25770
26042
  }
25771
- const raw = readFileSync31(outputFile, "utf-8");
26043
+ const raw = readFileSync32(outputFile, "utf-8");
25772
26044
  parseCliWorkerVerdict(raw);
25773
26045
  renameSync5(outputFile, processingOutputFile);
25774
26046
  verdictFile = processingOutputFile;
@@ -26261,6 +26533,38 @@ Subagent skip reason: ${CURSOR_RUNTIME_POLICY_SKIP_REASON}` : cursorSummary;
26261
26533
  }
26262
26534
  return results;
26263
26535
  }
26536
+ async function terminalizeTaskForLeader(teamName, cwd, observed, status, error, metadata) {
26537
+ const lock = await withTaskClaimLock(teamName, observed.id, cwd, async () => {
26538
+ let current;
26539
+ try {
26540
+ current = await teamReadTask(teamName, observed.id, cwd);
26541
+ } catch {
26542
+ return null;
26543
+ }
26544
+ if (!current || (current.version ?? 1) !== (observed.version ?? 1)) return null;
26545
+ if (current.status !== "in_progress" || current.owner !== observed.owner) return null;
26546
+ const updated = normalizeTaskRecord({
26547
+ ...current,
26548
+ status,
26549
+ completed_at: (/* @__PURE__ */ new Date()).toISOString(),
26550
+ claim: void 0,
26551
+ version: (current.version ?? 1) + 1,
26552
+ error,
26553
+ metadata: { ...current.metadata ?? {}, ...metadata }
26554
+ });
26555
+ await writeAtomic2(absPath(cwd, TeamPaths.taskFile(teamName, observed.id)), JSON.stringify(updated, null, 2));
26556
+ return updated;
26557
+ });
26558
+ return lock.ok ? lock.value : null;
26559
+ }
26560
+ function resolveBlockerTimeoutMs(pluginCfg) {
26561
+ const value = pluginCfg.team?.sdk?.blockerTimeoutMinutes;
26562
+ if (value === void 0) return null;
26563
+ if (!(typeof value === "number" && Number.isFinite(value) && value > 0)) {
26564
+ throw new Error(`invalid_team_sdk_config:blockerTimeoutMinutes must be a positive number (got ${JSON.stringify(value)})`);
26565
+ }
26566
+ return value * 6e4;
26567
+ }
26264
26568
  async function monitorTeamV2(teamName, cwd, expectedInstanceId) {
26265
26569
  const monitorStartMs = import_perf_hooks.performance.now();
26266
26570
  const sanitized = sanitizeTeamName(teamName);
@@ -26400,8 +26704,30 @@ async function monitorTeamV2(teamName, cwd, expectedInstanceId) {
26400
26704
  nonReportingWorkers.push(w.name);
26401
26705
  if (stallReason === "sdk_credit_cap") {
26402
26706
  const cappedTasks = inProgressByOwner.get(w.name) ?? [];
26707
+ const salvageDir = w.worktree_path ?? w.working_dir ?? cwd;
26708
+ const salvage = `salvage: uncommitted work, if any, is in ${salvageDir}${w.worktree_branch ? ` (branch ${w.worktree_branch})` : ""}`;
26403
26709
  for (const t of cappedTasks) {
26404
- recommendations.push(`Reassign task-${t.id} from ${w.name}: sdk credit cap reached (${sdkSession?.last_error ?? "capped"}); the worker takes no more prompts`);
26710
+ let written = null;
26711
+ try {
26712
+ written = await terminalizeTaskForLeader(
26713
+ sanitized,
26714
+ cwd,
26715
+ t,
26716
+ "capped",
26717
+ `sdk_credit_cap (${sdkSession?.last_error ?? "capped"}); ${salvage}`,
26718
+ { capped_by: "monitor", capped_worker: w.name, salvage_path: salvageDir, ...w.worktree_branch ? { salvage_branch: w.worktree_branch } : {} }
26719
+ );
26720
+ } catch (err) {
26721
+ if (isTeamInstanceBoundaryError(err)) throw err;
26722
+ process.stderr.write(`[team/runtime-v2] capped transition for task-${t.id} failed: ${err instanceof Error ? err.message : String(err)}
26723
+ `);
26724
+ }
26725
+ if (written) {
26726
+ const index = allTasks.findIndex((task) => task.id === t.id);
26727
+ if (index >= 0) allTasks[index] = written;
26728
+ taskById.set(t.id, written);
26729
+ }
26730
+ recommendations.push(`Reassign task-${t.id} from ${w.name} or raise team.sdk.maxCreditsPerWorker: sdk credit cap reached (${sdkSession?.last_error ?? "capped"}); ${salvage}`);
26405
26731
  }
26406
26732
  if (cappedTasks.length === 0) {
26407
26733
  recommendations.push(`${w.name} reached its sdk credit cap and takes no more prompts; do not assign it new work`);
@@ -26419,13 +26745,52 @@ async function monitorTeamV2(teamName, cwd, expectedInstanceId) {
26419
26745
  }
26420
26746
  }
26421
26747
  }
26748
+ const leaderInbox = await readLeaderInbox((0, import_path48.dirname)(absPath(cwd, TeamPaths.mailbox(sanitized, "leader-fixed"))));
26749
+ if (leaderInbox.length > 0) {
26750
+ const sdkTeam = config.workers.some((worker) => worker.transport === "sdk" || isSdkTarget(worker.pane_id));
26751
+ let blockerTimeoutMs = null;
26752
+ try {
26753
+ if (sdkTeam) blockerTimeoutMs = resolveBlockerTimeoutMs(loadConfig());
26754
+ } catch (err) {
26755
+ process.stderr.write(`[team/runtime-v2] ${err instanceof Error ? err.message : String(err)}
26756
+ `);
26757
+ }
26758
+ const nowMs = Date.now();
26759
+ const timeoutMs = blockerTimeoutMs ?? Number.POSITIVE_INFINITY;
26760
+ for (const message of leaderInbox) {
26761
+ const ageMs = nowMs - Date.parse(message.created_at);
26762
+ if (!(ageMs > timeoutMs)) continue;
26763
+ for (const task of allTasks.filter((t) => t.status === "in_progress" && t.owner === message.from)) {
26764
+ let written = null;
26765
+ try {
26766
+ written = await terminalizeTaskForLeader(
26767
+ sanitized,
26768
+ cwd,
26769
+ task,
26770
+ "failed",
26771
+ `blocker_unanswered: no leader reply within ${Math.round(timeoutMs / 6e4)} min to ${message.from}: ${message.body.slice(0, 200)}`,
26772
+ { blocker_message_id: message.message_id, blocker_message_at: message.created_at, blocker_message: message.body }
26773
+ );
26774
+ } catch (err) {
26775
+ if (isTeamInstanceBoundaryError(err)) throw err;
26776
+ process.stderr.write(`[team/runtime-v2] blocker timeout for task-${task.id} failed: ${err instanceof Error ? err.message : String(err)}
26777
+ `);
26778
+ }
26779
+ if (written) {
26780
+ allTasks[allTasks.indexOf(task)] = written;
26781
+ recommendations.push(`task-${task.id} failed: ${message.from}'s message to the leader went unanswered past team.sdk.blockerTimeoutMinutes`);
26782
+ }
26783
+ }
26784
+ }
26785
+ }
26422
26786
  const taskCounts = {
26423
26787
  total: allTasks.length,
26424
26788
  pending: allTasks.filter((t) => t.status === "pending").length,
26425
26789
  blocked: allTasks.filter((t) => t.status === "blocked").length,
26426
26790
  in_progress: allTasks.filter((t) => t.status === "in_progress").length,
26427
26791
  completed: allTasks.filter((t) => t.status === "completed").length,
26428
- failed: allTasks.filter((t) => t.status === "failed").length
26792
+ failed: allTasks.filter((t) => t.status === "failed").length,
26793
+ capped: allTasks.filter((t) => t.status === "capped").length
26429
26794
  };
26430
26795
  const allTasksTerminal = taskCounts.pending === 0 && taskCounts.blocked === 0 && taskCounts.in_progress === 0;
26431
26796
  for (const task of allTasks) {
@@ -26437,10 +26802,11 @@ async function monitorTeamV2(teamName, cwd, expectedInstanceId) {
26437
26802
  `Investigate task-${task.id}: depends on missing task ids [${missingDependencyIds.join(", ")}]`
26438
26803
  );
26439
26804
  }
26440
- const phase = inferPhase(allTasks.map((t) => ({
26805
+ const inferredPhase = inferPhase(allTasks.map((t) => ({
26441
26806
  status: t.status,
26442
26807
  metadata: void 0
26443
26808
  })));
26809
+ const phase = allTasksTerminal && allTasks.length > 0 && inferredPhase === "executing" ? taskCounts.failed + taskCounts.capped > 0 ? "failed" : "completed" : inferredPhase;
26444
26810
  const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
26445
26811
  const totalMs = import_perf_hooks.performance.now() - monitorStartMs;
26446
26812
  await withTeamInstanceLifecycleLock(monitorInstance.cwd, monitorInstance.team_name, async () => {
@@ -26479,6 +26845,7 @@ async function monitorTeamV2(teamName, cwd, expectedInstanceId) {
26479
26845
  ...taskCounts,
26480
26846
  items: allTasks
26481
26847
  },
26848
+ leaderInbox,
26482
26849
  allTasksTerminal,
26483
26850
  deadWorkers,
26484
26851
  nonReportingWorkers,
@@ -26553,13 +26920,14 @@ async function shutdownTeamV2(teamName, cwd, options = {}) {
26553
26920
  in_progress: allTasks.filter((t) => t.status === "in_progress").length,
26554
26921
  completed: allTasks.filter((t) => t.status === "completed").length,
26555
26922
  failed: allTasks.filter((t) => t.status === "failed").length,
26923
+ capped: allTasks.filter((t) => t.status === "capped").length,
26556
26924
  allowed: false
26557
26925
  };
26558
- gate.allowed = gate.pending === 0 && gate.blocked === 0 && gate.in_progress === 0 && gate.failed === 0;
26926
+ gate.allowed = gate.pending === 0 && gate.blocked === 0 && gate.in_progress === 0;
26559
26927
  await appendTeamEvent(sanitized, {
26560
26928
  type: "shutdown_gate",
26561
26929
  worker: "leader-fixed",
26562
- reason: `allowed=${gate.allowed} total=${gate.total} pending=${gate.pending} blocked=${gate.blocked} in_progress=${gate.in_progress} completed=${gate.completed} failed=${gate.failed}${ralph ? " policy=ralph" : ""}`
26930
+ reason: `allowed=${gate.allowed} total=${gate.total} pending=${gate.pending} blocked=${gate.blocked} in_progress=${gate.in_progress} completed=${gate.completed} failed=${gate.failed} capped=${gate.capped}${ralph ? " policy=ralph" : ""}${gate.failed + gate.capped > 0 ? ` unfinished=${allTasks.filter((t) => t.status === "failed" || t.status === "capped").map((t) => `task-${t.id}:${t.status}`).join(",")}` : ""}`
26563
26931
  }, cwd).catch(logEventFailure);
26564
26932
  if (gate.allowed) return;
26565
26933
  const hasActiveWork = gate.pending > 0 || gate.blocked > 0 || gate.in_progress > 0;
@@ -27031,10 +27399,12 @@ If you accept, exit your session. If you reject, remain active for task work and
27031
27399
  await commitStoppedFenceUnderLock();
27032
27400
  let worktreeCleanupFailure = null;
27033
27401
  let preservedWorktrees = 0;
27402
+ let keptWorktrees = [];
27034
27403
  let retainedWorktrees = [];
27035
27404
  try {
27036
27405
  const worktreeCleanup = cleanupTeamWorktrees(sanitized, cwd);
27037
27406
  preservedWorktrees = worktreeCleanup.preserved.length;
27407
+ keptWorktrees = worktreeCleanup.preserved;
27038
27408
  retainedWorktrees = worktreeCleanup.retained;
27039
27409
  } catch (err) {
27040
27410
  preservedWorktrees = 1;
@@ -27048,7 +27418,12 @@ If you accept, exit your session. If you reject, remain active for task work and
27048
27418
  if (preservedWorktrees > 0) {
27049
27419
  process.stderr.write(`[team/runtime-v2] preserved ${preservedWorktrees} worktree(s); keeping team state for follow-up cleanup
27050
27420
  `);
27051
- return { outcome: "preserved", reason: "worktrees_preserved", workers: [] };
27421
+ return {
27422
+ outcome: "preserved",
27423
+ reason: "worktrees_preserved",
27424
+ workers: [...new Set(keptWorktrees.map((wt) => wt.workerName))],
27425
+ worktrees: keptWorktrees
27426
+ };
27052
27427
  }
27053
27428
  try {
27054
27429
  await disposeTeamInstanceUnderLock(
@@ -27071,7 +27446,7 @@ If you accept, exit your session. If you reject, remain active for task work and
27071
27446
  return retainedWorktrees.length > 0 ? { outcome: "cleaned", preservedWorktrees: retainedWorktrees } : { outcome: "cleaned" };
27072
27447
  });
27073
27448
  }
27074
- var import_path48, import_fs43, import_promises19, import_perf_hooks, import_node_child_process8, import_node_crypto11, orchestratorByTeam, cadenceByTeam, MONITOR_SIGNAL_STALE_MS, WORKER_STARTUP_EVIDENCE_POLL_INTERVAL_MS, WORKER_STARTUP_EVIDENCE_POLICIES, ENGAGED_PANE_RECHECK_TIMEOUT_ENV, MAX_ENGAGED_PANE_RECHECK_BUDGET_MS, CLAIM_ERROR_CAPTURE_MAX, CLAIM_ERROR_JSON_LINES_MAX, CLAIM_ERROR_LINE_MAX, CLAIM_ERROR_CODES, DEFAULT_SDK_LAUNCH_CONCURRENCY, pendingRecoveryPanes, BOOTSTRAP_RECOVERY_EVIDENCE_POLL_MS, BOOTSTRAP_RECOVERY_EVIDENCE_MAX_WAIT_MS, TEAM_INSTANCE_FINAL_DISPOSAL_AUTHORIZATION, CURSOR_RUNTIME_POLICY_SKIP_REASON, CURSOR_RUNTIME_POLICY_SKIP_PROVENANCE, CURSOR_DELEGATION_EVIDENCE_LINE;
27449
+ var import_path48, import_fs43, import_promises19, import_perf_hooks, import_node_child_process8, import_node_crypto11, orchestratorByTeam, cadenceByTeam, MONITOR_SIGNAL_STALE_MS, WORKER_STARTUP_EVIDENCE_POLL_INTERVAL_MS, WORKER_STARTUP_EVIDENCE_POLICIES, ENGAGED_PANE_RECHECK_TIMEOUT_ENV, MAX_ENGAGED_PANE_RECHECK_BUDGET_MS, CLAIM_ERROR_CAPTURE_MAX, CLAIM_ERROR_JSON_LINES_MAX, CLAIM_ERROR_LINE_MAX, CLAIM_ERROR_CODES, DEFAULT_SDK_LAUNCH_CONCURRENCY, DEFAULT_SDK_MAX_CREDITS_PER_WORKER, pendingRecoveryPanes, BOOTSTRAP_RECOVERY_EVIDENCE_POLL_MS, BOOTSTRAP_RECOVERY_EVIDENCE_MAX_WAIT_MS, TEAM_INSTANCE_FINAL_DISPOSAL_AUTHORIZATION, CURSOR_RUNTIME_POLICY_SKIP_REASON, CURSOR_RUNTIME_POLICY_SKIP_PROVENANCE, CURSOR_DELEGATION_EVIDENCE_LINE;
27075
27450
  var init_runtime_v2 = __esm({
27076
27451
  "src/team/runtime-v2.ts"() {
27077
27452
  "use strict";
@@ -27093,6 +27468,8 @@ var init_runtime_v2 = __esm({
27093
27468
  init_tmux_session();
27094
27469
  init_worker_bootstrap();
27095
27470
  init_mcp_comm();
27471
+ init_sdk_launch_progress();
27472
+ init_mailbox_outstanding();
27096
27473
  init_git_worktree();
27097
27474
  init_omc_cli_rendering();
27098
27475
  init_swallowed_error();
@@ -27190,6 +27567,7 @@ var init_runtime_v2 = __esm({
27190
27567
  "worker_not_found"
27191
27568
  ]);
27192
27569
  DEFAULT_SDK_LAUNCH_CONCURRENCY = 4;
27570
+ DEFAULT_SDK_MAX_CREDITS_PER_WORKER = 50;
27193
27571
  pendingRecoveryPanes = /* @__PURE__ */ new Map();
27194
27572
  BOOTSTRAP_RECOVERY_EVIDENCE_POLL_MS = 25;
27195
27573
  BOOTSTRAP_RECOVERY_EVIDENCE_MAX_WAIT_MS = 1e3;
@@ -27252,6 +27630,22 @@ function deriveTeamLeaderGuidance(input) {
27252
27630
  const aliveWorkers = Math.max(0, input.workers.alive);
27253
27631
  const idleWorkers = Math.max(0, input.workers.idle);
27254
27632
  const nonReportingWorkers = Math.max(0, input.workers.nonReporting);
27633
+ const cappedTasks = Math.max(0, input.tasks.capped ?? 0);
27634
+ const unreadLeaderMessages = Math.max(0, input.leaderInbox?.unread ?? 0);
27635
+ if (unreadLeaderMessages > 0 && activeTasks > 0) {
27636
+ return {
27637
+ nextAction: "answer-blocker",
27638
+ reason: `leader_inbox_unread:unread=${unreadLeaderMessages},active=${activeTasks}`,
27639
+ message: 'A worker is waiting for the leader. Read leader_inbox, then reply with `omg team api send-message --input \'{"team_name":"<team>","from_worker":"leader-fixed","to_worker":"<worker>","body":"<answer>"}\' --json`.'
27640
+ };
27641
+ }
27642
+ if (cappedTasks > 0) {
27643
+ return {
27644
+ nextAction: "reassign-capped",
27645
+ reason: `tasks_capped:capped=${cappedTasks},active=${activeTasks}`,
27646
+ message: "A worker hit its sdk credit cap and its task is `capped`; its uncommitted work stays where the task error says. Reassign the work (a new task or team), or raise team.sdk.maxCreditsPerWorker and relaunch. Shutdown is allowed once nothing is active."
27647
+ };
27648
+ }
27255
27649
  if (activeTasks === 0) {
27256
27650
  return {
27257
27651
  nextAction: "shutdown",
@@ -28713,7 +29107,7 @@ async function main() {
28713
29107
  } catch {
28714
29108
  }
28715
29109
  process.stderr.write(
28716
- `[runtime-cli/v2] phase=${snap.phase} pending=${snap.tasks.pending} blocked=${snap.tasks.blocked} in_progress=${snap.tasks.in_progress} completed=${snap.tasks.completed} failed=${snap.tasks.failed} dead=${snap.deadWorkers.length} totalMs=${snap.performance.total_ms}
29110
+ `[runtime-cli/v2] phase=${snap.phase} pending=${snap.tasks.pending} blocked=${snap.tasks.blocked} in_progress=${snap.tasks.in_progress} completed=${snap.tasks.completed} failed=${snap.tasks.failed} capped=${snap.tasks.capped} dead=${snap.deadWorkers.length} totalMs=${snap.performance.total_ms}
28717
29111
  `
28718
29112
  );
28719
29113
  const leaderGuidance = deriveTeamLeaderGuidance({
@@ -28722,14 +29116,16 @@ async function main() {
28722
29116
  blocked: snap.tasks.blocked,
28723
29117
  inProgress: snap.tasks.in_progress,
28724
29118
  completed: snap.tasks.completed,
28725
- failed: snap.tasks.failed
29119
+ failed: snap.tasks.failed,
29120
+ capped: snap.tasks.capped
28726
29121
  },
28727
29122
  workers: {
28728
29123
  total: snap.workers.length,
28729
29124
  alive: snap.workers.filter((worker) => worker.alive).length,
28730
29125
  idle: snap.workers.filter((worker) => worker.alive && (worker.status.state === "idle" || worker.status.state === "done")).length,
28731
29126
  nonReporting: snap.nonReportingWorkers.length
28732
- }
29127
+ },
29128
+ leaderInbox: { unread: snap.leaderInbox.length }
28733
29129
  });
28734
29130
  process.stderr.write(
28735
29131
  `[runtime-cli/v2] leader_next_action=${leaderGuidance.nextAction} reason=${leaderGuidance.reason}