oh-my-copilot 5.26.0 → 5.28.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 (779) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/agents/executor.md +1 -0
  4. package/bridge/claude-md-coordinator.cjs +2 -2
  5. package/bridge/cli.cjs +23572 -17129
  6. package/bridge/mcp-server.cjs +2721 -1497
  7. package/bridge/runtime-cli.cjs +4707 -1925
  8. package/bridge/team-mcp.cjs +2917 -816
  9. package/bridge/team.js +5397 -2381
  10. package/copilot/agents/executor.md +1 -0
  11. package/copilot/hooks.json +3 -3
  12. package/dist/__tests__/arguments-literal-substitution.test.d.ts +2 -0
  13. package/dist/__tests__/arguments-literal-substitution.test.d.ts.map +1 -0
  14. package/dist/__tests__/arguments-literal-substitution.test.js +34 -0
  15. package/dist/__tests__/arguments-literal-substitution.test.js.map +1 -0
  16. package/dist/__tests__/bridge-self-contained.test.d.ts +2 -0
  17. package/dist/__tests__/bridge-self-contained.test.d.ts.map +1 -0
  18. package/dist/__tests__/bridge-self-contained.test.js +44 -0
  19. package/dist/__tests__/bridge-self-contained.test.js.map +1 -0
  20. package/dist/__tests__/context-safety.test.js +1 -1
  21. package/dist/__tests__/context-safety.test.js.map +1 -1
  22. package/dist/__tests__/copilot-hook-dispatch.test.js +5 -1
  23. package/dist/__tests__/copilot-hook-dispatch.test.js.map +1 -1
  24. package/dist/__tests__/copilot-hooks-manifest.test.js +15 -1
  25. package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
  26. package/dist/__tests__/directory-context-injector-registration.test.js +5 -2
  27. package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -1
  28. package/dist/__tests__/doctor-conflicts.test.js +61 -0
  29. package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
  30. package/dist/__tests__/hook-command-normalizer.test.js +96 -58
  31. package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
  32. package/dist/__tests__/hooks/session-end-cleanup.test.js +87 -1
  33. package/dist/__tests__/hooks/session-end-cleanup.test.js.map +1 -1
  34. package/dist/__tests__/hooks-command-escaping.test.js +18 -16
  35. package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
  36. package/dist/__tests__/hud/omc-state.test.js +62 -1
  37. package/dist/__tests__/hud/omc-state.test.js.map +1 -1
  38. package/dist/__tests__/installer-mcp-config.test.js +39 -1
  39. package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
  40. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js +1 -1
  41. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js.map +1 -1
  42. package/dist/__tests__/keyword-detector-echo-guard.test.js +13 -1
  43. package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
  44. package/dist/__tests__/keyword-detector-script.test.js +201 -0
  45. package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
  46. package/dist/__tests__/npm-package-surface-helpers.d.ts.map +1 -1
  47. package/dist/__tests__/npm-package-surface-helpers.js +8 -4
  48. package/dist/__tests__/npm-package-surface-helpers.js.map +1 -1
  49. package/dist/__tests__/plugin-setup-deps.test.js +144 -71
  50. package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
  51. package/dist/__tests__/preemptive-compaction-hook.test.js +62 -5
  52. package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
  53. package/dist/__tests__/ralph-prd-mandatory.test.js +3 -0
  54. package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
  55. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts +10 -0
  56. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts.map +1 -0
  57. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js +241 -0
  58. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js.map +1 -0
  59. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts +9 -0
  60. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts.map +1 -0
  61. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js +162 -0
  62. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js.map +1 -0
  63. package/dist/__tests__/repair-plugin-cache-script.test.js +7 -1
  64. package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
  65. package/dist/__tests__/run-cjs-graceful-fallback.test.js +3 -2
  66. package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
  67. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +4 -1
  68. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
  69. package/dist/__tests__/setup-contracts-regression.test.js +13 -10
  70. package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
  71. package/dist/__tests__/skills.test.js +10 -9
  72. package/dist/__tests__/skills.test.js.map +1 -1
  73. package/dist/alias-retirement/__tests__/registry.test.js +2 -2
  74. package/dist/cli/__tests__/doctor-conflicts-json.test.js +2 -2
  75. package/dist/cli/__tests__/doctor-conflicts-json.test.js.map +1 -1
  76. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts +10 -0
  77. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts.map +1 -0
  78. package/dist/cli/__tests__/herdr-no-raw-calls.test.js +54 -0
  79. package/dist/cli/__tests__/herdr-no-raw-calls.test.js.map +1 -0
  80. package/dist/cli/__tests__/interop-herdr.test.d.ts +9 -0
  81. package/dist/cli/__tests__/interop-herdr.test.d.ts.map +1 -0
  82. package/dist/cli/__tests__/interop-herdr.test.js +138 -0
  83. package/dist/cli/__tests__/interop-herdr.test.js.map +1 -0
  84. package/dist/cli/__tests__/launch-herdr.test.d.ts +10 -0
  85. package/dist/cli/__tests__/launch-herdr.test.d.ts.map +1 -0
  86. package/dist/cli/__tests__/launch-herdr.test.js +141 -0
  87. package/dist/cli/__tests__/launch-herdr.test.js.map +1 -0
  88. package/dist/cli/__tests__/launch.test.js +140 -10
  89. package/dist/cli/__tests__/launch.test.js.map +1 -1
  90. package/dist/cli/__tests__/plugin-dir-capture.test.js +2 -0
  91. package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
  92. package/dist/cli/__tests__/ralph-afk.test.js +392 -2
  93. package/dist/cli/__tests__/ralph-afk.test.js.map +1 -1
  94. package/dist/cli/__tests__/ralph-closeout.test.d.ts +2 -0
  95. package/dist/cli/__tests__/ralph-closeout.test.d.ts.map +1 -0
  96. package/dist/cli/__tests__/ralph-closeout.test.js +156 -0
  97. package/dist/cli/__tests__/ralph-closeout.test.js.map +1 -0
  98. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts +2 -0
  99. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts.map +1 -0
  100. package/dist/cli/__tests__/subcommand-json-flag.test.js +86 -0
  101. package/dist/cli/__tests__/subcommand-json-flag.test.js.map +1 -0
  102. package/dist/cli/__tests__/team-resume-v2.test.js +46 -0
  103. package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -1
  104. package/dist/cli/__tests__/team.test.js +24 -0
  105. package/dist/cli/__tests__/team.test.js.map +1 -1
  106. package/dist/cli/__tests__/wait-teleport-json.test.js +2 -2
  107. package/dist/cli/__tests__/wait-teleport-json.test.js.map +1 -1
  108. package/dist/cli/commands/__tests__/factory-run-cli.test.js +20 -0
  109. package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
  110. package/dist/cli/commands/__tests__/release-cli.test.js +11 -0
  111. package/dist/cli/commands/__tests__/release-cli.test.js.map +1 -1
  112. package/dist/cli/commands/__tests__/ship-cli.test.js +1 -1
  113. package/dist/cli/commands/__tests__/ship-cli.test.js.map +1 -1
  114. package/dist/cli/commands/__tests__/teleport.test.js +42 -0
  115. package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
  116. package/dist/cli/commands/__tests__/wait.test.js +33 -1
  117. package/dist/cli/commands/__tests__/wait.test.js.map +1 -1
  118. package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
  119. package/dist/cli/commands/doctor-conflicts.js +6 -2
  120. package/dist/cli/commands/doctor-conflicts.js.map +1 -1
  121. package/dist/cli/commands/factory-bench.d.ts.map +1 -1
  122. package/dist/cli/commands/factory-bench.js +17 -3
  123. package/dist/cli/commands/factory-bench.js.map +1 -1
  124. package/dist/cli/commands/factory-dashboard.d.ts +5 -1
  125. package/dist/cli/commands/factory-dashboard.d.ts.map +1 -1
  126. package/dist/cli/commands/factory-dashboard.js +6 -2
  127. package/dist/cli/commands/factory-dashboard.js.map +1 -1
  128. package/dist/cli/commands/factory.d.ts +6 -0
  129. package/dist/cli/commands/factory.d.ts.map +1 -1
  130. package/dist/cli/commands/factory.js +45 -4
  131. package/dist/cli/commands/factory.js.map +1 -1
  132. package/dist/cli/commands/ralph.d.ts +36 -1
  133. package/dist/cli/commands/ralph.d.ts.map +1 -1
  134. package/dist/cli/commands/ralph.js +298 -50
  135. package/dist/cli/commands/ralph.js.map +1 -1
  136. package/dist/cli/commands/release.d.ts +3 -1
  137. package/dist/cli/commands/release.d.ts.map +1 -1
  138. package/dist/cli/commands/release.js +12 -3
  139. package/dist/cli/commands/release.js.map +1 -1
  140. package/dist/cli/commands/ship.d.ts.map +1 -1
  141. package/dist/cli/commands/ship.js +8 -4
  142. package/dist/cli/commands/ship.js.map +1 -1
  143. package/dist/cli/commands/team.d.ts.map +1 -1
  144. package/dist/cli/commands/team.js +2 -0
  145. package/dist/cli/commands/team.js.map +1 -1
  146. package/dist/cli/commands/teleport.d.ts.map +1 -1
  147. package/dist/cli/commands/teleport.js +6 -1
  148. package/dist/cli/commands/teleport.js.map +1 -1
  149. package/dist/cli/commands/wait.d.ts.map +1 -1
  150. package/dist/cli/commands/wait.js +3 -1
  151. package/dist/cli/commands/wait.js.map +1 -1
  152. package/dist/cli/index.js +8 -8
  153. package/dist/cli/index.js.map +1 -1
  154. package/dist/cli/interop.d.ts +4 -3
  155. package/dist/cli/interop.d.ts.map +1 -1
  156. package/dist/cli/interop.js +95 -4
  157. package/dist/cli/interop.js.map +1 -1
  158. package/dist/cli/launch.d.ts +17 -2
  159. package/dist/cli/launch.d.ts.map +1 -1
  160. package/dist/cli/launch.js +110 -12
  161. package/dist/cli/launch.js.map +1 -1
  162. package/dist/cli/team.d.ts.map +1 -1
  163. package/dist/cli/team.js +4 -1
  164. package/dist/cli/team.js.map +1 -1
  165. package/dist/commands/index.js +1 -1
  166. package/dist/commands/index.js.map +1 -1
  167. package/dist/config/loader.d.ts.map +1 -1
  168. package/dist/config/loader.js +17 -0
  169. package/dist/config/loader.js.map +1 -1
  170. package/dist/copilot-run/job.d.ts +2 -0
  171. package/dist/copilot-run/job.d.ts.map +1 -1
  172. package/dist/copilot-run/job.js +3 -0
  173. package/dist/copilot-run/job.js.map +1 -1
  174. package/dist/copilot-run/sandbox.d.ts +16 -0
  175. package/dist/copilot-run/sandbox.d.ts.map +1 -1
  176. package/dist/copilot-run/sandbox.js +29 -2
  177. package/dist/copilot-run/sandbox.js.map +1 -1
  178. package/dist/factory/bench/__tests__/bench.units.test.js +133 -1
  179. package/dist/factory/bench/__tests__/bench.units.test.js.map +1 -1
  180. package/dist/factory/bench/score.d.ts +33 -1
  181. package/dist/factory/bench/score.d.ts.map +1 -1
  182. package/dist/factory/bench/score.js +95 -5
  183. package/dist/factory/bench/score.js.map +1 -1
  184. package/dist/factory/board/__tests__/board.test.js +31 -1
  185. package/dist/factory/board/__tests__/board.test.js.map +1 -1
  186. package/dist/factory/board/collect.d.ts +5 -2
  187. package/dist/factory/board/collect.d.ts.map +1 -1
  188. package/dist/factory/board/collect.js +7 -2
  189. package/dist/factory/board/collect.js.map +1 -1
  190. package/dist/factory/check/cli.d.ts.map +1 -1
  191. package/dist/factory/check/cli.js +6 -2
  192. package/dist/factory/check/cli.js.map +1 -1
  193. package/dist/factory/dashboard/__tests__/dashboard.test.js +10 -0
  194. package/dist/factory/dashboard/__tests__/dashboard.test.js.map +1 -1
  195. package/dist/factory/run/__tests__/auto-merge.test.js +2 -0
  196. package/dist/factory/run/__tests__/auto-merge.test.js.map +1 -1
  197. package/dist/factory/run/__tests__/claims.test.js +15 -0
  198. package/dist/factory/run/__tests__/claims.test.js.map +1 -1
  199. package/dist/factory/run/__tests__/container-gate.test.js +59 -1
  200. package/dist/factory/run/__tests__/container-gate.test.js.map +1 -1
  201. package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -1
  202. package/dist/factory/run/__tests__/engine-local-harness.js +6 -0
  203. package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -1
  204. package/dist/factory/run/__tests__/engine-local-harness.test.d.ts +2 -0
  205. package/dist/factory/run/__tests__/engine-local-harness.test.d.ts.map +1 -0
  206. package/dist/factory/run/__tests__/engine-local-harness.test.js +23 -0
  207. package/dist/factory/run/__tests__/engine-local-harness.test.js.map +1 -0
  208. package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts +2 -0
  209. package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts.map +1 -0
  210. package/dist/factory/run/__tests__/engine.gates-git-transport.test.js +392 -0
  211. package/dist/factory/run/__tests__/engine.gates-git-transport.test.js.map +1 -0
  212. package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts +2 -0
  213. package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts.map +1 -0
  214. package/dist/factory/run/__tests__/engine.gates-test-delta.test.js +347 -0
  215. package/dist/factory/run/__tests__/engine.gates-test-delta.test.js.map +1 -0
  216. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts +2 -0
  217. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts.map +1 -0
  218. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js +235 -0
  219. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js.map +1 -0
  220. package/dist/factory/run/__tests__/engine.human-merged.test.d.ts +2 -0
  221. package/dist/factory/run/__tests__/engine.human-merged.test.d.ts.map +1 -0
  222. package/dist/factory/run/__tests__/engine.human-merged.test.js +171 -0
  223. package/dist/factory/run/__tests__/engine.human-merged.test.js.map +1 -0
  224. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts +2 -0
  225. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts.map +1 -0
  226. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js +56 -0
  227. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js.map +1 -0
  228. package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts +2 -0
  229. package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts.map +1 -0
  230. package/dist/factory/run/__tests__/engine.local.human-merged.test.js +48 -0
  231. package/dist/factory/run/__tests__/engine.local.human-merged.test.js.map +1 -0
  232. package/dist/factory/run/__tests__/engine.stall.test.d.ts +2 -0
  233. package/dist/factory/run/__tests__/engine.stall.test.d.ts.map +1 -0
  234. package/dist/factory/run/__tests__/engine.stall.test.js +137 -0
  235. package/dist/factory/run/__tests__/engine.stall.test.js.map +1 -0
  236. package/dist/factory/run/__tests__/fake-lanes.d.ts +6 -0
  237. package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
  238. package/dist/factory/run/__tests__/fake-lanes.js +17 -1
  239. package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
  240. package/dist/factory/run/__tests__/human-merged.test.d.ts +2 -0
  241. package/dist/factory/run/__tests__/human-merged.test.d.ts.map +1 -0
  242. package/dist/factory/run/__tests__/human-merged.test.js +301 -0
  243. package/dist/factory/run/__tests__/human-merged.test.js.map +1 -0
  244. package/dist/factory/run/__tests__/lane.test.js +2 -0
  245. package/dist/factory/run/__tests__/lane.test.js.map +1 -1
  246. package/dist/factory/run/__tests__/merge-policy.test.js +16 -0
  247. package/dist/factory/run/__tests__/merge-policy.test.js.map +1 -1
  248. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts +2 -0
  249. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts.map +1 -0
  250. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js +137 -0
  251. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js.map +1 -0
  252. package/dist/factory/run/__tests__/prepare-gates.crash.test.js +21 -0
  253. package/dist/factory/run/__tests__/prepare-gates.crash.test.js.map +1 -1
  254. package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js +11 -0
  255. package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js.map +1 -1
  256. package/dist/factory/run/__tests__/prepare-gates.test.js +39 -0
  257. package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
  258. package/dist/factory/run/__tests__/private-store.test.js +22 -1
  259. package/dist/factory/run/__tests__/private-store.test.js.map +1 -1
  260. package/dist/factory/run/__tests__/test-delta.test.d.ts +2 -0
  261. package/dist/factory/run/__tests__/test-delta.test.d.ts.map +1 -0
  262. package/dist/factory/run/__tests__/test-delta.test.js +239 -0
  263. package/dist/factory/run/__tests__/test-delta.test.js.map +1 -0
  264. package/dist/factory/run/__tests__/units.test.js +219 -2
  265. package/dist/factory/run/__tests__/units.test.js.map +1 -1
  266. package/dist/factory/run/__tests__/workspace-tree.test.js +16 -4
  267. package/dist/factory/run/__tests__/workspace-tree.test.js.map +1 -1
  268. package/dist/factory/run/auto-merge.d.ts +4 -0
  269. package/dist/factory/run/auto-merge.d.ts.map +1 -1
  270. package/dist/factory/run/auto-merge.js +3 -0
  271. package/dist/factory/run/auto-merge.js.map +1 -1
  272. package/dist/factory/run/budget.d.ts +6 -0
  273. package/dist/factory/run/budget.d.ts.map +1 -1
  274. package/dist/factory/run/budget.js +5 -0
  275. package/dist/factory/run/budget.js.map +1 -1
  276. package/dist/factory/run/claims.d.ts.map +1 -1
  277. package/dist/factory/run/claims.js +5 -3
  278. package/dist/factory/run/claims.js.map +1 -1
  279. package/dist/factory/run/container-gate.d.ts +14 -1
  280. package/dist/factory/run/container-gate.d.ts.map +1 -1
  281. package/dist/factory/run/container-gate.js +42 -4
  282. package/dist/factory/run/container-gate.js.map +1 -1
  283. package/dist/factory/run/engine.d.ts +46 -1
  284. package/dist/factory/run/engine.d.ts.map +1 -1
  285. package/dist/factory/run/engine.js +779 -68
  286. package/dist/factory/run/engine.js.map +1 -1
  287. package/dist/factory/run/human-merged.d.ts +105 -0
  288. package/dist/factory/run/human-merged.d.ts.map +1 -0
  289. package/dist/factory/run/human-merged.js +256 -0
  290. package/dist/factory/run/human-merged.js.map +1 -0
  291. package/dist/factory/run/lane.d.ts +2 -0
  292. package/dist/factory/run/lane.d.ts.map +1 -1
  293. package/dist/factory/run/lane.js +1 -0
  294. package/dist/factory/run/lane.js.map +1 -1
  295. package/dist/factory/run/merge-policy.d.ts +1 -2
  296. package/dist/factory/run/merge-policy.d.ts.map +1 -1
  297. package/dist/factory/run/merge-policy.js +5 -12
  298. package/dist/factory/run/merge-policy.js.map +1 -1
  299. package/dist/factory/run/prepare.d.ts +40 -1
  300. package/dist/factory/run/prepare.d.ts.map +1 -1
  301. package/dist/factory/run/prepare.js +240 -38
  302. package/dist/factory/run/prepare.js.map +1 -1
  303. package/dist/factory/run/private-run.d.ts +2 -1
  304. package/dist/factory/run/private-run.d.ts.map +1 -1
  305. package/dist/factory/run/private-run.js +5 -2
  306. package/dist/factory/run/private-run.js.map +1 -1
  307. package/dist/factory/run/prompts.d.ts +2 -2
  308. package/dist/factory/run/prompts.d.ts.map +1 -1
  309. package/dist/factory/run/prompts.js +7 -6
  310. package/dist/factory/run/prompts.js.map +1 -1
  311. package/dist/factory/run/sandbox-exec.d.ts +9 -1
  312. package/dist/factory/run/sandbox-exec.d.ts.map +1 -1
  313. package/dist/factory/run/sandbox-exec.js.map +1 -1
  314. package/dist/factory/run/state.d.ts +54 -1
  315. package/dist/factory/run/state.d.ts.map +1 -1
  316. package/dist/factory/run/state.js +23 -2
  317. package/dist/factory/run/state.js.map +1 -1
  318. package/dist/factory/run/test-delta.d.ts +123 -0
  319. package/dist/factory/run/test-delta.d.ts.map +1 -0
  320. package/dist/factory/run/test-delta.js +236 -0
  321. package/dist/factory/run/test-delta.js.map +1 -0
  322. package/dist/features/__tests__/checkpoint.test.js +118 -1
  323. package/dist/features/__tests__/checkpoint.test.js.map +1 -1
  324. package/dist/features/__tests__/jev-model-routing.test.js +20 -2
  325. package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
  326. package/dist/features/__tests__/jev-slop-warning.test.js +22 -2
  327. package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -1
  328. package/dist/features/checkpoint/index.d.ts.map +1 -1
  329. package/dist/features/checkpoint/index.js +25 -8
  330. package/dist/features/checkpoint/index.js.map +1 -1
  331. package/dist/features/jev-slop-warning.d.ts +3 -2
  332. package/dist/features/jev-slop-warning.d.ts.map +1 -1
  333. package/dist/features/jev-slop-warning.js +5 -3
  334. package/dist/features/jev-slop-warning.js.map +1 -1
  335. package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
  336. package/dist/features/rate-limit-wait/daemon.js +55 -9
  337. package/dist/features/rate-limit-wait/daemon.js.map +1 -1
  338. package/dist/features/rate-limit-wait/tmux-detector.d.ts +33 -0
  339. package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
  340. package/dist/features/rate-limit-wait/tmux-detector.js +156 -0
  341. package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
  342. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +4 -2
  343. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
  344. package/dist/forge/ado/__tests__/adapter.test.js +7 -0
  345. package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
  346. package/dist/forge/ado/reviews.d.ts.map +1 -1
  347. package/dist/forge/ado/reviews.js +6 -0
  348. package/dist/forge/ado/reviews.js.map +1 -1
  349. package/dist/forge/github/__tests__/mergeability.test.d.ts +2 -0
  350. package/dist/forge/github/__tests__/mergeability.test.d.ts.map +1 -0
  351. package/dist/forge/github/__tests__/mergeability.test.js +34 -0
  352. package/dist/forge/github/__tests__/mergeability.test.js.map +1 -0
  353. package/dist/forge/github/reviews.d.ts +7 -1
  354. package/dist/forge/github/reviews.d.ts.map +1 -1
  355. package/dist/forge/github/reviews.js +13 -0
  356. package/dist/forge/github/reviews.js.map +1 -1
  357. package/dist/forge/local/__tests__/mirror.test.js +3 -1
  358. package/dist/forge/local/__tests__/mirror.test.js.map +1 -1
  359. package/dist/forge/local/__tests__/reviews.test.js +19 -0
  360. package/dist/forge/local/__tests__/reviews.test.js.map +1 -1
  361. package/dist/forge/local/mirror.d.ts +2 -0
  362. package/dist/forge/local/mirror.d.ts.map +1 -1
  363. package/dist/forge/local/mirror.js +2 -0
  364. package/dist/forge/local/mirror.js.map +1 -1
  365. package/dist/forge/local/reviews.d.ts.map +1 -1
  366. package/dist/forge/local/reviews.js +12 -1
  367. package/dist/forge/local/reviews.js.map +1 -1
  368. package/dist/forge/types.d.ts +13 -0
  369. package/dist/forge/types.d.ts.map +1 -1
  370. package/dist/graph/schema.d.ts +10 -10
  371. package/dist/hooks/__tests__/precompact-restore.test.js +38 -0
  372. package/dist/hooks/__tests__/precompact-restore.test.js.map +1 -1
  373. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +7 -2
  374. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
  375. package/dist/hooks/auto-slash-command/executor.js +1 -1
  376. package/dist/hooks/auto-slash-command/executor.js.map +1 -1
  377. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +24 -2
  378. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -1
  379. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
  380. package/dist/hooks/code-simplifier/jev-shadow.js +6 -4
  381. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
  382. package/dist/hooks/jev/__tests__/client.test.js +20 -1
  383. package/dist/hooks/jev/__tests__/client.test.js.map +1 -1
  384. package/dist/hooks/jev/__tests__/log-context.test.d.ts +2 -0
  385. package/dist/hooks/jev/__tests__/log-context.test.d.ts.map +1 -0
  386. package/dist/hooks/jev/__tests__/log-context.test.js +97 -0
  387. package/dist/hooks/jev/__tests__/log-context.test.js.map +1 -0
  388. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts +2 -0
  389. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts.map +1 -0
  390. package/dist/hooks/jev/__tests__/log-rotation.test.js +148 -0
  391. package/dist/hooks/jev/__tests__/log-rotation.test.js.map +1 -0
  392. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts +2 -0
  393. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts.map +1 -0
  394. package/dist/hooks/jev/__tests__/resolver-request-count.test.js +117 -0
  395. package/dist/hooks/jev/__tests__/resolver-request-count.test.js.map +1 -0
  396. package/dist/hooks/jev/__tests__/resolver.test.js +63 -1
  397. package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
  398. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts +2 -0
  399. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts.map +1 -0
  400. package/dist/hooks/jev/__tests__/shared-breaker.test.js +294 -0
  401. package/dist/hooks/jev/__tests__/shared-breaker.test.js.map +1 -0
  402. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts +2 -0
  403. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts.map +1 -0
  404. package/dist/hooks/jev/__tests__/state-omit-ids.test.js +88 -0
  405. package/dist/hooks/jev/__tests__/state-omit-ids.test.js.map +1 -0
  406. package/dist/hooks/jev/client.d.ts +34 -2
  407. package/dist/hooks/jev/client.d.ts.map +1 -1
  408. package/dist/hooks/jev/client.js +80 -5
  409. package/dist/hooks/jev/client.js.map +1 -1
  410. package/dist/hooks/jev/config.d.ts +78 -4
  411. package/dist/hooks/jev/config.d.ts.map +1 -1
  412. package/dist/hooks/jev/config.js +123 -9
  413. package/dist/hooks/jev/config.js.map +1 -1
  414. package/dist/hooks/jev/points.d.ts +2 -0
  415. package/dist/hooks/jev/points.d.ts.map +1 -1
  416. package/dist/hooks/jev/points.js +41 -10
  417. package/dist/hooks/jev/points.js.map +1 -1
  418. package/dist/hooks/jev/resolver.d.ts +27 -2
  419. package/dist/hooks/jev/resolver.d.ts.map +1 -1
  420. package/dist/hooks/jev/resolver.js +176 -20
  421. package/dist/hooks/jev/resolver.js.map +1 -1
  422. package/dist/hooks/jev/types.d.ts +21 -4
  423. package/dist/hooks/jev/types.d.ts.map +1 -1
  424. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts +2 -0
  425. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts.map +1 -0
  426. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js +209 -0
  427. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js.map +1 -0
  428. package/dist/hooks/keyword-detector/__tests__/index.test.js +6 -1
  429. package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
  430. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +15 -0
  431. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
  432. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  433. package/dist/hooks/keyword-detector/index.js +200 -2
  434. package/dist/hooks/keyword-detector/index.js.map +1 -1
  435. package/dist/hooks/keyword-detector/jev-shadow.js +3 -3
  436. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
  437. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +20 -1
  438. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
  439. package/dist/hooks/learner/jev-shadow.js +3 -3
  440. package/dist/hooks/learner/jev-shadow.js.map +1 -1
  441. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts +2 -0
  442. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts.map +1 -0
  443. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js +280 -0
  444. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js.map +1 -0
  445. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js +2 -2
  446. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js.map +1 -1
  447. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +47 -1
  448. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
  449. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  450. package/dist/hooks/persistent-mode/index.js +136 -40
  451. package/dist/hooks/persistent-mode/index.js.map +1 -1
  452. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
  453. package/dist/hooks/persistent-mode/jev-shadow.js +11 -7
  454. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
  455. package/dist/hooks/pre-compact/index.d.ts.map +1 -1
  456. package/dist/hooks/pre-compact/index.js +8 -5
  457. package/dist/hooks/pre-compact/index.js.map +1 -1
  458. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts +11 -0
  459. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts.map +1 -0
  460. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js +227 -0
  461. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js.map +1 -0
  462. package/dist/hooks/project-memory/index.d.ts.map +1 -1
  463. package/dist/hooks/project-memory/index.js +26 -6
  464. package/dist/hooks/project-memory/index.js.map +1 -1
  465. package/dist/hooks/ralph/__tests__/closeout.test.d.ts +2 -0
  466. package/dist/hooks/ralph/__tests__/closeout.test.d.ts.map +1 -0
  467. package/dist/hooks/ralph/__tests__/closeout.test.js +82 -0
  468. package/dist/hooks/ralph/__tests__/closeout.test.js.map +1 -0
  469. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +572 -4
  470. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
  471. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +23 -2
  472. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -1
  473. package/dist/hooks/ralph/closeout.d.ts +34 -0
  474. package/dist/hooks/ralph/closeout.d.ts.map +1 -0
  475. package/dist/hooks/ralph/closeout.js +66 -0
  476. package/dist/hooks/ralph/closeout.js.map +1 -0
  477. package/dist/hooks/ralph/feedback-baseline.d.ts +60 -6
  478. package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
  479. package/dist/hooks/ralph/feedback-baseline.js +302 -15
  480. package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
  481. package/dist/hooks/ralph/index.d.ts +1 -1
  482. package/dist/hooks/ralph/index.d.ts.map +1 -1
  483. package/dist/hooks/ralph/index.js +1 -1
  484. package/dist/hooks/ralph/index.js.map +1 -1
  485. package/dist/hooks/ralph/jev-shadow.js +3 -3
  486. package/dist/hooks/ralph/jev-shadow.js.map +1 -1
  487. package/dist/hooks/ralph/verifier.d.ts +5 -0
  488. package/dist/hooks/ralph/verifier.d.ts.map +1 -1
  489. package/dist/hooks/ralph/verifier.js +21 -10
  490. package/dist/hooks/ralph/verifier.js.map +1 -1
  491. package/dist/hooks/registry/__tests__/registry.test.js +6 -0
  492. package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
  493. package/dist/hooks/registry/registry.d.ts +6 -2
  494. package/dist/hooks/registry/registry.d.ts.map +1 -1
  495. package/dist/hooks/registry/registry.js +21 -6
  496. package/dist/hooks/registry/registry.js.map +1 -1
  497. package/dist/hooks/registry/types.d.ts +2 -0
  498. package/dist/hooks/registry/types.d.ts.map +1 -1
  499. package/dist/hooks/session-end/__tests__/callbacks.test.js +10 -1
  500. package/dist/hooks/session-end/__tests__/callbacks.test.js.map +1 -1
  501. package/dist/hooks/session-end/__tests__/worker.test.js +111 -2
  502. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  503. package/dist/hooks/session-end/callbacks.js +1 -1
  504. package/dist/hooks/session-end/callbacks.js.map +1 -1
  505. package/dist/hooks/session-end/cleanup-manifest.d.ts +2 -0
  506. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  507. package/dist/hooks/session-end/cleanup-manifest.js +8 -0
  508. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  509. package/dist/hooks/session-end/index.d.ts.map +1 -1
  510. package/dist/hooks/session-end/index.js +21 -3
  511. package/dist/hooks/session-end/index.js.map +1 -1
  512. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  513. package/dist/hooks/session-end/worker.js +32 -2
  514. package/dist/hooks/session-end/worker.js.map +1 -1
  515. package/dist/hooks/setup/__tests__/windows-patch.test.js +89 -17
  516. package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
  517. package/dist/hooks/setup/index.d.ts +10 -21
  518. package/dist/hooks/setup/index.d.ts.map +1 -1
  519. package/dist/hooks/setup/index.js +14 -48
  520. package/dist/hooks/setup/index.js.map +1 -1
  521. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +2 -1
  522. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
  523. package/dist/hud/omc-state.d.ts +8 -0
  524. package/dist/hud/omc-state.d.ts.map +1 -1
  525. package/dist/hud/omc-state.js +23 -2
  526. package/dist/hud/omc-state.js.map +1 -1
  527. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts +2 -0
  528. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts.map +1 -0
  529. package/dist/installer/__tests__/claude-mcp-config-path.test.js +323 -0
  530. package/dist/installer/__tests__/claude-mcp-config-path.test.js.map +1 -0
  531. package/dist/installer/__tests__/mcp-registry.test.js +81 -3
  532. package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
  533. package/dist/installer/__tests__/standalone-hook-reconcile.test.js +36 -0
  534. package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
  535. package/dist/installer/index.d.ts.map +1 -1
  536. package/dist/installer/index.js +16 -4
  537. package/dist/installer/index.js.map +1 -1
  538. package/dist/installer/mcp-registry.d.ts +21 -1
  539. package/dist/installer/mcp-registry.d.ts.map +1 -1
  540. package/dist/installer/mcp-registry.js +101 -20
  541. package/dist/installer/mcp-registry.js.map +1 -1
  542. package/dist/lib/atomic-write.d.ts.map +1 -1
  543. package/dist/lib/atomic-write.js +61 -2
  544. package/dist/lib/atomic-write.js.map +1 -1
  545. package/dist/lib/one-line.d.ts +3 -0
  546. package/dist/lib/one-line.d.ts.map +1 -0
  547. package/dist/lib/one-line.js +5 -0
  548. package/dist/lib/one-line.js.map +1 -0
  549. package/dist/mcp/__tests__/team-cleanup.test.js +13 -0
  550. package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
  551. package/dist/mcp/team-job-convergence.d.ts.map +1 -1
  552. package/dist/mcp/team-job-convergence.js +4 -1
  553. package/dist/mcp/team-job-convergence.js.map +1 -1
  554. package/dist/mcp/team-server.js +2 -2
  555. package/dist/mcp/team-server.js.map +1 -1
  556. package/dist/notifications/__tests__/approval-reply.test.js +8 -0
  557. package/dist/notifications/__tests__/approval-reply.test.js.map +1 -1
  558. package/dist/notifications/__tests__/reply-herdr.test.d.ts +8 -0
  559. package/dist/notifications/__tests__/reply-herdr.test.d.ts.map +1 -0
  560. package/dist/notifications/__tests__/reply-herdr.test.js +125 -0
  561. package/dist/notifications/__tests__/reply-herdr.test.js.map +1 -0
  562. package/dist/notifications/__tests__/tmux.test.js +56 -1
  563. package/dist/notifications/__tests__/tmux.test.js.map +1 -1
  564. package/dist/notifications/index.d.ts +1 -1
  565. package/dist/notifications/index.d.ts.map +1 -1
  566. package/dist/notifications/index.js +22 -7
  567. package/dist/notifications/index.js.map +1 -1
  568. package/dist/notifications/reply-listener.d.ts +28 -12
  569. package/dist/notifications/reply-listener.d.ts.map +1 -1
  570. package/dist/notifications/reply-listener.js +326 -172
  571. package/dist/notifications/reply-listener.js.map +1 -1
  572. package/dist/notifications/tmux.d.ts +22 -2
  573. package/dist/notifications/tmux.d.ts.map +1 -1
  574. package/dist/notifications/tmux.js +57 -2
  575. package/dist/notifications/tmux.js.map +1 -1
  576. package/dist/release/__tests__/engine.test.js +74 -2
  577. package/dist/release/__tests__/engine.test.js.map +1 -1
  578. package/dist/release/engine.d.ts +9 -1
  579. package/dist/release/engine.d.ts.map +1 -1
  580. package/dist/release/engine.js +41 -4
  581. package/dist/release/engine.js.map +1 -1
  582. package/dist/shared/types.d.ts +5 -0
  583. package/dist/shared/types.d.ts.map +1 -1
  584. package/dist/ship/__tests__/check-name.test.d.ts +2 -0
  585. package/dist/ship/__tests__/check-name.test.d.ts.map +1 -0
  586. package/dist/ship/__tests__/check-name.test.js +17 -0
  587. package/dist/ship/__tests__/check-name.test.js.map +1 -0
  588. package/dist/ship/__tests__/gates-settle.test.js +13 -1
  589. package/dist/ship/__tests__/gates-settle.test.js.map +1 -1
  590. package/dist/ship/__tests__/prepare-build.test.d.ts +2 -0
  591. package/dist/ship/__tests__/prepare-build.test.d.ts.map +1 -0
  592. package/dist/ship/__tests__/prepare-build.test.js +287 -0
  593. package/dist/ship/__tests__/prepare-build.test.js.map +1 -0
  594. package/dist/ship/__tests__/prepare-merge.test.js +8 -1
  595. package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
  596. package/dist/ship/__tests__/safety-state.test.js +4 -0
  597. package/dist/ship/__tests__/safety-state.test.js.map +1 -1
  598. package/dist/ship/check-name.d.ts +12 -0
  599. package/dist/ship/check-name.d.ts.map +1 -0
  600. package/dist/ship/check-name.js +13 -0
  601. package/dist/ship/check-name.js.map +1 -0
  602. package/dist/ship/config.d.ts +13 -0
  603. package/dist/ship/config.d.ts.map +1 -1
  604. package/dist/ship/config.js +18 -1
  605. package/dist/ship/config.js.map +1 -1
  606. package/dist/ship/exec.d.ts +8 -0
  607. package/dist/ship/exec.d.ts.map +1 -1
  608. package/dist/ship/exec.js +33 -5
  609. package/dist/ship/exec.js.map +1 -1
  610. package/dist/ship/gates.d.ts.map +1 -1
  611. package/dist/ship/gates.js +3 -2
  612. package/dist/ship/gates.js.map +1 -1
  613. package/dist/ship/merge.d.ts +11 -2
  614. package/dist/ship/merge.d.ts.map +1 -1
  615. package/dist/ship/merge.js +55 -10
  616. package/dist/ship/merge.js.map +1 -1
  617. package/dist/ship/prepare.d.ts +16 -4
  618. package/dist/ship/prepare.d.ts.map +1 -1
  619. package/dist/ship/prepare.js +108 -2
  620. package/dist/ship/prepare.js.map +1 -1
  621. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +9 -0
  622. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
  623. package/dist/team/__tests__/herdr-session-realherdr.test.js +140 -0
  624. package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
  625. package/dist/team/__tests__/herdr-session.test.d.ts +9 -0
  626. package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
  627. package/dist/team/__tests__/herdr-session.test.js +270 -0
  628. package/dist/team/__tests__/herdr-session.test.js.map +1 -0
  629. package/dist/team/__tests__/idle-nudge.test.js +17 -0
  630. package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
  631. package/dist/team/__tests__/mailbox-notification-guard.test.js +403 -181
  632. package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
  633. package/dist/team/__tests__/scaling-launch-config.test.js +12 -0
  634. package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
  635. package/dist/team/__tests__/scaling.test.js +12 -0
  636. package/dist/team/__tests__/scaling.test.js.map +1 -1
  637. package/dist/team/__tests__/task-claim-renewal.test.d.ts +2 -0
  638. package/dist/team/__tests__/task-claim-renewal.test.d.ts.map +1 -0
  639. package/dist/team/__tests__/task-claim-renewal.test.js +421 -0
  640. package/dist/team/__tests__/task-claim-renewal.test.js.map +1 -0
  641. package/dist/team/__tests__/task-storage-integrity.test.js +34 -0
  642. package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -1
  643. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts +11 -0
  644. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts.map +1 -0
  645. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js +99 -0
  646. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js.map +1 -0
  647. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts +10 -0
  648. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts.map +1 -0
  649. package/dist/team/__tests__/tmux-session.herdr-arms.test.js +226 -0
  650. package/dist/team/__tests__/tmux-session.herdr-arms.test.js.map +1 -0
  651. package/dist/team/__tests__/tmux-session.test.js +888 -721
  652. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  653. package/dist/team/__tests__/worker-bootstrap.test.js +19 -0
  654. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  655. package/dist/team/api-interop.d.ts +1 -1
  656. package/dist/team/api-interop.d.ts.map +1 -1
  657. package/dist/team/api-interop.js +13 -1
  658. package/dist/team/api-interop.js.map +1 -1
  659. package/dist/team/herdr-session.d.ts +267 -0
  660. package/dist/team/herdr-session.d.ts.map +1 -0
  661. package/dist/team/herdr-session.js +508 -0
  662. package/dist/team/herdr-session.js.map +1 -0
  663. package/dist/team/idle-nudge.d.ts +1 -1
  664. package/dist/team/idle-nudge.d.ts.map +1 -1
  665. package/dist/team/idle-nudge.js +4 -4
  666. package/dist/team/idle-nudge.js.map +1 -1
  667. package/dist/team/mailbox-notification-guard.d.ts +24 -19
  668. package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
  669. package/dist/team/mailbox-notification-guard.js +241 -148
  670. package/dist/team/mailbox-notification-guard.js.map +1 -1
  671. package/dist/team/model-contract.d.ts.map +1 -1
  672. package/dist/team/model-contract.js +1 -0
  673. package/dist/team/model-contract.js.map +1 -1
  674. package/dist/team/runtime-v2.d.ts +33 -33
  675. package/dist/team/runtime-v2.d.ts.map +1 -1
  676. package/dist/team/runtime-v2.js +2810 -1591
  677. package/dist/team/runtime-v2.js.map +1 -1
  678. package/dist/team/scaling.d.ts +3 -3
  679. package/dist/team/scaling.d.ts.map +1 -1
  680. package/dist/team/scaling.js +766 -402
  681. package/dist/team/scaling.js.map +1 -1
  682. package/dist/team/state/tasks.d.ts +15 -1
  683. package/dist/team/state/tasks.d.ts.map +1 -1
  684. package/dist/team/state/tasks.js +56 -2
  685. package/dist/team/state/tasks.js.map +1 -1
  686. package/dist/team/team-ops.d.ts +3 -2
  687. package/dist/team/team-ops.d.ts.map +1 -1
  688. package/dist/team/team-ops.js +32 -5
  689. package/dist/team/team-ops.js.map +1 -1
  690. package/dist/team/tmux-session.d.ts +66 -40
  691. package/dist/team/tmux-session.d.ts.map +1 -1
  692. package/dist/team/tmux-session.js +1733 -1096
  693. package/dist/team/tmux-session.js.map +1 -1
  694. package/dist/team/types.d.ts +8 -0
  695. package/dist/team/types.d.ts.map +1 -1
  696. package/dist/team/types.js.map +1 -1
  697. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  698. package/dist/team/worker-bootstrap.js +3 -0
  699. package/dist/team/worker-bootstrap.js.map +1 -1
  700. package/dist/tools/lsp/__tests__/devcontainer.test.js +39 -5
  701. package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -1
  702. package/dist/tools/lsp/devcontainer.d.ts.map +1 -1
  703. package/dist/tools/lsp/devcontainer.js +25 -8
  704. package/dist/tools/lsp/devcontainer.js.map +1 -1
  705. package/dist/utils/__tests__/windows-search.test.js +17 -3
  706. package/dist/utils/__tests__/windows-search.test.js.map +1 -1
  707. package/dist/utils/plugin-cache-validation.d.ts.map +1 -1
  708. package/dist/utils/plugin-cache-validation.js +27 -18
  709. package/dist/utils/plugin-cache-validation.js.map +1 -1
  710. package/dist/workflow/__tests__/projections.test.js +3 -3
  711. package/dist/workflow/__tests__/projections.test.js.map +1 -1
  712. package/dist/workflow/__tests__/registry.test.js +3 -3
  713. package/dist/workflow/__tests__/registry.test.js.map +1 -1
  714. package/dist/workflow/registry.d.ts.map +1 -1
  715. package/dist/workflow/registry.js +1 -0
  716. package/dist/workflow/registry.js.map +1 -1
  717. package/docs/ARCHITECTURE.md +1 -1
  718. package/docs/CLAUDE.md +1 -1
  719. package/docs/CREDITS.md +1 -0
  720. package/docs/FEATURES.md +18 -0
  721. package/docs/FIELD-TESTING.md +10 -0
  722. package/docs/HOOKS.md +339 -36
  723. package/docs/REFERENCE.md +82 -17
  724. package/docs/TEAM-MULTIPLEXER.md +107 -0
  725. package/hooks/hooks.json +204 -66
  726. package/hooks/jev-compaction.mjs +2404 -0
  727. package/package.json +2 -2
  728. package/plugin.json +1 -1
  729. package/scripts/check-omc-playbooks.mjs +214 -124
  730. package/scripts/code-simplifier.mjs +26 -3
  731. package/scripts/copilot/build-hooks.mjs +24 -7
  732. package/scripts/generate-inventory-graph.mjs +77 -92
  733. package/scripts/jev-eval.mjs +123 -22
  734. package/scripts/jev-repair-transcript.mjs +331 -0
  735. package/scripts/jev-resolve.mjs +374 -22
  736. package/scripts/keyword-detector.mjs +427 -29
  737. package/scripts/lib/hook-command-normalizer.d.mts +33 -0
  738. package/scripts/lib/hook-command-normalizer.mjs +157 -60
  739. package/scripts/lib/jev-breaker.d.mts +73 -0
  740. package/scripts/lib/jev-breaker.mjs +830 -0
  741. package/scripts/lib/jev-compaction-state.mjs +320 -0
  742. package/scripts/lib/jev-delivery-guard.mjs +567 -0
  743. package/scripts/lib/jev-mask.mjs +36 -0
  744. package/scripts/lib/jev-shadow.mjs +363 -14
  745. package/scripts/lib/shell-checks.mjs +1121 -0
  746. package/scripts/lib/state-root.cjs +19 -8
  747. package/scripts/lib/state-root.mjs +19 -8
  748. package/scripts/persistent-mode.cjs +289 -1
  749. package/scripts/persistent-mode.mjs +540 -91
  750. package/scripts/plugin-setup.mjs +26 -30
  751. package/scripts/plugin-shipping-surface.mjs +4 -1
  752. package/scripts/post-tool-use-failure.mjs +18 -0
  753. package/scripts/post-tool-verifier.mjs +49 -3
  754. package/scripts/pre-tool-enforcer.mjs +658 -64
  755. package/scripts/run.cjs +4 -2
  756. package/scripts/session-start.mjs +54 -0
  757. package/skills/AGENTS.md +1 -0
  758. package/skills/ai-slop-cleaner/SKILL.md +14 -0
  759. package/skills/arena/SKILL.md +8 -1
  760. package/skills/babysit/SKILL.md +2 -1
  761. package/skills/create-formal-verification-skill/SKILL.md +6 -4
  762. package/skills/figure-it-out/SKILL.md +5 -0
  763. package/skills/fix-ci/SKILL.md +3 -1
  764. package/skills/how/references/explainer-prompt.md +7 -4
  765. package/skills/interrogate/SKILL.md +10 -6
  766. package/skills/ralph/SKILL.md +27 -2
  767. package/skills/ralph-experiment/SKILL.md +1 -1
  768. package/skills/sdd/SKILL.md +67 -0
  769. package/skills/sdd/phases/criteria.md +144 -0
  770. package/skills/sdd/phases/execute.md +226 -0
  771. package/skills/sdd/phases/review.md +216 -0
  772. package/skills/sdd/phases/rules.md +195 -0
  773. package/skills/sdd/phases/spec.md +75 -0
  774. package/skills/sdd/phases/tasks.md +162 -0
  775. package/skills/statechart/scripts/run.ts +6 -3
  776. package/skills/statechart/scripts/test/child-env.test.ts +53 -0
  777. package/templates/hooks/keyword-detector.mjs +172 -5
  778. package/templates/hooks/lib/state-root.mjs +19 -8
  779. package/templates/hooks/persistent-mode.mjs +296 -1
@@ -1,8 +1,8 @@
1
- import { describe, it, expect, vi, afterEach } from 'vitest';
2
- import { readFileSync } from 'fs';
3
- import { join } from 'path';
4
- import { sanitizeName, sessionName, shouldAttemptAdaptiveRetry, getDefaultShell, buildWorkerStartCommand, paneLooksReady, paneHasActiveTask, paneHasTrustPrompt, verifyTeamTargetOwnership, TeamSessionCreationError, normalizeDetachedSessionTarget, buildDetachedTmuxServerKeepaliveArgs, buildPrivateTmuxSocketPath, captureTmuxServerIdentity, observeTmuxServerIdentity, runTmuxServerIdentityGuard, } from '../tmux-session.js';
5
- import { isValidTmuxServerIdentity } from '../types.js';
1
+ import { describe, it, expect, vi, afterEach } from "vitest";
2
+ import { readFileSync } from "fs";
3
+ import { join } from "path";
4
+ import { sanitizeName, sessionName, shouldAttemptAdaptiveRetry, getDefaultShell, buildWorkerStartCommand, paneLooksReady, paneHasActiveTask, paneHasTrustPrompt, verifyTeamTargetOwnership, TeamSessionCreationError, normalizeDetachedSessionTarget, buildDetachedTmuxServerKeepaliveArgs, buildPrivateTmuxSocketPath, captureTmuxServerIdentity, observeTmuxServerIdentity, runTmuxServerIdentityGuard, } from "../tmux-session.js";
5
+ import { isValidTmuxServerIdentity, } from "../types.js";
6
6
  /**
7
7
  * Native Windows is win32 *without* the MSYS markers a Git Bash launch exports.
8
8
  * Stubbing only process.platform leaves the launching shell's MSYSTEM in place,
@@ -10,238 +10,309 @@ import { isValidTmuxServerIdentity } from '../types.js';
10
10
  * and fail under Git Bash. Tests that mean MSYS set MSYSTEM themselves.
11
11
  */
12
12
  function stubNativeWindows() {
13
- vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
14
- vi.stubEnv('MSYSTEM', '');
15
- vi.stubEnv('MINGW_PREFIX', '');
13
+ vi.spyOn(process, "platform", "get").mockReturnValue("win32");
14
+ vi.stubEnv("MSYSTEM", "");
15
+ vi.stubEnv("MINGW_PREFIX", "");
16
16
  }
17
17
  afterEach(() => {
18
18
  vi.unstubAllEnvs();
19
19
  vi.restoreAllMocks();
20
20
  });
21
- const testProcessStartedAt = process.platform === 'linux'
22
- ? 'linux:test-boot:1'
23
- : process.platform === 'darwin'
24
- ? 'darwin:1:1'
25
- : process.platform === 'win32'
26
- ? 'win32:1'
27
- : 'unsupported:identity';
28
- describe('sanitizeName', () => {
29
- it('passes alphanumeric names', () => {
30
- expect(sanitizeName('worker1')).toBe('worker1');
31
- });
32
- it('removes invalid characters', () => {
33
- expect(sanitizeName('worker@1!')).toBe('worker1');
34
- });
35
- it('allows hyphens', () => {
36
- expect(sanitizeName('my-worker')).toBe('my-worker');
37
- });
38
- it('truncates to 50 chars', () => {
39
- const long = 'a'.repeat(100);
21
+ const testProcessStartedAt = process.platform === "linux"
22
+ ? "linux:test-boot:1"
23
+ : process.platform === "darwin"
24
+ ? "darwin:1:1"
25
+ : process.platform === "win32"
26
+ ? "win32:1"
27
+ : "unsupported:identity";
28
+ describe("sanitizeName", () => {
29
+ it("passes alphanumeric names", () => {
30
+ expect(sanitizeName("worker1")).toBe("worker1");
31
+ });
32
+ it("removes invalid characters", () => {
33
+ expect(sanitizeName("worker@1!")).toBe("worker1");
34
+ });
35
+ it("allows hyphens", () => {
36
+ expect(sanitizeName("my-worker")).toBe("my-worker");
37
+ });
38
+ it("truncates to 50 chars", () => {
39
+ const long = "a".repeat(100);
40
40
  expect(sanitizeName(long).length).toBe(50);
41
41
  });
42
- it('throws for all-invalid names', () => {
43
- expect(() => sanitizeName('!!!@@@')).toThrow('no valid characters');
42
+ it("throws for all-invalid names", () => {
43
+ expect(() => sanitizeName("!!!@@@")).toThrow("no valid characters");
44
44
  });
45
- it('rejects 1-char result after sanitization', () => {
46
- expect(() => sanitizeName('a')).toThrow('too short');
45
+ it("rejects 1-char result after sanitization", () => {
46
+ expect(() => sanitizeName("a")).toThrow("too short");
47
47
  });
48
- it('accepts 2-char result after sanitization', () => {
49
- expect(sanitizeName('ab')).toBe('ab');
48
+ it("accepts 2-char result after sanitization", () => {
49
+ expect(sanitizeName("ab")).toBe("ab");
50
50
  });
51
51
  });
52
- describe('sessionName', () => {
53
- it('builds correct session name', () => {
54
- expect(sessionName('myteam', 'codex1')).toBe('omc-team-myteam-codex1');
52
+ describe("sessionName", () => {
53
+ it("builds correct session name", () => {
54
+ expect(sessionName("myteam", "codex1")).toBe("omc-team-myteam-codex1");
55
55
  });
56
- it('sanitizes both parts', () => {
57
- expect(sessionName('my team!', 'work@er')).toBe('omc-team-myteam-worker');
56
+ it("sanitizes both parts", () => {
57
+ expect(sessionName("my team!", "work@er")).toBe("omc-team-myteam-worker");
58
58
  });
59
59
  });
60
- describe('detached session target normalization', () => {
61
- it('normalizes numeric window indices from new-session responses', () => {
60
+ describe("detached session target normalization", () => {
61
+ it("normalizes numeric window indices from new-session responses", () => {
62
62
  // Base-index 0: new-session creates window 0
63
- expect(normalizeDetachedSessionTarget('worker-detached-session:0')).toBe('worker-detached-session');
63
+ expect(normalizeDetachedSessionTarget("worker-detached-session:0")).toBe("worker-detached-session");
64
64
  // Base-index 1: new-session creates window 1
65
- expect(normalizeDetachedSessionTarget('worker-detached-session:1')).toBe('worker-detached-session');
65
+ expect(normalizeDetachedSessionTarget("worker-detached-session:1")).toBe("worker-detached-session");
66
66
  // Base-index with custom offset: new-session might create window 5
67
- expect(normalizeDetachedSessionTarget('worker-detached-session:5')).toBe('worker-detached-session');
67
+ expect(normalizeDetachedSessionTarget("worker-detached-session:5")).toBe("worker-detached-session");
68
68
  // Non-numeric suffixes are rejected
69
- expect(normalizeDetachedSessionTarget('worker-detached-session:workers')).toBeNull();
69
+ expect(normalizeDetachedSessionTarget("worker-detached-session:workers")).toBeNull();
70
70
  // Session name alone is accepted
71
- expect(normalizeDetachedSessionTarget('worker-detached-session')).toBe('worker-detached-session');
71
+ expect(normalizeDetachedSessionTarget("worker-detached-session")).toBe("worker-detached-session");
72
72
  });
73
73
  });
74
- describe('tmux creation allocation evidence', () => {
75
- it('retains typed evidence when creation cleanup is unknown', () => {
76
- const error = new TeamSessionCreationError('tmux_creation_cleanup_unverified', {
77
- sessionName: 'team:0',
78
- leaderPaneId: '%1',
74
+ describe("tmux creation allocation evidence", () => {
75
+ it("retains typed evidence when creation cleanup is unknown", () => {
76
+ const error = new TeamSessionCreationError("tmux_creation_cleanup_unverified", {
77
+ sessionName: "team:0",
78
+ leaderPaneId: "%1",
79
79
  workerPaneIds: [],
80
- sessionMode: 'split-pane',
80
+ sessionMode: "split-pane",
81
81
  tmuxServerIdentity: {
82
- socket_path: '/tmp/team.sock',
82
+ socket_path: "/tmp/team.sock",
83
83
  server_pid: 7,
84
84
  process_started_at: testProcessStartedAt,
85
85
  },
86
86
  }, {
87
- provider: 'tmux',
88
- operation: 'split-window',
89
- rawOutput: 'unexpected output',
90
- stderr: '',
87
+ provider: "tmux",
88
+ operation: "split-window",
89
+ rawOutput: "unexpected output",
90
+ stderr: "",
91
91
  });
92
- expect(error.cleanupStatus).toBe('unknown');
93
- expect(error.creationEvidence?.rawOutput).toBe('unexpected output');
92
+ expect(error.cleanupStatus).toBe("unknown");
93
+ expect(error.creationEvidence?.rawOutput).toBe("unexpected output");
94
94
  expect(error.partialSession.workerPaneIds).toEqual([]);
95
95
  });
96
96
  });
97
- describe('verifyTeamTargetOwnership tmux target kinds', () => {
98
- const processStartedAt = process.platform === 'linux'
99
- ? 'linux:test-boot:1'
100
- : process.platform === 'darwin'
101
- ? 'darwin:1:1'
102
- : process.platform === 'win32'
103
- ? 'win32:1'
104
- : 'unsupported:identity';
97
+ describe("verifyTeamTargetOwnership tmux target kinds", () => {
98
+ const processStartedAt = process.platform === "linux"
99
+ ? "linux:test-boot:1"
100
+ : process.platform === "darwin"
101
+ ? "darwin:1:1"
102
+ : process.platform === "win32"
103
+ ? "win32:1"
104
+ : "unsupported:identity";
105
105
  const serverIdentity = {
106
- socket_path: '/tmp/omc-tmux-membership.sock',
106
+ socket_path: "/tmp/omc-tmux-membership.sock",
107
107
  server_pid: 42,
108
108
  process_started_at: processStartedAt,
109
109
  };
110
110
  const dependenciesFor = (tmuxExec) => ({
111
111
  tmuxExec,
112
- cmuxExec: vi.fn(async () => ({ stdout: '', stderr: '' })),
112
+ cmuxExec: vi.fn(async () => ({ stdout: "", stderr: "" })),
113
113
  serverIdentityDependencies: {
114
- tmuxQuery: vi.fn(async () => ({ stdout: '42\n', stderr: '' })),
114
+ tmuxQuery: vi.fn(async () => ({ stdout: "42\n", stderr: "" })),
115
115
  processIdentity: () => processStartedAt,
116
- processObservation: () => 'matching',
116
+ processObservation: () => "matching",
117
117
  },
118
118
  });
119
119
  const target = (providerTarget) => ({
120
- provider: 'tmux',
120
+ provider: "tmux",
121
121
  providerTarget,
122
- recipient: 'worker-1',
123
- recipientRole: 'worker',
124
- paneId: '%9',
122
+ recipient: "worker-1",
123
+ recipientRole: "worker",
124
+ paneId: "%9",
125
125
  workerIndex: 1,
126
126
  tmuxServerIdentity: serverIdentity,
127
127
  });
128
- it('uses an exact session selector for bare named-session membership', async () => {
129
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
130
- await expect(verifyTeamTargetOwnership(target('dispatch-session'), dependenciesFor(tmuxExec))).resolves.toEqual({
131
- kind: 'owned',
132
- provider: 'tmux',
133
- providerTarget: 'dispatch-session',
134
- paneId: '%9',
128
+ it("uses an exact session selector for bare named-session membership", async () => {
129
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
130
+ await expect(verifyTeamTargetOwnership(target("dispatch-session"), dependenciesFor(tmuxExec))).resolves.toEqual({
131
+ kind: "owned",
132
+ provider: "tmux",
133
+ providerTarget: "dispatch-session",
134
+ paneId: "%9",
135
135
  tmuxServerIdentity: serverIdentity,
136
136
  });
137
137
  expect(tmuxExec).toHaveBeenCalledWith([
138
- '-S', serverIdentity.socket_path, 'list-panes', '-s', '-t', '=dispatch-session:', '-F', '#{pane_id}',
138
+ "-S",
139
+ serverIdentity.socket_path,
140
+ "list-panes",
141
+ "-s",
142
+ "-t",
143
+ "=dispatch-session:",
144
+ "-F",
145
+ "#{pane_id}",
139
146
  ]);
140
147
  });
141
- it('keeps an explicit session:window target exact without session scope', async () => {
142
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
143
- await expect(verifyTeamTargetOwnership(target('dispatch-session:0'), dependenciesFor(tmuxExec)))
144
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
148
+ it("keeps an explicit session:window target exact without session scope", async () => {
149
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
150
+ await expect(verifyTeamTargetOwnership(target("dispatch-session:0"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
151
+ kind: "owned",
152
+ paneId: "%9",
153
+ tmuxServerIdentity: serverIdentity,
154
+ });
145
155
  expect(tmuxExec).toHaveBeenCalledWith([
146
- '-S', serverIdentity.socket_path, 'list-panes', '-t', '=dispatch-session:0', '-F', '#{pane_id}',
156
+ "-S",
157
+ serverIdentity.socket_path,
158
+ "list-panes",
159
+ "-t",
160
+ "=dispatch-session:0",
161
+ "-F",
162
+ "#{pane_id}",
147
163
  ]);
148
164
  });
149
- it('adds exact matching to named windows to prevent prefix collisions', async () => {
150
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
151
- await expect(verifyTeamTargetOwnership(target('dispatch-session:worker'), dependenciesFor(tmuxExec)))
152
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
165
+ it("adds exact matching to named windows to prevent prefix collisions", async () => {
166
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
167
+ await expect(verifyTeamTargetOwnership(target("dispatch-session:worker"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
168
+ kind: "owned",
169
+ paneId: "%9",
170
+ tmuxServerIdentity: serverIdentity,
171
+ });
153
172
  expect(tmuxExec).toHaveBeenCalledWith([
154
- '-S', serverIdentity.socket_path, 'list-panes', '-t', '=dispatch-session:=worker', '-F', '#{pane_id}',
173
+ "-S",
174
+ serverIdentity.socket_path,
175
+ "list-panes",
176
+ "-t",
177
+ "=dispatch-session:=worker",
178
+ "-F",
179
+ "#{pane_id}",
155
180
  ]);
156
181
  });
157
- it('passes supported native session/window IDs without name prefixes', async () => {
158
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
182
+ it("passes supported native session/window IDs without name prefixes", async () => {
183
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
159
184
  const dependencies = dependenciesFor(tmuxExec);
160
- await expect(verifyTeamTargetOwnership(target('$7'), dependencies))
161
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
185
+ await expect(verifyTeamTargetOwnership(target("$7"), dependencies)).resolves.toMatchObject({
186
+ kind: "owned",
187
+ paneId: "%9",
188
+ tmuxServerIdentity: serverIdentity,
189
+ });
162
190
  expect(tmuxExec).toHaveBeenLastCalledWith([
163
- '-S', serverIdentity.socket_path, 'list-panes', '-s', '-t', '$7', '-F', '#{pane_id}',
191
+ "-S",
192
+ serverIdentity.socket_path,
193
+ "list-panes",
194
+ "-s",
195
+ "-t",
196
+ "$7",
197
+ "-F",
198
+ "#{pane_id}",
164
199
  ]);
165
- await expect(verifyTeamTargetOwnership(target('@13'), dependencies))
166
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
200
+ await expect(verifyTeamTargetOwnership(target("@13"), dependencies)).resolves.toMatchObject({
201
+ kind: "owned",
202
+ paneId: "%9",
203
+ tmuxServerIdentity: serverIdentity,
204
+ });
167
205
  expect(tmuxExec).toHaveBeenLastCalledWith([
168
- '-S', serverIdentity.socket_path, 'list-panes', '-t', '@13', '-F', '#{pane_id}',
206
+ "-S",
207
+ serverIdentity.socket_path,
208
+ "list-panes",
209
+ "-t",
210
+ "@13",
211
+ "-F",
212
+ "#{pane_id}",
169
213
  ]);
170
214
  });
171
- it('fails closed for malformed native-looking target IDs', async () => {
172
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
173
- await expect(verifyTeamTargetOwnership(target('$session'), dependenciesFor(tmuxExec)))
174
- .resolves.toEqual({ kind: 'unavailable' });
215
+ it("fails closed for malformed native-looking target IDs", async () => {
216
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
217
+ await expect(verifyTeamTargetOwnership(target("$session"), dependenciesFor(tmuxExec))).resolves.toEqual({ kind: "unavailable" });
175
218
  expect(tmuxExec).not.toHaveBeenCalled();
176
219
  });
177
- it('handles base-index 0: numeric windows with index 0', async () => {
178
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
179
- await expect(verifyTeamTargetOwnership(target('dispatch-session:0'), dependenciesFor(tmuxExec)))
180
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
220
+ it("handles base-index 0: numeric windows with index 0", async () => {
221
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
222
+ await expect(verifyTeamTargetOwnership(target("dispatch-session:0"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
223
+ kind: "owned",
224
+ paneId: "%9",
225
+ tmuxServerIdentity: serverIdentity,
226
+ });
181
227
  expect(tmuxExec).toHaveBeenCalledWith([
182
- '-S', serverIdentity.socket_path, 'list-panes', '-t', '=dispatch-session:0', '-F', '#{pane_id}',
228
+ "-S",
229
+ serverIdentity.socket_path,
230
+ "list-panes",
231
+ "-t",
232
+ "=dispatch-session:0",
233
+ "-F",
234
+ "#{pane_id}",
183
235
  ]);
184
236
  });
185
- it('handles base-index 1: numeric windows with index 1', async () => {
186
- const tmuxExec = vi.fn(async () => ({ stdout: '%9\n', stderr: '' }));
187
- await expect(verifyTeamTargetOwnership(target('dispatch-session:1'), dependenciesFor(tmuxExec)))
188
- .resolves.toMatchObject({ kind: 'owned', paneId: '%9', tmuxServerIdentity: serverIdentity });
237
+ it("handles base-index 1: numeric windows with index 1", async () => {
238
+ const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
239
+ await expect(verifyTeamTargetOwnership(target("dispatch-session:1"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
240
+ kind: "owned",
241
+ paneId: "%9",
242
+ tmuxServerIdentity: serverIdentity,
243
+ });
189
244
  expect(tmuxExec).toHaveBeenCalledWith([
190
- '-S', serverIdentity.socket_path, 'list-panes', '-t', '=dispatch-session:1', '-F', '#{pane_id}',
245
+ "-S",
246
+ serverIdentity.socket_path,
247
+ "list-panes",
248
+ "-t",
249
+ "=dispatch-session:1",
250
+ "-F",
251
+ "#{pane_id}",
191
252
  ]);
192
253
  });
193
254
  });
194
- describe('tmux server incarnation identity', () => {
195
- const startIdentity = process.platform === 'linux'
196
- ? 'linux:test-boot:1'
197
- : process.platform === 'darwin'
198
- ? 'darwin:1:1'
199
- : process.platform === 'win32'
200
- ? 'win32:1'
255
+ describe("tmux server incarnation identity", () => {
256
+ const startIdentity = process.platform === "linux"
257
+ ? "linux:test-boot:1"
258
+ : process.platform === "darwin"
259
+ ? "darwin:1:1"
260
+ : process.platform === "win32"
261
+ ? "win32:1"
201
262
  : `${process.platform}:native`;
202
263
  const identity = {
203
- socket_path: '/tmp/omc-tmux-test.sock',
264
+ socket_path: "/tmp/omc-tmux-test.sock",
204
265
  server_pid: 42,
205
266
  process_started_at: startIdentity,
206
267
  };
207
- it('captures socket and PID from tmux output, then binds strict process identity', async () => {
208
- const tmuxQuery = vi.fn(async () => ({ stdout: `${identity.socket_path}\t${identity.server_pid}\n`, stderr: '' }));
209
- const kill = vi.spyOn(process, 'kill').mockReturnValue(true);
268
+ it("captures socket and PID from tmux output, then binds strict process identity", async () => {
269
+ const tmuxQuery = vi.fn(async () => ({
270
+ stdout: `${identity.socket_path}\t${identity.server_pid}\n`,
271
+ stderr: "",
272
+ }));
273
+ const kill = vi.spyOn(process, "kill").mockReturnValue(true);
210
274
  try {
211
275
  await expect(captureTmuxServerIdentity(undefined, {
212
276
  tmuxQuery,
213
277
  processIdentity: () => identity.process_started_at,
214
278
  })).resolves.toEqual(identity);
215
- expect(tmuxQuery).toHaveBeenCalledWith(['display-message', '-p', '#{socket_path}\t#{pid}'], undefined);
279
+ expect(tmuxQuery).toHaveBeenCalledWith(["display-message", "-p", "#{socket_path}\t#{pid}"], undefined);
216
280
  }
217
281
  finally {
218
282
  kill.mockRestore();
219
283
  }
220
284
  });
221
285
  it.each([
222
- ['matching', 'matching', 'matching'],
223
- ['dead', 'dead', 'dead'],
224
- ['unknown', 'unknown', 'unknown'],
225
- ])('keeps process identity observation distinct for %s', async (_label, processState, expected) => {
286
+ ["matching", "matching", "matching"],
287
+ ["dead", "dead", "dead"],
288
+ ["unknown", "unknown", "unknown"],
289
+ ])("keeps process identity observation distinct for %s", async (_label, processState, expected) => {
226
290
  const actual = await observeTmuxServerIdentity(identity, {
227
- tmuxQuery: vi.fn(async () => ({ stdout: '42\n', stderr: '' })),
291
+ tmuxQuery: vi.fn(async () => ({ stdout: "42\n", stderr: "" })),
228
292
  processIdentity: () => identity.process_started_at,
229
293
  processObservation: () => processState,
230
294
  });
231
295
  expect(actual).toBe(expected);
232
296
  });
233
- it('checks the Windows server incarnation once after confirming its PID', async () => {
234
- const platform = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
235
- const kill = vi.spyOn(process, 'kill').mockReturnValue(true);
297
+ it("checks the Windows server incarnation once after confirming its PID", async () => {
298
+ const platform = vi
299
+ .spyOn(process, "platform", "get")
300
+ .mockReturnValue("win32");
301
+ const kill = vi.spyOn(process, "kill").mockReturnValue(true);
236
302
  const windowsIdentity = {
237
303
  ...identity,
238
- process_started_at: 'win32:638878752000000000',
304
+ process_started_at: "win32:638878752000000000",
239
305
  };
240
306
  const processIdentity = vi.fn(() => windowsIdentity.process_started_at);
241
- const tmuxQuery = vi.fn(async () => ({ stdout: `${windowsIdentity.server_pid}\n`, stderr: '' }));
307
+ const tmuxQuery = vi.fn(async () => ({
308
+ stdout: `${windowsIdentity.server_pid}\n`,
309
+ stderr: "",
310
+ }));
242
311
  try {
243
- await expect(observeTmuxServerIdentity(windowsIdentity, { tmuxQuery, processIdentity }))
244
- .resolves.toBe('matching');
312
+ await expect(observeTmuxServerIdentity(windowsIdentity, {
313
+ tmuxQuery,
314
+ processIdentity,
315
+ })).resolves.toBe("matching");
245
316
  expect(kill).toHaveBeenNthCalledWith(1, windowsIdentity.server_pid, 0);
246
317
  expect(kill).toHaveBeenNthCalledWith(2, windowsIdentity.server_pid, 0);
247
318
  expect(kill).toHaveBeenCalledTimes(2);
@@ -252,27 +323,35 @@ describe('tmux server incarnation identity', () => {
252
323
  platform.mockRestore();
253
324
  }
254
325
  });
255
- it('fails closed when a Windows PID has been reused or its identity probe is invalid', async () => {
256
- const platform = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
257
- const kill = vi.spyOn(process, 'kill').mockReturnValue(true);
326
+ it("fails closed when a Windows PID has been reused or its identity probe is invalid", async () => {
327
+ const platform = vi
328
+ .spyOn(process, "platform", "get")
329
+ .mockReturnValue("win32");
330
+ const kill = vi.spyOn(process, "kill").mockReturnValue(true);
258
331
  const windowsIdentity = {
259
332
  ...identity,
260
- process_started_at: 'win32:638878752000000000',
333
+ process_started_at: "win32:638878752000000000",
261
334
  };
262
- const tmuxQuery = vi.fn(async () => ({ stdout: `${windowsIdentity.server_pid}\n`, stderr: '' }));
263
- const differentIncarnation = vi.fn(() => 'win32:638878752000000001');
335
+ const tmuxQuery = vi.fn(async () => ({
336
+ stdout: `${windowsIdentity.server_pid}\n`,
337
+ stderr: "",
338
+ }));
339
+ const differentIncarnation = vi.fn(() => "win32:638878752000000001");
264
340
  const emptyProbe = vi.fn(() => null);
265
- const malformedProbe = vi.fn(() => 'garbage');
341
+ const malformedProbe = vi.fn(() => "garbage");
266
342
  try {
267
343
  await expect(observeTmuxServerIdentity(windowsIdentity, {
268
- tmuxQuery, processIdentity: differentIncarnation,
269
- })).resolves.toBe('dead');
344
+ tmuxQuery,
345
+ processIdentity: differentIncarnation,
346
+ })).resolves.toBe("dead");
270
347
  await expect(observeTmuxServerIdentity(windowsIdentity, {
271
- tmuxQuery, processIdentity: emptyProbe,
272
- })).resolves.toBe('unknown');
348
+ tmuxQuery,
349
+ processIdentity: emptyProbe,
350
+ })).resolves.toBe("unknown");
273
351
  await expect(observeTmuxServerIdentity(windowsIdentity, {
274
- tmuxQuery, processIdentity: malformedProbe,
275
- })).resolves.toBe('unknown');
352
+ tmuxQuery,
353
+ processIdentity: malformedProbe,
354
+ })).resolves.toBe("unknown");
276
355
  expect(differentIncarnation).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
277
356
  expect(emptyProbe).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
278
357
  expect(malformedProbe).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
@@ -282,21 +361,29 @@ describe('tmux server incarnation identity', () => {
282
361
  platform.mockRestore();
283
362
  }
284
363
  });
285
- it('does not match a Windows process when the post-probe liveness check fails', async () => {
286
- const platform = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
287
- const kill = vi.spyOn(process, 'kill')
364
+ it("does not match a Windows process when the post-probe liveness check fails", async () => {
365
+ const platform = vi
366
+ .spyOn(process, "platform", "get")
367
+ .mockReturnValue("win32");
368
+ const kill = vi
369
+ .spyOn(process, "kill")
288
370
  .mockReturnValueOnce(true)
289
- .mockImplementationOnce(() => { throw Object.assign(new Error('denied'), { code: 'EPERM' }); });
371
+ .mockImplementationOnce(() => {
372
+ throw Object.assign(new Error("denied"), { code: "EPERM" });
373
+ });
290
374
  const windowsIdentity = {
291
375
  ...identity,
292
- process_started_at: 'win32:638878752000000000',
376
+ process_started_at: "win32:638878752000000000",
293
377
  };
294
378
  const processIdentity = vi.fn(() => windowsIdentity.process_started_at);
295
379
  try {
296
380
  await expect(observeTmuxServerIdentity(windowsIdentity, {
297
- tmuxQuery: vi.fn(async () => ({ stdout: `${windowsIdentity.server_pid}\n`, stderr: '' })),
381
+ tmuxQuery: vi.fn(async () => ({
382
+ stdout: `${windowsIdentity.server_pid}\n`,
383
+ stderr: "",
384
+ })),
298
385
  processIdentity,
299
- })).resolves.toBe('unknown');
386
+ })).resolves.toBe("unknown");
300
387
  expect(processIdentity).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
301
388
  expect(kill).toHaveBeenCalledTimes(2);
302
389
  }
@@ -305,16 +392,18 @@ describe('tmux server incarnation identity', () => {
305
392
  platform.mockRestore();
306
393
  }
307
394
  });
308
- it('probes a Windows server only after reading its PID and checks liveness afterward', async () => {
309
- const platform = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
395
+ it("probes a Windows server only after reading its PID and checks liveness afterward", async () => {
396
+ const platform = vi
397
+ .spyOn(process, "platform", "get")
398
+ .mockReturnValue("win32");
310
399
  const calls = [];
311
- const kill = vi.spyOn(process, 'kill').mockImplementation(() => {
312
- calls.push('alive');
400
+ const kill = vi.spyOn(process, "kill").mockImplementation(() => {
401
+ calls.push("alive");
313
402
  return true;
314
403
  });
315
404
  const windowsIdentity = {
316
405
  ...identity,
317
- process_started_at: 'win32:638878752000000000',
406
+ process_started_at: "win32:638878752000000000",
318
407
  };
319
408
  const processIdentity = vi.fn((pid) => {
320
409
  calls.push(`probe:${pid}`);
@@ -324,24 +413,28 @@ describe('tmux server incarnation identity', () => {
324
413
  await expect(captureTmuxServerIdentity(undefined, {
325
414
  tmuxQuery: vi.fn(async () => ({
326
415
  stdout: `${windowsIdentity.socket_path}\t${windowsIdentity.server_pid}\n`,
327
- stderr: '',
416
+ stderr: "",
328
417
  })),
329
418
  processIdentity,
330
419
  })).resolves.toEqual(windowsIdentity);
331
- expect(calls).toEqual([`probe:${windowsIdentity.server_pid}`, 'alive']);
420
+ expect(calls).toEqual([`probe:${windowsIdentity.server_pid}`, "alive"]);
332
421
  }
333
422
  finally {
334
423
  kill.mockRestore();
335
424
  platform.mockRestore();
336
425
  }
337
426
  });
338
- it('rejects malformed identity before querying and rejects a mismatched server response', async () => {
339
- expect(isValidTmuxServerIdentity({ socket_path: 'relative', server_pid: 42, process_started_at: startIdentity })).toBe(false);
340
- const tmuxQuery = vi.fn(async () => ({ stdout: '42\n', stderr: '' }));
427
+ it("rejects malformed identity before querying and rejects a mismatched server response", async () => {
428
+ expect(isValidTmuxServerIdentity({
429
+ socket_path: "relative",
430
+ server_pid: 42,
431
+ process_started_at: startIdentity,
432
+ })).toBe(false);
433
+ const tmuxQuery = vi.fn(async () => ({ stdout: "42\n", stderr: "" }));
341
434
  await expect(observeTmuxServerIdentity({
342
435
  ...identity,
343
- socket_path: 'relative',
344
- }, { tmuxQuery })).resolves.toBe('unknown');
436
+ socket_path: "relative",
437
+ }, { tmuxQuery })).resolves.toBe("unknown");
345
438
  expect(tmuxQuery).not.toHaveBeenCalled();
346
439
  await expect(observeTmuxServerIdentity({
347
440
  ...identity,
@@ -349,102 +442,111 @@ describe('tmux server incarnation identity', () => {
349
442
  }, {
350
443
  tmuxQuery,
351
444
  processIdentity: () => identity.process_started_at,
352
- processObservation: () => 'matching',
353
- })).resolves.toBe('unknown');
354
- expect(tmuxQuery).toHaveBeenCalledExactlyOnceWith(['-S', identity.socket_path, 'display-message', '-p', '#{pid}'], { timeout: 2_000, stripTmux: true });
445
+ processObservation: () => "matching",
446
+ })).resolves.toBe("unknown");
447
+ expect(tmuxQuery).toHaveBeenCalledExactlyOnceWith(["-S", identity.socket_path, "display-message", "-p", "#{pid}"], { timeout: 2_000, stripTmux: true });
355
448
  });
356
- it('returns guard success only for exact PID/socket and strict process identity', () => {
357
- expect(runTmuxServerIdentityGuard(identity, '42', identity.socket_path, {
449
+ it("returns guard success only for exact PID/socket and strict process identity", () => {
450
+ expect(runTmuxServerIdentityGuard(identity, "42", identity.socket_path, {
358
451
  processIdentity: () => identity.process_started_at,
359
452
  })).toBe(0);
360
- expect(runTmuxServerIdentityGuard(identity, '43', identity.socket_path, {
453
+ expect(runTmuxServerIdentityGuard(identity, "43", identity.socket_path, {
361
454
  processIdentity: () => identity.process_started_at,
362
455
  })).toBe(1);
363
- expect(runTmuxServerIdentityGuard(identity, '42', '/tmp/other.sock', {
456
+ expect(runTmuxServerIdentityGuard(identity, "42", "/tmp/other.sock", {
364
457
  processIdentity: () => identity.process_started_at,
365
458
  })).toBe(1);
366
459
  });
367
460
  });
368
- describe('detached tmux no-server startup handshake', () => {
369
- it('starts the first session directly on a short private endpoint', () => {
461
+ describe("detached tmux no-server startup handshake", () => {
462
+ it("starts the first session directly on a short private endpoint", () => {
370
463
  const socketPath = buildPrivateTmuxSocketPath();
371
464
  const keepalive = buildDetachedTmuxServerKeepaliveArgs(socketPath);
372
465
  expect(keepalive).toEqual([
373
- '-S', socketPath, 'start-server', ';', 'set-option', '-g', 'exit-empty', 'off',
466
+ "-S",
467
+ socketPath,
468
+ "start-server",
469
+ ";",
470
+ "set-option",
471
+ "-g",
472
+ "exit-empty",
473
+ "off",
374
474
  ]);
375
- if (process.platform === 'darwin' || process.platform === 'linux') {
376
- expect(Buffer.byteLength(socketPath, 'utf8')).toBeLessThan(104);
475
+ if (process.platform === "darwin" || process.platform === "linux") {
476
+ expect(Buffer.byteLength(socketPath, "utf8")).toBeLessThan(104);
377
477
  }
378
478
  });
379
479
  });
380
- describe('getWorkerLiveness tmux inventory fallback', () => {
480
+ describe("getWorkerLiveness tmux inventory fallback", () => {
381
481
  async function loadLivenessWithTmuxOutputs(displayOutput, inventoryOutput) {
382
482
  const calls = [];
383
483
  const tmuxCmdAsync = vi.fn(async (args) => {
384
484
  calls.push(args);
385
- if (args[0] === 'display-message')
386
- return { stdout: displayOutput, stderr: '' };
387
- return { stdout: inventoryOutput, stderr: '' };
485
+ if (args[0] === "display-message")
486
+ return { stdout: displayOutput, stderr: "" };
487
+ return { stdout: inventoryOutput, stderr: "" };
388
488
  });
389
489
  vi.resetModules();
390
- vi.doMock('../../cli/tmux-utils.js', async (importOriginal) => {
490
+ vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
391
491
  const actual = await importOriginal();
392
492
  return { ...actual, tmuxCmdAsync };
393
493
  });
394
494
  try {
395
- const { getWorkerLiveness } = await import('../tmux-session.js');
396
- return { liveness: await getWorkerLiveness('%1'), calls };
495
+ const { getWorkerLiveness } = await import("../tmux-session.js");
496
+ return { liveness: await getWorkerLiveness("%1"), calls };
397
497
  }
398
498
  finally {
399
- vi.doUnmock('../../cli/tmux-utils.js');
499
+ vi.doUnmock("../../cli/tmux-utils.js");
400
500
  vi.resetModules();
401
501
  }
402
502
  }
403
- it('proves a removed pane dead from a valid non-empty native inventory', async () => {
404
- const result = await loadLivenessWithTmuxOutputs('', '%0 0\n');
405
- expect(result.liveness).toBe('dead');
503
+ it("proves a removed pane dead from a valid non-empty native inventory", async () => {
504
+ const result = await loadLivenessWithTmuxOutputs("", "%0 0\n");
505
+ expect(result.liveness).toBe("dead");
406
506
  expect(result.calls).toEqual([
407
- ['display-message', '-t', '%1', '-p', '#{pane_dead}'],
408
- ['list-panes', '-a', '-F', '#{pane_id} #{pane_dead}'],
507
+ ["display-message", "-t", "%1", "-p", "#{pane_dead}"],
508
+ ["list-panes", "-a", "-F", "#{pane_id} #{pane_dead}"],
409
509
  ]);
410
510
  });
411
- it.each(['', 'not-a-pane\n', '%0 malformed\n', '%0 0\nmalformed\n'])('preserves unknown when fallback inventory is empty or malformed: %j', async (inventoryOutput) => {
412
- const result = await loadLivenessWithTmuxOutputs('', inventoryOutput);
413
- expect(result.liveness).toBe('unknown');
511
+ it.each(["", "not-a-pane\n", "%0 malformed\n", "%0 0\nmalformed\n"])("preserves unknown when fallback inventory is empty or malformed: %j", async (inventoryOutput) => {
512
+ const result = await loadLivenessWithTmuxOutputs("", inventoryOutput);
513
+ expect(result.liveness).toBe("unknown");
414
514
  });
415
- it('matches native pane IDs exactly instead of treating a prefix as present', async () => {
416
- const result = await loadLivenessWithTmuxOutputs('', '%10 0\n');
417
- expect(result.liveness).toBe('dead');
515
+ it("matches native pane IDs exactly instead of treating a prefix as present", async () => {
516
+ const result = await loadLivenessWithTmuxOutputs("", "%10 0\n");
517
+ expect(result.liveness).toBe("dead");
418
518
  });
419
519
  });
420
- describe('applyMainVerticalLayout', () => {
520
+ describe("applyMainVerticalLayout", () => {
421
521
  const identity = {
422
- socket_path: '/tmp/layout-test.sock',
522
+ socket_path: "/tmp/layout-test.sock",
423
523
  server_pid: 42,
424
- process_started_at: process.platform === 'linux'
425
- ? 'linux:fixture:42'
426
- : process.platform === 'win32' ? 'win32:42' : 'darwin:42:123456',
524
+ process_started_at: process.platform === "linux"
525
+ ? "linux:fixture:42"
526
+ : process.platform === "win32"
527
+ ? "win32:42"
528
+ : "darwin:42:123456",
427
529
  };
428
530
  function guardedResult(args) {
429
- expect(args.slice(0, 3)).toEqual(['-S', identity.socket_path, 'if-shell']);
430
- expect(args[3]).toContain('--tmux-server-identity-guard');
531
+ expect(args.slice(0, 3)).toEqual(["-S", identity.socket_path, "if-shell"]);
532
+ expect(args[3]).toContain("--tmux-server-identity-guard");
431
533
  const marker = args[4]?.match(/OMC_TMUX_GUARD_OK_[A-Za-z0-9_]+/)?.[0];
432
534
  expect(marker).toBeDefined();
433
- return { stdout: `${marker}\n`, stderr: '' };
535
+ return { stdout: `${marker}\n`, stderr: "" };
434
536
  }
435
- it('sets the 80-column main width before its sole layout selection', async () => {
537
+ it("sets the 80-column main width before its sole layout selection", async () => {
436
538
  const calls = [];
437
539
  let mainPaneWidth;
438
540
  const selectedPaneWidths = [];
439
541
  vi.resetModules();
440
- vi.doMock('../../cli/tmux-utils.js', async (importOriginal) => {
542
+ vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
441
543
  const actual = await importOriginal();
442
544
  return {
443
545
  ...actual,
444
546
  tmuxCmdAsync: vi.fn(async (args) => {
445
547
  calls.push(args);
446
- if (args[2] === 'if-shell') {
447
- const command = args[4] ?? '';
548
+ if (args[2] === "if-shell") {
549
+ const command = args[4] ?? "";
448
550
  const width = command.match(/'main-pane-width' '(\d+)'/)?.[1];
449
551
  if (width)
450
552
  mainPaneWidth = Number(width);
@@ -452,490 +554,555 @@ describe('applyMainVerticalLayout', () => {
452
554
  selectedPaneWidths.push(mainPaneWidth);
453
555
  return guardedResult(args);
454
556
  }
455
- return { stdout: '80\n', stderr: '' };
557
+ return { stdout: "80\n", stderr: "" };
456
558
  }),
457
559
  tmuxExecAsync: vi.fn(async (args) => {
458
- throw new Error(`unguarded layout effect: ${args.join(' ')}`);
560
+ throw new Error(`unguarded layout effect: ${args.join(" ")}`);
459
561
  }),
460
562
  };
461
563
  });
462
564
  try {
463
565
  // Stock tmux guard path, even on a win32 host with psmux installed.
464
- (await import('../psmux-adapter.js')).__setPsmuxDetectionForTests(false);
465
- const { applyMainVerticalLayout } = await import('../tmux-session.js');
466
- await applyMainVerticalLayout('team-session', { tmuxServerIdentity: identity });
566
+ (await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
567
+ const { applyMainVerticalLayout } = await import("../tmux-session.js");
568
+ await applyMainVerticalLayout("team-session", {
569
+ tmuxServerIdentity: identity,
570
+ });
467
571
  }
468
572
  finally {
469
- vi.doUnmock('../../cli/tmux-utils.js');
573
+ vi.doUnmock("../../cli/tmux-utils.js");
470
574
  vi.resetModules();
471
575
  }
472
576
  expect(calls).toEqual([
473
- ['-S', identity.socket_path, 'display-message', '-p', '-t', 'team-session', '#{window_width}'],
474
- ['-S', identity.socket_path, 'if-shell', expect.any(String), expect.stringContaining("'main-pane-width' '40'"), expect.any(String)],
475
- ['-S', identity.socket_path, 'if-shell', expect.any(String), expect.stringContaining("'select-layout' '-t' 'team-session' 'main-vertical'"), expect.any(String)],
577
+ [
578
+ "-S",
579
+ identity.socket_path,
580
+ "display-message",
581
+ "-p",
582
+ "-t",
583
+ "team-session",
584
+ "#{window_width}",
585
+ ],
586
+ [
587
+ "-S",
588
+ identity.socket_path,
589
+ "if-shell",
590
+ expect.any(String),
591
+ expect.stringContaining("'main-pane-width' '40'"),
592
+ expect.any(String),
593
+ ],
594
+ [
595
+ "-S",
596
+ identity.socket_path,
597
+ "if-shell",
598
+ expect.any(String),
599
+ expect.stringContaining("'select-layout' '-t' 'team-session' 'main-vertical'"),
600
+ expect.any(String),
601
+ ],
476
602
  ]);
477
- expect(calls.filter(args => args[4]?.includes("'select-layout'"))).toHaveLength(1);
603
+ expect(calls.filter((args) => args[4]?.includes("'select-layout'"))).toHaveLength(1);
478
604
  expect(selectedPaneWidths).toEqual([40]);
479
605
  });
480
- it('fails required startup layout before selecting when width is invalid', async () => {
606
+ it("fails required startup layout before selecting when width is invalid", async () => {
481
607
  const calls = [];
482
608
  vi.resetModules();
483
- vi.doMock('../../cli/tmux-utils.js', async (importOriginal) => {
609
+ vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
484
610
  const actual = await importOriginal();
485
611
  return {
486
612
  ...actual,
487
613
  tmuxCmdAsync: vi.fn(async (args) => {
488
614
  calls.push(args);
489
- return { stdout: 'not-a-width\n', stderr: '' };
615
+ return { stdout: "not-a-width\n", stderr: "" };
490
616
  }),
491
617
  tmuxExecAsync: vi.fn(async (args) => {
492
618
  calls.push(args);
493
- return { stdout: '', stderr: '' };
619
+ return { stdout: "", stderr: "" };
494
620
  }),
495
621
  };
496
622
  });
497
623
  try {
498
624
  // Stock tmux guard path, even on a win32 host with psmux installed.
499
- (await import('../psmux-adapter.js')).__setPsmuxDetectionForTests(false);
500
- const { applyMainVerticalLayout } = await import('../tmux-session.js');
501
- await expect(applyMainVerticalLayout('team-session', { required: true, tmuxServerIdentity: identity }))
502
- .rejects.toThrow('team_layout_window_width_invalid:not-a-width');
625
+ (await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
626
+ const { applyMainVerticalLayout } = await import("../tmux-session.js");
627
+ await expect(applyMainVerticalLayout("team-session", {
628
+ required: true,
629
+ tmuxServerIdentity: identity,
630
+ })).rejects.toThrow("team_layout_window_width_invalid:not-a-width");
503
631
  }
504
632
  finally {
505
- vi.doUnmock('../../cli/tmux-utils.js');
633
+ vi.doUnmock("../../cli/tmux-utils.js");
506
634
  vi.resetModules();
507
635
  }
508
636
  expect(calls).toEqual([
509
- ['-S', identity.socket_path, 'display-message', '-p', '-t', 'team-session', '#{window_width}'],
637
+ [
638
+ "-S",
639
+ identity.socket_path,
640
+ "display-message",
641
+ "-p",
642
+ "-t",
643
+ "team-session",
644
+ "#{window_width}",
645
+ ],
510
646
  ]);
511
647
  });
512
- it('rejects a required layout below the startup width boundary', async () => {
648
+ it("rejects a required layout below the startup width boundary", async () => {
513
649
  const calls = [];
514
650
  vi.resetModules();
515
- vi.doMock('../../cli/tmux-utils.js', async (importOriginal) => {
651
+ vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
516
652
  const actual = await importOriginal();
517
653
  return {
518
654
  ...actual,
519
655
  tmuxCmdAsync: vi.fn(async (args) => {
520
656
  calls.push(args);
521
- return { stdout: '39\n', stderr: '' };
657
+ return { stdout: "39\n", stderr: "" };
522
658
  }),
523
659
  tmuxExecAsync: vi.fn(async (args) => {
524
660
  calls.push(args);
525
- return { stdout: '', stderr: '' };
661
+ return { stdout: "", stderr: "" };
526
662
  }),
527
663
  };
528
664
  });
529
665
  try {
530
666
  // Stock tmux guard path, even on a win32 host with psmux installed.
531
- (await import('../psmux-adapter.js')).__setPsmuxDetectionForTests(false);
532
- const { applyMainVerticalLayout } = await import('../tmux-session.js');
533
- await expect(applyMainVerticalLayout('team-session', { required: true, tmuxServerIdentity: identity }))
534
- .rejects.toThrow('team_layout_window_width_invalid:39');
667
+ (await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
668
+ const { applyMainVerticalLayout } = await import("../tmux-session.js");
669
+ await expect(applyMainVerticalLayout("team-session", {
670
+ required: true,
671
+ tmuxServerIdentity: identity,
672
+ })).rejects.toThrow("team_layout_window_width_invalid:39");
535
673
  }
536
674
  finally {
537
- vi.doUnmock('../../cli/tmux-utils.js');
675
+ vi.doUnmock("../../cli/tmux-utils.js");
538
676
  vi.resetModules();
539
677
  }
540
678
  expect(calls).toEqual([
541
- ['-S', identity.socket_path, 'display-message', '-p', '-t', 'team-session', '#{window_width}'],
679
+ [
680
+ "-S",
681
+ identity.socket_path,
682
+ "display-message",
683
+ "-p",
684
+ "-t",
685
+ "team-session",
686
+ "#{window_width}",
687
+ ],
542
688
  ]);
543
689
  });
544
- it('never selects a best-effort layout when main-pane-width cannot be set', async () => {
690
+ it("never selects a best-effort layout when main-pane-width cannot be set", async () => {
545
691
  const calls = [];
546
692
  vi.resetModules();
547
- vi.doMock('../../cli/tmux-utils.js', async (importOriginal) => {
693
+ vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
548
694
  const actual = await importOriginal();
549
695
  return {
550
696
  ...actual,
551
697
  tmuxCmdAsync: vi.fn(async (args) => {
552
698
  calls.push(args);
553
- if (args[2] === 'if-shell') {
699
+ if (args[2] === "if-shell") {
554
700
  guardedResult(args);
555
- return { stdout: '', stderr: 'set failed' };
701
+ return { stdout: "", stderr: "set failed" };
556
702
  }
557
- return { stdout: '80\n', stderr: '' };
703
+ return { stdout: "80\n", stderr: "" };
558
704
  }),
559
705
  tmuxExecAsync: vi.fn(async (args) => {
560
706
  calls.push(args);
561
- if (args[0] === 'set-window-option')
562
- throw new Error('set failed');
563
- return { stdout: '', stderr: '' };
707
+ if (args[0] === "set-window-option")
708
+ throw new Error("set failed");
709
+ return { stdout: "", stderr: "" };
564
710
  }),
565
711
  };
566
712
  });
567
713
  try {
568
714
  // Stock tmux guard path, even on a win32 host with psmux installed.
569
- (await import('../psmux-adapter.js')).__setPsmuxDetectionForTests(false);
570
- const { applyMainVerticalLayout } = await import('../tmux-session.js');
571
- await expect(applyMainVerticalLayout('team-session', { tmuxServerIdentity: identity }))
572
- .rejects.toThrow('team_layout_server_guard_failed');
715
+ (await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
716
+ const { applyMainVerticalLayout } = await import("../tmux-session.js");
717
+ await expect(applyMainVerticalLayout("team-session", {
718
+ tmuxServerIdentity: identity,
719
+ })).rejects.toThrow("team_layout_server_guard_failed");
573
720
  }
574
721
  finally {
575
- vi.doUnmock('../../cli/tmux-utils.js');
722
+ vi.doUnmock("../../cli/tmux-utils.js");
576
723
  vi.resetModules();
577
724
  }
578
725
  expect(calls).toEqual([
579
- ['-S', identity.socket_path, 'display-message', '-p', '-t', 'team-session', '#{window_width}'],
580
- ['-S', identity.socket_path, 'if-shell', expect.any(String), expect.stringContaining("'main-pane-width' '40'"), expect.any(String)],
726
+ [
727
+ "-S",
728
+ identity.socket_path,
729
+ "display-message",
730
+ "-p",
731
+ "-t",
732
+ "team-session",
733
+ "#{window_width}",
734
+ ],
735
+ [
736
+ "-S",
737
+ identity.socket_path,
738
+ "if-shell",
739
+ expect.any(String),
740
+ expect.stringContaining("'main-pane-width' '40'"),
741
+ expect.any(String),
742
+ ],
581
743
  ]);
582
744
  });
583
745
  });
584
- describe('getDefaultShell', () => {
585
- it('uses COMSPEC on win32', () => {
746
+ describe("getDefaultShell", () => {
747
+ it("uses COMSPEC on win32", () => {
586
748
  stubNativeWindows();
587
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
588
- expect(getDefaultShell()).toBe('C:\\Windows\\System32\\cmd.exe');
589
- });
590
- it('uses SHELL on non-win32', () => {
591
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
592
- vi.stubEnv('SHELL', '/bin/zsh');
593
- expect(getDefaultShell()).toBe('/bin/zsh');
594
- });
595
- it('uses SHELL instead of COMSPEC on win32 when MSYSTEM is set (MSYS2)', () => {
596
- vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
597
- vi.stubEnv('MSYSTEM', 'MINGW64');
598
- vi.stubEnv('SHELL', '/usr/bin/bash');
599
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
600
- expect(getDefaultShell()).toBe('/usr/bin/bash');
601
- });
602
- it('uses SHELL instead of COMSPEC on win32 when MINGW_PREFIX is set', () => {
603
- vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
604
- vi.stubEnv('MINGW_PREFIX', '/mingw64');
605
- vi.stubEnv('SHELL', '/usr/bin/bash');
606
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
607
- expect(getDefaultShell()).toBe('/usr/bin/bash');
749
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
750
+ expect(getDefaultShell()).toBe("C:\\Windows\\System32\\cmd.exe");
751
+ });
752
+ it("uses SHELL on non-win32", () => {
753
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
754
+ vi.stubEnv("SHELL", "/bin/zsh");
755
+ expect(getDefaultShell()).toBe("/bin/zsh");
756
+ });
757
+ it("uses SHELL instead of COMSPEC on win32 when MSYSTEM is set (MSYS2)", () => {
758
+ vi.spyOn(process, "platform", "get").mockReturnValue("win32");
759
+ vi.stubEnv("MSYSTEM", "MINGW64");
760
+ vi.stubEnv("SHELL", "/usr/bin/bash");
761
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
762
+ expect(getDefaultShell()).toBe("/usr/bin/bash");
763
+ });
764
+ it("uses SHELL instead of COMSPEC on win32 when MINGW_PREFIX is set", () => {
765
+ vi.spyOn(process, "platform", "get").mockReturnValue("win32");
766
+ vi.stubEnv("MINGW_PREFIX", "/mingw64");
767
+ vi.stubEnv("SHELL", "/usr/bin/bash");
768
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
769
+ expect(getDefaultShell()).toBe("/usr/bin/bash");
608
770
  });
609
771
  });
610
- describe('buildWorkerStartCommand', () => {
611
- it('throws when deprecated launchCmd is used (security: C2)', () => {
612
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
613
- vi.stubEnv('SHELL', '/bin/zsh');
614
- vi.stubEnv('HOME', '/home/tester');
772
+ describe("buildWorkerStartCommand", () => {
773
+ it("throws when deprecated launchCmd is used (security: C2)", () => {
774
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
775
+ vi.stubEnv("SHELL", "/bin/zsh");
776
+ vi.stubEnv("HOME", "/home/tester");
615
777
  expect(() => buildWorkerStartCommand({
616
- teamName: 't',
617
- workerName: 'w',
618
- envVars: { A: '1' },
619
- launchCmd: 'node app.js',
620
- cwd: '/tmp'
621
- })).toThrow('launchCmd is deprecated');
622
- });
623
- it('throws when neither launchBinary nor launchCmd is provided', () => {
624
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
625
- vi.stubEnv('SHELL', '/bin/zsh');
778
+ teamName: "t",
779
+ workerName: "w",
780
+ envVars: { A: "1" },
781
+ launchCmd: "node app.js",
782
+ cwd: "/tmp",
783
+ })).toThrow("launchCmd is deprecated");
784
+ });
785
+ it("throws when neither launchBinary nor launchCmd is provided", () => {
786
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
787
+ vi.stubEnv("SHELL", "/bin/zsh");
626
788
  expect(() => buildWorkerStartCommand({
627
- teamName: 't',
628
- workerName: 'w',
789
+ teamName: "t",
790
+ workerName: "w",
629
791
  envVars: {},
630
- cwd: '/tmp'
631
- })).toThrow('Missing worker launch command');
792
+ cwd: "/tmp",
793
+ })).toThrow("Missing worker launch command");
632
794
  });
633
- it('accepts absolute Windows launchBinary paths with spaces', () => {
795
+ it("accepts absolute Windows launchBinary paths with spaces", () => {
634
796
  stubNativeWindows();
635
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
797
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
636
798
  expect(() => buildWorkerStartCommand({
637
- teamName: 't',
638
- workerName: 'w',
639
- envVars: { OMC_TEAM_WORKER: 't/w' },
640
- launchBinary: 'C:\\Program Files\\OpenAI\\Codex\\codex.exe',
641
- launchArgs: ['--full-auto'],
642
- cwd: 'C:\\repo'
799
+ teamName: "t",
800
+ workerName: "w",
801
+ envVars: { OMC_TEAM_WORKER: "t/w" },
802
+ launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
803
+ launchArgs: ["--full-auto"],
804
+ cwd: "C:\\repo",
643
805
  })).not.toThrow();
644
806
  });
645
- it('uses cmd.exe syntax for native Windows psmux worker start commands', () => {
807
+ it("uses cmd.exe syntax for native Windows psmux worker start commands", () => {
646
808
  stubNativeWindows();
647
- vi.stubEnv('PSMUX_SESSION', 'psmux-session-1');
648
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
809
+ vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
810
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
649
811
  const cmd = buildWorkerStartCommand({
650
- teamName: 't',
651
- workerName: 'w',
652
- envVars: { OMC_TEAM_WORKER: 'team/worker-1' },
653
- launchBinary: 'C:\\Users\\tester\\AppData\\Local\\Programs\\claude\\claude.exe',
654
- launchArgs: ['--agent-id', 'worker-1'],
655
- cwd: 'C:\\repo'
812
+ teamName: "t",
813
+ workerName: "w",
814
+ envVars: { OMC_TEAM_WORKER: "team/worker-1" },
815
+ launchBinary: "C:\\Users\\tester\\AppData\\Local\\Programs\\claude\\claude.exe",
816
+ launchArgs: ["--agent-id", "worker-1"],
817
+ cwd: "C:\\repo",
656
818
  });
657
819
  expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && set "OMC_TEAM_WORKER=team/worker-1" && ' +
658
820
  '"C:\\Users\\tester\\AppData\\Local\\Programs\\claude\\claude.exe" "--agent-id" "worker-1"" & exit /b');
659
- expect(cmd).not.toContain('$env:OMC_TEAM_WORKER');
821
+ expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
660
822
  });
661
- it('preserves POSIX argv-style exec while routing launch through the acknowledgement bootstrap', () => {
662
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
663
- vi.stubEnv('SHELL', '/bin/bash');
823
+ it("preserves POSIX argv-style exec while routing launch through the acknowledgement bootstrap", () => {
824
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
825
+ vi.stubEnv("SHELL", "/bin/bash");
664
826
  const cmd = buildWorkerStartCommand({
665
- teamName: 't',
666
- workerName: 'w',
667
- envVars: { OMC_TEAM_WORKER: 't/w' },
668
- launchBinary: '/opt/codex/bin/codex',
669
- launchArgs: ['--label', 'worker one'],
670
- cwd: '/tmp/team workspace',
671
- provider: 'codex',
827
+ teamName: "t",
828
+ workerName: "w",
829
+ envVars: { OMC_TEAM_WORKER: "t/w" },
830
+ launchBinary: "/opt/codex/bin/codex",
831
+ launchArgs: ["--label", "worker one"],
832
+ cwd: "/tmp/team workspace",
833
+ provider: "codex",
672
834
  launchAttempt: {
673
835
  schema_version: 1,
674
- attempt_id: '11111111-1111-4111-8111-111111111111',
675
- nonce: '22222222-2222-4222-8222-222222222222',
676
- instance_id: '33333333-3333-4333-8333-333333333333',
677
- team_name: 't',
678
- worker_name: 'w',
679
- pane_id: '%2',
680
- provider: 'codex',
681
- created_at: '2026-01-01T00:00:00.000Z',
682
- currentPath: '/tmp/current.json',
683
- expectedPath: '/tmp/expected.json',
684
- ackPath: '/tmp/ack.json',
685
- decisionPath: '/tmp/decision.json',
686
- startedPath: '/tmp/provider-started.json',
687
- transportOwnerPath: '/tmp/transport-owner.json',
688
- bootstrapDescriptorPath: '/tmp/bootstrap.json',
689
- wrapperPath: '/tmp/launch.cmd',
690
- transportCleanupCompletePath: '/tmp/transport-cleanup-complete.json',
691
- runtimeCliPath: '/opt/omc/runtime-cli.cjs',
836
+ attempt_id: "11111111-1111-4111-8111-111111111111",
837
+ nonce: "22222222-2222-4222-8222-222222222222",
838
+ instance_id: "33333333-3333-4333-8333-333333333333",
839
+ team_name: "t",
840
+ worker_name: "w",
841
+ pane_id: "%2",
842
+ provider: "codex",
843
+ created_at: "2026-01-01T00:00:00.000Z",
844
+ currentPath: "/tmp/current.json",
845
+ expectedPath: "/tmp/expected.json",
846
+ ackPath: "/tmp/ack.json",
847
+ decisionPath: "/tmp/decision.json",
848
+ startedPath: "/tmp/provider-started.json",
849
+ transportOwnerPath: "/tmp/transport-owner.json",
850
+ bootstrapDescriptorPath: "/tmp/bootstrap.json",
851
+ wrapperPath: "/tmp/launch.cmd",
852
+ transportCleanupCompletePath: "/tmp/transport-cleanup-complete.json",
853
+ runtimeCliPath: "/opt/omc/runtime-cli.cjs",
692
854
  },
693
855
  });
694
856
  // Supervised POSIX launches reference the attempt-owned descriptor by path
695
857
  // (issue #3655); the bootstrap spec itself must never travel inline.
696
858
  expect(cmd).toContain("OMC_WORKER_LAUNCH_SPEC_FILE='/tmp/bootstrap.json'");
697
- expect(cmd).not.toContain('OMC_WORKER_LAUNCH_SPEC=');
698
- expect(cmd).toContain("exec \"$@\"");
859
+ expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC=");
860
+ expect(cmd).toContain('exec "$@"');
699
861
  expect(cmd).toContain("'--worker-launch'");
700
862
  expect(cmd).toContain("'/opt/omc/runtime-cli.cjs'");
701
863
  });
702
- it('keeps provider percent/quote metacharacters out of the native Windows cmd command', () => {
864
+ it("keeps provider percent/quote metacharacters out of the native Windows cmd command", () => {
703
865
  stubNativeWindows();
704
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
866
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
705
867
  const cmd = buildWorkerStartCommand({
706
- teamName: 't',
707
- workerName: 'w',
708
- envVars: { OMC_TEAM_WORKER: 't/w' },
709
- launchBinary: 'C:\\Program Files\\Codex\\codex.exe',
710
- launchArgs: ['--label', '100% ready %USERPROFILE%', '--title="quoted"'],
711
- cwd: 'C:\\team workspace',
712
- provider: 'codex',
868
+ teamName: "t",
869
+ workerName: "w",
870
+ envVars: { OMC_TEAM_WORKER: "t/w" },
871
+ launchBinary: "C:\\Program Files\\Codex\\codex.exe",
872
+ launchArgs: ["--label", "100% ready %USERPROFILE%", '--title="quoted"'],
873
+ cwd: "C:\\team workspace",
874
+ provider: "codex",
713
875
  launchAttempt: {
714
876
  schema_version: 1,
715
- attempt_id: '11111111-1111-4111-8111-111111111111',
716
- nonce: '22222222-2222-4222-8222-222222222222',
717
- instance_id: '33333333-3333-4333-8333-333333333333',
718
- team_name: 't',
719
- worker_name: 'w',
720
- pane_id: '%2',
721
- provider: 'codex',
722
- created_at: '2026-01-01T00:00:00.000Z',
723
- currentPath: 'C:\\state\\current.json',
724
- expectedPath: 'C:\\state\\expected.json',
725
- ackPath: 'C:\\state\\ack.json',
726
- decisionPath: 'C:\\state\\decision.json',
727
- startedPath: 'C:\\state\\provider-started.json',
728
- transportOwnerPath: 'C:\\state\\transport-owner.json',
729
- bootstrapDescriptorPath: 'C:\\state\\bootstrap.json',
730
- wrapperPath: 'C:\\state\\launch.cmd',
731
- transportCleanupCompletePath: 'C:\\state\\transport-cleanup-complete.json',
732
- runtimeCliPath: 'C:\\Program Files\\omc\\runtime-cli.cjs',
877
+ attempt_id: "11111111-1111-4111-8111-111111111111",
878
+ nonce: "22222222-2222-4222-8222-222222222222",
879
+ instance_id: "33333333-3333-4333-8333-333333333333",
880
+ team_name: "t",
881
+ worker_name: "w",
882
+ pane_id: "%2",
883
+ provider: "codex",
884
+ created_at: "2026-01-01T00:00:00.000Z",
885
+ currentPath: "C:\\state\\current.json",
886
+ expectedPath: "C:\\state\\expected.json",
887
+ ackPath: "C:\\state\\ack.json",
888
+ decisionPath: "C:\\state\\decision.json",
889
+ startedPath: "C:\\state\\provider-started.json",
890
+ transportOwnerPath: "C:\\state\\transport-owner.json",
891
+ bootstrapDescriptorPath: "C:\\state\\bootstrap.json",
892
+ wrapperPath: "C:\\state\\launch.cmd",
893
+ transportCleanupCompletePath: "C:\\state\\transport-cleanup-complete.json",
894
+ runtimeCliPath: "C:\\Program Files\\omc\\runtime-cli.cjs",
733
895
  },
734
896
  });
735
- expect(cmd).toContain('C:\\Windows\\System32\\cmd.exe /d /s /c');
897
+ expect(cmd).toContain("C:\\Windows\\System32\\cmd.exe /d /s /c");
736
898
  // Supervised launches deliver the attempt-owned descriptor by path; the
737
899
  // bootstrap spec (and its percent/quote metacharacters) never travels in
738
900
  // the command line or cmd environment (issue #3655).
739
901
  expect(cmd).toContain('set "OMC_WORKER_LAUNCH_SPEC_FILE=C:\\state\\bootstrap.json"');
740
- expect(cmd).not.toContain('OMC_WORKER_LAUNCH_SPEC_B64=');
741
- expect(cmd).not.toContain('OMC_WORKER_LAUNCH_SPEC=');
742
- expect(cmd).not.toContain('100% ready %USERPROFILE%');
743
- expect(cmd).not.toContain('pane_id=%%2');
902
+ expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC_B64=");
903
+ expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC=");
904
+ expect(cmd).not.toContain("100% ready %USERPROFILE%");
905
+ expect(cmd).not.toContain("pane_id=%%2");
744
906
  });
745
- it('rejects CRLF injection in native Windows provider argv', () => {
907
+ it("rejects CRLF injection in native Windows provider argv", () => {
746
908
  stubNativeWindows();
747
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
909
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
748
910
  expect(() => buildWorkerStartCommand({
749
- teamName: 't', workerName: 'w', envVars: {},
750
- launchBinary: 'C:\\Program Files\\Cursor\\cursor-agent.exe',
751
- launchArgs: ['--model', 'safe\r\nset PWNED=1'], cwd: 'C:\\repo',
752
- })).toThrow('contains CR, LF, or NUL');
911
+ teamName: "t",
912
+ workerName: "w",
913
+ envVars: {},
914
+ launchBinary: "C:\\Program Files\\Cursor\\cursor-agent.exe",
915
+ launchArgs: ["--model", "safe\r\nset PWNED=1"],
916
+ cwd: "C:\\repo",
917
+ })).toThrow("contains CR, LF, or NUL");
753
918
  });
754
- it('escapes psmux cmd.exe env vars and quoted launch args without PowerShell syntax', () => {
919
+ it("escapes psmux cmd.exe env vars and quoted launch args without PowerShell syntax", () => {
755
920
  stubNativeWindows();
756
- vi.stubEnv('PSMUX_SESSION', 'psmux-session-1');
757
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
921
+ vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
922
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
758
923
  const cmd = buildWorkerStartCommand({
759
- teamName: 't',
760
- workerName: 'w',
924
+ teamName: "t",
925
+ workerName: "w",
761
926
  envVars: {
762
927
  OMC_TEAM_WORKER: "team name/worker 'one'",
763
- OMC_TEAM_STATE_ROOT: 'C:\\Users\\Test User\\AppData\\Local\\omc state',
928
+ OMC_TEAM_STATE_ROOT: "C:\\Users\\Test User\\AppData\\Local\\omc state",
764
929
  CLAUDE_CODE_USE_BEDROCK: 'value with spaces & [brackets] "quotes"',
765
930
  },
766
- launchBinary: 'C:\\Program Files\\Claude Code\\claude.exe',
767
- launchArgs: [
768
- '--model',
769
- 'sonnet "quoted"',
770
- "--label=worker 'one'",
771
- ],
772
- cwd: 'C:\\repo'
931
+ launchBinary: "C:\\Program Files\\Claude Code\\claude.exe",
932
+ launchArgs: ["--model", 'sonnet "quoted"', "--label=worker 'one'"],
933
+ cwd: "C:\\repo",
773
934
  });
774
- expect(cmd).toContain('set "OMC_TEAM_WORKER=team name/worker \'one\'"');
935
+ expect(cmd).toContain("set \"OMC_TEAM_WORKER=team name/worker 'one'\"");
775
936
  expect(cmd).toContain('set "OMC_TEAM_STATE_ROOT=C:\\Users\\Test User\\AppData\\Local\\omc state"');
776
937
  expect(cmd).toContain('set "CLAUDE_CODE_USE_BEDROCK=value with spaces & [brackets] ""quotes"""');
777
938
  expect(cmd).toContain('"C:\\Program Files\\Claude Code\\claude.exe" "--model" "sonnet ""quoted""" "--label=worker \'one\'"');
778
- expect(cmd).not.toContain('$env:OMC_TEAM_WORKER');
939
+ expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
779
940
  });
780
- it('escapes literal percent signs in native Windows cmd env values and launch args', () => {
941
+ it("escapes literal percent signs in native Windows cmd env values and launch args", () => {
781
942
  stubNativeWindows();
782
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
943
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
783
944
  const cmd = buildWorkerStartCommand({
784
- teamName: 't',
785
- workerName: 'w',
945
+ teamName: "t",
946
+ workerName: "w",
786
947
  envVars: {
787
- OMC_TEAM_WORKER: 'team/worker-1',
788
- OMC_TOKEN: 'literal%USERPROFILE%token%25',
948
+ OMC_TEAM_WORKER: "team/worker-1",
949
+ OMC_TOKEN: "literal%USERPROFILE%token%25",
789
950
  },
790
- launchBinary: 'C:\\Program Files\\Claude Code\\claude.exe',
791
- launchArgs: ['--label', '100% ready %USERPROFILE%', '--token=abc%25'],
792
- cwd: 'C:\\repo'
951
+ launchBinary: "C:\\Program Files\\Claude Code\\claude.exe",
952
+ launchArgs: ["--label", "100% ready %USERPROFILE%", "--token=abc%25"],
953
+ cwd: "C:\\repo",
793
954
  });
794
955
  expect(cmd).toContain('set "OMC_TOKEN=literal%%USERPROFILE%%token%%25"');
795
956
  expect(cmd).toContain('"100%% ready %%USERPROFILE%%"');
796
957
  expect(cmd).toContain('"--token=abc%%25"');
797
- expect(cmd).not.toContain('literal%USERPROFILE%token%25');
958
+ expect(cmd).not.toContain("literal%USERPROFILE%token%25");
798
959
  });
799
- it('base64-encodes recovery gate launch identities for native Windows cmd', () => {
960
+ it("base64-encodes recovery gate launch identities for native Windows cmd", () => {
800
961
  stubNativeWindows();
801
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
802
- const gate = { recoveryId: 'recovery-1', launchAttempt: { attempt_id: 'attempt-1', nonce: 'nonce-1', pane_id: '%2' } };
962
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
963
+ const gate = {
964
+ recoveryId: "recovery-1",
965
+ launchAttempt: {
966
+ attempt_id: "attempt-1",
967
+ nonce: "nonce-1",
968
+ pane_id: "%2",
969
+ },
970
+ };
803
971
  const cmd = buildWorkerStartCommand({
804
- teamName: 't',
805
- workerName: 'w',
972
+ teamName: "t",
973
+ workerName: "w",
806
974
  envVars: { OMC_RECOVERY_GATE_SPEC: JSON.stringify(gate) },
807
- launchBinary: 'C:\\Program Files\\nodejs\\node.exe',
808
- launchArgs: ['C:\\omc\\runtime-cli.cjs', '--recovery-gate'],
809
- cwd: 'C:\\repo',
975
+ launchBinary: "C:\\Program Files\\nodejs\\node.exe",
976
+ launchArgs: ["C:\\omc\\runtime-cli.cjs", "--recovery-gate"],
977
+ cwd: "C:\\repo",
810
978
  });
811
979
  const marker = 'set "OMC_RECOVERY_GATE_SPEC_B64=';
812
980
  const encodedStart = cmd.indexOf(marker) + marker.length;
813
981
  const encodedEnd = cmd.indexOf('" &&', encodedStart);
814
- expect(JSON.parse(Buffer.from(cmd.slice(encodedStart, encodedEnd), 'base64').toString('utf8')))
815
- .toMatchObject({ launchAttempt: { pane_id: '%2' } });
816
- expect(cmd).not.toContain('OMC_RECOVERY_GATE_SPEC=');
817
- expect(cmd).not.toContain('pane_id=%%2');
982
+ expect(JSON.parse(Buffer.from(cmd.slice(encodedStart, encodedEnd), "base64").toString("utf8"))).toMatchObject({ launchAttempt: { pane_id: "%2" } });
983
+ expect(cmd).not.toContain("OMC_RECOVERY_GATE_SPEC=");
984
+ expect(cmd).not.toContain("pane_id=%%2");
818
985
  });
819
- it('does not cmd-escape percent signs on MSYS Windows worker startup', () => {
986
+ it("does not cmd-escape percent signs on MSYS Windows worker startup", () => {
820
987
  stubNativeWindows();
821
- vi.stubEnv('PSMUX_SESSION', 'psmux-session-1');
822
- vi.stubEnv('MSYSTEM', 'MINGW64');
823
- vi.stubEnv('SHELL', '/usr/bin/bash');
824
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
988
+ vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
989
+ vi.stubEnv("MSYSTEM", "MINGW64");
990
+ vi.stubEnv("SHELL", "/usr/bin/bash");
991
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
825
992
  const cmd = buildWorkerStartCommand({
826
- teamName: 't',
827
- workerName: 'w',
828
- envVars: { OMC_TOKEN: 'literal%USERPROFILE%token%25' },
829
- launchBinary: '/c/Program Files/Git/bin/bash.exe',
830
- launchArgs: ['--label=100% ready'],
831
- cwd: '/c/repo'
993
+ teamName: "t",
994
+ workerName: "w",
995
+ envVars: { OMC_TOKEN: "literal%USERPROFILE%token%25" },
996
+ launchBinary: "/c/Program Files/Git/bin/bash.exe",
997
+ launchArgs: ["--label=100% ready"],
998
+ cwd: "/c/repo",
832
999
  });
833
1000
  expect(cmd).toContain("OMC_TOKEN='literal%USERPROFILE%token%25'");
834
1001
  expect(cmd).toContain("'--label=100% ready'");
835
- expect(cmd).not.toContain('%%USERPROFILE%%');
1002
+ expect(cmd).not.toContain("%%USERPROFILE%%");
836
1003
  });
837
- it('keeps cmd.exe worker startup syntax for native Windows without psmux', () => {
1004
+ it("keeps cmd.exe worker startup syntax for native Windows without psmux", () => {
838
1005
  stubNativeWindows();
839
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
1006
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
840
1007
  const cmd = buildWorkerStartCommand({
841
- teamName: 't',
842
- workerName: 'w',
843
- envVars: { OMC_TEAM_WORKER: 'team/worker-1' },
844
- launchBinary: 'C:\\Program Files\\OpenAI\\Codex\\codex.exe',
845
- launchArgs: ['--full-auto'],
846
- cwd: 'C:\\repo'
1008
+ teamName: "t",
1009
+ workerName: "w",
1010
+ envVars: { OMC_TEAM_WORKER: "team/worker-1" },
1011
+ launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
1012
+ launchArgs: ["--full-auto"],
1013
+ cwd: "C:\\repo",
847
1014
  });
848
1015
  expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && set "OMC_TEAM_WORKER=team/worker-1" && ' +
849
1016
  '"C:\\Program Files\\OpenAI\\Codex\\codex.exe" "--full-auto"" & exit /b');
850
1017
  });
851
- it('turns off the cwd executable search in the cmd.exe fallback even when the caller sets it to 0', () => {
1018
+ it("turns off the cwd executable search in the cmd.exe fallback even when the caller sets it to 0", () => {
852
1019
  stubNativeWindows();
853
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
1020
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
854
1021
  const cmd = buildWorkerStartCommand({
855
- teamName: 't',
856
- workerName: 'w',
857
- envVars: { nodefaultcurrentdirectoryinexepath: '0' },
858
- launchBinary: 'C:\\Program Files\\OpenAI\\Codex\\codex.exe',
1022
+ teamName: "t",
1023
+ workerName: "w",
1024
+ envVars: { nodefaultcurrentdirectoryinexepath: "0" },
1025
+ launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
859
1026
  launchArgs: [],
860
- cwd: 'C:\\repo'
1027
+ cwd: "C:\\repo",
861
1028
  });
862
1029
  expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && ' +
863
1030
  '"C:\\Program Files\\OpenAI\\Codex\\codex.exe"" & exit /b');
864
1031
  });
865
- it('keeps MSYS/Git Bash worker startup syntax even when psmux env is present', () => {
1032
+ it("keeps MSYS/Git Bash worker startup syntax even when psmux env is present", () => {
866
1033
  stubNativeWindows();
867
- vi.stubEnv('PSMUX_SESSION', 'psmux-session-1');
868
- vi.stubEnv('MSYSTEM', 'MINGW64');
869
- vi.stubEnv('SHELL', '/usr/bin/bash');
870
- vi.stubEnv('COMSPEC', 'C:\\Windows\\System32\\cmd.exe');
1034
+ vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
1035
+ vi.stubEnv("MSYSTEM", "MINGW64");
1036
+ vi.stubEnv("SHELL", "/usr/bin/bash");
1037
+ vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
871
1038
  const cmd = buildWorkerStartCommand({
872
- teamName: 't',
873
- workerName: 'w',
874
- envVars: { OMC_TEAM_WORKER: 'team/worker-1' },
875
- launchBinary: '/c/Program Files/Git/bin/bash.exe',
876
- launchArgs: ['--login'],
877
- cwd: '/c/repo'
1039
+ teamName: "t",
1040
+ workerName: "w",
1041
+ envVars: { OMC_TEAM_WORKER: "team/worker-1" },
1042
+ launchBinary: "/c/Program Files/Git/bin/bash.exe",
1043
+ launchArgs: ["--login"],
1044
+ cwd: "/c/repo",
878
1045
  });
879
1046
  expect(cmd).toContain("'env' OMC_TEAM_WORKER='team/worker-1'");
880
1047
  expect(cmd).toContain("'/usr/bin/bash' '-lc'");
881
1048
  expect(cmd).toContain("'--' '/c/Program Files/Git/bin/bash.exe' '--login'");
882
- expect(cmd).not.toContain('/d /s /c');
883
- expect(cmd).not.toContain('$env:OMC_TEAM_WORKER');
1049
+ expect(cmd).not.toContain("/d /s /c");
1050
+ expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
884
1051
  });
885
1052
  it('uses exec \"$@\" for launchBinary with non-fish shells', () => {
886
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
887
- vi.stubEnv('SHELL', '/bin/zsh');
888
- vi.stubEnv('HOME', '/home/tester');
1053
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1054
+ vi.stubEnv("SHELL", "/bin/zsh");
1055
+ vi.stubEnv("HOME", "/home/tester");
889
1056
  const cmd = buildWorkerStartCommand({
890
- teamName: 't',
891
- workerName: 'w',
892
- envVars: { OMC_TEAM_WORKER: 't/w' },
893
- launchBinary: 'codex',
894
- launchArgs: ['--full-auto'],
895
- cwd: '/tmp'
1057
+ teamName: "t",
1058
+ workerName: "w",
1059
+ envVars: { OMC_TEAM_WORKER: "t/w" },
1060
+ launchBinary: "codex",
1061
+ launchArgs: ["--full-auto"],
1062
+ cwd: "/tmp",
896
1063
  });
897
- expect(cmd).toContain("exec \"$@\"");
1064
+ expect(cmd).toContain('exec "$@"');
898
1065
  expect(cmd).toContain("'--' 'codex' '--full-auto'");
899
1066
  });
900
- it('uses exec $argv for launchBinary with fish shell', () => {
901
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
902
- vi.stubEnv('SHELL', '/usr/bin/fish');
903
- vi.stubEnv('HOME', '/home/tester');
1067
+ it("uses exec $argv for launchBinary with fish shell", () => {
1068
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1069
+ vi.stubEnv("SHELL", "/usr/bin/fish");
1070
+ vi.stubEnv("HOME", "/home/tester");
904
1071
  const cmd = buildWorkerStartCommand({
905
- teamName: 't',
906
- workerName: 'w',
907
- envVars: { OMC_TEAM_WORKER: 't/w' },
908
- launchBinary: 'codex',
909
- launchArgs: ['--full-auto'],
910
- cwd: '/tmp'
1072
+ teamName: "t",
1073
+ workerName: "w",
1074
+ envVars: { OMC_TEAM_WORKER: "t/w" },
1075
+ launchBinary: "codex",
1076
+ launchArgs: ["--full-auto"],
1077
+ cwd: "/tmp",
911
1078
  });
912
- expect(cmd).toContain('exec $argv');
1079
+ expect(cmd).toContain("exec $argv");
913
1080
  expect(cmd).not.toContain('exec "$@"');
914
1081
  expect(cmd).toContain("'--' 'codex' '--full-auto'");
915
1082
  // Fish uses separate -l -c flags (not combined -lc)
916
1083
  expect(cmd).toContain("'-l' '-c'");
917
1084
  expect(cmd).not.toContain("'-lc'");
918
1085
  // Fish sources ~/.config/fish/config.fish, not ~/.fishrc
919
- expect(cmd).toContain('.config/fish/config.fish');
920
- expect(cmd).not.toContain('.fishrc');
1086
+ expect(cmd).toContain(".config/fish/config.fish");
1087
+ expect(cmd).not.toContain(".fishrc");
921
1088
  // Fish uses test/and syntax, not [ ] && .
922
- expect(cmd).toContain('test -f');
923
- expect(cmd).toContain('; and source');
1089
+ expect(cmd).toContain("test -f");
1090
+ expect(cmd).toContain("; and source");
924
1091
  });
925
- it('does not double-escape env vars in launchBinary mode (issue #1415)', () => {
926
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
927
- vi.stubEnv('SHELL', '/bin/zsh');
928
- vi.stubEnv('HOME', '/home/tester');
1092
+ it("does not double-escape env vars in launchBinary mode (issue #1415)", () => {
1093
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1094
+ vi.stubEnv("SHELL", "/bin/zsh");
1095
+ vi.stubEnv("HOME", "/home/tester");
929
1096
  const cmd = buildWorkerStartCommand({
930
- teamName: 't',
931
- workerName: 'w',
1097
+ teamName: "t",
1098
+ workerName: "w",
932
1099
  envVars: {
933
- ANTHROPIC_MODEL: 'us.anthropic.claude-sonnet-4-6-v1[1m]',
934
- CLAUDE_CODE_USE_BEDROCK: '1',
1100
+ ANTHROPIC_MODEL: "us.anthropic.claude-sonnet-4-6-v1[1m]",
1101
+ CLAUDE_CODE_USE_BEDROCK: "1",
935
1102
  },
936
- launchBinary: '/usr/local/bin/claude',
937
- launchArgs: ['--dangerously-skip-permissions'],
938
- cwd: '/tmp'
1103
+ launchBinary: "/usr/local/bin/claude",
1104
+ launchArgs: ["--dangerously-skip-permissions"],
1105
+ cwd: "/tmp",
939
1106
  });
940
1107
  // env assignments must appear WITHOUT extra wrapping quotes.
941
1108
  // Correct: ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-6-v1[1m]'
@@ -947,330 +1114,330 @@ describe('buildWorkerStartCommand', () => {
947
1114
  expect(cmd).toContain("'/usr/local/bin/claude'");
948
1115
  expect(cmd).toContain("'--dangerously-skip-permissions'");
949
1116
  });
950
- it('env vars with special characters survive single escaping correctly', () => {
951
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
952
- vi.stubEnv('SHELL', '/bin/bash');
953
- vi.stubEnv('HOME', '/home/tester');
1117
+ it("env vars with special characters survive single escaping correctly", () => {
1118
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1119
+ vi.stubEnv("SHELL", "/bin/bash");
1120
+ vi.stubEnv("HOME", "/home/tester");
954
1121
  const cmd = buildWorkerStartCommand({
955
- teamName: 't',
956
- workerName: 'w',
1122
+ teamName: "t",
1123
+ workerName: "w",
957
1124
  envVars: {
958
- OMC_TEAM_WORKER: 'my-team/worker-1',
959
- ANTHROPIC_DEFAULT_SONNET_MODEL: 'global.anthropic.claude-sonnet-4-6[1m]',
1125
+ OMC_TEAM_WORKER: "my-team/worker-1",
1126
+ ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6[1m]",
960
1127
  },
961
- launchBinary: '/usr/local/bin/claude',
1128
+ launchBinary: "/usr/local/bin/claude",
962
1129
  launchArgs: [],
963
- cwd: '/tmp'
1130
+ cwd: "/tmp",
964
1131
  });
965
1132
  // Values with / and [] must be preserved without extra quoting
966
1133
  expect(cmd).toContain("OMC_TEAM_WORKER='my-team/worker-1'");
967
1134
  expect(cmd).toContain("ANTHROPIC_DEFAULT_SONNET_MODEL='global.anthropic.claude-sonnet-4-6[1m]'");
968
1135
  });
969
- it('rejects relative launchBinary containing spaces', () => {
970
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
1136
+ it("rejects relative launchBinary containing spaces", () => {
1137
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
971
1138
  expect(() => buildWorkerStartCommand({
972
- teamName: 't',
973
- workerName: 'w',
1139
+ teamName: "t",
1140
+ workerName: "w",
974
1141
  envVars: {},
975
- launchBinary: 'Program Files/codex',
976
- cwd: '/tmp'
977
- })).toThrow('Invalid launchBinary: paths with spaces must be absolute');
1142
+ launchBinary: "Program Files/codex",
1143
+ cwd: "/tmp",
1144
+ })).toThrow("Invalid launchBinary: paths with spaces must be absolute");
978
1145
  });
979
- it('rejects dangerous shell metacharacters in launchBinary', () => {
980
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
1146
+ it("rejects dangerous shell metacharacters in launchBinary", () => {
1147
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
981
1148
  expect(() => buildWorkerStartCommand({
982
- teamName: 't',
983
- workerName: 'w',
1149
+ teamName: "t",
1150
+ workerName: "w",
984
1151
  envVars: {},
985
- launchBinary: '/usr/bin/codex;touch /tmp/pwn',
986
- cwd: '/tmp'
987
- })).toThrow('Invalid launchBinary: contains dangerous shell metacharacters');
1152
+ launchBinary: "/usr/bin/codex;touch /tmp/pwn",
1153
+ cwd: "/tmp",
1154
+ })).toThrow("Invalid launchBinary: contains dangerous shell metacharacters");
988
1155
  });
989
1156
  });
990
- describe('shouldAttemptAdaptiveRetry', () => {
991
- it('only enables adaptive retry for busy panes with visible unsent message', () => {
1157
+ describe("shouldAttemptAdaptiveRetry", () => {
1158
+ it("only enables adaptive retry for busy panes with visible unsent message", () => {
992
1159
  delete process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY;
993
1160
  expect(shouldAttemptAdaptiveRetry({
994
1161
  paneBusy: false,
995
- latestCapture: '❯ check-inbox',
996
- message: 'check-inbox',
1162
+ latestCapture: "❯ check-inbox",
1163
+ message: "check-inbox",
997
1164
  paneInCopyMode: false,
998
1165
  retriesAttempted: 0,
999
1166
  })).toBe(false);
1000
1167
  expect(shouldAttemptAdaptiveRetry({
1001
1168
  paneBusy: true,
1002
- latestCapture: '❯ ready prompt',
1003
- message: 'check-inbox',
1169
+ latestCapture: "❯ ready prompt",
1170
+ message: "check-inbox",
1004
1171
  paneInCopyMode: false,
1005
1172
  retriesAttempted: 0,
1006
1173
  })).toBe(false);
1007
1174
  expect(shouldAttemptAdaptiveRetry({
1008
1175
  paneBusy: true,
1009
- latestCapture: '❯ check-inbox',
1010
- message: 'check-inbox',
1176
+ latestCapture: "❯ check-inbox",
1177
+ message: "check-inbox",
1011
1178
  paneInCopyMode: true,
1012
1179
  retriesAttempted: 0,
1013
1180
  })).toBe(false);
1014
1181
  expect(shouldAttemptAdaptiveRetry({
1015
1182
  paneBusy: true,
1016
- latestCapture: '❯ check-inbox',
1017
- message: 'check-inbox',
1183
+ latestCapture: "❯ check-inbox",
1184
+ message: "check-inbox",
1018
1185
  paneInCopyMode: false,
1019
1186
  retriesAttempted: 1,
1020
1187
  })).toBe(false);
1021
1188
  expect(shouldAttemptAdaptiveRetry({
1022
1189
  paneBusy: true,
1023
- latestCapture: '❯ check-inbox\ngpt-5.3-codex high · 80% left',
1024
- message: 'check-inbox',
1190
+ latestCapture: "❯ check-inbox\ngpt-5.3-codex high · 80% left",
1191
+ message: "check-inbox",
1025
1192
  paneInCopyMode: false,
1026
1193
  retriesAttempted: 0,
1027
1194
  })).toBe(true);
1028
1195
  });
1029
- it('respects OMC_TEAM_AUTO_INTERRUPT_RETRY=0', () => {
1030
- process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY = '0';
1196
+ it("respects OMC_TEAM_AUTO_INTERRUPT_RETRY=0", () => {
1197
+ process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY = "0";
1031
1198
  expect(shouldAttemptAdaptiveRetry({
1032
1199
  paneBusy: true,
1033
- latestCapture: '❯ check-inbox',
1034
- message: 'check-inbox',
1200
+ latestCapture: "❯ check-inbox",
1201
+ message: "check-inbox",
1035
1202
  paneInCopyMode: false,
1036
1203
  retriesAttempted: 0,
1037
1204
  })).toBe(false);
1038
1205
  delete process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY;
1039
1206
  });
1040
1207
  });
1041
- describe('pane readiness startup banners', () => {
1042
- it('does not treat Claude bypass-permissions startup banner as ready', () => {
1208
+ describe("pane readiness startup banners", () => {
1209
+ it("does not treat Claude bypass-permissions startup banner as ready", () => {
1043
1210
  const capture = [
1044
- 'Read .omg/state/team/example/workers/worker-1/inbox.md, execute now, report concrete progress.',
1045
- '─────────────────────────────────────────────',
1046
- '[OMC] Starting...',
1047
- '⏵⏵ bypass permissions on (shift+tab to cycle)',
1048
- ].join('\n');
1211
+ "Read .omg/state/team/example/workers/worker-1/inbox.md, execute now, report concrete progress.",
1212
+ "─────────────────────────────────────────────",
1213
+ "[OMC] Starting...",
1214
+ "⏵⏵ bypass permissions on (shift+tab to cycle)",
1215
+ ].join("\n");
1049
1216
  expect(paneLooksReady(capture)).toBe(false);
1050
1217
  });
1051
- it('treats an exact directory trust selector as ready for legacy delivery', () => {
1218
+ it("treats an exact directory trust selector as ready for legacy delivery", () => {
1052
1219
  const capture = [
1053
- 'Do you trust the contents of this directory?',
1054
- '› 1. Yes, continue',
1055
- ' 2. No, quit',
1056
- ].join('\n');
1220
+ "Do you trust the contents of this directory?",
1221
+ "› 1. Yes, continue",
1222
+ " 2. No, quit",
1223
+ ].join("\n");
1057
1224
  expect(paneHasTrustPrompt(capture)).toBe(true);
1058
1225
  expect(paneLooksReady(capture)).toBe(true);
1059
1226
  expect(paneHasActiveTask(capture)).toBe(false);
1060
1227
  });
1061
- it('detects Codex CLI hook-trust review screen as a trust prompt', () => {
1228
+ it("detects Codex CLI hook-trust review screen as a trust prompt", () => {
1062
1229
  const capture = [
1063
- ' Hooks need review',
1064
- ' 3 hooks are new or changed.',
1065
- ' Hooks can run outside the sandbox after you trust them.',
1066
- '',
1067
- '› 1. Review hooks',
1068
- ' 2. Trust all and continue',
1230
+ " Hooks need review",
1231
+ " 3 hooks are new or changed.",
1232
+ " Hooks can run outside the sandbox after you trust them.",
1233
+ "",
1234
+ "› 1. Review hooks",
1235
+ " 2. Trust all and continue",
1069
1236
  " 3. Continue without trusting (hooks won't run)",
1070
- '',
1071
- ' Press enter to confirm or esc to go back',
1072
- ].join('\n');
1237
+ "",
1238
+ " Press enter to confirm or esc to go back",
1239
+ ].join("\n");
1073
1240
  expect(paneHasTrustPrompt(capture)).toBe(true);
1074
1241
  expect(paneLooksReady(capture)).toBe(true);
1075
1242
  expect(paneHasActiveTask(capture)).toBe(false);
1076
1243
  });
1077
- it('detects the cursor-agent workspace-trust banner and refuses to call it ready', () => {
1244
+ it("detects the cursor-agent workspace-trust banner and refuses to call it ready", () => {
1078
1245
  // Verbatim capture from `cursor-agent` launched in tmux on an untrusted
1079
1246
  // directory. It offers no numbered choice and the process exits, unlike
1080
1247
  // the dismissible Claude/Codex prompts above.
1081
1248
  const capture = [
1082
- '⚠ Workspace Trust Required',
1083
- '',
1084
- ' Cursor Agent can execute code and access files in this directory.',
1085
- ' Do you trust the contents of this directory?',
1086
- '',
1087
- ' /private/tmp/ct-nf2',
1088
- '',
1089
- ' To proceed, you can either:',
1249
+ "⚠ Workspace Trust Required",
1250
+ "",
1251
+ " Cursor Agent can execute code and access files in this directory.",
1252
+ " Do you trust the contents of this directory?",
1253
+ "",
1254
+ " /private/tmp/ct-nf2",
1255
+ "",
1256
+ " To proceed, you can either:",
1090
1257
  " • Run 'agent' interactively to decide",
1091
- ' • Pass --trust, --yolo, or -f if you trust this directory',
1092
- ].join('\n');
1258
+ " • Pass --trust, --yolo, or -f if you trust this directory",
1259
+ ].join("\n");
1093
1260
  expect(paneHasTrustPrompt(capture)).toBe(true);
1094
1261
  // The pane is dead: treating it as ready would hand work to a gone process.
1095
- expect(paneLooksReady(capture, 'cursor')).toBe(false);
1096
- expect(paneHasActiveTask(capture, 'cursor')).toBe(false);
1262
+ expect(paneLooksReady(capture, "cursor")).toBe(false);
1263
+ expect(paneHasActiveTask(capture, "cursor")).toBe(false);
1097
1264
  });
1098
- it('gives the Cursor trust banner precedence and keeps it provider-scoped', () => {
1265
+ it("gives the Cursor trust banner precedence and keeps it provider-scoped", () => {
1099
1266
  const capture = [
1100
- '⚠ Workspace Trust Required',
1101
- 'Do you trust the contents of this directory?',
1102
- '› 1. Yes, continue',
1103
- ' 2. No, quit',
1267
+ "⚠ Workspace Trust Required",
1268
+ "Do you trust the contents of this directory?",
1269
+ "› 1. Yes, continue",
1270
+ " 2. No, quit",
1104
1271
  " • Pass --trust, --yolo, or -f if you trust this directory",
1105
- ].join('\n');
1106
- expect(paneHasTrustPrompt(capture, 'cursor')).toBe(true);
1107
- expect(paneLooksReady(capture, 'cursor')).toBe(false);
1108
- expect(paneLooksReady(capture, 'claude')).toBe(true);
1272
+ ].join("\n");
1273
+ expect(paneHasTrustPrompt(capture, "cursor")).toBe(true);
1274
+ expect(paneLooksReady(capture, "cursor")).toBe(false);
1275
+ expect(paneLooksReady(capture, "claude")).toBe(true);
1109
1276
  });
1110
1277
  // Fork fix: verbatim Copilot CLI 1.0.91 idle capture from a psmux pane.
1111
- it('treats the Copilot CLI 1.0.9x empty input box as ready for copilot only', () => {
1278
+ it("treats the Copilot CLI 1.0.9x empty input box as ready for copilot only", () => {
1112
1279
  const capture = [
1113
- ' ╭─╮╭─╮',
1114
- ' ╰─╯╰─╯ Copilot v1.0.91 uses AI.',
1115
- ' █ ▘▝ █ Check for mistakes.',
1116
- ' ● MCP Servers reloaded: 2 servers connected',
1117
- ' ~\\AppData\\L... [⎇ master%] Session: 0 AIC used',
1118
- '╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄',
1119
- '┃',
1120
- '╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀',
1121
- ' ← open ·Interactive · · / commands · ? help',
1122
- ' sidebar Allow All · tab next tab',
1123
- ' GitHub Copilot • Auto',
1124
- ].join('\n');
1125
- expect(paneLooksReady(capture, 'copilot')).toBe(true);
1126
- expect(paneLooksReady(capture, 'claude')).toBe(false);
1127
- expect(paneLooksReady(capture.replace('\n┃\n', '\n┃ typing\n'), 'copilot')).toBe(false);
1128
- });
1129
- it('treats the Copilot CLI 1.0.9x working status line as an active task', () => {
1280
+ " ╭─╮╭─╮",
1281
+ " ╰─╯╰─╯ Copilot v1.0.91 uses AI.",
1282
+ " █ ▘▝ █ Check for mistakes.",
1283
+ " ● MCP Servers reloaded: 2 servers connected",
1284
+ " ~\\AppData\\L... [⎇ master%] Session: 0 AIC used",
1285
+ "╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
1286
+ "┃",
1287
+ "╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
1288
+ " ← open ·Interactive · · / commands · ? help",
1289
+ " sidebar Allow All · tab next tab",
1290
+ " GitHub Copilot • Auto",
1291
+ ].join("\n");
1292
+ expect(paneLooksReady(capture, "copilot")).toBe(true);
1293
+ expect(paneLooksReady(capture, "claude")).toBe(false);
1294
+ expect(paneLooksReady(capture.replace("\n┃\n", "\n┃ typing\n"), "copilot")).toBe(false);
1295
+ });
1296
+ it("treats the Copilot CLI 1.0.9x working status line as an active task", () => {
1130
1297
  const capture = [
1131
- ' ❯ Read .omg/state/team/t/workers/worker-1/inbox.md, execute now',
1132
- ' ○ skill(lean-ctx)',
1133
- '╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄',
1134
- '┃',
1135
- '╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀',
1136
- ' ○ Working · 25 B esc interrupt',
1137
- ' GitHub Copilot • Auto → gpt-6-luna',
1138
- ].join('\n');
1139
- expect(paneHasActiveTask(capture, 'copilot')).toBe(true);
1140
- expect(paneHasActiveTask(capture, 'claude')).toBe(false);
1141
- expect(paneHasActiveTask(capture.replace('○ Working · 25 B esc interrupt', '◉ Working esc edit prompt'), 'copilot')).toBe(true);
1142
- expect(paneHasActiveTask(capture.replace(' ○ Working · 25 B esc interrupt\n', ''), 'copilot')).toBe(false);
1143
- });
1144
- it('still treats actual prompt lines as ready', () => {
1145
- expect(paneLooksReady('Welcome\n❯ ')).toBe(true);
1146
- expect(paneLooksReady('Welcome\n> ')).toBe(true);
1147
- expect(paneLooksReady('⏵⏵ bypass permissions on (shift+tab to cycle)\nReady\n❯ ')).toBe(true);
1148
- });
1149
- it('treats Claude Code v2.1.x idle pane (prompt above persistent mode indicator) as ready', () => {
1298
+ " ❯ Read .omg/state/team/t/workers/worker-1/inbox.md, execute now",
1299
+ " ○ skill(lean-ctx)",
1300
+ "╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
1301
+ "┃",
1302
+ "╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
1303
+ " ○ Working · 25 B esc interrupt",
1304
+ " GitHub Copilot • Auto → gpt-6-luna",
1305
+ ].join("\n");
1306
+ expect(paneHasActiveTask(capture, "copilot")).toBe(true);
1307
+ expect(paneHasActiveTask(capture, "claude")).toBe(false);
1308
+ expect(paneHasActiveTask(capture.replace("○ Working · 25 B esc interrupt", "◉ Working esc edit prompt"), "copilot")).toBe(true);
1309
+ expect(paneHasActiveTask(capture.replace(" ○ Working · 25 B esc interrupt\n", ""), "copilot")).toBe(false);
1310
+ });
1311
+ it("still treats actual prompt lines as ready", () => {
1312
+ expect(paneLooksReady("Welcome\n❯ ")).toBe(true);
1313
+ expect(paneLooksReady("Welcome\n> ")).toBe(true);
1314
+ expect(paneLooksReady("⏵⏵ bypass permissions on (shift+tab to cycle)\nReady\n❯ ")).toBe(true);
1315
+ });
1316
+ it("treats Claude Code v2.1.x idle pane (prompt above persistent mode indicator) as ready", () => {
1150
1317
  // Claude Code v2.1.142 renders the permission-mode indicator
1151
1318
  // ("⏵⏵ bypass permissions on (shift+tab to cycle)") *below* the prompt
1152
1319
  // as a persistent idle-state UI element. Before this fix, the pane was
1153
1320
  // misread as still bootstrapping and OMC never dispatched the inbox to
1154
1321
  // claude workers, leaving them hung with "[OMC] Starting..." forever.
1155
1322
  const capture = [
1156
- '▐▛███▜▌ Claude Code v2.1.142',
1157
- '▝▜█████▛▘ Opus 4.7 (1M context) · Claude Max',
1158
- ' ▘▘ ▝▝ ~/some/repo',
1159
- '',
1160
- '───────────────────────────────────────',
1161
- '❯ ',
1162
- '───────────────────────────────────────',
1163
- ' ⏵⏵ bypass permissions on (shift+tab to cycle)',
1164
- ].join('\n');
1323
+ "▐▛███▜▌ Claude Code v2.1.142",
1324
+ "▝▜█████▛▘ Opus 4.7 (1M context) · Claude Max",
1325
+ " ▘▘ ▝▝ ~/some/repo",
1326
+ "",
1327
+ "───────────────────────────────────────",
1328
+ "❯ ",
1329
+ "───────────────────────────────────────",
1330
+ " ⏵⏵ bypass permissions on (shift+tab to cycle)",
1331
+ ].join("\n");
1165
1332
  expect(paneLooksReady(capture)).toBe(true);
1166
1333
  expect(paneHasActiveTask(capture)).toBe(false);
1167
1334
  });
1168
- it('treats Claude idle prompt inside the TUI gutter as ready for initial dispatch', () => {
1335
+ it("treats Claude idle prompt inside the TUI gutter as ready for initial dispatch", () => {
1169
1336
  const capture = [
1170
- '╭────────────────────────────────────────────────────────╮',
1171
- '│ ✻ Welcome to Claude Code v2.1.142 │',
1172
- '│ │',
1173
- '│ ❯ │',
1174
- '╰────────────────────────────────────────────────────────╯',
1175
- ' ⏵⏵ bypass permissions on (shift+tab to cycle)',
1176
- ].join('\n');
1337
+ "╭────────────────────────────────────────────────────────╮",
1338
+ "│ ✻ Welcome to Claude Code v2.1.142 │",
1339
+ "│ │",
1340
+ "│ ❯ │",
1341
+ "╰────────────────────────────────────────────────────────╯",
1342
+ " ⏵⏵ bypass permissions on (shift+tab to cycle)",
1343
+ ].join("\n");
1177
1344
  expect(paneLooksReady(capture)).toBe(true);
1178
1345
  expect(paneHasActiveTask(capture)).toBe(false);
1179
1346
  });
1180
- it('still flags Claude Code v2.1.x mid-task panes via paneHasActiveTask', () => {
1347
+ it("still flags Claude Code v2.1.x mid-task panes via paneHasActiveTask", () => {
1181
1348
  // Same v2.1.x pane shape with a spinner + "esc to interrupt" — paneLooksReady
1182
1349
  // sees the prompt and reports ready, but waitForPaneReady's secondary
1183
1350
  // paneHasActiveTask guard catches the in-flight task and keeps the worker
1184
1351
  // from being treated as idle.
1185
1352
  const capture = [
1186
- '❯ Run the migration',
1187
- '· Thinking…',
1188
- ' esc to interrupt',
1189
- ' ⏵⏵ bypass permissions on (shift+tab to cycle)',
1190
- ].join('\n');
1353
+ "❯ Run the migration",
1354
+ "· Thinking…",
1355
+ " esc to interrupt",
1356
+ " ⏵⏵ bypass permissions on (shift+tab to cycle)",
1357
+ ].join("\n");
1191
1358
  expect(paneLooksReady(capture)).toBe(true);
1192
1359
  expect(paneHasActiveTask(capture)).toBe(true);
1193
1360
  });
1194
- it.each(['✢', '✳', '✶', '✽', '✺', '✹', '✸', '✷', '*'])('treats Claude Code spinner glyph %s as an active task', (glyph) => {
1361
+ it.each(["✢", "✳", "✶", "✽", "✺", "✹", "✸", "✷", "*"])("treats Claude Code spinner glyph %s as an active task", (glyph) => {
1195
1362
  expect(paneHasActiveTask(`${glyph} Compacting…`)).toBe(true);
1196
1363
  });
1197
- it('treats a Claude Code spinner status suffix as an active task', () => {
1198
- expect(paneHasActiveTask('✻ Compacting… (12 tokens, 3s)')).toBe(true);
1364
+ it("treats a Claude Code spinner status suffix as an active task", () => {
1365
+ expect(paneHasActiveTask("✻ Compacting… (12 tokens, 3s)")).toBe(true);
1199
1366
  });
1200
1367
  });
1201
- describe('sendToWorker implementation guards', () => {
1202
- const source = readFileSync(join(__dirname, '..', 'tmux-session.ts'), 'utf-8');
1203
- it('points the readiness timeout hint at the env var the worker wait reads', () => {
1204
- expect(source).not.toContain('OMC_SHELL_READY_TIMEOUT_MS');
1205
- expect(source).toContain('set OMC_TEAM_READY_TIMEOUT_MS to tune');
1206
- expect(source).toContain('30_000');
1207
- });
1208
- it('checks and exits tmux copy-mode before injection', () => {
1209
- expect(source).toContain('#{pane_in_mode}');
1210
- expect(source).toContain('skip injection entirely');
1211
- });
1212
- it('supports env-gated adaptive interrupt retry', () => {
1213
- expect(source).toContain('OMC_TEAM_AUTO_INTERRUPT_RETRY');
1214
- expect(source).toContain("sendSubmitKey('C-u')");
1215
- });
1216
- it('re-checks copy-mode before adaptive and final fallback keys', () => {
1217
- expect(source).toContain('Safety gate: copy-mode can turn on while we retry');
1218
- expect(source).toContain('Before fallback control keys, re-check copy-mode');
1219
- expect(source).toContain('Fail-closed: one final submit attempt');
1368
+ describe("sendToWorker implementation guards", () => {
1369
+ const source = readFileSync(join(__dirname, "..", "tmux-session.ts"), "utf-8");
1370
+ it("points the readiness timeout hint at the env var the worker wait reads", () => {
1371
+ expect(source).not.toContain("OMC_SHELL_READY_TIMEOUT_MS");
1372
+ expect(source).toContain("set OMC_TEAM_READY_TIMEOUT_MS to tune");
1373
+ expect(source).toContain("30_000");
1374
+ });
1375
+ it("checks and exits tmux copy-mode before injection", () => {
1376
+ expect(source).toContain("#{pane_in_mode}");
1377
+ expect(source).toContain("skip injection entirely");
1378
+ });
1379
+ it("supports env-gated adaptive interrupt retry", () => {
1380
+ expect(source).toContain("OMC_TEAM_AUTO_INTERRUPT_RETRY");
1381
+ expect(source).toContain('sendSubmitKey("C-u")');
1382
+ });
1383
+ it("re-checks copy-mode before adaptive and final fallback keys", () => {
1384
+ expect(source).toContain("Safety gate: copy-mode can turn on while we retry");
1385
+ expect(source).toContain("Before fallback control keys, re-check copy-mode");
1386
+ expect(source).toContain("Fail-closed: one final submit attempt");
1220
1387
  });
1221
1388
  });
1222
- describe('buildWorkerStartCommand MAX_CANON compliance (issue #4191)', () => {
1223
- it('keeps supervised launch command under 1024 bytes even with long cwd paths', () => {
1224
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
1225
- vi.stubEnv('SHELL', '/bin/bash');
1389
+ describe("buildWorkerStartCommand MAX_CANON compliance (issue #4191)", () => {
1390
+ it("keeps supervised launch command under 1024 bytes even with long cwd paths", () => {
1391
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1392
+ vi.stubEnv("SHELL", "/bin/bash");
1226
1393
  // Create a long cwd (300+ chars) to simulate real-world paths
1227
- const longCwd = '/home/user/projects/very/deep/nested/directory/structure/' +
1228
- 'with/many/components/that/add/up/to/make/a/realistically/long/path/to/the/working/' +
1229
- 'directory/where/the/team/would/be/running/from/and/this/represents/typical/monorepo/' +
1230
- 'layouts/or/deeply/nested/project/structures/that/developers/might/encounter/in/' +
1231
- 'their/workflows/on/their/systems/today';
1394
+ const longCwd = "/home/user/projects/very/deep/nested/directory/structure/" +
1395
+ "with/many/components/that/add/up/to/make/a/realistically/long/path/to/the/working/" +
1396
+ "directory/where/the/team/would/be/running/from/and/this/represents/typical/monorepo/" +
1397
+ "layouts/or/deeply/nested/project/structures/that/developers/might/encounter/in/" +
1398
+ "their/workflows/on/their/systems/today";
1232
1399
  const attempt = {
1233
1400
  schema_version: 1,
1234
- attempt_id: '11111111-1111-4111-8111-111111111111',
1235
- nonce: '22222222-2222-4222-8222-222222222222',
1236
- instance_id: '33333333-3333-4333-8333-333333333333',
1237
- team_name: 'test-team',
1238
- worker_name: 'worker-1',
1239
- pane_id: '%2',
1240
- provider: 'codex',
1241
- created_at: '2026-01-01T00:00:00.000Z',
1242
- currentPath: '/tmp/current.json',
1243
- expectedPath: '/tmp/expected.json',
1244
- ackPath: '/tmp/ack.json',
1245
- decisionPath: '/tmp/decision.json',
1246
- startedPath: '/tmp/provider-started.json',
1247
- transportOwnerPath: '/tmp/transport-owner.json',
1248
- bootstrapDescriptorPath: '/tmp/bootstrap.json',
1249
- wrapperPath: '/tmp/launch.cmd',
1250
- transportCleanupCompletePath: '/tmp/transport-cleanup-complete.json',
1251
- runtimeCliPath: '/opt/omc/runtime-cli.cjs',
1401
+ attempt_id: "11111111-1111-4111-8111-111111111111",
1402
+ nonce: "22222222-2222-4222-8222-222222222222",
1403
+ instance_id: "33333333-3333-4333-8333-333333333333",
1404
+ team_name: "test-team",
1405
+ worker_name: "worker-1",
1406
+ pane_id: "%2",
1407
+ provider: "codex",
1408
+ created_at: "2026-01-01T00:00:00.000Z",
1409
+ currentPath: "/tmp/current.json",
1410
+ expectedPath: "/tmp/expected.json",
1411
+ ackPath: "/tmp/ack.json",
1412
+ decisionPath: "/tmp/decision.json",
1413
+ startedPath: "/tmp/provider-started.json",
1414
+ transportOwnerPath: "/tmp/transport-owner.json",
1415
+ bootstrapDescriptorPath: "/tmp/bootstrap.json",
1416
+ wrapperPath: "/tmp/launch.cmd",
1417
+ transportCleanupCompletePath: "/tmp/transport-cleanup-complete.json",
1418
+ runtimeCliPath: "/opt/omc/runtime-cli.cjs",
1252
1419
  };
1253
1420
  // Simulate what runtime-v2 passes in envVars with long paths
1254
1421
  const envVarsWithLongPaths = {
1255
- OMC_TEAM_WORKER: 'test-team/worker-1',
1256
- OMC_TEAM_NAME: 'test-team',
1257
- OMC_WORKER_AGENT_TYPE: 'codex',
1422
+ OMC_TEAM_WORKER: "test-team/worker-1",
1423
+ OMC_TEAM_NAME: "test-team",
1424
+ OMC_WORKER_AGENT_TYPE: "codex",
1258
1425
  OMC_TEAM_STATE_ROOT: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/.omc/state/team/test-team`,
1259
1426
  OMC_TEAM_LEADER_CWD: longCwd,
1260
1427
  OMC_TEAM_WORKTREE_PATH: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/worktree`,
1261
1428
  OMC_TEAM_WORKER_CWD: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/worker-cwd`,
1262
1429
  };
1263
1430
  const cmd = buildWorkerStartCommand({
1264
- teamName: 'test-team',
1265
- workerName: 'worker-1',
1431
+ teamName: "test-team",
1432
+ workerName: "worker-1",
1266
1433
  envVars: envVarsWithLongPaths,
1267
- launchBinary: '/usr/bin/codex',
1268
- launchArgs: ['--full-auto'],
1434
+ launchBinary: "/usr/bin/codex",
1435
+ launchArgs: ["--full-auto"],
1269
1436
  cwd: longCwd,
1270
- provider: 'codex',
1437
+ provider: "codex",
1271
1438
  launchAttempt: attempt,
1272
1439
  });
1273
- const cmdBytes = Buffer.byteLength(cmd, 'utf8');
1440
+ const cmdBytes = Buffer.byteLength(cmd, "utf8");
1274
1441
  // Key assertion: command must stay under 1024 bytes (macOS MAX_CANON limit)
1275
1442
  // to avoid truncation in terminal line discipline
1276
1443
  expect(cmdBytes).toBeLessThan(1024);
@@ -1278,35 +1445,35 @@ describe('buildWorkerStartCommand MAX_CANON compliance (issue #4191)', () => {
1278
1445
  // Verify supervised launch only includes OMC_WORKER_LAUNCH_SPEC_FILE
1279
1446
  // NOT the long env vars that would push it over the limit
1280
1447
  expect(cmd).toContain("OMC_WORKER_LAUNCH_SPEC_FILE='/tmp/bootstrap.json'");
1281
- expect(cmd).not.toContain('OMC_TEAM_STATE_ROOT');
1282
- expect(cmd).not.toContain('OMC_TEAM_LEADER_CWD');
1283
- expect(cmd).not.toContain('OMC_TEAM_WORKER_CWD');
1448
+ expect(cmd).not.toContain("OMC_TEAM_STATE_ROOT");
1449
+ expect(cmd).not.toContain("OMC_TEAM_LEADER_CWD");
1450
+ expect(cmd).not.toContain("OMC_TEAM_WORKER_CWD");
1284
1451
  expect(cmd).not.toContain(longCwd);
1285
1452
  // Verify it still invokes the runtime CLI correctly
1286
- expect(cmd).toContain('--worker-launch');
1287
- expect(cmd).toContain('/opt/omc/runtime-cli.cjs');
1453
+ expect(cmd).toContain("--worker-launch");
1454
+ expect(cmd).toContain("/opt/omc/runtime-cli.cjs");
1288
1455
  });
1289
- it('non-supervised launches still include env vars normally', () => {
1290
- vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
1291
- vi.stubEnv('SHELL', '/bin/bash');
1456
+ it("non-supervised launches still include env vars normally", () => {
1457
+ vi.spyOn(process, "platform", "get").mockReturnValue("linux");
1458
+ vi.stubEnv("SHELL", "/bin/bash");
1292
1459
  const cmd = buildWorkerStartCommand({
1293
- teamName: 'test-team',
1294
- workerName: 'worker-1',
1460
+ teamName: "test-team",
1461
+ workerName: "worker-1",
1295
1462
  envVars: {
1296
- OMC_TEAM_WORKER: 'test-team/worker-1',
1297
- OMC_TEAM_NAME: 'test-team',
1298
- OMC_TEAM_STATE_ROOT: '/tmp/state',
1463
+ OMC_TEAM_WORKER: "test-team/worker-1",
1464
+ OMC_TEAM_NAME: "test-team",
1465
+ OMC_TEAM_STATE_ROOT: "/tmp/state",
1299
1466
  },
1300
- launchBinary: '/usr/bin/codex',
1301
- launchArgs: ['--full-auto'],
1302
- cwd: '/tmp',
1303
- provider: 'codex',
1467
+ launchBinary: "/usr/bin/codex",
1468
+ launchArgs: ["--full-auto"],
1469
+ cwd: "/tmp",
1470
+ provider: "codex",
1304
1471
  // No launchAttempt - non-supervised
1305
1472
  });
1306
1473
  // Non-supervised launches should include all env vars
1307
- expect(cmd).toContain('OMC_TEAM_WORKER');
1308
- expect(cmd).toContain('OMC_TEAM_NAME');
1309
- expect(cmd).toContain('OMC_TEAM_STATE_ROOT');
1474
+ expect(cmd).toContain("OMC_TEAM_WORKER");
1475
+ expect(cmd).toContain("OMC_TEAM_NAME");
1476
+ expect(cmd).toContain("OMC_TEAM_STATE_ROOT");
1310
1477
  });
1311
1478
  });
1312
1479
  //# sourceMappingURL=tmux-session.test.js.map