oh-my-copilot 5.5.0 → 5.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +1 -0
  4. package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
  5. package/bridge/claude-md-coordinator.cjs +2 -2
  6. package/bridge/cli.cjs +6290 -3436
  7. package/bridge/mcp-server.cjs +637 -503
  8. package/bridge/runtime-cli.cjs +516 -213
  9. package/bridge/team-bridge.cjs +141 -135
  10. package/bridge/team-mcp.cjs +201 -129
  11. package/bridge/team.js +473 -237
  12. package/copilot/hooks.json +43 -0
  13. package/dist/__tests__/chain-enqueuer-registration.test.d.ts +11 -0
  14. package/dist/__tests__/chain-enqueuer-registration.test.d.ts.map +1 -0
  15. package/dist/__tests__/chain-enqueuer-registration.test.js +122 -0
  16. package/dist/__tests__/chain-enqueuer-registration.test.js.map +1 -0
  17. package/dist/__tests__/copilot-hooks-manifest.test.js +3 -1
  18. package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
  19. package/dist/__tests__/directory-context-injector.test.js +41 -1
  20. package/dist/__tests__/directory-context-injector.test.js.map +1 -1
  21. package/dist/__tests__/hook-bridge-main-module.test.d.ts +2 -0
  22. package/dist/__tests__/hook-bridge-main-module.test.d.ts.map +1 -0
  23. package/dist/__tests__/hook-bridge-main-module.test.js +48 -0
  24. package/dist/__tests__/hook-bridge-main-module.test.js.map +1 -0
  25. package/dist/__tests__/ralph-prd-stale.test.js +12 -1
  26. package/dist/__tests__/ralph-prd-stale.test.js.map +1 -1
  27. package/dist/__tests__/ralph-prd.test.js +56 -0
  28. package/dist/__tests__/ralph-prd.test.js.map +1 -1
  29. package/dist/__tests__/run-cjs-graceful-fallback.test.js +2 -0
  30. package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
  31. package/dist/__tests__/session-end-forwarder-fallback.test.d.ts +2 -0
  32. package/dist/__tests__/session-end-forwarder-fallback.test.d.ts.map +1 -0
  33. package/dist/__tests__/session-end-forwarder-fallback.test.js +138 -0
  34. package/dist/__tests__/session-end-forwarder-fallback.test.js.map +1 -0
  35. package/dist/cli/__tests__/autoresearch-setup-session.test.js +67 -3
  36. package/dist/cli/__tests__/autoresearch-setup-session.test.js.map +1 -1
  37. package/dist/cli/__tests__/launch.test.js +73 -11
  38. package/dist/cli/__tests__/launch.test.js.map +1 -1
  39. package/dist/cli/__tests__/plugin-dir-capture.test.js +45 -0
  40. package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
  41. package/dist/cli/__tests__/ralph-afk.test.d.ts +2 -0
  42. package/dist/cli/__tests__/ralph-afk.test.d.ts.map +1 -0
  43. package/dist/cli/__tests__/ralph-afk.test.js +312 -0
  44. package/dist/cli/__tests__/ralph-afk.test.js.map +1 -0
  45. package/dist/cli/__tests__/team.test.js +170 -0
  46. package/dist/cli/__tests__/team.test.js.map +1 -1
  47. package/dist/cli/__tests__/tmux-utils.test.js +132 -16
  48. package/dist/cli/__tests__/tmux-utils.test.js.map +1 -1
  49. package/dist/cli/autoresearch-setup-session.d.ts.map +1 -1
  50. package/dist/cli/autoresearch-setup-session.js +29 -9
  51. package/dist/cli/autoresearch-setup-session.js.map +1 -1
  52. package/dist/cli/commands/__tests__/factory-init.test.d.ts +2 -0
  53. package/dist/cli/commands/__tests__/factory-init.test.d.ts.map +1 -0
  54. package/dist/cli/commands/__tests__/factory-init.test.js +90 -0
  55. package/dist/cli/commands/__tests__/factory-init.test.js.map +1 -0
  56. package/dist/cli/commands/__tests__/intake-headless-flag.test.d.ts +2 -0
  57. package/dist/cli/commands/__tests__/intake-headless-flag.test.d.ts.map +1 -0
  58. package/dist/cli/commands/__tests__/intake-headless-flag.test.js +30 -0
  59. package/dist/cli/commands/__tests__/intake-headless-flag.test.js.map +1 -0
  60. package/dist/cli/commands/__tests__/intake.test.d.ts +2 -0
  61. package/dist/cli/commands/__tests__/intake.test.d.ts.map +1 -0
  62. package/dist/cli/commands/__tests__/intake.test.js +257 -0
  63. package/dist/cli/commands/__tests__/intake.test.js.map +1 -0
  64. package/dist/cli/commands/factory.d.ts +61 -0
  65. package/dist/cli/commands/factory.d.ts.map +1 -0
  66. package/dist/cli/commands/factory.js +190 -0
  67. package/dist/cli/commands/factory.js.map +1 -0
  68. package/dist/cli/commands/intake.d.ts +94 -0
  69. package/dist/cli/commands/intake.d.ts.map +1 -0
  70. package/dist/cli/commands/intake.js +311 -0
  71. package/dist/cli/commands/intake.js.map +1 -0
  72. package/dist/cli/commands/ralph.d.ts +88 -0
  73. package/dist/cli/commands/ralph.d.ts.map +1 -0
  74. package/dist/cli/commands/ralph.js +456 -0
  75. package/dist/cli/commands/ralph.js.map +1 -0
  76. package/dist/cli/commands/team.d.ts.map +1 -1
  77. package/dist/cli/commands/team.js +25 -5
  78. package/dist/cli/commands/team.js.map +1 -1
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +7 -0
  81. package/dist/cli/index.js.map +1 -1
  82. package/dist/cli/launch.d.ts.map +1 -1
  83. package/dist/cli/launch.js +32 -7
  84. package/dist/cli/launch.js.map +1 -1
  85. package/dist/cli/team.d.ts.map +1 -1
  86. package/dist/cli/team.js +61 -7
  87. package/dist/cli/team.js.map +1 -1
  88. package/dist/cli/tmux-utils.d.ts +26 -0
  89. package/dist/cli/tmux-utils.d.ts.map +1 -1
  90. package/dist/cli/tmux-utils.js +61 -9
  91. package/dist/cli/tmux-utils.js.map +1 -1
  92. package/dist/config/__tests__/loader.test.js +138 -0
  93. package/dist/config/__tests__/loader.test.js.map +1 -1
  94. package/dist/config/loader.d.ts.map +1 -1
  95. package/dist/config/loader.js +17 -0
  96. package/dist/config/loader.js.map +1 -1
  97. package/dist/factory/__tests__/check-run.test.d.ts +2 -0
  98. package/dist/factory/__tests__/check-run.test.d.ts.map +1 -0
  99. package/dist/factory/__tests__/check-run.test.js +213 -0
  100. package/dist/factory/__tests__/check-run.test.js.map +1 -0
  101. package/dist/factory/__tests__/listener.test.d.ts +2 -0
  102. package/dist/factory/__tests__/listener.test.d.ts.map +1 -0
  103. package/dist/factory/__tests__/listener.test.js +312 -0
  104. package/dist/factory/__tests__/listener.test.js.map +1 -0
  105. package/dist/factory/__tests__/map-frontier.test.d.ts +2 -0
  106. package/dist/factory/__tests__/map-frontier.test.d.ts.map +1 -0
  107. package/dist/factory/__tests__/map-frontier.test.js +128 -0
  108. package/dist/factory/__tests__/map-frontier.test.js.map +1 -0
  109. package/dist/factory/__tests__/map-ingest.test.d.ts +2 -0
  110. package/dist/factory/__tests__/map-ingest.test.d.ts.map +1 -0
  111. package/dist/factory/__tests__/map-ingest.test.js +166 -0
  112. package/dist/factory/__tests__/map-ingest.test.js.map +1 -0
  113. package/dist/factory/__tests__/map-run.test.d.ts +2 -0
  114. package/dist/factory/__tests__/map-run.test.d.ts.map +1 -0
  115. package/dist/factory/__tests__/map-run.test.js +148 -0
  116. package/dist/factory/__tests__/map-run.test.js.map +1 -0
  117. package/dist/factory/__tests__/status.test.d.ts +2 -0
  118. package/dist/factory/__tests__/status.test.d.ts.map +1 -0
  119. package/dist/factory/__tests__/status.test.js +77 -0
  120. package/dist/factory/__tests__/status.test.js.map +1 -0
  121. package/dist/factory/listener.d.ts +98 -0
  122. package/dist/factory/listener.d.ts.map +1 -0
  123. package/dist/factory/listener.js +315 -0
  124. package/dist/factory/listener.js.map +1 -0
  125. package/dist/factory/map-frontier.d.ts +73 -0
  126. package/dist/factory/map-frontier.d.ts.map +1 -0
  127. package/dist/factory/map-frontier.js +147 -0
  128. package/dist/factory/map-frontier.js.map +1 -0
  129. package/dist/factory/map-ingest.d.ts +79 -0
  130. package/dist/factory/map-ingest.d.ts.map +1 -0
  131. package/dist/factory/map-ingest.js +232 -0
  132. package/dist/factory/map-ingest.js.map +1 -0
  133. package/dist/factory/map-run.d.ts +74 -0
  134. package/dist/factory/map-run.d.ts.map +1 -0
  135. package/dist/factory/map-run.js +229 -0
  136. package/dist/factory/map-run.js.map +1 -0
  137. package/dist/factory/status.d.ts +33 -0
  138. package/dist/factory/status.d.ts.map +1 -0
  139. package/dist/factory/status.js +93 -0
  140. package/dist/factory/status.js.map +1 -0
  141. package/dist/factory/watchdog.d.ts +46 -0
  142. package/dist/factory/watchdog.d.ts.map +1 -0
  143. package/dist/factory/watchdog.js +130 -0
  144. package/dist/factory/watchdog.js.map +1 -0
  145. package/dist/factory/watchdog.test.d.ts +2 -0
  146. package/dist/factory/watchdog.test.d.ts.map +1 -0
  147. package/dist/factory/watchdog.test.js +111 -0
  148. package/dist/factory/watchdog.test.js.map +1 -0
  149. package/dist/graph/runtime/native-contained-fs.js +1 -1
  150. package/dist/graph/runtime/native-contained-fs.js.map +1 -1
  151. package/dist/hooks/__tests__/compaction-concurrency.test.js +20 -20
  152. package/dist/hooks/__tests__/compaction-concurrency.test.js.map +1 -1
  153. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +27 -0
  154. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
  155. package/dist/hooks/bridge.d.ts +8 -0
  156. package/dist/hooks/bridge.d.ts.map +1 -1
  157. package/dist/hooks/bridge.js +38 -9
  158. package/dist/hooks/bridge.js.map +1 -1
  159. package/dist/hooks/code-simplifier/__tests__/global-config-path.test.d.ts +2 -0
  160. package/dist/hooks/code-simplifier/__tests__/global-config-path.test.d.ts.map +1 -0
  161. package/dist/hooks/code-simplifier/__tests__/global-config-path.test.js +89 -0
  162. package/dist/hooks/code-simplifier/__tests__/global-config-path.test.js.map +1 -0
  163. package/dist/hooks/code-simplifier/index.d.ts +1 -1
  164. package/dist/hooks/code-simplifier/index.js +1 -1
  165. package/dist/hooks/code-simplifier/jev-shadow.d.ts +5 -4
  166. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
  167. package/dist/hooks/code-simplifier/jev-shadow.js +9 -4
  168. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
  169. package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -1
  170. package/dist/hooks/directory-readme-injector/index.js +11 -2
  171. package/dist/hooks/directory-readme-injector/index.js.map +1 -1
  172. package/dist/hooks/jev/__tests__/active-mode.test.d.ts +9 -0
  173. package/dist/hooks/jev/__tests__/active-mode.test.d.ts.map +1 -0
  174. package/dist/hooks/jev/__tests__/active-mode.test.js +252 -0
  175. package/dist/hooks/jev/__tests__/active-mode.test.js.map +1 -0
  176. package/dist/hooks/jev/points.d.ts +3 -1
  177. package/dist/hooks/jev/points.d.ts.map +1 -1
  178. package/dist/hooks/jev/points.js +1 -0
  179. package/dist/hooks/jev/points.js.map +1 -1
  180. package/dist/hooks/jev/resolver.d.ts.map +1 -1
  181. package/dist/hooks/jev/resolver.js +17 -1
  182. package/dist/hooks/jev/resolver.js.map +1 -1
  183. package/dist/hooks/keyword-detector/index.d.ts +2 -0
  184. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  185. package/dist/hooks/keyword-detector/index.js +3 -3
  186. package/dist/hooks/keyword-detector/index.js.map +1 -1
  187. package/dist/hooks/keyword-detector/jev-shadow.d.ts +6 -4
  188. package/dist/hooks/keyword-detector/jev-shadow.d.ts.map +1 -1
  189. package/dist/hooks/keyword-detector/jev-shadow.js +18 -4
  190. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
  191. package/dist/hooks/learner/jev-shadow.d.ts +4 -3
  192. package/dist/hooks/learner/jev-shadow.d.ts.map +1 -1
  193. package/dist/hooks/learner/jev-shadow.js +14 -3
  194. package/dist/hooks/learner/jev-shadow.js.map +1 -1
  195. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  196. package/dist/hooks/persistent-mode/index.js +22 -6
  197. package/dist/hooks/persistent-mode/index.js.map +1 -1
  198. package/dist/hooks/persistent-mode/jev-shadow.d.ts +7 -5
  199. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
  200. package/dist/hooks/persistent-mode/jev-shadow.js +28 -6
  201. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
  202. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js +3 -3
  203. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js.map +1 -1
  204. package/dist/hooks/preemptive-compaction/index.d.ts +5 -1
  205. package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -1
  206. package/dist/hooks/preemptive-compaction/index.js +13 -8
  207. package/dist/hooks/preemptive-compaction/index.js.map +1 -1
  208. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts +6 -5
  209. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts.map +1 -1
  210. package/dist/hooks/preemptive-compaction/jev-shadow.js +18 -5
  211. package/dist/hooks/preemptive-compaction/jev-shadow.js.map +1 -1
  212. package/dist/hooks/ralph/__tests__/feedback-baseline.test.d.ts +2 -0
  213. package/dist/hooks/ralph/__tests__/feedback-baseline.test.d.ts.map +1 -0
  214. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +250 -0
  215. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -0
  216. package/dist/hooks/ralph/feedback-baseline.d.ts +58 -0
  217. package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -0
  218. package/dist/hooks/ralph/feedback-baseline.js +141 -0
  219. package/dist/hooks/ralph/feedback-baseline.js.map +1 -0
  220. package/dist/hooks/ralph/index.d.ts +1 -1
  221. package/dist/hooks/ralph/index.d.ts.map +1 -1
  222. package/dist/hooks/ralph/index.js +1 -1
  223. package/dist/hooks/ralph/index.js.map +1 -1
  224. package/dist/hooks/ralph/jev-shadow.d.ts +4 -3
  225. package/dist/hooks/ralph/jev-shadow.d.ts.map +1 -1
  226. package/dist/hooks/ralph/jev-shadow.js +14 -4
  227. package/dist/hooks/ralph/jev-shadow.js.map +1 -1
  228. package/dist/hooks/ralph/loop.d.ts +7 -0
  229. package/dist/hooks/ralph/loop.d.ts.map +1 -1
  230. package/dist/hooks/ralph/loop.js +21 -0
  231. package/dist/hooks/ralph/loop.js.map +1 -1
  232. package/dist/hooks/ralph/prd.d.ts +17 -0
  233. package/dist/hooks/ralph/prd.d.ts.map +1 -1
  234. package/dist/hooks/ralph/prd.js +26 -1
  235. package/dist/hooks/ralph/prd.js.map +1 -1
  236. package/dist/hooks/registry/__tests__/registry.test.js +12 -4
  237. package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
  238. package/dist/hooks/rules-injector/matcher.d.ts.map +1 -1
  239. package/dist/hooks/rules-injector/matcher.js +35 -7
  240. package/dist/hooks/rules-injector/matcher.js.map +1 -1
  241. package/dist/hooks/rules-injector/matcher.test.d.ts +2 -0
  242. package/dist/hooks/rules-injector/matcher.test.d.ts.map +1 -0
  243. package/dist/hooks/rules-injector/matcher.test.js +58 -0
  244. package/dist/hooks/rules-injector/matcher.test.js.map +1 -0
  245. package/dist/hooks/session-end/__tests__/action-runner.test.js +51 -0
  246. package/dist/hooks/session-end/__tests__/action-runner.test.js.map +1 -1
  247. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.d.ts +2 -0
  248. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.d.ts.map +1 -0
  249. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js +274 -0
  250. package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js.map +1 -0
  251. package/dist/hooks/session-end/__tests__/check-evidence.test.d.ts +2 -0
  252. package/dist/hooks/session-end/__tests__/check-evidence.test.d.ts.map +1 -0
  253. package/dist/hooks/session-end/__tests__/check-evidence.test.js +171 -0
  254. package/dist/hooks/session-end/__tests__/check-evidence.test.js.map +1 -0
  255. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +21 -0
  256. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
  257. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.d.ts +10 -0
  258. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.d.ts.map +1 -0
  259. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js +123 -0
  260. package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js.map +1 -0
  261. package/dist/hooks/session-end/__tests__/guardrails.test.d.ts +2 -0
  262. package/dist/hooks/session-end/__tests__/guardrails.test.d.ts.map +1 -0
  263. package/dist/hooks/session-end/__tests__/guardrails.test.js +184 -0
  264. package/dist/hooks/session-end/__tests__/guardrails.test.js.map +1 -0
  265. package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.d.ts +9 -0
  266. package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.d.ts.map +1 -0
  267. package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.js +96 -0
  268. package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.js.map +1 -0
  269. package/dist/hooks/session-end/__tests__/routing.test.d.ts +2 -0
  270. package/dist/hooks/session-end/__tests__/routing.test.d.ts.map +1 -0
  271. package/dist/hooks/session-end/__tests__/routing.test.js +135 -0
  272. package/dist/hooks/session-end/__tests__/routing.test.js.map +1 -0
  273. package/dist/hooks/session-end/__tests__/spawn-next.test.d.ts +2 -0
  274. package/dist/hooks/session-end/__tests__/spawn-next.test.d.ts.map +1 -0
  275. package/dist/hooks/session-end/__tests__/spawn-next.test.js +501 -0
  276. package/dist/hooks/session-end/__tests__/spawn-next.test.js.map +1 -0
  277. package/dist/hooks/session-end/__tests__/worker.test.js +102 -0
  278. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  279. package/dist/hooks/session-end/action-runner.d.ts.map +1 -1
  280. package/dist/hooks/session-end/action-runner.js +24 -2
  281. package/dist/hooks/session-end/action-runner.js.map +1 -1
  282. package/dist/hooks/session-end/chain-enqueuer.d.ts +45 -0
  283. package/dist/hooks/session-end/chain-enqueuer.d.ts.map +1 -0
  284. package/dist/hooks/session-end/chain-enqueuer.js +191 -0
  285. package/dist/hooks/session-end/chain-enqueuer.js.map +1 -0
  286. package/dist/hooks/session-end/check-evidence.d.ts +29 -0
  287. package/dist/hooks/session-end/check-evidence.d.ts.map +1 -0
  288. package/dist/hooks/session-end/check-evidence.js +52 -0
  289. package/dist/hooks/session-end/check-evidence.js.map +1 -0
  290. package/dist/hooks/session-end/cleanup-manifest.d.ts +1 -1
  291. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  292. package/dist/hooks/session-end/cleanup-manifest.js +22 -2
  293. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  294. package/dist/hooks/session-end/foreground-bootstrap.d.ts.map +1 -1
  295. package/dist/hooks/session-end/foreground-bootstrap.js +30 -4
  296. package/dist/hooks/session-end/foreground-bootstrap.js.map +1 -1
  297. package/dist/hooks/session-end/guardrails.d.ts +67 -0
  298. package/dist/hooks/session-end/guardrails.d.ts.map +1 -0
  299. package/dist/hooks/session-end/guardrails.js +149 -0
  300. package/dist/hooks/session-end/guardrails.js.map +1 -0
  301. package/dist/hooks/session-end/index.d.ts.map +1 -1
  302. package/dist/hooks/session-end/index.js +14 -6
  303. package/dist/hooks/session-end/index.js.map +1 -1
  304. package/dist/hooks/session-end/routing.d.ts +53 -0
  305. package/dist/hooks/session-end/routing.d.ts.map +1 -0
  306. package/dist/hooks/session-end/routing.js +75 -0
  307. package/dist/hooks/session-end/routing.js.map +1 -0
  308. package/dist/hooks/session-end/spawn-next.d.ts +117 -0
  309. package/dist/hooks/session-end/spawn-next.d.ts.map +1 -0
  310. package/dist/hooks/session-end/spawn-next.js +292 -0
  311. package/dist/hooks/session-end/spawn-next.js.map +1 -0
  312. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  313. package/dist/hooks/session-end/worker.js +45 -5
  314. package/dist/hooks/session-end/worker.js.map +1 -1
  315. package/dist/hooks/task-size-detector/jev-shadow.d.ts +2 -1
  316. package/dist/hooks/task-size-detector/jev-shadow.d.ts.map +1 -1
  317. package/dist/hooks/task-size-detector/jev-shadow.js +19 -1
  318. package/dist/hooks/task-size-detector/jev-shadow.js.map +1 -1
  319. package/dist/installer/__tests__/hook-command-portability.test.js +57 -1
  320. package/dist/installer/__tests__/hook-command-portability.test.js.map +1 -1
  321. package/dist/installer/__tests__/mcp-registry.test.js +98 -0
  322. package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
  323. package/dist/installer/hooks.d.ts +7 -0
  324. package/dist/installer/hooks.d.ts.map +1 -1
  325. package/dist/installer/hooks.js +15 -0
  326. package/dist/installer/hooks.js.map +1 -1
  327. package/dist/installer/index.d.ts +12 -0
  328. package/dist/installer/index.d.ts.map +1 -1
  329. package/dist/installer/index.js +3 -1
  330. package/dist/installer/index.js.map +1 -1
  331. package/dist/installer/mcp-registry.d.ts.map +1 -1
  332. package/dist/installer/mcp-registry.js +56 -6
  333. package/dist/installer/mcp-registry.js.map +1 -1
  334. package/dist/lib/__tests__/host-load-gate.test.d.ts +2 -0
  335. package/dist/lib/__tests__/host-load-gate.test.d.ts.map +1 -0
  336. package/dist/lib/__tests__/host-load-gate.test.js +377 -0
  337. package/dist/lib/__tests__/host-load-gate.test.js.map +1 -0
  338. package/dist/lib/__tests__/runs-ledger.test.d.ts +2 -0
  339. package/dist/lib/__tests__/runs-ledger.test.d.ts.map +1 -0
  340. package/dist/lib/__tests__/runs-ledger.test.js +99 -0
  341. package/dist/lib/__tests__/runs-ledger.test.js.map +1 -0
  342. package/dist/lib/atomic-write.d.ts +16 -0
  343. package/dist/lib/atomic-write.d.ts.map +1 -1
  344. package/dist/lib/atomic-write.js +27 -4
  345. package/dist/lib/atomic-write.js.map +1 -1
  346. package/dist/lib/host-load-gate.d.ts +110 -0
  347. package/dist/lib/host-load-gate.d.ts.map +1 -0
  348. package/dist/lib/host-load-gate.js +228 -0
  349. package/dist/lib/host-load-gate.js.map +1 -0
  350. package/dist/lib/mode-state-io.d.ts.map +1 -1
  351. package/dist/lib/mode-state-io.js +55 -18
  352. package/dist/lib/mode-state-io.js.map +1 -1
  353. package/dist/lib/runs-ledger.d.ts +45 -0
  354. package/dist/lib/runs-ledger.d.ts.map +1 -0
  355. package/dist/lib/runs-ledger.js +141 -0
  356. package/dist/lib/runs-ledger.js.map +1 -0
  357. package/dist/platform/executable-resolution.d.ts +13 -0
  358. package/dist/platform/executable-resolution.d.ts.map +1 -1
  359. package/dist/platform/executable-resolution.js +16 -0
  360. package/dist/platform/executable-resolution.js.map +1 -1
  361. package/dist/shared/types.d.ts +3 -0
  362. package/dist/shared/types.d.ts.map +1 -1
  363. package/dist/team/__tests__/model-contract.test.js +63 -1
  364. package/dist/team/__tests__/model-contract.test.js.map +1 -1
  365. package/dist/team/__tests__/stage-router.test.js +22 -0
  366. package/dist/team/__tests__/stage-router.test.js.map +1 -1
  367. package/dist/team/__tests__/team-owner-epoch.test.js +33 -0
  368. package/dist/team/__tests__/team-owner-epoch.test.js.map +1 -1
  369. package/dist/team/__tests__/tmux-session.create-team.test.js +60 -2
  370. package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
  371. package/dist/team/__tests__/tmux-session.psmux.test.js +12 -0
  372. package/dist/team/__tests__/tmux-session.psmux.test.js.map +1 -1
  373. package/dist/team/__tests__/tmux-session.test.js +230 -7
  374. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  375. package/dist/team/__tests__/worker-launch-ack.test.js +62 -0
  376. package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
  377. package/dist/team/model-contract.d.ts +3 -2
  378. package/dist/team/model-contract.d.ts.map +1 -1
  379. package/dist/team/model-contract.js +35 -10
  380. package/dist/team/model-contract.js.map +1 -1
  381. package/dist/team/runtime-v2.d.ts +13 -0
  382. package/dist/team/runtime-v2.d.ts.map +1 -1
  383. package/dist/team/runtime-v2.js +112 -7
  384. package/dist/team/runtime-v2.js.map +1 -1
  385. package/dist/team/scaling.d.ts.map +1 -1
  386. package/dist/team/scaling.js +4 -1
  387. package/dist/team/scaling.js.map +1 -1
  388. package/dist/team/stage-router.d.ts.map +1 -1
  389. package/dist/team/stage-router.js +3 -1
  390. package/dist/team/stage-router.js.map +1 -1
  391. package/dist/team/team-owner-epoch.d.ts.map +1 -1
  392. package/dist/team/team-owner-epoch.js +4 -7
  393. package/dist/team/team-owner-epoch.js.map +1 -1
  394. package/dist/team/tmux-session.d.ts +8 -1
  395. package/dist/team/tmux-session.d.ts.map +1 -1
  396. package/dist/team/tmux-session.js +71 -19
  397. package/dist/team/tmux-session.js.map +1 -1
  398. package/dist/team/worker-launch-ack.d.ts +1 -1
  399. package/dist/team/worker-launch-ack.d.ts.map +1 -1
  400. package/dist/team/worker-launch-ack.js +28 -1
  401. package/dist/team/worker-launch-ack.js.map +1 -1
  402. package/dist/tools/lsp/__tests__/client-handle-data.test.js +83 -0
  403. package/dist/tools/lsp/__tests__/client-handle-data.test.js.map +1 -1
  404. package/dist/tools/lsp/client.d.ts.map +1 -1
  405. package/dist/tools/lsp/client.js +41 -11
  406. package/dist/tools/lsp/client.js.map +1 -1
  407. package/docs/CLAUDE.md +1 -1
  408. package/docs/HOOKS.md +235 -0
  409. package/docs/MIGRATION.md +132 -0
  410. package/docs/REFERENCE.md +26 -1
  411. package/docs/adr/03672-env-activated-active-mode.md +18 -1
  412. package/docs/design/FACTORY-FINAL-DESIGN.md +114 -0
  413. package/docs/design/P2-RUN-LEDGER-AND-INTAKE-PLAN.md +83 -0
  414. package/docs/factory/t6-acceptance/acceptance-comment.md +36 -0
  415. package/hooks/hooks.json +22 -1
  416. package/package.json +6 -2
  417. package/plugin.json +1 -1
  418. package/scripts/build-contained-fs.mjs +24 -2
  419. package/scripts/ci/check-multirepo-paths.mjs +3 -0
  420. package/scripts/code-simplifier.mjs +24 -2
  421. package/scripts/dev/repro-state-lock.mjs +67 -0
  422. package/scripts/git-guardrails.mjs +581 -0
  423. package/scripts/keyword-detector.mjs +21 -4
  424. package/scripts/lib/atomic-write.mjs +31 -8
  425. package/scripts/lib/jev-shadow.mjs +68 -29
  426. package/scripts/lib/run-reaper.mjs +114 -0
  427. package/scripts/lib/state-lock.mjs +22 -13
  428. package/scripts/post-tool-verifier.mjs +8 -2
  429. package/scripts/postinstall-contained-fs.mjs +56 -0
  430. package/scripts/pre-tool-enforcer.mjs +25 -8
  431. package/scripts/run.cjs +18 -0
  432. package/scripts/runs-reconciler.mjs +103 -0
  433. package/scripts/stale-run-reporter.mjs +73 -0
  434. package/scripts/workflow-drift-guard.mjs +6 -1
  435. package/skills/autopilot/SKILL.md +10 -2
  436. package/skills/harbor/SKILL.md +8 -0
  437. package/skills/omc-setup/phases/04-welcome.md +1 -1
  438. package/skills/ralph/SKILL.md +32 -15
  439. package/skills/refit/SKILL.md +8 -0
  440. package/skills/team/SKILL.md +2 -0
  441. package/templates/hooks/code-simplifier.mjs +24 -2
  442. package/templates/hooks/lib/atomic-write.mjs +31 -8
  443. package/templates/hooks/session-end.mjs +99 -0
  444. package/templates/hooks/workflow-drift-guard.mjs +6 -1
@@ -1188,13 +1188,13 @@ var init_worker_canonicalization = __esm({
1188
1188
  });
1189
1189
 
1190
1190
  // src/team/monitor.ts
1191
- var import_fs19, import_promises3, import_path21;
1191
+ var import_fs20, import_promises3, import_path22;
1192
1192
  var init_monitor = __esm({
1193
1193
  "src/team/monitor.ts"() {
1194
1194
  "use strict";
1195
- import_fs19 = require("fs");
1195
+ import_fs20 = require("fs");
1196
1196
  import_promises3 = require("fs/promises");
1197
- import_path21 = require("path");
1197
+ import_path22 = require("path");
1198
1198
  init_types();
1199
1199
  init_contracts();
1200
1200
  init_state_paths();
@@ -1213,14 +1213,14 @@ __export(bridge_entry_exports, {
1213
1213
  validateConfigPath: () => validateConfigPath
1214
1214
  });
1215
1215
  module.exports = __toCommonJS(bridge_entry_exports);
1216
- var import_fs28 = require("fs");
1217
- var import_path30 = require("path");
1218
- var import_os7 = require("os");
1216
+ var import_fs29 = require("fs");
1217
+ var import_path31 = require("path");
1218
+ var import_os8 = require("os");
1219
1219
 
1220
1220
  // src/team/mcp-team-bridge.ts
1221
1221
  var import_child_process8 = require("child_process");
1222
- var import_fs27 = require("fs");
1223
- var import_path29 = require("path");
1222
+ var import_fs28 = require("fs");
1223
+ var import_path30 = require("path");
1224
1224
 
1225
1225
  // src/team/fs-utils.ts
1226
1226
  var import_fs = require("fs");
@@ -1278,18 +1278,18 @@ function validateResolvedPath(resolvedPath, expectedBase) {
1278
1278
  init_worktree_paths();
1279
1279
 
1280
1280
  // src/team/task-file-ops.ts
1281
- var import_fs21 = require("fs");
1282
- var import_path23 = require("path");
1281
+ var import_fs22 = require("fs");
1282
+ var import_path24 = require("path");
1283
1283
  init_worktree_paths();
1284
1284
  init_config_dir();
1285
1285
 
1286
1286
  // src/team/tmux-session.ts
1287
- var import_fs20 = require("fs");
1287
+ var import_fs21 = require("fs");
1288
1288
  var import_crypto6 = require("crypto");
1289
1289
  var import_child_process7 = require("child_process");
1290
1290
  var import_util3 = require("util");
1291
- var import_path22 = require("path");
1292
- var import_os6 = require("os");
1291
+ var import_path23 = require("path");
1292
+ var import_os7 = require("os");
1293
1293
 
1294
1294
  // src/cli/tmux-utils.ts
1295
1295
  var import_child_process5 = require("child_process");
@@ -2398,6 +2398,7 @@ var PSMUX_NS_DIR = import_path15.win32.join(PSMUX_REGISTRY_DIR, "omg-ns");
2398
2398
  // src/team/tmux-session.ts
2399
2399
  init_types2();
2400
2400
  init_team_owner_epoch();
2401
+ init_native_contained_fs();
2401
2402
 
2402
2403
  // src/platform/process-utils.ts
2403
2404
  var import_child_process6 = require("child_process");
@@ -2588,6 +2589,11 @@ function withFileLockSync(lockPath, fn, opts) {
2588
2589
  }
2589
2590
  }
2590
2591
 
2592
+ // src/lib/host-load-gate.ts
2593
+ var import_os6 = require("os");
2594
+ var import_fs18 = require("fs");
2595
+ var import_path20 = require("path");
2596
+
2591
2597
  // src/team/worker-launch-ack.ts
2592
2598
  var WORKER_LAUNCH_RECOVERY_GATE_CONTAINED_ENV = "OMC_WORKER_LAUNCH_RECOVERY_GATE_CONTAINED";
2593
2599
  var WORKER_LAUNCH_INTERNAL_ENV_KEYS = /* @__PURE__ */ new Set([
@@ -2600,8 +2606,8 @@ var WINDOWS_RESERVED_ENV_KEYS = new Set([...WORKER_LAUNCH_INTERNAL_ENV_KEYS, "Sy
2600
2606
 
2601
2607
  // src/team/recovery-request-store.ts
2602
2608
  var import_crypto5 = require("crypto");
2603
- var import_fs18 = require("fs");
2604
- var import_path20 = require("path");
2609
+ var import_fs19 = require("fs");
2610
+ var import_path21 = require("path");
2605
2611
  init_types2();
2606
2612
  init_state_paths();
2607
2613
  init_process_identity_lock();
@@ -2635,22 +2641,22 @@ function acquireTaskLock(teamName, taskId, opts) {
2635
2641
  const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS2;
2636
2642
  const dir = canonicalTasksDir(teamName, opts?.cwd);
2637
2643
  ensureDirWithMode(dir);
2638
- const lockPath = (0, import_path23.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
2644
+ const lockPath = (0, import_path24.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
2639
2645
  for (let attempt = 0; attempt < 2; attempt++) {
2640
2646
  try {
2641
- const fd = (0, import_fs21.openSync)(lockPath, import_fs21.constants.O_CREAT | import_fs21.constants.O_EXCL | import_fs21.constants.O_WRONLY, 384);
2647
+ const fd = (0, import_fs22.openSync)(lockPath, import_fs22.constants.O_CREAT | import_fs22.constants.O_EXCL | import_fs22.constants.O_WRONLY, 384);
2642
2648
  const payload = JSON.stringify({
2643
2649
  pid: process.pid,
2644
2650
  workerName: opts?.workerName ?? "",
2645
2651
  timestamp: Date.now()
2646
2652
  });
2647
- (0, import_fs21.writeSync)(fd, payload, null, "utf-8");
2653
+ (0, import_fs22.writeSync)(fd, payload, null, "utf-8");
2648
2654
  return { fd, path: lockPath };
2649
2655
  } catch (err) {
2650
2656
  if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
2651
2657
  if (attempt === 0 && isLockStale2(lockPath, staleLockMs)) {
2652
2658
  try {
2653
- (0, import_fs21.unlinkSync)(lockPath);
2659
+ (0, import_fs22.unlinkSync)(lockPath);
2654
2660
  } catch {
2655
2661
  }
2656
2662
  continue;
@@ -2664,21 +2670,21 @@ function acquireTaskLock(teamName, taskId, opts) {
2664
2670
  }
2665
2671
  function releaseTaskLock(handle) {
2666
2672
  try {
2667
- (0, import_fs21.closeSync)(handle.fd);
2673
+ (0, import_fs22.closeSync)(handle.fd);
2668
2674
  } catch {
2669
2675
  }
2670
2676
  try {
2671
- (0, import_fs21.unlinkSync)(handle.path);
2677
+ (0, import_fs22.unlinkSync)(handle.path);
2672
2678
  } catch {
2673
2679
  }
2674
2680
  }
2675
2681
  function isLockStale2(lockPath, staleLockMs) {
2676
2682
  try {
2677
- const stat = (0, import_fs21.statSync)(lockPath);
2683
+ const stat = (0, import_fs22.statSync)(lockPath);
2678
2684
  const ageMs = Date.now() - stat.mtimeMs;
2679
2685
  if (ageMs < staleLockMs) return false;
2680
2686
  try {
2681
- const raw = (0, import_fs21.readFileSync)(lockPath, "utf-8");
2687
+ const raw = (0, import_fs22.readFileSync)(lockPath, "utf-8");
2682
2688
  const payload = JSON.parse(raw);
2683
2689
  if (payload.pid && isProcessAlive(payload.pid)) return false;
2684
2690
  } catch {
@@ -2697,37 +2703,37 @@ function sanitizeTaskId(taskId) {
2697
2703
  function canonicalTasksDir(teamName, cwd) {
2698
2704
  const root = cwd ?? process.cwd();
2699
2705
  const dir = getTaskStoragePath(root, sanitizeName(teamName));
2700
- validateResolvedPath(dir, (0, import_path23.join)(getOmcRoot(root), "state", "team"));
2706
+ validateResolvedPath(dir, (0, import_path24.join)(getOmcRoot(root), "state", "team"));
2701
2707
  return dir;
2702
2708
  }
2703
2709
  function legacyTasksDir(teamName) {
2704
2710
  const claudeConfigDir = getCopilotConfigDir();
2705
2711
  const dir = getLegacyTaskStoragePath(claudeConfigDir, sanitizeName(teamName));
2706
- validateResolvedPath(dir, (0, import_path23.join)(claudeConfigDir, "tasks"));
2712
+ validateResolvedPath(dir, (0, import_path24.join)(claudeConfigDir, "tasks"));
2707
2713
  return dir;
2708
2714
  }
2709
2715
  function resolveTaskPathForRead(teamName, taskId, cwd) {
2710
2716
  const safeTaskId = sanitizeTaskId(taskId);
2711
2717
  const canonicalDir = canonicalTasksDir(teamName, cwd);
2712
- const canonical = (0, import_path23.join)(canonicalDir, `${normalizeTaskFileStem(safeTaskId)}.json`);
2713
- if ((0, import_fs21.existsSync)(canonical)) return canonical;
2714
- const legacyCanonical = (0, import_path23.join)(canonicalDir, `${safeTaskId}.json`);
2715
- if ((0, import_fs21.existsSync)(legacyCanonical)) return legacyCanonical;
2716
- const legacy = (0, import_path23.join)(legacyTasksDir(teamName), `${safeTaskId}.json`);
2717
- if ((0, import_fs21.existsSync)(legacy)) return legacy;
2718
+ const canonical = (0, import_path24.join)(canonicalDir, `${normalizeTaskFileStem(safeTaskId)}.json`);
2719
+ if ((0, import_fs22.existsSync)(canonical)) return canonical;
2720
+ const legacyCanonical = (0, import_path24.join)(canonicalDir, `${safeTaskId}.json`);
2721
+ if ((0, import_fs22.existsSync)(legacyCanonical)) return legacyCanonical;
2722
+ const legacy = (0, import_path24.join)(legacyTasksDir(teamName), `${safeTaskId}.json`);
2723
+ if ((0, import_fs22.existsSync)(legacy)) return legacy;
2718
2724
  return canonical;
2719
2725
  }
2720
2726
  function resolveTaskPathForWrite(teamName, taskId, cwd) {
2721
- return (0, import_path23.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
2727
+ return (0, import_path24.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
2722
2728
  }
2723
2729
  function failureSidecarPath(teamName, taskId, cwd) {
2724
- return (0, import_path23.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
2730
+ return (0, import_path24.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
2725
2731
  }
2726
2732
  function readTask(teamName, taskId, opts) {
2727
2733
  const filePath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
2728
- if (!(0, import_fs21.existsSync)(filePath)) return null;
2734
+ if (!(0, import_fs22.existsSync)(filePath)) return null;
2729
2735
  try {
2730
- const raw = (0, import_fs21.readFileSync)(filePath, "utf-8");
2736
+ const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
2731
2737
  return JSON.parse(raw);
2732
2738
  } catch {
2733
2739
  return null;
@@ -2739,7 +2745,7 @@ function updateTask(teamName, taskId, updates, opts) {
2739
2745
  const readPath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
2740
2746
  let task;
2741
2747
  try {
2742
- const raw = (0, import_fs21.readFileSync)(readPath, "utf-8");
2748
+ const raw = (0, import_fs22.readFileSync)(readPath, "utf-8");
2743
2749
  task = JSON.parse(raw);
2744
2750
  } catch {
2745
2751
  throw new Error(`Task file not found or malformed: ${taskId}`);
@@ -2768,7 +2774,7 @@ function updateTask(teamName, taskId, updates, opts) {
2768
2774
  }
2769
2775
  async function findNextTask(teamName, workerName, opts) {
2770
2776
  const dir = canonicalTasksDir(teamName, opts?.cwd);
2771
- if (!(0, import_fs21.existsSync)(dir)) return null;
2777
+ if (!(0, import_fs22.existsSync)(dir)) return null;
2772
2778
  const taskIds = listTaskIds(teamName, opts);
2773
2779
  for (const id of taskIds) {
2774
2780
  const task = readTask(teamName, id, opts);
@@ -2787,7 +2793,7 @@ async function findNextTask(teamName, workerName, opts) {
2787
2793
  let taskData;
2788
2794
  try {
2789
2795
  const readPath = resolveTaskPathForRead(teamName, id, opts?.cwd);
2790
- const raw = (0, import_fs21.readFileSync)(readPath, "utf-8");
2796
+ const raw = (0, import_fs22.readFileSync)(readPath, "utf-8");
2791
2797
  taskData = JSON.parse(raw);
2792
2798
  } catch {
2793
2799
  continue;
@@ -2826,9 +2832,9 @@ function writeTaskFailure(teamName, taskId, error, opts) {
2826
2832
  }
2827
2833
  function readTaskFailure(teamName, taskId, opts) {
2828
2834
  const filePath = failureSidecarPath(teamName, taskId, opts?.cwd);
2829
- if (!(0, import_fs21.existsSync)(filePath)) return null;
2835
+ if (!(0, import_fs22.existsSync)(filePath)) return null;
2830
2836
  try {
2831
- const raw = (0, import_fs21.readFileSync)(filePath, "utf-8");
2837
+ const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
2832
2838
  return JSON.parse(raw);
2833
2839
  } catch {
2834
2840
  return null;
@@ -2836,9 +2842,9 @@ function readTaskFailure(teamName, taskId, opts) {
2836
2842
  }
2837
2843
  function listTaskIds(teamName, opts) {
2838
2844
  const scanDir = (dir) => {
2839
- if (!(0, import_fs21.existsSync)(dir)) return [];
2845
+ if (!(0, import_fs22.existsSync)(dir)) return [];
2840
2846
  try {
2841
- return (0, import_fs21.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.includes(".tmp.") && !f.includes(".failure.") && !f.endsWith(".lock")).map((f) => f.replace(/^task-/, "").replace(".json", ""));
2847
+ return (0, import_fs22.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.includes(".tmp.") && !f.includes(".failure.") && !f.endsWith(".lock")).map((f) => f.replace(/^task-/, "").replace(".json", ""));
2842
2848
  } catch {
2843
2849
  return [];
2844
2850
  }
@@ -2856,32 +2862,32 @@ function listTaskIds(teamName, opts) {
2856
2862
  }
2857
2863
 
2858
2864
  // src/team/inbox-outbox.ts
2859
- var import_fs22 = require("fs");
2860
- var import_path24 = require("path");
2865
+ var import_fs23 = require("fs");
2866
+ var import_path25 = require("path");
2861
2867
  init_config_dir();
2862
2868
  var MAX_INBOX_READ_SIZE = 10 * 1024 * 1024;
2863
2869
  function teamsDir(teamName) {
2864
- const result = (0, import_path24.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
2865
- validateResolvedPath(result, (0, import_path24.join)(getCopilotConfigDir(), "teams"));
2870
+ const result = (0, import_path25.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
2871
+ validateResolvedPath(result, (0, import_path25.join)(getCopilotConfigDir(), "teams"));
2866
2872
  return result;
2867
2873
  }
2868
2874
  function inboxPath(teamName, workerName) {
2869
- return (0, import_path24.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
2875
+ return (0, import_path25.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
2870
2876
  }
2871
2877
  function inboxCursorPath(teamName, workerName) {
2872
- return (0, import_path24.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
2878
+ return (0, import_path25.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
2873
2879
  }
2874
2880
  function outboxPath(teamName, workerName) {
2875
- return (0, import_path24.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
2881
+ return (0, import_path25.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
2876
2882
  }
2877
2883
  function signalPath(teamName, workerName) {
2878
- return (0, import_path24.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
2884
+ return (0, import_path25.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
2879
2885
  }
2880
2886
  function drainSignalPath(teamName, workerName) {
2881
- return (0, import_path24.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
2887
+ return (0, import_path25.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
2882
2888
  }
2883
2889
  function ensureDir(filePath) {
2884
- const dir = (0, import_path24.dirname)(filePath);
2890
+ const dir = (0, import_path25.dirname)(filePath);
2885
2891
  ensureDirWithMode(dir);
2886
2892
  }
2887
2893
  function appendOutbox(teamName, workerName, message) {
@@ -2891,32 +2897,32 @@ function appendOutbox(teamName, workerName, message) {
2891
2897
  }
2892
2898
  function rotateOutboxIfNeeded(teamName, workerName, maxLines) {
2893
2899
  const filePath = outboxPath(teamName, workerName);
2894
- if (!(0, import_fs22.existsSync)(filePath)) return;
2900
+ if (!(0, import_fs23.existsSync)(filePath)) return;
2895
2901
  try {
2896
- const content = (0, import_fs22.readFileSync)(filePath, "utf-8");
2902
+ const content = (0, import_fs23.readFileSync)(filePath, "utf-8");
2897
2903
  const lines = content.split("\n").filter((l) => l.trim());
2898
2904
  if (lines.length <= maxLines) return;
2899
2905
  const keepCount = Math.floor(maxLines / 2);
2900
2906
  const kept = keepCount === 0 ? [] : lines.slice(-keepCount);
2901
2907
  const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
2902
2908
  writeFileWithMode(tmpPath, kept.join("\n") + "\n");
2903
- (0, import_fs22.renameSync)(tmpPath, filePath);
2909
+ (0, import_fs23.renameSync)(tmpPath, filePath);
2904
2910
  } catch {
2905
2911
  }
2906
2912
  }
2907
2913
  function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
2908
2914
  const filePath = inboxPath(teamName, workerName);
2909
- if (!(0, import_fs22.existsSync)(filePath)) return;
2915
+ if (!(0, import_fs23.existsSync)(filePath)) return;
2910
2916
  try {
2911
- const stat = (0, import_fs22.statSync)(filePath);
2917
+ const stat = (0, import_fs23.statSync)(filePath);
2912
2918
  if (stat.size <= maxSizeBytes) return;
2913
- const content = (0, import_fs22.readFileSync)(filePath, "utf-8");
2919
+ const content = (0, import_fs23.readFileSync)(filePath, "utf-8");
2914
2920
  const lines = content.split("\n").filter((l) => l.trim());
2915
2921
  const keepCount = Math.max(1, Math.floor(lines.length / 2));
2916
2922
  const kept = lines.slice(-keepCount);
2917
2923
  const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
2918
2924
  writeFileWithMode(tmpPath, kept.join("\n") + "\n");
2919
- (0, import_fs22.renameSync)(tmpPath, filePath);
2925
+ (0, import_fs23.renameSync)(tmpPath, filePath);
2920
2926
  const cursorFile = inboxCursorPath(teamName, workerName);
2921
2927
  atomicWriteJson(cursorFile, { bytesRead: 0 });
2922
2928
  } catch {
@@ -2925,16 +2931,16 @@ function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
2925
2931
  function readNewInboxMessages(teamName, workerName) {
2926
2932
  const inbox = inboxPath(teamName, workerName);
2927
2933
  const cursorFile = inboxCursorPath(teamName, workerName);
2928
- if (!(0, import_fs22.existsSync)(inbox)) return [];
2934
+ if (!(0, import_fs23.existsSync)(inbox)) return [];
2929
2935
  let offset = 0;
2930
- if ((0, import_fs22.existsSync)(cursorFile)) {
2936
+ if ((0, import_fs23.existsSync)(cursorFile)) {
2931
2937
  try {
2932
- const cursor = JSON.parse((0, import_fs22.readFileSync)(cursorFile, "utf-8"));
2938
+ const cursor = JSON.parse((0, import_fs23.readFileSync)(cursorFile, "utf-8"));
2933
2939
  offset = cursor.bytesRead;
2934
2940
  } catch {
2935
2941
  }
2936
2942
  }
2937
- const stat = (0, import_fs22.statSync)(inbox);
2943
+ const stat = (0, import_fs23.statSync)(inbox);
2938
2944
  if (stat.size < offset) {
2939
2945
  offset = 0;
2940
2946
  }
@@ -2944,12 +2950,12 @@ function readNewInboxMessages(teamName, workerName) {
2944
2950
  if (cappedSize < readSize) {
2945
2951
  console.warn(`[inbox-outbox] Inbox for ${workerName} exceeds ${MAX_INBOX_READ_SIZE} bytes, reading truncated`);
2946
2952
  }
2947
- const fd = (0, import_fs22.openSync)(inbox, "r");
2953
+ const fd = (0, import_fs23.openSync)(inbox, "r");
2948
2954
  const buffer = Buffer.alloc(cappedSize);
2949
2955
  try {
2950
- (0, import_fs22.readSync)(fd, buffer, 0, buffer.length, offset);
2956
+ (0, import_fs23.readSync)(fd, buffer, 0, buffer.length, offset);
2951
2957
  } finally {
2952
- (0, import_fs22.closeSync)(fd);
2958
+ (0, import_fs23.closeSync)(fd);
2953
2959
  }
2954
2960
  const newData = buffer.toString("utf-8");
2955
2961
  const lastNewlineIdx = newData.lastIndexOf("\n");
@@ -2986,9 +2992,9 @@ function readNewInboxMessages(teamName, workerName) {
2986
2992
  }
2987
2993
  function checkShutdownSignal(teamName, workerName) {
2988
2994
  const filePath = signalPath(teamName, workerName);
2989
- if (!(0, import_fs22.existsSync)(filePath)) return null;
2995
+ if (!(0, import_fs23.existsSync)(filePath)) return null;
2990
2996
  try {
2991
- const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
2997
+ const raw = (0, import_fs23.readFileSync)(filePath, "utf-8");
2992
2998
  return JSON.parse(raw);
2993
2999
  } catch {
2994
3000
  return null;
@@ -2996,18 +3002,18 @@ function checkShutdownSignal(teamName, workerName) {
2996
3002
  }
2997
3003
  function deleteShutdownSignal(teamName, workerName) {
2998
3004
  const filePath = signalPath(teamName, workerName);
2999
- if ((0, import_fs22.existsSync)(filePath)) {
3005
+ if ((0, import_fs23.existsSync)(filePath)) {
3000
3006
  try {
3001
- (0, import_fs22.unlinkSync)(filePath);
3007
+ (0, import_fs23.unlinkSync)(filePath);
3002
3008
  } catch {
3003
3009
  }
3004
3010
  }
3005
3011
  }
3006
3012
  function checkDrainSignal(teamName, workerName) {
3007
3013
  const filePath = drainSignalPath(teamName, workerName);
3008
- if (!(0, import_fs22.existsSync)(filePath)) return null;
3014
+ if (!(0, import_fs23.existsSync)(filePath)) return null;
3009
3015
  try {
3010
- const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
3016
+ const raw = (0, import_fs23.readFileSync)(filePath, "utf-8");
3011
3017
  return JSON.parse(raw);
3012
3018
  } catch {
3013
3019
  return null;
@@ -3015,34 +3021,34 @@ function checkDrainSignal(teamName, workerName) {
3015
3021
  }
3016
3022
  function deleteDrainSignal(teamName, workerName) {
3017
3023
  const filePath = drainSignalPath(teamName, workerName);
3018
- if ((0, import_fs22.existsSync)(filePath)) {
3024
+ if ((0, import_fs23.existsSync)(filePath)) {
3019
3025
  try {
3020
- (0, import_fs22.unlinkSync)(filePath);
3026
+ (0, import_fs23.unlinkSync)(filePath);
3021
3027
  } catch {
3022
3028
  }
3023
3029
  }
3024
3030
  }
3025
3031
 
3026
3032
  // src/team/team-registration.ts
3027
- var import_fs23 = require("fs");
3028
- var import_path25 = require("path");
3033
+ var import_fs24 = require("fs");
3034
+ var import_path26 = require("path");
3029
3035
  init_config_dir();
3030
3036
  init_worktree_paths();
3031
3037
  function configPath(teamName) {
3032
- const result = (0, import_path25.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
3033
- validateResolvedPath(result, (0, import_path25.join)(getCopilotConfigDir(), "teams"));
3038
+ const result = (0, import_path26.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
3039
+ validateResolvedPath(result, (0, import_path26.join)(getCopilotConfigDir(), "teams"));
3034
3040
  return result;
3035
3041
  }
3036
3042
  function shadowRegistryPath(workingDirectory) {
3037
- const result = (0, import_path25.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
3038
- validateResolvedPath(result, (0, import_path25.join)(getOmcRoot(workingDirectory), "state"));
3043
+ const result = (0, import_path26.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
3044
+ validateResolvedPath(result, (0, import_path26.join)(getOmcRoot(workingDirectory), "state"));
3039
3045
  return result;
3040
3046
  }
3041
3047
  function unregisterMcpWorker(teamName, workerName, workingDirectory) {
3042
3048
  const configFile = configPath(teamName);
3043
- if ((0, import_fs23.existsSync)(configFile)) {
3049
+ if ((0, import_fs24.existsSync)(configFile)) {
3044
3050
  try {
3045
- const raw = (0, import_fs23.readFileSync)(configFile, "utf-8");
3051
+ const raw = (0, import_fs24.readFileSync)(configFile, "utf-8");
3046
3052
  const config = JSON.parse(raw);
3047
3053
  const members = Array.isArray(config.members) ? config.members : [];
3048
3054
  config.members = members.filter((m) => m.name !== workerName);
@@ -3053,9 +3059,9 @@ function unregisterMcpWorker(teamName, workerName, workingDirectory) {
3053
3059
  const shadowFile = shadowRegistryPath(workingDirectory);
3054
3060
  try {
3055
3061
  withFileLockSync(shadowFile + ".lock", () => {
3056
- if ((0, import_fs23.existsSync)(shadowFile)) {
3062
+ if ((0, import_fs24.existsSync)(shadowFile)) {
3057
3063
  try {
3058
- const registry = JSON.parse((0, import_fs23.readFileSync)(shadowFile, "utf-8"));
3064
+ const registry = JSON.parse((0, import_fs24.readFileSync)(shadowFile, "utf-8"));
3059
3065
  registry.workers = (registry.workers || []).filter((w) => w.name !== workerName);
3060
3066
  atomicWriteJson(shadowFile, registry);
3061
3067
  } catch {
@@ -3071,9 +3077,9 @@ function isMcpWorker(member) {
3071
3077
  function listMcpWorkers(teamName, workingDirectory) {
3072
3078
  const workers = /* @__PURE__ */ new Map();
3073
3079
  const configFile = configPath(teamName);
3074
- if ((0, import_fs23.existsSync)(configFile)) {
3080
+ if ((0, import_fs24.existsSync)(configFile)) {
3075
3081
  try {
3076
- const raw = (0, import_fs23.readFileSync)(configFile, "utf-8");
3082
+ const raw = (0, import_fs24.readFileSync)(configFile, "utf-8");
3077
3083
  const config = JSON.parse(raw);
3078
3084
  const members = Array.isArray(config.members) ? config.members : [];
3079
3085
  for (const m of members) {
@@ -3085,9 +3091,9 @@ function listMcpWorkers(teamName, workingDirectory) {
3085
3091
  }
3086
3092
  }
3087
3093
  const shadowFile = shadowRegistryPath(workingDirectory);
3088
- if ((0, import_fs23.existsSync)(shadowFile)) {
3094
+ if ((0, import_fs24.existsSync)(shadowFile)) {
3089
3095
  try {
3090
- const registry = JSON.parse((0, import_fs23.readFileSync)(shadowFile, "utf-8"));
3096
+ const registry = JSON.parse((0, import_fs24.readFileSync)(shadowFile, "utf-8"));
3091
3097
  for (const w of registry.workers || []) {
3092
3098
  workers.set(w.name, w);
3093
3099
  }
@@ -3098,11 +3104,11 @@ function listMcpWorkers(teamName, workingDirectory) {
3098
3104
  }
3099
3105
 
3100
3106
  // src/team/heartbeat.ts
3101
- var import_fs24 = require("fs");
3102
- var import_path26 = require("path");
3107
+ var import_fs25 = require("fs");
3108
+ var import_path27 = require("path");
3103
3109
  init_worktree_paths();
3104
3110
  function heartbeatPath(workingDirectory, teamName, workerName) {
3105
- return (0, import_path26.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
3111
+ return (0, import_path27.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
3106
3112
  }
3107
3113
  function writeHeartbeat(workingDirectory, data) {
3108
3114
  const filePath = heartbeatPath(workingDirectory, data.teamName, data.workerName);
@@ -3110,9 +3116,9 @@ function writeHeartbeat(workingDirectory, data) {
3110
3116
  }
3111
3117
  function readHeartbeat(workingDirectory, teamName, workerName) {
3112
3118
  const filePath = heartbeatPath(workingDirectory, teamName, workerName);
3113
- if (!(0, import_fs24.existsSync)(filePath)) return null;
3119
+ if (!(0, import_fs25.existsSync)(filePath)) return null;
3114
3120
  try {
3115
- const raw = (0, import_fs24.readFileSync)(filePath, "utf-8");
3121
+ const raw = (0, import_fs25.readFileSync)(filePath, "utf-8");
3116
3122
  return JSON.parse(raw);
3117
3123
  } catch {
3118
3124
  return null;
@@ -3131,9 +3137,9 @@ function isWorkerAlive(workingDirectory, teamName, workerName, maxAgeMs) {
3131
3137
  }
3132
3138
  function deleteHeartbeat(workingDirectory, teamName, workerName) {
3133
3139
  const filePath = heartbeatPath(workingDirectory, teamName, workerName);
3134
- if ((0, import_fs24.existsSync)(filePath)) {
3140
+ if ((0, import_fs25.existsSync)(filePath)) {
3135
3141
  try {
3136
- (0, import_fs24.unlinkSync)(filePath);
3142
+ (0, import_fs25.unlinkSync)(filePath);
3137
3143
  } catch {
3138
3144
  }
3139
3145
  }
@@ -3289,28 +3295,28 @@ function findPermissionViolations(changedPaths, permissions, cwd) {
3289
3295
  }
3290
3296
 
3291
3297
  // src/agents/prompt-helpers.ts
3292
- var import_fs25 = require("fs");
3293
- var import_path27 = require("path");
3298
+ var import_fs26 = require("fs");
3299
+ var import_path28 = require("path");
3294
3300
  var import_url4 = require("url");
3295
3301
  function getPackageDir3() {
3296
3302
  if (typeof __dirname !== "undefined" && __dirname) {
3297
- const currentDirName = (0, import_path27.basename)(__dirname);
3298
- const parentDirName = (0, import_path27.basename)((0, import_path27.dirname)(__dirname));
3303
+ const currentDirName = (0, import_path28.basename)(__dirname);
3304
+ const parentDirName = (0, import_path28.basename)((0, import_path28.dirname)(__dirname));
3299
3305
  if (currentDirName === "bridge") {
3300
- return (0, import_path27.join)(__dirname, "..");
3306
+ return (0, import_path28.join)(__dirname, "..");
3301
3307
  }
3302
3308
  if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
3303
- return (0, import_path27.join)(__dirname, "..", "..");
3309
+ return (0, import_path28.join)(__dirname, "..", "..");
3304
3310
  }
3305
3311
  }
3306
3312
  try {
3307
3313
  const __filename = (0, import_url4.fileURLToPath)(importMetaUrl);
3308
- const __dirname2 = (0, import_path27.dirname)(__filename);
3309
- const currentDirName = (0, import_path27.basename)(__dirname2);
3314
+ const __dirname2 = (0, import_path28.dirname)(__filename);
3315
+ const currentDirName = (0, import_path28.basename)(__dirname2);
3310
3316
  if (currentDirName === "bridge") {
3311
- return (0, import_path27.join)(__dirname2, "..");
3317
+ return (0, import_path28.join)(__dirname2, "..");
3312
3318
  }
3313
- return (0, import_path27.join)(__dirname2, "..", "..");
3319
+ return (0, import_path28.join)(__dirname2, "..", "..");
3314
3320
  } catch {
3315
3321
  }
3316
3322
  return process.cwd();
@@ -3326,9 +3332,9 @@ function getValidAgentRoles() {
3326
3332
  } catch {
3327
3333
  }
3328
3334
  try {
3329
- const agentsDir = (0, import_path27.join)(getPackageDir3(), "agents");
3330
- const files = (0, import_fs25.readdirSync)(agentsDir);
3331
- _cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path27.basename)(f, ".md")).sort();
3335
+ const agentsDir = (0, import_path28.join)(getPackageDir3(), "agents");
3336
+ const files = (0, import_fs26.readdirSync)(agentsDir);
3337
+ _cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path28.basename)(f, ".md")).sort();
3332
3338
  } catch (err) {
3333
3339
  console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
3334
3340
  _cachedRoles = [];
@@ -3350,8 +3356,8 @@ function sanitizePromptContent(content, maxLength = 4e3) {
3350
3356
  }
3351
3357
 
3352
3358
  // src/team/team-status.ts
3353
- var import_fs26 = require("fs");
3354
- var import_path28 = require("path");
3359
+ var import_fs27 = require("fs");
3360
+ var import_path29 = require("path");
3355
3361
  init_config_dir();
3356
3362
 
3357
3363
  // src/team/usage-tracker.ts
@@ -3442,10 +3448,10 @@ function emptyUsageReport(teamName) {
3442
3448
  function peekRecentOutboxMessages(teamName, workerName, maxMessages = 10) {
3443
3449
  const safeName = sanitizeName(teamName);
3444
3450
  const safeWorker = sanitizeName(workerName);
3445
- const outboxPath2 = (0, import_path28.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
3446
- if (!(0, import_fs26.existsSync)(outboxPath2)) return [];
3451
+ const outboxPath2 = (0, import_path29.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
3452
+ if (!(0, import_fs27.existsSync)(outboxPath2)) return [];
3447
3453
  try {
3448
- const content = (0, import_fs26.readFileSync)(outboxPath2, "utf-8");
3454
+ const content = (0, import_fs27.readFileSync)(outboxPath2, "utf-8");
3449
3455
  const lines = content.split("\n").filter((l) => l.trim());
3450
3456
  const recentLines = lines.slice(-maxMessages);
3451
3457
  const messages = [];
@@ -3718,29 +3724,29 @@ function buildTaskPrompt(task, messages, config) {
3718
3724
  return result;
3719
3725
  }
3720
3726
  function writePromptFile(config, taskId, prompt) {
3721
- const dir = (0, import_path29.join)(getOmcRoot(config.workingDirectory), "prompts");
3727
+ const dir = (0, import_path30.join)(getOmcRoot(config.workingDirectory), "prompts");
3722
3728
  ensureDirWithMode(dir);
3723
3729
  const filename = `team-${config.teamName}-task-${taskId}-${Date.now()}.md`;
3724
- const filePath = (0, import_path29.join)(dir, filename);
3730
+ const filePath = (0, import_path30.join)(dir, filename);
3725
3731
  writeFileWithMode(filePath, prompt);
3726
3732
  return filePath;
3727
3733
  }
3728
3734
  function getOutputPath(config, taskId) {
3729
- const dir = (0, import_path29.join)(getOmcRoot(config.workingDirectory), "outputs");
3735
+ const dir = (0, import_path30.join)(getOmcRoot(config.workingDirectory), "outputs");
3730
3736
  ensureDirWithMode(dir);
3731
3737
  const suffix = Math.random().toString(36).slice(2, 8);
3732
- return (0, import_path29.join)(
3738
+ return (0, import_path30.join)(
3733
3739
  dir,
3734
3740
  `team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`
3735
3741
  );
3736
3742
  }
3737
3743
  function readOutputSummary(outputFile) {
3738
3744
  try {
3739
- if (!(0, import_fs27.existsSync)(outputFile)) return "(no output file)";
3745
+ if (!(0, import_fs28.existsSync)(outputFile)) return "(no output file)";
3740
3746
  const buf = Buffer.alloc(1024);
3741
- const fd = (0, import_fs27.openSync)(outputFile, "r");
3747
+ const fd = (0, import_fs28.openSync)(outputFile, "r");
3742
3748
  try {
3743
- const bytesRead = (0, import_fs27.readSync)(fd, buf, 0, 1024, 0);
3749
+ const bytesRead = (0, import_fs28.readSync)(fd, buf, 0, 1024, 0);
3744
3750
  if (bytesRead === 0) return "(empty output)";
3745
3751
  const content = buf.toString("utf-8", 0, bytesRead);
3746
3752
  if (content.length > 500) {
@@ -3748,7 +3754,7 @@ function readOutputSummary(outputFile) {
3748
3754
  }
3749
3755
  return content;
3750
3756
  } finally {
3751
- (0, import_fs27.closeSync)(fd);
3757
+ (0, import_fs28.closeSync)(fd);
3752
3758
  }
3753
3759
  } catch {
3754
3760
  return "(error reading output)";
@@ -4304,16 +4310,16 @@ ${violationSummary}`
4304
4310
  init_worktree_paths();
4305
4311
  init_config_dir();
4306
4312
  function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
4307
- const resolved = (0, import_path30.resolve)(configPath2);
4308
- const normalizedHome = (0, import_path30.resolve)(homeDir);
4313
+ const resolved = (0, import_path31.resolve)(configPath2);
4314
+ const normalizedHome = (0, import_path31.resolve)(homeDir);
4309
4315
  const isUnderHome = isAtOrUnder(normalizedHome, resolved);
4310
- const normalizedConfigDir = (0, import_path30.resolve)(claudeConfigDir);
4311
- const normalizedOmcDir = (0, import_path30.resolve)(homeDir, ".omg");
4316
+ const normalizedConfigDir = (0, import_path31.resolve)(claudeConfigDir);
4317
+ const normalizedOmcDir = (0, import_path31.resolve)(homeDir, ".omg");
4312
4318
  const isTrustedSubpath = isAtOrUnder(normalizedConfigDir, resolved) || isAtOrUnder(normalizedOmcDir, resolved) || hasOmcPathSegment(resolved);
4313
4319
  if (!isUnderHome || !isTrustedSubpath) return false;
4314
4320
  try {
4315
- const parentDir = (0, import_path30.resolve)(resolved, "..");
4316
- const realParent = (0, import_fs28.realpathSync)(parentDir);
4321
+ const parentDir = (0, import_path31.resolve)(resolved, "..");
4322
+ const realParent = (0, import_fs29.realpathSync)(parentDir);
4317
4323
  if (!isAtOrUnder(normalizedHome, realParent)) {
4318
4324
  return false;
4319
4325
  }
@@ -4322,9 +4328,9 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
4322
4328
  return true;
4323
4329
  }
4324
4330
  function isAtOrUnder(parent, child) {
4325
- const rel = (0, import_path30.relative)(parent, child);
4331
+ const rel = (0, import_path31.relative)(parent, child);
4326
4332
  if (rel === "") return true;
4327
- return !rel.startsWith("..") && !(0, import_path30.isAbsolute)(rel);
4333
+ return !rel.startsWith("..") && !(0, import_path31.isAbsolute)(rel);
4328
4334
  }
4329
4335
  function hasOmcPathSegment(absolutePath) {
4330
4336
  return absolutePath.split(/[\\/]/).includes(".omg");
@@ -4332,15 +4338,15 @@ function hasOmcPathSegment(absolutePath) {
4332
4338
  function validateBridgeWorkingDirectory(workingDirectory) {
4333
4339
  let stat;
4334
4340
  try {
4335
- stat = (0, import_fs28.statSync)(workingDirectory);
4341
+ stat = (0, import_fs29.statSync)(workingDirectory);
4336
4342
  } catch {
4337
4343
  throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
4338
4344
  }
4339
4345
  if (!stat.isDirectory()) {
4340
4346
  throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
4341
4347
  }
4342
- const resolved = (0, import_fs28.realpathSync)(workingDirectory);
4343
- const home = (0, import_path30.resolve)((0, import_os7.homedir)());
4348
+ const resolved = (0, import_fs29.realpathSync)(workingDirectory);
4349
+ const home = (0, import_path31.resolve)((0, import_os8.homedir)());
4344
4350
  if (!isAtOrUnder(home, resolved)) {
4345
4351
  throw new Error(`workingDirectory is outside home directory: ${resolved}`);
4346
4352
  }
@@ -4355,8 +4361,8 @@ function main() {
4355
4361
  console.error("Usage: node bridge-entry.js --config <path-to-config.json>");
4356
4362
  process.exit(1);
4357
4363
  }
4358
- const configPath2 = (0, import_path30.resolve)(process.argv[configIdx + 1]);
4359
- const home = (0, import_os7.homedir)();
4364
+ const configPath2 = (0, import_path31.resolve)(process.argv[configIdx + 1]);
4365
+ const home = (0, import_os8.homedir)();
4360
4366
  const claudeConfigDir = getCopilotConfigDir();
4361
4367
  if (!validateConfigPath(configPath2, home, claudeConfigDir)) {
4362
4368
  console.error(`Config path must be under ~/ with ${claudeConfigDir} or ~/.omg/ subpath: ${configPath2}`);
@@ -4364,7 +4370,7 @@ function main() {
4364
4370
  }
4365
4371
  let config;
4366
4372
  try {
4367
- const raw = (0, import_fs28.readFileSync)(configPath2, "utf-8");
4373
+ const raw = (0, import_fs29.readFileSync)(configPath2, "utf-8");
4368
4374
  config = JSON.parse(raw);
4369
4375
  } catch (err) {
4370
4376
  console.error(`Failed to read config from ${configPath2}: ${err.message}`);