oh-my-copilot 5.0.0 → 5.5.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 (1428) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/.claude-plugin/plugin.json +16 -1
  3. package/README.md +15 -4
  4. package/agents/debugger.md +9 -1
  5. package/agents/explore.md +3 -1
  6. package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
  7. package/bridge/claude-md-coordinator.cjs +2 -2
  8. package/bridge/cli.cjs +35962 -26371
  9. package/bridge/mcp-server.cjs +3025 -1333
  10. package/bridge/runtime-cli.cjs +20794 -16157
  11. package/bridge/team-bridge.cjs +2074 -587
  12. package/bridge/team-mcp.cjs +22008 -12937
  13. package/bridge/team.js +16235 -10694
  14. package/copilot/agents/analyst.md +120 -0
  15. package/copilot/agents/architect.md +129 -0
  16. package/copilot/agents/code-reviewer.md +242 -0
  17. package/copilot/agents/code-simplifier.md +92 -0
  18. package/copilot/agents/critic.md +280 -0
  19. package/copilot/agents/debugger.md +158 -0
  20. package/copilot/agents/designer.md +117 -0
  21. package/copilot/agents/devils-advocate.md +221 -0
  22. package/copilot/agents/document-specialist.md +77 -0
  23. package/copilot/agents/executor.md +121 -0
  24. package/copilot/agents/explore.md +120 -0
  25. package/copilot/agents/git-master.md +95 -0
  26. package/copilot/agents/planner.md +140 -0
  27. package/copilot/agents/qa-tester.md +101 -0
  28. package/copilot/agents/scientist.md +95 -0
  29. package/copilot/agents/security-reviewer.md +191 -0
  30. package/copilot/agents/test-engineer.md +126 -0
  31. package/copilot/agents/tracer.md +168 -0
  32. package/copilot/agents/verifier.md +114 -0
  33. package/copilot/agents/writer.md +91 -0
  34. package/copilot/hooks.json +381 -0
  35. package/dist/__tests__/auto-slash-aliases.test.js +2 -2
  36. package/dist/__tests__/auto-slash-aliases.test.js.map +1 -1
  37. package/dist/__tests__/auto-slash-live-data-security.test.js +4 -4
  38. package/dist/__tests__/auto-slash-live-data-security.test.js.map +1 -1
  39. package/dist/__tests__/auto-update.test.js +16 -16
  40. package/dist/__tests__/auto-update.test.js.map +1 -1
  41. package/dist/__tests__/bounded-git-timeout-parity.test.js +2 -0
  42. package/dist/__tests__/bounded-git-timeout-parity.test.js.map +1 -1
  43. package/dist/__tests__/cli-config-stop-callback.test.js +3 -3
  44. package/dist/__tests__/cli-config-stop-callback.test.js.map +1 -1
  45. package/dist/__tests__/cli-notify-profile.test.js +1 -1
  46. package/dist/__tests__/cli-notify-profile.test.js.map +1 -1
  47. package/dist/__tests__/config-dir.test.js +88 -36
  48. package/dist/__tests__/config-dir.test.js.map +1 -1
  49. package/dist/__tests__/config-worker-permissions.test.d.ts +2 -0
  50. package/dist/__tests__/config-worker-permissions.test.d.ts.map +1 -0
  51. package/dist/__tests__/config-worker-permissions.test.js +99 -0
  52. package/dist/__tests__/config-worker-permissions.test.js.map +1 -0
  53. package/dist/__tests__/consolidation-contracts.test.js +7 -1
  54. package/dist/__tests__/consolidation-contracts.test.js.map +1 -1
  55. package/dist/__tests__/context-bloat-2577.test.js.map +1 -1
  56. package/dist/__tests__/copilot-agents-manifest.test.d.ts +2 -0
  57. package/dist/__tests__/copilot-agents-manifest.test.d.ts.map +1 -0
  58. package/dist/__tests__/copilot-agents-manifest.test.js +162 -0
  59. package/dist/__tests__/copilot-agents-manifest.test.js.map +1 -0
  60. package/dist/__tests__/copilot-config-dir-alias.test.d.ts +2 -0
  61. package/dist/__tests__/copilot-config-dir-alias.test.d.ts.map +1 -0
  62. package/dist/__tests__/copilot-config-dir-alias.test.js +13 -0
  63. package/dist/__tests__/copilot-config-dir-alias.test.js.map +1 -0
  64. package/dist/__tests__/copilot-hook-adapter.test.d.ts +2 -0
  65. package/dist/__tests__/copilot-hook-adapter.test.d.ts.map +1 -0
  66. package/dist/__tests__/copilot-hook-adapter.test.js +385 -0
  67. package/dist/__tests__/copilot-hook-adapter.test.js.map +1 -0
  68. package/dist/__tests__/copilot-hooks-manifest.test.d.ts +2 -0
  69. package/dist/__tests__/copilot-hooks-manifest.test.d.ts.map +1 -0
  70. package/dist/__tests__/copilot-hooks-manifest.test.js +201 -0
  71. package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -0
  72. package/dist/__tests__/delegation-enforcement-levels.test.js +47 -16
  73. package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -1
  74. package/dist/__tests__/directory-context-injector-registration.test.d.ts +2 -0
  75. package/dist/__tests__/directory-context-injector-registration.test.d.ts.map +1 -0
  76. package/dist/__tests__/directory-context-injector-registration.test.js +79 -0
  77. package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -0
  78. package/dist/__tests__/doctor-conflicts.test.js +71 -16
  79. package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
  80. package/dist/__tests__/doctor-legacy-config-dir.test.d.ts +2 -0
  81. package/dist/__tests__/doctor-legacy-config-dir.test.d.ts.map +1 -0
  82. package/dist/__tests__/doctor-legacy-config-dir.test.js +45 -0
  83. package/dist/__tests__/doctor-legacy-config-dir.test.js.map +1 -0
  84. package/dist/__tests__/doctor-node-on-path.test.d.ts +2 -0
  85. package/dist/__tests__/doctor-node-on-path.test.d.ts.map +1 -0
  86. package/dist/__tests__/doctor-node-on-path.test.js +63 -0
  87. package/dist/__tests__/doctor-node-on-path.test.js.map +1 -0
  88. package/dist/__tests__/hook-command-normalizer.test.js +4 -4
  89. package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
  90. package/dist/__tests__/hooks-command-escaping.test.js +2 -2
  91. package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
  92. package/dist/__tests__/hooks.test.js +44 -0
  93. package/dist/__tests__/hooks.test.js.map +1 -1
  94. package/dist/__tests__/host-detection.test.js +28 -8
  95. package/dist/__tests__/host-detection.test.js.map +1 -1
  96. package/dist/__tests__/hud/cli-diagnostic.test.js +1 -0
  97. package/dist/__tests__/hud/cli-diagnostic.test.js.map +1 -1
  98. package/dist/__tests__/hud/labels.test.js +4 -4
  99. package/dist/__tests__/hud/labels.test.js.map +1 -1
  100. package/dist/__tests__/hud/model.test.js +22 -0
  101. package/dist/__tests__/hud/model.test.js.map +1 -1
  102. package/dist/__tests__/hud/update-hint.test.d.ts +2 -0
  103. package/dist/__tests__/hud/update-hint.test.d.ts.map +1 -0
  104. package/dist/__tests__/hud/update-hint.test.js +120 -0
  105. package/dist/__tests__/hud/update-hint.test.js.map +1 -0
  106. package/dist/__tests__/hud/usage-api-header-fallback.test.d.ts +2 -0
  107. package/dist/__tests__/hud/usage-api-header-fallback.test.d.ts.map +1 -0
  108. package/dist/__tests__/hud/usage-api-header-fallback.test.js +70 -0
  109. package/dist/__tests__/hud/usage-api-header-fallback.test.js.map +1 -0
  110. package/dist/__tests__/hud/usage-api-lock.test.js +6 -6
  111. package/dist/__tests__/hud/usage-api-lock.test.js.map +1 -1
  112. package/dist/__tests__/hud/usage-api-stale.test.js +6 -6
  113. package/dist/__tests__/hud/usage-api-stale.test.js.map +1 -1
  114. package/dist/__tests__/hud/usage-api.test.js +84 -6
  115. package/dist/__tests__/hud/usage-api.test.js.map +1 -1
  116. package/dist/__tests__/hud/watch-mode-init.test.js +171 -22
  117. package/dist/__tests__/hud/watch-mode-init.test.js.map +1 -1
  118. package/dist/__tests__/hud-cache-wrapper.test.js +453 -5
  119. package/dist/__tests__/hud-cache-wrapper.test.js.map +1 -1
  120. package/dist/__tests__/hud-marketplace-resolution.test.js +10 -10
  121. package/dist/__tests__/hud-marketplace-resolution.test.js.map +1 -1
  122. package/dist/__tests__/hud-windows.test.js +1 -1
  123. package/dist/__tests__/hud-windows.test.js.map +1 -1
  124. package/dist/__tests__/installer-hooks-merge.test.js +3 -3
  125. package/dist/__tests__/installer-hooks-merge.test.js.map +1 -1
  126. package/dist/__tests__/installer-hud-skip.test.js +8 -8
  127. package/dist/__tests__/installer-hud-skip.test.js.map +1 -1
  128. package/dist/__tests__/installer-mcp-config.test.js +2 -2
  129. package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
  130. package/dist/__tests__/installer-omc-reference.test.js +4 -4
  131. package/dist/__tests__/installer-omc-reference.test.js.map +1 -1
  132. package/dist/__tests__/installer-plugin-agents.test.js +4 -4
  133. package/dist/__tests__/installer-plugin-agents.test.js.map +1 -1
  134. package/dist/__tests__/installer-version-guard.test.js +2 -2
  135. package/dist/__tests__/installer-version-guard.test.js.map +1 -1
  136. package/dist/__tests__/installer.test.js +8 -8
  137. package/dist/__tests__/installer.test.js.map +1 -1
  138. package/dist/__tests__/keyword-detector-echo-guard.test.js +2 -2
  139. package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
  140. package/dist/__tests__/keyword-detector-script.test.js +50 -6
  141. package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
  142. package/dist/__tests__/live-data.test.js +4 -0
  143. package/dist/__tests__/live-data.test.js.map +1 -1
  144. package/dist/__tests__/manual-compact-command.test.js +4 -4
  145. package/dist/__tests__/manual-compact-command.test.js.map +1 -1
  146. package/dist/__tests__/notepad.test.js +61 -0
  147. package/dist/__tests__/notepad.test.js.map +1 -1
  148. package/dist/__tests__/npm-package-bin-surface.test.js +3 -2
  149. package/dist/__tests__/npm-package-bin-surface.test.js.map +1 -1
  150. package/dist/__tests__/package-dir-resolution-regression.test.js +13 -6
  151. package/dist/__tests__/package-dir-resolution-regression.test.js.map +1 -1
  152. package/dist/__tests__/plugin-setup-deps.test.js +137 -50
  153. package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
  154. package/dist/__tests__/plugin-shipping-surface.test.js +61 -0
  155. package/dist/__tests__/plugin-shipping-surface.test.js.map +1 -1
  156. package/dist/__tests__/plugin-skill-budget.test.js +7 -1
  157. package/dist/__tests__/plugin-skill-budget.test.js.map +1 -1
  158. package/dist/__tests__/post-tool-rules-injector.test.js +42 -12
  159. package/dist/__tests__/post-tool-rules-injector.test.js.map +1 -1
  160. package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.d.ts +2 -0
  161. package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.d.ts.map +1 -0
  162. package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.js +136 -0
  163. package/dist/__tests__/pre-tool-enforcer-jev-wiring.test.js.map +1 -0
  164. package/dist/__tests__/pre-tool-enforcer.test.js +180 -4
  165. package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -1
  166. package/dist/__tests__/preemptive-compaction-hook.test.js +44 -7
  167. package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
  168. package/dist/__tests__/project-memory-posttool.test.d.ts +2 -0
  169. package/dist/__tests__/project-memory-posttool.test.d.ts.map +1 -0
  170. package/dist/__tests__/project-memory-posttool.test.js +84 -0
  171. package/dist/__tests__/project-memory-posttool.test.js.map +1 -0
  172. package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js +2 -2
  173. package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js.map +1 -1
  174. package/dist/__tests__/rate-limit-wait/integration.test.js +3 -3
  175. package/dist/__tests__/rate-limit-wait/integration.test.js.map +1 -1
  176. package/dist/__tests__/rate-limit-wait/pane-fresh-capture.test.js +0 -1
  177. package/dist/__tests__/rate-limit-wait/pane-fresh-capture.test.js.map +1 -1
  178. package/dist/__tests__/read-budget-preflight.test.d.ts +2 -0
  179. package/dist/__tests__/read-budget-preflight.test.d.ts.map +1 -0
  180. package/dist/__tests__/read-budget-preflight.test.js +142 -0
  181. package/dist/__tests__/read-budget-preflight.test.js.map +1 -0
  182. package/dist/__tests__/release-boundary.test.js +32 -2
  183. package/dist/__tests__/release-boundary.test.js.map +1 -1
  184. package/dist/__tests__/release-guidance.test.js +10 -0
  185. package/dist/__tests__/release-guidance.test.js.map +1 -1
  186. package/dist/__tests__/repair-plugin-cache-script.test.js +10 -9
  187. package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
  188. package/dist/__tests__/resolve-transcript-path.test.js +10 -10
  189. package/dist/__tests__/resolve-transcript-path.test.js.map +1 -1
  190. package/dist/__tests__/run-cjs-generic-timeout.test.js +146 -12
  191. package/dist/__tests__/run-cjs-generic-timeout.test.js.map +1 -1
  192. package/dist/__tests__/run-cjs-graceful-fallback.test.js +86 -14
  193. package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
  194. package/dist/__tests__/run-cjs-windows-stdio-contract.test.d.ts +2 -0
  195. package/dist/__tests__/run-cjs-windows-stdio-contract.test.d.ts.map +1 -0
  196. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +841 -0
  197. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -0
  198. package/dist/__tests__/run-cjs-worker-skip-guard.test.d.ts +2 -0
  199. package/dist/__tests__/run-cjs-worker-skip-guard.test.d.ts.map +1 -0
  200. package/dist/__tests__/run-cjs-worker-skip-guard.test.js +75 -0
  201. package/dist/__tests__/run-cjs-worker-skip-guard.test.js.map +1 -0
  202. package/dist/__tests__/session-end-process-exit.test.js +82 -21
  203. package/dist/__tests__/session-end-process-exit.test.js.map +1 -1
  204. package/dist/__tests__/session-friction-report.test.js +2 -2
  205. package/dist/__tests__/session-friction-report.test.js.map +1 -1
  206. package/dist/__tests__/session-history-search.test.js +90 -7
  207. package/dist/__tests__/session-history-search.test.js.map +1 -1
  208. package/dist/__tests__/session-start-background-output.test.js +1 -1
  209. package/dist/__tests__/session-start-background-output.test.js.map +1 -1
  210. package/dist/__tests__/session-start-cache-cleanup.test.js +9 -9
  211. package/dist/__tests__/session-start-cache-cleanup.test.js.map +1 -1
  212. package/dist/__tests__/session-start-context-budget.test.d.ts +2 -0
  213. package/dist/__tests__/session-start-context-budget.test.d.ts.map +1 -0
  214. package/dist/__tests__/session-start-context-budget.test.js +84 -0
  215. package/dist/__tests__/session-start-context-budget.test.js.map +1 -0
  216. package/dist/__tests__/session-start-script-context.test.js +4 -4
  217. package/dist/__tests__/session-start-script-context.test.js.map +1 -1
  218. package/dist/__tests__/session-start-timeout-cleanup.test.js +11 -7
  219. package/dist/__tests__/session-start-timeout-cleanup.test.js.map +1 -1
  220. package/dist/__tests__/session-start-update-check.test.d.ts +2 -0
  221. package/dist/__tests__/session-start-update-check.test.d.ts.map +1 -0
  222. package/dist/__tests__/session-start-update-check.test.js +69 -0
  223. package/dist/__tests__/session-start-update-check.test.js.map +1 -0
  224. package/dist/__tests__/session-start-update-refresh.test.d.ts +2 -0
  225. package/dist/__tests__/session-start-update-refresh.test.d.ts.map +1 -0
  226. package/dist/__tests__/session-start-update-refresh.test.js +179 -0
  227. package/dist/__tests__/session-start-update-refresh.test.js.map +1 -0
  228. package/dist/__tests__/setup/clear-copilot-home.d.ts +2 -0
  229. package/dist/__tests__/setup/clear-copilot-home.d.ts.map +1 -0
  230. package/dist/__tests__/setup/clear-copilot-home.js +5 -0
  231. package/dist/__tests__/setup/clear-copilot-home.js.map +1 -0
  232. package/dist/__tests__/setup-claude-md-script.test.js +105 -21
  233. package/dist/__tests__/setup-claude-md-script.test.js.map +1 -1
  234. package/dist/__tests__/setup-contracts-regression.test.d.ts +2 -2
  235. package/dist/__tests__/setup-contracts-regression.test.js +49 -43
  236. package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
  237. package/dist/__tests__/setup-lifecycle-node.test.js +5 -5
  238. package/dist/__tests__/setup-lifecycle-node.test.js.map +1 -1
  239. package/dist/__tests__/setup-progress-script.test.js +3 -3
  240. package/dist/__tests__/setup-progress-script.test.js.map +1 -1
  241. package/dist/__tests__/shared-memory.test.js +8 -8
  242. package/dist/__tests__/shared-memory.test.js.map +1 -1
  243. package/dist/__tests__/shipyard-seed-locale.test.d.ts +2 -0
  244. package/dist/__tests__/shipyard-seed-locale.test.d.ts.map +1 -0
  245. package/dist/__tests__/shipyard-seed-locale.test.js +213 -0
  246. package/dist/__tests__/shipyard-seed-locale.test.js.map +1 -0
  247. package/dist/__tests__/shipyard-skills.test.d.ts +2 -0
  248. package/dist/__tests__/shipyard-skills.test.d.ts.map +1 -0
  249. package/dist/__tests__/shipyard-skills.test.js +797 -0
  250. package/dist/__tests__/shipyard-skills.test.js.map +1 -0
  251. package/dist/__tests__/skill-entitlements-cross-surface.test.js +4 -4
  252. package/dist/__tests__/skill-entitlements-cross-surface.test.js.map +1 -1
  253. package/dist/__tests__/skill-injector-script.test.js +3 -0
  254. package/dist/__tests__/skill-injector-script.test.js.map +1 -1
  255. package/dist/__tests__/skills-frontmatter-regression.test.js +65 -0
  256. package/dist/__tests__/skills-frontmatter-regression.test.js.map +1 -1
  257. package/dist/__tests__/skills.test.js +58 -20
  258. package/dist/__tests__/skills.test.js.map +1 -1
  259. package/dist/__tests__/smoke-pipeline-edge.test.js +1 -0
  260. package/dist/__tests__/smoke-pipeline-edge.test.js.map +1 -1
  261. package/dist/__tests__/state-root-resolution.test.js +78 -2
  262. package/dist/__tests__/state-root-resolution.test.js.map +1 -1
  263. package/dist/__tests__/team-server-validation.test.js +7 -3
  264. package/dist/__tests__/team-server-validation.test.js.map +1 -1
  265. package/dist/__tests__/tier0-contracts.test.js +0 -4
  266. package/dist/__tests__/tier0-contracts.test.js.map +1 -1
  267. package/dist/__tests__/tier0-docs-consistency.test.js +6 -2
  268. package/dist/__tests__/tier0-docs-consistency.test.js.map +1 -1
  269. package/dist/__tests__/trusted-publishing-contract.test.js +16 -11
  270. package/dist/__tests__/trusted-publishing-contract.test.js.map +1 -1
  271. package/dist/__tests__/update-check-path.test.js +4 -4
  272. package/dist/__tests__/update-check-path.test.js.map +1 -1
  273. package/dist/__tests__/user-skill-compat.test.js +4 -4
  274. package/dist/__tests__/user-skill-compat.test.js.map +1 -1
  275. package/dist/__tests__/windows-prompt-hook-runner.test.js +63 -9
  276. package/dist/__tests__/windows-prompt-hook-runner.test.js.map +1 -1
  277. package/dist/__tests__/workflow-profile-activation-script.test.js +13 -7
  278. package/dist/__tests__/workflow-profile-activation-script.test.js.map +1 -1
  279. package/dist/alias-retirement/__tests__/registry.test.js +16 -3
  280. package/dist/alias-retirement/__tests__/registry.test.js.map +1 -1
  281. package/dist/cli/__tests__/ask.test.js +2 -1
  282. package/dist/cli/__tests__/ask.test.js.map +1 -1
  283. package/dist/cli/__tests__/autoresearch-guided.test.js +34 -0
  284. package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
  285. package/dist/cli/__tests__/autoresearch-setup-session.test.js +21 -1
  286. package/dist/cli/__tests__/autoresearch-setup-session.test.js.map +1 -1
  287. package/dist/cli/__tests__/hud-watch.test.js +55 -2
  288. package/dist/cli/__tests__/hud-watch.test.js.map +1 -1
  289. package/dist/cli/__tests__/launch-secure-transport.test.d.ts +2 -0
  290. package/dist/cli/__tests__/launch-secure-transport.test.d.ts.map +1 -0
  291. package/dist/cli/__tests__/launch-secure-transport.test.js +58 -0
  292. package/dist/cli/__tests__/launch-secure-transport.test.js.map +1 -0
  293. package/dist/cli/__tests__/launch.test.js +767 -94
  294. package/dist/cli/__tests__/launch.test.js.map +1 -1
  295. package/dist/cli/__tests__/lookout-cli.test.d.ts +7 -0
  296. package/dist/cli/__tests__/lookout-cli.test.d.ts.map +1 -0
  297. package/dist/cli/__tests__/lookout-cli.test.js +118 -0
  298. package/dist/cli/__tests__/lookout-cli.test.js.map +1 -0
  299. package/dist/cli/__tests__/plugin-dir-capture.test.js +5 -4
  300. package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
  301. package/dist/cli/__tests__/self-improve-paths.test.js +7 -4
  302. package/dist/cli/__tests__/self-improve-paths.test.js.map +1 -1
  303. package/dist/cli/__tests__/session-search.test.js +2 -2
  304. package/dist/cli/__tests__/session-search.test.js.map +1 -1
  305. package/dist/cli/__tests__/team-runtime-boundary.test.js +41 -0
  306. package/dist/cli/__tests__/team-runtime-boundary.test.js.map +1 -1
  307. package/dist/cli/__tests__/team-status-worktree.test.js +4 -0
  308. package/dist/cli/__tests__/team-status-worktree.test.js.map +1 -1
  309. package/dist/cli/__tests__/team.test.js +633 -186
  310. package/dist/cli/__tests__/team.test.js.map +1 -1
  311. package/dist/cli/__tests__/tmux-env-forward.integration.test.d.ts +3 -2
  312. package/dist/cli/__tests__/tmux-env-forward.integration.test.d.ts.map +1 -1
  313. package/dist/cli/__tests__/tmux-env-forward.integration.test.js +59 -17
  314. package/dist/cli/__tests__/tmux-env-forward.integration.test.js.map +1 -1
  315. package/dist/cli/__tests__/tmux-utils.test.js +140 -4
  316. package/dist/cli/__tests__/tmux-utils.test.js.map +1 -1
  317. package/dist/cli/autoresearch-guided.d.ts.map +1 -1
  318. package/dist/cli/autoresearch-guided.js +10 -4
  319. package/dist/cli/autoresearch-guided.js.map +1 -1
  320. package/dist/cli/autoresearch-setup-session.d.ts.map +1 -1
  321. package/dist/cli/autoresearch-setup-session.js +4 -2
  322. package/dist/cli/autoresearch-setup-session.js.map +1 -1
  323. package/dist/cli/checkpoint.d.ts +16 -0
  324. package/dist/cli/checkpoint.d.ts.map +1 -0
  325. package/dist/cli/checkpoint.js +79 -0
  326. package/dist/cli/checkpoint.js.map +1 -0
  327. package/dist/cli/commands/__tests__/doctor-team-routing.test.js +12 -0
  328. package/dist/cli/commands/__tests__/doctor-team-routing.test.js.map +1 -1
  329. package/dist/cli/commands/__tests__/team-role-shorthand.test.js +145 -1
  330. package/dist/cli/commands/__tests__/team-role-shorthand.test.js.map +1 -1
  331. package/dist/cli/commands/__tests__/team.test.js +98 -2
  332. package/dist/cli/commands/__tests__/team.test.js.map +1 -1
  333. package/dist/cli/commands/doctor-conflicts.d.ts +7 -0
  334. package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
  335. package/dist/cli/commands/doctor-conflicts.js +86 -8
  336. package/dist/cli/commands/doctor-conflicts.js.map +1 -1
  337. package/dist/cli/commands/doctor-team-routing.d.ts.map +1 -1
  338. package/dist/cli/commands/doctor-team-routing.js +4 -3
  339. package/dist/cli/commands/doctor-team-routing.js.map +1 -1
  340. package/dist/cli/commands/team.d.ts +1 -1
  341. package/dist/cli/commands/team.d.ts.map +1 -1
  342. package/dist/cli/commands/team.js +201 -89
  343. package/dist/cli/commands/team.js.map +1 -1
  344. package/dist/cli/graph.d.ts.map +1 -1
  345. package/dist/cli/graph.js +127 -3
  346. package/dist/cli/graph.js.map +1 -1
  347. package/dist/cli/hud-watch.d.ts +3 -0
  348. package/dist/cli/hud-watch.d.ts.map +1 -1
  349. package/dist/cli/hud-watch.js +14 -0
  350. package/dist/cli/hud-watch.js.map +1 -1
  351. package/dist/cli/index.d.ts.map +1 -1
  352. package/dist/cli/index.js +25 -7
  353. package/dist/cli/index.js.map +1 -1
  354. package/dist/cli/interop.d.ts.map +1 -1
  355. package/dist/cli/interop.js +3 -1
  356. package/dist/cli/interop.js.map +1 -1
  357. package/dist/cli/launch.d.ts +53 -6
  358. package/dist/cli/launch.d.ts.map +1 -1
  359. package/dist/cli/launch.js +446 -97
  360. package/dist/cli/launch.js.map +1 -1
  361. package/dist/cli/lookout.d.ts +19 -0
  362. package/dist/cli/lookout.d.ts.map +1 -0
  363. package/dist/cli/lookout.js +111 -0
  364. package/dist/cli/lookout.js.map +1 -0
  365. package/dist/cli/team.d.ts +2 -0
  366. package/dist/cli/team.d.ts.map +1 -1
  367. package/dist/cli/team.js +469 -177
  368. package/dist/cli/team.js.map +1 -1
  369. package/dist/cli/tmux-utils.d.ts +4 -2
  370. package/dist/cli/tmux-utils.d.ts.map +1 -1
  371. package/dist/cli/tmux-utils.js +55 -8
  372. package/dist/cli/tmux-utils.js.map +1 -1
  373. package/dist/config/__tests__/loader.test.js +39 -1
  374. package/dist/config/__tests__/loader.test.js.map +1 -1
  375. package/dist/config/loader.d.ts +6 -0
  376. package/dist/config/loader.d.ts.map +1 -1
  377. package/dist/config/loader.js +75 -15
  378. package/dist/config/loader.js.map +1 -1
  379. package/dist/features/__tests__/checkpoint.test.d.ts +6 -0
  380. package/dist/features/__tests__/checkpoint.test.d.ts.map +1 -0
  381. package/dist/features/__tests__/checkpoint.test.js +113 -0
  382. package/dist/features/__tests__/checkpoint.test.js.map +1 -0
  383. package/dist/features/__tests__/jev-model-routing.test.d.ts +10 -0
  384. package/dist/features/__tests__/jev-model-routing.test.d.ts.map +1 -0
  385. package/dist/features/__tests__/jev-model-routing.test.js +170 -0
  386. package/dist/features/__tests__/jev-model-routing.test.js.map +1 -0
  387. package/dist/features/__tests__/jev-slop-warning.test.d.ts +2 -0
  388. package/dist/features/__tests__/jev-slop-warning.test.d.ts.map +1 -0
  389. package/dist/features/__tests__/jev-slop-warning.test.js +150 -0
  390. package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -0
  391. package/dist/features/auto-update.d.ts +3 -1
  392. package/dist/features/auto-update.d.ts.map +1 -1
  393. package/dist/features/auto-update.js +9 -7
  394. package/dist/features/auto-update.js.map +1 -1
  395. package/dist/features/builtin-skills/skills.js +1 -1
  396. package/dist/features/builtin-skills/skills.js.map +1 -1
  397. package/dist/features/checkpoint/index.d.ts +50 -0
  398. package/dist/features/checkpoint/index.d.ts.map +1 -0
  399. package/dist/features/checkpoint/index.js +170 -0
  400. package/dist/features/checkpoint/index.js.map +1 -0
  401. package/dist/features/delegation-enforcer.d.ts.map +1 -1
  402. package/dist/features/delegation-enforcer.js +5 -0
  403. package/dist/features/delegation-enforcer.js.map +1 -1
  404. package/dist/features/index.d.ts +2 -1
  405. package/dist/features/index.d.ts.map +1 -1
  406. package/dist/features/index.js +4 -1
  407. package/dist/features/index.js.map +1 -1
  408. package/dist/features/jev-model-routing.d.ts +28 -0
  409. package/dist/features/jev-model-routing.d.ts.map +1 -0
  410. package/dist/features/jev-model-routing.js +37 -0
  411. package/dist/features/jev-model-routing.js.map +1 -0
  412. package/dist/features/jev-slop-warning.d.ts +32 -0
  413. package/dist/features/jev-slop-warning.d.ts.map +1 -0
  414. package/dist/features/jev-slop-warning.js +33 -0
  415. package/dist/features/jev-slop-warning.js.map +1 -0
  416. package/dist/features/lookout/__tests__/lookout-workspace.test.d.ts +3 -0
  417. package/dist/features/lookout/__tests__/lookout-workspace.test.d.ts.map +1 -0
  418. package/dist/features/lookout/__tests__/lookout-workspace.test.js +203 -0
  419. package/dist/features/lookout/__tests__/lookout-workspace.test.js.map +1 -0
  420. package/dist/features/lookout/__tests__/lookout.test.d.ts +11 -0
  421. package/dist/features/lookout/__tests__/lookout.test.d.ts.map +1 -0
  422. package/dist/features/lookout/__tests__/lookout.test.js +769 -0
  423. package/dist/features/lookout/__tests__/lookout.test.js.map +1 -0
  424. package/dist/features/lookout/command-parser.d.ts +20 -0
  425. package/dist/features/lookout/command-parser.d.ts.map +1 -0
  426. package/dist/features/lookout/command-parser.js +815 -0
  427. package/dist/features/lookout/command-parser.js.map +1 -0
  428. package/dist/features/lookout/index.d.ts +54 -0
  429. package/dist/features/lookout/index.d.ts.map +1 -0
  430. package/dist/features/lookout/index.js +566 -0
  431. package/dist/features/lookout/index.js.map +1 -0
  432. package/dist/features/lookout/substitution-parser.d.ts +11 -0
  433. package/dist/features/lookout/substitution-parser.d.ts.map +1 -0
  434. package/dist/features/lookout/substitution-parser.js +157 -0
  435. package/dist/features/lookout/substitution-parser.js.map +1 -0
  436. package/dist/features/lookout/test-artifact-parser.d.ts +7 -0
  437. package/dist/features/lookout/test-artifact-parser.d.ts.map +1 -0
  438. package/dist/features/lookout/test-artifact-parser.js +106 -0
  439. package/dist/features/lookout/test-artifact-parser.js.map +1 -0
  440. package/dist/features/lookout/types.d.ts +33 -0
  441. package/dist/features/lookout/types.d.ts.map +1 -0
  442. package/dist/features/lookout/types.js +10 -0
  443. package/dist/features/lookout/types.js.map +1 -0
  444. package/dist/features/lookout/workspace.d.ts +7 -0
  445. package/dist/features/lookout/workspace.d.ts.map +1 -0
  446. package/dist/features/lookout/workspace.js +140 -0
  447. package/dist/features/lookout/workspace.js.map +1 -0
  448. package/dist/features/lookout/wrapper-parser.d.ts +4 -0
  449. package/dist/features/lookout/wrapper-parser.d.ts.map +1 -0
  450. package/dist/features/lookout/wrapper-parser.js +15 -0
  451. package/dist/features/lookout/wrapper-parser.js.map +1 -0
  452. package/dist/features/notepad-wisdom/__tests__/extractor.test.d.ts +2 -0
  453. package/dist/features/notepad-wisdom/__tests__/extractor.test.d.ts.map +1 -0
  454. package/dist/features/notepad-wisdom/__tests__/extractor.test.js +17 -0
  455. package/dist/features/notepad-wisdom/__tests__/extractor.test.js.map +1 -0
  456. package/dist/features/notepad-wisdom/extractor.js +1 -1
  457. package/dist/features/notepad-wisdom/extractor.js.map +1 -1
  458. package/dist/features/rate-limit-wait/daemon.js +1 -1
  459. package/dist/features/rate-limit-wait/daemon.js.map +1 -1
  460. package/dist/features/session-history-search/index.d.ts +8 -2
  461. package/dist/features/session-history-search/index.d.ts.map +1 -1
  462. package/dist/features/session-history-search/index.js +86 -25
  463. package/dist/features/session-history-search/index.js.map +1 -1
  464. package/dist/graph/__tests__/runtime/cli.test.js +7 -8
  465. package/dist/graph/__tests__/runtime/cli.test.js.map +1 -1
  466. package/dist/graph/__tests__/runtime/e2e-crash-recovery.test.js +3 -3
  467. package/dist/graph/__tests__/runtime/e2e-crash-recovery.test.js.map +1 -1
  468. package/dist/graph/__tests__/runtime/fence.test.js +4 -4
  469. package/dist/graph/__tests__/runtime/fence.test.js.map +1 -1
  470. package/dist/graph/__tests__/runtime/journal-epoch.test.js +2 -2
  471. package/dist/graph/__tests__/runtime/journal-epoch.test.js.map +1 -1
  472. package/dist/graph/__tests__/runtime/journal.test.js +2 -2
  473. package/dist/graph/__tests__/runtime/journal.test.js.map +1 -1
  474. package/dist/graph/__tests__/runtime/native-contained-fs.test.d.ts +2 -0
  475. package/dist/graph/__tests__/runtime/native-contained-fs.test.d.ts.map +1 -0
  476. package/dist/graph/__tests__/runtime/native-contained-fs.test.js +117 -0
  477. package/dist/graph/__tests__/runtime/native-contained-fs.test.js.map +1 -0
  478. package/dist/graph/__tests__/runtime/regression-matrix.test.js +2 -2
  479. package/dist/graph/__tests__/runtime/regression-matrix.test.js.map +1 -1
  480. package/dist/graph/__tests__/runtime/remote-approval.test.d.ts +6 -0
  481. package/dist/graph/__tests__/runtime/remote-approval.test.d.ts.map +1 -0
  482. package/dist/graph/__tests__/runtime/remote-approval.test.js +298 -0
  483. package/dist/graph/__tests__/runtime/remote-approval.test.js.map +1 -0
  484. package/dist/graph/__tests__/runtime/run-dir.test.js +13 -7
  485. package/dist/graph/__tests__/runtime/run-dir.test.js.map +1 -1
  486. package/dist/graph/__tests__/runtime/runner.test.js +2 -2
  487. package/dist/graph/__tests__/runtime/runner.test.js.map +1 -1
  488. package/dist/graph/__tests__/runtime/safe-fs.test.js +156 -29
  489. package/dist/graph/__tests__/runtime/safe-fs.test.js.map +1 -1
  490. package/dist/graph/__tests__/runtime/store.test.js +2 -2
  491. package/dist/graph/__tests__/runtime/store.test.js.map +1 -1
  492. package/dist/graph/runtime/contained-fd.d.ts +28 -0
  493. package/dist/graph/runtime/contained-fd.d.ts.map +1 -0
  494. package/dist/graph/runtime/contained-fd.js +72 -0
  495. package/dist/graph/runtime/contained-fd.js.map +1 -0
  496. package/dist/graph/runtime/executors/command.d.ts.map +1 -1
  497. package/dist/graph/runtime/executors/command.js +1 -2
  498. package/dist/graph/runtime/executors/command.js.map +1 -1
  499. package/dist/graph/runtime/fence.d.ts +0 -1
  500. package/dist/graph/runtime/fence.d.ts.map +1 -1
  501. package/dist/graph/runtime/fence.js +59 -64
  502. package/dist/graph/runtime/fence.js.map +1 -1
  503. package/dist/graph/runtime/journal.d.ts.map +1 -1
  504. package/dist/graph/runtime/journal.js +4 -3
  505. package/dist/graph/runtime/journal.js.map +1 -1
  506. package/dist/graph/runtime/native-contained-fs.d.ts +26 -0
  507. package/dist/graph/runtime/native-contained-fs.d.ts.map +1 -0
  508. package/dist/graph/runtime/native-contained-fs.js +32 -0
  509. package/dist/graph/runtime/native-contained-fs.js.map +1 -0
  510. package/dist/graph/runtime/remote-approval.d.ts +97 -0
  511. package/dist/graph/runtime/remote-approval.d.ts.map +1 -0
  512. package/dist/graph/runtime/remote-approval.js +271 -0
  513. package/dist/graph/runtime/remote-approval.js.map +1 -0
  514. package/dist/graph/runtime/run-dir.d.ts +13 -1
  515. package/dist/graph/runtime/run-dir.d.ts.map +1 -1
  516. package/dist/graph/runtime/run-dir.js +41 -15
  517. package/dist/graph/runtime/run-dir.js.map +1 -1
  518. package/dist/graph/runtime/runner.js +3 -3
  519. package/dist/graph/runtime/runner.js.map +1 -1
  520. package/dist/graph/runtime/safe-fs.d.ts +31 -1
  521. package/dist/graph/runtime/safe-fs.d.ts.map +1 -1
  522. package/dist/graph/runtime/safe-fs.js +173 -9
  523. package/dist/graph/runtime/safe-fs.js.map +1 -1
  524. package/dist/graph/runtime/store.js +3 -3
  525. package/dist/graph/runtime/store.js.map +1 -1
  526. package/dist/graph/schema.d.ts +36 -36
  527. package/dist/hooks/__tests__/background-process-guard.test.js +1 -1
  528. package/dist/hooks/__tests__/background-process-guard.test.js.map +1 -1
  529. package/dist/hooks/__tests__/pre-tool-use-template-source-ext.test.js +494 -11
  530. package/dist/hooks/__tests__/pre-tool-use-template-source-ext.test.js.map +1 -1
  531. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +1 -1
  532. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
  533. package/dist/hooks/auto-slash-command/executor.js +4 -4
  534. package/dist/hooks/auto-slash-command/executor.js.map +1 -1
  535. package/dist/hooks/autopilot/__tests__/cancel.test.js +23 -3
  536. package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
  537. package/dist/hooks/autopilot/__tests__/pipeline.test.js +14 -0
  538. package/dist/hooks/autopilot/__tests__/pipeline.test.js.map +1 -1
  539. package/dist/hooks/autopilot/__tests__/workflow-integrity.test.js +3 -3
  540. package/dist/hooks/autopilot/__tests__/workflow-integrity.test.js.map +1 -1
  541. package/dist/hooks/autopilot/adapters/execution-adapter.js +1 -1
  542. package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -1
  543. package/dist/hooks/autopilot/cancel.js +1 -1
  544. package/dist/hooks/autopilot/cancel.js.map +1 -1
  545. package/dist/hooks/autopilot/named-workflow-resume-validator.d.ts +1 -1
  546. package/dist/hooks/autopilot/named-workflow-resume-validator.js +1 -1
  547. package/dist/hooks/autopilot/pipeline-types.d.ts +1 -1
  548. package/dist/hooks/autopilot/pipeline-types.d.ts.map +1 -1
  549. package/dist/hooks/autopilot/pipeline-types.js.map +1 -1
  550. package/dist/hooks/bridge.d.ts.map +1 -1
  551. package/dist/hooks/bridge.js +28 -5
  552. package/dist/hooks/bridge.js.map +1 -1
  553. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.d.ts +2 -0
  554. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.d.ts.map +1 -0
  555. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +181 -0
  556. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -0
  557. package/dist/hooks/code-simplifier/index.d.ts.map +1 -1
  558. package/dist/hooks/code-simplifier/index.js +10 -0
  559. package/dist/hooks/code-simplifier/index.js.map +1 -1
  560. package/dist/hooks/code-simplifier/jev-shadow.d.ts +38 -0
  561. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -0
  562. package/dist/hooks/code-simplifier/jev-shadow.js +45 -0
  563. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -0
  564. package/dist/hooks/factcheck/__tests__/config-tokens.test.d.ts +2 -0
  565. package/dist/hooks/factcheck/__tests__/config-tokens.test.d.ts.map +1 -0
  566. package/dist/hooks/factcheck/__tests__/config-tokens.test.js +13 -0
  567. package/dist/hooks/factcheck/__tests__/config-tokens.test.js.map +1 -0
  568. package/dist/hooks/factcheck/config.d.ts +3 -2
  569. package/dist/hooks/factcheck/config.d.ts.map +1 -1
  570. package/dist/hooks/factcheck/config.js +5 -4
  571. package/dist/hooks/factcheck/config.js.map +1 -1
  572. package/dist/hooks/jev/__tests__/client.test.d.ts +2 -0
  573. package/dist/hooks/jev/__tests__/client.test.d.ts.map +1 -0
  574. package/dist/hooks/jev/__tests__/client.test.js +114 -0
  575. package/dist/hooks/jev/__tests__/client.test.js.map +1 -0
  576. package/dist/hooks/jev/__tests__/points-wire-shape.test.d.ts +2 -0
  577. package/dist/hooks/jev/__tests__/points-wire-shape.test.d.ts.map +1 -0
  578. package/dist/hooks/jev/__tests__/points-wire-shape.test.js +72 -0
  579. package/dist/hooks/jev/__tests__/points-wire-shape.test.js.map +1 -0
  580. package/dist/hooks/jev/__tests__/resolver.test.d.ts +2 -0
  581. package/dist/hooks/jev/__tests__/resolver.test.d.ts.map +1 -0
  582. package/dist/hooks/jev/__tests__/resolver.test.js +340 -0
  583. package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -0
  584. package/dist/hooks/jev/client.d.ts +39 -0
  585. package/dist/hooks/jev/client.d.ts.map +1 -0
  586. package/dist/hooks/jev/client.js +91 -0
  587. package/dist/hooks/jev/client.js.map +1 -0
  588. package/dist/hooks/jev/config.d.ts +66 -0
  589. package/dist/hooks/jev/config.d.ts.map +1 -0
  590. package/dist/hooks/jev/config.js +124 -0
  591. package/dist/hooks/jev/config.js.map +1 -0
  592. package/dist/hooks/jev/index.d.ts +12 -0
  593. package/dist/hooks/jev/index.d.ts.map +1 -0
  594. package/dist/hooks/jev/index.js +12 -0
  595. package/dist/hooks/jev/index.js.map +1 -0
  596. package/dist/hooks/jev/points.d.ts +55 -0
  597. package/dist/hooks/jev/points.d.ts.map +1 -0
  598. package/dist/hooks/jev/points.js +230 -0
  599. package/dist/hooks/jev/points.js.map +1 -0
  600. package/dist/hooks/jev/resolver.d.ts +47 -0
  601. package/dist/hooks/jev/resolver.d.ts.map +1 -0
  602. package/dist/hooks/jev/resolver.js +162 -0
  603. package/dist/hooks/jev/resolver.js.map +1 -0
  604. package/dist/hooks/jev/types.d.ts +58 -0
  605. package/dist/hooks/jev/types.d.ts.map +1 -0
  606. package/dist/hooks/jev/types.js +8 -0
  607. package/dist/hooks/jev/types.js.map +1 -0
  608. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.d.ts +2 -0
  609. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.d.ts.map +1 -0
  610. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +131 -0
  611. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -0
  612. package/dist/hooks/keyword-detector/index.d.ts +6 -0
  613. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  614. package/dist/hooks/keyword-detector/index.js +4 -2
  615. package/dist/hooks/keyword-detector/index.js.map +1 -1
  616. package/dist/hooks/keyword-detector/jev-shadow.d.ts +27 -0
  617. package/dist/hooks/keyword-detector/jev-shadow.d.ts.map +1 -0
  618. package/dist/hooks/keyword-detector/jev-shadow.js +47 -0
  619. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -0
  620. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.d.ts +2 -0
  621. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.d.ts.map +1 -0
  622. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +150 -0
  623. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -0
  624. package/dist/hooks/learner/detection-hook.d.ts.map +1 -1
  625. package/dist/hooks/learner/detection-hook.js +5 -0
  626. package/dist/hooks/learner/detection-hook.js.map +1 -1
  627. package/dist/hooks/learner/jev-shadow.d.ts +22 -0
  628. package/dist/hooks/learner/jev-shadow.d.ts.map +1 -0
  629. package/dist/hooks/learner/jev-shadow.js +32 -0
  630. package/dist/hooks/learner/jev-shadow.js.map +1 -0
  631. package/dist/hooks/mode-registry/__tests__/session-isolation.test.js +4 -2
  632. package/dist/hooks/mode-registry/__tests__/session-isolation.test.js.map +1 -1
  633. package/dist/hooks/mode-registry/index.js +8 -8
  634. package/dist/hooks/mode-registry/index.js.map +1 -1
  635. package/dist/hooks/notepad/index.d.ts.map +1 -1
  636. package/dist/hooks/notepad/index.js +9 -2
  637. package/dist/hooks/notepad/index.js.map +1 -1
  638. package/dist/hooks/omc-orchestrator/constants.d.ts +1 -1
  639. package/dist/hooks/omc-orchestrator/constants.d.ts.map +1 -1
  640. package/dist/hooks/omc-orchestrator/constants.js +1 -1
  641. package/dist/hooks/omc-orchestrator/index.d.ts +1 -0
  642. package/dist/hooks/omc-orchestrator/index.d.ts.map +1 -1
  643. package/dist/hooks/omc-orchestrator/index.js +133 -15
  644. package/dist/hooks/omc-orchestrator/index.js.map +1 -1
  645. package/dist/hooks/permission-handler/__tests__/index.test.js +83 -1
  646. package/dist/hooks/permission-handler/__tests__/index.test.js.map +1 -1
  647. package/dist/hooks/permission-handler/index.d.ts.map +1 -1
  648. package/dist/hooks/permission-handler/index.js +47 -22
  649. package/dist/hooks/permission-handler/index.js.map +1 -1
  650. package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js +29 -1
  651. package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js.map +1 -1
  652. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.d.ts +2 -0
  653. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.d.ts.map +1 -0
  654. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +131 -0
  655. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -0
  656. package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js +4 -4
  657. package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js.map +1 -1
  658. package/dist/hooks/persistent-mode/__tests__/tool-error.test.js +4 -2
  659. package/dist/hooks/persistent-mode/__tests__/tool-error.test.js.map +1 -1
  660. package/dist/hooks/persistent-mode/__tests__/ultragoal-persistence.test.js +2 -2
  661. package/dist/hooks/persistent-mode/__tests__/ultragoal-persistence.test.js.map +1 -1
  662. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  663. package/dist/hooks/persistent-mode/index.js +35 -2
  664. package/dist/hooks/persistent-mode/index.js.map +1 -1
  665. package/dist/hooks/persistent-mode/jev-shadow.d.ts +33 -0
  666. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -0
  667. package/dist/hooks/persistent-mode/jev-shadow.js +63 -0
  668. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -0
  669. package/dist/hooks/persistent-mode/session-isolation.test.js +2 -1
  670. package/dist/hooks/persistent-mode/session-isolation.test.js.map +1 -1
  671. package/dist/hooks/pre-compact/restore.d.ts.map +1 -1
  672. package/dist/hooks/pre-compact/restore.js.map +1 -1
  673. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.d.ts +2 -0
  674. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.d.ts.map +1 -0
  675. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js +179 -0
  676. package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js.map +1 -0
  677. package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -1
  678. package/dist/hooks/preemptive-compaction/index.js +26 -0
  679. package/dist/hooks/preemptive-compaction/index.js.map +1 -1
  680. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts +42 -0
  681. package/dist/hooks/preemptive-compaction/jev-shadow.d.ts.map +1 -0
  682. package/dist/hooks/preemptive-compaction/jev-shadow.js +39 -0
  683. package/dist/hooks/preemptive-compaction/jev-shadow.js.map +1 -0
  684. package/dist/hooks/preemptive-compaction/types.d.ts +2 -0
  685. package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -1
  686. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.d.ts +2 -0
  687. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.d.ts.map +1 -0
  688. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +144 -0
  689. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -0
  690. package/dist/hooks/ralph/jev-shadow.d.ts +35 -0
  691. package/dist/hooks/ralph/jev-shadow.d.ts.map +1 -0
  692. package/dist/hooks/ralph/jev-shadow.js +37 -0
  693. package/dist/hooks/ralph/jev-shadow.js.map +1 -0
  694. package/dist/hooks/ralph/loop.d.ts.map +1 -1
  695. package/dist/hooks/ralph/loop.js.map +1 -1
  696. package/dist/hooks/rules-injector/finder.d.ts +2 -2
  697. package/dist/hooks/rules-injector/finder.js +2 -2
  698. package/dist/hooks/rules-injector/finder.test.d.ts +1 -1
  699. package/dist/hooks/rules-injector/finder.test.js +6 -6
  700. package/dist/hooks/rules-injector/finder.test.js.map +1 -1
  701. package/dist/hooks/rules-injector/index.d.ts +1 -1
  702. package/dist/hooks/rules-injector/index.js +1 -1
  703. package/dist/hooks/self-improve/__tests__/session-isolation.test.js +4 -4
  704. package/dist/hooks/self-improve/__tests__/session-isolation.test.js.map +1 -1
  705. package/dist/hooks/session-end/__tests__/action-runner.test.js +1 -1
  706. package/dist/hooks/session-end/__tests__/action-runner.test.js.map +1 -1
  707. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +44 -3
  708. package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
  709. package/dist/hooks/session-end/__tests__/duplicate-notifications.test.js +4 -0
  710. package/dist/hooks/session-end/__tests__/duplicate-notifications.test.js.map +1 -1
  711. package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js +1 -0
  712. package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js.map +1 -1
  713. package/dist/hooks/session-end/__tests__/session-end-bridge-cleanup.test.js +2 -0
  714. package/dist/hooks/session-end/__tests__/session-end-bridge-cleanup.test.js.map +1 -1
  715. package/dist/hooks/session-end/__tests__/session-end-timeout.test.js +13 -3
  716. package/dist/hooks/session-end/__tests__/session-end-timeout.test.js.map +1 -1
  717. package/dist/hooks/session-end/__tests__/team-cleanup.test.js +186 -33
  718. package/dist/hooks/session-end/__tests__/team-cleanup.test.js.map +1 -1
  719. package/dist/hooks/session-end/__tests__/worker.test.js +9 -0
  720. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  721. package/dist/hooks/session-end/action-runner.js +9 -3
  722. package/dist/hooks/session-end/action-runner.js.map +1 -1
  723. package/dist/hooks/session-end/cleanup-manifest.d.ts +23 -1
  724. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  725. package/dist/hooks/session-end/cleanup-manifest.js +21 -4
  726. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  727. package/dist/hooks/session-end/foreground-bootstrap.d.ts +22 -0
  728. package/dist/hooks/session-end/foreground-bootstrap.d.ts.map +1 -0
  729. package/dist/hooks/session-end/foreground-bootstrap.js +23 -0
  730. package/dist/hooks/session-end/foreground-bootstrap.js.map +1 -0
  731. package/dist/hooks/session-end/index.d.ts +2 -0
  732. package/dist/hooks/session-end/index.d.ts.map +1 -1
  733. package/dist/hooks/session-end/index.js +116 -59
  734. package/dist/hooks/session-end/index.js.map +1 -1
  735. package/dist/hooks/session-end/worker.d.ts +2 -2
  736. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  737. package/dist/hooks/session-end/worker.js +50 -17
  738. package/dist/hooks/session-end/worker.js.map +1 -1
  739. package/dist/hooks/setup/__tests__/stdin-symlink.test.js +7 -7
  740. package/dist/hooks/setup/__tests__/stdin-symlink.test.js.map +1 -1
  741. package/dist/hooks/setup/__tests__/windows-patch.test.js +12 -12
  742. package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
  743. package/dist/hooks/setup/index.d.ts +7 -3
  744. package/dist/hooks/setup/index.d.ts.map +1 -1
  745. package/dist/hooks/setup/index.js +14 -7
  746. package/dist/hooks/setup/index.js.map +1 -1
  747. package/dist/hooks/skill-bridge.cjs +372 -21
  748. package/dist/hooks/subagent-tracker/__tests__/flow-tracer.test.js +8 -0
  749. package/dist/hooks/subagent-tracker/__tests__/flow-tracer.test.js.map +1 -1
  750. package/dist/hooks/subagent-tracker/__tests__/index.test.js +6 -0
  751. package/dist/hooks/subagent-tracker/__tests__/index.test.js.map +1 -1
  752. package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js +8 -0
  753. package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js.map +1 -1
  754. package/dist/hooks/subagent-tracker/__tests__/worktree-evidence.test.js +4 -4
  755. package/dist/hooks/subagent-tracker/__tests__/worktree-evidence.test.js.map +1 -1
  756. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.d.ts +2 -0
  757. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.d.ts.map +1 -0
  758. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +120 -0
  759. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -0
  760. package/dist/hooks/task-size-detector/jev-shadow.d.ts +26 -0
  761. package/dist/hooks/task-size-detector/jev-shadow.d.ts.map +1 -0
  762. package/dist/hooks/task-size-detector/jev-shadow.js +32 -0
  763. package/dist/hooks/task-size-detector/jev-shadow.js.map +1 -0
  764. package/dist/hooks/team-dispatch-hook.d.ts.map +1 -1
  765. package/dist/hooks/team-dispatch-hook.js +0 -7
  766. package/dist/hooks/team-dispatch-hook.js.map +1 -1
  767. package/dist/hooks/todo-continuation/index.d.ts +2 -1
  768. package/dist/hooks/todo-continuation/index.d.ts.map +1 -1
  769. package/dist/hooks/todo-continuation/index.js +3 -2
  770. package/dist/hooks/todo-continuation/index.js.map +1 -1
  771. package/dist/hooks/wiki/__tests__/session-hooks.test.js +9 -9
  772. package/dist/hooks/wiki/__tests__/session-hooks.test.js.map +1 -1
  773. package/dist/hud/elements/model.d.ts.map +1 -1
  774. package/dist/hud/elements/model.js +4 -2
  775. package/dist/hud/elements/model.js.map +1 -1
  776. package/dist/hud/elements/update-hint.d.ts +22 -0
  777. package/dist/hud/elements/update-hint.d.ts.map +1 -0
  778. package/dist/hud/elements/update-hint.js +29 -0
  779. package/dist/hud/elements/update-hint.js.map +1 -0
  780. package/dist/hud/index.d.ts +0 -4
  781. package/dist/hud/index.d.ts.map +1 -1
  782. package/dist/hud/index.js +47 -8
  783. package/dist/hud/index.js.map +1 -1
  784. package/dist/hud/render.d.ts.map +1 -1
  785. package/dist/hud/render.js +17 -0
  786. package/dist/hud/render.js.map +1 -1
  787. package/dist/hud/types.d.ts +7 -1
  788. package/dist/hud/types.d.ts.map +1 -1
  789. package/dist/hud/types.js +3 -3
  790. package/dist/hud/types.js.map +1 -1
  791. package/dist/hud/usage-api.d.ts +8 -0
  792. package/dist/hud/usage-api.d.ts.map +1 -1
  793. package/dist/hud/usage-api.js +182 -20
  794. package/dist/hud/usage-api.js.map +1 -1
  795. package/dist/index.d.ts +4 -2
  796. package/dist/index.d.ts.map +1 -1
  797. package/dist/index.js +4 -2
  798. package/dist/index.js.map +1 -1
  799. package/dist/installer/__tests__/bundled-skill-sync.test.d.ts +2 -0
  800. package/dist/installer/__tests__/bundled-skill-sync.test.d.ts.map +1 -0
  801. package/dist/installer/__tests__/bundled-skill-sync.test.js +119 -0
  802. package/dist/installer/__tests__/bundled-skill-sync.test.js.map +1 -0
  803. package/dist/installer/__tests__/claude-md-target-resolution.test.js +4 -4
  804. package/dist/installer/__tests__/claude-md-target-resolution.test.js.map +1 -1
  805. package/dist/installer/__tests__/claude-md-transaction.test.js +16 -13
  806. package/dist/installer/__tests__/claude-md-transaction.test.js.map +1 -1
  807. package/dist/installer/__tests__/has-enabled-omc-plugin.test.js +1 -1
  808. package/dist/installer/__tests__/has-enabled-omc-plugin.test.js.map +1 -1
  809. package/dist/installer/__tests__/hook-command-portability.test.d.ts +1 -1
  810. package/dist/installer/__tests__/hook-command-portability.test.js +14 -14
  811. package/dist/installer/__tests__/hook-command-portability.test.js.map +1 -1
  812. package/dist/installer/__tests__/hook-templates.test.js +133 -25
  813. package/dist/installer/__tests__/hook-templates.test.js.map +1 -1
  814. package/dist/installer/__tests__/hud-cache-wrapper.test.js +33 -8
  815. package/dist/installer/__tests__/hud-cache-wrapper.test.js.map +1 -1
  816. package/dist/installer/__tests__/hud-wrapper-env.test.js +9 -9
  817. package/dist/installer/__tests__/hud-wrapper-env.test.js.map +1 -1
  818. package/dist/installer/__tests__/mcp-registry.test.js +1 -1
  819. package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
  820. package/dist/installer/__tests__/plugin-cache-sync.test.js +13 -13
  821. package/dist/installer/__tests__/plugin-cache-sync.test.js.map +1 -1
  822. package/dist/installer/__tests__/plugin-dir-mode-e2e.test.d.ts +1 -1
  823. package/dist/installer/__tests__/plugin-dir-mode-e2e.test.js +3 -3
  824. package/dist/installer/__tests__/plugin-dir-mode-e2e.test.js.map +1 -1
  825. package/dist/installer/__tests__/plugin-dir-mode.test.d.ts +1 -1
  826. package/dist/installer/__tests__/plugin-dir-mode.test.js +2 -2
  827. package/dist/installer/__tests__/plugin-dir-mode.test.js.map +1 -1
  828. package/dist/installer/__tests__/safe-installer.test.js +5 -5
  829. package/dist/installer/__tests__/safe-installer.test.js.map +1 -1
  830. package/dist/installer/__tests__/settings-race.test.js +1 -1
  831. package/dist/installer/__tests__/settings-race.test.js.map +1 -1
  832. package/dist/installer/__tests__/stale-cleanup.test.js +16 -16
  833. package/dist/installer/__tests__/stale-cleanup.test.js.map +1 -1
  834. package/dist/installer/__tests__/standalone-hook-reconcile.test.js +40 -12
  835. package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
  836. package/dist/installer/__tests__/standalone-state-lock-bridge.test.d.ts +2 -0
  837. package/dist/installer/__tests__/standalone-state-lock-bridge.test.d.ts.map +1 -0
  838. package/dist/installer/__tests__/standalone-state-lock-bridge.test.js +105 -0
  839. package/dist/installer/__tests__/standalone-state-lock-bridge.test.js.map +1 -0
  840. package/dist/installer/__tests__/user-skill-compat.test.js +4 -4
  841. package/dist/installer/__tests__/user-skill-compat.test.js.map +1 -1
  842. package/dist/installer/hooks.js +1 -1
  843. package/dist/installer/hooks.js.map +1 -1
  844. package/dist/installer/index.d.ts +3 -0
  845. package/dist/installer/index.d.ts.map +1 -1
  846. package/dist/installer/index.js +150 -29
  847. package/dist/installer/index.js.map +1 -1
  848. package/dist/lib/__tests__/atomic-write.test.js +75 -86
  849. package/dist/lib/__tests__/atomic-write.test.js.map +1 -1
  850. package/dist/lib/__tests__/mode-state-io.test.js +65 -47
  851. package/dist/lib/__tests__/mode-state-io.test.js.map +1 -1
  852. package/dist/lib/__tests__/mode-state-lock.test.d.ts +2 -0
  853. package/dist/lib/__tests__/mode-state-lock.test.d.ts.map +1 -0
  854. package/dist/lib/__tests__/mode-state-lock.test.js +242 -0
  855. package/dist/lib/__tests__/mode-state-lock.test.js.map +1 -0
  856. package/dist/lib/__tests__/sync-publication-short-write.test.js +36 -5
  857. package/dist/lib/__tests__/sync-publication-short-write.test.js.map +1 -1
  858. package/dist/lib/__tests__/worktree-paths-bare-container.test.d.ts +2 -0
  859. package/dist/lib/__tests__/worktree-paths-bare-container.test.d.ts.map +1 -0
  860. package/dist/lib/__tests__/worktree-paths-bare-container.test.js +99 -0
  861. package/dist/lib/__tests__/worktree-paths-bare-container.test.js.map +1 -0
  862. package/dist/lib/__tests__/worktree-paths-foreign-root.test.js +5 -5
  863. package/dist/lib/__tests__/worktree-paths-foreign-root.test.js.map +1 -1
  864. package/dist/lib/__tests__/worktree-paths-git-probe-failclosed.test.js +3 -3
  865. package/dist/lib/__tests__/worktree-paths-git-probe-failclosed.test.js.map +1 -1
  866. package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.d.ts +2 -0
  867. package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.d.ts.map +1 -0
  868. package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.js +66 -0
  869. package/dist/lib/__tests__/worktree-paths-git-probe-locale.test.js.map +1 -0
  870. package/dist/lib/__tests__/worktree-paths-git-timeout.test.d.ts +2 -0
  871. package/dist/lib/__tests__/worktree-paths-git-timeout.test.d.ts.map +1 -0
  872. package/dist/lib/__tests__/worktree-paths-git-timeout.test.js +118 -0
  873. package/dist/lib/__tests__/worktree-paths-git-timeout.test.js.map +1 -0
  874. package/dist/lib/__tests__/worktree-paths-nongit-anchor.test.js +11 -9
  875. package/dist/lib/__tests__/worktree-paths-nongit-anchor.test.js.map +1 -1
  876. package/dist/lib/__tests__/worktree-paths-split-warning.test.d.ts +2 -0
  877. package/dist/lib/__tests__/worktree-paths-split-warning.test.d.ts.map +1 -0
  878. package/dist/lib/__tests__/worktree-paths-split-warning.test.js +247 -0
  879. package/dist/lib/__tests__/worktree-paths-split-warning.test.js.map +1 -0
  880. package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.d.ts +2 -0
  881. package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.d.ts.map +1 -0
  882. package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.js +457 -0
  883. package/dist/lib/__tests__/worktree-paths-toplevel-cache.test.js.map +1 -0
  884. package/dist/lib/atomic-write.d.ts +12 -2
  885. package/dist/lib/atomic-write.d.ts.map +1 -1
  886. package/dist/lib/atomic-write.js +45 -35
  887. package/dist/lib/atomic-write.js.map +1 -1
  888. package/dist/lib/mode-state-io.d.ts +8 -1
  889. package/dist/lib/mode-state-io.d.ts.map +1 -1
  890. package/dist/lib/mode-state-io.js +926 -448
  891. package/dist/lib/mode-state-io.js.map +1 -1
  892. package/dist/lib/shared-memory.d.ts +1 -1
  893. package/dist/lib/shared-memory.js +1 -1
  894. package/dist/lib/worktree-paths.d.ts +23 -7
  895. package/dist/lib/worktree-paths.d.ts.map +1 -1
  896. package/dist/lib/worktree-paths.js +487 -31
  897. package/dist/lib/worktree-paths.js.map +1 -1
  898. package/dist/mcp/__tests__/team-cleanup.test.d.ts +1 -1
  899. package/dist/mcp/__tests__/team-cleanup.test.js +211 -110
  900. package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
  901. package/dist/mcp/__tests__/team-server-artifact-convergence.test.js +1155 -41
  902. package/dist/mcp/__tests__/team-server-artifact-convergence.test.js.map +1 -1
  903. package/dist/mcp/team-job-convergence.d.ts +20 -6
  904. package/dist/mcp/team-job-convergence.d.ts.map +1 -1
  905. package/dist/mcp/team-job-convergence.js +150 -49
  906. package/dist/mcp/team-job-convergence.js.map +1 -1
  907. package/dist/mcp/team-server.d.ts +6 -4
  908. package/dist/mcp/team-server.d.ts.map +1 -1
  909. package/dist/mcp/team-server.js +629 -207
  910. package/dist/mcp/team-server.js.map +1 -1
  911. package/dist/notifications/__tests__/approval-reply.test.d.ts +6 -0
  912. package/dist/notifications/__tests__/approval-reply.test.d.ts.map +1 -0
  913. package/dist/notifications/__tests__/approval-reply.test.js +71 -0
  914. package/dist/notifications/__tests__/approval-reply.test.js.map +1 -0
  915. package/dist/notifications/config.d.ts.map +1 -1
  916. package/dist/notifications/config.js +3 -0
  917. package/dist/notifications/config.js.map +1 -1
  918. package/dist/notifications/formatter.d.ts +5 -0
  919. package/dist/notifications/formatter.d.ts.map +1 -1
  920. package/dist/notifications/formatter.js +21 -0
  921. package/dist/notifications/formatter.js.map +1 -1
  922. package/dist/notifications/hook-config-types.d.ts +1 -0
  923. package/dist/notifications/hook-config-types.d.ts.map +1 -1
  924. package/dist/notifications/index.d.ts.map +1 -1
  925. package/dist/notifications/index.js +7 -2
  926. package/dist/notifications/index.js.map +1 -1
  927. package/dist/notifications/reply-listener.d.ts +12 -0
  928. package/dist/notifications/reply-listener.d.ts.map +1 -1
  929. package/dist/notifications/reply-listener.js +135 -0
  930. package/dist/notifications/reply-listener.js.map +1 -1
  931. package/dist/notifications/session-registry.d.ts +6 -0
  932. package/dist/notifications/session-registry.d.ts.map +1 -1
  933. package/dist/notifications/session-registry.js.map +1 -1
  934. package/dist/notifications/template-engine.d.ts.map +1 -1
  935. package/dist/notifications/template-engine.js +3 -0
  936. package/dist/notifications/template-engine.js.map +1 -1
  937. package/dist/notifications/types.d.ts +11 -1
  938. package/dist/notifications/types.d.ts.map +1 -1
  939. package/dist/platform/__tests__/process-utils-identity.test.js +24 -2
  940. package/dist/platform/__tests__/process-utils-identity.test.js.map +1 -1
  941. package/dist/platform/executable-resolution.d.ts.map +1 -1
  942. package/dist/platform/executable-resolution.js +17 -2
  943. package/dist/platform/executable-resolution.js.map +1 -1
  944. package/dist/platform/process-utils.js +1 -1
  945. package/dist/platform/process-utils.js.map +1 -1
  946. package/dist/shared/types.d.ts +7 -2
  947. package/dist/shared/types.d.ts.map +1 -1
  948. package/dist/shared/types.js.map +1 -1
  949. package/dist/skills/__tests__/mingw-escape.test.js +1 -1
  950. package/dist/skills/__tests__/mingw-escape.test.js.map +1 -1
  951. package/dist/skills/__tests__/omc-doctor-skill.test.js +9 -7
  952. package/dist/skills/__tests__/omc-doctor-skill.test.js.map +1 -1
  953. package/dist/skills/__tests__/skill-config-dir.test.d.ts +2 -2
  954. package/dist/skills/__tests__/skill-config-dir.test.js +17 -17
  955. package/dist/skills/__tests__/skill-config-dir.test.js.map +1 -1
  956. package/dist/team/__tests__/api-interop.cleanup.test.js +137 -23
  957. package/dist/team/__tests__/api-interop.cleanup.test.js.map +1 -1
  958. package/dist/team/__tests__/api-interop.cwd-resolution.test.js +89 -45
  959. package/dist/team/__tests__/api-interop.cwd-resolution.test.js.map +1 -1
  960. package/dist/team/__tests__/api-interop.dispatch.test.js +56 -12
  961. package/dist/team/__tests__/api-interop.dispatch.test.js.map +1 -1
  962. package/dist/team/__tests__/auto-cleanup.test.js +4 -4
  963. package/dist/team/__tests__/auto-cleanup.test.js.map +1 -1
  964. package/dist/team/__tests__/auto-merge.perf.test.js +2 -4
  965. package/dist/team/__tests__/auto-merge.perf.test.js.map +1 -1
  966. package/dist/team/__tests__/behavior-snapshot.test.js +8 -1
  967. package/dist/team/__tests__/behavior-snapshot.test.js.map +1 -1
  968. package/dist/team/__tests__/bridge-entry.guardrails.test.js +1 -1
  969. package/dist/team/__tests__/bridge-entry.guardrails.test.js.map +1 -1
  970. package/dist/team/__tests__/bridge-entry.test.js +1 -1
  971. package/dist/team/__tests__/bridge-entry.test.js.map +1 -1
  972. package/dist/team/__tests__/bridge-integration.test.js +4 -4
  973. package/dist/team/__tests__/bridge-integration.test.js.map +1 -1
  974. package/dist/team/__tests__/cli-detection.test.js +39 -0
  975. package/dist/team/__tests__/cli-detection.test.js.map +1 -1
  976. package/dist/team/__tests__/critic-cli-worker.integration.test.js +16 -3
  977. package/dist/team/__tests__/critic-cli-worker.integration.test.js.map +1 -1
  978. package/dist/team/__tests__/governance-enforcement.test.js +42 -2
  979. package/dist/team/__tests__/governance-enforcement.test.js.map +1 -1
  980. package/dist/team/__tests__/idle-nudge.test.d.ts +1 -0
  981. package/dist/team/__tests__/idle-nudge.test.d.ts.map +1 -1
  982. package/dist/team/__tests__/idle-nudge.test.js +124 -27
  983. package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
  984. package/dist/team/__tests__/mailbox-notification-guard.test.js +219 -6
  985. package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
  986. package/dist/team/__tests__/mcp-comm.mailbox-notification.test.js +49 -3
  987. package/dist/team/__tests__/mcp-comm.mailbox-notification.test.js.map +1 -1
  988. package/dist/team/__tests__/merge-orchestrator.test.js +22 -15
  989. package/dist/team/__tests__/merge-orchestrator.test.js.map +1 -1
  990. package/dist/team/__tests__/message-router.test.js +4 -4
  991. package/dist/team/__tests__/message-router.test.js.map +1 -1
  992. package/dist/team/__tests__/model-contract.test.js +141 -13
  993. package/dist/team/__tests__/model-contract.test.js.map +1 -1
  994. package/dist/team/__tests__/psmux-adapter.test.d.ts +2 -0
  995. package/dist/team/__tests__/psmux-adapter.test.d.ts.map +1 -0
  996. package/dist/team/__tests__/psmux-adapter.test.js +188 -0
  997. package/dist/team/__tests__/psmux-adapter.test.js.map +1 -0
  998. package/dist/team/__tests__/recovery-finalization-concurrency.test.js +69 -5
  999. package/dist/team/__tests__/recovery-finalization-concurrency.test.js.map +1 -1
  1000. package/dist/team/__tests__/recovery-owner-finalization.test.js +2 -0
  1001. package/dist/team/__tests__/recovery-owner-finalization.test.js.map +1 -1
  1002. package/dist/team/__tests__/recovery-pane-rollback.test.js +450 -206
  1003. package/dist/team/__tests__/recovery-pane-rollback.test.js.map +1 -1
  1004. package/dist/team/__tests__/recovery-public-api.test.js +70 -15
  1005. package/dist/team/__tests__/recovery-public-api.test.js.map +1 -1
  1006. package/dist/team/__tests__/recovery-request-store.test.js +11 -2
  1007. package/dist/team/__tests__/recovery-request-store.test.js.map +1 -1
  1008. package/dist/team/__tests__/recovery-saga.test.js +16 -1
  1009. package/dist/team/__tests__/recovery-saga.test.js.map +1 -1
  1010. package/dist/team/__tests__/resolved-routing-snapshot.test.js +33 -2
  1011. package/dist/team/__tests__/resolved-routing-snapshot.test.js.map +1 -1
  1012. package/dist/team/__tests__/runtime-cli.test.js +310 -197
  1013. package/dist/team/__tests__/runtime-cli.test.js.map +1 -1
  1014. package/dist/team/__tests__/runtime-done-recovery.test.js +64 -74
  1015. package/dist/team/__tests__/runtime-done-recovery.test.js.map +1 -1
  1016. package/dist/team/__tests__/runtime-owner-busy.test.js +351 -57
  1017. package/dist/team/__tests__/runtime-owner-busy.test.js.map +1 -1
  1018. package/dist/team/__tests__/runtime-owner-client.test.js +153 -49
  1019. package/dist/team/__tests__/runtime-owner-client.test.js.map +1 -1
  1020. package/dist/team/__tests__/runtime-prompt-mode.test.js +29 -16
  1021. package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -1
  1022. package/dist/team/__tests__/runtime-storage-boundary.test.d.ts +2 -0
  1023. package/dist/team/__tests__/runtime-storage-boundary.test.d.ts.map +1 -0
  1024. package/dist/team/__tests__/runtime-storage-boundary.test.js +409 -0
  1025. package/dist/team/__tests__/runtime-storage-boundary.test.js.map +1 -0
  1026. package/dist/team/__tests__/runtime-v2-role-routing.test.js +613 -72
  1027. package/dist/team/__tests__/runtime-v2-role-routing.test.js.map +1 -1
  1028. package/dist/team/__tests__/runtime-v2.cursor-routing.test.js +6 -10
  1029. package/dist/team/__tests__/runtime-v2.cursor-routing.test.js.map +1 -1
  1030. package/dist/team/__tests__/runtime-v2.dispatch.test.js +2425 -209
  1031. package/dist/team/__tests__/runtime-v2.dispatch.test.js.map +1 -1
  1032. package/dist/team/__tests__/runtime-v2.explicit-provider-routing.test.js +3 -9
  1033. package/dist/team/__tests__/runtime-v2.explicit-provider-routing.test.js.map +1 -1
  1034. package/dist/team/__tests__/runtime-v2.gemini-preflight.test.js +296 -3
  1035. package/dist/team/__tests__/runtime-v2.gemini-preflight.test.js.map +1 -1
  1036. package/dist/team/__tests__/runtime-v2.monitor.test.js +174 -13
  1037. package/dist/team/__tests__/runtime-v2.monitor.test.js.map +1 -1
  1038. package/dist/team/__tests__/runtime-v2.permission-lines.test.d.ts +2 -0
  1039. package/dist/team/__tests__/runtime-v2.permission-lines.test.d.ts.map +1 -0
  1040. package/dist/team/__tests__/runtime-v2.permission-lines.test.js +42 -0
  1041. package/dist/team/__tests__/runtime-v2.permission-lines.test.js.map +1 -0
  1042. package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.d.ts +2 -0
  1043. package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.d.ts.map +1 -0
  1044. package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.js +875 -0
  1045. package/dist/team/__tests__/runtime-v2.shutdown-interruption.test.js.map +1 -0
  1046. package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js +115 -60
  1047. package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js.map +1 -1
  1048. package/dist/team/__tests__/runtime-v2.shutdown.test.js +551 -52
  1049. package/dist/team/__tests__/runtime-v2.shutdown.test.js.map +1 -1
  1050. package/dist/team/__tests__/runtime-watchdog-retry.test.js +125 -369
  1051. package/dist/team/__tests__/runtime-watchdog-retry.test.js.map +1 -1
  1052. package/dist/team/__tests__/runtime.test.js +54 -3
  1053. package/dist/team/__tests__/runtime.test.js.map +1 -1
  1054. package/dist/team/__tests__/scaling-launch-config.test.js +278 -52
  1055. package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
  1056. package/dist/team/__tests__/scaling.test.js +394 -39
  1057. package/dist/team/__tests__/scaling.test.js.map +1 -1
  1058. package/dist/team/__tests__/split-pane-cleanup-evidence.test.js.map +1 -1
  1059. package/dist/team/__tests__/stage-router.test.js +54 -1
  1060. package/dist/team/__tests__/stage-router.test.js.map +1 -1
  1061. package/dist/team/__tests__/startup-claim-error.test.d.ts +2 -0
  1062. package/dist/team/__tests__/startup-claim-error.test.d.ts.map +1 -0
  1063. package/dist/team/__tests__/startup-claim-error.test.js +73 -0
  1064. package/dist/team/__tests__/startup-claim-error.test.js.map +1 -0
  1065. package/dist/team/__tests__/task-recovery-checkpoint.test.js +2 -1
  1066. package/dist/team/__tests__/task-recovery-checkpoint.test.js.map +1 -1
  1067. package/dist/team/__tests__/task-storage-integrity.test.d.ts +2 -0
  1068. package/dist/team/__tests__/task-storage-integrity.test.d.ts.map +1 -0
  1069. package/dist/team/__tests__/task-storage-integrity.test.js +590 -0
  1070. package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -0
  1071. package/dist/team/__tests__/team-config-revision-lock.test.js +250 -4
  1072. package/dist/team/__tests__/team-config-revision-lock.test.js.map +1 -1
  1073. package/dist/team/__tests__/team-instance.test.d.ts +2 -0
  1074. package/dist/team/__tests__/team-instance.test.d.ts.map +1 -0
  1075. package/dist/team/__tests__/team-instance.test.js +367 -0
  1076. package/dist/team/__tests__/team-instance.test.js.map +1 -0
  1077. package/dist/team/__tests__/team-owner-epoch.test.js +80 -1
  1078. package/dist/team/__tests__/team-owner-epoch.test.js.map +1 -1
  1079. package/dist/team/__tests__/team-state-reader.test.js +50 -1
  1080. package/dist/team/__tests__/team-state-reader.test.js.map +1 -1
  1081. package/dist/team/__tests__/teardown-invariant.test.js +20 -2
  1082. package/dist/team/__tests__/teardown-invariant.test.js.map +1 -1
  1083. package/dist/team/__tests__/tmux-session-liveness.test.js +4 -0
  1084. package/dist/team/__tests__/tmux-session-liveness.test.js.map +1 -1
  1085. package/dist/team/__tests__/tmux-session.create-team.test.js +497 -65
  1086. package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
  1087. package/dist/team/__tests__/tmux-session.kill-team-session.test.js +255 -60
  1088. package/dist/team/__tests__/tmux-session.kill-team-session.test.js.map +1 -1
  1089. package/dist/team/__tests__/tmux-session.psmux.test.d.ts +2 -0
  1090. package/dist/team/__tests__/tmux-session.psmux.test.d.ts.map +1 -0
  1091. package/dist/team/__tests__/tmux-session.psmux.test.js +394 -0
  1092. package/dist/team/__tests__/tmux-session.psmux.test.js.map +1 -0
  1093. package/dist/team/__tests__/tmux-session.spawn.test.js +113 -30
  1094. package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -1
  1095. package/dist/team/__tests__/tmux-session.startup.test.js +395 -26
  1096. package/dist/team/__tests__/tmux-session.startup.test.js.map +1 -1
  1097. package/dist/team/__tests__/tmux-session.target-membership.test.js +181 -28
  1098. package/dist/team/__tests__/tmux-session.target-membership.test.js.map +1 -1
  1099. package/dist/team/__tests__/tmux-session.test.js +325 -50
  1100. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  1101. package/dist/team/__tests__/worker-activation-gate.test.js +15 -9
  1102. package/dist/team/__tests__/worker-activation-gate.test.js.map +1 -1
  1103. package/dist/team/__tests__/worker-bootstrap.test.js +9 -1
  1104. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  1105. package/dist/team/__tests__/worker-launch-ack.test.js +1792 -74
  1106. package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
  1107. package/dist/team/__tests__/worker-launch-posix-transport.test.js +266 -42
  1108. package/dist/team/__tests__/worker-launch-posix-transport.test.js.map +1 -1
  1109. package/dist/team/__tests__/worker-launch-wrapper-posix.test.d.ts +10 -0
  1110. package/dist/team/__tests__/worker-launch-wrapper-posix.test.d.ts.map +1 -0
  1111. package/dist/team/__tests__/worker-launch-wrapper-posix.test.js +191 -0
  1112. package/dist/team/__tests__/worker-launch-wrapper-posix.test.js.map +1 -0
  1113. package/dist/team/__tests__/worktree-runtime-e2e.test.js.map +1 -1
  1114. package/dist/team/api-interop.d.ts.map +1 -1
  1115. package/dist/team/api-interop.js +33 -29
  1116. package/dist/team/api-interop.js.map +1 -1
  1117. package/dist/team/bridge-entry.js +3 -3
  1118. package/dist/team/bridge-entry.js.map +1 -1
  1119. package/dist/team/idle-nudge.d.ts +27 -4
  1120. package/dist/team/idle-nudge.d.ts.map +1 -1
  1121. package/dist/team/idle-nudge.js +59 -9
  1122. package/dist/team/idle-nudge.js.map +1 -1
  1123. package/dist/team/index.d.ts +3 -3
  1124. package/dist/team/index.d.ts.map +1 -1
  1125. package/dist/team/index.js +2 -2
  1126. package/dist/team/index.js.map +1 -1
  1127. package/dist/team/mailbox-notification-guard.d.ts +14 -2
  1128. package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
  1129. package/dist/team/mailbox-notification-guard.js +72 -1
  1130. package/dist/team/mailbox-notification-guard.js.map +1 -1
  1131. package/dist/team/mcp-team-bridge.d.ts.map +1 -1
  1132. package/dist/team/mcp-team-bridge.js +0 -8
  1133. package/dist/team/mcp-team-bridge.js.map +1 -1
  1134. package/dist/team/merge-orchestrator.d.ts.map +1 -1
  1135. package/dist/team/merge-orchestrator.js +49 -0
  1136. package/dist/team/merge-orchestrator.js.map +1 -1
  1137. package/dist/team/model-contract.d.ts +35 -0
  1138. package/dist/team/model-contract.d.ts.map +1 -1
  1139. package/dist/team/model-contract.js +136 -9
  1140. package/dist/team/model-contract.js.map +1 -1
  1141. package/dist/team/monitor.d.ts +25 -5
  1142. package/dist/team/monitor.d.ts.map +1 -1
  1143. package/dist/team/monitor.js +271 -91
  1144. package/dist/team/monitor.js.map +1 -1
  1145. package/dist/team/pane-readiness.d.ts.map +1 -1
  1146. package/dist/team/pane-readiness.js +4 -1
  1147. package/dist/team/pane-readiness.js.map +1 -1
  1148. package/dist/team/psmux-adapter.d.ts +73 -0
  1149. package/dist/team/psmux-adapter.d.ts.map +1 -0
  1150. package/dist/team/psmux-adapter.js +219 -0
  1151. package/dist/team/psmux-adapter.js.map +1 -0
  1152. package/dist/team/recovery-request-store.d.ts +4 -0
  1153. package/dist/team/recovery-request-store.d.ts.map +1 -1
  1154. package/dist/team/recovery-request-store.js +16 -4
  1155. package/dist/team/recovery-request-store.js.map +1 -1
  1156. package/dist/team/recovery-saga.d.ts +7 -0
  1157. package/dist/team/recovery-saga.d.ts.map +1 -1
  1158. package/dist/team/recovery-saga.js +4 -1
  1159. package/dist/team/recovery-saga.js.map +1 -1
  1160. package/dist/team/runtime-cli.d.ts +36 -22
  1161. package/dist/team/runtime-cli.d.ts.map +1 -1
  1162. package/dist/team/runtime-cli.js +491 -354
  1163. package/dist/team/runtime-cli.js.map +1 -1
  1164. package/dist/team/runtime-owner-client.d.ts +6 -1
  1165. package/dist/team/runtime-owner-client.d.ts.map +1 -1
  1166. package/dist/team/runtime-owner-client.js +230 -78
  1167. package/dist/team/runtime-owner-client.js.map +1 -1
  1168. package/dist/team/runtime-v2.d.ts +62 -16
  1169. package/dist/team/runtime-v2.d.ts.map +1 -1
  1170. package/dist/team/runtime-v2.js +2171 -850
  1171. package/dist/team/runtime-v2.js.map +1 -1
  1172. package/dist/team/runtime.d.ts +20 -33
  1173. package/dist/team/runtime.d.ts.map +1 -1
  1174. package/dist/team/runtime.js +115 -780
  1175. package/dist/team/runtime.js.map +1 -1
  1176. package/dist/team/scaling.d.ts +1 -1
  1177. package/dist/team/scaling.d.ts.map +1 -1
  1178. package/dist/team/scaling.js +501 -183
  1179. package/dist/team/scaling.js.map +1 -1
  1180. package/dist/team/stage-router.d.ts +1 -1
  1181. package/dist/team/stage-router.d.ts.map +1 -1
  1182. package/dist/team/stage-router.js +25 -17
  1183. package/dist/team/stage-router.js.map +1 -1
  1184. package/dist/team/state/tasks.d.ts +23 -3
  1185. package/dist/team/state/tasks.d.ts.map +1 -1
  1186. package/dist/team/state/tasks.js +234 -52
  1187. package/dist/team/state/tasks.js.map +1 -1
  1188. package/dist/team/state-paths.d.ts +57 -0
  1189. package/dist/team/state-paths.d.ts.map +1 -1
  1190. package/dist/team/state-paths.js +176 -1
  1191. package/dist/team/state-paths.js.map +1 -1
  1192. package/dist/team/team-instance.d.ts +71 -0
  1193. package/dist/team/team-instance.d.ts.map +1 -0
  1194. package/dist/team/team-instance.js +863 -0
  1195. package/dist/team/team-instance.js.map +1 -0
  1196. package/dist/team/team-ops.d.ts +13 -1
  1197. package/dist/team/team-ops.d.ts.map +1 -1
  1198. package/dist/team/team-ops.js +328 -36
  1199. package/dist/team/team-ops.js.map +1 -1
  1200. package/dist/team/team-owner-epoch.d.ts +21 -0
  1201. package/dist/team/team-owner-epoch.d.ts.map +1 -1
  1202. package/dist/team/team-owner-epoch.js +128 -9
  1203. package/dist/team/team-owner-epoch.js.map +1 -1
  1204. package/dist/team/team-state-reader.d.ts.map +1 -1
  1205. package/dist/team/team-state-reader.js +8 -2
  1206. package/dist/team/team-state-reader.js.map +1 -1
  1207. package/dist/team/tmux-session.d.ts +150 -23
  1208. package/dist/team/tmux-session.d.ts.map +1 -1
  1209. package/dist/team/tmux-session.js +1837 -260
  1210. package/dist/team/tmux-session.js.map +1 -1
  1211. package/dist/team/types.d.ts +141 -2
  1212. package/dist/team/types.d.ts.map +1 -1
  1213. package/dist/team/types.js +34 -0
  1214. package/dist/team/types.js.map +1 -1
  1215. package/dist/team/worker-activation-gate.d.ts.map +1 -1
  1216. package/dist/team/worker-activation-gate.js +14 -12
  1217. package/dist/team/worker-activation-gate.js.map +1 -1
  1218. package/dist/team/worker-bootstrap.d.ts +2 -0
  1219. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  1220. package/dist/team/worker-bootstrap.js +25 -5
  1221. package/dist/team/worker-bootstrap.js.map +1 -1
  1222. package/dist/team/worker-launch-ack.d.ts +33 -1
  1223. package/dist/team/worker-launch-ack.d.ts.map +1 -1
  1224. package/dist/team/worker-launch-ack.js +996 -158
  1225. package/dist/team/worker-launch-ack.js.map +1 -1
  1226. package/dist/tools/__tests__/cancel-integration.test.js +99 -21
  1227. package/dist/tools/__tests__/cancel-integration.test.js.map +1 -1
  1228. package/dist/tools/__tests__/state-tools-nongit-ownership.test.js +2 -2
  1229. package/dist/tools/__tests__/state-tools-nongit-ownership.test.js.map +1 -1
  1230. package/dist/tools/__tests__/state-tools.test.js +927 -6
  1231. package/dist/tools/__tests__/state-tools.test.js.map +1 -1
  1232. package/dist/tools/__tests__/wiki-tools-direct-dist-failclosed.test.js +20 -1
  1233. package/dist/tools/__tests__/wiki-tools-direct-dist-failclosed.test.js.map +1 -1
  1234. package/dist/tools/__tests__/wiki-tools-git-probe-failclosed.test.js +4 -1
  1235. package/dist/tools/__tests__/wiki-tools-git-probe-failclosed.test.js.map +1 -1
  1236. package/dist/tools/ast-tools.d.ts.map +1 -1
  1237. package/dist/tools/ast-tools.js +7 -2
  1238. package/dist/tools/ast-tools.js.map +1 -1
  1239. package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.js +159 -6
  1240. package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.js.map +1 -1
  1241. package/dist/tools/diagnostics/lsp-aggregator.d.ts +1 -0
  1242. package/dist/tools/diagnostics/lsp-aggregator.d.ts.map +1 -1
  1243. package/dist/tools/diagnostics/lsp-aggregator.js +58 -32
  1244. package/dist/tools/diagnostics/lsp-aggregator.js.map +1 -1
  1245. package/dist/tools/lsp/__tests__/client-document-lifecycle.test.d.ts +2 -0
  1246. package/dist/tools/lsp/__tests__/client-document-lifecycle.test.d.ts.map +1 -0
  1247. package/dist/tools/lsp/__tests__/client-document-lifecycle.test.js +585 -0
  1248. package/dist/tools/lsp/__tests__/client-document-lifecycle.test.js.map +1 -0
  1249. package/dist/tools/lsp/__tests__/client-handle-data.test.js +5 -2
  1250. package/dist/tools/lsp/__tests__/client-handle-data.test.js.map +1 -1
  1251. package/dist/tools/lsp/client.d.ts +39 -1
  1252. package/dist/tools/lsp/client.d.ts.map +1 -1
  1253. package/dist/tools/lsp/client.js +542 -89
  1254. package/dist/tools/lsp/client.js.map +1 -1
  1255. package/dist/tools/skills-tools.js +1 -1
  1256. package/dist/tools/skills-tools.js.map +1 -1
  1257. package/dist/tools/state-tools.d.ts.map +1 -1
  1258. package/dist/tools/state-tools.js +459 -459
  1259. package/dist/tools/state-tools.js.map +1 -1
  1260. package/dist/utils/__tests__/cache-occupancy.test.js +61 -3
  1261. package/dist/utils/__tests__/cache-occupancy.test.js.map +1 -1
  1262. package/dist/utils/cache-occupancy.d.ts +12 -2
  1263. package/dist/utils/cache-occupancy.d.ts.map +1 -1
  1264. package/dist/utils/cache-occupancy.js +46 -6
  1265. package/dist/utils/cache-occupancy.js.map +1 -1
  1266. package/dist/utils/config-dir.d.ts +4 -4
  1267. package/dist/utils/config-dir.js +5 -5
  1268. package/dist/utils/config-dir.js.map +1 -1
  1269. package/dist/utils/host-detection.d.ts +2 -4
  1270. package/dist/utils/host-detection.d.ts.map +1 -1
  1271. package/dist/utils/host-detection.js +4 -7
  1272. package/dist/utils/host-detection.js.map +1 -1
  1273. package/dist/utils/host-signal.d.ts +19 -0
  1274. package/dist/utils/host-signal.d.ts.map +1 -0
  1275. package/dist/utils/host-signal.js +24 -0
  1276. package/dist/utils/host-signal.js.map +1 -0
  1277. package/dist/workflow/__tests__/alias-resolver.test.js +8 -6
  1278. package/dist/workflow/__tests__/alias-resolver.test.js.map +1 -1
  1279. package/dist/workflow/__tests__/projections.test.js +8 -4
  1280. package/dist/workflow/__tests__/projections.test.js.map +1 -1
  1281. package/dist/workflow/__tests__/registry.test.js +12 -3
  1282. package/dist/workflow/__tests__/registry.test.js.map +1 -1
  1283. package/dist/workflow/registry.d.ts.map +1 -1
  1284. package/dist/workflow/registry.js +16 -1
  1285. package/dist/workflow/registry.js.map +1 -1
  1286. package/docs/ARCHITECTURE.md +57 -31
  1287. package/docs/CLAUDE.md +2 -2
  1288. package/docs/COMPATIBILITY.md +6 -0
  1289. package/docs/FEATURES.md +61 -0
  1290. package/docs/GETTING-STARTED.md +31 -25
  1291. package/docs/HOOKS.md +107 -28
  1292. package/docs/MIGRATION.md +261 -1
  1293. package/docs/PERFORMANCE-MONITORING.md +1 -1
  1294. package/docs/REFERENCE.md +209 -29
  1295. package/docs/TEAM-WORKTREE-MODE.md +3 -1
  1296. package/docs/TOOLS.md +9 -3
  1297. package/docs/adr/03665-jev-degradation-contract.md +3 -0
  1298. package/docs/adr/03671-script-side-judgment-channel.md +37 -0
  1299. package/docs/adr/03672-env-activated-active-mode.md +3 -0
  1300. package/docs/business/README.md +6 -0
  1301. package/docs/copilot-instructions.md +1 -1
  1302. package/docs/graph-contained-filesystem.md +77 -0
  1303. package/docs/issues/issue-3668-ralph-namespace.md +3 -3
  1304. package/docs/issues/issue-3669-jev-judgment-points.md +103 -0
  1305. package/docs/shared/features.md +4 -2
  1306. package/docs/shipyard.md +140 -0
  1307. package/docs/standards/architecture.md +6 -0
  1308. package/docs/standards/data.md +4 -0
  1309. package/docs/standards/process.md +5 -0
  1310. package/hooks/hooks.json +36 -26
  1311. package/native/contained-fs.c +292 -0
  1312. package/package.json +15 -7
  1313. package/plugin.json +23 -0
  1314. package/scripts/budget-guard.mjs +217 -0
  1315. package/scripts/build-bridge-entry.mjs +5 -0
  1316. package/scripts/build-contained-fs.mjs +38 -0
  1317. package/scripts/build-generated-artifact-authorization.mjs +100 -0
  1318. package/scripts/build-mcp-server.mjs +5 -0
  1319. package/scripts/build-runtime-cli.mjs +7 -0
  1320. package/scripts/build-team-server.mjs +7 -0
  1321. package/scripts/ci/check-multirepo-paths.mjs +2 -2
  1322. package/scripts/code-simplifier.mjs +18 -0
  1323. package/scripts/copilot/build-agents.mjs +173 -0
  1324. package/scripts/copilot/build-hooks.mjs +128 -0
  1325. package/scripts/generate-inventory-graph.mjs +13 -4
  1326. package/scripts/jev-eval.mjs +257 -0
  1327. package/scripts/jev-resolve.mjs +245 -0
  1328. package/scripts/keyword-detector.mjs +120 -18
  1329. package/scripts/lib/atomic-write.mjs +27 -445
  1330. package/scripts/lib/bounded-git-timeout.mjs +3 -2
  1331. package/scripts/lib/cache-occupancy.mjs +50 -7
  1332. package/scripts/lib/config-dir.cjs +2 -2
  1333. package/scripts/lib/config-dir.mjs +2 -2
  1334. package/scripts/lib/config-dir.sh +2 -1
  1335. package/scripts/lib/copilot-hook-adapter.cjs +325 -0
  1336. package/scripts/lib/enforcement-log.mjs +46 -0
  1337. package/scripts/lib/hook-command-normalizer.mjs +34 -12
  1338. package/scripts/lib/hud-cache-wrapper.sh +192 -17
  1339. package/scripts/lib/hud-wrapper-template.txt +1 -1
  1340. package/scripts/lib/jev-shadow.mjs +49 -0
  1341. package/scripts/lib/pre-tool-enforcer-preflight.mjs +10 -3
  1342. package/scripts/lib/read-budget-preflight.mjs +410 -0
  1343. package/scripts/lib/state-lock.mjs +750 -0
  1344. package/scripts/lib/state-root.cjs +9 -3
  1345. package/scripts/lib/state-root.mjs +34 -4
  1346. package/scripts/lib/workflow-profile-runtime.mjs +1 -1
  1347. package/scripts/persistent-mode.mjs +157 -18
  1348. package/scripts/plugin-setup.mjs +66 -18
  1349. package/scripts/plugin-shipping-surface.mjs +35 -3
  1350. package/scripts/post-tool-directory-context-injector.mjs +115 -0
  1351. package/scripts/post-tool-rules-injector.mjs +5 -5
  1352. package/scripts/post-tool-verifier.mjs +97 -21
  1353. package/scripts/pre-tool-enforcer.mjs +118 -2
  1354. package/scripts/project-memory-posttool.mjs +33 -25
  1355. package/scripts/release-boundary.mjs +14 -0
  1356. package/scripts/release.ts +29 -16
  1357. package/scripts/repair-plugin-cache.mjs +1 -1
  1358. package/scripts/run-provider-advisor.js +14 -0
  1359. package/scripts/run.cjs +600 -71
  1360. package/scripts/session-end.mjs +3 -7
  1361. package/scripts/session-start.mjs +201 -39
  1362. package/scripts/setup-claude-md.sh +36 -5
  1363. package/scripts/setup-progress.mjs +1 -1
  1364. package/scripts/shipyard-audit.mjs +322 -0
  1365. package/scripts/sync-version.sh +9 -1
  1366. package/scripts/uninstall.sh +37 -37
  1367. package/scripts/verify-graph-contained-fs.mjs +202 -0
  1368. package/skills/AGENTS.md +54 -14
  1369. package/skills/agent-doc-discipline/SKILL.md +54 -0
  1370. package/skills/architecture-survey/SKILL.md +59 -0
  1371. package/skills/ask-navigator/SKILL.md +143 -0
  1372. package/skills/cancel/SKILL.md +288 -299
  1373. package/skills/configure-notifications/SKILL.md +11 -11
  1374. package/skills/debug/SKILL.md +3 -0
  1375. package/skills/deep-interview/SKILL.md +16 -4
  1376. package/skills/deepinit/SKILL.md +47 -24
  1377. package/skills/diagram/SKILL.md +125 -0
  1378. package/skills/drydock/SKILL.md +381 -0
  1379. package/skills/harbor/SKILL.md +169 -0
  1380. package/skills/hud/SKILL.md +10 -10
  1381. package/skills/intent/SKILL.md +95 -0
  1382. package/skills/launch/SKILL.md +185 -0
  1383. package/skills/loft/SKILL.md +70 -0
  1384. package/skills/map/SKILL.md +73 -0
  1385. package/skills/minimal-code-discipline/SKILL.md +59 -0
  1386. package/skills/minimal-prose-discipline/SKILL.md +73 -0
  1387. package/skills/omc-ado-auto-review/SKILL.md +1 -4
  1388. package/skills/omc-ado-review/SKILL.md +1 -4
  1389. package/skills/omc-ado-setup/SKILL.md +1 -4
  1390. package/skills/omc-ado-sprint/SKILL.md +1 -4
  1391. package/skills/omc-ado-triage/SKILL.md +1 -4
  1392. package/skills/omc-doctor/SKILL.md +32 -27
  1393. package/skills/omc-gh-auto-review/SKILL.md +1 -4
  1394. package/skills/omc-gh-project/SKILL.md +1 -4
  1395. package/skills/omc-gh-review/SKILL.md +1 -4
  1396. package/skills/omc-gh-setup/SKILL.md +1 -4
  1397. package/skills/omc-gh-triage/SKILL.md +1 -4
  1398. package/skills/omc-setup/SKILL.md +2 -2
  1399. package/skills/omc-setup/phases/02-configure.md +7 -6
  1400. package/skills/omc-setup/phases/03-integrations.md +7 -7
  1401. package/skills/omc-setup/phases/04-welcome.md +2 -2
  1402. package/skills/pr/SKILL.md +66 -0
  1403. package/skills/refit/SKILL.md +46 -0
  1404. package/skills/review/SKILL.md +9 -0
  1405. package/skills/skill/SKILL.md +7 -7
  1406. package/skills/skillify/SKILL.md +1 -1
  1407. package/skills/tdd/SKILL.md +33 -0
  1408. package/skills/team/SKILL.md +84 -81
  1409. package/templates/hooks/keyword-detector.mjs +24 -10
  1410. package/templates/hooks/lib/atomic-write.mjs +27 -445
  1411. package/templates/hooks/lib/bounded-git-timeout.mjs +3 -2
  1412. package/templates/hooks/lib/cache-occupancy.mjs +36 -7
  1413. package/templates/hooks/lib/config-dir.mjs +2 -2
  1414. package/templates/hooks/lib/state-lock.mjs +4 -0
  1415. package/templates/hooks/lib/state-root.mjs +34 -4
  1416. package/templates/hooks/lib/workflow-profile-runtime.mjs +1 -1
  1417. package/templates/hooks/persistent-mode.mjs +59 -17
  1418. package/templates/hooks/pre-tool-use.mjs +1213 -51
  1419. package/templates/hooks/session-start.mjs +190 -25
  1420. package/dist/__tests__/safe-command-approver.test.d.ts +0 -2
  1421. package/dist/__tests__/safe-command-approver.test.d.ts.map +0 -1
  1422. package/dist/__tests__/safe-command-approver.test.js +0 -103
  1423. package/dist/__tests__/safe-command-approver.test.js.map +0 -1
  1424. package/dist/installer/permissions.d.ts +0 -9
  1425. package/dist/installer/permissions.d.ts.map +0 -1
  1426. package/dist/installer/permissions.js +0 -59
  1427. package/dist/installer/permissions.js.map +0 -1
  1428. package/scripts/safe-command-approver.mjs +0 -156
@@ -1,4 +1,6 @@
1
1
 
2
+ const importMetaUrl = require("url").pathToFileURL(__filename);
3
+
2
4
  // Resolve global npm modules for native package imports
3
5
  try {
4
6
  var _cp = require('child_process');
@@ -18,6 +20,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
20
  var __getOwnPropNames = Object.getOwnPropertyNames;
19
21
  var __getProtoOf = Object.getPrototypeOf;
20
22
  var __hasOwnProp = Object.prototype.hasOwnProperty;
23
+ var __esm = (fn, res) => function __init() {
24
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
25
+ };
21
26
  var __export = (target, all) => {
22
27
  for (var name in all)
23
28
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -40,85 +45,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
45
  ));
41
46
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
47
 
43
- // src/team/bridge-entry.ts
44
- var bridge_entry_exports = {};
45
- __export(bridge_entry_exports, {
46
- validateBridgeWorkingDirectory: () => validateBridgeWorkingDirectory,
47
- validateConfigPath: () => validateConfigPath
48
- });
49
- module.exports = __toCommonJS(bridge_entry_exports);
50
- var import_fs18 = require("fs");
51
- var import_path18 = require("path");
52
- var import_os3 = require("os");
53
-
54
- // src/team/mcp-team-bridge.ts
55
- var import_child_process6 = require("child_process");
56
- var import_fs17 = require("fs");
57
- var import_path17 = require("path");
58
-
59
- // src/team/fs-utils.ts
60
- var import_fs = require("fs");
61
- var import_path = require("path");
62
- function atomicWriteJson(filePath, data, mode = 384) {
63
- const dir = (0, import_path.dirname)(filePath);
64
- if (!(0, import_fs.existsSync)(dir)) (0, import_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
65
- const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
66
- (0, import_fs.writeFileSync)(tmpPath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode });
67
- (0, import_fs.renameSync)(tmpPath, filePath);
68
- }
69
- function writeFileWithMode(filePath, data, mode = 384) {
70
- (0, import_fs.writeFileSync)(filePath, data, { encoding: "utf-8", mode });
71
- }
72
- function appendFileWithMode(filePath, data, mode = 384) {
73
- const fd = (0, import_fs.openSync)(filePath, import_fs.constants.O_WRONLY | import_fs.constants.O_APPEND | import_fs.constants.O_CREAT, mode);
74
- try {
75
- (0, import_fs.writeSync)(fd, data, null, "utf-8");
76
- } finally {
77
- (0, import_fs.closeSync)(fd);
78
- }
79
- }
80
- function ensureDirWithMode(dirPath, mode = 448) {
81
- if (!(0, import_fs.existsSync)(dirPath)) (0, import_fs.mkdirSync)(dirPath, { recursive: true, mode });
82
- }
83
- function safeRealpath(p) {
84
- try {
85
- return (0, import_fs.realpathSync)(p);
86
- } catch {
87
- const segments = [];
88
- let current = (0, import_path.resolve)(p);
89
- while (!(0, import_fs.existsSync)(current)) {
90
- segments.unshift((0, import_path.basename)(current));
91
- const parent = (0, import_path.dirname)(current);
92
- if (parent === current) break;
93
- current = parent;
94
- }
95
- try {
96
- return (0, import_path.join)((0, import_fs.realpathSync)(current), ...segments);
97
- } catch {
98
- return (0, import_path.resolve)(p);
99
- }
100
- }
101
- }
102
- function validateResolvedPath(resolvedPath, expectedBase) {
103
- const absResolved = safeRealpath(resolvedPath);
104
- const absBase = safeRealpath(expectedBase);
105
- const rel = (0, import_path.relative)(absBase, absResolved);
106
- if (rel.startsWith("..") || (0, import_path.resolve)(absBase, rel) !== absResolved) {
107
- throw new Error(`Path traversal detected: "${resolvedPath}" escapes base "${expectedBase}"`);
108
- }
109
- }
110
-
111
- // src/lib/worktree-paths.ts
112
- var import_crypto = require("crypto");
113
- var import_child_process = require("child_process");
114
- var import_fs2 = require("fs");
115
- var import_os2 = require("os");
116
- var import_path3 = require("path");
117
- var import_url = require("url");
118
-
119
48
  // src/utils/config-dir.ts
120
- var import_path2 = require("path");
121
- var import_os = require("os");
122
49
  function stripTrailingSep(p) {
123
50
  if (!p.endsWith(import_path2.sep)) {
124
51
  return p;
@@ -127,7 +54,7 @@ function stripTrailingSep(p) {
127
54
  }
128
55
  function getCopilotConfigDir() {
129
56
  const home = (0, import_os.homedir)();
130
- const configured = process.env.COPILOT_CONFIG_DIR?.trim();
57
+ const configured = process.env.COPILOT_HOME?.trim();
131
58
  if (!configured) {
132
59
  return stripTrailingSep((0, import_path2.normalize)((0, import_path2.join)(home, ".copilot")));
133
60
  }
@@ -139,31 +66,28 @@ function getCopilotConfigDir() {
139
66
  }
140
67
  return stripTrailingSep((0, import_path2.normalize)(configured));
141
68
  }
69
+ var import_path2, import_os;
70
+ var init_config_dir = __esm({
71
+ "src/utils/config-dir.ts"() {
72
+ "use strict";
73
+ import_path2 = require("path");
74
+ import_os = require("os");
75
+ }
76
+ });
77
+
78
+ // src/utils/encode-project-path.ts
79
+ var init_encode_project_path = __esm({
80
+ "src/utils/encode-project-path.ts"() {
81
+ "use strict";
82
+ }
83
+ });
142
84
 
143
85
  // src/lib/worktree-paths.ts
144
- var WORKSPACE_MARKER = ".omc-workspace";
145
- var OmcPaths = {
146
- ROOT: ".omg",
147
- STATE: ".omg/state",
148
- SESSIONS: ".omg/state/sessions",
149
- PLANS: ".omg/plans",
150
- RESEARCH: ".omg/research",
151
- NOTEPAD: ".omg/notepad.md",
152
- PROJECT_MEMORY: ".omg/project-memory.json",
153
- DRAFTS: ".omg/drafts",
154
- NOTEPADS: ".omg/notepads",
155
- LOGS: ".omg/logs",
156
- SCIENTIST: ".omg/scientist",
157
- AUTOPILOT: ".omg/autopilot",
158
- SKILLS: ".omg/skills",
159
- SHARED_MEMORY: ".omg/state/shared-memory",
160
- DEEPINIT_MANIFEST: ".omg/deepinit-manifest.json"
161
- };
162
- var MAX_WORKTREE_CACHE_SIZE = 8;
163
- var worktreeCacheMap = /* @__PURE__ */ new Map();
164
- var superprojectCacheMap = /* @__PURE__ */ new Map();
165
- var canonicalWorkingDirectoryRoots = /* @__PURE__ */ new WeakMap();
166
- var workspaceCacheMap = /* @__PURE__ */ new Map();
86
+ function gitProbeEnvironmentSignature() {
87
+ const fixedEntries = GIT_PROBE_ENVIRONMENT_KEYS.map((key) => JSON.stringify([key, process.env[key] !== void 0, process.env[key] ?? ""]));
88
+ const dynamicEntries = Object.keys(process.env).filter((key) => /^GIT_CONFIG_(?:KEY|VALUE)_\d+$/.test(key)).sort().map((key) => JSON.stringify([key, process.env[key] !== void 0, process.env[key] ?? ""]));
89
+ return [...fixedEntries, ...dynamicEntries].join("\0");
90
+ }
167
91
  function findWorkspaceRoot(startDir) {
168
92
  if (process.env.OMC_DISABLE_MULTIREPO === "1") return null;
169
93
  const effectiveStart = startDir || process.cwd();
@@ -228,10 +152,13 @@ function isDefinitiveNonGitError(error) {
228
152
  function resolveSuperprojectRoot(cwd) {
229
153
  const cacheKey = (0, import_path3.resolve)(cwd);
230
154
  if (superprojectCacheMap.has(cacheKey)) {
231
- const cached = superprojectCacheMap.get(cacheKey) ?? null;
155
+ const cached = superprojectCacheMap.get(cacheKey);
156
+ if (isStateRootCacheEntryValid(cacheKey, cached)) {
157
+ superprojectCacheMap.delete(cacheKey);
158
+ superprojectCacheMap.set(cacheKey, cached);
159
+ return cached.root;
160
+ }
232
161
  superprojectCacheMap.delete(cacheKey);
233
- superprojectCacheMap.set(cacheKey, cached);
234
- return cached;
235
162
  }
236
163
  let anchor = null;
237
164
  let probeCwd = cacheKey;
@@ -244,7 +171,11 @@ function resolveSuperprojectRoot(cwd) {
244
171
  encoding: "utf-8",
245
172
  stdio: ["pipe", "pipe", "pipe"],
246
173
  windowsHide: true,
247
- timeout: 5e3
174
+ timeout: 5e3,
175
+ // Force English error text so isDefinitiveNonGitError's stderr match is
176
+ // locale-independent (localized git output otherwise fails to match
177
+ // and mis-classifies a plain "not a repository" as a generic failure).
178
+ env: { ...process.env, LC_ALL: "C" }
248
179
  }).trim();
249
180
  } catch (error) {
250
181
  completed = depth === 0 && isDefinitiveNonGitError(error);
@@ -262,42 +193,10 @@ function resolveSuperprojectRoot(cwd) {
262
193
  const oldest = superprojectCacheMap.keys().next().value;
263
194
  if (oldest !== void 0) superprojectCacheMap.delete(oldest);
264
195
  }
265
- superprojectCacheMap.set(cacheKey, anchor);
196
+ superprojectCacheMap.set(cacheKey, createStateRootCacheEntry(cacheKey, anchor));
266
197
  }
267
198
  return anchor;
268
199
  }
269
- var SENSITIVE_DIR_BASENAMES = /* @__PURE__ */ new Set([
270
- ".ssh",
271
- ".gnupg",
272
- ".aws",
273
- ".azure",
274
- ".gcloud",
275
- ".kube",
276
- "ssh",
277
- ".pki",
278
- ".config",
279
- ".copilot",
280
- ".claude.json",
281
- ".codex",
282
- ".gemini",
283
- ".cursor",
284
- ".vscode",
285
- ".ollama",
286
- ".docker",
287
- ".npm",
288
- ".cache",
289
- ".local",
290
- "desktop",
291
- "documents",
292
- "downloads",
293
- "pictures",
294
- "photos",
295
- "music",
296
- "movies",
297
- "videos",
298
- "public",
299
- "library"
300
- ]);
301
200
  function sensitiveAbsoluteRoots() {
302
201
  const roots = [];
303
202
  const temp = (() => {
@@ -344,7 +243,12 @@ function isSensitiveStateLocation(dir) {
344
243
  }
345
244
  const home = (() => {
346
245
  try {
347
- return (0, import_path3.resolve)((0, import_os2.homedir)());
246
+ const path5 = (0, import_path3.resolve)((0, import_os2.homedir)());
247
+ try {
248
+ return (0, import_fs2.realpathSync)(path5);
249
+ } catch {
250
+ return path5;
251
+ }
348
252
  } catch {
349
253
  return null;
350
254
  }
@@ -363,7 +267,12 @@ function isSensitiveStateLocation(dir) {
363
267
  if (isFilesystemRoot(candidate)) return true;
364
268
  return sensitiveAbsoluteRoots().some((root) => {
365
269
  const normalizedCandidate = process.platform === "win32" ? candidate.toLowerCase() : candidate;
366
- const normalizedRoot = process.platform === "win32" ? root.toLowerCase() : root;
270
+ let canonicalRoot = root;
271
+ try {
272
+ canonicalRoot = (0, import_fs2.realpathSync)(root);
273
+ } catch {
274
+ }
275
+ const normalizedRoot = process.platform === "win32" ? canonicalRoot.toLowerCase() : canonicalRoot;
367
276
  return normalizedCandidate === normalizedRoot || isWithinPath(normalizedRoot, normalizedCandidate);
368
277
  });
369
278
  }
@@ -389,7 +298,6 @@ function resolveStateAnchorRoot(worktreeRoot) {
389
298
  if (worktreeRoot) return resolveSuperprojectRoot(worktreeRoot) || worktreeRoot;
390
299
  return getWorktreeRoot() || resolveNonGitStateAnchor();
391
300
  }
392
- var gitShowToplevelProbeForTests;
393
301
  function gitErrorStderr(error) {
394
302
  if (!error || typeof error !== "object") {
395
303
  return "";
@@ -445,7 +353,7 @@ function isNotAGitRepositoryError(error) {
445
353
  return false;
446
354
  }
447
355
  const stderr = gitErrorStderr(error);
448
- return err.status === 128 && /not a git repository/i.test(stderr);
356
+ return err.status === 128 && /(?:not a git repository|must be run in a work tree)/i.test(stderr);
449
357
  }
450
358
  function formatGitProbeDetail(error) {
451
359
  if (!error || typeof error !== "object") {
@@ -572,27 +480,229 @@ function runGitShowToplevel(cwd) {
572
480
  encoding: "utf-8",
573
481
  stdio: ["pipe", "pipe", "pipe"],
574
482
  windowsHide: true,
575
- timeout: 5e3
483
+ timeout: 5e3,
484
+ // Force English error text so isNotAGitRepositoryError's stderr match is
485
+ // locale-independent (localized git output otherwise fails to match and
486
+ // mis-classifies a plain "not a repository" as probe_failed, which then
487
+ // fails closed and breaks callers such as the HUD statusline).
488
+ env: { ...process.env, LC_ALL: "C" }
576
489
  });
577
490
  }
578
491
  function probeGitTopLevel(cwd) {
492
+ const scope = worktreePathRenderScope.getStore();
493
+ const scopeKey = scope ? canonicalizeExistingPath(cwd) ?? (0, import_path3.resolve)(cwd) : null;
494
+ if (scope && scopeKey) {
495
+ const cached = scope.gitTopLevelProbes.get(scopeKey);
496
+ if (cached) return cached;
497
+ }
498
+ let result;
579
499
  try {
580
- return classifyGitShowToplevelStdout(runGitShowToplevel(cwd), cwd);
500
+ result = classifyGitShowToplevelStdout(runGitShowToplevel(cwd), cwd);
581
501
  } catch (error) {
582
- return classifyGitShowToplevelError(error);
502
+ result = classifyGitShowToplevelError(error);
503
+ }
504
+ if (scope && scopeKey) {
505
+ scope.gitTopLevelProbes.set(scopeKey, result);
506
+ }
507
+ return result;
508
+ }
509
+ function gitMetadataFileSignature(path5) {
510
+ try {
511
+ const metadata = (0, import_fs2.statSync)(path5);
512
+ return [
513
+ path5,
514
+ metadata.dev,
515
+ metadata.ino,
516
+ metadata.mode,
517
+ metadata.size,
518
+ metadata.mtimeMs,
519
+ metadata.ctimeMs
520
+ ].join(":");
521
+ } catch {
522
+ return `${path5}:missing`;
523
+ }
524
+ }
525
+ function readGitMarker(path5) {
526
+ let descriptor;
527
+ try {
528
+ if (!(0, import_fs2.lstatSync)(path5).isFile()) return null;
529
+ descriptor = (0, import_fs2.openSync)(path5, "r");
530
+ const buffer = Buffer.alloc(MAX_GIT_MARKER_BYTES);
531
+ const bytesRead = (0, import_fs2.readSync)(descriptor, buffer, 0, buffer.length, 0);
532
+ return buffer.toString("utf8", 0, bytesRead);
533
+ } catch {
534
+ return null;
535
+ } finally {
536
+ if (descriptor !== void 0) (0, import_fs2.closeSync)(descriptor);
537
+ }
538
+ }
539
+ function commonGitDirectorySignature(linkedGitDir) {
540
+ const commondirPath = (0, import_path3.join)(linkedGitDir, "commondir");
541
+ try {
542
+ if (!(0, import_fs2.existsSync)(commondirPath)) return `${commondirPath}:absent`;
543
+ const marker = readGitMarker(commondirPath);
544
+ if (marker === null) return `${commondirPath}:unreadable`;
545
+ const commonDir = canonicalizeExistingPath((0, import_path3.resolve)(linkedGitDir, marker.trim()));
546
+ if (!commonDir || !(0, import_fs2.statSync)(commonDir).isDirectory()) {
547
+ return `${commondirPath}:invalid:${marker}`;
548
+ }
549
+ return [
550
+ commonDir,
551
+ gitMetadataFileSignature(commonDir),
552
+ gitMetadataFileSignature((0, import_path3.join)(commonDir, "HEAD")),
553
+ gitMetadataFileSignature((0, import_path3.join)(commonDir, "index")),
554
+ gitMetadataFileSignature((0, import_path3.join)(commonDir, "config"))
555
+ ].join(":");
556
+ } catch {
557
+ return `${commondirPath}:invalid`;
558
+ }
559
+ }
560
+ function getGitMetadataSnapshot(cwd) {
561
+ const metadataDir = findGitMetadataDir(canonicalizeExistingPath(cwd) ?? (0, import_path3.resolve)(cwd));
562
+ if (!metadataDir) return null;
563
+ const canonicalDirectory = canonicalizeExistingPath(metadataDir);
564
+ if (!canonicalDirectory) return null;
565
+ const gitPath = (0, import_path3.join)(canonicalDirectory, ".git");
566
+ try {
567
+ const metadata = (0, import_fs2.statSync)(gitPath);
568
+ const marker = metadata.isFile() ? readGitMarker(gitPath) : "";
569
+ if (marker === null) return null;
570
+ let metadataPath = gitPath;
571
+ let linkedGitDirSignature = "";
572
+ if (metadata.isFile()) {
573
+ const gitDirMatch = /^\s*gitdir:\s*(.+?)\s*$/im.exec(marker);
574
+ if (!gitDirMatch?.[1]) return null;
575
+ const linkedGitDir = (0, import_path3.resolve)(canonicalDirectory, gitDirMatch[1].trim());
576
+ const linkedGitDirReal = canonicalizeExistingPath(linkedGitDir);
577
+ if (!linkedGitDirReal || !(0, import_fs2.statSync)(linkedGitDirReal).isDirectory()) return null;
578
+ metadataPath = linkedGitDirReal;
579
+ linkedGitDirSignature = [
580
+ linkedGitDirReal,
581
+ gitMetadataFileSignature(linkedGitDirReal),
582
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "HEAD")),
583
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "index")),
584
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "config")),
585
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "config.worktree")),
586
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "commondir")),
587
+ gitMetadataFileSignature((0, import_path3.join)(linkedGitDirReal, "gitdir")),
588
+ commonGitDirectorySignature(linkedGitDirReal)
589
+ ].join(":");
590
+ }
591
+ const gitPathReal = canonicalizeExistingPath(gitPath) ?? (0, import_path3.resolve)(gitPath);
592
+ const metadataPathReal = canonicalizeExistingPath(metadataPath) ?? (0, import_path3.resolve)(metadataPath);
593
+ const signature = [
594
+ gitPathReal,
595
+ gitMetadataFileSignature(gitPath),
596
+ marker,
597
+ linkedGitDirSignature,
598
+ metadataPathReal,
599
+ gitMetadataFileSignature((0, import_path3.join)(metadataPathReal, "HEAD")),
600
+ gitMetadataFileSignature((0, import_path3.join)(metadataPathReal, "index")),
601
+ gitMetadataFileSignature((0, import_path3.join)(metadataPathReal, "config")),
602
+ gitMetadataFileSignature((0, import_path3.join)(metadataPathReal, "config.worktree"))
603
+ ].join(":");
604
+ return { directory: canonicalDirectory, signature };
605
+ } catch {
606
+ return null;
607
+ }
608
+ }
609
+ function getGitTopologySignature(cwd) {
610
+ const start = canonicalizeExistingPath(cwd) ?? (0, import_path3.resolve)(cwd);
611
+ const signatures = [];
612
+ let cursor = start;
613
+ for (; ; ) {
614
+ const gitPath = (0, import_path3.join)(cursor, ".git");
615
+ if ((0, import_fs2.existsSync)(gitPath)) {
616
+ let metadataPath = gitPath;
617
+ let marker = "";
618
+ try {
619
+ if ((0, import_fs2.statSync)(gitPath).isFile()) {
620
+ marker = readGitMarker(gitPath) ?? "<unreadable>";
621
+ const gitDirMatch = /^\s*gitdir:\s*(.+?)\s*$/im.exec(marker);
622
+ if (gitDirMatch?.[1]) metadataPath = (0, import_path3.resolve)(cursor, gitDirMatch[1].trim());
623
+ }
624
+ } catch {
625
+ }
626
+ const metadataReal = canonicalizeExistingPath(metadataPath) ?? (0, import_path3.resolve)(metadataPath);
627
+ signatures.push([
628
+ cursor,
629
+ gitMetadataFileSignature(gitPath),
630
+ marker,
631
+ gitMetadataFileSignature((0, import_path3.join)(metadataReal, "HEAD")),
632
+ gitMetadataFileSignature((0, import_path3.join)(metadataReal, "index")),
633
+ gitMetadataFileSignature((0, import_path3.join)(metadataReal, "config")),
634
+ gitMetadataFileSignature((0, import_path3.join)(metadataReal, "config.worktree")),
635
+ commonGitDirectorySignature(metadataReal)
636
+ ].join(":"));
637
+ }
638
+ const parent = (0, import_path3.dirname)(cursor);
639
+ if (parent === cursor) break;
640
+ cursor = parent;
583
641
  }
642
+ return signatures.join("|");
643
+ }
644
+ function createStateRootCacheEntry(cwd, root) {
645
+ return {
646
+ root,
647
+ metadataSignature: getGitMetadataSnapshot(cwd)?.signature ?? null,
648
+ topologySignature: getGitTopologySignature(cwd),
649
+ environmentSignature: gitProbeEnvironmentSignature()
650
+ };
651
+ }
652
+ function isStateRootCacheEntryValid(cwd, entry) {
653
+ return entry.metadataSignature === (getGitMetadataSnapshot(cwd)?.signature ?? null) && entry.topologySignature === getGitTopologySignature(cwd) && entry.environmentSignature === gitProbeEnvironmentSignature();
654
+ }
655
+ function isGitTopLevelCacheEntryValid(cwd, cached) {
656
+ const current = getGitMetadataSnapshot(cwd);
657
+ if (!current || current.signature !== cached.metadataSignature) return false;
658
+ if (cached.topologySignature !== getGitTopologySignature(cwd)) return false;
659
+ if (cached.environmentSignature !== gitProbeEnvironmentSignature()) return false;
660
+ if (!sameCanonicalPath(current.directory, cached.metadataDir)) return false;
661
+ if (!sameCanonicalPath(current.directory, cached.root)) return false;
662
+ return isCredibleGitWorktreeRoot(cached.root);
663
+ }
664
+ function cacheGitTopLevel(key, root, cwd) {
665
+ const metadata = getGitMetadataSnapshot(cwd);
666
+ if (!metadata || !sameCanonicalPath(metadata.directory, root)) return;
667
+ if (gitTopLevelCacheMap.size >= MAX_WORKTREE_CACHE_SIZE) {
668
+ const oldest = gitTopLevelCacheMap.keys().next().value;
669
+ if (oldest !== void 0) gitTopLevelCacheMap.delete(oldest);
670
+ }
671
+ gitTopLevelCacheMap.set(key, {
672
+ root,
673
+ metadataDir: metadata.directory,
674
+ metadataSignature: metadata.signature,
675
+ topologySignature: getGitTopologySignature(cwd),
676
+ environmentSignature: gitProbeEnvironmentSignature()
677
+ });
584
678
  }
585
679
  function getGitTopLevel(cwd) {
586
- const probe = probeGitTopLevel(cwd || process.cwd());
587
- return probe.status === "ok" ? probe.root : null;
680
+ const effectiveCwd = cwd || process.cwd();
681
+ const key = canonicalizeExistingPath(effectiveCwd) ?? (0, import_path3.resolve)(effectiveCwd);
682
+ const cached = gitTopLevelCacheMap.get(key);
683
+ if (cached) {
684
+ if (isGitTopLevelCacheEntryValid(effectiveCwd, cached)) {
685
+ gitTopLevelCacheMap.delete(key);
686
+ gitTopLevelCacheMap.set(key, cached);
687
+ return cached.root;
688
+ }
689
+ gitTopLevelCacheMap.delete(key);
690
+ }
691
+ const probe = probeGitTopLevel(effectiveCwd);
692
+ if (probe.status !== "ok") return null;
693
+ cacheGitTopLevel(key, probe.root, effectiveCwd);
694
+ return probe.root;
588
695
  }
589
696
  function getWorktreeRoot(cwd) {
590
697
  const effectiveCwd = cwd || process.cwd();
591
698
  if (worktreeCacheMap.has(effectiveCwd)) {
592
- const root2 = worktreeCacheMap.get(effectiveCwd);
699
+ const cached = worktreeCacheMap.get(effectiveCwd);
700
+ if (isStateRootCacheEntryValid(effectiveCwd, cached) && cached.root !== null && isCredibleGitWorktreeRoot(cached.root)) {
701
+ worktreeCacheMap.delete(effectiveCwd);
702
+ worktreeCacheMap.set(effectiveCwd, cached);
703
+ return cached.root;
704
+ }
593
705
  worktreeCacheMap.delete(effectiveCwd);
594
- worktreeCacheMap.set(effectiveCwd, root2);
595
- return root2 || null;
596
706
  }
597
707
  const root = resolveSuperprojectRoot(effectiveCwd) || getGitTopLevel(effectiveCwd);
598
708
  if (!root) {
@@ -604,23 +714,64 @@ function getWorktreeRoot(cwd) {
604
714
  worktreeCacheMap.delete(oldest);
605
715
  }
606
716
  }
607
- worktreeCacheMap.set(effectiveCwd, root);
717
+ worktreeCacheMap.set(effectiveCwd, createStateRootCacheEntry(effectiveCwd, root));
608
718
  return root;
609
719
  }
610
- var dualDirWarnings = /* @__PURE__ */ new Set();
720
+ function discoverCentralizedDirFromSettings() {
721
+ const candidates = [];
722
+ try {
723
+ candidates.push((0, import_path3.join)(getCopilotConfigDir(), "settings.json"));
724
+ } catch {
725
+ }
726
+ try {
727
+ const cw = process.cwd();
728
+ candidates.push((0, import_path3.join)(cw, ".claude", "settings.json"));
729
+ candidates.push((0, import_path3.join)(cw, ".claude", "settings.local.json"));
730
+ } catch {
731
+ }
732
+ for (const p of candidates) {
733
+ try {
734
+ const raw = (0, import_fs2.readFileSync)(p, "utf-8");
735
+ const parsed = JSON.parse(raw);
736
+ const env = parsed?.env;
737
+ const val = env?.OMC_STATE_DIR;
738
+ if (typeof val === "string" && val.trim()) return val.trim();
739
+ } catch {
740
+ }
741
+ }
742
+ return null;
743
+ }
611
744
  function getProjectIdentifier(worktreeRoot) {
612
745
  const root = worktreeRoot || getGitTopLevel() || process.cwd();
746
+ const operationScope = projectIdentifierOperationScope.getStore();
747
+ const operationScopeKey = operationScope ? canonicalizeExistingPath(root) ?? (0, import_path3.resolve)(root) : null;
748
+ if (operationScope && operationScopeKey) {
749
+ const cached = operationScope.get(operationScopeKey);
750
+ if (cached !== void 0) return cached;
751
+ }
752
+ const scope = worktreePathRenderScope.getStore();
753
+ const scopeKey = scope ? canonicalizeExistingPath(root) ?? (0, import_path3.resolve)(root) : null;
754
+ if (scope && scopeKey) {
755
+ const cached = scope.projectIdentifiers.get(scopeKey);
756
+ if (cached !== void 0) return cached;
757
+ }
613
758
  const workspaceRoot = findWorkspaceRoot(root);
614
759
  if (workspaceRoot) {
615
760
  const cfg = readWorkspaceMarkerConfig(workspaceRoot);
616
761
  if (cfg.id && typeof cfg.id === "string" && cfg.id.trim()) {
617
762
  const safeId = cfg.id.trim().replace(/[^a-zA-Z0-9_-]/g, "_");
618
763
  const hash3 = (0, import_crypto.createHash)("sha256").update(safeId).digest("hex").slice(0, 16);
619
- return `${safeId}-${hash3}`;
764
+ const identifier3 = `${safeId}-${hash3}`;
765
+ if (operationScope && operationScopeKey) operationScope.set(operationScopeKey, identifier3);
766
+ if (scope && scopeKey) scope.projectIdentifiers.set(scopeKey, identifier3);
767
+ return identifier3;
620
768
  }
621
769
  const hash2 = (0, import_crypto.createHash)("sha256").update(workspaceRoot).digest("hex").slice(0, 16);
622
770
  const dirName2 = (0, import_path3.basename)(workspaceRoot).replace(/[^a-zA-Z0-9_-]/g, "_");
623
- return `${dirName2}-${hash2}`;
771
+ const identifier2 = `${dirName2}-${hash2}`;
772
+ if (operationScope && operationScopeKey) operationScope.set(operationScopeKey, identifier2);
773
+ if (scope && scopeKey) scope.projectIdentifiers.set(scopeKey, identifier2);
774
+ return identifier2;
624
775
  }
625
776
  let remoteUrl = "";
626
777
  try {
@@ -628,7 +779,8 @@ function getProjectIdentifier(worktreeRoot) {
628
779
  cwd: root,
629
780
  encoding: "utf-8",
630
781
  stdio: ["pipe", "pipe", "pipe"],
631
- windowsHide: true
782
+ windowsHide: true,
783
+ timeout: 5e3
632
784
  }).trim();
633
785
  } catch {
634
786
  }
@@ -649,228 +801,1610 @@ function getProjectIdentifier(worktreeRoot) {
649
801
  primaryRoot = resolved;
650
802
  }
651
803
  }
652
- } catch {
653
- }
654
- const source = remoteUrl || primaryRoot;
655
- const hash = (0, import_crypto.createHash)("sha256").update(source).digest("hex").slice(0, 16);
656
- const dirName = (0, import_path3.basename)(primaryRoot).replace(/[^a-zA-Z0-9_-]/g, "_");
657
- return `${dirName}-${hash}`;
658
- }
659
- function getOmcRoot(worktreeRoot) {
660
- const customDir = process.env.OMC_STATE_DIR;
661
- if (customDir) {
662
- const root2 = worktreeRoot || getGitTopLevel() || process.cwd();
663
- const workspaceRoot = findWorkspaceRoot(root2);
664
- const gitTopLevel = getGitTopLevel(root2);
665
- const projectId = !gitTopLevel && !workspaceRoot ? "non-git" : getProjectIdentifier(root2);
666
- const centralizedPath = (0, import_path3.join)(customDir, projectId);
667
- const legacyPath = (0, import_path3.join)(root2, OmcPaths.ROOT);
668
- const warningKey = `${legacyPath}:${centralizedPath}`;
669
- if (!dualDirWarnings.has(warningKey) && (0, import_fs2.existsSync)(legacyPath) && (0, import_fs2.existsSync)(centralizedPath)) {
670
- dualDirWarnings.add(warningKey);
671
- console.warn(
672
- `[omc] Both legacy state dir (${legacyPath}) and centralized state dir (${centralizedPath}) exist. Using centralized dir. Consider migrating data from the legacy dir and removing it.`
673
- );
804
+ } catch {
805
+ }
806
+ const source = remoteUrl || primaryRoot;
807
+ const hash = (0, import_crypto.createHash)("sha256").update(source).digest("hex").slice(0, 16);
808
+ const dirName = (0, import_path3.basename)(primaryRoot).replace(/[^a-zA-Z0-9_-]/g, "_");
809
+ const identifier = `${dirName}-${hash}`;
810
+ if (operationScope && operationScopeKey) operationScope.set(operationScopeKey, identifier);
811
+ if (scope && scopeKey) scope.projectIdentifiers.set(scopeKey, identifier);
812
+ return identifier;
813
+ }
814
+ function getOmcRoot(worktreeRoot) {
815
+ const customDir = process.env.OMC_STATE_DIR;
816
+ if (customDir) {
817
+ const root2 = worktreeRoot || getGitTopLevel() || process.cwd();
818
+ const workspaceRoot = findWorkspaceRoot(root2);
819
+ const gitTopLevel = getGitTopLevel(root2);
820
+ const projectId = !gitTopLevel && !workspaceRoot ? "non-git" : getProjectIdentifier(root2);
821
+ const centralizedPath = (0, import_path3.join)(customDir, projectId);
822
+ const legacyPath = (0, import_path3.join)(root2, OmcPaths.ROOT);
823
+ const warningKey = `${legacyPath}:${centralizedPath}`;
824
+ if (!dualDirWarnings.has(warningKey) && (0, import_fs2.existsSync)(legacyPath) && (0, import_fs2.existsSync)(centralizedPath)) {
825
+ dualDirWarnings.add(warningKey);
826
+ console.warn(
827
+ `[omc] Both legacy state dir (${legacyPath}) and centralized state dir (${centralizedPath}) exist. Using centralized dir. Consider migrating data from the legacy dir and removing it.`
828
+ );
829
+ }
830
+ return centralizedPath;
831
+ }
832
+ const workspaceAnchor = findWorkspaceRoot(worktreeRoot);
833
+ if (workspaceAnchor && !isSensitiveStateLocation(workspaceAnchor)) {
834
+ try {
835
+ const legacyPathW = (0, import_path3.join)(workspaceAnchor, OmcPaths.ROOT);
836
+ const discoveredCentral = discoverCentralizedDirFromSettings();
837
+ if (discoveredCentral) {
838
+ const wsCfg = readWorkspaceMarkerConfig(workspaceAnchor);
839
+ let projectIdW;
840
+ if (wsCfg.id && typeof wsCfg.id === "string" && wsCfg.id.trim()) {
841
+ const safeId = wsCfg.id.trim().replace(/[^a-zA-Z0-9_-]/g, "_");
842
+ projectIdW = `${safeId}-${(0, import_crypto.createHash)("sha256").update(safeId).digest("hex").slice(0, 16)}`;
843
+ } else {
844
+ projectIdW = `${(0, import_path3.basename)(workspaceAnchor).replace(/[^a-zA-Z0-9_-]/g, "_")}-${(0, import_crypto.createHash)("sha256").update(workspaceAnchor).digest("hex").slice(0, 16)}`;
845
+ }
846
+ const centralizedPathW = (0, import_path3.join)(discoveredCentral, projectIdW);
847
+ const warningKeyW = `${legacyPathW}:${centralizedPathW}`;
848
+ if (!dualDirWarnings.has(warningKeyW) && (0, import_fs2.existsSync)(legacyPathW) && (0, import_fs2.existsSync)(centralizedPathW)) {
849
+ dualDirWarnings.add(warningKeyW);
850
+ console.warn(
851
+ `[omc] Both legacy state dir (${legacyPathW}) and centralized state dir (${centralizedPathW}) exist. Using legacy dir (OMC_STATE_DIR not set in this process). Set OMC_STATE_DIR via settings.json env to use centralized dir consistently.`
852
+ );
853
+ }
854
+ }
855
+ } catch {
856
+ }
857
+ return (0, import_path3.join)(workspaceAnchor, OmcPaths.ROOT);
858
+ }
859
+ const root = resolveStateAnchorRoot(worktreeRoot);
860
+ if (!getGitTopLevel(root)) {
861
+ return (0, import_path3.join)(resolveNonGitStateAnchor(root), OmcPaths.ROOT);
862
+ }
863
+ try {
864
+ const legacyPath = (0, import_path3.join)(root, OmcPaths.ROOT);
865
+ const discoveredCentral = discoverCentralizedDirFromSettings();
866
+ if (discoveredCentral) {
867
+ const projectId = getProjectIdentifier(root);
868
+ const centralizedPath = (0, import_path3.join)(discoveredCentral, projectId);
869
+ const warningKey = `${legacyPath}:${centralizedPath}`;
870
+ if (!dualDirWarnings.has(warningKey) && (0, import_fs2.existsSync)(legacyPath) && (0, import_fs2.existsSync)(centralizedPath)) {
871
+ dualDirWarnings.add(warningKey);
872
+ console.warn(
873
+ `[omc] Both legacy state dir (${legacyPath}) and centralized state dir (${centralizedPath}) exist. Using legacy dir (OMC_STATE_DIR not set in this process). Set OMC_STATE_DIR via settings.json env to use centralized dir consistently.`
874
+ );
875
+ }
876
+ }
877
+ } catch {
878
+ }
879
+ return (0, import_path3.join)(root, OmcPaths.ROOT);
880
+ }
881
+ function callerVisibleTrustedRootLabel(trustedRoot) {
882
+ const label = (0, import_path3.basename)(trustedRoot);
883
+ return label.length > 0 ? label : "current repository";
884
+ }
885
+ function attachCanonicalWorkingDirectoryRoots(target, providedRoot, trustedRoot) {
886
+ canonicalWorkingDirectoryRoots.set(target, { providedRoot, trustedRoot });
887
+ }
888
+ function canonicalRootAliases(root) {
889
+ if (root.length === 0) {
890
+ return [];
891
+ }
892
+ const aliases = /* @__PURE__ */ new Set([root]);
893
+ try {
894
+ aliases.add((0, import_url.pathToFileURL)(root).href);
895
+ } catch {
896
+ }
897
+ try {
898
+ const real = (0, import_fs2.realpathSync)(root);
899
+ aliases.add(real);
900
+ aliases.add((0, import_url.pathToFileURL)(real).href);
901
+ } catch {
902
+ }
903
+ if (import_path3.sep === "\\") {
904
+ aliases.add(root.replaceAll("\\", "/"));
905
+ }
906
+ return [...aliases].sort((a, b) => b.length - a.length);
907
+ }
908
+ function redactCanonicalRoots(text, providedRoot, trustedRoot) {
909
+ let redacted = text;
910
+ const roots = [...canonicalRootAliases(providedRoot), ...canonicalRootAliases(trustedRoot)].sort((a, b) => b.length - a.length);
911
+ for (const root of roots) {
912
+ redacted = redacted.split(root).join("<redacted>");
913
+ }
914
+ return redacted;
915
+ }
916
+ function redactErrorStack(stack, providedRoot, trustedRoot) {
917
+ const newline = stack.includes("\r\n") ? "\r\n" : "\n";
918
+ const lines = stack.split(/\r?\n/);
919
+ if (lines.length <= 1) {
920
+ return stack;
921
+ }
922
+ const [header, ...frames] = lines;
923
+ return [header, ...frames.map((frame) => redactCanonicalRoots(frame, providedRoot, trustedRoot))].join(newline);
924
+ }
925
+ var import_crypto, import_node_async_hooks, import_child_process, import_fs2, import_os2, import_path3, import_url, WORKSPACE_MARKER, OmcPaths, MAX_WORKTREE_CACHE_SIZE, worktreeCacheMap, gitTopLevelCacheMap, superprojectCacheMap, canonicalWorkingDirectoryRoots, GIT_PROBE_ENVIRONMENT_KEYS, MAX_GIT_MARKER_BYTES, workspaceCacheMap, SENSITIVE_DIR_BASENAMES, worktreePathRenderScope, projectIdentifierOperationScope, gitShowToplevelProbeForTests, dualDirWarnings, ForeignWorkingDirectoryError;
926
+ var init_worktree_paths = __esm({
927
+ "src/lib/worktree-paths.ts"() {
928
+ "use strict";
929
+ import_crypto = require("crypto");
930
+ import_node_async_hooks = require("node:async_hooks");
931
+ import_child_process = require("child_process");
932
+ import_fs2 = require("fs");
933
+ import_os2 = require("os");
934
+ import_path3 = require("path");
935
+ import_url = require("url");
936
+ init_config_dir();
937
+ init_encode_project_path();
938
+ WORKSPACE_MARKER = ".omc-workspace";
939
+ OmcPaths = {
940
+ ROOT: ".omg",
941
+ STATE: ".omg/state",
942
+ SESSIONS: ".omg/state/sessions",
943
+ PLANS: ".omg/plans",
944
+ RESEARCH: ".omg/research",
945
+ NOTEPAD: ".omg/notepad.md",
946
+ PROJECT_MEMORY: ".omg/project-memory.json",
947
+ DRAFTS: ".omg/drafts",
948
+ NOTEPADS: ".omg/notepads",
949
+ LOGS: ".omg/logs",
950
+ SCIENTIST: ".omg/scientist",
951
+ AUTOPILOT: ".omg/autopilot",
952
+ SKILLS: ".omg/skills",
953
+ SHARED_MEMORY: ".omg/state/shared-memory",
954
+ DEEPINIT_MANIFEST: ".omg/deepinit-manifest.json"
955
+ };
956
+ MAX_WORKTREE_CACHE_SIZE = 8;
957
+ worktreeCacheMap = /* @__PURE__ */ new Map();
958
+ gitTopLevelCacheMap = /* @__PURE__ */ new Map();
959
+ superprojectCacheMap = /* @__PURE__ */ new Map();
960
+ canonicalWorkingDirectoryRoots = /* @__PURE__ */ new WeakMap();
961
+ GIT_PROBE_ENVIRONMENT_KEYS = [
962
+ "PATH",
963
+ "GIT_DIR",
964
+ "GIT_WORK_TREE",
965
+ "GIT_COMMON_DIR",
966
+ "GIT_EXEC_PATH",
967
+ "GIT_CEILING_DIRECTORIES",
968
+ "GIT_DISCOVERY_ACROSS_FILESYSTEM",
969
+ "GIT_CONFIG_SYSTEM",
970
+ "GIT_CONFIG_GLOBAL",
971
+ "GIT_CONFIG_NOSYSTEM",
972
+ "GIT_CONFIG_COUNT",
973
+ "GIT_CONFIG_PARAMETERS",
974
+ "GIT_INDEX_FILE",
975
+ "HOME",
976
+ "XDG_CONFIG_HOME"
977
+ ];
978
+ MAX_GIT_MARKER_BYTES = 4096;
979
+ workspaceCacheMap = /* @__PURE__ */ new Map();
980
+ SENSITIVE_DIR_BASENAMES = /* @__PURE__ */ new Set([
981
+ ".ssh",
982
+ ".gnupg",
983
+ ".aws",
984
+ ".azure",
985
+ ".gcloud",
986
+ ".kube",
987
+ "ssh",
988
+ ".pki",
989
+ ".config",
990
+ ".copilot",
991
+ ".claude.json",
992
+ ".codex",
993
+ ".gemini",
994
+ ".cursor",
995
+ ".vscode",
996
+ ".ollama",
997
+ ".docker",
998
+ ".npm",
999
+ ".cache",
1000
+ ".local",
1001
+ "desktop",
1002
+ "documents",
1003
+ "downloads",
1004
+ "pictures",
1005
+ "photos",
1006
+ "music",
1007
+ "movies",
1008
+ "videos",
1009
+ "public",
1010
+ "library"
1011
+ ]);
1012
+ worktreePathRenderScope = new import_node_async_hooks.AsyncLocalStorage();
1013
+ projectIdentifierOperationScope = new import_node_async_hooks.AsyncLocalStorage();
1014
+ dualDirWarnings = /* @__PURE__ */ new Set();
1015
+ ForeignWorkingDirectoryError = class extends Error {
1016
+ callerLabel;
1017
+ constructor(providedRoot, trustedRoot, callerLabel) {
1018
+ super(
1019
+ `workingDirectory '${callerLabel}' belongs to a different repository than '${callerVisibleTrustedRootLabel(trustedRoot)}' and was not used. Cross-repository access is not permitted; pass a path inside the current repository or start the session there.`
1020
+ );
1021
+ this.name = "ForeignWorkingDirectoryError";
1022
+ this.callerLabel = callerLabel;
1023
+ attachCanonicalWorkingDirectoryRoots(this, providedRoot, trustedRoot);
1024
+ Object.defineProperty(this, "stack", {
1025
+ value: redactErrorStack(this.stack ?? `${this.name}: ${this.message}`, providedRoot, trustedRoot),
1026
+ enumerable: false,
1027
+ configurable: true,
1028
+ writable: true
1029
+ });
1030
+ }
1031
+ toJSON() {
1032
+ return {
1033
+ name: this.name,
1034
+ message: this.message,
1035
+ callerLabel: this.callerLabel
1036
+ };
1037
+ }
1038
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
1039
+ return this.stack ?? `${this.name}: ${this.message}`;
1040
+ }
1041
+ };
1042
+ }
1043
+ });
1044
+
1045
+ // src/shared/types.ts
1046
+ var CANONICAL_TEAM_ROLES, KNOWN_AGENT_NAMES;
1047
+ var init_types = __esm({
1048
+ "src/shared/types.ts"() {
1049
+ "use strict";
1050
+ CANONICAL_TEAM_ROLES = [
1051
+ "orchestrator",
1052
+ "planner",
1053
+ "analyst",
1054
+ "architect",
1055
+ "executor",
1056
+ "debugger",
1057
+ "critic",
1058
+ "code-reviewer",
1059
+ "security-reviewer",
1060
+ "test-engineer",
1061
+ "designer",
1062
+ "writer",
1063
+ "code-simplifier",
1064
+ "explore",
1065
+ "document-specialist"
1066
+ ];
1067
+ KNOWN_AGENT_NAMES = [
1068
+ "omc",
1069
+ "explore",
1070
+ "analyst",
1071
+ "planner",
1072
+ "architect",
1073
+ "debugger",
1074
+ "executor",
1075
+ "verifier",
1076
+ "securityReviewer",
1077
+ "codeReviewer",
1078
+ "testEngineer",
1079
+ "designer",
1080
+ "writer",
1081
+ "qaTester",
1082
+ "scientist",
1083
+ "tracer",
1084
+ "gitMaster",
1085
+ "codeSimplifier",
1086
+ "critic",
1087
+ "documentSpecialist"
1088
+ ];
1089
+ }
1090
+ });
1091
+
1092
+ // src/team/types.ts
1093
+ var init_types2 = __esm({
1094
+ "src/team/types.ts"() {
1095
+ "use strict";
1096
+ }
1097
+ });
1098
+
1099
+ // src/graph/runtime/native-contained-fs.ts
1100
+ var init_native_contained_fs = __esm({
1101
+ "src/graph/runtime/native-contained-fs.ts"() {
1102
+ "use strict";
1103
+ }
1104
+ });
1105
+
1106
+ // src/team/state-paths.ts
1107
+ function normalizeTaskFileStem(taskId) {
1108
+ const trimmed = String(taskId).trim().replace(/\.json$/i, "");
1109
+ if (/^task-\d+$/.test(trimmed)) return trimmed;
1110
+ if (/^\d+$/.test(trimmed)) return `task-${trimmed}`;
1111
+ return trimmed;
1112
+ }
1113
+ function getTaskStoragePath(cwd, teamName, taskId) {
1114
+ const tasksRoot = (0, import_path17.join)(getOmcRoot(cwd), "state", "team", teamName, "tasks");
1115
+ if (taskId !== void 0) {
1116
+ return (0, import_path17.join)(tasksRoot, normalizeTaskFileStem(taskId) + ".json");
1117
+ }
1118
+ return tasksRoot;
1119
+ }
1120
+ function getLegacyTaskStoragePath(claudeConfigDir, teamName, taskId) {
1121
+ if (taskId !== void 0) {
1122
+ return (0, import_path17.join)(claudeConfigDir, "tasks", teamName, `${taskId}.json`);
1123
+ }
1124
+ return (0, import_path17.join)(claudeConfigDir, "tasks", teamName);
1125
+ }
1126
+ var import_path17;
1127
+ var init_state_paths = __esm({
1128
+ "src/team/state-paths.ts"() {
1129
+ "use strict";
1130
+ import_path17 = require("path");
1131
+ init_worktree_paths();
1132
+ }
1133
+ });
1134
+
1135
+ // src/team/team-owner-epoch.ts
1136
+ var import_crypto4, import_fs13, import_path18;
1137
+ var init_team_owner_epoch = __esm({
1138
+ "src/team/team-owner-epoch.ts"() {
1139
+ "use strict";
1140
+ import_crypto4 = require("crypto");
1141
+ import_fs13 = require("fs");
1142
+ import_path18 = require("path");
1143
+ init_native_contained_fs();
1144
+ init_state_paths();
1145
+ }
1146
+ });
1147
+
1148
+ // src/team/process-identity-lock.ts
1149
+ var init_process_identity_lock = __esm({
1150
+ "src/team/process-identity-lock.ts"() {
1151
+ "use strict";
1152
+ init_team_owner_epoch();
1153
+ }
1154
+ });
1155
+
1156
+ // src/team/contracts.ts
1157
+ var init_contracts = __esm({
1158
+ "src/team/contracts.ts"() {
1159
+ "use strict";
1160
+ }
1161
+ });
1162
+
1163
+ // src/team/team-instance.ts
1164
+ var init_team_instance = __esm({
1165
+ "src/team/team-instance.ts"() {
1166
+ "use strict";
1167
+ init_contracts();
1168
+ init_state_paths();
1169
+ init_process_identity_lock();
1170
+ init_team_owner_epoch();
1171
+ init_types2();
1172
+ }
1173
+ });
1174
+
1175
+ // src/team/governance.ts
1176
+ var init_governance = __esm({
1177
+ "src/team/governance.ts"() {
1178
+ "use strict";
1179
+ init_types2();
1180
+ }
1181
+ });
1182
+
1183
+ // src/team/worker-canonicalization.ts
1184
+ var init_worker_canonicalization = __esm({
1185
+ "src/team/worker-canonicalization.ts"() {
1186
+ "use strict";
1187
+ }
1188
+ });
1189
+
1190
+ // src/team/monitor.ts
1191
+ var import_fs19, import_promises3, import_path21;
1192
+ var init_monitor = __esm({
1193
+ "src/team/monitor.ts"() {
1194
+ "use strict";
1195
+ import_fs19 = require("fs");
1196
+ import_promises3 = require("fs/promises");
1197
+ import_path21 = require("path");
1198
+ init_types();
1199
+ init_contracts();
1200
+ init_state_paths();
1201
+ init_process_identity_lock();
1202
+ init_governance();
1203
+ init_worker_canonicalization();
1204
+ init_team_instance();
1205
+ init_types2();
1206
+ }
1207
+ });
1208
+
1209
+ // src/team/bridge-entry.ts
1210
+ var bridge_entry_exports = {};
1211
+ __export(bridge_entry_exports, {
1212
+ validateBridgeWorkingDirectory: () => validateBridgeWorkingDirectory,
1213
+ validateConfigPath: () => validateConfigPath
1214
+ });
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");
1219
+
1220
+ // src/team/mcp-team-bridge.ts
1221
+ var import_child_process8 = require("child_process");
1222
+ var import_fs27 = require("fs");
1223
+ var import_path29 = require("path");
1224
+
1225
+ // src/team/fs-utils.ts
1226
+ var import_fs = require("fs");
1227
+ var import_path = require("path");
1228
+ function atomicWriteJson(filePath, data, mode = 384) {
1229
+ const dir = (0, import_path.dirname)(filePath);
1230
+ if (!(0, import_fs.existsSync)(dir)) (0, import_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
1231
+ const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
1232
+ (0, import_fs.writeFileSync)(tmpPath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode });
1233
+ (0, import_fs.renameSync)(tmpPath, filePath);
1234
+ }
1235
+ function writeFileWithMode(filePath, data, mode = 384) {
1236
+ (0, import_fs.writeFileSync)(filePath, data, { encoding: "utf-8", mode });
1237
+ }
1238
+ function appendFileWithMode(filePath, data, mode = 384) {
1239
+ const fd = (0, import_fs.openSync)(filePath, import_fs.constants.O_WRONLY | import_fs.constants.O_APPEND | import_fs.constants.O_CREAT, mode);
1240
+ try {
1241
+ (0, import_fs.writeSync)(fd, data, null, "utf-8");
1242
+ } finally {
1243
+ (0, import_fs.closeSync)(fd);
1244
+ }
1245
+ }
1246
+ function ensureDirWithMode(dirPath, mode = 448) {
1247
+ if (!(0, import_fs.existsSync)(dirPath)) (0, import_fs.mkdirSync)(dirPath, { recursive: true, mode });
1248
+ }
1249
+ function safeRealpath(p) {
1250
+ try {
1251
+ return (0, import_fs.realpathSync)(p);
1252
+ } catch {
1253
+ const segments = [];
1254
+ let current = (0, import_path.resolve)(p);
1255
+ while (!(0, import_fs.existsSync)(current)) {
1256
+ segments.unshift((0, import_path.basename)(current));
1257
+ const parent = (0, import_path.dirname)(current);
1258
+ if (parent === current) break;
1259
+ current = parent;
1260
+ }
1261
+ try {
1262
+ return (0, import_path.join)((0, import_fs.realpathSync)(current), ...segments);
1263
+ } catch {
1264
+ return (0, import_path.resolve)(p);
1265
+ }
1266
+ }
1267
+ }
1268
+ function validateResolvedPath(resolvedPath, expectedBase) {
1269
+ const absResolved = safeRealpath(resolvedPath);
1270
+ const absBase = safeRealpath(expectedBase);
1271
+ const rel = (0, import_path.relative)(absBase, absResolved);
1272
+ if (rel.startsWith("..") || (0, import_path.resolve)(absBase, rel) !== absResolved) {
1273
+ throw new Error(`Path traversal detected: "${resolvedPath}" escapes base "${expectedBase}"`);
1274
+ }
1275
+ }
1276
+
1277
+ // src/team/mcp-team-bridge.ts
1278
+ init_worktree_paths();
1279
+
1280
+ // src/team/task-file-ops.ts
1281
+ var import_fs21 = require("fs");
1282
+ var import_path23 = require("path");
1283
+ init_worktree_paths();
1284
+ init_config_dir();
1285
+
1286
+ // src/team/tmux-session.ts
1287
+ var import_fs20 = require("fs");
1288
+ var import_crypto6 = require("crypto");
1289
+ var import_child_process7 = require("child_process");
1290
+ var import_util3 = require("util");
1291
+ var import_path22 = require("path");
1292
+ var import_os6 = require("os");
1293
+
1294
+ // src/cli/tmux-utils.ts
1295
+ var import_child_process5 = require("child_process");
1296
+ var import_path16 = require("path");
1297
+ var import_util = require("util");
1298
+
1299
+ // src/platform/executable-resolution.ts
1300
+ var import_fs3 = require("fs");
1301
+ var import_path4 = __toESM(require("path"), 1);
1302
+ var import_child_process2 = require("child_process");
1303
+
1304
+ // src/team/model-contract.ts
1305
+ var import_path14 = require("path");
1306
+ var import_os4 = require("os");
1307
+
1308
+ // src/features/delegation-enforcer.ts
1309
+ var import_fs11 = require("fs");
1310
+ var import_path12 = require("path");
1311
+
1312
+ // src/agents/utils.ts
1313
+ var import_fs4 = require("fs");
1314
+ var import_path5 = require("path");
1315
+ var import_url2 = require("url");
1316
+ function getPackageDir() {
1317
+ if (typeof __dirname !== "undefined" && __dirname) {
1318
+ const currentDirName = (0, import_path5.basename)(__dirname);
1319
+ const parentDirName = (0, import_path5.basename)((0, import_path5.dirname)(__dirname));
1320
+ if (currentDirName === "bridge") {
1321
+ return (0, import_path5.join)(__dirname, "..");
1322
+ }
1323
+ if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
1324
+ return (0, import_path5.join)(__dirname, "..", "..");
1325
+ }
1326
+ }
1327
+ try {
1328
+ const __filename = (0, import_url2.fileURLToPath)(importMetaUrl);
1329
+ const __dirname2 = (0, import_path5.dirname)(__filename);
1330
+ const currentDirName = (0, import_path5.basename)(__dirname2);
1331
+ if (currentDirName === "bridge") {
1332
+ return (0, import_path5.join)(__dirname2, "..");
1333
+ }
1334
+ return (0, import_path5.join)(__dirname2, "..", "..");
1335
+ } catch {
1336
+ }
1337
+ return process.cwd();
1338
+ }
1339
+ function stripFrontmatter(content) {
1340
+ const match = content.match(/^---[\s\S]*?---\s*([\s\S]*)$/);
1341
+ return match ? match[1].trim() : content.trim();
1342
+ }
1343
+ function loadAgentPrompt(agentName) {
1344
+ if (!/^[a-z0-9-]+$/i.test(agentName)) {
1345
+ throw new Error(`Invalid agent name: contains disallowed characters`);
1346
+ }
1347
+ try {
1348
+ if (typeof __AGENT_PROMPTS__ !== "undefined" && __AGENT_PROMPTS__ !== null) {
1349
+ const prompt = __AGENT_PROMPTS__[agentName];
1350
+ if (prompt) return prompt;
1351
+ }
1352
+ } catch {
1353
+ }
1354
+ try {
1355
+ const agentsDir = (0, import_path5.join)(getPackageDir(), "agents");
1356
+ const agentPath = (0, import_path5.join)(agentsDir, `${agentName}.md`);
1357
+ const resolvedPath = (0, import_path5.resolve)(agentPath);
1358
+ const resolvedAgentsDir = (0, import_path5.resolve)(agentsDir);
1359
+ const rel = (0, import_path5.relative)(resolvedAgentsDir, resolvedPath);
1360
+ if (rel.startsWith("..") || (0, import_path5.isAbsolute)(rel)) {
1361
+ throw new Error(`Invalid agent name: path traversal detected`);
1362
+ }
1363
+ const content = (0, import_fs4.readFileSync)(agentPath, "utf-8");
1364
+ return stripFrontmatter(content);
1365
+ } catch (error) {
1366
+ const message = error instanceof Error && error.message.includes("Invalid agent name") ? error.message : "Agent prompt file not found";
1367
+ console.warn(`[loadAgentPrompt] ${message}`);
1368
+ return `Agent: ${agentName}
1369
+
1370
+ Prompt unavailable.`;
1371
+ }
1372
+ }
1373
+
1374
+ // src/config/loader.ts
1375
+ var import_fs7 = require("fs");
1376
+ var import_path8 = require("path");
1377
+ init_types();
1378
+
1379
+ // src/utils/paths.ts
1380
+ var import_path7 = require("path");
1381
+ var import_fs6 = require("fs");
1382
+ var import_os3 = require("os");
1383
+ init_config_dir();
1384
+
1385
+ // src/utils/cache-occupancy.ts
1386
+ var import_fs5 = require("fs");
1387
+ var import_promises = require("fs/promises");
1388
+ var import_crypto2 = require("crypto");
1389
+ var import_path6 = require("path");
1390
+ init_config_dir();
1391
+
1392
+ // src/utils/paths.ts
1393
+ var PLUGIN_ROOT_REQUIREMENTS = [
1394
+ (0, import_path7.join)("hooks", "hooks.json"),
1395
+ (0, import_path7.join)("scripts", "run.cjs"),
1396
+ "scripts"
1397
+ ];
1398
+ var OCCUPIED_CODES = new Set(
1399
+ process.platform === "win32" ? ["EEXIST", "ENOTEMPTY", "ENOTDIR", "EISDIR", "EPERM", "EACCES"] : ["EEXIST", "ENOTEMPTY", "ENOTDIR", "EISDIR"]
1400
+ );
1401
+ var STALE_THRESHOLD_MS = 10 * 60 * 1e3;
1402
+
1403
+ // src/config/models.ts
1404
+ var TIER_ENV_KEYS = {
1405
+ LOW: [
1406
+ "OMC_MODEL_LOW",
1407
+ "CLAUDE_CODE_BEDROCK_HAIKU_MODEL",
1408
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL"
1409
+ ],
1410
+ MEDIUM: [
1411
+ "OMC_MODEL_MEDIUM",
1412
+ "CLAUDE_CODE_BEDROCK_SONNET_MODEL",
1413
+ "ANTHROPIC_DEFAULT_SONNET_MODEL"
1414
+ ],
1415
+ HIGH: [
1416
+ "OMC_MODEL_HIGH",
1417
+ "CLAUDE_CODE_BEDROCK_OPUS_MODEL",
1418
+ "ANTHROPIC_DEFAULT_OPUS_MODEL"
1419
+ ]
1420
+ };
1421
+ var COPILOT_FAMILY_DEFAULTS = {
1422
+ HAIKU: "claude-haiku-4-5",
1423
+ SONNET: "claude-sonnet-5",
1424
+ OPUS: "claude-opus-4-8",
1425
+ FABLE: "claude-fable-5"
1426
+ };
1427
+ var BUILTIN_TIER_MODEL_DEFAULTS = {
1428
+ LOW: COPILOT_FAMILY_DEFAULTS.HAIKU,
1429
+ MEDIUM: COPILOT_FAMILY_DEFAULTS.SONNET,
1430
+ HIGH: COPILOT_FAMILY_DEFAULTS.OPUS
1431
+ };
1432
+ var CLAUDE_FAMILY_HIGH_VARIANTS = {
1433
+ HAIKU: `${COPILOT_FAMILY_DEFAULTS.HAIKU}-high`,
1434
+ SONNET: `${COPILOT_FAMILY_DEFAULTS.SONNET}-high`,
1435
+ OPUS: `${COPILOT_FAMILY_DEFAULTS.OPUS}-high`,
1436
+ FABLE: `${COPILOT_FAMILY_DEFAULTS.FABLE}-high`
1437
+ };
1438
+ var BUILTIN_EXTERNAL_MODEL_DEFAULTS = {
1439
+ codexModel: "gpt-5.3-codex",
1440
+ geminiModel: "gemini-3.1-pro-preview",
1441
+ antigravityModel: "Gemini 3.1 Pro (High)"
1442
+ };
1443
+ function readEnvValue(key) {
1444
+ const value = process.env[key]?.trim();
1445
+ return value || void 0;
1446
+ }
1447
+ function resolveTierModelFromEnv(tier) {
1448
+ for (const key of TIER_ENV_KEYS[tier]) {
1449
+ const value = readEnvValue(key);
1450
+ if (value) {
1451
+ return value;
1452
+ }
1453
+ }
1454
+ return void 0;
1455
+ }
1456
+ function getDefaultModelHigh() {
1457
+ return resolveTierModelFromEnv("HIGH") || BUILTIN_TIER_MODEL_DEFAULTS.HIGH;
1458
+ }
1459
+ function getDefaultModelMedium() {
1460
+ return resolveTierModelFromEnv("MEDIUM") || BUILTIN_TIER_MODEL_DEFAULTS.MEDIUM;
1461
+ }
1462
+ function getDefaultModelLow() {
1463
+ return resolveTierModelFromEnv("LOW") || BUILTIN_TIER_MODEL_DEFAULTS.LOW;
1464
+ }
1465
+ function getDefaultTierModels() {
1466
+ return {
1467
+ LOW: getDefaultModelLow(),
1468
+ MEDIUM: getDefaultModelMedium(),
1469
+ HIGH: getDefaultModelHigh()
1470
+ };
1471
+ }
1472
+ function getBuiltinExternalDefaultModel(provider) {
1473
+ if (provider === "codex") return BUILTIN_EXTERNAL_MODEL_DEFAULTS.codexModel;
1474
+ if (provider === "antigravity") return BUILTIN_EXTERNAL_MODEL_DEFAULTS.antigravityModel;
1475
+ return BUILTIN_EXTERNAL_MODEL_DEFAULTS.geminiModel;
1476
+ }
1477
+
1478
+ // src/config/loader.ts
1479
+ function buildDefaultConfig() {
1480
+ const defaultTierModels = getDefaultTierModels();
1481
+ return {
1482
+ agents: {
1483
+ omc: { model: defaultTierModels.HIGH },
1484
+ explore: { model: defaultTierModels.LOW },
1485
+ analyst: { model: defaultTierModels.HIGH },
1486
+ planner: { model: defaultTierModels.HIGH },
1487
+ architect: { model: defaultTierModels.HIGH },
1488
+ debugger: { model: defaultTierModels.MEDIUM },
1489
+ executor: { model: defaultTierModels.MEDIUM },
1490
+ verifier: { model: defaultTierModels.MEDIUM },
1491
+ securityReviewer: { model: defaultTierModels.MEDIUM },
1492
+ codeReviewer: { model: defaultTierModels.HIGH },
1493
+ testEngineer: { model: defaultTierModels.MEDIUM },
1494
+ designer: { model: defaultTierModels.MEDIUM },
1495
+ writer: { model: defaultTierModels.LOW },
1496
+ qaTester: { model: defaultTierModels.MEDIUM },
1497
+ scientist: { model: defaultTierModels.MEDIUM },
1498
+ tracer: { model: defaultTierModels.MEDIUM },
1499
+ gitMaster: { model: defaultTierModels.MEDIUM },
1500
+ codeSimplifier: { model: defaultTierModels.HIGH },
1501
+ critic: { model: defaultTierModels.HIGH },
1502
+ documentSpecialist: { model: defaultTierModels.MEDIUM }
1503
+ },
1504
+ features: {
1505
+ parallelExecution: true,
1506
+ lspTools: true,
1507
+ // Real LSP integration with language servers
1508
+ astTools: true,
1509
+ // Real AST tools using ast-grep
1510
+ continuationEnforcement: true,
1511
+ autoContextInjection: true
1512
+ },
1513
+ mcpServers: {
1514
+ exa: { enabled: true },
1515
+ context7: { enabled: true }
1516
+ },
1517
+ companyContext: {
1518
+ onError: "warn"
1519
+ },
1520
+ permissions: {
1521
+ allowBash: true,
1522
+ allowEdit: true,
1523
+ allowWrite: true,
1524
+ maxBackgroundTasks: 5,
1525
+ workerDenyTools: [],
1526
+ workerDenyUrls: []
1527
+ },
1528
+ magicKeywords: {
1529
+ search: ["search", "find", "locate"],
1530
+ analyze: ["analyze", "investigate", "examine"],
1531
+ ultrathink: ["ultrathink", "think", "reason", "ponder"]
1532
+ },
1533
+ // Intelligent model routing configuration
1534
+ routing: {
1535
+ enabled: true,
1536
+ defaultTier: "MEDIUM",
1537
+ forceInherit: false,
1538
+ escalationEnabled: true,
1539
+ maxEscalations: 2,
1540
+ tierModels: { ...defaultTierModels },
1541
+ agentOverrides: {
1542
+ architect: {
1543
+ tier: "HIGH",
1544
+ reason: "Advisory agent requires deep reasoning"
1545
+ },
1546
+ planner: {
1547
+ tier: "HIGH",
1548
+ reason: "Strategic planning requires deep reasoning"
1549
+ },
1550
+ critic: {
1551
+ tier: "HIGH",
1552
+ reason: "Critical review requires deep reasoning"
1553
+ },
1554
+ analyst: {
1555
+ tier: "HIGH",
1556
+ reason: "Pre-planning analysis requires deep reasoning"
1557
+ },
1558
+ explore: { tier: "LOW", reason: "Exploration is search-focused" },
1559
+ writer: { tier: "LOW", reason: "Documentation is straightforward" }
1560
+ },
1561
+ escalationKeywords: [
1562
+ "critical",
1563
+ "production",
1564
+ "urgent",
1565
+ "security",
1566
+ "breaking",
1567
+ "architecture",
1568
+ "refactor",
1569
+ "redesign",
1570
+ "root cause"
1571
+ ],
1572
+ simplificationKeywords: [
1573
+ "find",
1574
+ "list",
1575
+ "show",
1576
+ "where",
1577
+ "search",
1578
+ "locate",
1579
+ "grep"
1580
+ ]
1581
+ },
1582
+ // External models configuration (Codex, Gemini)
1583
+ // Static defaults only — env var overrides applied in loadEnvConfig()
1584
+ externalModels: {
1585
+ defaults: {
1586
+ codexModel: BUILTIN_EXTERNAL_MODEL_DEFAULTS.codexModel,
1587
+ geminiModel: BUILTIN_EXTERNAL_MODEL_DEFAULTS.geminiModel,
1588
+ antigravityModel: BUILTIN_EXTERNAL_MODEL_DEFAULTS.antigravityModel
1589
+ },
1590
+ fallbackPolicy: {
1591
+ onModelFailure: "provider_chain",
1592
+ allowCrossProvider: false,
1593
+ crossProviderOrder: ["codex", "gemini"]
1594
+ }
1595
+ },
1596
+ // Delegation routing configuration (opt-in feature for external model routing)
1597
+ delegationRouting: {
1598
+ enabled: false,
1599
+ defaultProvider: "claude",
1600
+ roles: {}
1601
+ },
1602
+ // /team role routing (Option E — /team-scoped per-role provider & model)
1603
+ // Empty defaults: zero behavior change until user opts in.
1604
+ team: {
1605
+ ops: {},
1606
+ roleRouting: {}
1607
+ },
1608
+ autopilot: {
1609
+ execution: "solo"
1610
+ },
1611
+ planOutput: {
1612
+ directory: ".omg/plans",
1613
+ filenameTemplate: "{{name}}.md"
1614
+ },
1615
+ teleport: {
1616
+ symlinkNodeModules: true
1617
+ },
1618
+ startupCodebaseMap: {
1619
+ enabled: true,
1620
+ maxFiles: 200,
1621
+ maxDepth: 4
1622
+ },
1623
+ taskSizeDetection: {
1624
+ enabled: true,
1625
+ smallWordLimit: 50,
1626
+ largeWordLimit: 200,
1627
+ suppressHeavyModesForSmallTasks: true
1628
+ },
1629
+ promptPrerequisites: {
1630
+ enabled: true,
1631
+ sectionNames: {
1632
+ memory: ["M\xC9MOIRE", "MEMOIRE", "MEMORY"],
1633
+ skills: ["SKILLS"],
1634
+ verifyFirst: ["VERIFY-FIRST", "VERIFY FIRST", "VERIFY_FIRST"],
1635
+ context: ["CONTEXT"]
1636
+ },
1637
+ blockingTools: ["Edit", "MultiEdit", "Write", "Agent", "Task"],
1638
+ executionKeywords: ["ralph", "autopilot"]
1639
+ }
1640
+ };
1641
+ }
1642
+ var DEFAULT_CONFIG = buildDefaultConfig();
1643
+ var CANONICAL_TEAM_ROLE_SET = new Set(CANONICAL_TEAM_ROLES);
1644
+ var KNOWN_AGENT_NAME_SET = new Set(KNOWN_AGENT_NAMES);
1645
+
1646
+ // src/utils/strict-mode.ts
1647
+ var import_fs8 = require("fs");
1648
+ var import_path9 = require("path");
1649
+ init_config_dir();
1650
+
1651
+ // src/agents/architect.ts
1652
+ var ARCHITECT_PROMPT_METADATA = {
1653
+ category: "advisor",
1654
+ cost: "EXPENSIVE",
1655
+ promptAlias: "architect",
1656
+ triggers: [
1657
+ { domain: "Architecture decisions", trigger: "Multi-system tradeoffs, unfamiliar patterns" },
1658
+ { domain: "Self-review", trigger: "After completing significant implementation" },
1659
+ { domain: "Hard debugging", trigger: "After 2+ failed fix attempts" }
1660
+ ],
1661
+ useWhen: [
1662
+ "Complex architecture design",
1663
+ "After completing significant work",
1664
+ "2+ failed fix attempts",
1665
+ "Unfamiliar code patterns",
1666
+ "Security/performance concerns",
1667
+ "Multi-system tradeoffs"
1668
+ ],
1669
+ avoidWhen: [
1670
+ "Simple file operations (use direct tools)",
1671
+ "First attempt at any fix (try yourself first)",
1672
+ "Questions answerable from code you've read",
1673
+ "Trivial decisions (variable names, formatting)",
1674
+ "Things you can infer from existing code patterns"
1675
+ ]
1676
+ };
1677
+ var architectAgent = {
1678
+ name: "architect",
1679
+ description: "Read-only consultation agent. High-IQ reasoning specialist for debugging hard problems and high-difficulty architecture design.",
1680
+ prompt: loadAgentPrompt("architect"),
1681
+ model: "opus",
1682
+ defaultModel: "opus",
1683
+ metadata: ARCHITECT_PROMPT_METADATA
1684
+ };
1685
+
1686
+ // src/agents/designer.ts
1687
+ var FRONTEND_ENGINEER_PROMPT_METADATA = {
1688
+ category: "specialist",
1689
+ cost: "CHEAP",
1690
+ promptAlias: "designer",
1691
+ triggers: [
1692
+ {
1693
+ domain: "UI/UX",
1694
+ trigger: "Visual changes, styling, components, accessibility"
1695
+ },
1696
+ {
1697
+ domain: "Design",
1698
+ trigger: "Layout, animations, responsive design"
1699
+ }
1700
+ ],
1701
+ useWhen: [
1702
+ "Visual styling or layout changes",
1703
+ "Component design or refactoring",
1704
+ "Animation implementation",
1705
+ "Accessibility improvements",
1706
+ "Responsive design work"
1707
+ ],
1708
+ avoidWhen: [
1709
+ "Pure logic changes in frontend files",
1710
+ "Backend/API work",
1711
+ "Non-visual refactoring"
1712
+ ]
1713
+ };
1714
+ var designerAgent = {
1715
+ name: "designer",
1716
+ description: `Designer-turned-developer who crafts stunning UI/UX even without design mockups. Use for VISUAL changes only (styling, layout, animation). Pure logic changes in frontend files should be handled directly.`,
1717
+ prompt: loadAgentPrompt("designer"),
1718
+ model: "sonnet",
1719
+ defaultModel: "sonnet",
1720
+ metadata: FRONTEND_ENGINEER_PROMPT_METADATA
1721
+ };
1722
+
1723
+ // src/agents/writer.ts
1724
+ var DOCUMENT_WRITER_PROMPT_METADATA = {
1725
+ category: "specialist",
1726
+ cost: "FREE",
1727
+ promptAlias: "writer",
1728
+ triggers: [
1729
+ {
1730
+ domain: "Documentation",
1731
+ trigger: "README, API docs, guides, comments"
1732
+ }
1733
+ ],
1734
+ useWhen: [
1735
+ "Creating or updating README files",
1736
+ "Writing API documentation",
1737
+ "Creating user guides or tutorials",
1738
+ "Adding code comments or JSDoc",
1739
+ "Architecture documentation"
1740
+ ],
1741
+ avoidWhen: [
1742
+ "Code implementation tasks",
1743
+ "Bug fixes",
1744
+ "Non-documentation tasks"
1745
+ ]
1746
+ };
1747
+ var writerAgent = {
1748
+ name: "writer",
1749
+ description: `Technical writer who crafts clear, comprehensive documentation. Specializes in README files, API docs, architecture docs, and user guides.`,
1750
+ prompt: loadAgentPrompt("writer"),
1751
+ model: "haiku",
1752
+ defaultModel: "haiku",
1753
+ metadata: DOCUMENT_WRITER_PROMPT_METADATA
1754
+ };
1755
+
1756
+ // src/agents/critic.ts
1757
+ var CRITIC_PROMPT_METADATA = {
1758
+ category: "reviewer",
1759
+ cost: "EXPENSIVE",
1760
+ promptAlias: "critic",
1761
+ triggers: [
1762
+ {
1763
+ domain: "Plan Review",
1764
+ trigger: "Evaluating work plans before execution"
1765
+ }
1766
+ ],
1767
+ useWhen: [
1768
+ "After planner creates a work plan",
1769
+ "Before executing a complex plan",
1770
+ "When plan quality validation is needed",
1771
+ "To catch gaps before implementation"
1772
+ ],
1773
+ avoidWhen: [
1774
+ "Simple, straightforward tasks",
1775
+ "When no plan exists to review",
1776
+ "During implementation phase"
1777
+ ]
1778
+ };
1779
+ var criticAgent = {
1780
+ name: "critic",
1781
+ description: `Expert reviewer for evaluating work plans against rigorous clarity, verifiability, and completeness standards. Use after planner creates a work plan to validate it before execution.`,
1782
+ prompt: loadAgentPrompt("critic"),
1783
+ model: "opus",
1784
+ defaultModel: "opus",
1785
+ metadata: CRITIC_PROMPT_METADATA
1786
+ };
1787
+
1788
+ // src/agents/analyst.ts
1789
+ var ANALYST_PROMPT_METADATA = {
1790
+ category: "planner",
1791
+ cost: "EXPENSIVE",
1792
+ promptAlias: "analyst",
1793
+ triggers: [
1794
+ {
1795
+ domain: "Pre-Planning",
1796
+ trigger: "Hidden requirements, edge cases, risk analysis"
1797
+ }
1798
+ ],
1799
+ useWhen: [
1800
+ "Before creating a work plan",
1801
+ "When requirements seem incomplete",
1802
+ "To identify hidden assumptions",
1803
+ "Risk analysis before implementation",
1804
+ "Scope validation"
1805
+ ],
1806
+ avoidWhen: [
1807
+ "Simple, well-defined tasks",
1808
+ "During implementation phase",
1809
+ "When plan already reviewed"
1810
+ ]
1811
+ };
1812
+ var analystAgent = {
1813
+ name: "analyst",
1814
+ description: `Pre-planning consultant that analyzes requests before implementation to identify hidden requirements, edge cases, and potential risks. Use before creating a work plan.`,
1815
+ prompt: loadAgentPrompt("analyst"),
1816
+ model: "opus",
1817
+ defaultModel: "opus",
1818
+ metadata: ANALYST_PROMPT_METADATA
1819
+ };
1820
+
1821
+ // src/agents/executor.ts
1822
+ var EXECUTOR_PROMPT_METADATA = {
1823
+ category: "specialist",
1824
+ cost: "CHEAP",
1825
+ promptAlias: "Junior",
1826
+ triggers: [
1827
+ { domain: "Direct implementation", trigger: "Single-file changes, focused tasks" },
1828
+ { domain: "Bug fixes", trigger: "Clear, scoped fixes" },
1829
+ { domain: "Small features", trigger: "Well-defined, isolated work" }
1830
+ ],
1831
+ useWhen: [
1832
+ "Direct, focused implementation tasks",
1833
+ "Single-file or few-file changes",
1834
+ "When delegation overhead isn't worth it",
1835
+ "Clear, well-scoped work items"
1836
+ ],
1837
+ avoidWhen: [
1838
+ "Multi-file refactoring (use orchestrator)",
1839
+ "Tasks requiring research (use explore/document-specialist first)",
1840
+ "Complex decisions (consult architect)"
1841
+ ]
1842
+ };
1843
+ var executorAgent = {
1844
+ name: "executor",
1845
+ description: "Focused task executor. Execute tasks directly. NEVER delegate or spawn other agents. Same discipline as OMC, no delegation.",
1846
+ prompt: loadAgentPrompt("executor"),
1847
+ model: "sonnet",
1848
+ defaultModel: "sonnet",
1849
+ metadata: EXECUTOR_PROMPT_METADATA
1850
+ };
1851
+
1852
+ // src/agents/planner.ts
1853
+ var PLANNER_PROMPT_METADATA = {
1854
+ category: "planner",
1855
+ cost: "EXPENSIVE",
1856
+ promptAlias: "planner",
1857
+ triggers: [
1858
+ {
1859
+ domain: "Strategic Planning",
1860
+ trigger: "Comprehensive work plans, interview-style consultation"
1861
+ }
1862
+ ],
1863
+ useWhen: [
1864
+ "Complex features requiring planning",
1865
+ "When requirements need clarification through interview",
1866
+ "Creating comprehensive work plans",
1867
+ "Before large implementation efforts"
1868
+ ],
1869
+ avoidWhen: [
1870
+ "Simple, straightforward tasks",
1871
+ "When implementation should just start",
1872
+ "When a plan already exists"
1873
+ ]
1874
+ };
1875
+ var plannerAgent = {
1876
+ name: "planner",
1877
+ description: `Strategic planning consultant. Interviews users to understand requirements, then creates comprehensive work plans. NEVER implements - only plans.`,
1878
+ prompt: loadAgentPrompt("planner"),
1879
+ model: "opus",
1880
+ defaultModel: "opus",
1881
+ metadata: PLANNER_PROMPT_METADATA
1882
+ };
1883
+
1884
+ // src/agents/qa-tester.ts
1885
+ var QA_TESTER_PROMPT_METADATA = {
1886
+ category: "specialist",
1887
+ cost: "CHEAP",
1888
+ promptAlias: "QATester",
1889
+ triggers: [
1890
+ { domain: "CLI testing", trigger: "Testing command-line applications" },
1891
+ { domain: "Service testing", trigger: "Starting and testing background services" },
1892
+ { domain: "Integration testing", trigger: "End-to-end CLI workflow verification" },
1893
+ { domain: "Interactive testing", trigger: "Testing applications requiring user input" }
1894
+ ],
1895
+ useWhen: [
1896
+ "Testing CLI applications that need interactive input",
1897
+ "Starting background services and verifying their behavior",
1898
+ "Running end-to-end tests on command-line tools",
1899
+ "Testing applications that produce streaming output",
1900
+ "Verifying service startup and shutdown behavior"
1901
+ ],
1902
+ avoidWhen: [
1903
+ "Unit testing (use standard test runners)",
1904
+ "API testing without CLI interface (use curl/httpie directly)",
1905
+ "Static code analysis (use architect or explore)"
1906
+ ]
1907
+ };
1908
+ var qaTesterAgent = {
1909
+ name: "qa-tester",
1910
+ description: "Interactive CLI testing specialist using tmux. Tests CLI applications, background services, and interactive tools. Manages test sessions, sends commands, verifies output, and ensures cleanup.",
1911
+ prompt: loadAgentPrompt("qa-tester"),
1912
+ model: "sonnet",
1913
+ defaultModel: "sonnet",
1914
+ metadata: QA_TESTER_PROMPT_METADATA
1915
+ };
1916
+
1917
+ // src/agents/scientist.ts
1918
+ var SCIENTIST_PROMPT_METADATA = {
1919
+ category: "specialist",
1920
+ cost: "CHEAP",
1921
+ promptAlias: "scientist",
1922
+ triggers: [
1923
+ { domain: "Data analysis", trigger: "Analyzing in-memory data and computing statistics" },
1924
+ { domain: "Research execution", trigger: "Running data experiments and generating findings" },
1925
+ { domain: "Python data work", trigger: "Computing statistics on in-memory data with built-in functions" },
1926
+ { domain: "EDA", trigger: "Exploratory data analysis on in-memory data" },
1927
+ { domain: "Hypothesis testing", trigger: "Statistical comparisons with built-in functions on in-memory data" },
1928
+ { domain: "Research stages", trigger: "Multi-stage analysis with structured markers" }
1929
+ ],
1930
+ useWhen: [
1931
+ "Analyzing in-memory data supplied in the task",
1932
+ "Computing descriptive statistics or aggregations with Python built-ins",
1933
+ "Performing exploratory data analysis (EDA) on in-memory data",
1934
+ "Generating data-driven findings and insights",
1935
+ "In-memory data transformations",
1936
+ "Hypothesis testing with statistical evidence markers",
1937
+ "Research stages with [STAGE:*] markers for orchestration"
1938
+ ],
1939
+ avoidWhen: [
1940
+ "Researching external documentation or APIs (use document-specialist)",
1941
+ "Implementing production code features (use executor)",
1942
+ "Architecture or system design questions (use architect)",
1943
+ "Reading files, importing third-party libraries, or plotting (imports, file I/O, and third-party packages are blocked in the python_repl sandbox)",
1944
+ "Web scraping or external data fetching (use document-specialist)"
1945
+ ]
1946
+ };
1947
+ var scientistAgent = {
1948
+ name: "scientist",
1949
+ description: "Data analysis and research execution specialist. Executes sandboxed Python code for statistical analysis and generating data-driven findings using built-in functions on in-memory data.",
1950
+ prompt: loadAgentPrompt("scientist"),
1951
+ model: "sonnet",
1952
+ defaultModel: "sonnet",
1953
+ metadata: SCIENTIST_PROMPT_METADATA
1954
+ };
1955
+
1956
+ // src/agents/explore.ts
1957
+ var EXPLORE_PROMPT_METADATA = {
1958
+ category: "exploration",
1959
+ cost: "CHEAP",
1960
+ promptAlias: "Explore",
1961
+ triggers: [
1962
+ { domain: "Internal codebase search", trigger: "Finding implementations, patterns, files" },
1963
+ { domain: "Project structure", trigger: "Understanding code organization" },
1964
+ { domain: "Code discovery", trigger: "Locating specific code by pattern" }
1965
+ ],
1966
+ useWhen: [
1967
+ "Finding files by pattern or name",
1968
+ "Searching for implementations in current project",
1969
+ "Understanding project structure",
1970
+ "Locating code by content or pattern",
1971
+ "Quick codebase exploration"
1972
+ ],
1973
+ avoidWhen: [
1974
+ "External documentation, literature, or academic paper lookup (use document-specialist)",
1975
+ "Database/reference/manual lookups outside the current project (use document-specialist)",
1976
+ "GitHub/npm package research (use document-specialist)",
1977
+ "Complex architectural analysis (use architect)",
1978
+ "When you already know the file location"
1979
+ ]
1980
+ };
1981
+ var exploreAgent = {
1982
+ name: "explore",
1983
+ description: "Fast codebase exploration and pattern search. Use for finding files, understanding structure, locating implementations. Searches INTERNAL codebase only; external docs, literature, papers, and reference databases belong to document-specialist.",
1984
+ prompt: loadAgentPrompt("explore"),
1985
+ model: "haiku",
1986
+ defaultModel: "haiku",
1987
+ metadata: EXPLORE_PROMPT_METADATA
1988
+ };
1989
+
1990
+ // src/agents/tracer.ts
1991
+ var TRACER_PROMPT_METADATA = {
1992
+ category: "advisor",
1993
+ cost: "EXPENSIVE",
1994
+ promptAlias: "tracer",
1995
+ triggers: [
1996
+ { domain: "Causal tracing", trigger: "Why did this happen? Which explanation best fits the evidence?" },
1997
+ { domain: "Forensic analysis", trigger: "Observed output, artifact, or behavior needs ranked explanations" },
1998
+ { domain: "Evidence-driven uncertainty reduction", trigger: "Need competing hypotheses and the next best probe" }
1999
+ ],
2000
+ useWhen: [
2001
+ "Tracing ambiguous runtime behavior, regressions, or orchestration outcomes",
2002
+ "Ranking competing explanations for an observed result",
2003
+ "Separating observation, evidence, and inference",
2004
+ "Explaining performance, architecture, scientific, or configuration outcomes",
2005
+ "Identifying the next probe that would collapse uncertainty fastest"
2006
+ ],
2007
+ avoidWhen: [
2008
+ "The task is pure implementation or fixing (use executor/debugger)",
2009
+ "The task is a generic summary without causal analysis",
2010
+ "A single-file code search is enough (use explore)",
2011
+ "You already have decisive evidence and only need execution"
2012
+ ]
2013
+ };
2014
+ var tracerAgent = {
2015
+ name: "tracer",
2016
+ description: "Evidence-driven causal tracing specialist. Explains observed outcomes using competing hypotheses, evidence for and against, uncertainty tracking, and next-probe recommendations.",
2017
+ prompt: loadAgentPrompt("tracer"),
2018
+ model: "sonnet",
2019
+ defaultModel: "sonnet",
2020
+ metadata: TRACER_PROMPT_METADATA
2021
+ };
2022
+
2023
+ // src/agents/document-specialist.ts
2024
+ var DOCUMENT_SPECIALIST_PROMPT_METADATA = {
2025
+ category: "exploration",
2026
+ cost: "CHEAP",
2027
+ promptAlias: "document-specialist",
2028
+ triggers: [
2029
+ {
2030
+ domain: "Project documentation",
2031
+ trigger: "README, docs/, migration guides, local references"
2032
+ },
2033
+ {
2034
+ domain: "External documentation",
2035
+ trigger: "API references, official docs"
2036
+ },
2037
+ {
2038
+ domain: "API/framework correctness",
2039
+ trigger: "Context Hub / chub first when available; curated backend fallback otherwise"
2040
+ },
2041
+ {
2042
+ domain: "OSS implementations",
2043
+ trigger: "GitHub examples, package source"
2044
+ },
2045
+ {
2046
+ domain: "Best practices",
2047
+ trigger: "Community patterns, recommendations"
2048
+ },
2049
+ {
2050
+ domain: "Literature and reference research",
2051
+ trigger: "Academic papers, manuals, reference databases"
2052
+ }
2053
+ ],
2054
+ useWhen: [
2055
+ "Checking README/docs/local reference files before broader research",
2056
+ "Looking up official documentation",
2057
+ "Using Context Hub / chub (or another curated docs backend) for external API/framework correctness when available",
2058
+ "Finding GitHub examples",
2059
+ "Researching npm/pip packages",
2060
+ "Stack Overflow solutions",
2061
+ "External API references",
2062
+ "Searching external literature or academic papers",
2063
+ "Looking up manuals, databases, or reference material outside the current project"
2064
+ ],
2065
+ avoidWhen: [
2066
+ "Internal codebase implementation search (use explore)",
2067
+ "Current project source files when the task is code discovery rather than documentation lookup (use explore)",
2068
+ "When you already have the information"
2069
+ ]
2070
+ };
2071
+ var documentSpecialistAgent = {
2072
+ name: "document-specialist",
2073
+ description: "Document Specialist for documentation research and reference finding. Use for local repo docs, official docs, Context Hub / chub or other curated docs backends for API/framework correctness, GitHub examples, OSS implementations, external literature, academic papers, and reference/database lookups. Avoid internal implementation search; use explore for code discovery.",
2074
+ prompt: loadAgentPrompt("document-specialist"),
2075
+ model: "sonnet",
2076
+ defaultModel: "sonnet",
2077
+ metadata: DOCUMENT_SPECIALIST_PROMPT_METADATA
2078
+ };
2079
+
2080
+ // src/agents/definitions.ts
2081
+ var debuggerAgent = {
2082
+ name: "debugger",
2083
+ description: "Root-cause analysis, regression isolation, failure diagnosis (Sonnet).",
2084
+ prompt: loadAgentPrompt("debugger"),
2085
+ model: "sonnet",
2086
+ defaultModel: "sonnet"
2087
+ };
2088
+ var verifierAgent = {
2089
+ name: "verifier",
2090
+ description: "Completion evidence, claim validation, test adequacy (Sonnet).",
2091
+ prompt: loadAgentPrompt("verifier"),
2092
+ model: "sonnet",
2093
+ defaultModel: "sonnet"
2094
+ };
2095
+ var testEngineerAgent = {
2096
+ name: "test-engineer",
2097
+ description: "Test strategy, coverage, flaky test hardening (Sonnet).",
2098
+ prompt: loadAgentPrompt("test-engineer"),
2099
+ model: "sonnet",
2100
+ defaultModel: "sonnet"
2101
+ };
2102
+ var securityReviewerAgent = {
2103
+ name: "security-reviewer",
2104
+ description: "Security vulnerability detection specialist (Sonnet). Use for security audits and OWASP detection.",
2105
+ prompt: loadAgentPrompt("security-reviewer"),
2106
+ model: "sonnet",
2107
+ defaultModel: "sonnet"
2108
+ };
2109
+ var codeReviewerAgent = {
2110
+ name: "code-reviewer",
2111
+ description: "Expert code review specialist (Opus). Use for comprehensive code quality review.",
2112
+ prompt: loadAgentPrompt("code-reviewer"),
2113
+ model: "opus",
2114
+ defaultModel: "opus"
2115
+ };
2116
+ var gitMasterAgent = {
2117
+ name: "git-master",
2118
+ description: "Git expert for atomic commits, rebasing, and history management with style detection",
2119
+ prompt: loadAgentPrompt("git-master"),
2120
+ model: "sonnet",
2121
+ defaultModel: "sonnet"
2122
+ };
2123
+ var codeSimplifierAgent = {
2124
+ name: "code-simplifier",
2125
+ description: "Simplifies and refines code for clarity, consistency, and maintainability (Opus).",
2126
+ prompt: loadAgentPrompt("code-simplifier"),
2127
+ model: "opus",
2128
+ defaultModel: "opus"
2129
+ };
2130
+ var devilsAdvocateAgent = {
2131
+ name: "devils-advocate",
2132
+ description: "Independent pre-push critique \u2014 finds flaws in unpushed commits with adversarial skepticism (Opus).",
2133
+ prompt: loadAgentPrompt("devils-advocate"),
2134
+ model: "opus",
2135
+ defaultModel: "opus"
2136
+ };
2137
+
2138
+ // src/features/builtin-skills/skills.ts
2139
+ var import_fs10 = require("fs");
2140
+ var import_path11 = require("path");
2141
+ var import_url3 = require("url");
2142
+
2143
+ // src/utils/omc-cli-rendering.ts
2144
+ var import_child_process3 = require("child_process");
2145
+
2146
+ // src/utils/skill-resources.ts
2147
+ var import_fs9 = require("fs");
2148
+ var import_path10 = require("path");
2149
+
2150
+ // src/features/builtin-skills/skills.ts
2151
+ init_config_dir();
2152
+
2153
+ // src/config/builtin-skill-entitlements.json
2154
+ var builtin_skill_entitlements_default = {
2155
+ schemaVersion: 1,
2156
+ skininthegamebrosOnlySkills: []
2157
+ };
2158
+
2159
+ // src/features/builtin-skills/skills.ts
2160
+ function getPackageDir2() {
2161
+ if (typeof __dirname !== "undefined" && __dirname) {
2162
+ const currentDirName = (0, import_path11.basename)(__dirname);
2163
+ const parentDirName = (0, import_path11.basename)((0, import_path11.dirname)(__dirname));
2164
+ const grandparentDirName = (0, import_path11.basename)((0, import_path11.dirname)((0, import_path11.dirname)(__dirname)));
2165
+ if (currentDirName === "bridge") {
2166
+ return (0, import_path11.join)(__dirname, "..");
2167
+ }
2168
+ if (currentDirName === "builtin-skills" && parentDirName === "features" && (grandparentDirName === "src" || grandparentDirName === "dist")) {
2169
+ return (0, import_path11.join)(__dirname, "..", "..", "..");
674
2170
  }
675
- return centralizedPath;
676
- }
677
- const workspaceAnchor = findWorkspaceRoot(worktreeRoot);
678
- if (workspaceAnchor && !isSensitiveStateLocation(workspaceAnchor)) {
679
- return (0, import_path3.join)(workspaceAnchor, OmcPaths.ROOT);
680
2171
  }
681
- const root = resolveStateAnchorRoot(worktreeRoot);
682
- if (!getGitTopLevel(root)) {
683
- return (0, import_path3.join)(resolveNonGitStateAnchor(root), OmcPaths.ROOT);
2172
+ try {
2173
+ const __filename = (0, import_url3.fileURLToPath)(importMetaUrl);
2174
+ const __dirname2 = (0, import_path11.dirname)(__filename);
2175
+ return (0, import_path11.join)(__dirname2, "..", "..", "..");
2176
+ } catch {
2177
+ return process.cwd();
684
2178
  }
685
- return (0, import_path3.join)(root, OmcPaths.ROOT);
686
2179
  }
687
- function callerVisibleTrustedRootLabel(trustedRoot) {
688
- const label = (0, import_path3.basename)(trustedRoot);
689
- return label.length > 0 ? label : "current repository";
2180
+ var SKILLS_DIR = (0, import_path11.join)(getPackageDir2(), "skills");
2181
+ var SKININTHEGAMEBROS_ONLY_SKILLS = new Set(
2182
+ builtin_skill_entitlements_default.skininthegamebrosOnlySkills.map((skill) => skill.trim().toLowerCase())
2183
+ );
2184
+
2185
+ // src/hooks/jev/config.ts
2186
+ init_worktree_paths();
2187
+
2188
+ // src/hooks/keyword-detector/index.ts
2189
+ var KEYWORD_PRIORITY = [
2190
+ "cancel",
2191
+ "ralph",
2192
+ "autopilot",
2193
+ "team",
2194
+ "ralplan",
2195
+ "tdd",
2196
+ "code-review",
2197
+ "security-review",
2198
+ "ultrathink",
2199
+ "deepsearch",
2200
+ "analyze",
2201
+ "deep-interview",
2202
+ "codex",
2203
+ "gemini",
2204
+ "cursor",
2205
+ "antigravity"
2206
+ ];
2207
+ var CANONICAL_WORKFLOW_SLASH_SKILLS = [
2208
+ "autopilot",
2209
+ "ralph",
2210
+ "team",
2211
+ "ultraqa",
2212
+ "deep-interview",
2213
+ "ralplan",
2214
+ "self-improve"
2215
+ ];
2216
+ var WORKFLOW_SLASH_PATTERN = new RegExp(
2217
+ "^\\s*/(?:oh-my-copilot:|omc:)?(" + CANONICAL_WORKFLOW_SLASH_SKILLS.map((skill) => skill.replace(/-/g, "\\-")).join("|") + ")(?=\\s|$|[?!.,;:])",
2218
+ "i"
2219
+ );
2220
+ var PATH_SEGMENT_CHARS = "[\\w.\\-\\u3000-\\u9FFF\\uAC00-\\uD7AF\\u0400-\\u04FF\\u0600-\\u06FF\\u0900-\\u097F\\u0E00-\\u0E7F\\u1000-\\u109F]";
2221
+ var FILE_PATH_PATTERN = new RegExp(
2222
+ "(^|[\\s\"'`(])(?:\\/)?(?:" + PATH_SEGMENT_CHARS + "+\\/)+(?:" + PATH_SEGMENT_CHARS + "*\\.\\w+|[\\w.\\-]+)",
2223
+ "gm"
2224
+ );
2225
+
2226
+ // src/hooks/jev/points.ts
2227
+ function skillTriggerCriteria() {
2228
+ const priority = Array.isArray(KEYWORD_PRIORITY) ? KEYWORD_PRIORITY : [];
2229
+ return {
2230
+ ...Object.fromEntries(
2231
+ priority.filter((type) => type !== "team").slice(0, 12).map((type) => [type, `The prompt explicitly invokes the ${type} trigger.`])
2232
+ ),
2233
+ none: "No trigger fires; handle the prompt without a mode or skill."
2234
+ };
690
2235
  }
691
- function attachCanonicalWorkingDirectoryRoots(target, providedRoot, trustedRoot) {
692
- canonicalWorkingDirectoryRoots.set(target, { providedRoot, trustedRoot });
2236
+ function skillTriggerQuestions() {
2237
+ return {
2238
+ "skill-trigger": {
2239
+ type: "choice",
2240
+ instructions: "Which skill or mode should this user prompt trigger?",
2241
+ criteria: skillTriggerCriteria()
2242
+ }
2243
+ };
693
2244
  }
694
- function canonicalRootAliases(root) {
695
- if (root.length === 0) {
696
- return [];
697
- }
698
- const aliases = /* @__PURE__ */ new Set([root]);
699
- try {
700
- aliases.add((0, import_url.pathToFileURL)(root).href);
701
- } catch {
2245
+ var INTENT_QUESTIONS = {
2246
+ intent: {
2247
+ type: "noul",
2248
+ instructions: "Does this user prompt start an Intent-intake request (a non-engineer contributor stating a problem/goal/constraints to start the requirements intake flow)?",
2249
+ criteria: {
2250
+ true: "The prompt states a problem, goal, or constraints from a contributor and starts the Intent intake \u2014 a goal-level intent.md with problem/goal/users-and-systems/constraints/open-questions, not a solution design.",
2251
+ false: "Everything else: solution or engineering work, informational questions, or an existing workflow. Not an Intent-intake request."
2252
+ }
702
2253
  }
703
- try {
704
- const real = (0, import_fs2.realpathSync)(root);
705
- aliases.add(real);
706
- aliases.add((0, import_url.pathToFileURL)(real).href);
707
- } catch {
2254
+ };
2255
+ var NOUL_QUESTIONS = {
2256
+ task_complete: {
2257
+ type: "noul",
2258
+ instructions: "Is the task complete \u2014 is there no substantive work left for this mode?",
2259
+ criteria: {}
708
2260
  }
709
- if (import_path3.sep === "\\") {
710
- aliases.add(root.replaceAll("\\", "/"));
2261
+ };
2262
+ var SCORE_QUESTIONS = {
2263
+ iteration_progress: {
2264
+ type: "score",
2265
+ instructions: "How much substantive progress did the current iteration make?",
2266
+ criteria: {
2267
+ no_progress: "No progress",
2268
+ minor_progress: "Minor progress",
2269
+ moderate_progress: "Moderate progress",
2270
+ substantial_progress: "Substantial progress"
2271
+ }
711
2272
  }
712
- return [...aliases].sort((a, b) => b.length - a.length);
713
- }
714
- function redactCanonicalRoots(text, providedRoot, trustedRoot) {
715
- let redacted = text;
716
- const roots = [...canonicalRootAliases(providedRoot), ...canonicalRootAliases(trustedRoot)].sort((a, b) => b.length - a.length);
717
- for (const root of roots) {
718
- redacted = redacted.split(root).join("<redacted>");
2273
+ };
2274
+ var MODEL_ROUTING_QUESTIONS = {
2275
+ "model-tier": {
2276
+ type: "choice",
2277
+ instructions: "Which model tier should this delegated task use?",
2278
+ criteria: {
2279
+ haiku: "Quick lookups and lightweight, mechanical work",
2280
+ sonnet: "Standard coding and orchestration work",
2281
+ opus: "Complex architecture and deep analysis"
2282
+ }
719
2283
  }
720
- return redacted;
721
- }
722
- function redactErrorStack(stack, providedRoot, trustedRoot) {
723
- const newline = stack.includes("\r\n") ? "\r\n" : "\n";
724
- const lines = stack.split(/\r?\n/);
725
- if (lines.length <= 1) {
726
- return stack;
2284
+ };
2285
+ var STALENESS_QUESTIONS = {
2286
+ staleness: {
2287
+ type: "score",
2288
+ instructions: "How stale is this context candidate?",
2289
+ criteria: {
2290
+ fresh: "Fresh \u2014 keep",
2291
+ recent: "Recent",
2292
+ aging: "Aging",
2293
+ stale: "Stale \u2014 prune candidate"
2294
+ }
727
2295
  }
728
- const [header, ...frames] = lines;
729
- return [header, ...frames.map((frame) => redactCanonicalRoots(frame, providedRoot, trustedRoot))].join(newline);
730
- }
731
- var ForeignWorkingDirectoryError = class extends Error {
732
- callerLabel;
733
- constructor(providedRoot, trustedRoot, callerLabel) {
734
- super(
735
- `workingDirectory '${callerLabel}' belongs to a different repository than '${callerVisibleTrustedRootLabel(trustedRoot)}' and was not used. Cross-repository access is not permitted; pass a path inside the current repository or start the session there.`
736
- );
737
- this.name = "ForeignWorkingDirectoryError";
738
- this.callerLabel = callerLabel;
739
- attachCanonicalWorkingDirectoryRoots(this, providedRoot, trustedRoot);
740
- Object.defineProperty(this, "stack", {
741
- value: redactErrorStack(this.stack ?? `${this.name}: ${this.message}`, providedRoot, trustedRoot),
742
- enumerable: false,
743
- configurable: true,
744
- writable: true
745
- });
2296
+ };
2297
+ var VERDICT_QUESTIONS = {
2298
+ completion_criteria_met: {
2299
+ type: "noul",
2300
+ instructions: "Does the completion claim satisfy the PRD acceptance criteria for this mode?",
2301
+ criteria: {
2302
+ true: "All acceptance criteria are demonstrably satisfied by the evidence",
2303
+ false: "At least one criterion is unmet or evidence is missing"
2304
+ }
746
2305
  }
747
- toJSON() {
748
- return {
749
- name: this.name,
750
- message: this.message,
751
- callerLabel: this.callerLabel
752
- };
2306
+ };
2307
+ var TASK_SIZE_QUESTIONS = {
2308
+ "task-size": {
2309
+ type: "choice",
2310
+ instructions: "What size is this task \u2014 how much orchestration does it warrant?",
2311
+ criteria: {
2312
+ small: "Single-file or few-line change; run directly without heavy modes",
2313
+ medium: "Multi-file but single-area change; standard delegation",
2314
+ large: "Multi-area or architectural change; heavy orchestration (ralph/autopilot/team) is warranted"
2315
+ }
753
2316
  }
754
- [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
755
- return this.stack ?? `${this.name}: ${this.message}`;
2317
+ };
2318
+ var LEARNER_EXTRACTION_QUESTIONS = {
2319
+ extractable_moment: {
2320
+ type: "noul",
2321
+ instructions: "Does this assistant message contain an extractable memory-worthy moment?",
2322
+ criteria: {
2323
+ true: "Contains a reusable pattern, decision, or correction worth persisting",
2324
+ false: "Routine work with nothing worth extracting"
2325
+ }
756
2326
  }
757
2327
  };
758
-
759
- // src/team/task-file-ops.ts
760
- var import_fs9 = require("fs");
761
- var import_path9 = require("path");
762
-
763
- // src/team/tmux-session.ts
764
- var import_fs8 = require("fs");
765
- var import_crypto2 = require("crypto");
766
- var import_child_process5 = require("child_process");
767
- var import_util3 = require("util");
768
- var import_path8 = require("path");
769
- var import_promises = __toESM(require("fs/promises"), 1);
770
-
771
- // src/cli/tmux-utils.ts
772
- var import_child_process3 = require("child_process");
773
- var import_path5 = require("path");
774
- var import_util = require("util");
775
-
776
- // src/platform/executable-resolution.ts
777
- var import_fs3 = require("fs");
778
- var import_path4 = __toESM(require("path"), 1);
779
- var import_child_process2 = require("child_process");
780
- var RESOLVE_TIMEOUT_MS = 5e3;
781
- var SAFE_BINARY_NAME = /^[A-Za-z0-9._-]+$/;
782
- function platformModel(platform) {
783
- const isWindows = platform === "win32";
784
- return {
785
- isWindows,
786
- finder: isWindows ? "where.exe" : "which",
787
- pathFlavor: isWindows ? import_path4.default.win32 : import_path4.default.posix
788
- };
789
- }
790
- function asText(value) {
791
- if (typeof value === "string") return value;
792
- if (Buffer.isBuffer(value)) return value.toString("utf8");
793
- return value == null ? "" : String(value);
794
- }
795
- function isValidBinaryName(binary) {
796
- return typeof binary === "string" && SAFE_BINARY_NAME.test(binary);
797
- }
798
- function neutralFinderCwd(model) {
799
- if (!model.isWindows) return void 0;
800
- return process.env.SystemRoot || process.env.windir || "C:\\Windows";
801
- }
802
- function resolveCliPath(binary, model) {
803
- try {
804
- const finderCwd = neutralFinderCwd(model);
805
- const result = (0, import_child_process2.spawnSync)(model.finder, [binary], {
806
- timeout: RESOLVE_TIMEOUT_MS,
807
- encoding: "utf8",
808
- shell: false,
809
- windowsHide: true,
810
- ...finderCwd ? { cwd: finderCwd } : {}
811
- });
812
- if (result.error || result.signal || result.status !== 0) return void 0;
813
- const stdout = asText(result.stdout);
814
- for (const line of stdout.split(/\r\n|\n|\r/)) {
815
- const candidate = line.trim();
816
- if (candidate && model.pathFlavor.isAbsolute(candidate)) return candidate;
2328
+ var SLOP_WARNING_QUESTIONS = {
2329
+ slop_advisory: {
2330
+ type: "noul",
2331
+ instructions: "Does this tool input contain fallback/workaround language worth an advisory warning?",
2332
+ criteria: {
2333
+ true: "Contains fallback/workaround phrasing outside doc or self-referential context",
2334
+ false: "No advisory-worthy language"
817
2335
  }
818
- return void 0;
819
- } catch {
820
- return void 0;
821
2336
  }
822
- }
823
- function resolveExecutable(binary, platform = process.platform) {
824
- if (!isValidBinaryName(binary)) return void 0;
825
- return resolveCliPath(binary, platformModel(platform));
826
- }
827
-
828
- // src/cli/tmux-utils.ts
829
- function tmuxEnv() {
830
- const { TMUX: _, PSMUX_SESSION: __, ...env } = process.env;
831
- return env;
832
- }
833
- function resolveEnv(opts) {
834
- return opts?.stripTmux ? tmuxEnv() : process.env;
835
- }
836
- function quoteForCmd(arg) {
837
- if (arg.length === 0) return '""';
838
- if (!/[\s"%^&|<>()]/.test(arg)) return arg;
839
- return `"${arg.replace(/(["%])/g, "$1$1")}"`;
840
- }
841
- function resolveTmuxInvocation(args) {
842
- const resolvedBinary = resolveTmuxBinaryPath();
843
- if (process.platform === "win32" && /\.(cmd|bat)$/i.test(resolvedBinary)) {
844
- const comspec = process.env.COMSPEC || "cmd.exe";
845
- const commandLine = [quoteForCmd(resolvedBinary), ...args.map(quoteForCmd)].join(" ");
846
- return {
847
- command: comspec,
848
- args: ["/d", "/s", "/c", commandLine]
849
- };
2337
+ };
2338
+ var SIMPLIFIER_TRIGGER_QUESTIONS = {
2339
+ simplification_worthy: {
2340
+ type: "noul",
2341
+ instructions: "Is this change simplification-worthy enough to inject the simplifier delegation?",
2342
+ criteria: {
2343
+ true: "The change would benefit from a simplification pass (duplication, speculative flexibility, over-abstraction)",
2344
+ false: "Change is already minimal or not code"
2345
+ }
850
2346
  }
2347
+ };
2348
+ function defineJudgmentPoint(definition) {
851
2349
  return {
852
- command: resolvedBinary,
853
- args
2350
+ name: definition.name,
2351
+ questions: Array.isArray(definition.questions) ? definition.questions : [definition.questions],
2352
+ blocking: definition.blocking
854
2353
  };
855
2354
  }
856
- function tmuxExec(args, opts) {
857
- const { stripTmux: _, ...execOpts } = opts ?? {};
858
- const invocation = resolveTmuxInvocation(args);
859
- return (0, import_child_process3.execFileSync)(invocation.command, invocation.args, { encoding: "utf-8", ...execOpts, env: resolveEnv(opts) });
860
- }
861
- function resolveTmuxBinaryPath() {
862
- if (process.platform !== "win32") {
863
- return "tmux";
864
- }
865
- return resolveExecutable("tmux") ?? "tmux";
866
- }
2355
+ var JUDGMENT_POINTS = {
2356
+ intent: defineJudgmentPoint({ name: "intent", questions: INTENT_QUESTIONS, blocking: false }),
2357
+ "loop-continuation": defineJudgmentPoint({
2358
+ name: "loop-continuation",
2359
+ questions: [NOUL_QUESTIONS, SCORE_QUESTIONS],
2360
+ blocking: true
2361
+ }),
2362
+ "skill-trigger": defineJudgmentPoint({ name: "skill-trigger", questions: skillTriggerQuestions, blocking: false }),
2363
+ "model-routing": defineJudgmentPoint({ name: "model-routing", questions: MODEL_ROUTING_QUESTIONS, blocking: false }),
2364
+ "context-pruning": defineJudgmentPoint({ name: "context-pruning", questions: STALENESS_QUESTIONS, blocking: false }),
2365
+ "ralph-verdict": defineJudgmentPoint({ name: "ralph-verdict", questions: VERDICT_QUESTIONS, blocking: true }),
2366
+ "task-size": defineJudgmentPoint({ name: "task-size", questions: TASK_SIZE_QUESTIONS, blocking: false }),
2367
+ "learner-extraction": defineJudgmentPoint({
2368
+ name: "learner-extraction",
2369
+ questions: LEARNER_EXTRACTION_QUESTIONS,
2370
+ blocking: false
2371
+ }),
2372
+ "slop-warning": defineJudgmentPoint({ name: "slop-warning", questions: SLOP_WARNING_QUESTIONS, blocking: false }),
2373
+ "simplifier-trigger": defineJudgmentPoint({
2374
+ name: "simplifier-trigger",
2375
+ questions: SIMPLIFIER_TRIGGER_QUESTIONS,
2376
+ blocking: false
2377
+ })
2378
+ };
867
2379
 
868
- // src/platform/process-utils.ts
2380
+ // src/features/delegation-enforcer.ts
2381
+ var SKININTHEGAMEBROS_ONLY_SKILLS2 = new Set(
2382
+ builtin_skill_entitlements_default.skininthegamebrosOnlySkills.map((skill) => skill.trim().toLowerCase())
2383
+ );
2384
+
2385
+ // src/lib/security-config.ts
2386
+ var import_fs12 = require("fs");
2387
+ var import_path13 = require("path");
2388
+
2389
+ // src/team/psmux-adapter.ts
869
2390
  var import_child_process4 = require("child_process");
870
- var import_fs4 = require("fs");
2391
+ var import_promises2 = require("fs/promises");
2392
+ var import_os5 = require("os");
2393
+ var import_crypto3 = require("crypto");
2394
+ var import_path15 = require("path");
2395
+ var PSMUX_REGISTRY_DIR = import_path15.win32.join((0, import_os5.homedir)(), ".psmux");
2396
+ var PSMUX_NS_DIR = import_path15.win32.join(PSMUX_REGISTRY_DIR, "omg-ns");
2397
+
2398
+ // src/team/tmux-session.ts
2399
+ init_types2();
2400
+ init_team_owner_epoch();
2401
+
2402
+ // src/platform/process-utils.ts
2403
+ var import_child_process6 = require("child_process");
2404
+ var import_fs14 = require("fs");
871
2405
  var import_util2 = require("util");
872
2406
  var fsPromises = __toESM(require("fs/promises"), 1);
873
- var execFileAsync = (0, import_util2.promisify)(import_child_process4.execFile);
2407
+ var execFileAsync = (0, import_util2.promisify)(import_child_process6.execFile);
874
2408
  function isProcessAlive(pid) {
875
2409
  if (!Number.isInteger(pid) || pid <= 0) return false;
876
2410
  try {
@@ -884,27 +2418,9 @@ function isProcessAlive(pid) {
884
2418
  }
885
2419
  }
886
2420
 
887
- // src/team/state-paths.ts
888
- var import_path6 = require("path");
889
- function normalizeTaskFileStem(taskId) {
890
- const trimmed = String(taskId).trim().replace(/\.json$/i, "");
891
- if (/^task-\d+$/.test(trimmed)) return trimmed;
892
- if (/^\d+$/.test(trimmed)) return `task-${trimmed}`;
893
- return trimmed;
894
- }
895
- function getTaskStoragePath(cwd, teamName, taskId) {
896
- const tasksRoot = (0, import_path6.join)(getOmcRoot(cwd), "state", "team", teamName, "tasks");
897
- if (taskId !== void 0) {
898
- return (0, import_path6.join)(tasksRoot, normalizeTaskFileStem(taskId) + ".json");
899
- }
900
- return tasksRoot;
901
- }
902
- function getLegacyTaskStoragePath(claudeConfigDir, teamName, taskId) {
903
- if (taskId !== void 0) {
904
- return (0, import_path6.join)(claudeConfigDir, "tasks", teamName, `${taskId}.json`);
905
- }
906
- return (0, import_path6.join)(claudeConfigDir, "tasks", teamName);
907
- }
2421
+ // src/team/worker-launch-ack.ts
2422
+ init_types2();
2423
+ init_state_paths();
908
2424
 
909
2425
  // src/lib/atomic-write.ts
910
2426
  var fs = __toESM(require("fs/promises"), 1);
@@ -927,22 +2443,22 @@ function ensureDirSync(dir) {
927
2443
  var ATOMIC_BATCH_MAX_CONTENT_BYTES = 1024 * 1024;
928
2444
 
929
2445
  // src/lib/file-lock.ts
930
- var import_fs7 = require("fs");
2446
+ var import_fs17 = require("fs");
931
2447
  var path4 = __toESM(require("path"), 1);
932
2448
 
933
2449
  // src/platform/index.ts
934
2450
  var path3 = __toESM(require("path"), 1);
935
- var import_fs6 = require("fs");
2451
+ var import_fs16 = require("fs");
936
2452
 
937
2453
  // src/platform/posix-shell.ts
938
- var import_fs5 = require("fs");
939
- var import_path7 = require("path");
2454
+ var import_fs15 = require("fs");
2455
+ var import_path19 = require("path");
940
2456
  var WINDOWS_SHELL_INSTALL_SUFFIXES = [
941
- (0, import_path7.join)("Git", "bin", "bash.exe"),
942
- (0, import_path7.join)("Git", "usr", "bin", "bash.exe"),
943
- (0, import_path7.join)("msys64", "usr", "bin", "bash.exe"),
944
- (0, import_path7.join)("msys32", "usr", "bin", "bash.exe"),
945
- (0, import_path7.join)("cygwin64", "bin", "bash.exe")
2457
+ (0, import_path19.join)("Git", "bin", "bash.exe"),
2458
+ (0, import_path19.join)("Git", "usr", "bin", "bash.exe"),
2459
+ (0, import_path19.join)("msys64", "usr", "bin", "bash.exe"),
2460
+ (0, import_path19.join)("msys32", "usr", "bin", "bash.exe"),
2461
+ (0, import_path19.join)("cygwin64", "bin", "bash.exe")
946
2462
  ];
947
2463
 
948
2464
  // src/platform/index.ts
@@ -953,11 +2469,11 @@ var DEFAULT_STALE_LOCK_MS = 3e4;
953
2469
  var DEFAULT_RETRY_DELAY_MS = 50;
954
2470
  function isLockStale(lockPath, staleLockMs) {
955
2471
  try {
956
- const stat = (0, import_fs7.statSync)(lockPath);
2472
+ const stat = (0, import_fs17.statSync)(lockPath);
957
2473
  const ageMs = Date.now() - stat.mtimeMs;
958
2474
  if (ageMs < staleLockMs) return false;
959
2475
  try {
960
- const raw = (0, import_fs7.readFileSync)(lockPath, "utf-8");
2476
+ const raw = (0, import_fs17.readFileSync)(lockPath, "utf-8");
961
2477
  const payload = JSON.parse(raw);
962
2478
  if (payload.pid && isProcessAlive(payload.pid)) return false;
963
2479
  } catch {
@@ -970,21 +2486,21 @@ function isLockStale(lockPath, staleLockMs) {
970
2486
  function tryAcquireSync(lockPath, staleLockMs) {
971
2487
  ensureDirSync(path4.dirname(lockPath));
972
2488
  try {
973
- const fd = (0, import_fs7.openSync)(
2489
+ const fd = (0, import_fs17.openSync)(
974
2490
  lockPath,
975
- import_fs7.constants.O_CREAT | import_fs7.constants.O_EXCL | import_fs7.constants.O_WRONLY,
2491
+ import_fs17.constants.O_CREAT | import_fs17.constants.O_EXCL | import_fs17.constants.O_WRONLY,
976
2492
  384
977
2493
  );
978
2494
  try {
979
2495
  const payload = JSON.stringify({ pid: process.pid, timestamp: Date.now() });
980
- (0, import_fs7.writeSync)(fd, payload, null, "utf-8");
2496
+ (0, import_fs17.writeSync)(fd, payload, null, "utf-8");
981
2497
  } catch (writeErr) {
982
2498
  try {
983
- (0, import_fs7.closeSync)(fd);
2499
+ (0, import_fs17.closeSync)(fd);
984
2500
  } catch {
985
2501
  }
986
2502
  try {
987
- (0, import_fs7.unlinkSync)(lockPath);
2503
+ (0, import_fs17.unlinkSync)(lockPath);
988
2504
  } catch {
989
2505
  }
990
2506
  throw writeErr;
@@ -994,25 +2510,25 @@ function tryAcquireSync(lockPath, staleLockMs) {
994
2510
  if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
995
2511
  if (isLockStale(lockPath, staleLockMs)) {
996
2512
  try {
997
- (0, import_fs7.unlinkSync)(lockPath);
2513
+ (0, import_fs17.unlinkSync)(lockPath);
998
2514
  } catch {
999
2515
  }
1000
2516
  try {
1001
- const fd = (0, import_fs7.openSync)(
2517
+ const fd = (0, import_fs17.openSync)(
1002
2518
  lockPath,
1003
- import_fs7.constants.O_CREAT | import_fs7.constants.O_EXCL | import_fs7.constants.O_WRONLY,
2519
+ import_fs17.constants.O_CREAT | import_fs17.constants.O_EXCL | import_fs17.constants.O_WRONLY,
1004
2520
  384
1005
2521
  );
1006
2522
  try {
1007
2523
  const payload = JSON.stringify({ pid: process.pid, timestamp: Date.now() });
1008
- (0, import_fs7.writeSync)(fd, payload, null, "utf-8");
2524
+ (0, import_fs17.writeSync)(fd, payload, null, "utf-8");
1009
2525
  } catch (writeErr) {
1010
2526
  try {
1011
- (0, import_fs7.closeSync)(fd);
2527
+ (0, import_fs17.closeSync)(fd);
1012
2528
  } catch {
1013
2529
  }
1014
2530
  try {
1015
- (0, import_fs7.unlinkSync)(lockPath);
2531
+ (0, import_fs17.unlinkSync)(lockPath);
1016
2532
  } catch {
1017
2533
  }
1018
2534
  throw writeErr;
@@ -1052,11 +2568,11 @@ function acquireFileLockSync(lockPath, opts) {
1052
2568
  }
1053
2569
  function releaseFileLockSync(handle) {
1054
2570
  try {
1055
- (0, import_fs7.closeSync)(handle.fd);
2571
+ (0, import_fs17.closeSync)(handle.fd);
1056
2572
  } catch {
1057
2573
  }
1058
2574
  try {
1059
- (0, import_fs7.unlinkSync)(handle.path);
2575
+ (0, import_fs17.unlinkSync)(handle.path);
1060
2576
  } catch {
1061
2577
  }
1062
2578
  }
@@ -1082,9 +2598,25 @@ var WORKER_LAUNCH_INTERNAL_ENV_KEYS = /* @__PURE__ */ new Set([
1082
2598
  ]);
1083
2599
  var WINDOWS_RESERVED_ENV_KEYS = new Set([...WORKER_LAUNCH_INTERNAL_ENV_KEYS, "SystemRoot"].map((key) => key.toUpperCase()));
1084
2600
 
2601
+ // src/team/recovery-request-store.ts
2602
+ var import_crypto5 = require("crypto");
2603
+ var import_fs18 = require("fs");
2604
+ var import_path20 = require("path");
2605
+ init_types2();
2606
+ init_state_paths();
2607
+ init_process_identity_lock();
2608
+ var RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
2609
+
2610
+ // src/team/runtime-owner-client.ts
2611
+ init_state_paths();
2612
+ init_team_instance();
2613
+ init_team_owner_epoch();
2614
+ init_types2();
2615
+ init_process_identity_lock();
2616
+ init_monitor();
2617
+
1085
2618
  // src/team/tmux-session.ts
1086
- var execFileAsync2 = (0, import_util3.promisify)(import_child_process5.execFile);
1087
- var TMUX_SESSION_PREFIX = "omc-team";
2619
+ var execFileAsync2 = (0, import_util3.promisify)(import_child_process7.execFile);
1088
2620
  function sanitizeName(name) {
1089
2621
  const sanitized = name.replace(/[^a-zA-Z0-9-]/g, "");
1090
2622
  if (sanitized.length === 0) {
@@ -1095,39 +2627,30 @@ function sanitizeName(name) {
1095
2627
  }
1096
2628
  return sanitized.slice(0, 50);
1097
2629
  }
1098
- function sessionName(teamName, workerName) {
1099
- return `${TMUX_SESSION_PREFIX}-${sanitizeName(teamName)}-${sanitizeName(workerName)}`;
1100
- }
1101
- function killSession(teamName, workerName) {
1102
- const name = sessionName(teamName, workerName);
1103
- try {
1104
- tmuxExec(["kill-session", "-t", name], { stripTmux: true, stdio: "pipe", timeout: 5e3 });
1105
- } catch {
1106
- }
1107
- }
1108
2630
 
1109
2631
  // src/team/task-file-ops.ts
2632
+ init_state_paths();
1110
2633
  var DEFAULT_STALE_LOCK_MS2 = 3e4;
1111
2634
  function acquireTaskLock(teamName, taskId, opts) {
1112
2635
  const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS2;
1113
2636
  const dir = canonicalTasksDir(teamName, opts?.cwd);
1114
2637
  ensureDirWithMode(dir);
1115
- const lockPath = (0, import_path9.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
2638
+ const lockPath = (0, import_path23.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
1116
2639
  for (let attempt = 0; attempt < 2; attempt++) {
1117
2640
  try {
1118
- const fd = (0, import_fs9.openSync)(lockPath, import_fs9.constants.O_CREAT | import_fs9.constants.O_EXCL | import_fs9.constants.O_WRONLY, 384);
2641
+ const fd = (0, import_fs21.openSync)(lockPath, import_fs21.constants.O_CREAT | import_fs21.constants.O_EXCL | import_fs21.constants.O_WRONLY, 384);
1119
2642
  const payload = JSON.stringify({
1120
2643
  pid: process.pid,
1121
2644
  workerName: opts?.workerName ?? "",
1122
2645
  timestamp: Date.now()
1123
2646
  });
1124
- (0, import_fs9.writeSync)(fd, payload, null, "utf-8");
2647
+ (0, import_fs21.writeSync)(fd, payload, null, "utf-8");
1125
2648
  return { fd, path: lockPath };
1126
2649
  } catch (err) {
1127
2650
  if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
1128
2651
  if (attempt === 0 && isLockStale2(lockPath, staleLockMs)) {
1129
2652
  try {
1130
- (0, import_fs9.unlinkSync)(lockPath);
2653
+ (0, import_fs21.unlinkSync)(lockPath);
1131
2654
  } catch {
1132
2655
  }
1133
2656
  continue;
@@ -1141,21 +2664,21 @@ function acquireTaskLock(teamName, taskId, opts) {
1141
2664
  }
1142
2665
  function releaseTaskLock(handle) {
1143
2666
  try {
1144
- (0, import_fs9.closeSync)(handle.fd);
2667
+ (0, import_fs21.closeSync)(handle.fd);
1145
2668
  } catch {
1146
2669
  }
1147
2670
  try {
1148
- (0, import_fs9.unlinkSync)(handle.path);
2671
+ (0, import_fs21.unlinkSync)(handle.path);
1149
2672
  } catch {
1150
2673
  }
1151
2674
  }
1152
2675
  function isLockStale2(lockPath, staleLockMs) {
1153
2676
  try {
1154
- const stat = (0, import_fs9.statSync)(lockPath);
2677
+ const stat = (0, import_fs21.statSync)(lockPath);
1155
2678
  const ageMs = Date.now() - stat.mtimeMs;
1156
2679
  if (ageMs < staleLockMs) return false;
1157
2680
  try {
1158
- const raw = (0, import_fs9.readFileSync)(lockPath, "utf-8");
2681
+ const raw = (0, import_fs21.readFileSync)(lockPath, "utf-8");
1159
2682
  const payload = JSON.parse(raw);
1160
2683
  if (payload.pid && isProcessAlive(payload.pid)) return false;
1161
2684
  } catch {
@@ -1174,37 +2697,37 @@ function sanitizeTaskId(taskId) {
1174
2697
  function canonicalTasksDir(teamName, cwd) {
1175
2698
  const root = cwd ?? process.cwd();
1176
2699
  const dir = getTaskStoragePath(root, sanitizeName(teamName));
1177
- validateResolvedPath(dir, (0, import_path9.join)(getOmcRoot(root), "state", "team"));
2700
+ validateResolvedPath(dir, (0, import_path23.join)(getOmcRoot(root), "state", "team"));
1178
2701
  return dir;
1179
2702
  }
1180
2703
  function legacyTasksDir(teamName) {
1181
2704
  const claudeConfigDir = getCopilotConfigDir();
1182
2705
  const dir = getLegacyTaskStoragePath(claudeConfigDir, sanitizeName(teamName));
1183
- validateResolvedPath(dir, (0, import_path9.join)(claudeConfigDir, "tasks"));
2706
+ validateResolvedPath(dir, (0, import_path23.join)(claudeConfigDir, "tasks"));
1184
2707
  return dir;
1185
2708
  }
1186
2709
  function resolveTaskPathForRead(teamName, taskId, cwd) {
1187
2710
  const safeTaskId = sanitizeTaskId(taskId);
1188
2711
  const canonicalDir = canonicalTasksDir(teamName, cwd);
1189
- const canonical = (0, import_path9.join)(canonicalDir, `${normalizeTaskFileStem(safeTaskId)}.json`);
1190
- if ((0, import_fs9.existsSync)(canonical)) return canonical;
1191
- const legacyCanonical = (0, import_path9.join)(canonicalDir, `${safeTaskId}.json`);
1192
- if ((0, import_fs9.existsSync)(legacyCanonical)) return legacyCanonical;
1193
- const legacy = (0, import_path9.join)(legacyTasksDir(teamName), `${safeTaskId}.json`);
1194
- if ((0, import_fs9.existsSync)(legacy)) return legacy;
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;
1195
2718
  return canonical;
1196
2719
  }
1197
2720
  function resolveTaskPathForWrite(teamName, taskId, cwd) {
1198
- return (0, import_path9.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
2721
+ return (0, import_path23.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
1199
2722
  }
1200
2723
  function failureSidecarPath(teamName, taskId, cwd) {
1201
- return (0, import_path9.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
2724
+ return (0, import_path23.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
1202
2725
  }
1203
2726
  function readTask(teamName, taskId, opts) {
1204
2727
  const filePath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
1205
- if (!(0, import_fs9.existsSync)(filePath)) return null;
2728
+ if (!(0, import_fs21.existsSync)(filePath)) return null;
1206
2729
  try {
1207
- const raw = (0, import_fs9.readFileSync)(filePath, "utf-8");
2730
+ const raw = (0, import_fs21.readFileSync)(filePath, "utf-8");
1208
2731
  return JSON.parse(raw);
1209
2732
  } catch {
1210
2733
  return null;
@@ -1216,7 +2739,7 @@ function updateTask(teamName, taskId, updates, opts) {
1216
2739
  const readPath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
1217
2740
  let task;
1218
2741
  try {
1219
- const raw = (0, import_fs9.readFileSync)(readPath, "utf-8");
2742
+ const raw = (0, import_fs21.readFileSync)(readPath, "utf-8");
1220
2743
  task = JSON.parse(raw);
1221
2744
  } catch {
1222
2745
  throw new Error(`Task file not found or malformed: ${taskId}`);
@@ -1245,7 +2768,7 @@ function updateTask(teamName, taskId, updates, opts) {
1245
2768
  }
1246
2769
  async function findNextTask(teamName, workerName, opts) {
1247
2770
  const dir = canonicalTasksDir(teamName, opts?.cwd);
1248
- if (!(0, import_fs9.existsSync)(dir)) return null;
2771
+ if (!(0, import_fs21.existsSync)(dir)) return null;
1249
2772
  const taskIds = listTaskIds(teamName, opts);
1250
2773
  for (const id of taskIds) {
1251
2774
  const task = readTask(teamName, id, opts);
@@ -1264,7 +2787,7 @@ async function findNextTask(teamName, workerName, opts) {
1264
2787
  let taskData;
1265
2788
  try {
1266
2789
  const readPath = resolveTaskPathForRead(teamName, id, opts?.cwd);
1267
- const raw = (0, import_fs9.readFileSync)(readPath, "utf-8");
2790
+ const raw = (0, import_fs21.readFileSync)(readPath, "utf-8");
1268
2791
  taskData = JSON.parse(raw);
1269
2792
  } catch {
1270
2793
  continue;
@@ -1303,9 +2826,9 @@ function writeTaskFailure(teamName, taskId, error, opts) {
1303
2826
  }
1304
2827
  function readTaskFailure(teamName, taskId, opts) {
1305
2828
  const filePath = failureSidecarPath(teamName, taskId, opts?.cwd);
1306
- if (!(0, import_fs9.existsSync)(filePath)) return null;
2829
+ if (!(0, import_fs21.existsSync)(filePath)) return null;
1307
2830
  try {
1308
- const raw = (0, import_fs9.readFileSync)(filePath, "utf-8");
2831
+ const raw = (0, import_fs21.readFileSync)(filePath, "utf-8");
1309
2832
  return JSON.parse(raw);
1310
2833
  } catch {
1311
2834
  return null;
@@ -1313,9 +2836,9 @@ function readTaskFailure(teamName, taskId, opts) {
1313
2836
  }
1314
2837
  function listTaskIds(teamName, opts) {
1315
2838
  const scanDir = (dir) => {
1316
- if (!(0, import_fs9.existsSync)(dir)) return [];
2839
+ if (!(0, import_fs21.existsSync)(dir)) return [];
1317
2840
  try {
1318
- return (0, import_fs9.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.includes(".tmp.") && !f.includes(".failure.") && !f.endsWith(".lock")).map((f) => f.replace(/^task-/, "").replace(".json", ""));
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", ""));
1319
2842
  } catch {
1320
2843
  return [];
1321
2844
  }
@@ -1333,31 +2856,32 @@ function listTaskIds(teamName, opts) {
1333
2856
  }
1334
2857
 
1335
2858
  // src/team/inbox-outbox.ts
1336
- var import_fs10 = require("fs");
1337
- var import_path10 = require("path");
2859
+ var import_fs22 = require("fs");
2860
+ var import_path24 = require("path");
2861
+ init_config_dir();
1338
2862
  var MAX_INBOX_READ_SIZE = 10 * 1024 * 1024;
1339
2863
  function teamsDir(teamName) {
1340
- const result = (0, import_path10.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
1341
- validateResolvedPath(result, (0, import_path10.join)(getCopilotConfigDir(), "teams"));
2864
+ const result = (0, import_path24.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
2865
+ validateResolvedPath(result, (0, import_path24.join)(getCopilotConfigDir(), "teams"));
1342
2866
  return result;
1343
2867
  }
1344
2868
  function inboxPath(teamName, workerName) {
1345
- return (0, import_path10.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
2869
+ return (0, import_path24.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
1346
2870
  }
1347
2871
  function inboxCursorPath(teamName, workerName) {
1348
- return (0, import_path10.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
2872
+ return (0, import_path24.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
1349
2873
  }
1350
2874
  function outboxPath(teamName, workerName) {
1351
- return (0, import_path10.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
2875
+ return (0, import_path24.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
1352
2876
  }
1353
2877
  function signalPath(teamName, workerName) {
1354
- return (0, import_path10.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
2878
+ return (0, import_path24.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
1355
2879
  }
1356
2880
  function drainSignalPath(teamName, workerName) {
1357
- return (0, import_path10.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
2881
+ return (0, import_path24.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
1358
2882
  }
1359
2883
  function ensureDir(filePath) {
1360
- const dir = (0, import_path10.dirname)(filePath);
2884
+ const dir = (0, import_path24.dirname)(filePath);
1361
2885
  ensureDirWithMode(dir);
1362
2886
  }
1363
2887
  function appendOutbox(teamName, workerName, message) {
@@ -1367,32 +2891,32 @@ function appendOutbox(teamName, workerName, message) {
1367
2891
  }
1368
2892
  function rotateOutboxIfNeeded(teamName, workerName, maxLines) {
1369
2893
  const filePath = outboxPath(teamName, workerName);
1370
- if (!(0, import_fs10.existsSync)(filePath)) return;
2894
+ if (!(0, import_fs22.existsSync)(filePath)) return;
1371
2895
  try {
1372
- const content = (0, import_fs10.readFileSync)(filePath, "utf-8");
2896
+ const content = (0, import_fs22.readFileSync)(filePath, "utf-8");
1373
2897
  const lines = content.split("\n").filter((l) => l.trim());
1374
2898
  if (lines.length <= maxLines) return;
1375
2899
  const keepCount = Math.floor(maxLines / 2);
1376
2900
  const kept = keepCount === 0 ? [] : lines.slice(-keepCount);
1377
2901
  const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
1378
2902
  writeFileWithMode(tmpPath, kept.join("\n") + "\n");
1379
- (0, import_fs10.renameSync)(tmpPath, filePath);
2903
+ (0, import_fs22.renameSync)(tmpPath, filePath);
1380
2904
  } catch {
1381
2905
  }
1382
2906
  }
1383
2907
  function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
1384
2908
  const filePath = inboxPath(teamName, workerName);
1385
- if (!(0, import_fs10.existsSync)(filePath)) return;
2909
+ if (!(0, import_fs22.existsSync)(filePath)) return;
1386
2910
  try {
1387
- const stat = (0, import_fs10.statSync)(filePath);
2911
+ const stat = (0, import_fs22.statSync)(filePath);
1388
2912
  if (stat.size <= maxSizeBytes) return;
1389
- const content = (0, import_fs10.readFileSync)(filePath, "utf-8");
2913
+ const content = (0, import_fs22.readFileSync)(filePath, "utf-8");
1390
2914
  const lines = content.split("\n").filter((l) => l.trim());
1391
2915
  const keepCount = Math.max(1, Math.floor(lines.length / 2));
1392
2916
  const kept = lines.slice(-keepCount);
1393
2917
  const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
1394
2918
  writeFileWithMode(tmpPath, kept.join("\n") + "\n");
1395
- (0, import_fs10.renameSync)(tmpPath, filePath);
2919
+ (0, import_fs22.renameSync)(tmpPath, filePath);
1396
2920
  const cursorFile = inboxCursorPath(teamName, workerName);
1397
2921
  atomicWriteJson(cursorFile, { bytesRead: 0 });
1398
2922
  } catch {
@@ -1401,16 +2925,16 @@ function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
1401
2925
  function readNewInboxMessages(teamName, workerName) {
1402
2926
  const inbox = inboxPath(teamName, workerName);
1403
2927
  const cursorFile = inboxCursorPath(teamName, workerName);
1404
- if (!(0, import_fs10.existsSync)(inbox)) return [];
2928
+ if (!(0, import_fs22.existsSync)(inbox)) return [];
1405
2929
  let offset = 0;
1406
- if ((0, import_fs10.existsSync)(cursorFile)) {
2930
+ if ((0, import_fs22.existsSync)(cursorFile)) {
1407
2931
  try {
1408
- const cursor = JSON.parse((0, import_fs10.readFileSync)(cursorFile, "utf-8"));
2932
+ const cursor = JSON.parse((0, import_fs22.readFileSync)(cursorFile, "utf-8"));
1409
2933
  offset = cursor.bytesRead;
1410
2934
  } catch {
1411
2935
  }
1412
2936
  }
1413
- const stat = (0, import_fs10.statSync)(inbox);
2937
+ const stat = (0, import_fs22.statSync)(inbox);
1414
2938
  if (stat.size < offset) {
1415
2939
  offset = 0;
1416
2940
  }
@@ -1420,12 +2944,12 @@ function readNewInboxMessages(teamName, workerName) {
1420
2944
  if (cappedSize < readSize) {
1421
2945
  console.warn(`[inbox-outbox] Inbox for ${workerName} exceeds ${MAX_INBOX_READ_SIZE} bytes, reading truncated`);
1422
2946
  }
1423
- const fd = (0, import_fs10.openSync)(inbox, "r");
2947
+ const fd = (0, import_fs22.openSync)(inbox, "r");
1424
2948
  const buffer = Buffer.alloc(cappedSize);
1425
2949
  try {
1426
- (0, import_fs10.readSync)(fd, buffer, 0, buffer.length, offset);
2950
+ (0, import_fs22.readSync)(fd, buffer, 0, buffer.length, offset);
1427
2951
  } finally {
1428
- (0, import_fs10.closeSync)(fd);
2952
+ (0, import_fs22.closeSync)(fd);
1429
2953
  }
1430
2954
  const newData = buffer.toString("utf-8");
1431
2955
  const lastNewlineIdx = newData.lastIndexOf("\n");
@@ -1462,9 +2986,9 @@ function readNewInboxMessages(teamName, workerName) {
1462
2986
  }
1463
2987
  function checkShutdownSignal(teamName, workerName) {
1464
2988
  const filePath = signalPath(teamName, workerName);
1465
- if (!(0, import_fs10.existsSync)(filePath)) return null;
2989
+ if (!(0, import_fs22.existsSync)(filePath)) return null;
1466
2990
  try {
1467
- const raw = (0, import_fs10.readFileSync)(filePath, "utf-8");
2991
+ const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
1468
2992
  return JSON.parse(raw);
1469
2993
  } catch {
1470
2994
  return null;
@@ -1472,18 +2996,18 @@ function checkShutdownSignal(teamName, workerName) {
1472
2996
  }
1473
2997
  function deleteShutdownSignal(teamName, workerName) {
1474
2998
  const filePath = signalPath(teamName, workerName);
1475
- if ((0, import_fs10.existsSync)(filePath)) {
2999
+ if ((0, import_fs22.existsSync)(filePath)) {
1476
3000
  try {
1477
- (0, import_fs10.unlinkSync)(filePath);
3001
+ (0, import_fs22.unlinkSync)(filePath);
1478
3002
  } catch {
1479
3003
  }
1480
3004
  }
1481
3005
  }
1482
3006
  function checkDrainSignal(teamName, workerName) {
1483
3007
  const filePath = drainSignalPath(teamName, workerName);
1484
- if (!(0, import_fs10.existsSync)(filePath)) return null;
3008
+ if (!(0, import_fs22.existsSync)(filePath)) return null;
1485
3009
  try {
1486
- const raw = (0, import_fs10.readFileSync)(filePath, "utf-8");
3010
+ const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
1487
3011
  return JSON.parse(raw);
1488
3012
  } catch {
1489
3013
  return null;
@@ -1491,32 +3015,34 @@ function checkDrainSignal(teamName, workerName) {
1491
3015
  }
1492
3016
  function deleteDrainSignal(teamName, workerName) {
1493
3017
  const filePath = drainSignalPath(teamName, workerName);
1494
- if ((0, import_fs10.existsSync)(filePath)) {
3018
+ if ((0, import_fs22.existsSync)(filePath)) {
1495
3019
  try {
1496
- (0, import_fs10.unlinkSync)(filePath);
3020
+ (0, import_fs22.unlinkSync)(filePath);
1497
3021
  } catch {
1498
3022
  }
1499
3023
  }
1500
3024
  }
1501
3025
 
1502
3026
  // src/team/team-registration.ts
1503
- var import_fs11 = require("fs");
1504
- var import_path11 = require("path");
3027
+ var import_fs23 = require("fs");
3028
+ var import_path25 = require("path");
3029
+ init_config_dir();
3030
+ init_worktree_paths();
1505
3031
  function configPath(teamName) {
1506
- const result = (0, import_path11.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
1507
- validateResolvedPath(result, (0, import_path11.join)(getCopilotConfigDir(), "teams"));
3032
+ const result = (0, import_path25.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
3033
+ validateResolvedPath(result, (0, import_path25.join)(getCopilotConfigDir(), "teams"));
1508
3034
  return result;
1509
3035
  }
1510
3036
  function shadowRegistryPath(workingDirectory) {
1511
- const result = (0, import_path11.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
1512
- validateResolvedPath(result, (0, import_path11.join)(getOmcRoot(workingDirectory), "state"));
3037
+ const result = (0, import_path25.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
3038
+ validateResolvedPath(result, (0, import_path25.join)(getOmcRoot(workingDirectory), "state"));
1513
3039
  return result;
1514
3040
  }
1515
3041
  function unregisterMcpWorker(teamName, workerName, workingDirectory) {
1516
3042
  const configFile = configPath(teamName);
1517
- if ((0, import_fs11.existsSync)(configFile)) {
3043
+ if ((0, import_fs23.existsSync)(configFile)) {
1518
3044
  try {
1519
- const raw = (0, import_fs11.readFileSync)(configFile, "utf-8");
3045
+ const raw = (0, import_fs23.readFileSync)(configFile, "utf-8");
1520
3046
  const config = JSON.parse(raw);
1521
3047
  const members = Array.isArray(config.members) ? config.members : [];
1522
3048
  config.members = members.filter((m) => m.name !== workerName);
@@ -1527,9 +3053,9 @@ function unregisterMcpWorker(teamName, workerName, workingDirectory) {
1527
3053
  const shadowFile = shadowRegistryPath(workingDirectory);
1528
3054
  try {
1529
3055
  withFileLockSync(shadowFile + ".lock", () => {
1530
- if ((0, import_fs11.existsSync)(shadowFile)) {
3056
+ if ((0, import_fs23.existsSync)(shadowFile)) {
1531
3057
  try {
1532
- const registry = JSON.parse((0, import_fs11.readFileSync)(shadowFile, "utf-8"));
3058
+ const registry = JSON.parse((0, import_fs23.readFileSync)(shadowFile, "utf-8"));
1533
3059
  registry.workers = (registry.workers || []).filter((w) => w.name !== workerName);
1534
3060
  atomicWriteJson(shadowFile, registry);
1535
3061
  } catch {
@@ -1545,9 +3071,9 @@ function isMcpWorker(member) {
1545
3071
  function listMcpWorkers(teamName, workingDirectory) {
1546
3072
  const workers = /* @__PURE__ */ new Map();
1547
3073
  const configFile = configPath(teamName);
1548
- if ((0, import_fs11.existsSync)(configFile)) {
3074
+ if ((0, import_fs23.existsSync)(configFile)) {
1549
3075
  try {
1550
- const raw = (0, import_fs11.readFileSync)(configFile, "utf-8");
3076
+ const raw = (0, import_fs23.readFileSync)(configFile, "utf-8");
1551
3077
  const config = JSON.parse(raw);
1552
3078
  const members = Array.isArray(config.members) ? config.members : [];
1553
3079
  for (const m of members) {
@@ -1559,9 +3085,9 @@ function listMcpWorkers(teamName, workingDirectory) {
1559
3085
  }
1560
3086
  }
1561
3087
  const shadowFile = shadowRegistryPath(workingDirectory);
1562
- if ((0, import_fs11.existsSync)(shadowFile)) {
3088
+ if ((0, import_fs23.existsSync)(shadowFile)) {
1563
3089
  try {
1564
- const registry = JSON.parse((0, import_fs11.readFileSync)(shadowFile, "utf-8"));
3090
+ const registry = JSON.parse((0, import_fs23.readFileSync)(shadowFile, "utf-8"));
1565
3091
  for (const w of registry.workers || []) {
1566
3092
  workers.set(w.name, w);
1567
3093
  }
@@ -1572,10 +3098,11 @@ function listMcpWorkers(teamName, workingDirectory) {
1572
3098
  }
1573
3099
 
1574
3100
  // src/team/heartbeat.ts
1575
- var import_fs12 = require("fs");
1576
- var import_path12 = require("path");
3101
+ var import_fs24 = require("fs");
3102
+ var import_path26 = require("path");
3103
+ init_worktree_paths();
1577
3104
  function heartbeatPath(workingDirectory, teamName, workerName) {
1578
- return (0, import_path12.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
3105
+ return (0, import_path26.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
1579
3106
  }
1580
3107
  function writeHeartbeat(workingDirectory, data) {
1581
3108
  const filePath = heartbeatPath(workingDirectory, data.teamName, data.workerName);
@@ -1583,9 +3110,9 @@ function writeHeartbeat(workingDirectory, data) {
1583
3110
  }
1584
3111
  function readHeartbeat(workingDirectory, teamName, workerName) {
1585
3112
  const filePath = heartbeatPath(workingDirectory, teamName, workerName);
1586
- if (!(0, import_fs12.existsSync)(filePath)) return null;
3113
+ if (!(0, import_fs24.existsSync)(filePath)) return null;
1587
3114
  try {
1588
- const raw = (0, import_fs12.readFileSync)(filePath, "utf-8");
3115
+ const raw = (0, import_fs24.readFileSync)(filePath, "utf-8");
1589
3116
  return JSON.parse(raw);
1590
3117
  } catch {
1591
3118
  return null;
@@ -1604,9 +3131,9 @@ function isWorkerAlive(workingDirectory, teamName, workerName, maxAgeMs) {
1604
3131
  }
1605
3132
  function deleteHeartbeat(workingDirectory, teamName, workerName) {
1606
3133
  const filePath = heartbeatPath(workingDirectory, teamName, workerName);
1607
- if ((0, import_fs12.existsSync)(filePath)) {
3134
+ if ((0, import_fs24.existsSync)(filePath)) {
1608
3135
  try {
1609
- (0, import_fs12.unlinkSync)(filePath);
3136
+ (0, import_fs24.unlinkSync)(filePath);
1610
3137
  } catch {
1611
3138
  }
1612
3139
  }
@@ -1614,6 +3141,7 @@ function deleteHeartbeat(workingDirectory, teamName, workerName) {
1614
3141
 
1615
3142
  // src/team/audit-log.ts
1616
3143
  var import_node_path = require("node:path");
3144
+ init_worktree_paths();
1617
3145
  var DEFAULT_MAX_LOG_SIZE = 5 * 1024 * 1024;
1618
3146
  function getLogPath(workingDirectory, teamName) {
1619
3147
  return (0, import_node_path.join)(getOmcRoot(workingDirectory), "logs", `team-bridge-${teamName}.jsonl`);
@@ -1760,70 +3288,29 @@ function findPermissionViolations(changedPaths, permissions, cwd) {
1760
3288
  return violations;
1761
3289
  }
1762
3290
 
1763
- // src/config/models.ts
1764
- var COPILOT_FAMILY_DEFAULTS = {
1765
- HAIKU: "claude-haiku-4-5",
1766
- SONNET: "claude-sonnet-5",
1767
- OPUS: "claude-opus-4-8",
1768
- FABLE: "claude-fable-5"
1769
- };
1770
- var BUILTIN_TIER_MODEL_DEFAULTS = {
1771
- LOW: COPILOT_FAMILY_DEFAULTS.HAIKU,
1772
- MEDIUM: COPILOT_FAMILY_DEFAULTS.SONNET,
1773
- HIGH: COPILOT_FAMILY_DEFAULTS.OPUS
1774
- };
1775
- var CLAUDE_FAMILY_HIGH_VARIANTS = {
1776
- HAIKU: `${COPILOT_FAMILY_DEFAULTS.HAIKU}-high`,
1777
- SONNET: `${COPILOT_FAMILY_DEFAULTS.SONNET}-high`,
1778
- OPUS: `${COPILOT_FAMILY_DEFAULTS.OPUS}-high`,
1779
- FABLE: `${COPILOT_FAMILY_DEFAULTS.FABLE}-high`
1780
- };
1781
- var BUILTIN_EXTERNAL_MODEL_DEFAULTS = {
1782
- codexModel: "gpt-5.3-codex",
1783
- geminiModel: "gemini-3.1-pro-preview",
1784
- antigravityModel: "Gemini 3.1 Pro (High)"
1785
- };
1786
- function getBuiltinExternalDefaultModel(provider) {
1787
- if (provider === "codex") return BUILTIN_EXTERNAL_MODEL_DEFAULTS.codexModel;
1788
- if (provider === "antigravity") return BUILTIN_EXTERNAL_MODEL_DEFAULTS.antigravityModel;
1789
- return BUILTIN_EXTERNAL_MODEL_DEFAULTS.geminiModel;
1790
- }
1791
-
1792
- // src/agents/prompt-helpers.ts
1793
- var import_fs15 = require("fs");
1794
- var import_path15 = require("path");
1795
- var import_url3 = require("url");
1796
-
1797
- // src/agents/utils.ts
1798
- var import_fs13 = require("fs");
1799
- var import_path13 = require("path");
1800
- var import_url2 = require("url");
1801
-
1802
- // src/utils/strict-mode.ts
1803
- var import_fs14 = require("fs");
1804
- var import_path14 = require("path");
1805
-
1806
3291
  // src/agents/prompt-helpers.ts
1807
- var import_meta = {};
1808
- function getPackageDir() {
3292
+ var import_fs25 = require("fs");
3293
+ var import_path27 = require("path");
3294
+ var import_url4 = require("url");
3295
+ function getPackageDir3() {
1809
3296
  if (typeof __dirname !== "undefined" && __dirname) {
1810
- const currentDirName = (0, import_path15.basename)(__dirname);
1811
- const parentDirName = (0, import_path15.basename)((0, import_path15.dirname)(__dirname));
3297
+ const currentDirName = (0, import_path27.basename)(__dirname);
3298
+ const parentDirName = (0, import_path27.basename)((0, import_path27.dirname)(__dirname));
1812
3299
  if (currentDirName === "bridge") {
1813
- return (0, import_path15.join)(__dirname, "..");
3300
+ return (0, import_path27.join)(__dirname, "..");
1814
3301
  }
1815
3302
  if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
1816
- return (0, import_path15.join)(__dirname, "..", "..");
3303
+ return (0, import_path27.join)(__dirname, "..", "..");
1817
3304
  }
1818
3305
  }
1819
3306
  try {
1820
- const __filename = (0, import_url3.fileURLToPath)(import_meta.url);
1821
- const __dirname2 = (0, import_path15.dirname)(__filename);
1822
- const currentDirName = (0, import_path15.basename)(__dirname2);
3307
+ const __filename = (0, import_url4.fileURLToPath)(importMetaUrl);
3308
+ const __dirname2 = (0, import_path27.dirname)(__filename);
3309
+ const currentDirName = (0, import_path27.basename)(__dirname2);
1823
3310
  if (currentDirName === "bridge") {
1824
- return (0, import_path15.join)(__dirname2, "..");
3311
+ return (0, import_path27.join)(__dirname2, "..");
1825
3312
  }
1826
- return (0, import_path15.join)(__dirname2, "..", "..");
3313
+ return (0, import_path27.join)(__dirname2, "..", "..");
1827
3314
  } catch {
1828
3315
  }
1829
3316
  return process.cwd();
@@ -1839,9 +3326,9 @@ function getValidAgentRoles() {
1839
3326
  } catch {
1840
3327
  }
1841
3328
  try {
1842
- const agentsDir = (0, import_path15.join)(getPackageDir(), "agents");
1843
- const files = (0, import_fs15.readdirSync)(agentsDir);
1844
- _cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path15.basename)(f, ".md")).sort();
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();
1845
3332
  } catch (err) {
1846
3333
  console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
1847
3334
  _cachedRoles = [];
@@ -1863,12 +3350,14 @@ function sanitizePromptContent(content, maxLength = 4e3) {
1863
3350
  }
1864
3351
 
1865
3352
  // src/team/team-status.ts
1866
- var import_fs16 = require("fs");
1867
- var import_path16 = require("path");
3353
+ var import_fs26 = require("fs");
3354
+ var import_path28 = require("path");
3355
+ init_config_dir();
1868
3356
 
1869
3357
  // src/team/usage-tracker.ts
1870
3358
  var import_node_fs = require("node:fs");
1871
3359
  var import_node_path3 = require("node:path");
3360
+ init_worktree_paths();
1872
3361
  function getUsageLogPath(workingDirectory, teamName) {
1873
3362
  return (0, import_node_path3.join)(getOmcRoot(workingDirectory), "logs", `team-usage-${teamName}.jsonl`);
1874
3363
  }
@@ -1953,10 +3442,10 @@ function emptyUsageReport(teamName) {
1953
3442
  function peekRecentOutboxMessages(teamName, workerName, maxMessages = 10) {
1954
3443
  const safeName = sanitizeName(teamName);
1955
3444
  const safeWorker = sanitizeName(workerName);
1956
- const outboxPath2 = (0, import_path16.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
1957
- if (!(0, import_fs16.existsSync)(outboxPath2)) return [];
3445
+ const outboxPath2 = (0, import_path28.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
3446
+ if (!(0, import_fs26.existsSync)(outboxPath2)) return [];
1958
3447
  try {
1959
- const content = (0, import_fs16.readFileSync)(outboxPath2, "utf-8");
3448
+ const content = (0, import_fs26.readFileSync)(outboxPath2, "utf-8");
1960
3449
  const lines = content.split("\n").filter((l) => l.trim());
1961
3450
  const recentLines = lines.slice(-maxMessages);
1962
3451
  const messages = [];
@@ -2061,12 +3550,12 @@ function audit(config, eventType, taskId, details) {
2061
3550
  }
2062
3551
  }
2063
3552
  function sleep(ms) {
2064
- return new Promise((resolve5) => setTimeout(resolve5, ms));
3553
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
2065
3554
  }
2066
3555
  function captureFileSnapshot(cwd) {
2067
3556
  const files = /* @__PURE__ */ new Set();
2068
3557
  try {
2069
- const statusOutput = (0, import_child_process6.execFileSync)("git", ["status", "--porcelain"], {
3558
+ const statusOutput = (0, import_child_process8.execFileSync)("git", ["status", "--porcelain"], {
2070
3559
  cwd,
2071
3560
  encoding: "utf-8",
2072
3561
  timeout: 1e4,
@@ -2079,7 +3568,7 @@ function captureFileSnapshot(cwd) {
2079
3568
  const fileName = arrowIdx !== -1 ? filePart.slice(arrowIdx + 4) : filePart;
2080
3569
  files.add(fileName.trim());
2081
3570
  }
2082
- const untrackedOutput = (0, import_child_process6.execFileSync)(
3571
+ const untrackedOutput = (0, import_child_process8.execFileSync)(
2083
3572
  "git",
2084
3573
  ["ls-files", "--others", "--exclude-standard"],
2085
3574
  { cwd, encoding: "utf-8", timeout: 1e4, windowsHide: true }
@@ -2229,29 +3718,29 @@ function buildTaskPrompt(task, messages, config) {
2229
3718
  return result;
2230
3719
  }
2231
3720
  function writePromptFile(config, taskId, prompt) {
2232
- const dir = (0, import_path17.join)(getOmcRoot(config.workingDirectory), "prompts");
3721
+ const dir = (0, import_path29.join)(getOmcRoot(config.workingDirectory), "prompts");
2233
3722
  ensureDirWithMode(dir);
2234
3723
  const filename = `team-${config.teamName}-task-${taskId}-${Date.now()}.md`;
2235
- const filePath = (0, import_path17.join)(dir, filename);
3724
+ const filePath = (0, import_path29.join)(dir, filename);
2236
3725
  writeFileWithMode(filePath, prompt);
2237
3726
  return filePath;
2238
3727
  }
2239
3728
  function getOutputPath(config, taskId) {
2240
- const dir = (0, import_path17.join)(getOmcRoot(config.workingDirectory), "outputs");
3729
+ const dir = (0, import_path29.join)(getOmcRoot(config.workingDirectory), "outputs");
2241
3730
  ensureDirWithMode(dir);
2242
3731
  const suffix = Math.random().toString(36).slice(2, 8);
2243
- return (0, import_path17.join)(
3732
+ return (0, import_path29.join)(
2244
3733
  dir,
2245
3734
  `team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`
2246
3735
  );
2247
3736
  }
2248
3737
  function readOutputSummary(outputFile) {
2249
3738
  try {
2250
- if (!(0, import_fs17.existsSync)(outputFile)) return "(no output file)";
3739
+ if (!(0, import_fs27.existsSync)(outputFile)) return "(no output file)";
2251
3740
  const buf = Buffer.alloc(1024);
2252
- const fd = (0, import_fs17.openSync)(outputFile, "r");
3741
+ const fd = (0, import_fs27.openSync)(outputFile, "r");
2253
3742
  try {
2254
- const bytesRead = (0, import_fs17.readSync)(fd, buf, 0, 1024, 0);
3743
+ const bytesRead = (0, import_fs27.readSync)(fd, buf, 0, 1024, 0);
2255
3744
  if (bytesRead === 0) return "(empty output)";
2256
3745
  const content = buf.toString("utf-8", 0, bytesRead);
2257
3746
  if (content.length > 500) {
@@ -2259,7 +3748,7 @@ function readOutputSummary(outputFile) {
2259
3748
  }
2260
3749
  return content;
2261
3750
  } finally {
2262
- (0, import_fs17.closeSync)(fd);
3751
+ (0, import_fs27.closeSync)(fd);
2263
3752
  }
2264
3753
  } catch {
2265
3754
  return "(error reading output)";
@@ -2342,11 +3831,11 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
2342
3831
  args = ["--approval-mode", "yolo"];
2343
3832
  if (model) args.push("--model", model);
2344
3833
  }
2345
- const child = (0, import_child_process6.spawn)(cmd, args, {
3834
+ const child = (0, import_child_process8.spawn)(cmd, args, {
2346
3835
  stdio: ["pipe", "pipe", "pipe"],
2347
3836
  cwd
2348
3837
  });
2349
- const result = new Promise((resolve5, reject) => {
3838
+ const result = new Promise((resolve8, reject) => {
2350
3839
  let stdout = "";
2351
3840
  let stderr = "";
2352
3841
  let settled = false;
@@ -2369,7 +3858,7 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
2369
3858
  clearTimeout(timeoutHandle);
2370
3859
  if (code === 0) {
2371
3860
  const response = provider === "codex" ? parseCodexOutput(stdout) : stdout.trim();
2372
- resolve5(response);
3861
+ resolve8(response);
2373
3862
  } else {
2374
3863
  const detail = stderr || stdout.trim() || "No output";
2375
3864
  reject(new Error(`CLI exited with code ${code}: ${detail}`));
@@ -2406,7 +3895,7 @@ async function handleShutdown(config, signal, activeChild) {
2406
3895
  });
2407
3896
  activeChild.kill("SIGTERM");
2408
3897
  await Promise.race([
2409
- new Promise((resolve5) => activeChild.on("close", () => resolve5())),
3898
+ new Promise((resolve8) => activeChild.on("close", () => resolve8())),
2410
3899
  sleep(5e3)
2411
3900
  ]);
2412
3901
  if (!closed) {
@@ -2428,10 +3917,6 @@ async function handleShutdown(config, signal, activeChild) {
2428
3917
  deleteHeartbeat(workingDirectory, teamName, workerName);
2429
3918
  audit(config, "bridge_shutdown");
2430
3919
  log(`[bridge] Shutdown complete. Goodbye.`);
2431
- try {
2432
- killSession(teamName, workerName);
2433
- } catch {
2434
- }
2435
3920
  }
2436
3921
  async function runBridge(config) {
2437
3922
  const { teamName, workerName, provider, workingDirectory } = config;
@@ -2816,17 +4301,19 @@ ${violationSummary}`
2816
4301
  }
2817
4302
 
2818
4303
  // src/team/bridge-entry.ts
4304
+ init_worktree_paths();
4305
+ init_config_dir();
2819
4306
  function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
2820
- const resolved = (0, import_path18.resolve)(configPath2);
2821
- const normalizedHome = (0, import_path18.resolve)(homeDir);
4307
+ const resolved = (0, import_path30.resolve)(configPath2);
4308
+ const normalizedHome = (0, import_path30.resolve)(homeDir);
2822
4309
  const isUnderHome = isAtOrUnder(normalizedHome, resolved);
2823
- const normalizedConfigDir = (0, import_path18.resolve)(claudeConfigDir);
2824
- const normalizedOmcDir = (0, import_path18.resolve)(homeDir, ".omg");
4310
+ const normalizedConfigDir = (0, import_path30.resolve)(claudeConfigDir);
4311
+ const normalizedOmcDir = (0, import_path30.resolve)(homeDir, ".omg");
2825
4312
  const isTrustedSubpath = isAtOrUnder(normalizedConfigDir, resolved) || isAtOrUnder(normalizedOmcDir, resolved) || hasOmcPathSegment(resolved);
2826
4313
  if (!isUnderHome || !isTrustedSubpath) return false;
2827
4314
  try {
2828
- const parentDir = (0, import_path18.resolve)(resolved, "..");
2829
- const realParent = (0, import_fs18.realpathSync)(parentDir);
4315
+ const parentDir = (0, import_path30.resolve)(resolved, "..");
4316
+ const realParent = (0, import_fs28.realpathSync)(parentDir);
2830
4317
  if (!isAtOrUnder(normalizedHome, realParent)) {
2831
4318
  return false;
2832
4319
  }
@@ -2835,9 +4322,9 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
2835
4322
  return true;
2836
4323
  }
2837
4324
  function isAtOrUnder(parent, child) {
2838
- const rel = (0, import_path18.relative)(parent, child);
4325
+ const rel = (0, import_path30.relative)(parent, child);
2839
4326
  if (rel === "") return true;
2840
- return !rel.startsWith("..") && !(0, import_path18.isAbsolute)(rel);
4327
+ return !rel.startsWith("..") && !(0, import_path30.isAbsolute)(rel);
2841
4328
  }
2842
4329
  function hasOmcPathSegment(absolutePath) {
2843
4330
  return absolutePath.split(/[\\/]/).includes(".omg");
@@ -2845,20 +4332,20 @@ function hasOmcPathSegment(absolutePath) {
2845
4332
  function validateBridgeWorkingDirectory(workingDirectory) {
2846
4333
  let stat;
2847
4334
  try {
2848
- stat = (0, import_fs18.statSync)(workingDirectory);
4335
+ stat = (0, import_fs28.statSync)(workingDirectory);
2849
4336
  } catch {
2850
4337
  throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
2851
4338
  }
2852
4339
  if (!stat.isDirectory()) {
2853
4340
  throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
2854
4341
  }
2855
- const resolved = (0, import_fs18.realpathSync)(workingDirectory);
2856
- const home = (0, import_path18.resolve)((0, import_os3.homedir)());
4342
+ const resolved = (0, import_fs28.realpathSync)(workingDirectory);
4343
+ const home = (0, import_path30.resolve)((0, import_os7.homedir)());
2857
4344
  if (!isAtOrUnder(home, resolved)) {
2858
4345
  throw new Error(`workingDirectory is outside home directory: ${resolved}`);
2859
4346
  }
2860
- const root = getWorktreeRoot(workingDirectory);
2861
- if (!root) {
4347
+ const probe = probeGitTopLevel(workingDirectory);
4348
+ if (probe.status !== "ok") {
2862
4349
  throw new Error(`workingDirectory is not inside a git worktree: ${workingDirectory}`);
2863
4350
  }
2864
4351
  }
@@ -2868,8 +4355,8 @@ function main() {
2868
4355
  console.error("Usage: node bridge-entry.js --config <path-to-config.json>");
2869
4356
  process.exit(1);
2870
4357
  }
2871
- const configPath2 = (0, import_path18.resolve)(process.argv[configIdx + 1]);
2872
- const home = (0, import_os3.homedir)();
4358
+ const configPath2 = (0, import_path30.resolve)(process.argv[configIdx + 1]);
4359
+ const home = (0, import_os7.homedir)();
2873
4360
  const claudeConfigDir = getCopilotConfigDir();
2874
4361
  if (!validateConfigPath(configPath2, home, claudeConfigDir)) {
2875
4362
  console.error(`Config path must be under ~/ with ${claudeConfigDir} or ~/.omg/ subpath: ${configPath2}`);
@@ -2877,7 +4364,7 @@ function main() {
2877
4364
  }
2878
4365
  let config;
2879
4366
  try {
2880
- const raw = (0, import_fs18.readFileSync)(configPath2, "utf-8");
4367
+ const raw = (0, import_fs28.readFileSync)(configPath2, "utf-8");
2881
4368
  config = JSON.parse(raw);
2882
4369
  } catch (err) {
2883
4370
  console.error(`Failed to read config from ${configPath2}: ${err.message}`);