oh-my-codex-pennix 0.18.13

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 (3061) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/Cargo.lock +185 -0
  3. package/Cargo.toml +24 -0
  4. package/README.md +445 -0
  5. package/crates/omx-api/Cargo.toml +19 -0
  6. package/crates/omx-api/src/lib.rs +2997 -0
  7. package/crates/omx-api/src/main.rs +10 -0
  8. package/crates/omx-api/tests/cli.rs +558 -0
  9. package/crates/omx-explore/Cargo.toml +14 -0
  10. package/crates/omx-explore/src/main.rs +2972 -0
  11. package/crates/omx-mux/Cargo.toml +11 -0
  12. package/crates/omx-mux/src/lib.rs +91 -0
  13. package/crates/omx-mux/src/tmux.rs +282 -0
  14. package/crates/omx-mux/src/types.rs +306 -0
  15. package/crates/omx-runtime/Cargo.toml +13 -0
  16. package/crates/omx-runtime/src/main.rs +125 -0
  17. package/crates/omx-runtime/tests/execution.rs +212 -0
  18. package/crates/omx-runtime-core/Cargo.toml +13 -0
  19. package/crates/omx-runtime-core/src/authority.rs +239 -0
  20. package/crates/omx-runtime-core/src/dispatch.rs +330 -0
  21. package/crates/omx-runtime-core/src/engine.rs +853 -0
  22. package/crates/omx-runtime-core/src/lib.rs +653 -0
  23. package/crates/omx-runtime-core/src/mailbox.rs +261 -0
  24. package/crates/omx-runtime-core/src/replay.rs +104 -0
  25. package/crates/omx-sparkshell/Cargo.lock +7 -0
  26. package/crates/omx-sparkshell/Cargo.toml +14 -0
  27. package/crates/omx-sparkshell/src/codex_bridge.rs +768 -0
  28. package/crates/omx-sparkshell/src/error.rs +45 -0
  29. package/crates/omx-sparkshell/src/exec.rs +241 -0
  30. package/crates/omx-sparkshell/src/main.rs +1133 -0
  31. package/crates/omx-sparkshell/src/prompt.rs +364 -0
  32. package/crates/omx-sparkshell/src/redaction.rs +241 -0
  33. package/crates/omx-sparkshell/src/registry/c_cpp.rs +9 -0
  34. package/crates/omx-sparkshell/src/registry/csharp.rs +10 -0
  35. package/crates/omx-sparkshell/src/registry/generic_shell.rs +11 -0
  36. package/crates/omx-sparkshell/src/registry/git.rs +10 -0
  37. package/crates/omx-sparkshell/src/registry/go.rs +9 -0
  38. package/crates/omx-sparkshell/src/registry/java_kotlin.rs +9 -0
  39. package/crates/omx-sparkshell/src/registry/mod.rs +85 -0
  40. package/crates/omx-sparkshell/src/registry/node_js.rs +9 -0
  41. package/crates/omx-sparkshell/src/registry/python.rs +9 -0
  42. package/crates/omx-sparkshell/src/registry/ruby.rs +9 -0
  43. package/crates/omx-sparkshell/src/registry/rust.rs +9 -0
  44. package/crates/omx-sparkshell/src/registry/swift.rs +10 -0
  45. package/crates/omx-sparkshell/src/test_support.rs +10 -0
  46. package/crates/omx-sparkshell/src/threshold.rs +75 -0
  47. package/crates/omx-sparkshell/tests/execution.rs +986 -0
  48. package/crates/omx-sparkshell/tests/registry.rs +99 -0
  49. package/dist/adapt/__tests__/foundation.test.d.ts +2 -0
  50. package/dist/adapt/__tests__/foundation.test.d.ts.map +1 -0
  51. package/dist/adapt/__tests__/foundation.test.js +171 -0
  52. package/dist/adapt/__tests__/foundation.test.js.map +1 -0
  53. package/dist/adapt/__tests__/hermes.test.d.ts +2 -0
  54. package/dist/adapt/__tests__/hermes.test.d.ts.map +1 -0
  55. package/dist/adapt/__tests__/hermes.test.js +137 -0
  56. package/dist/adapt/__tests__/hermes.test.js.map +1 -0
  57. package/dist/adapt/contracts.d.ts +157 -0
  58. package/dist/adapt/contracts.d.ts.map +1 -0
  59. package/dist/adapt/contracts.js +10 -0
  60. package/dist/adapt/contracts.js.map +1 -0
  61. package/dist/adapt/hermes.d.ts +83 -0
  62. package/dist/adapt/hermes.d.ts.map +1 -0
  63. package/dist/adapt/hermes.js +371 -0
  64. package/dist/adapt/hermes.js.map +1 -0
  65. package/dist/adapt/index.d.ts +14 -0
  66. package/dist/adapt/index.d.ts.map +1 -0
  67. package/dist/adapt/index.js +293 -0
  68. package/dist/adapt/index.js.map +1 -0
  69. package/dist/adapt/openclaw.d.ts +7 -0
  70. package/dist/adapt/openclaw.d.ts.map +1 -0
  71. package/dist/adapt/openclaw.js +299 -0
  72. package/dist/adapt/openclaw.js.map +1 -0
  73. package/dist/adapt/paths.d.ts +3 -0
  74. package/dist/adapt/paths.d.ts.map +1 -0
  75. package/dist/adapt/paths.js +15 -0
  76. package/dist/adapt/paths.js.map +1 -0
  77. package/dist/adapt/registry.d.ts +4 -0
  78. package/dist/adapt/registry.d.ts.map +1 -0
  79. package/dist/adapt/registry.js +48 -0
  80. package/dist/adapt/registry.js.map +1 -0
  81. package/dist/agents/__tests__/definitions.test.d.ts +2 -0
  82. package/dist/agents/__tests__/definitions.test.d.ts.map +1 -0
  83. package/dist/agents/__tests__/definitions.test.js +96 -0
  84. package/dist/agents/__tests__/definitions.test.js.map +1 -0
  85. package/dist/agents/__tests__/native-config.test.d.ts +2 -0
  86. package/dist/agents/__tests__/native-config.test.d.ts.map +1 -0
  87. package/dist/agents/__tests__/native-config.test.js +398 -0
  88. package/dist/agents/__tests__/native-config.test.js.map +1 -0
  89. package/dist/agents/definitions.d.ts +35 -0
  90. package/dist/agents/definitions.d.ts.map +1 -0
  91. package/dist/agents/definitions.js +371 -0
  92. package/dist/agents/definitions.js.map +1 -0
  93. package/dist/agents/native-config.d.ts +56 -0
  94. package/dist/agents/native-config.d.ts.map +1 -0
  95. package/dist/agents/native-config.js +285 -0
  96. package/dist/agents/native-config.js.map +1 -0
  97. package/dist/agents/policy.d.ts +10 -0
  98. package/dist/agents/policy.d.ts.map +1 -0
  99. package/dist/agents/policy.js +61 -0
  100. package/dist/agents/policy.js.map +1 -0
  101. package/dist/auth/__tests__/config-sessions.test.d.ts +2 -0
  102. package/dist/auth/__tests__/config-sessions.test.d.ts.map +1 -0
  103. package/dist/auth/__tests__/config-sessions.test.js +48 -0
  104. package/dist/auth/__tests__/config-sessions.test.js.map +1 -0
  105. package/dist/auth/__tests__/quota-rotation.test.d.ts +2 -0
  106. package/dist/auth/__tests__/quota-rotation.test.d.ts.map +1 -0
  107. package/dist/auth/__tests__/quota-rotation.test.js +33 -0
  108. package/dist/auth/__tests__/quota-rotation.test.js.map +1 -0
  109. package/dist/auth/__tests__/redact.test.d.ts +2 -0
  110. package/dist/auth/__tests__/redact.test.d.ts.map +1 -0
  111. package/dist/auth/__tests__/redact.test.js +20 -0
  112. package/dist/auth/__tests__/redact.test.js.map +1 -0
  113. package/dist/auth/__tests__/storage.test.d.ts +2 -0
  114. package/dist/auth/__tests__/storage.test.d.ts.map +1 -0
  115. package/dist/auth/__tests__/storage.test.js +108 -0
  116. package/dist/auth/__tests__/storage.test.js.map +1 -0
  117. package/dist/auth/config.d.ts +9 -0
  118. package/dist/auth/config.d.ts.map +1 -0
  119. package/dist/auth/config.js +77 -0
  120. package/dist/auth/config.js.map +1 -0
  121. package/dist/auth/hotswap.d.ts +36 -0
  122. package/dist/auth/hotswap.d.ts.map +1 -0
  123. package/dist/auth/hotswap.js +159 -0
  124. package/dist/auth/hotswap.js.map +1 -0
  125. package/dist/auth/index.d.ts +8 -0
  126. package/dist/auth/index.d.ts.map +1 -0
  127. package/dist/auth/index.js +8 -0
  128. package/dist/auth/index.js.map +1 -0
  129. package/dist/auth/paths.d.ts +12 -0
  130. package/dist/auth/paths.d.ts.map +1 -0
  131. package/dist/auth/paths.js +78 -0
  132. package/dist/auth/paths.js.map +1 -0
  133. package/dist/auth/quota-detector.d.ts +10 -0
  134. package/dist/auth/quota-detector.d.ts.map +1 -0
  135. package/dist/auth/quota-detector.js +40 -0
  136. package/dist/auth/quota-detector.js.map +1 -0
  137. package/dist/auth/redact.d.ts +2 -0
  138. package/dist/auth/redact.d.ts.map +1 -0
  139. package/dist/auth/redact.js +26 -0
  140. package/dist/auth/redact.js.map +1 -0
  141. package/dist/auth/rotation.d.ts +9 -0
  142. package/dist/auth/rotation.d.ts.map +1 -0
  143. package/dist/auth/rotation.js +26 -0
  144. package/dist/auth/rotation.js.map +1 -0
  145. package/dist/auth/sessions.d.ts +15 -0
  146. package/dist/auth/sessions.d.ts.map +1 -0
  147. package/dist/auth/sessions.js +62 -0
  148. package/dist/auth/sessions.js.map +1 -0
  149. package/dist/auth/storage.d.ts +27 -0
  150. package/dist/auth/storage.d.ts.map +1 -0
  151. package/dist/auth/storage.js +111 -0
  152. package/dist/auth/storage.js.map +1 -0
  153. package/dist/autopilot/__tests__/deep-interview-gate.test.d.ts +2 -0
  154. package/dist/autopilot/__tests__/deep-interview-gate.test.d.ts.map +1 -0
  155. package/dist/autopilot/__tests__/deep-interview-gate.test.js +215 -0
  156. package/dist/autopilot/__tests__/deep-interview-gate.test.js.map +1 -0
  157. package/dist/autopilot/__tests__/fsm.test.d.ts +2 -0
  158. package/dist/autopilot/__tests__/fsm.test.d.ts.map +1 -0
  159. package/dist/autopilot/__tests__/fsm.test.js +78 -0
  160. package/dist/autopilot/__tests__/fsm.test.js.map +1 -0
  161. package/dist/autopilot/__tests__/ralplan-gate.test.d.ts +2 -0
  162. package/dist/autopilot/__tests__/ralplan-gate.test.d.ts.map +1 -0
  163. package/dist/autopilot/__tests__/ralplan-gate.test.js +274 -0
  164. package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -0
  165. package/dist/autopilot/completion-gate.d.ts +10 -0
  166. package/dist/autopilot/completion-gate.d.ts.map +1 -0
  167. package/dist/autopilot/completion-gate.js +154 -0
  168. package/dist/autopilot/completion-gate.js.map +1 -0
  169. package/dist/autopilot/deep-interview-gate.d.ts +18 -0
  170. package/dist/autopilot/deep-interview-gate.d.ts.map +1 -0
  171. package/dist/autopilot/deep-interview-gate.js +396 -0
  172. package/dist/autopilot/deep-interview-gate.js.map +1 -0
  173. package/dist/autopilot/fsm.d.ts +13 -0
  174. package/dist/autopilot/fsm.d.ts.map +1 -0
  175. package/dist/autopilot/fsm.js +70 -0
  176. package/dist/autopilot/fsm.js.map +1 -0
  177. package/dist/autopilot/ralplan-gate.d.ts +17 -0
  178. package/dist/autopilot/ralplan-gate.d.ts.map +1 -0
  179. package/dist/autopilot/ralplan-gate.js +68 -0
  180. package/dist/autopilot/ralplan-gate.js.map +1 -0
  181. package/dist/autoresearch/__tests__/contracts.test.d.ts +2 -0
  182. package/dist/autoresearch/__tests__/contracts.test.d.ts.map +1 -0
  183. package/dist/autoresearch/__tests__/contracts.test.js +127 -0
  184. package/dist/autoresearch/__tests__/contracts.test.js.map +1 -0
  185. package/dist/autoresearch/__tests__/runtime-parity-extra.test.d.ts +2 -0
  186. package/dist/autoresearch/__tests__/runtime-parity-extra.test.d.ts.map +1 -0
  187. package/dist/autoresearch/__tests__/runtime-parity-extra.test.js +349 -0
  188. package/dist/autoresearch/__tests__/runtime-parity-extra.test.js.map +1 -0
  189. package/dist/autoresearch/__tests__/runtime.test.d.ts +2 -0
  190. package/dist/autoresearch/__tests__/runtime.test.d.ts.map +1 -0
  191. package/dist/autoresearch/__tests__/runtime.test.js +211 -0
  192. package/dist/autoresearch/__tests__/runtime.test.js.map +1 -0
  193. package/dist/autoresearch/__tests__/skill-validation.test.d.ts +2 -0
  194. package/dist/autoresearch/__tests__/skill-validation.test.d.ts.map +1 -0
  195. package/dist/autoresearch/__tests__/skill-validation.test.js +91 -0
  196. package/dist/autoresearch/__tests__/skill-validation.test.js.map +1 -0
  197. package/dist/autoresearch/contracts.d.ts +31 -0
  198. package/dist/autoresearch/contracts.d.ts.map +1 -0
  199. package/dist/autoresearch/contracts.js +197 -0
  200. package/dist/autoresearch/contracts.js.map +1 -0
  201. package/dist/autoresearch/goal.d.ts +90 -0
  202. package/dist/autoresearch/goal.d.ts.map +1 -0
  203. package/dist/autoresearch/goal.js +237 -0
  204. package/dist/autoresearch/goal.js.map +1 -0
  205. package/dist/autoresearch/runtime.d.ts +132 -0
  206. package/dist/autoresearch/runtime.d.ts.map +1 -0
  207. package/dist/autoresearch/runtime.js +1022 -0
  208. package/dist/autoresearch/runtime.js.map +1 -0
  209. package/dist/autoresearch/skill-validation.d.ts +14 -0
  210. package/dist/autoresearch/skill-validation.d.ts.map +1 -0
  211. package/dist/autoresearch/skill-validation.js +172 -0
  212. package/dist/autoresearch/skill-validation.js.map +1 -0
  213. package/dist/catalog/__tests__/generator.test.d.ts +2 -0
  214. package/dist/catalog/__tests__/generator.test.d.ts.map +1 -0
  215. package/dist/catalog/__tests__/generator.test.js +60 -0
  216. package/dist/catalog/__tests__/generator.test.js.map +1 -0
  217. package/dist/catalog/__tests__/plugin-bundle-ssot.test.d.ts +2 -0
  218. package/dist/catalog/__tests__/plugin-bundle-ssot.test.d.ts.map +1 -0
  219. package/dist/catalog/__tests__/plugin-bundle-ssot.test.js +108 -0
  220. package/dist/catalog/__tests__/plugin-bundle-ssot.test.js.map +1 -0
  221. package/dist/catalog/__tests__/schema.test.d.ts +2 -0
  222. package/dist/catalog/__tests__/schema.test.d.ts.map +1 -0
  223. package/dist/catalog/__tests__/schema.test.js +84 -0
  224. package/dist/catalog/__tests__/schema.test.js.map +1 -0
  225. package/dist/catalog/installable.d.ts +5 -0
  226. package/dist/catalog/installable.d.ts.map +1 -0
  227. package/dist/catalog/installable.js +13 -0
  228. package/dist/catalog/installable.js.map +1 -0
  229. package/dist/catalog/reader.d.ts +19 -0
  230. package/dist/catalog/reader.d.ts.map +1 -0
  231. package/dist/catalog/reader.js +63 -0
  232. package/dist/catalog/reader.js.map +1 -0
  233. package/dist/catalog/schema.d.ts +32 -0
  234. package/dist/catalog/schema.d.ts.map +1 -0
  235. package/dist/catalog/schema.js +107 -0
  236. package/dist/catalog/schema.js.map +1 -0
  237. package/dist/catalog/skill-mirror.d.ts +20 -0
  238. package/dist/catalog/skill-mirror.d.ts.map +1 -0
  239. package/dist/catalog/skill-mirror.js +104 -0
  240. package/dist/catalog/skill-mirror.js.map +1 -0
  241. package/dist/cli/__tests__/adapt-help.test.d.ts +2 -0
  242. package/dist/cli/__tests__/adapt-help.test.d.ts.map +1 -0
  243. package/dist/cli/__tests__/adapt-help.test.js +39 -0
  244. package/dist/cli/__tests__/adapt-help.test.js.map +1 -0
  245. package/dist/cli/__tests__/adapt.test.d.ts +2 -0
  246. package/dist/cli/__tests__/adapt.test.d.ts.map +1 -0
  247. package/dist/cli/__tests__/adapt.test.js +62 -0
  248. package/dist/cli/__tests__/adapt.test.js.map +1 -0
  249. package/dist/cli/__tests__/agents-init.test.d.ts +2 -0
  250. package/dist/cli/__tests__/agents-init.test.d.ts.map +1 -0
  251. package/dist/cli/__tests__/agents-init.test.js +184 -0
  252. package/dist/cli/__tests__/agents-init.test.js.map +1 -0
  253. package/dist/cli/__tests__/agents.test.d.ts +2 -0
  254. package/dist/cli/__tests__/agents.test.d.ts.map +1 -0
  255. package/dist/cli/__tests__/agents.test.js +137 -0
  256. package/dist/cli/__tests__/agents.test.js.map +1 -0
  257. package/dist/cli/__tests__/api.test.d.ts +2 -0
  258. package/dist/cli/__tests__/api.test.d.ts.map +1 -0
  259. package/dist/cli/__tests__/api.test.js +175 -0
  260. package/dist/cli/__tests__/api.test.js.map +1 -0
  261. package/dist/cli/__tests__/ask.test.d.ts +2 -0
  262. package/dist/cli/__tests__/ask.test.d.ts.map +1 -0
  263. package/dist/cli/__tests__/ask.test.js +332 -0
  264. package/dist/cli/__tests__/ask.test.js.map +1 -0
  265. package/dist/cli/__tests__/auth.test.d.ts +2 -0
  266. package/dist/cli/__tests__/auth.test.d.ts.map +1 -0
  267. package/dist/cli/__tests__/auth.test.js +203 -0
  268. package/dist/cli/__tests__/auth.test.js.map +1 -0
  269. package/dist/cli/__tests__/autoresearch-goal.test.d.ts +2 -0
  270. package/dist/cli/__tests__/autoresearch-goal.test.d.ts.map +1 -0
  271. package/dist/cli/__tests__/autoresearch-goal.test.js +207 -0
  272. package/dist/cli/__tests__/autoresearch-goal.test.js.map +1 -0
  273. package/dist/cli/__tests__/autoresearch-guided.test.d.ts +2 -0
  274. package/dist/cli/__tests__/autoresearch-guided.test.d.ts.map +1 -0
  275. package/dist/cli/__tests__/autoresearch-guided.test.js +365 -0
  276. package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -0
  277. package/dist/cli/__tests__/autoresearch.test.d.ts +2 -0
  278. package/dist/cli/__tests__/autoresearch.test.d.ts.map +1 -0
  279. package/dist/cli/__tests__/autoresearch.test.js +155 -0
  280. package/dist/cli/__tests__/autoresearch.test.js.map +1 -0
  281. package/dist/cli/__tests__/catalog-contract.test.d.ts +2 -0
  282. package/dist/cli/__tests__/catalog-contract.test.d.ts.map +1 -0
  283. package/dist/cli/__tests__/catalog-contract.test.js +18 -0
  284. package/dist/cli/__tests__/catalog-contract.test.js.map +1 -0
  285. package/dist/cli/__tests__/cleanup.test.d.ts +2 -0
  286. package/dist/cli/__tests__/cleanup.test.d.ts.map +1 -0
  287. package/dist/cli/__tests__/cleanup.test.js +527 -0
  288. package/dist/cli/__tests__/cleanup.test.js.map +1 -0
  289. package/dist/cli/__tests__/codex-feature-probe.test.d.ts +2 -0
  290. package/dist/cli/__tests__/codex-feature-probe.test.d.ts.map +1 -0
  291. package/dist/cli/__tests__/codex-feature-probe.test.js +46 -0
  292. package/dist/cli/__tests__/codex-feature-probe.test.js.map +1 -0
  293. package/dist/cli/__tests__/codex-plugin-layout.test.d.ts +2 -0
  294. package/dist/cli/__tests__/codex-plugin-layout.test.d.ts.map +1 -0
  295. package/dist/cli/__tests__/codex-plugin-layout.test.js +778 -0
  296. package/dist/cli/__tests__/codex-plugin-layout.test.js.map +1 -0
  297. package/dist/cli/__tests__/doctor-context-window-warning.test.d.ts +2 -0
  298. package/dist/cli/__tests__/doctor-context-window-warning.test.d.ts.map +1 -0
  299. package/dist/cli/__tests__/doctor-context-window-warning.test.js +122 -0
  300. package/dist/cli/__tests__/doctor-context-window-warning.test.js.map +1 -0
  301. package/dist/cli/__tests__/doctor-invalid-config.test.d.ts +2 -0
  302. package/dist/cli/__tests__/doctor-invalid-config.test.d.ts.map +1 -0
  303. package/dist/cli/__tests__/doctor-invalid-config.test.js +52 -0
  304. package/dist/cli/__tests__/doctor-invalid-config.test.js.map +1 -0
  305. package/dist/cli/__tests__/doctor-spark-routing.test.d.ts +2 -0
  306. package/dist/cli/__tests__/doctor-spark-routing.test.d.ts.map +1 -0
  307. package/dist/cli/__tests__/doctor-spark-routing.test.js +79 -0
  308. package/dist/cli/__tests__/doctor-spark-routing.test.js.map +1 -0
  309. package/dist/cli/__tests__/doctor-team.test.d.ts +2 -0
  310. package/dist/cli/__tests__/doctor-team.test.d.ts.map +1 -0
  311. package/dist/cli/__tests__/doctor-team.test.js +299 -0
  312. package/dist/cli/__tests__/doctor-team.test.js.map +1 -0
  313. package/dist/cli/__tests__/doctor-warning-copy.test.d.ts +2 -0
  314. package/dist/cli/__tests__/doctor-warning-copy.test.d.ts.map +1 -0
  315. package/dist/cli/__tests__/doctor-warning-copy.test.js +1312 -0
  316. package/dist/cli/__tests__/doctor-warning-copy.test.js.map +1 -0
  317. package/dist/cli/__tests__/error-handling-warnings.test.d.ts +2 -0
  318. package/dist/cli/__tests__/error-handling-warnings.test.d.ts.map +1 -0
  319. package/dist/cli/__tests__/error-handling-warnings.test.js +52 -0
  320. package/dist/cli/__tests__/error-handling-warnings.test.js.map +1 -0
  321. package/dist/cli/__tests__/exec.test.d.ts +2 -0
  322. package/dist/cli/__tests__/exec.test.d.ts.map +1 -0
  323. package/dist/cli/__tests__/exec.test.js +213 -0
  324. package/dist/cli/__tests__/exec.test.js.map +1 -0
  325. package/dist/cli/__tests__/explore-windows-diagnostics.test.d.ts +2 -0
  326. package/dist/cli/__tests__/explore-windows-diagnostics.test.d.ts.map +1 -0
  327. package/dist/cli/__tests__/explore-windows-diagnostics.test.js +17 -0
  328. package/dist/cli/__tests__/explore-windows-diagnostics.test.js.map +1 -0
  329. package/dist/cli/__tests__/explore.test.d.ts +2 -0
  330. package/dist/cli/__tests__/explore.test.d.ts.map +1 -0
  331. package/dist/cli/__tests__/explore.test.js +104 -0
  332. package/dist/cli/__tests__/explore.test.js.map +1 -0
  333. package/dist/cli/__tests__/hooks.test.d.ts +2 -0
  334. package/dist/cli/__tests__/hooks.test.d.ts.map +1 -0
  335. package/dist/cli/__tests__/hooks.test.js +55 -0
  336. package/dist/cli/__tests__/hooks.test.js.map +1 -0
  337. package/dist/cli/__tests__/imagegen-continuation.test.d.ts +2 -0
  338. package/dist/cli/__tests__/imagegen-continuation.test.d.ts.map +1 -0
  339. package/dist/cli/__tests__/imagegen-continuation.test.js +135 -0
  340. package/dist/cli/__tests__/imagegen-continuation.test.js.map +1 -0
  341. package/dist/cli/__tests__/index.test.d.ts +2 -0
  342. package/dist/cli/__tests__/index.test.d.ts.map +1 -0
  343. package/dist/cli/__tests__/index.test.js +3619 -0
  344. package/dist/cli/__tests__/index.test.js.map +1 -0
  345. package/dist/cli/__tests__/install-docs-contract.test.d.ts +2 -0
  346. package/dist/cli/__tests__/install-docs-contract.test.d.ts.map +1 -0
  347. package/dist/cli/__tests__/install-docs-contract.test.js +55 -0
  348. package/dist/cli/__tests__/install-docs-contract.test.js.map +1 -0
  349. package/dist/cli/__tests__/launch-fallback.test.d.ts +2 -0
  350. package/dist/cli/__tests__/launch-fallback.test.d.ts.map +1 -0
  351. package/dist/cli/__tests__/launch-fallback.test.js +1285 -0
  352. package/dist/cli/__tests__/launch-fallback.test.js.map +1 -0
  353. package/dist/cli/__tests__/lifecycle-notifications.test.d.ts +2 -0
  354. package/dist/cli/__tests__/lifecycle-notifications.test.d.ts.map +1 -0
  355. package/dist/cli/__tests__/lifecycle-notifications.test.js +48 -0
  356. package/dist/cli/__tests__/lifecycle-notifications.test.js.map +1 -0
  357. package/dist/cli/__tests__/list.test.d.ts +2 -0
  358. package/dist/cli/__tests__/list.test.d.ts.map +1 -0
  359. package/dist/cli/__tests__/list.test.js +38 -0
  360. package/dist/cli/__tests__/list.test.js.map +1 -0
  361. package/dist/cli/__tests__/mcp-parity.test.d.ts +2 -0
  362. package/dist/cli/__tests__/mcp-parity.test.d.ts.map +1 -0
  363. package/dist/cli/__tests__/mcp-parity.test.js +228 -0
  364. package/dist/cli/__tests__/mcp-parity.test.js.map +1 -0
  365. package/dist/cli/__tests__/mcp-serve.test.d.ts +2 -0
  366. package/dist/cli/__tests__/mcp-serve.test.d.ts.map +1 -0
  367. package/dist/cli/__tests__/mcp-serve.test.js +68 -0
  368. package/dist/cli/__tests__/mcp-serve.test.js.map +1 -0
  369. package/dist/cli/__tests__/native-assets.test.d.ts +2 -0
  370. package/dist/cli/__tests__/native-assets.test.d.ts.map +1 -0
  371. package/dist/cli/__tests__/native-assets.test.js +296 -0
  372. package/dist/cli/__tests__/native-assets.test.js.map +1 -0
  373. package/dist/cli/__tests__/native-hook-dispatch-contract.test.d.ts +2 -0
  374. package/dist/cli/__tests__/native-hook-dispatch-contract.test.d.ts.map +1 -0
  375. package/dist/cli/__tests__/native-hook-dispatch-contract.test.js +11 -0
  376. package/dist/cli/__tests__/native-hook-dispatch-contract.test.js.map +1 -0
  377. package/dist/cli/__tests__/nested-help-routing.test.d.ts +2 -0
  378. package/dist/cli/__tests__/nested-help-routing.test.d.ts.map +1 -0
  379. package/dist/cli/__tests__/nested-help-routing.test.js +63 -0
  380. package/dist/cli/__tests__/nested-help-routing.test.js.map +1 -0
  381. package/dist/cli/__tests__/package-bin-contract.test.d.ts +2 -0
  382. package/dist/cli/__tests__/package-bin-contract.test.d.ts.map +1 -0
  383. package/dist/cli/__tests__/package-bin-contract.test.js +190 -0
  384. package/dist/cli/__tests__/package-bin-contract.test.js.map +1 -0
  385. package/dist/cli/__tests__/packaged-explore-harness-lock.d.ts +3 -0
  386. package/dist/cli/__tests__/packaged-explore-harness-lock.d.ts.map +1 -0
  387. package/dist/cli/__tests__/packaged-explore-harness-lock.js +67 -0
  388. package/dist/cli/__tests__/packaged-explore-harness-lock.js.map +1 -0
  389. package/dist/cli/__tests__/packaged-script-resolution.test.d.ts +2 -0
  390. package/dist/cli/__tests__/packaged-script-resolution.test.d.ts.map +1 -0
  391. package/dist/cli/__tests__/packaged-script-resolution.test.js +19 -0
  392. package/dist/cli/__tests__/packaged-script-resolution.test.js.map +1 -0
  393. package/dist/cli/__tests__/performance-goal.test.d.ts +2 -0
  394. package/dist/cli/__tests__/performance-goal.test.d.ts.map +1 -0
  395. package/dist/cli/__tests__/performance-goal.test.js +144 -0
  396. package/dist/cli/__tests__/performance-goal.test.js.map +1 -0
  397. package/dist/cli/__tests__/prompt-skill-sanitization.test.d.ts +2 -0
  398. package/dist/cli/__tests__/prompt-skill-sanitization.test.d.ts.map +1 -0
  399. package/dist/cli/__tests__/prompt-skill-sanitization.test.js +48 -0
  400. package/dist/cli/__tests__/prompt-skill-sanitization.test.js.map +1 -0
  401. package/dist/cli/__tests__/question.test.d.ts +2 -0
  402. package/dist/cli/__tests__/question.test.d.ts.map +1 -0
  403. package/dist/cli/__tests__/question.test.js +850 -0
  404. package/dist/cli/__tests__/question.test.js.map +1 -0
  405. package/dist/cli/__tests__/ralph-deslop-contract.test.d.ts +2 -0
  406. package/dist/cli/__tests__/ralph-deslop-contract.test.d.ts.map +1 -0
  407. package/dist/cli/__tests__/ralph-deslop-contract.test.js +28 -0
  408. package/dist/cli/__tests__/ralph-deslop-contract.test.js.map +1 -0
  409. package/dist/cli/__tests__/ralph-goal-mode-contract.test.d.ts +2 -0
  410. package/dist/cli/__tests__/ralph-goal-mode-contract.test.d.ts.map +1 -0
  411. package/dist/cli/__tests__/ralph-goal-mode-contract.test.js +49 -0
  412. package/dist/cli/__tests__/ralph-goal-mode-contract.test.js.map +1 -0
  413. package/dist/cli/__tests__/ralph-prd-deep-interview.test.d.ts +2 -0
  414. package/dist/cli/__tests__/ralph-prd-deep-interview.test.d.ts.map +1 -0
  415. package/dist/cli/__tests__/ralph-prd-deep-interview.test.js +25 -0
  416. package/dist/cli/__tests__/ralph-prd-deep-interview.test.js.map +1 -0
  417. package/dist/cli/__tests__/ralph-prd-smoke.test.d.ts +2 -0
  418. package/dist/cli/__tests__/ralph-prd-smoke.test.d.ts.map +1 -0
  419. package/dist/cli/__tests__/ralph-prd-smoke.test.js +174 -0
  420. package/dist/cli/__tests__/ralph-prd-smoke.test.js.map +1 -0
  421. package/dist/cli/__tests__/ralph.test.d.ts +2 -0
  422. package/dist/cli/__tests__/ralph.test.d.ts.map +1 -0
  423. package/dist/cli/__tests__/ralph.test.js +256 -0
  424. package/dist/cli/__tests__/ralph.test.js.map +1 -0
  425. package/dist/cli/__tests__/resume.test.d.ts +2 -0
  426. package/dist/cli/__tests__/resume.test.d.ts.map +1 -0
  427. package/dist/cli/__tests__/resume.test.js +133 -0
  428. package/dist/cli/__tests__/resume.test.js.map +1 -0
  429. package/dist/cli/__tests__/session-scoped-runtime.test.d.ts +2 -0
  430. package/dist/cli/__tests__/session-scoped-runtime.test.d.ts.map +1 -0
  431. package/dist/cli/__tests__/session-scoped-runtime.test.js +247 -0
  432. package/dist/cli/__tests__/session-scoped-runtime.test.js.map +1 -0
  433. package/dist/cli/__tests__/session-search-help.test.d.ts +2 -0
  434. package/dist/cli/__tests__/session-search-help.test.d.ts.map +1 -0
  435. package/dist/cli/__tests__/session-search-help.test.js +37 -0
  436. package/dist/cli/__tests__/session-search-help.test.js.map +1 -0
  437. package/dist/cli/__tests__/session-search.test.d.ts +2 -0
  438. package/dist/cli/__tests__/session-search.test.d.ts.map +1 -0
  439. package/dist/cli/__tests__/session-search.test.js +77 -0
  440. package/dist/cli/__tests__/session-search.test.js.map +1 -0
  441. package/dist/cli/__tests__/setup-agents-overwrite.test.d.ts +2 -0
  442. package/dist/cli/__tests__/setup-agents-overwrite.test.d.ts.map +1 -0
  443. package/dist/cli/__tests__/setup-agents-overwrite.test.js +776 -0
  444. package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -0
  445. package/dist/cli/__tests__/setup-gh-star.test.d.ts +2 -0
  446. package/dist/cli/__tests__/setup-gh-star.test.d.ts.map +1 -0
  447. package/dist/cli/__tests__/setup-gh-star.test.js +67 -0
  448. package/dist/cli/__tests__/setup-gh-star.test.js.map +1 -0
  449. package/dist/cli/__tests__/setup-hooks-shared-ownership.test.d.ts +2 -0
  450. package/dist/cli/__tests__/setup-hooks-shared-ownership.test.d.ts.map +1 -0
  451. package/dist/cli/__tests__/setup-hooks-shared-ownership.test.js +202 -0
  452. package/dist/cli/__tests__/setup-hooks-shared-ownership.test.js.map +1 -0
  453. package/dist/cli/__tests__/setup-install-mode.test.d.ts +2 -0
  454. package/dist/cli/__tests__/setup-install-mode.test.d.ts.map +1 -0
  455. package/dist/cli/__tests__/setup-install-mode.test.js +2103 -0
  456. package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -0
  457. package/dist/cli/__tests__/setup-prompts-overwrite.test.d.ts +2 -0
  458. package/dist/cli/__tests__/setup-prompts-overwrite.test.d.ts.map +1 -0
  459. package/dist/cli/__tests__/setup-prompts-overwrite.test.js +191 -0
  460. package/dist/cli/__tests__/setup-prompts-overwrite.test.js.map +1 -0
  461. package/dist/cli/__tests__/setup-refresh.test.d.ts +2 -0
  462. package/dist/cli/__tests__/setup-refresh.test.d.ts.map +1 -0
  463. package/dist/cli/__tests__/setup-refresh.test.js +779 -0
  464. package/dist/cli/__tests__/setup-refresh.test.js.map +1 -0
  465. package/dist/cli/__tests__/setup-scope.test.d.ts +2 -0
  466. package/dist/cli/__tests__/setup-scope.test.d.ts.map +1 -0
  467. package/dist/cli/__tests__/setup-scope.test.js +367 -0
  468. package/dist/cli/__tests__/setup-scope.test.js.map +1 -0
  469. package/dist/cli/__tests__/setup-skill-validation.test.d.ts +2 -0
  470. package/dist/cli/__tests__/setup-skill-validation.test.d.ts.map +1 -0
  471. package/dist/cli/__tests__/setup-skill-validation.test.js +44 -0
  472. package/dist/cli/__tests__/setup-skill-validation.test.js.map +1 -0
  473. package/dist/cli/__tests__/setup-skills-overwrite.test.d.ts +2 -0
  474. package/dist/cli/__tests__/setup-skills-overwrite.test.d.ts.map +1 -0
  475. package/dist/cli/__tests__/setup-skills-overwrite.test.js +292 -0
  476. package/dist/cli/__tests__/setup-skills-overwrite.test.js.map +1 -0
  477. package/dist/cli/__tests__/sidecar.test.d.ts +2 -0
  478. package/dist/cli/__tests__/sidecar.test.d.ts.map +1 -0
  479. package/dist/cli/__tests__/sidecar.test.js +24 -0
  480. package/dist/cli/__tests__/sidecar.test.js.map +1 -0
  481. package/dist/cli/__tests__/sparkshell-cli.test.d.ts +2 -0
  482. package/dist/cli/__tests__/sparkshell-cli.test.d.ts.map +1 -0
  483. package/dist/cli/__tests__/sparkshell-cli.test.js +471 -0
  484. package/dist/cli/__tests__/sparkshell-cli.test.js.map +1 -0
  485. package/dist/cli/__tests__/sparkshell-packaging.test.d.ts +2 -0
  486. package/dist/cli/__tests__/sparkshell-packaging.test.d.ts.map +1 -0
  487. package/dist/cli/__tests__/sparkshell-packaging.test.js +105 -0
  488. package/dist/cli/__tests__/sparkshell-packaging.test.js.map +1 -0
  489. package/dist/cli/__tests__/star-prompt.test.d.ts +2 -0
  490. package/dist/cli/__tests__/star-prompt.test.d.ts.map +1 -0
  491. package/dist/cli/__tests__/star-prompt.test.js +172 -0
  492. package/dist/cli/__tests__/star-prompt.test.js.map +1 -0
  493. package/dist/cli/__tests__/state.test.d.ts +2 -0
  494. package/dist/cli/__tests__/state.test.d.ts.map +1 -0
  495. package/dist/cli/__tests__/state.test.js +160 -0
  496. package/dist/cli/__tests__/state.test.js.map +1 -0
  497. package/dist/cli/__tests__/team-decompose.test.d.ts +2 -0
  498. package/dist/cli/__tests__/team-decompose.test.d.ts.map +1 -0
  499. package/dist/cli/__tests__/team-decompose.test.js +138 -0
  500. package/dist/cli/__tests__/team-decompose.test.js.map +1 -0
  501. package/dist/cli/__tests__/team.test.d.ts +2 -0
  502. package/dist/cli/__tests__/team.test.d.ts.map +1 -0
  503. package/dist/cli/__tests__/team.test.js +2897 -0
  504. package/dist/cli/__tests__/team.test.js.map +1 -0
  505. package/dist/cli/__tests__/ultragoal.test.d.ts +2 -0
  506. package/dist/cli/__tests__/ultragoal.test.d.ts.map +1 -0
  507. package/dist/cli/__tests__/ultragoal.test.js +599 -0
  508. package/dist/cli/__tests__/ultragoal.test.js.map +1 -0
  509. package/dist/cli/__tests__/uninstall.test.d.ts +2 -0
  510. package/dist/cli/__tests__/uninstall.test.d.ts.map +1 -0
  511. package/dist/cli/__tests__/uninstall.test.js +865 -0
  512. package/dist/cli/__tests__/uninstall.test.js.map +1 -0
  513. package/dist/cli/__tests__/update.test.d.ts +2 -0
  514. package/dist/cli/__tests__/update.test.d.ts.map +1 -0
  515. package/dist/cli/__tests__/update.test.js +1182 -0
  516. package/dist/cli/__tests__/update.test.js.map +1 -0
  517. package/dist/cli/__tests__/version-sync-contract.test.d.ts +2 -0
  518. package/dist/cli/__tests__/version-sync-contract.test.d.ts.map +1 -0
  519. package/dist/cli/__tests__/version-sync-contract.test.js +47 -0
  520. package/dist/cli/__tests__/version-sync-contract.test.js.map +1 -0
  521. package/dist/cli/__tests__/version.test.d.ts +2 -0
  522. package/dist/cli/__tests__/version.test.d.ts.map +1 -0
  523. package/dist/cli/__tests__/version.test.js +21 -0
  524. package/dist/cli/__tests__/version.test.js.map +1 -0
  525. package/dist/cli/__tests__/windows-popup-loop-contract.test.d.ts +2 -0
  526. package/dist/cli/__tests__/windows-popup-loop-contract.test.d.ts.map +1 -0
  527. package/dist/cli/__tests__/windows-popup-loop-contract.test.js +31 -0
  528. package/dist/cli/__tests__/windows-popup-loop-contract.test.js.map +1 -0
  529. package/dist/cli/adapt.d.ts +6 -0
  530. package/dist/cli/adapt.d.ts.map +1 -0
  531. package/dist/cli/adapt.js +135 -0
  532. package/dist/cli/adapt.js.map +1 -0
  533. package/dist/cli/agents-init.d.ts +14 -0
  534. package/dist/cli/agents-init.d.ts.map +1 -0
  535. package/dist/cli/agents-init.js +274 -0
  536. package/dist/cli/agents-init.js.map +1 -0
  537. package/dist/cli/agents.d.ts +14 -0
  538. package/dist/cli/agents.d.ts.map +1 -0
  539. package/dist/cli/agents.js +267 -0
  540. package/dist/cli/agents.js.map +1 -0
  541. package/dist/cli/api.d.ts +26 -0
  542. package/dist/cli/api.d.ts.map +1 -0
  543. package/dist/cli/api.js +153 -0
  544. package/dist/cli/api.js.map +1 -0
  545. package/dist/cli/ask.d.ts +13 -0
  546. package/dist/cli/ask.d.ts.map +1 -0
  547. package/dist/cli/ask.js +178 -0
  548. package/dist/cli/ask.js.map +1 -0
  549. package/dist/cli/auth.d.ts +4 -0
  550. package/dist/cli/auth.d.ts.map +1 -0
  551. package/dist/cli/auth.js +113 -0
  552. package/dist/cli/auth.js.map +1 -0
  553. package/dist/cli/autoresearch-goal.d.ts +3 -0
  554. package/dist/cli/autoresearch-goal.d.ts.map +1 -0
  555. package/dist/cli/autoresearch-goal.js +175 -0
  556. package/dist/cli/autoresearch-goal.js.map +1 -0
  557. package/dist/cli/autoresearch-guided.d.ts +43 -0
  558. package/dist/cli/autoresearch-guided.d.ts.map +1 -0
  559. package/dist/cli/autoresearch-guided.js +282 -0
  560. package/dist/cli/autoresearch-guided.js.map +1 -0
  561. package/dist/cli/autoresearch-intake.d.ts +62 -0
  562. package/dist/cli/autoresearch-intake.d.ts.map +1 -0
  563. package/dist/cli/autoresearch-intake.js +336 -0
  564. package/dist/cli/autoresearch-intake.js.map +1 -0
  565. package/dist/cli/autoresearch.d.ts +16 -0
  566. package/dist/cli/autoresearch.d.ts.map +1 -0
  567. package/dist/cli/autoresearch.js +91 -0
  568. package/dist/cli/autoresearch.js.map +1 -0
  569. package/dist/cli/catalog-contract.d.ts +10 -0
  570. package/dist/cli/catalog-contract.d.ts.map +1 -0
  571. package/dist/cli/catalog-contract.js +34 -0
  572. package/dist/cli/catalog-contract.js.map +1 -0
  573. package/dist/cli/cleanup.d.ts +58 -0
  574. package/dist/cli/cleanup.d.ts.map +1 -0
  575. package/dist/cli/cleanup.js +444 -0
  576. package/dist/cli/cleanup.js.map +1 -0
  577. package/dist/cli/codex-feature-probe.d.ts +17 -0
  578. package/dist/cli/codex-feature-probe.d.ts.map +1 -0
  579. package/dist/cli/codex-feature-probe.js +50 -0
  580. package/dist/cli/codex-feature-probe.js.map +1 -0
  581. package/dist/cli/codex-home.d.ts +7 -0
  582. package/dist/cli/codex-home.d.ts.map +1 -0
  583. package/dist/cli/codex-home.js +26 -0
  584. package/dist/cli/codex-home.js.map +1 -0
  585. package/dist/cli/constants.d.ts +11 -0
  586. package/dist/cli/constants.d.ts.map +1 -0
  587. package/dist/cli/constants.js +11 -0
  588. package/dist/cli/constants.js.map +1 -0
  589. package/dist/cli/doctor.d.ts +43 -0
  590. package/dist/cli/doctor.d.ts.map +1 -0
  591. package/dist/cli/doctor.js +1956 -0
  592. package/dist/cli/doctor.js.map +1 -0
  593. package/dist/cli/explore.d.ts +14 -0
  594. package/dist/cli/explore.d.ts.map +1 -0
  595. package/dist/cli/explore.js +72 -0
  596. package/dist/cli/explore.js.map +1 -0
  597. package/dist/cli/hooks.d.ts +4 -0
  598. package/dist/cli/hooks.d.ts.map +1 -0
  599. package/dist/cli/hooks.js +201 -0
  600. package/dist/cli/hooks.js.map +1 -0
  601. package/dist/cli/index.d.ts +247 -0
  602. package/dist/cli/index.d.ts.map +1 -0
  603. package/dist/cli/index.js +4590 -0
  604. package/dist/cli/index.js.map +1 -0
  605. package/dist/cli/list.d.ts +2 -0
  606. package/dist/cli/list.d.ts.map +1 -0
  607. package/dist/cli/list.js +40 -0
  608. package/dist/cli/list.js.map +1 -0
  609. package/dist/cli/mcp-parity.d.ts +22 -0
  610. package/dist/cli/mcp-parity.d.ts.map +1 -0
  611. package/dist/cli/mcp-parity.js +251 -0
  612. package/dist/cli/mcp-parity.js.map +1 -0
  613. package/dist/cli/mcp-serve.d.ts +13 -0
  614. package/dist/cli/mcp-serve.d.ts.map +1 -0
  615. package/dist/cli/mcp-serve.js +75 -0
  616. package/dist/cli/mcp-serve.js.map +1 -0
  617. package/dist/cli/native-assets.d.ts +52 -0
  618. package/dist/cli/native-assets.d.ts.map +1 -0
  619. package/dist/cli/native-assets.js +302 -0
  620. package/dist/cli/native-assets.js.map +1 -0
  621. package/dist/cli/omx.d.ts +3 -0
  622. package/dist/cli/omx.d.ts.map +1 -0
  623. package/dist/cli/omx.js +25 -0
  624. package/dist/cli/omx.js.map +1 -0
  625. package/dist/cli/performance-goal.d.ts +3 -0
  626. package/dist/cli/performance-goal.d.ts.map +1 -0
  627. package/dist/cli/performance-goal.js +186 -0
  628. package/dist/cli/performance-goal.js.map +1 -0
  629. package/dist/cli/plugin-marketplace.d.ts +54 -0
  630. package/dist/cli/plugin-marketplace.d.ts.map +1 -0
  631. package/dist/cli/plugin-marketplace.js +369 -0
  632. package/dist/cli/plugin-marketplace.js.map +1 -0
  633. package/dist/cli/question.d.ts +3 -0
  634. package/dist/cli/question.d.ts.map +1 -0
  635. package/dist/cli/question.js +376 -0
  636. package/dist/cli/question.js.map +1 -0
  637. package/dist/cli/ralph.d.ts +17 -0
  638. package/dist/cli/ralph.d.ts.map +1 -0
  639. package/dist/cli/ralph.js +330 -0
  640. package/dist/cli/ralph.js.map +1 -0
  641. package/dist/cli/session-search.d.ts +8 -0
  642. package/dist/cli/session-search.d.ts.map +1 -0
  643. package/dist/cli/session-search.js +133 -0
  644. package/dist/cli/session-search.js.map +1 -0
  645. package/dist/cli/setup-preferences.d.ts +26 -0
  646. package/dist/cli/setup-preferences.d.ts.map +1 -0
  647. package/dist/cli/setup-preferences.js +82 -0
  648. package/dist/cli/setup-preferences.js.map +1 -0
  649. package/dist/cli/setup.d.ts +60 -0
  650. package/dist/cli/setup.d.ts.map +1 -0
  651. package/dist/cli/setup.js +2748 -0
  652. package/dist/cli/setup.js.map +1 -0
  653. package/dist/cli/sparkshell.d.ts +39 -0
  654. package/dist/cli/sparkshell.d.ts.map +1 -0
  655. package/dist/cli/sparkshell.js +299 -0
  656. package/dist/cli/sparkshell.js.map +1 -0
  657. package/dist/cli/star-prompt.d.ts +31 -0
  658. package/dist/cli/star-prompt.d.ts.map +1 -0
  659. package/dist/cli/star-prompt.js +97 -0
  660. package/dist/cli/star-prompt.js.map +1 -0
  661. package/dist/cli/state.d.ts +8 -0
  662. package/dist/cli/state.d.ts.map +1 -0
  663. package/dist/cli/state.js +149 -0
  664. package/dist/cli/state.js.map +1 -0
  665. package/dist/cli/team.d.ts +49 -0
  666. package/dist/cli/team.d.ts.map +1 -0
  667. package/dist/cli/team.js +1453 -0
  668. package/dist/cli/team.js.map +1 -0
  669. package/dist/cli/tmux-hook.d.ts +3 -0
  670. package/dist/cli/tmux-hook.d.ts.map +1 -0
  671. package/dist/cli/tmux-hook.js +403 -0
  672. package/dist/cli/tmux-hook.js.map +1 -0
  673. package/dist/cli/ultragoal.d.ts +3 -0
  674. package/dist/cli/ultragoal.d.ts.map +1 -0
  675. package/dist/cli/ultragoal.js +494 -0
  676. package/dist/cli/ultragoal.js.map +1 -0
  677. package/dist/cli/uninstall.d.ts +15 -0
  678. package/dist/cli/uninstall.d.ts.map +1 -0
  679. package/dist/cli/uninstall.js +476 -0
  680. package/dist/cli/uninstall.js.map +1 -0
  681. package/dist/cli/update.d.ts +86 -0
  682. package/dist/cli/update.d.ts.map +1 -0
  683. package/dist/cli/update.js +754 -0
  684. package/dist/cli/update.js.map +1 -0
  685. package/dist/cli/version.d.ts +2 -0
  686. package/dist/cli/version.d.ts.map +1 -0
  687. package/dist/cli/version.js +13 -0
  688. package/dist/cli/version.js.map +1 -0
  689. package/dist/compat/__tests__/doctor-contract.test.d.ts +2 -0
  690. package/dist/compat/__tests__/doctor-contract.test.d.ts.map +1 -0
  691. package/dist/compat/__tests__/doctor-contract.test.js +122 -0
  692. package/dist/compat/__tests__/doctor-contract.test.js.map +1 -0
  693. package/dist/compat/__tests__/rust-runtime-compat.test.d.ts +2 -0
  694. package/dist/compat/__tests__/rust-runtime-compat.test.d.ts.map +1 -0
  695. package/dist/compat/__tests__/rust-runtime-compat.test.js +218 -0
  696. package/dist/compat/__tests__/rust-runtime-compat.test.js.map +1 -0
  697. package/dist/config/__tests__/codex-feature-flags.test.d.ts +2 -0
  698. package/dist/config/__tests__/codex-feature-flags.test.d.ts.map +1 -0
  699. package/dist/config/__tests__/codex-feature-flags.test.js +45 -0
  700. package/dist/config/__tests__/codex-feature-flags.test.js.map +1 -0
  701. package/dist/config/__tests__/codex-hooks.test.d.ts +2 -0
  702. package/dist/config/__tests__/codex-hooks.test.d.ts.map +1 -0
  703. package/dist/config/__tests__/codex-hooks.test.js +524 -0
  704. package/dist/config/__tests__/codex-hooks.test.js.map +1 -0
  705. package/dist/config/__tests__/commit-lore-guard.test.d.ts +2 -0
  706. package/dist/config/__tests__/commit-lore-guard.test.d.ts.map +1 -0
  707. package/dist/config/__tests__/commit-lore-guard.test.js +20 -0
  708. package/dist/config/__tests__/commit-lore-guard.test.js.map +1 -0
  709. package/dist/config/__tests__/deep-interview.test.d.ts +2 -0
  710. package/dist/config/__tests__/deep-interview.test.d.ts.map +1 -0
  711. package/dist/config/__tests__/deep-interview.test.js +240 -0
  712. package/dist/config/__tests__/deep-interview.test.js.map +1 -0
  713. package/dist/config/__tests__/generator-idempotent.test.d.ts +2 -0
  714. package/dist/config/__tests__/generator-idempotent.test.d.ts.map +1 -0
  715. package/dist/config/__tests__/generator-idempotent.test.js +1150 -0
  716. package/dist/config/__tests__/generator-idempotent.test.js.map +1 -0
  717. package/dist/config/__tests__/generator-notify.test.d.ts +2 -0
  718. package/dist/config/__tests__/generator-notify.test.d.ts.map +1 -0
  719. package/dist/config/__tests__/generator-notify.test.js +512 -0
  720. package/dist/config/__tests__/generator-notify.test.js.map +1 -0
  721. package/dist/config/__tests__/generator-status-line-presets.test.d.ts +2 -0
  722. package/dist/config/__tests__/generator-status-line-presets.test.d.ts.map +1 -0
  723. package/dist/config/__tests__/generator-status-line-presets.test.js +203 -0
  724. package/dist/config/__tests__/generator-status-line-presets.test.js.map +1 -0
  725. package/dist/config/__tests__/mcp-registry.test.d.ts +2 -0
  726. package/dist/config/__tests__/mcp-registry.test.d.ts.map +1 -0
  727. package/dist/config/__tests__/mcp-registry.test.js +190 -0
  728. package/dist/config/__tests__/mcp-registry.test.js.map +1 -0
  729. package/dist/config/__tests__/models.test.d.ts +2 -0
  730. package/dist/config/__tests__/models.test.d.ts.map +1 -0
  731. package/dist/config/__tests__/models.test.js +241 -0
  732. package/dist/config/__tests__/models.test.js.map +1 -0
  733. package/dist/config/__tests__/wiki-config-contract.test.d.ts +2 -0
  734. package/dist/config/__tests__/wiki-config-contract.test.d.ts.map +1 -0
  735. package/dist/config/__tests__/wiki-config-contract.test.js +23 -0
  736. package/dist/config/__tests__/wiki-config-contract.test.js.map +1 -0
  737. package/dist/config/codex-feature-flags.d.ts +25 -0
  738. package/dist/config/codex-feature-flags.d.ts.map +1 -0
  739. package/dist/config/codex-feature-flags.js +60 -0
  740. package/dist/config/codex-feature-flags.js.map +1 -0
  741. package/dist/config/codex-hooks.d.ts +79 -0
  742. package/dist/config/codex-hooks.d.ts.map +1 -0
  743. package/dist/config/codex-hooks.js +578 -0
  744. package/dist/config/codex-hooks.js.map +1 -0
  745. package/dist/config/commit-lore-guard.d.ts +4 -0
  746. package/dist/config/commit-lore-guard.d.ts.map +1 -0
  747. package/dist/config/commit-lore-guard.js +35 -0
  748. package/dist/config/commit-lore-guard.js.map +1 -0
  749. package/dist/config/deep-interview.d.ts +22 -0
  750. package/dist/config/deep-interview.d.ts.map +1 -0
  751. package/dist/config/deep-interview.js +161 -0
  752. package/dist/config/deep-interview.js.map +1 -0
  753. package/dist/config/generator.d.ts +141 -0
  754. package/dist/config/generator.d.ts.map +1 -0
  755. package/dist/config/generator.js +1845 -0
  756. package/dist/config/generator.js.map +1 -0
  757. package/dist/config/mcp-registry.d.ts +35 -0
  758. package/dist/config/mcp-registry.d.ts.map +1 -0
  759. package/dist/config/mcp-registry.js +159 -0
  760. package/dist/config/mcp-registry.js.map +1 -0
  761. package/dist/config/models.d.ts +80 -0
  762. package/dist/config/models.d.ts.map +1 -0
  763. package/dist/config/models.js +251 -0
  764. package/dist/config/models.js.map +1 -0
  765. package/dist/config/omx-first-party-mcp.d.ts +21 -0
  766. package/dist/config/omx-first-party-mcp.d.ts.map +1 -0
  767. package/dist/config/omx-first-party-mcp.js +86 -0
  768. package/dist/config/omx-first-party-mcp.js.map +1 -0
  769. package/dist/config/team-mode.d.ts +12 -0
  770. package/dist/config/team-mode.d.ts.map +1 -0
  771. package/dist/config/team-mode.js +91 -0
  772. package/dist/config/team-mode.js.map +1 -0
  773. package/dist/document-refresh/__tests__/enforcer.test.d.ts +2 -0
  774. package/dist/document-refresh/__tests__/enforcer.test.d.ts.map +1 -0
  775. package/dist/document-refresh/__tests__/enforcer.test.js +128 -0
  776. package/dist/document-refresh/__tests__/enforcer.test.js.map +1 -0
  777. package/dist/document-refresh/config.d.ts +9 -0
  778. package/dist/document-refresh/config.d.ts.map +1 -0
  779. package/dist/document-refresh/config.js +70 -0
  780. package/dist/document-refresh/config.js.map +1 -0
  781. package/dist/document-refresh/enforcer.d.ts +43 -0
  782. package/dist/document-refresh/enforcer.d.ts.map +1 -0
  783. package/dist/document-refresh/enforcer.js +329 -0
  784. package/dist/document-refresh/enforcer.js.map +1 -0
  785. package/dist/exec/followup.d.ts +45 -0
  786. package/dist/exec/followup.d.ts.map +1 -0
  787. package/dist/exec/followup.js +355 -0
  788. package/dist/exec/followup.js.map +1 -0
  789. package/dist/goal-workflows/__tests__/artifacts.test.d.ts +2 -0
  790. package/dist/goal-workflows/__tests__/artifacts.test.d.ts.map +1 -0
  791. package/dist/goal-workflows/__tests__/artifacts.test.js +96 -0
  792. package/dist/goal-workflows/__tests__/artifacts.test.js.map +1 -0
  793. package/dist/goal-workflows/__tests__/codex-goal-snapshot.test.d.ts +2 -0
  794. package/dist/goal-workflows/__tests__/codex-goal-snapshot.test.d.ts.map +1 -0
  795. package/dist/goal-workflows/__tests__/codex-goal-snapshot.test.js +75 -0
  796. package/dist/goal-workflows/__tests__/codex-goal-snapshot.test.js.map +1 -0
  797. package/dist/goal-workflows/artifacts.d.ts +62 -0
  798. package/dist/goal-workflows/artifacts.d.ts.map +1 -0
  799. package/dist/goal-workflows/artifacts.js +132 -0
  800. package/dist/goal-workflows/artifacts.js.map +1 -0
  801. package/dist/goal-workflows/codex-goal-snapshot.d.ts +32 -0
  802. package/dist/goal-workflows/codex-goal-snapshot.d.ts.map +1 -0
  803. package/dist/goal-workflows/codex-goal-snapshot.js +157 -0
  804. package/dist/goal-workflows/codex-goal-snapshot.js.map +1 -0
  805. package/dist/goal-workflows/handoff.d.ts +10 -0
  806. package/dist/goal-workflows/handoff.d.ts.map +1 -0
  807. package/dist/goal-workflows/handoff.js +31 -0
  808. package/dist/goal-workflows/handoff.js.map +1 -0
  809. package/dist/goal-workflows/validation.d.ts +13 -0
  810. package/dist/goal-workflows/validation.d.ts.map +1 -0
  811. package/dist/goal-workflows/validation.js +36 -0
  812. package/dist/goal-workflows/validation.js.map +1 -0
  813. package/dist/hooks/__tests__/agents-overlay.test.d.ts +8 -0
  814. package/dist/hooks/__tests__/agents-overlay.test.d.ts.map +1 -0
  815. package/dist/hooks/__tests__/agents-overlay.test.js +761 -0
  816. package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -0
  817. package/dist/hooks/__tests__/analyze-routing-contract.test.d.ts +2 -0
  818. package/dist/hooks/__tests__/analyze-routing-contract.test.d.ts.map +1 -0
  819. package/dist/hooks/__tests__/analyze-routing-contract.test.js +45 -0
  820. package/dist/hooks/__tests__/analyze-routing-contract.test.js.map +1 -0
  821. package/dist/hooks/__tests__/analyze-skill-contract.test.d.ts +2 -0
  822. package/dist/hooks/__tests__/analyze-skill-contract.test.d.ts.map +1 -0
  823. package/dist/hooks/__tests__/analyze-skill-contract.test.js +48 -0
  824. package/dist/hooks/__tests__/analyze-skill-contract.test.js.map +1 -0
  825. package/dist/hooks/__tests__/anti-slop-workflow.test.d.ts +2 -0
  826. package/dist/hooks/__tests__/anti-slop-workflow.test.d.ts.map +1 -0
  827. package/dist/hooks/__tests__/anti-slop-workflow.test.js +165 -0
  828. package/dist/hooks/__tests__/anti-slop-workflow.test.js.map +1 -0
  829. package/dist/hooks/__tests__/autopilot-skill-contract.test.d.ts +2 -0
  830. package/dist/hooks/__tests__/autopilot-skill-contract.test.d.ts.map +1 -0
  831. package/dist/hooks/__tests__/autopilot-skill-contract.test.js +90 -0
  832. package/dist/hooks/__tests__/autopilot-skill-contract.test.js.map +1 -0
  833. package/dist/hooks/__tests__/best-practice-research-skill.test.d.ts +2 -0
  834. package/dist/hooks/__tests__/best-practice-research-skill.test.d.ts.map +1 -0
  835. package/dist/hooks/__tests__/best-practice-research-skill.test.js +39 -0
  836. package/dist/hooks/__tests__/best-practice-research-skill.test.js.map +1 -0
  837. package/dist/hooks/__tests__/clawhip-event-contract.test.d.ts +2 -0
  838. package/dist/hooks/__tests__/clawhip-event-contract.test.d.ts.map +1 -0
  839. package/dist/hooks/__tests__/clawhip-event-contract.test.js +37 -0
  840. package/dist/hooks/__tests__/clawhip-event-contract.test.js.map +1 -0
  841. package/dist/hooks/__tests__/code-review-skill-contract.test.d.ts +2 -0
  842. package/dist/hooks/__tests__/code-review-skill-contract.test.d.ts.map +1 -0
  843. package/dist/hooks/__tests__/code-review-skill-contract.test.js +77 -0
  844. package/dist/hooks/__tests__/code-review-skill-contract.test.js.map +1 -0
  845. package/dist/hooks/__tests__/codebase-map.test.d.ts +8 -0
  846. package/dist/hooks/__tests__/codebase-map.test.d.ts.map +1 -0
  847. package/dist/hooks/__tests__/codebase-map.test.js +218 -0
  848. package/dist/hooks/__tests__/codebase-map.test.js.map +1 -0
  849. package/dist/hooks/__tests__/consensus-execution-handoff.test.d.ts +18 -0
  850. package/dist/hooks/__tests__/consensus-execution-handoff.test.d.ts.map +1 -0
  851. package/dist/hooks/__tests__/consensus-execution-handoff.test.js +266 -0
  852. package/dist/hooks/__tests__/consensus-execution-handoff.test.js.map +1 -0
  853. package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts +2 -0
  854. package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts.map +1 -0
  855. package/dist/hooks/__tests__/debugger-log-recency-contract.test.js +20 -0
  856. package/dist/hooks/__tests__/debugger-log-recency-contract.test.js.map +1 -0
  857. package/dist/hooks/__tests__/deep-interview-contract.test.d.ts +2 -0
  858. package/dist/hooks/__tests__/deep-interview-contract.test.d.ts.map +1 -0
  859. package/dist/hooks/__tests__/deep-interview-contract.test.js +309 -0
  860. package/dist/hooks/__tests__/deep-interview-contract.test.js.map +1 -0
  861. package/dist/hooks/__tests__/design-skill.test.d.ts +2 -0
  862. package/dist/hooks/__tests__/design-skill.test.d.ts.map +1 -0
  863. package/dist/hooks/__tests__/design-skill.test.js +55 -0
  864. package/dist/hooks/__tests__/design-skill.test.js.map +1 -0
  865. package/dist/hooks/__tests__/explicit-terminal-stop-docs-contract.test.d.ts +2 -0
  866. package/dist/hooks/__tests__/explicit-terminal-stop-docs-contract.test.d.ts.map +1 -0
  867. package/dist/hooks/__tests__/explicit-terminal-stop-docs-contract.test.js +43 -0
  868. package/dist/hooks/__tests__/explicit-terminal-stop-docs-contract.test.js.map +1 -0
  869. package/dist/hooks/__tests__/explicit-terminal-stop-model-docs-contract.test.d.ts +2 -0
  870. package/dist/hooks/__tests__/explicit-terminal-stop-model-docs-contract.test.d.ts.map +1 -0
  871. package/dist/hooks/__tests__/explicit-terminal-stop-model-docs-contract.test.js +38 -0
  872. package/dist/hooks/__tests__/explicit-terminal-stop-model-docs-contract.test.js.map +1 -0
  873. package/dist/hooks/__tests__/explore-routing.test.d.ts +2 -0
  874. package/dist/hooks/__tests__/explore-routing.test.d.ts.map +1 -0
  875. package/dist/hooks/__tests__/explore-routing.test.js +38 -0
  876. package/dist/hooks/__tests__/explore-routing.test.js.map +1 -0
  877. package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.d.ts +2 -0
  878. package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.d.ts.map +1 -0
  879. package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.js +67 -0
  880. package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.js.map +1 -0
  881. package/dist/hooks/__tests__/foreground-isolation-contract.test.d.ts +2 -0
  882. package/dist/hooks/__tests__/foreground-isolation-contract.test.d.ts.map +1 -0
  883. package/dist/hooks/__tests__/foreground-isolation-contract.test.js +28 -0
  884. package/dist/hooks/__tests__/foreground-isolation-contract.test.js.map +1 -0
  885. package/dist/hooks/__tests__/keyword-detector.test.d.ts +2 -0
  886. package/dist/hooks/__tests__/keyword-detector.test.d.ts.map +1 -0
  887. package/dist/hooks/__tests__/keyword-detector.test.js +3323 -0
  888. package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -0
  889. package/dist/hooks/__tests__/notify-fallback-watcher.test.d.ts +2 -0
  890. package/dist/hooks/__tests__/notify-fallback-watcher.test.d.ts.map +1 -0
  891. package/dist/hooks/__tests__/notify-fallback-watcher.test.js +3956 -0
  892. package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -0
  893. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.d.ts +2 -0
  894. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.d.ts.map +1 -0
  895. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +786 -0
  896. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -0
  897. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.d.ts +2 -0
  898. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.d.ts.map +1 -0
  899. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +2602 -0
  900. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -0
  901. package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.d.ts +2 -0
  902. package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.d.ts.map +1 -0
  903. package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.js +161 -0
  904. package/dist/hooks/__tests__/notify-hook-cross-worktree-heartbeat.test.js.map +1 -0
  905. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts +2 -0
  906. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts.map +1 -0
  907. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js +1178 -0
  908. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js.map +1 -0
  909. package/dist/hooks/__tests__/notify-hook-modules.test.d.ts +9 -0
  910. package/dist/hooks/__tests__/notify-hook-modules.test.d.ts.map +1 -0
  911. package/dist/hooks/__tests__/notify-hook-modules.test.js +529 -0
  912. package/dist/hooks/__tests__/notify-hook-modules.test.js.map +1 -0
  913. package/dist/hooks/__tests__/notify-hook-native-dispatch-contract.test.d.ts +2 -0
  914. package/dist/hooks/__tests__/notify-hook-native-dispatch-contract.test.d.ts.map +1 -0
  915. package/dist/hooks/__tests__/notify-hook-native-dispatch-contract.test.js +14 -0
  916. package/dist/hooks/__tests__/notify-hook-native-dispatch-contract.test.js.map +1 -0
  917. package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.d.ts +2 -0
  918. package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.d.ts.map +1 -0
  919. package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.js +176 -0
  920. package/dist/hooks/__tests__/notify-hook-non-omx-guard.test.js.map +1 -0
  921. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.d.ts +2 -0
  922. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.d.ts.map +1 -0
  923. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js +890 -0
  924. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js.map +1 -0
  925. package/dist/hooks/__tests__/notify-hook-regression-205.test.d.ts +9 -0
  926. package/dist/hooks/__tests__/notify-hook-regression-205.test.d.ts.map +1 -0
  927. package/dist/hooks/__tests__/notify-hook-regression-205.test.js +255 -0
  928. package/dist/hooks/__tests__/notify-hook-regression-205.test.js.map +1 -0
  929. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts +2 -0
  930. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts.map +1 -0
  931. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js +162 -0
  932. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js.map +1 -0
  933. package/dist/hooks/__tests__/notify-hook-session-scope.test.d.ts +2 -0
  934. package/dist/hooks/__tests__/notify-hook-session-scope.test.d.ts.map +1 -0
  935. package/dist/hooks/__tests__/notify-hook-session-scope.test.js +304 -0
  936. package/dist/hooks/__tests__/notify-hook-session-scope.test.js.map +1 -0
  937. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.d.ts +2 -0
  938. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.d.ts.map +1 -0
  939. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +1511 -0
  940. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -0
  941. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.d.ts +2 -0
  942. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.d.ts.map +1 -0
  943. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +2911 -0
  944. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -0
  945. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.d.ts +2 -0
  946. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.d.ts.map +1 -0
  947. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js +261 -0
  948. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -0
  949. package/dist/hooks/__tests__/notify-hook-team-worker-fail-closed.test.d.ts +2 -0
  950. package/dist/hooks/__tests__/notify-hook-team-worker-fail-closed.test.d.ts.map +1 -0
  951. package/dist/hooks/__tests__/notify-hook-team-worker-fail-closed.test.js +35 -0
  952. package/dist/hooks/__tests__/notify-hook-team-worker-fail-closed.test.js.map +1 -0
  953. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.d.ts +2 -0
  954. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.d.ts.map +1 -0
  955. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js +1854 -0
  956. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js.map +1 -0
  957. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.d.ts +10 -0
  958. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.d.ts.map +1 -0
  959. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js +0 -0
  960. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js.map +1 -0
  961. package/dist/hooks/__tests__/notify-hook-visual-verdict.test.d.ts +11 -0
  962. package/dist/hooks/__tests__/notify-hook-visual-verdict.test.d.ts.map +1 -0
  963. package/dist/hooks/__tests__/notify-hook-visual-verdict.test.js +266 -0
  964. package/dist/hooks/__tests__/notify-hook-visual-verdict.test.js.map +1 -0
  965. package/dist/hooks/__tests__/notify-hook-worker-idle.test.d.ts +2 -0
  966. package/dist/hooks/__tests__/notify-hook-worker-idle.test.d.ts.map +1 -0
  967. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +895 -0
  968. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -0
  969. package/dist/hooks/__tests__/openclaw-setup-contract.test.d.ts +2 -0
  970. package/dist/hooks/__tests__/openclaw-setup-contract.test.d.ts.map +1 -0
  971. package/dist/hooks/__tests__/openclaw-setup-contract.test.js +61 -0
  972. package/dist/hooks/__tests__/openclaw-setup-contract.test.js.map +1 -0
  973. package/dist/hooks/__tests__/pre-context-gate-skills.test.d.ts +2 -0
  974. package/dist/hooks/__tests__/pre-context-gate-skills.test.d.ts.map +1 -0
  975. package/dist/hooks/__tests__/pre-context-gate-skills.test.js +40 -0
  976. package/dist/hooks/__tests__/pre-context-gate-skills.test.js.map +1 -0
  977. package/dist/hooks/__tests__/prometheus-strict-contract.test.d.ts +2 -0
  978. package/dist/hooks/__tests__/prometheus-strict-contract.test.d.ts.map +1 -0
  979. package/dist/hooks/__tests__/prometheus-strict-contract.test.js +320 -0
  980. package/dist/hooks/__tests__/prometheus-strict-contract.test.js.map +1 -0
  981. package/dist/hooks/__tests__/prompt-guidance-catalog.test.d.ts +2 -0
  982. package/dist/hooks/__tests__/prompt-guidance-catalog.test.d.ts.map +1 -0
  983. package/dist/hooks/__tests__/prompt-guidance-catalog.test.js +11 -0
  984. package/dist/hooks/__tests__/prompt-guidance-catalog.test.js.map +1 -0
  985. package/dist/hooks/__tests__/prompt-guidance-contract.test.d.ts +2 -0
  986. package/dist/hooks/__tests__/prompt-guidance-contract.test.d.ts.map +1 -0
  987. package/dist/hooks/__tests__/prompt-guidance-contract.test.js +38 -0
  988. package/dist/hooks/__tests__/prompt-guidance-contract.test.js.map +1 -0
  989. package/dist/hooks/__tests__/prompt-guidance-fragments.test.d.ts +2 -0
  990. package/dist/hooks/__tests__/prompt-guidance-fragments.test.d.ts.map +1 -0
  991. package/dist/hooks/__tests__/prompt-guidance-fragments.test.js +48 -0
  992. package/dist/hooks/__tests__/prompt-guidance-fragments.test.js.map +1 -0
  993. package/dist/hooks/__tests__/prompt-guidance-scenarios.test.d.ts +2 -0
  994. package/dist/hooks/__tests__/prompt-guidance-scenarios.test.d.ts.map +1 -0
  995. package/dist/hooks/__tests__/prompt-guidance-scenarios.test.js +11 -0
  996. package/dist/hooks/__tests__/prompt-guidance-scenarios.test.js.map +1 -0
  997. package/dist/hooks/__tests__/prompt-guidance-test-helpers.d.ts +5 -0
  998. package/dist/hooks/__tests__/prompt-guidance-test-helpers.d.ts.map +1 -0
  999. package/dist/hooks/__tests__/prompt-guidance-test-helpers.js +34 -0
  1000. package/dist/hooks/__tests__/prompt-guidance-test-helpers.js.map +1 -0
  1001. package/dist/hooks/__tests__/prompt-guidance-wave-two.test.d.ts +2 -0
  1002. package/dist/hooks/__tests__/prompt-guidance-wave-two.test.d.ts.map +1 -0
  1003. package/dist/hooks/__tests__/prompt-guidance-wave-two.test.js +81 -0
  1004. package/dist/hooks/__tests__/prompt-guidance-wave-two.test.js.map +1 -0
  1005. package/dist/hooks/__tests__/prompt-orchestration-boundary.test.d.ts +2 -0
  1006. package/dist/hooks/__tests__/prompt-orchestration-boundary.test.d.ts.map +1 -0
  1007. package/dist/hooks/__tests__/prompt-orchestration-boundary.test.js +38 -0
  1008. package/dist/hooks/__tests__/prompt-orchestration-boundary.test.js.map +1 -0
  1009. package/dist/hooks/__tests__/prompt-refactor-contract.test.d.ts +2 -0
  1010. package/dist/hooks/__tests__/prompt-refactor-contract.test.d.ts.map +1 -0
  1011. package/dist/hooks/__tests__/prompt-refactor-contract.test.js +22 -0
  1012. package/dist/hooks/__tests__/prompt-refactor-contract.test.js.map +1 -0
  1013. package/dist/hooks/__tests__/prompt-team-routing.test.d.ts +2 -0
  1014. package/dist/hooks/__tests__/prompt-team-routing.test.d.ts.map +1 -0
  1015. package/dist/hooks/__tests__/prompt-team-routing.test.js +49 -0
  1016. package/dist/hooks/__tests__/prompt-team-routing.test.js.map +1 -0
  1017. package/dist/hooks/__tests__/research-workflow-boundaries.test.d.ts +2 -0
  1018. package/dist/hooks/__tests__/research-workflow-boundaries.test.d.ts.map +1 -0
  1019. package/dist/hooks/__tests__/research-workflow-boundaries.test.js +35 -0
  1020. package/dist/hooks/__tests__/research-workflow-boundaries.test.js.map +1 -0
  1021. package/dist/hooks/__tests__/session.test.d.ts +2 -0
  1022. package/dist/hooks/__tests__/session.test.d.ts.map +1 -0
  1023. package/dist/hooks/__tests__/session.test.js +504 -0
  1024. package/dist/hooks/__tests__/session.test.js.map +1 -0
  1025. package/dist/hooks/__tests__/skill-catalog-hygiene.test.d.ts +2 -0
  1026. package/dist/hooks/__tests__/skill-catalog-hygiene.test.d.ts.map +1 -0
  1027. package/dist/hooks/__tests__/skill-catalog-hygiene.test.js +84 -0
  1028. package/dist/hooks/__tests__/skill-catalog-hygiene.test.js.map +1 -0
  1029. package/dist/hooks/__tests__/skill-guidance-contract.test.d.ts +2 -0
  1030. package/dist/hooks/__tests__/skill-guidance-contract.test.d.ts.map +1 -0
  1031. package/dist/hooks/__tests__/skill-guidance-contract.test.js +89 -0
  1032. package/dist/hooks/__tests__/skill-guidance-contract.test.js.map +1 -0
  1033. package/dist/hooks/__tests__/task-size-detector.test.d.ts +2 -0
  1034. package/dist/hooks/__tests__/task-size-detector.test.d.ts.map +1 -0
  1035. package/dist/hooks/__tests__/task-size-detector.test.js +330 -0
  1036. package/dist/hooks/__tests__/task-size-detector.test.js.map +1 -0
  1037. package/dist/hooks/__tests__/team-runtime-gating-docs-contract.test.d.ts +2 -0
  1038. package/dist/hooks/__tests__/team-runtime-gating-docs-contract.test.d.ts.map +1 -0
  1039. package/dist/hooks/__tests__/team-runtime-gating-docs-contract.test.js +28 -0
  1040. package/dist/hooks/__tests__/team-runtime-gating-docs-contract.test.js.map +1 -0
  1041. package/dist/hooks/__tests__/tmux-hook-engine-types-sync.test.d.ts +2 -0
  1042. package/dist/hooks/__tests__/tmux-hook-engine-types-sync.test.d.ts.map +1 -0
  1043. package/dist/hooks/__tests__/tmux-hook-engine-types-sync.test.js +24 -0
  1044. package/dist/hooks/__tests__/tmux-hook-engine-types-sync.test.js.map +1 -0
  1045. package/dist/hooks/__tests__/tmux-hook-engine.test.d.ts +2 -0
  1046. package/dist/hooks/__tests__/tmux-hook-engine.test.d.ts.map +1 -0
  1047. package/dist/hooks/__tests__/tmux-hook-engine.test.js +403 -0
  1048. package/dist/hooks/__tests__/tmux-hook-engine.test.js.map +1 -0
  1049. package/dist/hooks/__tests__/triage-config.test.d.ts +2 -0
  1050. package/dist/hooks/__tests__/triage-config.test.d.ts.map +1 -0
  1051. package/dist/hooks/__tests__/triage-config.test.js +211 -0
  1052. package/dist/hooks/__tests__/triage-config.test.js.map +1 -0
  1053. package/dist/hooks/__tests__/triage-heuristic.test.d.ts +2 -0
  1054. package/dist/hooks/__tests__/triage-heuristic.test.d.ts.map +1 -0
  1055. package/dist/hooks/__tests__/triage-heuristic.test.js +285 -0
  1056. package/dist/hooks/__tests__/triage-heuristic.test.js.map +1 -0
  1057. package/dist/hooks/__tests__/triage-state.test.d.ts +2 -0
  1058. package/dist/hooks/__tests__/triage-state.test.d.ts.map +1 -0
  1059. package/dist/hooks/__tests__/triage-state.test.js +426 -0
  1060. package/dist/hooks/__tests__/triage-state.test.js.map +1 -0
  1061. package/dist/hooks/__tests__/visual-ralph-skill.test.d.ts +2 -0
  1062. package/dist/hooks/__tests__/visual-ralph-skill.test.d.ts.map +1 -0
  1063. package/dist/hooks/__tests__/visual-ralph-skill.test.js +44 -0
  1064. package/dist/hooks/__tests__/visual-ralph-skill.test.js.map +1 -0
  1065. package/dist/hooks/__tests__/visual-verdict-loop.test.d.ts +2 -0
  1066. package/dist/hooks/__tests__/visual-verdict-loop.test.d.ts.map +1 -0
  1067. package/dist/hooks/__tests__/visual-verdict-loop.test.js +31 -0
  1068. package/dist/hooks/__tests__/visual-verdict-loop.test.js.map +1 -0
  1069. package/dist/hooks/__tests__/wiki-docs-contract.test.d.ts +2 -0
  1070. package/dist/hooks/__tests__/wiki-docs-contract.test.d.ts.map +1 -0
  1071. package/dist/hooks/__tests__/wiki-docs-contract.test.js +35 -0
  1072. package/dist/hooks/__tests__/wiki-docs-contract.test.js.map +1 -0
  1073. package/dist/hooks/agents-overlay.d.ts +51 -0
  1074. package/dist/hooks/agents-overlay.d.ts.map +1 -0
  1075. package/dist/hooks/agents-overlay.js +547 -0
  1076. package/dist/hooks/agents-overlay.js.map +1 -0
  1077. package/dist/hooks/code-simplifier/__tests__/index.test.d.ts +2 -0
  1078. package/dist/hooks/code-simplifier/__tests__/index.test.d.ts.map +1 -0
  1079. package/dist/hooks/code-simplifier/__tests__/index.test.js +187 -0
  1080. package/dist/hooks/code-simplifier/__tests__/index.test.js.map +1 -0
  1081. package/dist/hooks/code-simplifier/index.d.ts +80 -0
  1082. package/dist/hooks/code-simplifier/index.d.ts.map +1 -0
  1083. package/dist/hooks/code-simplifier/index.js +172 -0
  1084. package/dist/hooks/code-simplifier/index.js.map +1 -0
  1085. package/dist/hooks/codebase-map.d.ts +23 -0
  1086. package/dist/hooks/codebase-map.d.ts.map +1 -0
  1087. package/dist/hooks/codebase-map.js +234 -0
  1088. package/dist/hooks/codebase-map.js.map +1 -0
  1089. package/dist/hooks/deep-interview-config-instruction.d.ts +3 -0
  1090. package/dist/hooks/deep-interview-config-instruction.d.ts.map +1 -0
  1091. package/dist/hooks/deep-interview-config-instruction.js +47 -0
  1092. package/dist/hooks/deep-interview-config-instruction.js.map +1 -0
  1093. package/dist/hooks/explore-routing.d.ts +5 -0
  1094. package/dist/hooks/explore-routing.d.ts.map +1 -0
  1095. package/dist/hooks/explore-routing.js +37 -0
  1096. package/dist/hooks/explore-routing.js.map +1 -0
  1097. package/dist/hooks/extensibility/__tests__/dispatcher.test.d.ts +2 -0
  1098. package/dist/hooks/extensibility/__tests__/dispatcher.test.d.ts.map +1 -0
  1099. package/dist/hooks/extensibility/__tests__/dispatcher.test.js +265 -0
  1100. package/dist/hooks/extensibility/__tests__/dispatcher.test.js.map +1 -0
  1101. package/dist/hooks/extensibility/__tests__/events.test.d.ts +2 -0
  1102. package/dist/hooks/extensibility/__tests__/events.test.d.ts.map +1 -0
  1103. package/dist/hooks/extensibility/__tests__/events.test.js +125 -0
  1104. package/dist/hooks/extensibility/__tests__/events.test.js.map +1 -0
  1105. package/dist/hooks/extensibility/__tests__/example-hook-plugins.test.d.ts +2 -0
  1106. package/dist/hooks/extensibility/__tests__/example-hook-plugins.test.d.ts.map +1 -0
  1107. package/dist/hooks/extensibility/__tests__/example-hook-plugins.test.js +153 -0
  1108. package/dist/hooks/extensibility/__tests__/example-hook-plugins.test.js.map +1 -0
  1109. package/dist/hooks/extensibility/__tests__/loader.test.d.ts +2 -0
  1110. package/dist/hooks/extensibility/__tests__/loader.test.d.ts.map +1 -0
  1111. package/dist/hooks/extensibility/__tests__/loader.test.js +254 -0
  1112. package/dist/hooks/extensibility/__tests__/loader.test.js.map +1 -0
  1113. package/dist/hooks/extensibility/__tests__/logging.test.d.ts +2 -0
  1114. package/dist/hooks/extensibility/__tests__/logging.test.d.ts.map +1 -0
  1115. package/dist/hooks/extensibility/__tests__/logging.test.js +74 -0
  1116. package/dist/hooks/extensibility/__tests__/logging.test.js.map +1 -0
  1117. package/dist/hooks/extensibility/__tests__/plugin-runner.test.d.ts +2 -0
  1118. package/dist/hooks/extensibility/__tests__/plugin-runner.test.d.ts.map +1 -0
  1119. package/dist/hooks/extensibility/__tests__/plugin-runner.test.js +344 -0
  1120. package/dist/hooks/extensibility/__tests__/plugin-runner.test.js.map +1 -0
  1121. package/dist/hooks/extensibility/__tests__/runtime.test.d.ts +2 -0
  1122. package/dist/hooks/extensibility/__tests__/runtime.test.d.ts.map +1 -0
  1123. package/dist/hooks/extensibility/__tests__/runtime.test.js +198 -0
  1124. package/dist/hooks/extensibility/__tests__/runtime.test.js.map +1 -0
  1125. package/dist/hooks/extensibility/__tests__/sdk-public-surface.test.d.ts +2 -0
  1126. package/dist/hooks/extensibility/__tests__/sdk-public-surface.test.d.ts.map +1 -0
  1127. package/dist/hooks/extensibility/__tests__/sdk-public-surface.test.js +32 -0
  1128. package/dist/hooks/extensibility/__tests__/sdk-public-surface.test.js.map +1 -0
  1129. package/dist/hooks/extensibility/__tests__/sdk.test.d.ts +2 -0
  1130. package/dist/hooks/extensibility/__tests__/sdk.test.d.ts.map +1 -0
  1131. package/dist/hooks/extensibility/__tests__/sdk.test.js +479 -0
  1132. package/dist/hooks/extensibility/__tests__/sdk.test.js.map +1 -0
  1133. package/dist/hooks/extensibility/dispatcher.d.ts +4 -0
  1134. package/dist/hooks/extensibility/dispatcher.d.ts.map +1 -0
  1135. package/dist/hooks/extensibility/dispatcher.js +302 -0
  1136. package/dist/hooks/extensibility/dispatcher.js.map +1 -0
  1137. package/dist/hooks/extensibility/events.d.ts +18 -0
  1138. package/dist/hooks/extensibility/events.d.ts.map +1 -0
  1139. package/dist/hooks/extensibility/events.js +53 -0
  1140. package/dist/hooks/extensibility/events.js.map +1 -0
  1141. package/dist/hooks/extensibility/index.d.ts +6 -0
  1142. package/dist/hooks/extensibility/index.d.ts.map +1 -0
  1143. package/dist/hooks/extensibility/index.js +6 -0
  1144. package/dist/hooks/extensibility/index.js.map +1 -0
  1145. package/dist/hooks/extensibility/loader.d.ts +14 -0
  1146. package/dist/hooks/extensibility/loader.d.ts.map +1 -0
  1147. package/dist/hooks/extensibility/loader.js +117 -0
  1148. package/dist/hooks/extensibility/loader.js.map +1 -0
  1149. package/dist/hooks/extensibility/logging.d.ts +4 -0
  1150. package/dist/hooks/extensibility/logging.d.ts.map +1 -0
  1151. package/dist/hooks/extensibility/logging.js +22 -0
  1152. package/dist/hooks/extensibility/logging.js.map +1 -0
  1153. package/dist/hooks/extensibility/plugin-runner-stdin.d.ts +2 -0
  1154. package/dist/hooks/extensibility/plugin-runner-stdin.d.ts.map +1 -0
  1155. package/dist/hooks/extensibility/plugin-runner-stdin.js +16 -0
  1156. package/dist/hooks/extensibility/plugin-runner-stdin.js.map +1 -0
  1157. package/dist/hooks/extensibility/plugin-runner.d.ts +2 -0
  1158. package/dist/hooks/extensibility/plugin-runner.d.ts.map +1 -0
  1159. package/dist/hooks/extensibility/plugin-runner.js +63 -0
  1160. package/dist/hooks/extensibility/plugin-runner.js.map +1 -0
  1161. package/dist/hooks/extensibility/runtime.d.ts +3 -0
  1162. package/dist/hooks/extensibility/runtime.d.ts.map +1 -0
  1163. package/dist/hooks/extensibility/runtime.js +42 -0
  1164. package/dist/hooks/extensibility/runtime.js.map +1 -0
  1165. package/dist/hooks/extensibility/sdk/logging.d.ts +6 -0
  1166. package/dist/hooks/extensibility/sdk/logging.d.ts.map +1 -0
  1167. package/dist/hooks/extensibility/sdk/logging.js +32 -0
  1168. package/dist/hooks/extensibility/sdk/logging.js.map +1 -0
  1169. package/dist/hooks/extensibility/sdk/paths.d.ts +7 -0
  1170. package/dist/hooks/extensibility/sdk/paths.d.ts.map +1 -0
  1171. package/dist/hooks/extensibility/sdk/paths.js +23 -0
  1172. package/dist/hooks/extensibility/sdk/paths.js.map +1 -0
  1173. package/dist/hooks/extensibility/sdk/plugin-state.d.ts +5 -0
  1174. package/dist/hooks/extensibility/sdk/plugin-state.d.ts.map +1 -0
  1175. package/dist/hooks/extensibility/sdk/plugin-state.js +66 -0
  1176. package/dist/hooks/extensibility/sdk/plugin-state.js.map +1 -0
  1177. package/dist/hooks/extensibility/sdk/runtime-state.d.ts +3 -0
  1178. package/dist/hooks/extensibility/sdk/runtime-state.d.ts.map +1 -0
  1179. package/dist/hooks/extensibility/sdk/runtime-state.js +47 -0
  1180. package/dist/hooks/extensibility/sdk/runtime-state.js.map +1 -0
  1181. package/dist/hooks/extensibility/sdk/tmux.d.ts +10 -0
  1182. package/dist/hooks/extensibility/sdk/tmux.d.ts.map +1 -0
  1183. package/dist/hooks/extensibility/sdk/tmux.js +181 -0
  1184. package/dist/hooks/extensibility/sdk/tmux.js.map +1 -0
  1185. package/dist/hooks/extensibility/sdk.d.ts +11 -0
  1186. package/dist/hooks/extensibility/sdk.d.ts.map +1 -0
  1187. package/dist/hooks/extensibility/sdk.js +21 -0
  1188. package/dist/hooks/extensibility/sdk.js.map +1 -0
  1189. package/dist/hooks/extensibility/types.d.ts +175 -0
  1190. package/dist/hooks/extensibility/types.d.ts.map +1 -0
  1191. package/dist/hooks/extensibility/types.js +2 -0
  1192. package/dist/hooks/extensibility/types.js.map +1 -0
  1193. package/dist/hooks/keyword-detector.d.ts +170 -0
  1194. package/dist/hooks/keyword-detector.d.ts.map +1 -0
  1195. package/dist/hooks/keyword-detector.js +1363 -0
  1196. package/dist/hooks/keyword-detector.js.map +1 -0
  1197. package/dist/hooks/keyword-registry.d.ts +15 -0
  1198. package/dist/hooks/keyword-registry.d.ts.map +1 -0
  1199. package/dist/hooks/keyword-registry.js +56 -0
  1200. package/dist/hooks/keyword-registry.js.map +1 -0
  1201. package/dist/hooks/prompt-guidance-contract.d.ts +20 -0
  1202. package/dist/hooks/prompt-guidance-contract.d.ts.map +1 -0
  1203. package/dist/hooks/prompt-guidance-contract.js +380 -0
  1204. package/dist/hooks/prompt-guidance-contract.js.map +1 -0
  1205. package/dist/hooks/session.d.ts +83 -0
  1206. package/dist/hooks/session.d.ts.map +1 -0
  1207. package/dist/hooks/session.js +412 -0
  1208. package/dist/hooks/session.js.map +1 -0
  1209. package/dist/hooks/task-size-detector.d.ts +72 -0
  1210. package/dist/hooks/task-size-detector.d.ts.map +1 -0
  1211. package/dist/hooks/task-size-detector.js +203 -0
  1212. package/dist/hooks/task-size-detector.js.map +1 -0
  1213. package/dist/hooks/triage-config.d.ts +33 -0
  1214. package/dist/hooks/triage-config.d.ts.map +1 -0
  1215. package/dist/hooks/triage-config.js +87 -0
  1216. package/dist/hooks/triage-config.js.map +1 -0
  1217. package/dist/hooks/triage-heuristic.d.ts +20 -0
  1218. package/dist/hooks/triage-heuristic.d.ts.map +1 -0
  1219. package/dist/hooks/triage-heuristic.js +287 -0
  1220. package/dist/hooks/triage-heuristic.js.map +1 -0
  1221. package/dist/hooks/triage-state.d.ts +63 -0
  1222. package/dist/hooks/triage-state.d.ts.map +1 -0
  1223. package/dist/hooks/triage-state.js +139 -0
  1224. package/dist/hooks/triage-state.js.map +1 -0
  1225. package/dist/hud/__tests__/authority.test.d.ts +2 -0
  1226. package/dist/hud/__tests__/authority.test.d.ts.map +1 -0
  1227. package/dist/hud/__tests__/authority.test.js +527 -0
  1228. package/dist/hud/__tests__/authority.test.js.map +1 -0
  1229. package/dist/hud/__tests__/colors.test.d.ts +2 -0
  1230. package/dist/hud/__tests__/colors.test.d.ts.map +1 -0
  1231. package/dist/hud/__tests__/colors.test.js +92 -0
  1232. package/dist/hud/__tests__/colors.test.js.map +1 -0
  1233. package/dist/hud/__tests__/hud-tmux-injection.test.d.ts +10 -0
  1234. package/dist/hud/__tests__/hud-tmux-injection.test.d.ts.map +1 -0
  1235. package/dist/hud/__tests__/hud-tmux-injection.test.js +185 -0
  1236. package/dist/hud/__tests__/hud-tmux-injection.test.js.map +1 -0
  1237. package/dist/hud/__tests__/index.test.d.ts +2 -0
  1238. package/dist/hud/__tests__/index.test.d.ts.map +1 -0
  1239. package/dist/hud/__tests__/index.test.js +684 -0
  1240. package/dist/hud/__tests__/index.test.js.map +1 -0
  1241. package/dist/hud/__tests__/reconcile.test.d.ts +2 -0
  1242. package/dist/hud/__tests__/reconcile.test.d.ts.map +1 -0
  1243. package/dist/hud/__tests__/reconcile.test.js +1621 -0
  1244. package/dist/hud/__tests__/reconcile.test.js.map +1 -0
  1245. package/dist/hud/__tests__/render.test.d.ts +2 -0
  1246. package/dist/hud/__tests__/render.test.d.ts.map +1 -0
  1247. package/dist/hud/__tests__/render.test.js +983 -0
  1248. package/dist/hud/__tests__/render.test.js.map +1 -0
  1249. package/dist/hud/__tests__/resource-leak-watch.test.d.ts +2 -0
  1250. package/dist/hud/__tests__/resource-leak-watch.test.d.ts.map +1 -0
  1251. package/dist/hud/__tests__/resource-leak-watch.test.js +28 -0
  1252. package/dist/hud/__tests__/resource-leak-watch.test.js.map +1 -0
  1253. package/dist/hud/__tests__/state.test.d.ts +2 -0
  1254. package/dist/hud/__tests__/state.test.d.ts.map +1 -0
  1255. package/dist/hud/__tests__/state.test.js +1212 -0
  1256. package/dist/hud/__tests__/state.test.js.map +1 -0
  1257. package/dist/hud/__tests__/tmux.test.d.ts +2 -0
  1258. package/dist/hud/__tests__/tmux.test.d.ts.map +1 -0
  1259. package/dist/hud/__tests__/tmux.test.js +679 -0
  1260. package/dist/hud/__tests__/tmux.test.js.map +1 -0
  1261. package/dist/hud/__tests__/types.test.d.ts +2 -0
  1262. package/dist/hud/__tests__/types.test.d.ts.map +1 -0
  1263. package/dist/hud/__tests__/types.test.js +79 -0
  1264. package/dist/hud/__tests__/types.test.js.map +1 -0
  1265. package/dist/hud/__tests__/watch.test.d.ts +2 -0
  1266. package/dist/hud/__tests__/watch.test.d.ts.map +1 -0
  1267. package/dist/hud/__tests__/watch.test.js +63 -0
  1268. package/dist/hud/__tests__/watch.test.js.map +1 -0
  1269. package/dist/hud/authority.d.ts +22 -0
  1270. package/dist/hud/authority.d.ts.map +1 -0
  1271. package/dist/hud/authority.js +377 -0
  1272. package/dist/hud/authority.js.map +1 -0
  1273. package/dist/hud/colors.d.ts +20 -0
  1274. package/dist/hud/colors.d.ts.map +1 -0
  1275. package/dist/hud/colors.js +60 -0
  1276. package/dist/hud/colors.js.map +1 -0
  1277. package/dist/hud/constants.d.ts +16 -0
  1278. package/dist/hud/constants.d.ts.map +1 -0
  1279. package/dist/hud/constants.js +25 -0
  1280. package/dist/hud/constants.js.map +1 -0
  1281. package/dist/hud/index.d.ts +79 -0
  1282. package/dist/hud/index.d.ts.map +1 -0
  1283. package/dist/hud/index.js +384 -0
  1284. package/dist/hud/index.js.map +1 -0
  1285. package/dist/hud/reconcile.d.ts +37 -0
  1286. package/dist/hud/reconcile.d.ts.map +1 -0
  1287. package/dist/hud/reconcile.js +326 -0
  1288. package/dist/hud/reconcile.js.map +1 -0
  1289. package/dist/hud/render.d.ts +15 -0
  1290. package/dist/hud/render.d.ts.map +1 -0
  1291. package/dist/hud/render.js +453 -0
  1292. package/dist/hud/render.js.map +1 -0
  1293. package/dist/hud/state.d.ts +27 -0
  1294. package/dist/hud/state.d.ts.map +1 -0
  1295. package/dist/hud/state.js +477 -0
  1296. package/dist/hud/state.js.map +1 -0
  1297. package/dist/hud/tmux.d.ts +87 -0
  1298. package/dist/hud/tmux.d.ts.map +1 -0
  1299. package/dist/hud/tmux.js +572 -0
  1300. package/dist/hud/tmux.js.map +1 -0
  1301. package/dist/hud/types.d.ts +165 -0
  1302. package/dist/hud/types.d.ts.map +1 -0
  1303. package/dist/hud/types.js +14 -0
  1304. package/dist/hud/types.js.map +1 -0
  1305. package/dist/imagegen/continuation.d.ts +44 -0
  1306. package/dist/imagegen/continuation.d.ts.map +1 -0
  1307. package/dist/imagegen/continuation.js +220 -0
  1308. package/dist/imagegen/continuation.js.map +1 -0
  1309. package/dist/index.d.ts +19 -0
  1310. package/dist/index.d.ts.map +1 -0
  1311. package/dist/index.js +19 -0
  1312. package/dist/index.js.map +1 -0
  1313. package/dist/mcp/__tests__/bootstrap.test.d.ts +2 -0
  1314. package/dist/mcp/__tests__/bootstrap.test.d.ts.map +1 -0
  1315. package/dist/mcp/__tests__/bootstrap.test.js +372 -0
  1316. package/dist/mcp/__tests__/bootstrap.test.js.map +1 -0
  1317. package/dist/mcp/__tests__/code-intel-server.test.d.ts +2 -0
  1318. package/dist/mcp/__tests__/code-intel-server.test.d.ts.map +1 -0
  1319. package/dist/mcp/__tests__/code-intel-server.test.js +70 -0
  1320. package/dist/mcp/__tests__/code-intel-server.test.js.map +1 -0
  1321. package/dist/mcp/__tests__/hermes-bridge.test.d.ts +2 -0
  1322. package/dist/mcp/__tests__/hermes-bridge.test.d.ts.map +1 -0
  1323. package/dist/mcp/__tests__/hermes-bridge.test.js +651 -0
  1324. package/dist/mcp/__tests__/hermes-bridge.test.js.map +1 -0
  1325. package/dist/mcp/__tests__/memory-server.test.d.ts +2 -0
  1326. package/dist/mcp/__tests__/memory-server.test.d.ts.map +1 -0
  1327. package/dist/mcp/__tests__/memory-server.test.js +36 -0
  1328. package/dist/mcp/__tests__/memory-server.test.js.map +1 -0
  1329. package/dist/mcp/__tests__/memory-validation.test.d.ts +2 -0
  1330. package/dist/mcp/__tests__/memory-validation.test.d.ts.map +1 -0
  1331. package/dist/mcp/__tests__/memory-validation.test.js +29 -0
  1332. package/dist/mcp/__tests__/memory-validation.test.js.map +1 -0
  1333. package/dist/mcp/__tests__/path-traversal.test.d.ts +2 -0
  1334. package/dist/mcp/__tests__/path-traversal.test.d.ts.map +1 -0
  1335. package/dist/mcp/__tests__/path-traversal.test.js +83 -0
  1336. package/dist/mcp/__tests__/path-traversal.test.js.map +1 -0
  1337. package/dist/mcp/__tests__/server-lifecycle.test.d.ts +2 -0
  1338. package/dist/mcp/__tests__/server-lifecycle.test.d.ts.map +1 -0
  1339. package/dist/mcp/__tests__/server-lifecycle.test.js +308 -0
  1340. package/dist/mcp/__tests__/server-lifecycle.test.js.map +1 -0
  1341. package/dist/mcp/__tests__/state-paths.test.d.ts +2 -0
  1342. package/dist/mcp/__tests__/state-paths.test.d.ts.map +1 -0
  1343. package/dist/mcp/__tests__/state-paths.test.js +477 -0
  1344. package/dist/mcp/__tests__/state-paths.test.js.map +1 -0
  1345. package/dist/mcp/__tests__/state-server-ralph-phase.test.d.ts +2 -0
  1346. package/dist/mcp/__tests__/state-server-ralph-phase.test.d.ts.map +1 -0
  1347. package/dist/mcp/__tests__/state-server-ralph-phase.test.js +109 -0
  1348. package/dist/mcp/__tests__/state-server-ralph-phase.test.js.map +1 -0
  1349. package/dist/mcp/__tests__/state-server-schema.test.d.ts +2 -0
  1350. package/dist/mcp/__tests__/state-server-schema.test.d.ts.map +1 -0
  1351. package/dist/mcp/__tests__/state-server-schema.test.js +29 -0
  1352. package/dist/mcp/__tests__/state-server-schema.test.js.map +1 -0
  1353. package/dist/mcp/__tests__/state-server-team-tools.test.d.ts +2 -0
  1354. package/dist/mcp/__tests__/state-server-team-tools.test.d.ts.map +1 -0
  1355. package/dist/mcp/__tests__/state-server-team-tools.test.js +35 -0
  1356. package/dist/mcp/__tests__/state-server-team-tools.test.js.map +1 -0
  1357. package/dist/mcp/__tests__/state-server.test.d.ts +2 -0
  1358. package/dist/mcp/__tests__/state-server.test.d.ts.map +1 -0
  1359. package/dist/mcp/__tests__/state-server.test.js +1318 -0
  1360. package/dist/mcp/__tests__/state-server.test.js.map +1 -0
  1361. package/dist/mcp/__tests__/trace-server.test.d.ts +2 -0
  1362. package/dist/mcp/__tests__/trace-server.test.d.ts.map +1 -0
  1363. package/dist/mcp/__tests__/trace-server.test.js +119 -0
  1364. package/dist/mcp/__tests__/trace-server.test.js.map +1 -0
  1365. package/dist/mcp/__tests__/wiki-server.test.d.ts +2 -0
  1366. package/dist/mcp/__tests__/wiki-server.test.d.ts.map +1 -0
  1367. package/dist/mcp/__tests__/wiki-server.test.js +126 -0
  1368. package/dist/mcp/__tests__/wiki-server.test.js.map +1 -0
  1369. package/dist/mcp/bootstrap.d.ts +44 -0
  1370. package/dist/mcp/bootstrap.d.ts.map +1 -0
  1371. package/dist/mcp/bootstrap.js +520 -0
  1372. package/dist/mcp/bootstrap.js.map +1 -0
  1373. package/dist/mcp/code-intel-server.d.ts +333 -0
  1374. package/dist/mcp/code-intel-server.d.ts.map +1 -0
  1375. package/dist/mcp/code-intel-server.js +605 -0
  1376. package/dist/mcp/code-intel-server.js.map +1 -0
  1377. package/dist/mcp/hermes-bridge.d.ts +124 -0
  1378. package/dist/mcp/hermes-bridge.d.ts.map +1 -0
  1379. package/dist/mcp/hermes-bridge.js +549 -0
  1380. package/dist/mcp/hermes-bridge.js.map +1 -0
  1381. package/dist/mcp/hermes-server.d.ts +374 -0
  1382. package/dist/mcp/hermes-server.d.ts.map +1 -0
  1383. package/dist/mcp/hermes-server.js +158 -0
  1384. package/dist/mcp/hermes-server.js.map +1 -0
  1385. package/dist/mcp/lifecycle-telemetry.d.ts +16 -0
  1386. package/dist/mcp/lifecycle-telemetry.d.ts.map +1 -0
  1387. package/dist/mcp/lifecycle-telemetry.js +95 -0
  1388. package/dist/mcp/lifecycle-telemetry.js.map +1 -0
  1389. package/dist/mcp/memory-server.d.ts +201 -0
  1390. package/dist/mcp/memory-server.d.ts.map +1 -0
  1391. package/dist/mcp/memory-server.js +441 -0
  1392. package/dist/mcp/memory-server.js.map +1 -0
  1393. package/dist/mcp/memory-validation.d.ts +9 -0
  1394. package/dist/mcp/memory-validation.d.ts.map +1 -0
  1395. package/dist/mcp/memory-validation.js +11 -0
  1396. package/dist/mcp/memory-validation.js.map +1 -0
  1397. package/dist/mcp/state-paths.d.ts +91 -0
  1398. package/dist/mcp/state-paths.d.ts.map +1 -0
  1399. package/dist/mcp/state-paths.js +473 -0
  1400. package/dist/mcp/state-paths.js.map +1 -0
  1401. package/dist/mcp/state-server.d.ts +222 -0
  1402. package/dist/mcp/state-server.d.ts.map +1 -0
  1403. package/dist/mcp/state-server.js +181 -0
  1404. package/dist/mcp/state-server.js.map +1 -0
  1405. package/dist/mcp/trace-server.d.ts +81 -0
  1406. package/dist/mcp/trace-server.d.ts.map +1 -0
  1407. package/dist/mcp/trace-server.js +271 -0
  1408. package/dist/mcp/trace-server.js.map +1 -0
  1409. package/dist/mcp/wiki-server.d.ts +181 -0
  1410. package/dist/mcp/wiki-server.d.ts.map +1 -0
  1411. package/dist/mcp/wiki-server.js +244 -0
  1412. package/dist/mcp/wiki-server.js.map +1 -0
  1413. package/dist/modes/__tests__/base-autopilot-gates.test.d.ts +2 -0
  1414. package/dist/modes/__tests__/base-autopilot-gates.test.d.ts.map +1 -0
  1415. package/dist/modes/__tests__/base-autopilot-gates.test.js +154 -0
  1416. package/dist/modes/__tests__/base-autopilot-gates.test.js.map +1 -0
  1417. package/dist/modes/__tests__/base-autoresearch-contract.test.d.ts +2 -0
  1418. package/dist/modes/__tests__/base-autoresearch-contract.test.d.ts.map +1 -0
  1419. package/dist/modes/__tests__/base-autoresearch-contract.test.js +129 -0
  1420. package/dist/modes/__tests__/base-autoresearch-contract.test.js.map +1 -0
  1421. package/dist/modes/__tests__/base-multi-state-compat.test.d.ts +2 -0
  1422. package/dist/modes/__tests__/base-multi-state-compat.test.d.ts.map +1 -0
  1423. package/dist/modes/__tests__/base-multi-state-compat.test.js +38 -0
  1424. package/dist/modes/__tests__/base-multi-state-compat.test.js.map +1 -0
  1425. package/dist/modes/__tests__/base-ralph-contract.test.d.ts +2 -0
  1426. package/dist/modes/__tests__/base-ralph-contract.test.d.ts.map +1 -0
  1427. package/dist/modes/__tests__/base-ralph-contract.test.js +64 -0
  1428. package/dist/modes/__tests__/base-ralph-contract.test.js.map +1 -0
  1429. package/dist/modes/__tests__/base-session-scope.test.d.ts +2 -0
  1430. package/dist/modes/__tests__/base-session-scope.test.d.ts.map +1 -0
  1431. package/dist/modes/__tests__/base-session-scope.test.js +146 -0
  1432. package/dist/modes/__tests__/base-session-scope.test.js.map +1 -0
  1433. package/dist/modes/__tests__/base-tmux-pane.test.d.ts +2 -0
  1434. package/dist/modes/__tests__/base-tmux-pane.test.d.ts.map +1 -0
  1435. package/dist/modes/__tests__/base-tmux-pane.test.js +100 -0
  1436. package/dist/modes/__tests__/base-tmux-pane.test.js.map +1 -0
  1437. package/dist/modes/base.d.ts +60 -0
  1438. package/dist/modes/base.d.ts.map +1 -0
  1439. package/dist/modes/base.js +346 -0
  1440. package/dist/modes/base.js.map +1 -0
  1441. package/dist/notifications/__tests__/config.test.d.ts +2 -0
  1442. package/dist/notifications/__tests__/config.test.d.ts.map +1 -0
  1443. package/dist/notifications/__tests__/config.test.js +269 -0
  1444. package/dist/notifications/__tests__/config.test.js.map +1 -0
  1445. package/dist/notifications/__tests__/custom-alias-enablement.test.d.ts +2 -0
  1446. package/dist/notifications/__tests__/custom-alias-enablement.test.d.ts.map +1 -0
  1447. package/dist/notifications/__tests__/custom-alias-enablement.test.js +84 -0
  1448. package/dist/notifications/__tests__/custom-alias-enablement.test.js.map +1 -0
  1449. package/dist/notifications/__tests__/dispatch-cooldown.test.d.ts +5 -0
  1450. package/dist/notifications/__tests__/dispatch-cooldown.test.d.ts.map +1 -0
  1451. package/dist/notifications/__tests__/dispatch-cooldown.test.js +100 -0
  1452. package/dist/notifications/__tests__/dispatch-cooldown.test.js.map +1 -0
  1453. package/dist/notifications/__tests__/dispatcher.test.d.ts +2 -0
  1454. package/dist/notifications/__tests__/dispatcher.test.d.ts.map +1 -0
  1455. package/dist/notifications/__tests__/dispatcher.test.js +202 -0
  1456. package/dist/notifications/__tests__/dispatcher.test.js.map +1 -0
  1457. package/dist/notifications/__tests__/formatter.test.d.ts +2 -0
  1458. package/dist/notifications/__tests__/formatter.test.d.ts.map +1 -0
  1459. package/dist/notifications/__tests__/formatter.test.js +270 -0
  1460. package/dist/notifications/__tests__/formatter.test.js.map +1 -0
  1461. package/dist/notifications/__tests__/hook-config.test.d.ts +5 -0
  1462. package/dist/notifications/__tests__/hook-config.test.d.ts.map +1 -0
  1463. package/dist/notifications/__tests__/hook-config.test.js +139 -0
  1464. package/dist/notifications/__tests__/hook-config.test.js.map +1 -0
  1465. package/dist/notifications/__tests__/http-client-resource.test.d.ts +2 -0
  1466. package/dist/notifications/__tests__/http-client-resource.test.d.ts.map +1 -0
  1467. package/dist/notifications/__tests__/http-client-resource.test.js +41 -0
  1468. package/dist/notifications/__tests__/http-client-resource.test.js.map +1 -0
  1469. package/dist/notifications/__tests__/http-client.test.d.ts +2 -0
  1470. package/dist/notifications/__tests__/http-client.test.d.ts.map +1 -0
  1471. package/dist/notifications/__tests__/http-client.test.js +90 -0
  1472. package/dist/notifications/__tests__/http-client.test.js.map +1 -0
  1473. package/dist/notifications/__tests__/idle-cooldown.test.d.ts +5 -0
  1474. package/dist/notifications/__tests__/idle-cooldown.test.d.ts.map +1 -0
  1475. package/dist/notifications/__tests__/idle-cooldown.test.js +209 -0
  1476. package/dist/notifications/__tests__/idle-cooldown.test.js.map +1 -0
  1477. package/dist/notifications/__tests__/index.test.d.ts +2 -0
  1478. package/dist/notifications/__tests__/index.test.d.ts.map +1 -0
  1479. package/dist/notifications/__tests__/index.test.js +188 -0
  1480. package/dist/notifications/__tests__/index.test.js.map +1 -0
  1481. package/dist/notifications/__tests__/lifecycle-dedupe.test.d.ts +2 -0
  1482. package/dist/notifications/__tests__/lifecycle-dedupe.test.d.ts.map +1 -0
  1483. package/dist/notifications/__tests__/lifecycle-dedupe.test.js +86 -0
  1484. package/dist/notifications/__tests__/lifecycle-dedupe.test.js.map +1 -0
  1485. package/dist/notifications/__tests__/notifier.test.d.ts +2 -0
  1486. package/dist/notifications/__tests__/notifier.test.d.ts.map +1 -0
  1487. package/dist/notifications/__tests__/notifier.test.js +201 -0
  1488. package/dist/notifications/__tests__/notifier.test.js.map +1 -0
  1489. package/dist/notifications/__tests__/profiles.test.d.ts +2 -0
  1490. package/dist/notifications/__tests__/profiles.test.d.ts.map +1 -0
  1491. package/dist/notifications/__tests__/profiles.test.js +404 -0
  1492. package/dist/notifications/__tests__/profiles.test.js.map +1 -0
  1493. package/dist/notifications/__tests__/reply-config.test.d.ts +2 -0
  1494. package/dist/notifications/__tests__/reply-config.test.d.ts.map +1 -0
  1495. package/dist/notifications/__tests__/reply-config.test.js +79 -0
  1496. package/dist/notifications/__tests__/reply-config.test.js.map +1 -0
  1497. package/dist/notifications/__tests__/reply-listener.test.d.ts +2 -0
  1498. package/dist/notifications/__tests__/reply-listener.test.d.ts.map +1 -0
  1499. package/dist/notifications/__tests__/reply-listener.test.js +723 -0
  1500. package/dist/notifications/__tests__/reply-listener.test.js.map +1 -0
  1501. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.d.ts +2 -0
  1502. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.d.ts.map +1 -0
  1503. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js +93 -0
  1504. package/dist/notifications/__tests__/session-idle-tail-dedupe.test.js.map +1 -0
  1505. package/dist/notifications/__tests__/session-registry.test.d.ts +2 -0
  1506. package/dist/notifications/__tests__/session-registry.test.d.ts.map +1 -0
  1507. package/dist/notifications/__tests__/session-registry.test.js +234 -0
  1508. package/dist/notifications/__tests__/session-registry.test.js.map +1 -0
  1509. package/dist/notifications/__tests__/session-status.test.d.ts +2 -0
  1510. package/dist/notifications/__tests__/session-status.test.d.ts.map +1 -0
  1511. package/dist/notifications/__tests__/session-status.test.js +249 -0
  1512. package/dist/notifications/__tests__/session-status.test.js.map +1 -0
  1513. package/dist/notifications/__tests__/temp-mode.test.d.ts +2 -0
  1514. package/dist/notifications/__tests__/temp-mode.test.d.ts.map +1 -0
  1515. package/dist/notifications/__tests__/temp-mode.test.js +172 -0
  1516. package/dist/notifications/__tests__/temp-mode.test.js.map +1 -0
  1517. package/dist/notifications/__tests__/template-engine.test.d.ts +5 -0
  1518. package/dist/notifications/__tests__/template-engine.test.d.ts.map +1 -0
  1519. package/dist/notifications/__tests__/template-engine.test.js +158 -0
  1520. package/dist/notifications/__tests__/template-engine.test.js.map +1 -0
  1521. package/dist/notifications/__tests__/tmux-detector.test.d.ts +2 -0
  1522. package/dist/notifications/__tests__/tmux-detector.test.d.ts.map +1 -0
  1523. package/dist/notifications/__tests__/tmux-detector.test.js +204 -0
  1524. package/dist/notifications/__tests__/tmux-detector.test.js.map +1 -0
  1525. package/dist/notifications/__tests__/tmux.test.d.ts +2 -0
  1526. package/dist/notifications/__tests__/tmux.test.d.ts.map +1 -0
  1527. package/dist/notifications/__tests__/tmux.test.js +285 -0
  1528. package/dist/notifications/__tests__/tmux.test.js.map +1 -0
  1529. package/dist/notifications/__tests__/verbosity.test.d.ts +2 -0
  1530. package/dist/notifications/__tests__/verbosity.test.d.ts.map +1 -0
  1531. package/dist/notifications/__tests__/verbosity.test.js +257 -0
  1532. package/dist/notifications/__tests__/verbosity.test.js.map +1 -0
  1533. package/dist/notifications/config.d.ts +65 -0
  1534. package/dist/notifications/config.d.ts.map +1 -0
  1535. package/dist/notifications/config.js +615 -0
  1536. package/dist/notifications/config.js.map +1 -0
  1537. package/dist/notifications/dispatch-cooldown.d.ts +36 -0
  1538. package/dist/notifications/dispatch-cooldown.d.ts.map +1 -0
  1539. package/dist/notifications/dispatch-cooldown.js +109 -0
  1540. package/dist/notifications/dispatch-cooldown.js.map +1 -0
  1541. package/dist/notifications/dispatcher.d.ts +15 -0
  1542. package/dist/notifications/dispatcher.d.ts.map +1 -0
  1543. package/dist/notifications/dispatcher.js +385 -0
  1544. package/dist/notifications/dispatcher.js.map +1 -0
  1545. package/dist/notifications/formatter.d.ts +30 -0
  1546. package/dist/notifications/formatter.d.ts.map +1 -0
  1547. package/dist/notifications/formatter.js +234 -0
  1548. package/dist/notifications/formatter.js.map +1 -0
  1549. package/dist/notifications/hook-config-types.d.ts +43 -0
  1550. package/dist/notifications/hook-config-types.d.ts.map +1 -0
  1551. package/dist/notifications/hook-config-types.js +8 -0
  1552. package/dist/notifications/hook-config-types.js.map +1 -0
  1553. package/dist/notifications/hook-config.d.ts +40 -0
  1554. package/dist/notifications/hook-config.d.ts.map +1 -0
  1555. package/dist/notifications/hook-config.js +127 -0
  1556. package/dist/notifications/hook-config.js.map +1 -0
  1557. package/dist/notifications/http-client.d.ts +22 -0
  1558. package/dist/notifications/http-client.d.ts.map +1 -0
  1559. package/dist/notifications/http-client.js +349 -0
  1560. package/dist/notifications/http-client.js.map +1 -0
  1561. package/dist/notifications/idle-cooldown.d.ts +61 -0
  1562. package/dist/notifications/idle-cooldown.d.ts.map +1 -0
  1563. package/dist/notifications/idle-cooldown.js +207 -0
  1564. package/dist/notifications/idle-cooldown.js.map +1 -0
  1565. package/dist/notifications/index.d.ts +40 -0
  1566. package/dist/notifications/index.d.ts.map +1 -0
  1567. package/dist/notifications/index.js +228 -0
  1568. package/dist/notifications/index.js.map +1 -0
  1569. package/dist/notifications/lifecycle-dedupe.d.ts +8 -0
  1570. package/dist/notifications/lifecycle-dedupe.d.ts.map +1 -0
  1571. package/dist/notifications/lifecycle-dedupe.js +112 -0
  1572. package/dist/notifications/lifecycle-dedupe.js.map +1 -0
  1573. package/dist/notifications/notifier.d.ts +45 -0
  1574. package/dist/notifications/notifier.d.ts.map +1 -0
  1575. package/dist/notifications/notifier.js +146 -0
  1576. package/dist/notifications/notifier.js.map +1 -0
  1577. package/dist/notifications/reply-listener.d.ts +123 -0
  1578. package/dist/notifications/reply-listener.d.ts.map +1 -0
  1579. package/dist/notifications/reply-listener.js +846 -0
  1580. package/dist/notifications/reply-listener.js.map +1 -0
  1581. package/dist/notifications/session-registry.d.ts +26 -0
  1582. package/dist/notifications/session-registry.d.ts.map +1 -0
  1583. package/dist/notifications/session-registry.js +293 -0
  1584. package/dist/notifications/session-registry.js.map +1 -0
  1585. package/dist/notifications/session-status.d.ts +25 -0
  1586. package/dist/notifications/session-status.d.ts.map +1 -0
  1587. package/dist/notifications/session-status.js +202 -0
  1588. package/dist/notifications/session-status.js.map +1 -0
  1589. package/dist/notifications/temp-contract.d.ts +22 -0
  1590. package/dist/notifications/temp-contract.d.ts.map +1 -0
  1591. package/dist/notifications/temp-contract.js +147 -0
  1592. package/dist/notifications/temp-contract.js.map +1 -0
  1593. package/dist/notifications/template-engine.d.ts +34 -0
  1594. package/dist/notifications/template-engine.d.ts.map +1 -0
  1595. package/dist/notifications/template-engine.js +249 -0
  1596. package/dist/notifications/template-engine.js.map +1 -0
  1597. package/dist/notifications/tmux-detector.d.ts +59 -0
  1598. package/dist/notifications/tmux-detector.d.ts.map +1 -0
  1599. package/dist/notifications/tmux-detector.js +126 -0
  1600. package/dist/notifications/tmux-detector.js.map +1 -0
  1601. package/dist/notifications/tmux.d.ts +44 -0
  1602. package/dist/notifications/tmux.d.ts.map +1 -0
  1603. package/dist/notifications/tmux.js +293 -0
  1604. package/dist/notifications/tmux.js.map +1 -0
  1605. package/dist/notifications/types.d.ts +226 -0
  1606. package/dist/notifications/types.d.ts.map +1 -0
  1607. package/dist/notifications/types.js +9 -0
  1608. package/dist/notifications/types.js.map +1 -0
  1609. package/dist/openclaw/__tests__/config.test.d.ts +6 -0
  1610. package/dist/openclaw/__tests__/config.test.d.ts.map +1 -0
  1611. package/dist/openclaw/__tests__/config.test.js +344 -0
  1612. package/dist/openclaw/__tests__/config.test.js.map +1 -0
  1613. package/dist/openclaw/__tests__/dispatcher.test.d.ts +5 -0
  1614. package/dist/openclaw/__tests__/dispatcher.test.d.ts.map +1 -0
  1615. package/dist/openclaw/__tests__/dispatcher.test.js +278 -0
  1616. package/dist/openclaw/__tests__/dispatcher.test.js.map +1 -0
  1617. package/dist/openclaw/__tests__/index.test.d.ts +6 -0
  1618. package/dist/openclaw/__tests__/index.test.d.ts.map +1 -0
  1619. package/dist/openclaw/__tests__/index.test.js +382 -0
  1620. package/dist/openclaw/__tests__/index.test.js.map +1 -0
  1621. package/dist/openclaw/config.d.ts +59 -0
  1622. package/dist/openclaw/config.d.ts.map +1 -0
  1623. package/dist/openclaw/config.js +400 -0
  1624. package/dist/openclaw/config.js.map +1 -0
  1625. package/dist/openclaw/dispatcher.d.ts +75 -0
  1626. package/dist/openclaw/dispatcher.d.ts.map +1 -0
  1627. package/dist/openclaw/dispatcher.js +223 -0
  1628. package/dist/openclaw/dispatcher.js.map +1 -0
  1629. package/dist/openclaw/index.d.ts +29 -0
  1630. package/dist/openclaw/index.d.ts.map +1 -0
  1631. package/dist/openclaw/index.js +149 -0
  1632. package/dist/openclaw/index.js.map +1 -0
  1633. package/dist/openclaw/types.d.ts +123 -0
  1634. package/dist/openclaw/types.d.ts.map +1 -0
  1635. package/dist/openclaw/types.js +12 -0
  1636. package/dist/openclaw/types.js.map +1 -0
  1637. package/dist/performance-goal/artifacts.d.ts +76 -0
  1638. package/dist/performance-goal/artifacts.d.ts.map +1 -0
  1639. package/dist/performance-goal/artifacts.js +221 -0
  1640. package/dist/performance-goal/artifacts.js.map +1 -0
  1641. package/dist/pipeline/__tests__/orchestrator.test.d.ts +2 -0
  1642. package/dist/pipeline/__tests__/orchestrator.test.d.ts.map +1 -0
  1643. package/dist/pipeline/__tests__/orchestrator.test.js +645 -0
  1644. package/dist/pipeline/__tests__/orchestrator.test.js.map +1 -0
  1645. package/dist/pipeline/__tests__/stages.test.d.ts +2 -0
  1646. package/dist/pipeline/__tests__/stages.test.d.ts.map +1 -0
  1647. package/dist/pipeline/__tests__/stages.test.js +1638 -0
  1648. package/dist/pipeline/__tests__/stages.test.js.map +1 -0
  1649. package/dist/pipeline/index.d.ts +25 -0
  1650. package/dist/pipeline/index.d.ts.map +1 -0
  1651. package/dist/pipeline/index.js +17 -0
  1652. package/dist/pipeline/index.js.map +1 -0
  1653. package/dist/pipeline/orchestrator.d.ts +52 -0
  1654. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  1655. package/dist/pipeline/orchestrator.js +392 -0
  1656. package/dist/pipeline/orchestrator.js.map +1 -0
  1657. package/dist/pipeline/review-verdict.d.ts +3 -0
  1658. package/dist/pipeline/review-verdict.d.ts.map +1 -0
  1659. package/dist/pipeline/review-verdict.js +14 -0
  1660. package/dist/pipeline/review-verdict.js.map +1 -0
  1661. package/dist/pipeline/stages/code-review.d.ts +35 -0
  1662. package/dist/pipeline/stages/code-review.d.ts.map +1 -0
  1663. package/dist/pipeline/stages/code-review.js +55 -0
  1664. package/dist/pipeline/stages/code-review.js.map +1 -0
  1665. package/dist/pipeline/stages/deep-interview.d.ts +15 -0
  1666. package/dist/pipeline/stages/deep-interview.d.ts.map +1 -0
  1667. package/dist/pipeline/stages/deep-interview.js +32 -0
  1668. package/dist/pipeline/stages/deep-interview.js.map +1 -0
  1669. package/dist/pipeline/stages/ralph-verify.d.ts +53 -0
  1670. package/dist/pipeline/stages/ralph-verify.d.ts.map +1 -0
  1671. package/dist/pipeline/stages/ralph-verify.js +89 -0
  1672. package/dist/pipeline/stages/ralph-verify.js.map +1 -0
  1673. package/dist/pipeline/stages/ralplan.d.ts +26 -0
  1674. package/dist/pipeline/stages/ralplan.d.ts.map +1 -0
  1675. package/dist/pipeline/stages/ralplan.js +151 -0
  1676. package/dist/pipeline/stages/ralplan.js.map +1 -0
  1677. package/dist/pipeline/stages/team-exec.d.ts +52 -0
  1678. package/dist/pipeline/stages/team-exec.d.ts.map +1 -0
  1679. package/dist/pipeline/stages/team-exec.js +266 -0
  1680. package/dist/pipeline/stages/team-exec.js.map +1 -0
  1681. package/dist/pipeline/stages/ultragoal.d.ts +19 -0
  1682. package/dist/pipeline/stages/ultragoal.d.ts.map +1 -0
  1683. package/dist/pipeline/stages/ultragoal.js +38 -0
  1684. package/dist/pipeline/stages/ultragoal.js.map +1 -0
  1685. package/dist/pipeline/stages/ultraqa.d.ts +33 -0
  1686. package/dist/pipeline/stages/ultraqa.d.ts.map +1 -0
  1687. package/dist/pipeline/stages/ultraqa.js +49 -0
  1688. package/dist/pipeline/stages/ultraqa.js.map +1 -0
  1689. package/dist/pipeline/types.d.ts +124 -0
  1690. package/dist/pipeline/types.d.ts.map +1 -0
  1691. package/dist/pipeline/types.js +8 -0
  1692. package/dist/pipeline/types.js.map +1 -0
  1693. package/dist/planning/__tests__/approved-execution-lifecycle-matrix.test.d.ts +2 -0
  1694. package/dist/planning/__tests__/approved-execution-lifecycle-matrix.test.d.ts.map +1 -0
  1695. package/dist/planning/__tests__/approved-execution-lifecycle-matrix.test.js +158 -0
  1696. package/dist/planning/__tests__/approved-execution-lifecycle-matrix.test.js.map +1 -0
  1697. package/dist/planning/__tests__/approved-launch-hint-lineage-matrix.test.d.ts +2 -0
  1698. package/dist/planning/__tests__/approved-launch-hint-lineage-matrix.test.d.ts.map +1 -0
  1699. package/dist/planning/__tests__/approved-launch-hint-lineage-matrix.test.js +440 -0
  1700. package/dist/planning/__tests__/approved-launch-hint-lineage-matrix.test.js.map +1 -0
  1701. package/dist/planning/__tests__/artifacts.test.d.ts +2 -0
  1702. package/dist/planning/__tests__/artifacts.test.d.ts.map +1 -0
  1703. package/dist/planning/__tests__/artifacts.test.js +942 -0
  1704. package/dist/planning/__tests__/artifacts.test.js.map +1 -0
  1705. package/dist/planning/__tests__/markdown-structure.test.d.ts +2 -0
  1706. package/dist/planning/__tests__/markdown-structure.test.d.ts.map +1 -0
  1707. package/dist/planning/__tests__/markdown-structure.test.js +459 -0
  1708. package/dist/planning/__tests__/markdown-structure.test.js.map +1 -0
  1709. package/dist/planning/artifact-names.d.ts +13 -0
  1710. package/dist/planning/artifact-names.d.ts.map +1 -0
  1711. package/dist/planning/artifact-names.js +108 -0
  1712. package/dist/planning/artifact-names.js.map +1 -0
  1713. package/dist/planning/artifacts.d.ts +65 -0
  1714. package/dist/planning/artifacts.d.ts.map +1 -0
  1715. package/dist/planning/artifacts.js +561 -0
  1716. package/dist/planning/artifacts.js.map +1 -0
  1717. package/dist/planning/markdown-structure.d.ts +20 -0
  1718. package/dist/planning/markdown-structure.d.ts.map +1 -0
  1719. package/dist/planning/markdown-structure.js +137 -0
  1720. package/dist/planning/markdown-structure.js.map +1 -0
  1721. package/dist/question/__tests__/client.test.d.ts +2 -0
  1722. package/dist/question/__tests__/client.test.d.ts.map +1 -0
  1723. package/dist/question/__tests__/client.test.js +90 -0
  1724. package/dist/question/__tests__/client.test.js.map +1 -0
  1725. package/dist/question/__tests__/deep-interview.test.d.ts +2 -0
  1726. package/dist/question/__tests__/deep-interview.test.d.ts.map +1 -0
  1727. package/dist/question/__tests__/deep-interview.test.js +440 -0
  1728. package/dist/question/__tests__/deep-interview.test.js.map +1 -0
  1729. package/dist/question/__tests__/policy.test.d.ts +2 -0
  1730. package/dist/question/__tests__/policy.test.d.ts.map +1 -0
  1731. package/dist/question/__tests__/policy.test.js +273 -0
  1732. package/dist/question/__tests__/policy.test.js.map +1 -0
  1733. package/dist/question/__tests__/renderer.test.d.ts +2 -0
  1734. package/dist/question/__tests__/renderer.test.d.ts.map +1 -0
  1735. package/dist/question/__tests__/renderer.test.js +1461 -0
  1736. package/dist/question/__tests__/renderer.test.js.map +1 -0
  1737. package/dist/question/__tests__/state.test.d.ts +2 -0
  1738. package/dist/question/__tests__/state.test.d.ts.map +1 -0
  1739. package/dist/question/__tests__/state.test.js +541 -0
  1740. package/dist/question/__tests__/state.test.js.map +1 -0
  1741. package/dist/question/__tests__/types.test.d.ts +2 -0
  1742. package/dist/question/__tests__/types.test.d.ts.map +1 -0
  1743. package/dist/question/__tests__/types.test.js +65 -0
  1744. package/dist/question/__tests__/types.test.js.map +1 -0
  1745. package/dist/question/__tests__/ui.test.d.ts +2 -0
  1746. package/dist/question/__tests__/ui.test.d.ts.map +1 -0
  1747. package/dist/question/__tests__/ui.test.js +483 -0
  1748. package/dist/question/__tests__/ui.test.js.map +1 -0
  1749. package/dist/question/autopilot-wait.d.ts +21 -0
  1750. package/dist/question/autopilot-wait.d.ts.map +1 -0
  1751. package/dist/question/autopilot-wait.js +251 -0
  1752. package/dist/question/autopilot-wait.js.map +1 -0
  1753. package/dist/question/client.d.ts +64 -0
  1754. package/dist/question/client.d.ts.map +1 -0
  1755. package/dist/question/client.js +77 -0
  1756. package/dist/question/client.js.map +1 -0
  1757. package/dist/question/deep-interview.d.ts +33 -0
  1758. package/dist/question/deep-interview.d.ts.map +1 -0
  1759. package/dist/question/deep-interview.js +216 -0
  1760. package/dist/question/deep-interview.js.map +1 -0
  1761. package/dist/question/events.d.ts +53 -0
  1762. package/dist/question/events.d.ts.map +1 -0
  1763. package/dist/question/events.js +201 -0
  1764. package/dist/question/events.js.map +1 -0
  1765. package/dist/question/policy.d.ts +19 -0
  1766. package/dist/question/policy.d.ts.map +1 -0
  1767. package/dist/question/policy.js +95 -0
  1768. package/dist/question/policy.js.map +1 -0
  1769. package/dist/question/renderer.d.ts +66 -0
  1770. package/dist/question/renderer.d.ts.map +1 -0
  1771. package/dist/question/renderer.js +748 -0
  1772. package/dist/question/renderer.js.map +1 -0
  1773. package/dist/question/state.d.ts +56 -0
  1774. package/dist/question/state.d.ts.map +1 -0
  1775. package/dist/question/state.js +432 -0
  1776. package/dist/question/state.js.map +1 -0
  1777. package/dist/question/types.d.ts +92 -0
  1778. package/dist/question/types.d.ts.map +1 -0
  1779. package/dist/question/types.js +117 -0
  1780. package/dist/question/types.js.map +1 -0
  1781. package/dist/question/ui.d.ts +66 -0
  1782. package/dist/question/ui.d.ts.map +1 -0
  1783. package/dist/question/ui.js +458 -0
  1784. package/dist/question/ui.js.map +1 -0
  1785. package/dist/ralph/__tests__/completion-audit.test.d.ts +2 -0
  1786. package/dist/ralph/__tests__/completion-audit.test.d.ts.map +1 -0
  1787. package/dist/ralph/__tests__/completion-audit.test.js +160 -0
  1788. package/dist/ralph/__tests__/completion-audit.test.js.map +1 -0
  1789. package/dist/ralph/__tests__/persistence.test.d.ts +2 -0
  1790. package/dist/ralph/__tests__/persistence.test.d.ts.map +1 -0
  1791. package/dist/ralph/__tests__/persistence.test.js +116 -0
  1792. package/dist/ralph/__tests__/persistence.test.js.map +1 -0
  1793. package/dist/ralph/completion-audit.d.ts +8 -0
  1794. package/dist/ralph/completion-audit.d.ts.map +1 -0
  1795. package/dist/ralph/completion-audit.js +99 -0
  1796. package/dist/ralph/completion-audit.js.map +1 -0
  1797. package/dist/ralph/contract.d.ts +17 -0
  1798. package/dist/ralph/contract.d.ts.map +1 -0
  1799. package/dist/ralph/contract.js +108 -0
  1800. package/dist/ralph/contract.js.map +1 -0
  1801. package/dist/ralph/persistence.d.ts +29 -0
  1802. package/dist/ralph/persistence.d.ts.map +1 -0
  1803. package/dist/ralph/persistence.js +273 -0
  1804. package/dist/ralph/persistence.js.map +1 -0
  1805. package/dist/ralplan/__tests__/consensus-gate.test.d.ts +2 -0
  1806. package/dist/ralplan/__tests__/consensus-gate.test.d.ts.map +1 -0
  1807. package/dist/ralplan/__tests__/consensus-gate.test.js +192 -0
  1808. package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -0
  1809. package/dist/ralplan/__tests__/runtime.test.d.ts +2 -0
  1810. package/dist/ralplan/__tests__/runtime.test.d.ts.map +1 -0
  1811. package/dist/ralplan/__tests__/runtime.test.js +548 -0
  1812. package/dist/ralplan/__tests__/runtime.test.js.map +1 -0
  1813. package/dist/ralplan/consensus-gate.d.ts +37 -0
  1814. package/dist/ralplan/consensus-gate.d.ts.map +1 -0
  1815. package/dist/ralplan/consensus-gate.js +422 -0
  1816. package/dist/ralplan/consensus-gate.js.map +1 -0
  1817. package/dist/ralplan/runtime.d.ts +86 -0
  1818. package/dist/ralplan/runtime.d.ts.map +1 -0
  1819. package/dist/ralplan/runtime.js +365 -0
  1820. package/dist/ralplan/runtime.js.map +1 -0
  1821. package/dist/runtime/__tests__/bridge.test.d.ts +2 -0
  1822. package/dist/runtime/__tests__/bridge.test.d.ts.map +1 -0
  1823. package/dist/runtime/__tests__/bridge.test.js +194 -0
  1824. package/dist/runtime/__tests__/bridge.test.js.map +1 -0
  1825. package/dist/runtime/__tests__/process-tree.test.d.ts +2 -0
  1826. package/dist/runtime/__tests__/process-tree.test.d.ts.map +1 -0
  1827. package/dist/runtime/__tests__/process-tree.test.js +107 -0
  1828. package/dist/runtime/__tests__/process-tree.test.js.map +1 -0
  1829. package/dist/runtime/__tests__/run-loop.test.d.ts +2 -0
  1830. package/dist/runtime/__tests__/run-loop.test.d.ts.map +1 -0
  1831. package/dist/runtime/__tests__/run-loop.test.js +35 -0
  1832. package/dist/runtime/__tests__/run-loop.test.js.map +1 -0
  1833. package/dist/runtime/__tests__/run-outcome.test.d.ts +2 -0
  1834. package/dist/runtime/__tests__/run-outcome.test.d.ts.map +1 -0
  1835. package/dist/runtime/__tests__/run-outcome.test.js +102 -0
  1836. package/dist/runtime/__tests__/run-outcome.test.js.map +1 -0
  1837. package/dist/runtime/__tests__/run-state.test.d.ts +2 -0
  1838. package/dist/runtime/__tests__/run-state.test.d.ts.map +1 -0
  1839. package/dist/runtime/__tests__/run-state.test.js +37 -0
  1840. package/dist/runtime/__tests__/run-state.test.js.map +1 -0
  1841. package/dist/runtime/bridge.d.ts +214 -0
  1842. package/dist/runtime/bridge.d.ts.map +1 -0
  1843. package/dist/runtime/bridge.js +223 -0
  1844. package/dist/runtime/bridge.js.map +1 -0
  1845. package/dist/runtime/process-tree.d.ts +28 -0
  1846. package/dist/runtime/process-tree.d.ts.map +1 -0
  1847. package/dist/runtime/process-tree.js +230 -0
  1848. package/dist/runtime/process-tree.js.map +1 -0
  1849. package/dist/runtime/run-loop.d.ts +45 -0
  1850. package/dist/runtime/run-loop.d.ts.map +1 -0
  1851. package/dist/runtime/run-loop.js +51 -0
  1852. package/dist/runtime/run-loop.js.map +1 -0
  1853. package/dist/runtime/run-outcome.d.ts +46 -0
  1854. package/dist/runtime/run-outcome.d.ts.map +1 -0
  1855. package/dist/runtime/run-outcome.js +285 -0
  1856. package/dist/runtime/run-outcome.js.map +1 -0
  1857. package/dist/runtime/run-state.d.ts +40 -0
  1858. package/dist/runtime/run-state.d.ts.map +1 -0
  1859. package/dist/runtime/run-state.js +120 -0
  1860. package/dist/runtime/run-state.js.map +1 -0
  1861. package/dist/runtime/terminal-lifecycle.d.ts +11 -0
  1862. package/dist/runtime/terminal-lifecycle.d.ts.map +1 -0
  1863. package/dist/runtime/terminal-lifecycle.js +52 -0
  1864. package/dist/runtime/terminal-lifecycle.js.map +1 -0
  1865. package/dist/scripts/__tests__/codex-native-hook.test.d.ts +2 -0
  1866. package/dist/scripts/__tests__/codex-native-hook.test.d.ts.map +1 -0
  1867. package/dist/scripts/__tests__/codex-native-hook.test.js +14253 -0
  1868. package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -0
  1869. package/dist/scripts/__tests__/docs-site-contract.test.d.ts +2 -0
  1870. package/dist/scripts/__tests__/docs-site-contract.test.d.ts.map +1 -0
  1871. package/dist/scripts/__tests__/docs-site-contract.test.js +42 -0
  1872. package/dist/scripts/__tests__/docs-site-contract.test.js.map +1 -0
  1873. package/dist/scripts/__tests__/generate-release-body.test.d.ts +2 -0
  1874. package/dist/scripts/__tests__/generate-release-body.test.d.ts.map +1 -0
  1875. package/dist/scripts/__tests__/generate-release-body.test.js +233 -0
  1876. package/dist/scripts/__tests__/generate-release-body.test.js.map +1 -0
  1877. package/dist/scripts/__tests__/hook-derived-watcher.test.d.ts +2 -0
  1878. package/dist/scripts/__tests__/hook-derived-watcher.test.d.ts.map +1 -0
  1879. package/dist/scripts/__tests__/hook-derived-watcher.test.js +227 -0
  1880. package/dist/scripts/__tests__/hook-derived-watcher.test.js.map +1 -0
  1881. package/dist/scripts/__tests__/notify-dispatcher.test.d.ts +2 -0
  1882. package/dist/scripts/__tests__/notify-dispatcher.test.d.ts.map +1 -0
  1883. package/dist/scripts/__tests__/notify-dispatcher.test.js +421 -0
  1884. package/dist/scripts/__tests__/notify-dispatcher.test.js.map +1 -0
  1885. package/dist/scripts/__tests__/notify-state-io.test.d.ts +2 -0
  1886. package/dist/scripts/__tests__/notify-state-io.test.d.ts.map +1 -0
  1887. package/dist/scripts/__tests__/notify-state-io.test.js +111 -0
  1888. package/dist/scripts/__tests__/notify-state-io.test.js.map +1 -0
  1889. package/dist/scripts/__tests__/notify-tmux-injection.test.d.ts +2 -0
  1890. package/dist/scripts/__tests__/notify-tmux-injection.test.d.ts.map +1 -0
  1891. package/dist/scripts/__tests__/notify-tmux-injection.test.js +57 -0
  1892. package/dist/scripts/__tests__/notify-tmux-injection.test.js.map +1 -0
  1893. package/dist/scripts/__tests__/postinstall.test.d.ts +2 -0
  1894. package/dist/scripts/__tests__/postinstall.test.d.ts.map +1 -0
  1895. package/dist/scripts/__tests__/postinstall.test.js +92 -0
  1896. package/dist/scripts/__tests__/postinstall.test.js.map +1 -0
  1897. package/dist/scripts/__tests__/prompt-inventory.test.d.ts +2 -0
  1898. package/dist/scripts/__tests__/prompt-inventory.test.d.ts.map +1 -0
  1899. package/dist/scripts/__tests__/prompt-inventory.test.js +56 -0
  1900. package/dist/scripts/__tests__/prompt-inventory.test.js.map +1 -0
  1901. package/dist/scripts/__tests__/run-test-files.test.d.ts +2 -0
  1902. package/dist/scripts/__tests__/run-test-files.test.d.ts.map +1 -0
  1903. package/dist/scripts/__tests__/run-test-files.test.js +365 -0
  1904. package/dist/scripts/__tests__/run-test-files.test.js.map +1 -0
  1905. package/dist/scripts/__tests__/smoke-packed-install.test.d.ts +2 -0
  1906. package/dist/scripts/__tests__/smoke-packed-install.test.d.ts.map +1 -0
  1907. package/dist/scripts/__tests__/smoke-packed-install.test.js +160 -0
  1908. package/dist/scripts/__tests__/smoke-packed-install.test.js.map +1 -0
  1909. package/dist/scripts/__tests__/test-reply-listener-live.test.d.ts +2 -0
  1910. package/dist/scripts/__tests__/test-reply-listener-live.test.d.ts.map +1 -0
  1911. package/dist/scripts/__tests__/test-reply-listener-live.test.js +82 -0
  1912. package/dist/scripts/__tests__/test-reply-listener-live.test.js.map +1 -0
  1913. package/dist/scripts/__tests__/verify-native-agents.test.d.ts +2 -0
  1914. package/dist/scripts/__tests__/verify-native-agents.test.d.ts.map +1 -0
  1915. package/dist/scripts/__tests__/verify-native-agents.test.js +246 -0
  1916. package/dist/scripts/__tests__/verify-native-agents.test.js.map +1 -0
  1917. package/dist/scripts/build-api.d.ts +2 -0
  1918. package/dist/scripts/build-api.d.ts.map +1 -0
  1919. package/dist/scripts/build-api.js +44 -0
  1920. package/dist/scripts/build-api.js.map +1 -0
  1921. package/dist/scripts/build-explore-harness.d.ts +3 -0
  1922. package/dist/scripts/build-explore-harness.d.ts.map +1 -0
  1923. package/dist/scripts/build-explore-harness.js +50 -0
  1924. package/dist/scripts/build-explore-harness.js.map +1 -0
  1925. package/dist/scripts/build-sparkshell.d.ts +2 -0
  1926. package/dist/scripts/build-sparkshell.d.ts.map +1 -0
  1927. package/dist/scripts/build-sparkshell.js +46 -0
  1928. package/dist/scripts/build-sparkshell.js.map +1 -0
  1929. package/dist/scripts/check-runtime-syntax.d.ts +3 -0
  1930. package/dist/scripts/check-runtime-syntax.d.ts.map +1 -0
  1931. package/dist/scripts/check-runtime-syntax.js +57 -0
  1932. package/dist/scripts/check-runtime-syntax.js.map +1 -0
  1933. package/dist/scripts/check-version-sync.d.ts +3 -0
  1934. package/dist/scripts/check-version-sync.d.ts.map +1 -0
  1935. package/dist/scripts/check-version-sync.js +53 -0
  1936. package/dist/scripts/check-version-sync.js.map +1 -0
  1937. package/dist/scripts/cleanup-explore-harness.d.ts +3 -0
  1938. package/dist/scripts/cleanup-explore-harness.d.ts.map +1 -0
  1939. package/dist/scripts/cleanup-explore-harness.js +17 -0
  1940. package/dist/scripts/cleanup-explore-harness.js.map +1 -0
  1941. package/dist/scripts/codex-execution-surface.d.ts +16 -0
  1942. package/dist/scripts/codex-execution-surface.d.ts.map +1 -0
  1943. package/dist/scripts/codex-execution-surface.js +42 -0
  1944. package/dist/scripts/codex-execution-surface.js.map +1 -0
  1945. package/dist/scripts/codex-native-hook.d.ts +26 -0
  1946. package/dist/scripts/codex-native-hook.d.ts.map +1 -0
  1947. package/dist/scripts/codex-native-hook.js +3842 -0
  1948. package/dist/scripts/codex-native-hook.js.map +1 -0
  1949. package/dist/scripts/codex-native-pre-post.d.ts +46 -0
  1950. package/dist/scripts/codex-native-pre-post.d.ts.map +1 -0
  1951. package/dist/scripts/codex-native-pre-post.js +1186 -0
  1952. package/dist/scripts/codex-native-pre-post.js.map +1 -0
  1953. package/dist/scripts/eval/eval-candidate-handoff.d.ts +2 -0
  1954. package/dist/scripts/eval/eval-candidate-handoff.d.ts.map +1 -0
  1955. package/dist/scripts/eval/eval-candidate-handoff.js +11 -0
  1956. package/dist/scripts/eval/eval-candidate-handoff.js.map +1 -0
  1957. package/dist/scripts/eval/eval-cli-discoverability.d.ts +3 -0
  1958. package/dist/scripts/eval/eval-cli-discoverability.d.ts.map +1 -0
  1959. package/dist/scripts/eval/eval-cli-discoverability.js +37 -0
  1960. package/dist/scripts/eval/eval-cli-discoverability.js.map +1 -0
  1961. package/dist/scripts/eval/eval-fresh-run-tagging.d.ts +2 -0
  1962. package/dist/scripts/eval/eval-fresh-run-tagging.d.ts.map +1 -0
  1963. package/dist/scripts/eval/eval-fresh-run-tagging.js +11 -0
  1964. package/dist/scripts/eval/eval-fresh-run-tagging.js.map +1 -0
  1965. package/dist/scripts/eval/eval-help-consistency.d.ts +2 -0
  1966. package/dist/scripts/eval/eval-help-consistency.d.ts.map +1 -0
  1967. package/dist/scripts/eval/eval-help-consistency.js +12 -0
  1968. package/dist/scripts/eval/eval-help-consistency.js.map +1 -0
  1969. package/dist/scripts/eval/eval-in-action-cat-shellout-demo.d.ts +2 -0
  1970. package/dist/scripts/eval/eval-in-action-cat-shellout-demo.d.ts.map +1 -0
  1971. package/dist/scripts/eval/eval-in-action-cat-shellout-demo.js +31 -0
  1972. package/dist/scripts/eval/eval-in-action-cat-shellout-demo.js.map +1 -0
  1973. package/dist/scripts/eval/eval-parity-smoke.d.ts +2 -0
  1974. package/dist/scripts/eval/eval-parity-smoke.d.ts.map +1 -0
  1975. package/dist/scripts/eval/eval-parity-smoke.js +23 -0
  1976. package/dist/scripts/eval/eval-parity-smoke.js.map +1 -0
  1977. package/dist/scripts/eval/eval-parity-sweep.d.ts +2 -0
  1978. package/dist/scripts/eval/eval-parity-sweep.d.ts.map +1 -0
  1979. package/dist/scripts/eval/eval-parity-sweep.js +29 -0
  1980. package/dist/scripts/eval/eval-parity-sweep.js.map +1 -0
  1981. package/dist/scripts/eval/eval-resume-dirty-guard.d.ts +2 -0
  1982. package/dist/scripts/eval/eval-resume-dirty-guard.d.ts.map +1 -0
  1983. package/dist/scripts/eval/eval-resume-dirty-guard.js +11 -0
  1984. package/dist/scripts/eval/eval-resume-dirty-guard.js.map +1 -0
  1985. package/dist/scripts/eval/eval-security-path-traversal.d.ts +3 -0
  1986. package/dist/scripts/eval/eval-security-path-traversal.d.ts.map +1 -0
  1987. package/dist/scripts/eval/eval-security-path-traversal.js +35 -0
  1988. package/dist/scripts/eval/eval-security-path-traversal.js.map +1 -0
  1989. package/dist/scripts/fixtures/ask-advisor-stub.d.ts +3 -0
  1990. package/dist/scripts/fixtures/ask-advisor-stub.d.ts.map +1 -0
  1991. package/dist/scripts/fixtures/ask-advisor-stub.js +13 -0
  1992. package/dist/scripts/fixtures/ask-advisor-stub.js.map +1 -0
  1993. package/dist/scripts/generate-catalog-docs.d.ts +3 -0
  1994. package/dist/scripts/generate-catalog-docs.d.ts.map +1 -0
  1995. package/dist/scripts/generate-catalog-docs.js +99 -0
  1996. package/dist/scripts/generate-catalog-docs.js.map +1 -0
  1997. package/dist/scripts/generate-native-release-manifest.d.ts +3 -0
  1998. package/dist/scripts/generate-native-release-manifest.d.ts.map +1 -0
  1999. package/dist/scripts/generate-native-release-manifest.js +107 -0
  2000. package/dist/scripts/generate-native-release-manifest.js.map +1 -0
  2001. package/dist/scripts/generate-release-body.d.ts +35 -0
  2002. package/dist/scripts/generate-release-body.d.ts.map +1 -0
  2003. package/dist/scripts/generate-release-body.js +278 -0
  2004. package/dist/scripts/generate-release-body.js.map +1 -0
  2005. package/dist/scripts/hook-derived-watcher.d.ts +3 -0
  2006. package/dist/scripts/hook-derived-watcher.d.ts.map +1 -0
  2007. package/dist/scripts/hook-derived-watcher.js +557 -0
  2008. package/dist/scripts/hook-derived-watcher.js.map +1 -0
  2009. package/dist/scripts/hook-payload-guard.d.ts +9 -0
  2010. package/dist/scripts/hook-payload-guard.d.ts.map +1 -0
  2011. package/dist/scripts/hook-payload-guard.js +111 -0
  2012. package/dist/scripts/hook-payload-guard.js.map +1 -0
  2013. package/dist/scripts/notify-dispatcher.d.ts +7 -0
  2014. package/dist/scripts/notify-dispatcher.d.ts.map +1 -0
  2015. package/dist/scripts/notify-dispatcher.js +359 -0
  2016. package/dist/scripts/notify-dispatcher.js.map +1 -0
  2017. package/dist/scripts/notify-fallback-watcher.d.ts +3 -0
  2018. package/dist/scripts/notify-fallback-watcher.d.ts.map +1 -0
  2019. package/dist/scripts/notify-fallback-watcher.js +1771 -0
  2020. package/dist/scripts/notify-fallback-watcher.js.map +1 -0
  2021. package/dist/scripts/notify-hook/__tests__/operational-events.test.d.ts +2 -0
  2022. package/dist/scripts/notify-hook/__tests__/operational-events.test.d.ts.map +1 -0
  2023. package/dist/scripts/notify-hook/__tests__/operational-events.test.js +24 -0
  2024. package/dist/scripts/notify-hook/__tests__/operational-events.test.js.map +1 -0
  2025. package/dist/scripts/notify-hook/__tests__/payload-guard.test.d.ts +2 -0
  2026. package/dist/scripts/notify-hook/__tests__/payload-guard.test.d.ts.map +1 -0
  2027. package/dist/scripts/notify-hook/__tests__/payload-guard.test.js +39 -0
  2028. package/dist/scripts/notify-hook/__tests__/payload-guard.test.js.map +1 -0
  2029. package/dist/scripts/notify-hook/__tests__/team-worker-posttooluse.test.d.ts +2 -0
  2030. package/dist/scripts/notify-hook/__tests__/team-worker-posttooluse.test.d.ts.map +1 -0
  2031. package/dist/scripts/notify-hook/__tests__/team-worker-posttooluse.test.js +153 -0
  2032. package/dist/scripts/notify-hook/__tests__/team-worker-posttooluse.test.js.map +1 -0
  2033. package/dist/scripts/notify-hook/active-team.d.ts +9 -0
  2034. package/dist/scripts/notify-hook/active-team.d.ts.map +1 -0
  2035. package/dist/scripts/notify-hook/active-team.js +45 -0
  2036. package/dist/scripts/notify-hook/active-team.js.map +1 -0
  2037. package/dist/scripts/notify-hook/auto-nudge.d.ts +96 -0
  2038. package/dist/scripts/notify-hook/auto-nudge.d.ts.map +1 -0
  2039. package/dist/scripts/notify-hook/auto-nudge.js +698 -0
  2040. package/dist/scripts/notify-hook/auto-nudge.js.map +1 -0
  2041. package/dist/scripts/notify-hook/log.d.ts +6 -0
  2042. package/dist/scripts/notify-hook/log.d.ts.map +1 -0
  2043. package/dist/scripts/notify-hook/log.js +22 -0
  2044. package/dist/scripts/notify-hook/log.js.map +1 -0
  2045. package/dist/scripts/notify-hook/managed-tmux.d.ts +21 -0
  2046. package/dist/scripts/notify-hook/managed-tmux.d.ts.map +1 -0
  2047. package/dist/scripts/notify-hook/managed-tmux.js +541 -0
  2048. package/dist/scripts/notify-hook/managed-tmux.js.map +1 -0
  2049. package/dist/scripts/notify-hook/operational-events.d.ts +14 -0
  2050. package/dist/scripts/notify-hook/operational-events.d.ts.map +1 -0
  2051. package/dist/scripts/notify-hook/operational-events.js +255 -0
  2052. package/dist/scripts/notify-hook/operational-events.js.map +1 -0
  2053. package/dist/scripts/notify-hook/orchestration-intent.d.ts +17 -0
  2054. package/dist/scripts/notify-hook/orchestration-intent.d.ts.map +1 -0
  2055. package/dist/scripts/notify-hook/orchestration-intent.js +71 -0
  2056. package/dist/scripts/notify-hook/orchestration-intent.js.map +1 -0
  2057. package/dist/scripts/notify-hook/payload-parser.d.ts +13 -0
  2058. package/dist/scripts/notify-hook/payload-parser.d.ts.map +1 -0
  2059. package/dist/scripts/notify-hook/payload-parser.js +134 -0
  2060. package/dist/scripts/notify-hook/payload-parser.js.map +1 -0
  2061. package/dist/scripts/notify-hook/process-runner.d.ts +9 -0
  2062. package/dist/scripts/notify-hook/process-runner.d.ts.map +1 -0
  2063. package/dist/scripts/notify-hook/process-runner.js +74 -0
  2064. package/dist/scripts/notify-hook/process-runner.js.map +1 -0
  2065. package/dist/scripts/notify-hook/ralph-session-resume.d.ts +22 -0
  2066. package/dist/scripts/notify-hook/ralph-session-resume.d.ts.map +1 -0
  2067. package/dist/scripts/notify-hook/ralph-session-resume.js +381 -0
  2068. package/dist/scripts/notify-hook/ralph-session-resume.js.map +1 -0
  2069. package/dist/scripts/notify-hook/state-io.d.ts +21 -0
  2070. package/dist/scripts/notify-hook/state-io.d.ts.map +1 -0
  2071. package/dist/scripts/notify-hook/state-io.js +169 -0
  2072. package/dist/scripts/notify-hook/state-io.js.map +1 -0
  2073. package/dist/scripts/notify-hook/team-dispatch.d.ts +36 -0
  2074. package/dist/scripts/notify-hook/team-dispatch.d.ts.map +1 -0
  2075. package/dist/scripts/notify-hook/team-dispatch.js +1084 -0
  2076. package/dist/scripts/notify-hook/team-dispatch.js.map +1 -0
  2077. package/dist/scripts/notify-hook/team-leader-nudge.d.ts +21 -0
  2078. package/dist/scripts/notify-hook/team-leader-nudge.d.ts.map +1 -0
  2079. package/dist/scripts/notify-hook/team-leader-nudge.js +1029 -0
  2080. package/dist/scripts/notify-hook/team-leader-nudge.js.map +1 -0
  2081. package/dist/scripts/notify-hook/team-tmux-guard.d.ts +15 -0
  2082. package/dist/scripts/notify-hook/team-tmux-guard.d.ts.map +1 -0
  2083. package/dist/scripts/notify-hook/team-tmux-guard.js +205 -0
  2084. package/dist/scripts/notify-hook/team-tmux-guard.js.map +1 -0
  2085. package/dist/scripts/notify-hook/team-worker-posttooluse.d.ts +34 -0
  2086. package/dist/scripts/notify-hook/team-worker-posttooluse.d.ts.map +1 -0
  2087. package/dist/scripts/notify-hook/team-worker-posttooluse.js +434 -0
  2088. package/dist/scripts/notify-hook/team-worker-posttooluse.js.map +1 -0
  2089. package/dist/scripts/notify-hook/team-worker-stop.d.ts +15 -0
  2090. package/dist/scripts/notify-hook/team-worker-stop.d.ts.map +1 -0
  2091. package/dist/scripts/notify-hook/team-worker-stop.js +418 -0
  2092. package/dist/scripts/notify-hook/team-worker-stop.js.map +1 -0
  2093. package/dist/scripts/notify-hook/team-worker.d.ts +33 -0
  2094. package/dist/scripts/notify-hook/team-worker.d.ts.map +1 -0
  2095. package/dist/scripts/notify-hook/team-worker.js +705 -0
  2096. package/dist/scripts/notify-hook/team-worker.js.map +1 -0
  2097. package/dist/scripts/notify-hook/tmux-injection.d.ts +15 -0
  2098. package/dist/scripts/notify-hook/tmux-injection.d.ts.map +1 -0
  2099. package/dist/scripts/notify-hook/tmux-injection.js +673 -0
  2100. package/dist/scripts/notify-hook/tmux-injection.js.map +1 -0
  2101. package/dist/scripts/notify-hook/utils.d.ts +9 -0
  2102. package/dist/scripts/notify-hook/utils.d.ts.map +1 -0
  2103. package/dist/scripts/notify-hook/utils.js +36 -0
  2104. package/dist/scripts/notify-hook/utils.js.map +1 -0
  2105. package/dist/scripts/notify-hook/visual-verdict.d.ts +29 -0
  2106. package/dist/scripts/notify-hook/visual-verdict.d.ts.map +1 -0
  2107. package/dist/scripts/notify-hook/visual-verdict.js +145 -0
  2108. package/dist/scripts/notify-hook/visual-verdict.js.map +1 -0
  2109. package/dist/scripts/notify-hook.d.ts +20 -0
  2110. package/dist/scripts/notify-hook.d.ts.map +1 -0
  2111. package/dist/scripts/notify-hook.js +950 -0
  2112. package/dist/scripts/notify-hook.js.map +1 -0
  2113. package/dist/scripts/postinstall.d.ts +18 -0
  2114. package/dist/scripts/postinstall.d.ts.map +1 -0
  2115. package/dist/scripts/postinstall.js +66 -0
  2116. package/dist/scripts/postinstall.js.map +1 -0
  2117. package/dist/scripts/prompt-inventory.d.ts +29 -0
  2118. package/dist/scripts/prompt-inventory.d.ts.map +1 -0
  2119. package/dist/scripts/prompt-inventory.js +178 -0
  2120. package/dist/scripts/prompt-inventory.js.map +1 -0
  2121. package/dist/scripts/run-provider-advisor.d.ts +3 -0
  2122. package/dist/scripts/run-provider-advisor.d.ts.map +1 -0
  2123. package/dist/scripts/run-provider-advisor.js +177 -0
  2124. package/dist/scripts/run-provider-advisor.js.map +1 -0
  2125. package/dist/scripts/run-test-files.d.ts +2 -0
  2126. package/dist/scripts/run-test-files.d.ts.map +1 -0
  2127. package/dist/scripts/run-test-files.js +340 -0
  2128. package/dist/scripts/run-test-files.js.map +1 -0
  2129. package/dist/scripts/smoke-packed-install.d.ts +21 -0
  2130. package/dist/scripts/smoke-packed-install.d.ts.map +1 -0
  2131. package/dist/scripts/smoke-packed-install.js +221 -0
  2132. package/dist/scripts/smoke-packed-install.js.map +1 -0
  2133. package/dist/scripts/sync-plugin-mirror.d.ts +14 -0
  2134. package/dist/scripts/sync-plugin-mirror.d.ts.map +1 -0
  2135. package/dist/scripts/sync-plugin-mirror.js +306 -0
  2136. package/dist/scripts/sync-plugin-mirror.js.map +1 -0
  2137. package/dist/scripts/sync-prompt-guidance-fragments.d.ts +3 -0
  2138. package/dist/scripts/sync-prompt-guidance-fragments.d.ts.map +1 -0
  2139. package/dist/scripts/sync-prompt-guidance-fragments.js +50 -0
  2140. package/dist/scripts/sync-prompt-guidance-fragments.js.map +1 -0
  2141. package/dist/scripts/team-hardening-benchmark.d.ts +3 -0
  2142. package/dist/scripts/team-hardening-benchmark.d.ts.map +1 -0
  2143. package/dist/scripts/team-hardening-benchmark.js +91 -0
  2144. package/dist/scripts/team-hardening-benchmark.js.map +1 -0
  2145. package/dist/scripts/test-reply-listener-live.d.ts +24 -0
  2146. package/dist/scripts/test-reply-listener-live.d.ts.map +1 -0
  2147. package/dist/scripts/test-reply-listener-live.js +138 -0
  2148. package/dist/scripts/test-reply-listener-live.js.map +1 -0
  2149. package/dist/scripts/test-sparkshell.d.ts +2 -0
  2150. package/dist/scripts/test-sparkshell.d.ts.map +1 -0
  2151. package/dist/scripts/test-sparkshell.js +25 -0
  2152. package/dist/scripts/test-sparkshell.js.map +1 -0
  2153. package/dist/scripts/tmux-hook-engine.d.ts +45 -0
  2154. package/dist/scripts/tmux-hook-engine.d.ts.map +1 -0
  2155. package/dist/scripts/tmux-hook-engine.js +313 -0
  2156. package/dist/scripts/tmux-hook-engine.js.map +1 -0
  2157. package/dist/scripts/verify-native-agents.d.ts +16 -0
  2158. package/dist/scripts/verify-native-agents.d.ts.map +1 -0
  2159. package/dist/scripts/verify-native-agents.js +247 -0
  2160. package/dist/scripts/verify-native-agents.js.map +1 -0
  2161. package/dist/scripts/verify-native-release-assets.d.ts +3 -0
  2162. package/dist/scripts/verify-native-release-assets.d.ts.map +1 -0
  2163. package/dist/scripts/verify-native-release-assets.js +62 -0
  2164. package/dist/scripts/verify-native-release-assets.js.map +1 -0
  2165. package/dist/session-history/__tests__/search.test.d.ts +2 -0
  2166. package/dist/session-history/__tests__/search.test.d.ts.map +1 -0
  2167. package/dist/session-history/__tests__/search.test.js +150 -0
  2168. package/dist/session-history/__tests__/search.test.js.map +1 -0
  2169. package/dist/session-history/search.d.ts +31 -0
  2170. package/dist/session-history/search.d.ts.map +1 -0
  2171. package/dist/session-history/search.js +331 -0
  2172. package/dist/session-history/search.js.map +1 -0
  2173. package/dist/sidecar/__tests__/boundary.test.d.ts +2 -0
  2174. package/dist/sidecar/__tests__/boundary.test.d.ts.map +1 -0
  2175. package/dist/sidecar/__tests__/boundary.test.js +48 -0
  2176. package/dist/sidecar/__tests__/boundary.test.js.map +1 -0
  2177. package/dist/sidecar/__tests__/collector.test.d.ts +2 -0
  2178. package/dist/sidecar/__tests__/collector.test.d.ts.map +1 -0
  2179. package/dist/sidecar/__tests__/collector.test.js +162 -0
  2180. package/dist/sidecar/__tests__/collector.test.js.map +1 -0
  2181. package/dist/sidecar/__tests__/render.test.d.ts +2 -0
  2182. package/dist/sidecar/__tests__/render.test.d.ts.map +1 -0
  2183. package/dist/sidecar/__tests__/render.test.js +67 -0
  2184. package/dist/sidecar/__tests__/render.test.js.map +1 -0
  2185. package/dist/sidecar/__tests__/resource-leak-watch.test.d.ts +2 -0
  2186. package/dist/sidecar/__tests__/resource-leak-watch.test.d.ts.map +1 -0
  2187. package/dist/sidecar/__tests__/resource-leak-watch.test.js +38 -0
  2188. package/dist/sidecar/__tests__/resource-leak-watch.test.js.map +1 -0
  2189. package/dist/sidecar/__tests__/tmux.test.d.ts +2 -0
  2190. package/dist/sidecar/__tests__/tmux.test.d.ts.map +1 -0
  2191. package/dist/sidecar/__tests__/tmux.test.js +30 -0
  2192. package/dist/sidecar/__tests__/tmux.test.js.map +1 -0
  2193. package/dist/sidecar/__tests__/watch.test.d.ts +2 -0
  2194. package/dist/sidecar/__tests__/watch.test.d.ts.map +1 -0
  2195. package/dist/sidecar/__tests__/watch.test.js +42 -0
  2196. package/dist/sidecar/__tests__/watch.test.js.map +1 -0
  2197. package/dist/sidecar/collector.d.ts +4 -0
  2198. package/dist/sidecar/collector.d.ts.map +1 -0
  2199. package/dist/sidecar/collector.js +377 -0
  2200. package/dist/sidecar/collector.js.map +1 -0
  2201. package/dist/sidecar/index.d.ts +25 -0
  2202. package/dist/sidecar/index.d.ts.map +1 -0
  2203. package/dist/sidecar/index.js +182 -0
  2204. package/dist/sidecar/index.js.map +1 -0
  2205. package/dist/sidecar/render.d.ts +3 -0
  2206. package/dist/sidecar/render.d.ts.map +1 -0
  2207. package/dist/sidecar/render.js +72 -0
  2208. package/dist/sidecar/render.js.map +1 -0
  2209. package/dist/sidecar/tmux.d.ts +13 -0
  2210. package/dist/sidecar/tmux.d.ts.map +1 -0
  2211. package/dist/sidecar/tmux.js +44 -0
  2212. package/dist/sidecar/tmux.js.map +1 -0
  2213. package/dist/sidecar/types.d.ts +125 -0
  2214. package/dist/sidecar/types.d.ts.map +1 -0
  2215. package/dist/sidecar/types.js +2 -0
  2216. package/dist/sidecar/types.js.map +1 -0
  2217. package/dist/state/__tests__/mode-state-context.test.d.ts +2 -0
  2218. package/dist/state/__tests__/mode-state-context.test.d.ts.map +1 -0
  2219. package/dist/state/__tests__/mode-state-context.test.js +35 -0
  2220. package/dist/state/__tests__/mode-state-context.test.js.map +1 -0
  2221. package/dist/state/__tests__/operations-ralph-phase.test.d.ts +2 -0
  2222. package/dist/state/__tests__/operations-ralph-phase.test.d.ts.map +1 -0
  2223. package/dist/state/__tests__/operations-ralph-phase.test.js +190 -0
  2224. package/dist/state/__tests__/operations-ralph-phase.test.js.map +1 -0
  2225. package/dist/state/__tests__/operations.test.d.ts +2 -0
  2226. package/dist/state/__tests__/operations.test.d.ts.map +1 -0
  2227. package/dist/state/__tests__/operations.test.js +2753 -0
  2228. package/dist/state/__tests__/operations.test.js.map +1 -0
  2229. package/dist/state/__tests__/path-traversal.test.d.ts +2 -0
  2230. package/dist/state/__tests__/path-traversal.test.d.ts.map +1 -0
  2231. package/dist/state/__tests__/path-traversal.test.js +49 -0
  2232. package/dist/state/__tests__/path-traversal.test.js.map +1 -0
  2233. package/dist/state/__tests__/planning-gate.test.d.ts +2 -0
  2234. package/dist/state/__tests__/planning-gate.test.d.ts.map +1 -0
  2235. package/dist/state/__tests__/planning-gate.test.js +219 -0
  2236. package/dist/state/__tests__/planning-gate.test.js.map +1 -0
  2237. package/dist/state/__tests__/skill-active.test.d.ts +2 -0
  2238. package/dist/state/__tests__/skill-active.test.d.ts.map +1 -0
  2239. package/dist/state/__tests__/skill-active.test.js +314 -0
  2240. package/dist/state/__tests__/skill-active.test.js.map +1 -0
  2241. package/dist/state/__tests__/workflow-transition.test.d.ts +2 -0
  2242. package/dist/state/__tests__/workflow-transition.test.d.ts.map +1 -0
  2243. package/dist/state/__tests__/workflow-transition.test.js +293 -0
  2244. package/dist/state/__tests__/workflow-transition.test.js.map +1 -0
  2245. package/dist/state/mode-state-context.d.ts +14 -0
  2246. package/dist/state/mode-state-context.d.ts.map +1 -0
  2247. package/dist/state/mode-state-context.js +49 -0
  2248. package/dist/state/mode-state-context.js.map +1 -0
  2249. package/dist/state/operations.d.ts +13 -0
  2250. package/dist/state/operations.d.ts.map +1 -0
  2251. package/dist/state/operations.js +544 -0
  2252. package/dist/state/operations.js.map +1 -0
  2253. package/dist/state/paths.d.ts +3 -0
  2254. package/dist/state/paths.d.ts.map +1 -0
  2255. package/dist/state/paths.js +2 -0
  2256. package/dist/state/paths.js.map +1 -0
  2257. package/dist/state/skill-active.d.ts +64 -0
  2258. package/dist/state/skill-active.d.ts.map +1 -0
  2259. package/dist/state/skill-active.js +375 -0
  2260. package/dist/state/skill-active.js.map +1 -0
  2261. package/dist/state/workflow-transition-reconcile.d.ts +22 -0
  2262. package/dist/state/workflow-transition-reconcile.d.ts.map +1 -0
  2263. package/dist/state/workflow-transition-reconcile.js +144 -0
  2264. package/dist/state/workflow-transition-reconcile.js.map +1 -0
  2265. package/dist/state/workflow-transition.d.ts +45 -0
  2266. package/dist/state/workflow-transition.d.ts.map +1 -0
  2267. package/dist/state/workflow-transition.js +268 -0
  2268. package/dist/state/workflow-transition.js.map +1 -0
  2269. package/dist/subagents/__tests__/tracker.test.d.ts +2 -0
  2270. package/dist/subagents/__tests__/tracker.test.d.ts.map +1 -0
  2271. package/dist/subagents/__tests__/tracker.test.js +255 -0
  2272. package/dist/subagents/__tests__/tracker.test.js.map +1 -0
  2273. package/dist/subagents/tracker.d.ts +60 -0
  2274. package/dist/subagents/tracker.d.ts.map +1 -0
  2275. package/dist/subagents/tracker.js +229 -0
  2276. package/dist/subagents/tracker.js.map +1 -0
  2277. package/dist/team/__tests__/allocation-policy.test.d.ts +2 -0
  2278. package/dist/team/__tests__/allocation-policy.test.d.ts.map +1 -0
  2279. package/dist/team/__tests__/allocation-policy.test.js +111 -0
  2280. package/dist/team/__tests__/allocation-policy.test.js.map +1 -0
  2281. package/dist/team/__tests__/api-interop.test.d.ts +2 -0
  2282. package/dist/team/__tests__/api-interop.test.d.ts.map +1 -0
  2283. package/dist/team/__tests__/api-interop.test.js +2321 -0
  2284. package/dist/team/__tests__/api-interop.test.js.map +1 -0
  2285. package/dist/team/__tests__/approved-execution.test.d.ts +2 -0
  2286. package/dist/team/__tests__/approved-execution.test.d.ts.map +1 -0
  2287. package/dist/team/__tests__/approved-execution.test.js +304 -0
  2288. package/dist/team/__tests__/approved-execution.test.js.map +1 -0
  2289. package/dist/team/__tests__/commit-hygiene.test.d.ts +2 -0
  2290. package/dist/team/__tests__/commit-hygiene.test.d.ts.map +1 -0
  2291. package/dist/team/__tests__/commit-hygiene.test.js +93 -0
  2292. package/dist/team/__tests__/commit-hygiene.test.js.map +1 -0
  2293. package/dist/team/__tests__/coordination-protocol.test.d.ts +2 -0
  2294. package/dist/team/__tests__/coordination-protocol.test.d.ts.map +1 -0
  2295. package/dist/team/__tests__/coordination-protocol.test.js +173 -0
  2296. package/dist/team/__tests__/coordination-protocol.test.js.map +1 -0
  2297. package/dist/team/__tests__/cross-rebase-smoke.test.d.ts +2 -0
  2298. package/dist/team/__tests__/cross-rebase-smoke.test.d.ts.map +1 -0
  2299. package/dist/team/__tests__/cross-rebase-smoke.test.js +161 -0
  2300. package/dist/team/__tests__/cross-rebase-smoke.test.js.map +1 -0
  2301. package/dist/team/__tests__/current-task-baseline.test.d.ts +2 -0
  2302. package/dist/team/__tests__/current-task-baseline.test.d.ts.map +1 -0
  2303. package/dist/team/__tests__/current-task-baseline.test.js +87 -0
  2304. package/dist/team/__tests__/current-task-baseline.test.js.map +1 -0
  2305. package/dist/team/__tests__/delegation-policy.test.d.ts +2 -0
  2306. package/dist/team/__tests__/delegation-policy.test.d.ts.map +1 -0
  2307. package/dist/team/__tests__/delegation-policy.test.js +69 -0
  2308. package/dist/team/__tests__/delegation-policy.test.js.map +1 -0
  2309. package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts +2 -0
  2310. package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts.map +1 -0
  2311. package/dist/team/__tests__/delivery-e2e-smoke.test.js +677 -0
  2312. package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -0
  2313. package/dist/team/__tests__/delivery-log.test.d.ts +2 -0
  2314. package/dist/team/__tests__/delivery-log.test.d.ts.map +1 -0
  2315. package/dist/team/__tests__/delivery-log.test.js +62 -0
  2316. package/dist/team/__tests__/delivery-log.test.js.map +1 -0
  2317. package/dist/team/__tests__/events.test.d.ts +2 -0
  2318. package/dist/team/__tests__/events.test.d.ts.map +1 -0
  2319. package/dist/team/__tests__/events.test.js +313 -0
  2320. package/dist/team/__tests__/events.test.js.map +1 -0
  2321. package/dist/team/__tests__/followup-planner.test.d.ts +2 -0
  2322. package/dist/team/__tests__/followup-planner.test.d.ts.map +1 -0
  2323. package/dist/team/__tests__/followup-planner.test.js +100 -0
  2324. package/dist/team/__tests__/followup-planner.test.js.map +1 -0
  2325. package/dist/team/__tests__/hardening-e2e.test.d.ts +2 -0
  2326. package/dist/team/__tests__/hardening-e2e.test.d.ts.map +1 -0
  2327. package/dist/team/__tests__/hardening-e2e.test.js +98 -0
  2328. package/dist/team/__tests__/hardening-e2e.test.js.map +1 -0
  2329. package/dist/team/__tests__/hook-primary-e2e-contract.test.d.ts +2 -0
  2330. package/dist/team/__tests__/hook-primary-e2e-contract.test.d.ts.map +1 -0
  2331. package/dist/team/__tests__/hook-primary-e2e-contract.test.js +78 -0
  2332. package/dist/team/__tests__/hook-primary-e2e-contract.test.js.map +1 -0
  2333. package/dist/team/__tests__/idle-nudge.test.d.ts +2 -0
  2334. package/dist/team/__tests__/idle-nudge.test.d.ts.map +1 -0
  2335. package/dist/team/__tests__/idle-nudge.test.js +230 -0
  2336. package/dist/team/__tests__/idle-nudge.test.js.map +1 -0
  2337. package/dist/team/__tests__/leader-activity.test.d.ts +2 -0
  2338. package/dist/team/__tests__/leader-activity.test.d.ts.map +1 -0
  2339. package/dist/team/__tests__/leader-activity.test.js +261 -0
  2340. package/dist/team/__tests__/leader-activity.test.js.map +1 -0
  2341. package/dist/team/__tests__/mcp-comm.test.d.ts +2 -0
  2342. package/dist/team/__tests__/mcp-comm.test.d.ts.map +1 -0
  2343. package/dist/team/__tests__/mcp-comm.test.js +289 -0
  2344. package/dist/team/__tests__/mcp-comm.test.js.map +1 -0
  2345. package/dist/team/__tests__/model-contract.test.d.ts +2 -0
  2346. package/dist/team/__tests__/model-contract.test.d.ts.map +1 -0
  2347. package/dist/team/__tests__/model-contract.test.js +187 -0
  2348. package/dist/team/__tests__/model-contract.test.js.map +1 -0
  2349. package/dist/team/__tests__/orchestrator.test.d.ts +2 -0
  2350. package/dist/team/__tests__/orchestrator.test.d.ts.map +1 -0
  2351. package/dist/team/__tests__/orchestrator.test.js +111 -0
  2352. package/dist/team/__tests__/orchestrator.test.js.map +1 -0
  2353. package/dist/team/__tests__/phase-controller.test.d.ts +2 -0
  2354. package/dist/team/__tests__/phase-controller.test.d.ts.map +1 -0
  2355. package/dist/team/__tests__/phase-controller.test.js +50 -0
  2356. package/dist/team/__tests__/phase-controller.test.js.map +1 -0
  2357. package/dist/team/__tests__/rebalance-policy.test.d.ts +2 -0
  2358. package/dist/team/__tests__/rebalance-policy.test.d.ts.map +1 -0
  2359. package/dist/team/__tests__/rebalance-policy.test.js +168 -0
  2360. package/dist/team/__tests__/rebalance-policy.test.js.map +1 -0
  2361. package/dist/team/__tests__/repo-aware-decomposition.test.d.ts +2 -0
  2362. package/dist/team/__tests__/repo-aware-decomposition.test.d.ts.map +1 -0
  2363. package/dist/team/__tests__/repo-aware-decomposition.test.js +156 -0
  2364. package/dist/team/__tests__/repo-aware-decomposition.test.js.map +1 -0
  2365. package/dist/team/__tests__/role-router.test.d.ts +2 -0
  2366. package/dist/team/__tests__/role-router.test.d.ts.map +1 -0
  2367. package/dist/team/__tests__/role-router.test.js +263 -0
  2368. package/dist/team/__tests__/role-router.test.js.map +1 -0
  2369. package/dist/team/__tests__/runtime-boxed-state.test.d.ts +2 -0
  2370. package/dist/team/__tests__/runtime-boxed-state.test.d.ts.map +1 -0
  2371. package/dist/team/__tests__/runtime-boxed-state.test.js +39 -0
  2372. package/dist/team/__tests__/runtime-boxed-state.test.js.map +1 -0
  2373. package/dist/team/__tests__/runtime-cli.test.d.ts +2 -0
  2374. package/dist/team/__tests__/runtime-cli.test.d.ts.map +1 -0
  2375. package/dist/team/__tests__/runtime-cli.test.js +320 -0
  2376. package/dist/team/__tests__/runtime-cli.test.js.map +1 -0
  2377. package/dist/team/__tests__/runtime.test.d.ts +2 -0
  2378. package/dist/team/__tests__/runtime.test.d.ts.map +1 -0
  2379. package/dist/team/__tests__/runtime.test.js +6464 -0
  2380. package/dist/team/__tests__/runtime.test.js.map +1 -0
  2381. package/dist/team/__tests__/scaling.test.d.ts +2 -0
  2382. package/dist/team/__tests__/scaling.test.d.ts.map +1 -0
  2383. package/dist/team/__tests__/scaling.test.js +1664 -0
  2384. package/dist/team/__tests__/scaling.test.js.map +1 -0
  2385. package/dist/team/__tests__/shutdown-fallback.test.d.ts +2 -0
  2386. package/dist/team/__tests__/shutdown-fallback.test.d.ts.map +1 -0
  2387. package/dist/team/__tests__/shutdown-fallback.test.js +125 -0
  2388. package/dist/team/__tests__/shutdown-fallback.test.js.map +1 -0
  2389. package/dist/team/__tests__/state-root.test.d.ts +2 -0
  2390. package/dist/team/__tests__/state-root.test.d.ts.map +1 -0
  2391. package/dist/team/__tests__/state-root.test.js +208 -0
  2392. package/dist/team/__tests__/state-root.test.js.map +1 -0
  2393. package/dist/team/__tests__/state.test.d.ts +2 -0
  2394. package/dist/team/__tests__/state.test.d.ts.map +1 -0
  2395. package/dist/team/__tests__/state.test.js +1942 -0
  2396. package/dist/team/__tests__/state.test.js.map +1 -0
  2397. package/dist/team/__tests__/team-identity.test.d.ts +2 -0
  2398. package/dist/team/__tests__/team-identity.test.d.ts.map +1 -0
  2399. package/dist/team/__tests__/team-identity.test.js +166 -0
  2400. package/dist/team/__tests__/team-identity.test.js.map +1 -0
  2401. package/dist/team/__tests__/team-ops-contract.test.d.ts +2 -0
  2402. package/dist/team/__tests__/team-ops-contract.test.d.ts.map +1 -0
  2403. package/dist/team/__tests__/team-ops-contract.test.js +96 -0
  2404. package/dist/team/__tests__/team-ops-contract.test.js.map +1 -0
  2405. package/dist/team/__tests__/tmux-claude-workers-demo.test.d.ts +2 -0
  2406. package/dist/team/__tests__/tmux-claude-workers-demo.test.d.ts.map +1 -0
  2407. package/dist/team/__tests__/tmux-claude-workers-demo.test.js +191 -0
  2408. package/dist/team/__tests__/tmux-claude-workers-demo.test.js.map +1 -0
  2409. package/dist/team/__tests__/tmux-session.test.d.ts +2 -0
  2410. package/dist/team/__tests__/tmux-session.test.d.ts.map +1 -0
  2411. package/dist/team/__tests__/tmux-session.test.js +4546 -0
  2412. package/dist/team/__tests__/tmux-session.test.js.map +1 -0
  2413. package/dist/team/__tests__/tmux-test-fixture.d.ts +20 -0
  2414. package/dist/team/__tests__/tmux-test-fixture.d.ts.map +1 -0
  2415. package/dist/team/__tests__/tmux-test-fixture.js +148 -0
  2416. package/dist/team/__tests__/tmux-test-fixture.js.map +1 -0
  2417. package/dist/team/__tests__/tmux-test-fixture.test.d.ts +2 -0
  2418. package/dist/team/__tests__/tmux-test-fixture.test.d.ts.map +1 -0
  2419. package/dist/team/__tests__/tmux-test-fixture.test.js +114 -0
  2420. package/dist/team/__tests__/tmux-test-fixture.test.js.map +1 -0
  2421. package/dist/team/__tests__/worker-bootstrap.test.d.ts +2 -0
  2422. package/dist/team/__tests__/worker-bootstrap.test.d.ts.map +1 -0
  2423. package/dist/team/__tests__/worker-bootstrap.test.js +1122 -0
  2424. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -0
  2425. package/dist/team/__tests__/worker-runtime-identity.test.d.ts +2 -0
  2426. package/dist/team/__tests__/worker-runtime-identity.test.d.ts.map +1 -0
  2427. package/dist/team/__tests__/worker-runtime-identity.test.js +258 -0
  2428. package/dist/team/__tests__/worker-runtime-identity.test.js.map +1 -0
  2429. package/dist/team/__tests__/worktree.test.d.ts +2 -0
  2430. package/dist/team/__tests__/worktree.test.d.ts.map +1 -0
  2431. package/dist/team/__tests__/worktree.test.js +317 -0
  2432. package/dist/team/__tests__/worktree.test.js.map +1 -0
  2433. package/dist/team/allocation-policy.d.ts +29 -0
  2434. package/dist/team/allocation-policy.d.ts.map +1 -0
  2435. package/dist/team/allocation-policy.js +153 -0
  2436. package/dist/team/allocation-policy.js.map +1 -0
  2437. package/dist/team/api-interop.d.ts +20 -0
  2438. package/dist/team/api-interop.d.ts.map +1 -0
  2439. package/dist/team/api-interop.js +1084 -0
  2440. package/dist/team/api-interop.js.map +1 -0
  2441. package/dist/team/approved-execution.d.ts +64 -0
  2442. package/dist/team/approved-execution.d.ts.map +1 -0
  2443. package/dist/team/approved-execution.js +242 -0
  2444. package/dist/team/approved-execution.js.map +1 -0
  2445. package/dist/team/commit-hygiene.d.ts +79 -0
  2446. package/dist/team/commit-hygiene.d.ts.map +1 -0
  2447. package/dist/team/commit-hygiene.js +364 -0
  2448. package/dist/team/commit-hygiene.js.map +1 -0
  2449. package/dist/team/contracts.d.ts +26 -0
  2450. package/dist/team/contracts.d.ts.map +1 -0
  2451. package/dist/team/contracts.js +103 -0
  2452. package/dist/team/contracts.js.map +1 -0
  2453. package/dist/team/coordination-protocol.d.ts +14 -0
  2454. package/dist/team/coordination-protocol.d.ts.map +1 -0
  2455. package/dist/team/coordination-protocol.js +244 -0
  2456. package/dist/team/coordination-protocol.js.map +1 -0
  2457. package/dist/team/current-task-baseline.d.ts +32 -0
  2458. package/dist/team/current-task-baseline.d.ts.map +1 -0
  2459. package/dist/team/current-task-baseline.js +85 -0
  2460. package/dist/team/current-task-baseline.js.map +1 -0
  2461. package/dist/team/dag-schema.d.ts +38 -0
  2462. package/dist/team/dag-schema.d.ts.map +1 -0
  2463. package/dist/team/dag-schema.js +221 -0
  2464. package/dist/team/dag-schema.js.map +1 -0
  2465. package/dist/team/delegation-policy.d.ts +3 -0
  2466. package/dist/team/delegation-policy.d.ts.map +1 -0
  2467. package/dist/team/delegation-policy.js +82 -0
  2468. package/dist/team/delegation-policy.js.map +1 -0
  2469. package/dist/team/delivery-log.d.ts +14 -0
  2470. package/dist/team/delivery-log.d.ts.map +1 -0
  2471. package/dist/team/delivery-log.js +43 -0
  2472. package/dist/team/delivery-log.js.map +1 -0
  2473. package/dist/team/followup-planner.d.ts +45 -0
  2474. package/dist/team/followup-planner.d.ts.map +1 -0
  2475. package/dist/team/followup-planner.js +200 -0
  2476. package/dist/team/followup-planner.js.map +1 -0
  2477. package/dist/team/goal-workflow.d.ts +20 -0
  2478. package/dist/team/goal-workflow.d.ts.map +1 -0
  2479. package/dist/team/goal-workflow.js +57 -0
  2480. package/dist/team/goal-workflow.js.map +1 -0
  2481. package/dist/team/idle-nudge.d.ts +53 -0
  2482. package/dist/team/idle-nudge.d.ts.map +1 -0
  2483. package/dist/team/idle-nudge.js +141 -0
  2484. package/dist/team/idle-nudge.js.map +1 -0
  2485. package/dist/team/leader-activity.d.ts +15 -0
  2486. package/dist/team/leader-activity.d.ts.map +1 -0
  2487. package/dist/team/leader-activity.js +224 -0
  2488. package/dist/team/leader-activity.js.map +1 -0
  2489. package/dist/team/mcp-comm.d.ts +73 -0
  2490. package/dist/team/mcp-comm.d.ts.map +1 -0
  2491. package/dist/team/mcp-comm.js +314 -0
  2492. package/dist/team/mcp-comm.js.map +1 -0
  2493. package/dist/team/model-contract.d.ts +26 -0
  2494. package/dist/team/model-contract.d.ts.map +1 -0
  2495. package/dist/team/model-contract.js +205 -0
  2496. package/dist/team/model-contract.js.map +1 -0
  2497. package/dist/team/orchestrator.d.ts +47 -0
  2498. package/dist/team/orchestrator.d.ts.map +1 -0
  2499. package/dist/team/orchestrator.js +131 -0
  2500. package/dist/team/orchestrator.js.map +1 -0
  2501. package/dist/team/pane-status.d.ts +149 -0
  2502. package/dist/team/pane-status.d.ts.map +1 -0
  2503. package/dist/team/pane-status.js +558 -0
  2504. package/dist/team/pane-status.js.map +1 -0
  2505. package/dist/team/phase-controller.d.ts +12 -0
  2506. package/dist/team/phase-controller.d.ts.map +1 -0
  2507. package/dist/team/phase-controller.js +142 -0
  2508. package/dist/team/phase-controller.js.map +1 -0
  2509. package/dist/team/progress-evidence.d.ts +2 -0
  2510. package/dist/team/progress-evidence.d.ts.map +1 -0
  2511. package/dist/team/progress-evidence.js +77 -0
  2512. package/dist/team/progress-evidence.js.map +1 -0
  2513. package/dist/team/rebalance-policy.d.ts +19 -0
  2514. package/dist/team/rebalance-policy.d.ts.map +1 -0
  2515. package/dist/team/rebalance-policy.js +48 -0
  2516. package/dist/team/rebalance-policy.js.map +1 -0
  2517. package/dist/team/reminder-intents.d.ts +11 -0
  2518. package/dist/team/reminder-intents.d.ts.map +1 -0
  2519. package/dist/team/reminder-intents.js +40 -0
  2520. package/dist/team/reminder-intents.js.map +1 -0
  2521. package/dist/team/repo-aware-decomposition.d.ts +68 -0
  2522. package/dist/team/repo-aware-decomposition.d.ts.map +1 -0
  2523. package/dist/team/repo-aware-decomposition.js +235 -0
  2524. package/dist/team/repo-aware-decomposition.js.map +1 -0
  2525. package/dist/team/role-router.d.ts +32 -0
  2526. package/dist/team/role-router.d.ts.map +1 -0
  2527. package/dist/team/role-router.js +298 -0
  2528. package/dist/team/role-router.js.map +1 -0
  2529. package/dist/team/runtime-cli.d.ts +78 -0
  2530. package/dist/team/runtime-cli.d.ts.map +1 -0
  2531. package/dist/team/runtime-cli.js +376 -0
  2532. package/dist/team/runtime-cli.js.map +1 -0
  2533. package/dist/team/runtime.d.ts +162 -0
  2534. package/dist/team/runtime.d.ts.map +1 -0
  2535. package/dist/team/runtime.js +4160 -0
  2536. package/dist/team/runtime.js.map +1 -0
  2537. package/dist/team/scaling.d.ts +59 -0
  2538. package/dist/team/scaling.d.ts.map +1 -0
  2539. package/dist/team/scaling.js +650 -0
  2540. package/dist/team/scaling.js.map +1 -0
  2541. package/dist/team/state/approvals.d.ts +25 -0
  2542. package/dist/team/state/approvals.d.ts.map +1 -0
  2543. package/dist/team/state/approvals.js +31 -0
  2544. package/dist/team/state/approvals.js.map +1 -0
  2545. package/dist/team/state/config.d.ts +2 -0
  2546. package/dist/team/state/config.d.ts.map +1 -0
  2547. package/dist/team/state/config.js +2 -0
  2548. package/dist/team/state/config.js.map +1 -0
  2549. package/dist/team/state/dispatch-lock.d.ts +3 -0
  2550. package/dist/team/state/dispatch-lock.d.ts.map +1 -0
  2551. package/dist/team/state/dispatch-lock.js +81 -0
  2552. package/dist/team/state/dispatch-lock.js.map +1 -0
  2553. package/dist/team/state/dispatch.d.ts +67 -0
  2554. package/dist/team/state/dispatch.d.ts.map +1 -0
  2555. package/dist/team/state/dispatch.js +302 -0
  2556. package/dist/team/state/dispatch.js.map +1 -0
  2557. package/dist/team/state/events.d.ts +26 -0
  2558. package/dist/team/state/events.d.ts.map +1 -0
  2559. package/dist/team/state/events.js +145 -0
  2560. package/dist/team/state/events.js.map +1 -0
  2561. package/dist/team/state/index.d.ts +11 -0
  2562. package/dist/team/state/index.d.ts.map +1 -0
  2563. package/dist/team/state/index.js +11 -0
  2564. package/dist/team/state/index.js.map +1 -0
  2565. package/dist/team/state/io.d.ts +2 -0
  2566. package/dist/team/state/io.d.ts.map +1 -0
  2567. package/dist/team/state/io.js +2 -0
  2568. package/dist/team/state/io.js.map +1 -0
  2569. package/dist/team/state/locks.d.ts +16 -0
  2570. package/dist/team/state/locks.d.ts.map +1 -0
  2571. package/dist/team/state/locks.js +201 -0
  2572. package/dist/team/state/locks.js.map +1 -0
  2573. package/dist/team/state/mailbox.d.ts +43 -0
  2574. package/dist/team/state/mailbox.d.ts.map +1 -0
  2575. package/dist/team/state/mailbox.js +222 -0
  2576. package/dist/team/state/mailbox.js.map +1 -0
  2577. package/dist/team/state/monitor.d.ts +108 -0
  2578. package/dist/team/state/monitor.d.ts.map +1 -0
  2579. package/dist/team/state/monitor.js +193 -0
  2580. package/dist/team/state/monitor.js.map +1 -0
  2581. package/dist/team/state/shutdown.d.ts +2 -0
  2582. package/dist/team/state/shutdown.d.ts.map +1 -0
  2583. package/dist/team/state/shutdown.js +2 -0
  2584. package/dist/team/state/shutdown.js.map +1 -0
  2585. package/dist/team/state/summary.d.ts +2 -0
  2586. package/dist/team/state/summary.d.ts.map +1 -0
  2587. package/dist/team/state/summary.js +2 -0
  2588. package/dist/team/state/summary.js.map +1 -0
  2589. package/dist/team/state/tasks.d.ts +53 -0
  2590. package/dist/team/state/tasks.d.ts.map +1 -0
  2591. package/dist/team/state/tasks.js +284 -0
  2592. package/dist/team/state/tasks.js.map +1 -0
  2593. package/dist/team/state/types.d.ts +356 -0
  2594. package/dist/team/state/types.d.ts.map +1 -0
  2595. package/dist/team/state/types.js +3 -0
  2596. package/dist/team/state/types.js.map +1 -0
  2597. package/dist/team/state/workers.d.ts +2 -0
  2598. package/dist/team/state/workers.d.ts.map +1 -0
  2599. package/dist/team/state/workers.js +2 -0
  2600. package/dist/team/state/workers.js.map +1 -0
  2601. package/dist/team/state-root.d.ts +40 -0
  2602. package/dist/team/state-root.d.ts.map +1 -0
  2603. package/dist/team/state-root.js +297 -0
  2604. package/dist/team/state-root.js.map +1 -0
  2605. package/dist/team/state.d.ts +471 -0
  2606. package/dist/team/state.d.ts.map +1 -0
  2607. package/dist/team/state.js +1418 -0
  2608. package/dist/team/state.js.map +1 -0
  2609. package/dist/team/team-identity.d.ts +26 -0
  2610. package/dist/team/team-identity.d.ts.map +1 -0
  2611. package/dist/team/team-identity.js +169 -0
  2612. package/dist/team/team-identity.js.map +1 -0
  2613. package/dist/team/team-ops.d.ts +66 -0
  2614. package/dist/team/team-ops.d.ts.map +1 -0
  2615. package/dist/team/team-ops.js +79 -0
  2616. package/dist/team/team-ops.js.map +1 -0
  2617. package/dist/team/tmux-session.d.ts +190 -0
  2618. package/dist/team/tmux-session.d.ts.map +1 -0
  2619. package/dist/team/tmux-session.js +2071 -0
  2620. package/dist/team/tmux-session.js.map +1 -0
  2621. package/dist/team/ultragoal-context.d.ts +47 -0
  2622. package/dist/team/ultragoal-context.d.ts.map +1 -0
  2623. package/dist/team/ultragoal-context.js +215 -0
  2624. package/dist/team/ultragoal-context.js.map +1 -0
  2625. package/dist/team/worker-bootstrap.d.ts +92 -0
  2626. package/dist/team/worker-bootstrap.d.ts.map +1 -0
  2627. package/dist/team/worker-bootstrap.js +860 -0
  2628. package/dist/team/worker-bootstrap.js.map +1 -0
  2629. package/dist/team/worktree.d.ts +69 -0
  2630. package/dist/team/worktree.d.ts.map +1 -0
  2631. package/dist/team/worktree.js +437 -0
  2632. package/dist/team/worktree.js.map +1 -0
  2633. package/dist/ultragoal/__tests__/artifacts.test.d.ts +2 -0
  2634. package/dist/ultragoal/__tests__/artifacts.test.d.ts.map +1 -0
  2635. package/dist/ultragoal/__tests__/artifacts.test.js +1423 -0
  2636. package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -0
  2637. package/dist/ultragoal/__tests__/docs-contract.test.d.ts +2 -0
  2638. package/dist/ultragoal/__tests__/docs-contract.test.d.ts.map +1 -0
  2639. package/dist/ultragoal/__tests__/docs-contract.test.js +132 -0
  2640. package/dist/ultragoal/__tests__/docs-contract.test.js.map +1 -0
  2641. package/dist/ultragoal/__tests__/steering-fixtures.d.ts +68 -0
  2642. package/dist/ultragoal/__tests__/steering-fixtures.d.ts.map +1 -0
  2643. package/dist/ultragoal/__tests__/steering-fixtures.js +259 -0
  2644. package/dist/ultragoal/__tests__/steering-fixtures.js.map +1 -0
  2645. package/dist/ultragoal/__tests__/steering-fixtures.test.d.ts +2 -0
  2646. package/dist/ultragoal/__tests__/steering-fixtures.test.d.ts.map +1 -0
  2647. package/dist/ultragoal/__tests__/steering-fixtures.test.js +65 -0
  2648. package/dist/ultragoal/__tests__/steering-fixtures.test.js.map +1 -0
  2649. package/dist/ultragoal/artifacts.d.ts +249 -0
  2650. package/dist/ultragoal/artifacts.d.ts.map +1 -0
  2651. package/dist/ultragoal/artifacts.js +1349 -0
  2652. package/dist/ultragoal/artifacts.js.map +1 -0
  2653. package/dist/utils/__tests__/agents-md.test.d.ts +2 -0
  2654. package/dist/utils/__tests__/agents-md.test.d.ts.map +1 -0
  2655. package/dist/utils/__tests__/agents-md.test.js +96 -0
  2656. package/dist/utils/__tests__/agents-md.test.js.map +1 -0
  2657. package/dist/utils/__tests__/agents-model-table.test.d.ts +2 -0
  2658. package/dist/utils/__tests__/agents-model-table.test.d.ts.map +1 -0
  2659. package/dist/utils/__tests__/agents-model-table.test.js +108 -0
  2660. package/dist/utils/__tests__/agents-model-table.test.js.map +1 -0
  2661. package/dist/utils/__tests__/dep-versions.test.d.ts +2 -0
  2662. package/dist/utils/__tests__/dep-versions.test.d.ts.map +1 -0
  2663. package/dist/utils/__tests__/dep-versions.test.js +46 -0
  2664. package/dist/utils/__tests__/dep-versions.test.js.map +1 -0
  2665. package/dist/utils/__tests__/package.test.d.ts +2 -0
  2666. package/dist/utils/__tests__/package.test.d.ts.map +1 -0
  2667. package/dist/utils/__tests__/package.test.js +21 -0
  2668. package/dist/utils/__tests__/package.test.js.map +1 -0
  2669. package/dist/utils/__tests__/paths.test.d.ts +2 -0
  2670. package/dist/utils/__tests__/paths.test.d.ts.map +1 -0
  2671. package/dist/utils/__tests__/paths.test.js +647 -0
  2672. package/dist/utils/__tests__/paths.test.js.map +1 -0
  2673. package/dist/utils/__tests__/platform-command.test.d.ts +2 -0
  2674. package/dist/utils/__tests__/platform-command.test.d.ts.map +1 -0
  2675. package/dist/utils/__tests__/platform-command.test.js +399 -0
  2676. package/dist/utils/__tests__/platform-command.test.js.map +1 -0
  2677. package/dist/utils/__tests__/repo-deps.test.d.ts +2 -0
  2678. package/dist/utils/__tests__/repo-deps.test.d.ts.map +1 -0
  2679. package/dist/utils/__tests__/repo-deps.test.js +71 -0
  2680. package/dist/utils/__tests__/repo-deps.test.js.map +1 -0
  2681. package/dist/utils/__tests__/sleep-resource.test.d.ts +2 -0
  2682. package/dist/utils/__tests__/sleep-resource.test.d.ts.map +1 -0
  2683. package/dist/utils/__tests__/sleep-resource.test.js +39 -0
  2684. package/dist/utils/__tests__/sleep-resource.test.js.map +1 -0
  2685. package/dist/utils/__tests__/version.test.d.ts +2 -0
  2686. package/dist/utils/__tests__/version.test.d.ts.map +1 -0
  2687. package/dist/utils/__tests__/version.test.js +78 -0
  2688. package/dist/utils/__tests__/version.test.js.map +1 -0
  2689. package/dist/utils/agents-md.d.ts +10 -0
  2690. package/dist/utils/agents-md.d.ts.map +1 -0
  2691. package/dist/utils/agents-md.js +76 -0
  2692. package/dist/utils/agents-md.js.map +1 -0
  2693. package/dist/utils/agents-model-table.d.ts +16 -0
  2694. package/dist/utils/agents-model-table.d.ts.map +1 -0
  2695. package/dist/utils/agents-model-table.js +102 -0
  2696. package/dist/utils/agents-model-table.js.map +1 -0
  2697. package/dist/utils/git-layout.d.ts +8 -0
  2698. package/dist/utils/git-layout.d.ts.map +1 -0
  2699. package/dist/utils/git-layout.js +58 -0
  2700. package/dist/utils/git-layout.js.map +1 -0
  2701. package/dist/utils/package.d.ts +9 -0
  2702. package/dist/utils/package.d.ts.map +1 -0
  2703. package/dist/utils/package.js +31 -0
  2704. package/dist/utils/package.js.map +1 -0
  2705. package/dist/utils/paths.d.ts +101 -0
  2706. package/dist/utils/paths.d.ts.map +1 -0
  2707. package/dist/utils/paths.js +314 -0
  2708. package/dist/utils/paths.js.map +1 -0
  2709. package/dist/utils/platform-command.d.ts +29 -0
  2710. package/dist/utils/platform-command.d.ts.map +1 -0
  2711. package/dist/utils/platform-command.js +239 -0
  2712. package/dist/utils/platform-command.js.map +1 -0
  2713. package/dist/utils/repo-deps.d.ts +20 -0
  2714. package/dist/utils/repo-deps.d.ts.map +1 -0
  2715. package/dist/utils/repo-deps.js +78 -0
  2716. package/dist/utils/repo-deps.js.map +1 -0
  2717. package/dist/utils/safe-json.d.ts +3 -0
  2718. package/dist/utils/safe-json.d.ts.map +1 -0
  2719. package/dist/utils/safe-json.js +19 -0
  2720. package/dist/utils/safe-json.js.map +1 -0
  2721. package/dist/utils/sleep.d.ts +3 -0
  2722. package/dist/utils/sleep.d.ts.map +1 -0
  2723. package/dist/utils/sleep.js +35 -0
  2724. package/dist/utils/sleep.js.map +1 -0
  2725. package/dist/utils/toml.d.ts +4 -0
  2726. package/dist/utils/toml.d.ts.map +1 -0
  2727. package/dist/utils/toml.js +75 -0
  2728. package/dist/utils/toml.js.map +1 -0
  2729. package/dist/utils/version.d.ts +7 -0
  2730. package/dist/utils/version.d.ts.map +1 -0
  2731. package/dist/utils/version.js +72 -0
  2732. package/dist/utils/version.js.map +1 -0
  2733. package/dist/verification/__tests__/ci-rust-gates.test.d.ts +2 -0
  2734. package/dist/verification/__tests__/ci-rust-gates.test.d.ts.map +1 -0
  2735. package/dist/verification/__tests__/ci-rust-gates.test.js +293 -0
  2736. package/dist/verification/__tests__/ci-rust-gates.test.js.map +1 -0
  2737. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.d.ts +2 -0
  2738. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.d.ts.map +1 -0
  2739. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js +68 -0
  2740. package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js.map +1 -0
  2741. package/dist/verification/__tests__/explore-harness-release-workflow.test.d.ts +2 -0
  2742. package/dist/verification/__tests__/explore-harness-release-workflow.test.d.ts.map +1 -0
  2743. package/dist/verification/__tests__/explore-harness-release-workflow.test.js +74 -0
  2744. package/dist/verification/__tests__/explore-harness-release-workflow.test.js.map +1 -0
  2745. package/dist/verification/__tests__/native-release-manifest.test.d.ts +2 -0
  2746. package/dist/verification/__tests__/native-release-manifest.test.d.ts.map +1 -0
  2747. package/dist/verification/__tests__/native-release-manifest.test.js +80 -0
  2748. package/dist/verification/__tests__/native-release-manifest.test.js.map +1 -0
  2749. package/dist/verification/__tests__/pr-check-workflow.test.d.ts +2 -0
  2750. package/dist/verification/__tests__/pr-check-workflow.test.d.ts.map +1 -0
  2751. package/dist/verification/__tests__/pr-check-workflow.test.js +27 -0
  2752. package/dist/verification/__tests__/pr-check-workflow.test.js.map +1 -0
  2753. package/dist/verification/__tests__/ralph-persistence-gate.test.d.ts +2 -0
  2754. package/dist/verification/__tests__/ralph-persistence-gate.test.d.ts.map +1 -0
  2755. package/dist/verification/__tests__/ralph-persistence-gate.test.js +55 -0
  2756. package/dist/verification/__tests__/ralph-persistence-gate.test.js.map +1 -0
  2757. package/dist/verification/__tests__/rust-runtime-thin-adapter-gate.test.d.ts +2 -0
  2758. package/dist/verification/__tests__/rust-runtime-thin-adapter-gate.test.d.ts.map +1 -0
  2759. package/dist/verification/__tests__/rust-runtime-thin-adapter-gate.test.js +32 -0
  2760. package/dist/verification/__tests__/rust-runtime-thin-adapter-gate.test.js.map +1 -0
  2761. package/dist/verification/__tests__/verifier.test.d.ts +2 -0
  2762. package/dist/verification/__tests__/verifier.test.d.ts.map +1 -0
  2763. package/dist/verification/__tests__/verifier.test.js +113 -0
  2764. package/dist/verification/__tests__/verifier.test.js.map +1 -0
  2765. package/dist/verification/verifier.d.ts +37 -0
  2766. package/dist/verification/verifier.d.ts.map +1 -0
  2767. package/dist/verification/verifier.js +100 -0
  2768. package/dist/verification/verifier.js.map +1 -0
  2769. package/dist/visual/__tests__/verdict.test.d.ts +2 -0
  2770. package/dist/visual/__tests__/verdict.test.d.ts.map +1 -0
  2771. package/dist/visual/__tests__/verdict.test.js +81 -0
  2772. package/dist/visual/__tests__/verdict.test.js.map +1 -0
  2773. package/dist/visual/constants.d.ts +4 -0
  2774. package/dist/visual/constants.d.ts.map +1 -0
  2775. package/dist/visual/constants.js +3 -0
  2776. package/dist/visual/constants.js.map +1 -0
  2777. package/dist/visual/verdict.d.ts +17 -0
  2778. package/dist/visual/verdict.d.ts.map +1 -0
  2779. package/dist/visual/verdict.js +61 -0
  2780. package/dist/visual/verdict.js.map +1 -0
  2781. package/dist/wiki/__tests__/cjk-tokenize.test.d.ts +12 -0
  2782. package/dist/wiki/__tests__/cjk-tokenize.test.d.ts.map +1 -0
  2783. package/dist/wiki/__tests__/cjk-tokenize.test.js +139 -0
  2784. package/dist/wiki/__tests__/cjk-tokenize.test.js.map +1 -0
  2785. package/dist/wiki/__tests__/crlf-parse.test.d.ts +2 -0
  2786. package/dist/wiki/__tests__/crlf-parse.test.d.ts.map +1 -0
  2787. package/dist/wiki/__tests__/crlf-parse.test.js +24 -0
  2788. package/dist/wiki/__tests__/crlf-parse.test.js.map +1 -0
  2789. package/dist/wiki/__tests__/escape-newline.test.d.ts +2 -0
  2790. package/dist/wiki/__tests__/escape-newline.test.d.ts.map +1 -0
  2791. package/dist/wiki/__tests__/escape-newline.test.js +45 -0
  2792. package/dist/wiki/__tests__/escape-newline.test.js.map +1 -0
  2793. package/dist/wiki/__tests__/ingest.test.d.ts +5 -0
  2794. package/dist/wiki/__tests__/ingest.test.d.ts.map +1 -0
  2795. package/dist/wiki/__tests__/ingest.test.js +215 -0
  2796. package/dist/wiki/__tests__/ingest.test.js.map +1 -0
  2797. package/dist/wiki/__tests__/lint.test.d.ts +5 -0
  2798. package/dist/wiki/__tests__/lint.test.d.ts.map +1 -0
  2799. package/dist/wiki/__tests__/lint.test.js +176 -0
  2800. package/dist/wiki/__tests__/lint.test.js.map +1 -0
  2801. package/dist/wiki/__tests__/query.test.d.ts +5 -0
  2802. package/dist/wiki/__tests__/query.test.d.ts.map +1 -0
  2803. package/dist/wiki/__tests__/query.test.js +166 -0
  2804. package/dist/wiki/__tests__/query.test.js.map +1 -0
  2805. package/dist/wiki/__tests__/reserved-file-guard.test.d.ts +2 -0
  2806. package/dist/wiki/__tests__/reserved-file-guard.test.d.ts.map +1 -0
  2807. package/dist/wiki/__tests__/reserved-file-guard.test.js +44 -0
  2808. package/dist/wiki/__tests__/reserved-file-guard.test.js.map +1 -0
  2809. package/dist/wiki/__tests__/session-hooks.test.d.ts +5 -0
  2810. package/dist/wiki/__tests__/session-hooks.test.d.ts.map +1 -0
  2811. package/dist/wiki/__tests__/session-hooks.test.js +64 -0
  2812. package/dist/wiki/__tests__/session-hooks.test.js.map +1 -0
  2813. package/dist/wiki/__tests__/slug-nonascii.test.d.ts +2 -0
  2814. package/dist/wiki/__tests__/slug-nonascii.test.d.ts.map +1 -0
  2815. package/dist/wiki/__tests__/slug-nonascii.test.js +30 -0
  2816. package/dist/wiki/__tests__/slug-nonascii.test.js.map +1 -0
  2817. package/dist/wiki/__tests__/storage.test.d.ts +5 -0
  2818. package/dist/wiki/__tests__/storage.test.d.ts.map +1 -0
  2819. package/dist/wiki/__tests__/storage.test.js +318 -0
  2820. package/dist/wiki/__tests__/storage.test.js.map +1 -0
  2821. package/dist/wiki/__tests__/test-helpers.d.ts +31 -0
  2822. package/dist/wiki/__tests__/test-helpers.d.ts.map +1 -0
  2823. package/dist/wiki/__tests__/test-helpers.js +108 -0
  2824. package/dist/wiki/__tests__/test-helpers.js.map +1 -0
  2825. package/dist/wiki/index.d.ts +14 -0
  2826. package/dist/wiki/index.d.ts.map +1 -0
  2827. package/dist/wiki/index.js +17 -0
  2828. package/dist/wiki/index.js.map +1 -0
  2829. package/dist/wiki/ingest.d.ts +20 -0
  2830. package/dist/wiki/ingest.d.ts.map +1 -0
  2831. package/dist/wiki/ingest.js +115 -0
  2832. package/dist/wiki/ingest.js.map +1 -0
  2833. package/dist/wiki/lifecycle.d.ts +25 -0
  2834. package/dist/wiki/lifecycle.d.ts.map +1 -0
  2835. package/dist/wiki/lifecycle.js +239 -0
  2836. package/dist/wiki/lifecycle.js.map +1 -0
  2837. package/dist/wiki/lint.d.ts +25 -0
  2838. package/dist/wiki/lint.d.ts.map +1 -0
  2839. package/dist/wiki/lint.js +170 -0
  2840. package/dist/wiki/lint.js.map +1 -0
  2841. package/dist/wiki/query.d.ts +36 -0
  2842. package/dist/wiki/query.d.ts.map +1 -0
  2843. package/dist/wiki/query.js +139 -0
  2844. package/dist/wiki/query.js.map +1 -0
  2845. package/dist/wiki/storage.d.ts +37 -0
  2846. package/dist/wiki/storage.d.ts.map +1 -0
  2847. package/dist/wiki/storage.js +358 -0
  2848. package/dist/wiki/storage.js.map +1 -0
  2849. package/dist/wiki/types.d.ts +83 -0
  2850. package/dist/wiki/types.d.ts.map +1 -0
  2851. package/dist/wiki/types.js +15 -0
  2852. package/dist/wiki/types.js.map +1 -0
  2853. package/package.json +110 -0
  2854. package/plugins/oh-my-codex/.app.json +3 -0
  2855. package/plugins/oh-my-codex/.codex-plugin/plugin.json +31 -0
  2856. package/plugins/oh-my-codex/.mcp.json +52 -0
  2857. package/plugins/oh-my-codex/hooks/codex-native-hook.mjs +420 -0
  2858. package/plugins/oh-my-codex/hooks/hooks.json +76 -0
  2859. package/plugins/oh-my-codex/skills/ai-slop-cleaner/SKILL.md +148 -0
  2860. package/plugins/oh-my-codex/skills/analyze/SKILL.md +146 -0
  2861. package/plugins/oh-my-codex/skills/ask/SKILL.md +58 -0
  2862. package/plugins/oh-my-codex/skills/autopilot/SKILL.md +215 -0
  2863. package/plugins/oh-my-codex/skills/autoresearch/SKILL.md +72 -0
  2864. package/plugins/oh-my-codex/skills/autoresearch-goal/SKILL.md +36 -0
  2865. package/plugins/oh-my-codex/skills/best-practice-research/SKILL.md +88 -0
  2866. package/plugins/oh-my-codex/skills/cancel/SKILL.md +399 -0
  2867. package/plugins/oh-my-codex/skills/code-review/SKILL.md +292 -0
  2868. package/plugins/oh-my-codex/skills/configure-notifications/SKILL.md +287 -0
  2869. package/plugins/oh-my-codex/skills/deep-interview/SKILL.md +579 -0
  2870. package/plugins/oh-my-codex/skills/design/SKILL.md +180 -0
  2871. package/plugins/oh-my-codex/skills/doctor/SKILL.md +239 -0
  2872. package/plugins/oh-my-codex/skills/hud/SKILL.md +98 -0
  2873. package/plugins/oh-my-codex/skills/omx-setup/SKILL.md +135 -0
  2874. package/plugins/oh-my-codex/skills/performance-goal/SKILL.md +65 -0
  2875. package/plugins/oh-my-codex/skills/pipeline/SKILL.md +97 -0
  2876. package/plugins/oh-my-codex/skills/plan/SKILL.md +277 -0
  2877. package/plugins/oh-my-codex/skills/prometheus-strict/README.md +35 -0
  2878. package/plugins/oh-my-codex/skills/prometheus-strict/SKILL.md +219 -0
  2879. package/plugins/oh-my-codex/skills/ralph/SKILL.md +294 -0
  2880. package/plugins/oh-my-codex/skills/ralplan/SKILL.md +203 -0
  2881. package/plugins/oh-my-codex/skills/skill/SKILL.md +836 -0
  2882. package/plugins/oh-my-codex/skills/team/SKILL.md +536 -0
  2883. package/plugins/oh-my-codex/skills/ultragoal/SKILL.md +139 -0
  2884. package/plugins/oh-my-codex/skills/ultraqa/SKILL.md +263 -0
  2885. package/plugins/oh-my-codex/skills/ultrawork/SKILL.md +190 -0
  2886. package/plugins/oh-my-codex/skills/visual-ralph/SKILL.md +161 -0
  2887. package/plugins/oh-my-codex/skills/wiki/SKILL.md +57 -0
  2888. package/plugins/oh-my-codex/skills/worker/SKILL.md +120 -0
  2889. package/prompts/analyst.md +135 -0
  2890. package/prompts/api-reviewer.md +113 -0
  2891. package/prompts/architect.md +111 -0
  2892. package/prompts/build-fixer.md +115 -0
  2893. package/prompts/code-reviewer.md +139 -0
  2894. package/prompts/code-simplifier.md +134 -0
  2895. package/prompts/critic.md +80 -0
  2896. package/prompts/debugger.md +117 -0
  2897. package/prompts/dependency-expert.md +129 -0
  2898. package/prompts/designer.md +126 -0
  2899. package/prompts/executor.md +108 -0
  2900. package/prompts/explore-harness.md +64 -0
  2901. package/prompts/explore.md +85 -0
  2902. package/prompts/git-master.md +114 -0
  2903. package/prompts/information-architect.md +226 -0
  2904. package/prompts/performance-reviewer.md +109 -0
  2905. package/prompts/planner.md +110 -0
  2906. package/prompts/product-analyst.md +304 -0
  2907. package/prompts/product-manager.md +245 -0
  2908. package/prompts/prometheus-strict-metis.md +274 -0
  2909. package/prompts/prometheus-strict-momus.md +82 -0
  2910. package/prompts/prometheus-strict-oracle.md +107 -0
  2911. package/prompts/qa-tester.md +124 -0
  2912. package/prompts/quality-reviewer.md +123 -0
  2913. package/prompts/quality-strategist.md +274 -0
  2914. package/prompts/researcher.md +122 -0
  2915. package/prompts/scholastic.md +11 -0
  2916. package/prompts/security-reviewer.md +143 -0
  2917. package/prompts/sisyphus-lite.md +111 -0
  2918. package/prompts/style-reviewer.md +102 -0
  2919. package/prompts/team-executor.md +57 -0
  2920. package/prompts/team-orchestrator.md +8 -0
  2921. package/prompts/test-engineer.md +130 -0
  2922. package/prompts/ux-researcher.md +327 -0
  2923. package/prompts/verifier.md +85 -0
  2924. package/prompts/vision.md +98 -0
  2925. package/prompts/writer.md +109 -0
  2926. package/skills/ai-slop-cleaner/SKILL.md +148 -0
  2927. package/skills/analyze/SKILL.md +146 -0
  2928. package/skills/ask/SKILL.md +58 -0
  2929. package/skills/ask-claude/SKILL.md +12 -0
  2930. package/skills/ask-gemini/SKILL.md +12 -0
  2931. package/skills/autopilot/SKILL.md +215 -0
  2932. package/skills/autoresearch/SKILL.md +72 -0
  2933. package/skills/autoresearch-goal/SKILL.md +36 -0
  2934. package/skills/best-practice-research/SKILL.md +88 -0
  2935. package/skills/build-fix/SKILL.md +10 -0
  2936. package/skills/cancel/SKILL.md +399 -0
  2937. package/skills/code-review/SKILL.md +292 -0
  2938. package/skills/configure-notifications/SKILL.md +287 -0
  2939. package/skills/deep-interview/SKILL.md +579 -0
  2940. package/skills/deepsearch/SKILL.md +10 -0
  2941. package/skills/design/SKILL.md +180 -0
  2942. package/skills/doctor/SKILL.md +239 -0
  2943. package/skills/ecomode/SKILL.md +114 -0
  2944. package/skills/frontend-ui-ux/SKILL.md +16 -0
  2945. package/skills/git-master/SKILL.md +27 -0
  2946. package/skills/help/SKILL.md +10 -0
  2947. package/skills/hud/SKILL.md +98 -0
  2948. package/skills/note/SKILL.md +10 -0
  2949. package/skills/omx-setup/SKILL.md +135 -0
  2950. package/skills/performance-goal/SKILL.md +65 -0
  2951. package/skills/pipeline/SKILL.md +97 -0
  2952. package/skills/plan/SKILL.md +277 -0
  2953. package/skills/prometheus-strict/README.md +35 -0
  2954. package/skills/prometheus-strict/SKILL.md +219 -0
  2955. package/skills/ralph/SKILL.md +294 -0
  2956. package/skills/ralph-init/SKILL.md +10 -0
  2957. package/skills/ralplan/SKILL.md +203 -0
  2958. package/skills/review/SKILL.md +10 -0
  2959. package/skills/security-review/SKILL.md +10 -0
  2960. package/skills/skill/SKILL.md +836 -0
  2961. package/skills/swarm/SKILL.md +12 -0
  2962. package/skills/tdd/SKILL.md +104 -0
  2963. package/skills/team/SKILL.md +536 -0
  2964. package/skills/trace/SKILL.md +10 -0
  2965. package/skills/ultragoal/SKILL.md +139 -0
  2966. package/skills/ultraqa/SKILL.md +263 -0
  2967. package/skills/ultrawork/SKILL.md +190 -0
  2968. package/skills/visual-ralph/SKILL.md +161 -0
  2969. package/skills/visual-verdict/SKILL.md +10 -0
  2970. package/skills/web-clone/SKILL.md +357 -0
  2971. package/skills/wiki/SKILL.md +57 -0
  2972. package/skills/worker/SKILL.md +120 -0
  2973. package/src/scripts/__tests__/codex-native-hook.test.ts +17173 -0
  2974. package/src/scripts/__tests__/docs-site-contract.test.ts +47 -0
  2975. package/src/scripts/__tests__/generate-release-body.test.ts +275 -0
  2976. package/src/scripts/__tests__/hook-derived-watcher.test.ts +285 -0
  2977. package/src/scripts/__tests__/notify-dispatcher.test.ts +504 -0
  2978. package/src/scripts/__tests__/notify-state-io.test.ts +168 -0
  2979. package/src/scripts/__tests__/notify-tmux-injection.test.ts +82 -0
  2980. package/src/scripts/__tests__/postinstall.test.ts +113 -0
  2981. package/src/scripts/__tests__/prompt-inventory.test.ts +64 -0
  2982. package/src/scripts/__tests__/run-test-files.test.ts +455 -0
  2983. package/src/scripts/__tests__/smoke-packed-install.test.ts +192 -0
  2984. package/src/scripts/__tests__/test-reply-listener-live.test.ts +101 -0
  2985. package/src/scripts/__tests__/verify-native-agents.test.ts +299 -0
  2986. package/src/scripts/ask-claude.sh +17 -0
  2987. package/src/scripts/ask-gemini.sh +14 -0
  2988. package/src/scripts/build-api.ts +48 -0
  2989. package/src/scripts/build-explore-harness.ts +54 -0
  2990. package/src/scripts/build-sparkshell.ts +52 -0
  2991. package/src/scripts/check-runtime-syntax.ts +63 -0
  2992. package/src/scripts/check-version-sync.ts +54 -0
  2993. package/src/scripts/cleanup-explore-harness.ts +18 -0
  2994. package/src/scripts/codex-execution-surface.ts +75 -0
  2995. package/src/scripts/codex-native-hook.ts +4877 -0
  2996. package/src/scripts/codex-native-pre-post.ts +1360 -0
  2997. package/src/scripts/demo-claude-workers.sh +241 -0
  2998. package/src/scripts/demo-team-e2e.sh +184 -0
  2999. package/src/scripts/eval/eval-adaptive-sort-optimization.py +24 -0
  3000. package/src/scripts/eval/eval-candidate-handoff.ts +8 -0
  3001. package/src/scripts/eval/eval-cli-discoverability.ts +40 -0
  3002. package/src/scripts/eval/eval-fresh-run-tagging.ts +8 -0
  3003. package/src/scripts/eval/eval-help-consistency.ts +11 -0
  3004. package/src/scripts/eval/eval-in-action-cat-shellout-demo.ts +31 -0
  3005. package/src/scripts/eval/eval-ml-kaggle-model-optimization.py +29 -0
  3006. package/src/scripts/eval/eval-noisy-bayesopt-highdim.py +44 -0
  3007. package/src/scripts/eval/eval-noisy-latent-subspace-discovery.py +44 -0
  3008. package/src/scripts/eval/eval-parity-smoke.ts +20 -0
  3009. package/src/scripts/eval/eval-parity-sweep.ts +26 -0
  3010. package/src/scripts/eval/eval-resume-dirty-guard.ts +8 -0
  3011. package/src/scripts/eval/eval-security-path-traversal.ts +38 -0
  3012. package/src/scripts/fixtures/ask-advisor-stub.ts +12 -0
  3013. package/src/scripts/generate-catalog-docs.ts +112 -0
  3014. package/src/scripts/generate-native-release-manifest.ts +147 -0
  3015. package/src/scripts/generate-release-body.ts +327 -0
  3016. package/src/scripts/hook-derived-watcher.ts +649 -0
  3017. package/src/scripts/hook-payload-guard.ts +113 -0
  3018. package/src/scripts/notify-dispatcher.ts +408 -0
  3019. package/src/scripts/notify-fallback-watcher.ts +2022 -0
  3020. package/src/scripts/notify-hook/__tests__/operational-events.test.ts +24 -0
  3021. package/src/scripts/notify-hook/__tests__/payload-guard.test.ts +41 -0
  3022. package/src/scripts/notify-hook/__tests__/team-worker-posttooluse.test.ts +180 -0
  3023. package/src/scripts/notify-hook/active-team.ts +55 -0
  3024. package/src/scripts/notify-hook/auto-nudge.ts +758 -0
  3025. package/src/scripts/notify-hook/log.ts +30 -0
  3026. package/src/scripts/notify-hook/managed-tmux.ts +568 -0
  3027. package/src/scripts/notify-hook/operational-events.ts +282 -0
  3028. package/src/scripts/notify-hook/orchestration-intent.ts +80 -0
  3029. package/src/scripts/notify-hook/payload-parser.ts +143 -0
  3030. package/src/scripts/notify-hook/process-runner.ts +75 -0
  3031. package/src/scripts/notify-hook/ralph-session-resume.ts +465 -0
  3032. package/src/scripts/notify-hook/state-io.ts +220 -0
  3033. package/src/scripts/notify-hook/team-dispatch.ts +1162 -0
  3034. package/src/scripts/notify-hook/team-leader-nudge.ts +1068 -0
  3035. package/src/scripts/notify-hook/team-tmux-guard.ts +236 -0
  3036. package/src/scripts/notify-hook/team-worker-posttooluse.ts +536 -0
  3037. package/src/scripts/notify-hook/team-worker-stop.ts +438 -0
  3038. package/src/scripts/notify-hook/team-worker.ts +709 -0
  3039. package/src/scripts/notify-hook/tmux-injection.ts +740 -0
  3040. package/src/scripts/notify-hook/utils.ts +31 -0
  3041. package/src/scripts/notify-hook/visual-verdict.ts +158 -0
  3042. package/src/scripts/notify-hook.ts +1033 -0
  3043. package/src/scripts/postinstall.ts +107 -0
  3044. package/src/scripts/prepare-build.js +83 -0
  3045. package/src/scripts/prompt-inventory.ts +218 -0
  3046. package/src/scripts/run-autoresearch-showcase.sh +75 -0
  3047. package/src/scripts/run-provider-advisor.ts +213 -0
  3048. package/src/scripts/run-test-files.ts +379 -0
  3049. package/src/scripts/smoke-packed-install.ts +268 -0
  3050. package/src/scripts/sync-plugin-mirror.ts +458 -0
  3051. package/src/scripts/sync-prompt-guidance-fragments.ts +55 -0
  3052. package/src/scripts/team-hardening-benchmark.ts +90 -0
  3053. package/src/scripts/test-reply-listener-live.ts +188 -0
  3054. package/src/scripts/test-sparkshell.ts +29 -0
  3055. package/src/scripts/tmux-hook-engine.ts +349 -0
  3056. package/src/scripts/verify-native-agents.ts +311 -0
  3057. package/src/scripts/verify-native-release-assets.ts +68 -0
  3058. package/templates/AGENTS.md +187 -0
  3059. package/templates/catalog-manifest.json +547 -0
  3060. package/templates/model-instructions/explore-lightweight-AGENTS.md +11 -0
  3061. package/templates/model-instructions/sparkshell-lightweight-AGENTS.md +10 -0
@@ -0,0 +1,4590 @@
1
+ /**
2
+ * oh-my-codex CLI
3
+ * Multi-agent orchestration for OpenAI Codex CLI
4
+ */
5
+ import { execFileSync, spawn } from "child_process";
6
+ import { basename, dirname, join, posix, resolve, win32 } from "path";
7
+ import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "fs";
8
+ import { copyFile, cp, lstat, mkdir, readFile, readdir, rm, symlink, writeFile } from "fs/promises";
9
+ import { constants as osConstants, homedir } from "os";
10
+ import { createHash } from "crypto";
11
+ import { setup, SETUP_MCP_MODES, SETUP_SCOPES, SETUP_TEAM_MODES, } from "./setup.js";
12
+ import { uninstall } from "./uninstall.js";
13
+ import { version } from "./version.js";
14
+ import { tmuxHookCommand } from "./tmux-hook.js";
15
+ import { hooksCommand } from "./hooks.js";
16
+ import { hudCommand } from "../hud/index.js";
17
+ import { sidecarCommand } from "../sidecar/index.js";
18
+ import { teamCommand } from "./team.js";
19
+ import { ralphCommand } from "./ralph.js";
20
+ import { ultragoalCommand } from "./ultragoal.js";
21
+ import { performanceGoalCommand } from "./performance-goal.js";
22
+ import { askCommand } from "./ask.js";
23
+ import { questionCommand } from "./question.js";
24
+ import { stateCommand } from "./state.js";
25
+ import { cleanupCommand, cleanupOmxMcpProcesses, findLaunchSafeCleanupCandidates, } from "./cleanup.js";
26
+ import { exploreCommand } from "./explore.js";
27
+ import { sparkshellCommand } from "./sparkshell.js";
28
+ import { apiCommand } from "./api.js";
29
+ import { agentsInitCommand } from "./agents-init.js";
30
+ import { agentsCommand } from "./agents.js";
31
+ import { sessionCommand } from "./session-search.js";
32
+ import { autoresearchCommand } from "./autoresearch.js";
33
+ import { autoresearchGoalCommand } from "./autoresearch-goal.js";
34
+ import { mcpParityCommand } from "./mcp-parity.js";
35
+ import { mcpServeCommand } from "./mcp-serve.js";
36
+ import { adaptCommand } from "./adapt.js";
37
+ import { listCommand } from "./list.js";
38
+ import { authCommand } from "./auth.js";
39
+ import { runAuthHotswap } from "../auth/hotswap.js";
40
+ import { MADMAX_FLAG, CODEX_BYPASS_FLAG, HIGH_REASONING_FLAG, XHIGH_REASONING_FLAG, SPARK_FLAG, MADMAX_SPARK_FLAG, CONFIG_FLAG, LONG_CONFIG_FLAG, } from "./constants.js";
41
+ import { getBaseStateDir, getStateDir, listModeStateFilesWithScopePreference, } from "../mcp/state-paths.js";
42
+ import { evaluateRalphCompletionAuditEvidence, isRalphCompletePhase } from "../ralph/completion-audit.js";
43
+ import { readPersistedSetupPreferences, resolveCodexConfigPathForLaunch, resolveCodexHomeForLaunch, resolveProjectLocalCodexHomeForLaunch, } from "./codex-home.js";
44
+ import { escapeTomlString, readTopLevelTomlString, upsertTopLevelTomlString } from "../utils/toml.js";
45
+ export { readPersistedSetupPreferences, readPersistedSetupScope, resolveCodexConfigPathForLaunch, resolveCodexHomeForLaunch, resolveProjectLocalCodexHomeForLaunch, } from "./codex-home.js";
46
+ import { SKILL_ACTIVE_STATE_MODE, extractSessionIdFromInitializedStatePath, getSkillActiveStatePathsForStateDir, listActiveSkills, readSkillActiveState, syncCanonicalSkillStateForMode, } from "../state/skill-active.js";
47
+ import { isTrackedWorkflowMode } from "../state/workflow-transition.js";
48
+ import { maybeCheckAndPromptUpdate, runImmediateUpdate } from "./update.js";
49
+ import { maybePromptGithubStar } from "./star-prompt.js";
50
+ import { generateOverlay, removeSessionModelInstructionsFile, resolveSessionOrchestrationMode, sessionModelInstructionsPath, writeSessionModelInstructionsFile, } from "../hooks/agents-overlay.js";
51
+ import { readSessionState, writeSessionStart, writeSessionEnd, resetSessionMetrics, } from "../hooks/session.js";
52
+ import { buildClientAttachedReconcileHookName, buildReconcileHudResizeArgs, buildRegisterClientAttachedReconcileArgs, buildRegisterResizeHookArgs, buildResizeHookName, buildResizeHookTarget, buildScheduleDelayedHudResizeArgs, buildUnregisterClientAttachedReconcileArgs, buildUnregisterResizeHookArgs, enableMouseScrolling, isMsysOrGitBash, isNativeWindows, isTmuxAvailable, mitigateCopyModeUnderlineArtifacts, } from "../team/tmux-session.js";
53
+ import { getPackageRoot } from "../utils/package.js";
54
+ import { codexConfigPath, omxRoot, rememberOmxLaunchContext, resolveOmxCliEntryPath } from "../utils/paths.js";
55
+ import { cleanCodexModelAvailabilityNuxIfNeeded, extractSharedMcpRegistryServersFromConfig, repairConfigIfNeeded, repairProjectScopeTrustStateForLaunch, syncProjectScopeTrustStateFromRuntime } from "../config/generator.js";
56
+ import { OMX_FIRST_PARTY_MCP_SERVER_NAMES } from "../config/omx-first-party-mcp.js";
57
+ import { HUD_TMUX_HEIGHT_LINES, HUD_TMUX_MIN_LAUNCH_WINDOW_HEIGHT_LINES, isTmuxWindowTooCrampedForHudSplit } from "../hud/constants.js";
58
+ import { OMX_TMUX_HUD_OWNER_ENV } from "../hud/reconcile.js";
59
+ import { readUltragoalState } from "../hud/state.js";
60
+ import { createHudWatchPane as createSharedHudWatchPane, killTmuxPane as killSharedTmuxPane, listCurrentWindowHudPaneIds, listCurrentWindowPanes, buildHudRuntimeEnv, parsePaneIdFromTmuxOutput, reapDeadHudPanes, registerHudResizeHook, OMX_TMUX_HUD_LEADER_PANE_ENV, readCurrentWindowSize, resizeTmuxPane, unregisterHudResizeHook, } from "../hud/tmux.js";
61
+ export { parseTmuxPaneSnapshot, isHudWatchPane, findHudWatchPaneIds } from "../hud/tmux.js";
62
+ rememberOmxLaunchContext({ argv1: process.argv[1], cwd: process.cwd(), env: process.env });
63
+ import { classifySpawnError, resolveTmuxBinaryForPlatform, spawnPlatformCommandSync, } from "../utils/platform-command.js";
64
+ import { buildHookEvent } from "../hooks/extensibility/events.js";
65
+ import { dispatchHookEvent } from "../hooks/extensibility/dispatcher.js";
66
+ import { collectInheritableTeamWorkerArgs as collectInheritableTeamWorkerArgsShared, resolveTeamWorkerLaunchArgs, resolveTeamLowComplexityDefaultModel, } from "../team/model-contract.js";
67
+ import { parseWorktreeMode, planWorktreeTarget, ensureWorktree, } from "../team/worktree.js";
68
+ import { ensureReusableNodeModules } from "../utils/repo-deps.js";
69
+ import { OMX_NOTIFY_TEMP_CONTRACT_ENV, parseNotifyTempContractFromArgs, serializeNotifyTempContract, } from "../notifications/temp-contract.js";
70
+ import { execInjectCommand } from "../exec/followup.js";
71
+ import { imagegenCommand } from "../imagegen/continuation.js";
72
+ export function resolveNotifyFallbackWatcherScript(pkgRoot = getPackageRoot()) {
73
+ return resolveDistScript(pkgRoot, "notify-fallback-watcher.js");
74
+ }
75
+ export function resolveHookDerivedWatcherScript(pkgRoot = getPackageRoot()) {
76
+ return resolveDistScript(pkgRoot, "hook-derived-watcher.js");
77
+ }
78
+ export function resolveNotifyHookScript(pkgRoot = getPackageRoot()) {
79
+ return resolveDistScript(pkgRoot, "notify-hook.js");
80
+ }
81
+ function resolveDistScript(pkgRoot, scriptName) {
82
+ return join(pkgRoot, "dist", "scripts", scriptName);
83
+ }
84
+ export const HELP = `
85
+ oh-my-codex (omx) - Multi-agent orchestration for Codex CLI
86
+
87
+ Usage:
88
+ omx Launch Codex CLI (detached tmux by default on supported interactive terminals)
89
+ omx exec Run codex exec non-interactively with OMX AGENTS/overlay injection
90
+ omx exec inject <session-id> --prompt <text>
91
+ Queue audited follow-up instructions for a running non-interactive exec job
92
+ omx imagegen continuation <session-id> --artifact <name>
93
+ Queue a Stop-hook continuation for built-in image generation turns
94
+ omx setup Install skills, prompts, CLI-first config, and scope-specific AGENTS.md
95
+ (user scope prompts for legacy vs plugin skill delivery when needed)
96
+ omx update Install the stable channel now, then refresh setup
97
+ omx update --stable
98
+ Install/rollback to npm stable (oh-my-codex@latest), then refresh setup
99
+ omx update --dev
100
+ Install the upstream dev branch, then refresh setup
101
+ omx uninstall Remove OMX configuration and clean up installed artifacts
102
+ omx doctor Check installation health
103
+ omx list List packaged OMX skills and native agent prompts (--json)
104
+ omx cleanup Kill orphaned OMX MCP server processes and remove stale OMX /tmp directories
105
+ omx doctor --team Check team/swarm runtime health diagnostics
106
+ omx ask Ask local provider CLI (claude|gemini) and write artifact output
107
+ omx auth Manage Codex OAuth auth slots (add|list|use)
108
+ omx question OMX-owned blocking question UI entrypoint for agent-invoked user questions
109
+ omx adapt Scaffold OMX-owned adapter foundations for persistent external targets
110
+ omx resume Resume a previous interactive Codex session
111
+ omx explore DEPRECATED compatibility command; use normal repo inspection or omx sparkshell
112
+ omx api Run native omx-api localhost gateway commands (serve|status|stop|generate)
113
+ omx session Search prior local session transcripts and history artifacts
114
+ omx agents-init [path]
115
+ Bootstrap lightweight AGENTS.md files for a repo/subtree
116
+ omx agents Manage Codex native agent TOML files
117
+ omx deepinit [path]
118
+ Alias for agents-init (lightweight AGENTS bootstrap only)
119
+ omx team Spawn parallel worker panes in tmux and bootstrap inbox/task state
120
+ omx ralph Launch Codex with ralph persistence mode active
121
+ omx ultragoal Create, resume, and checkpoint durable multi-goal plans over Codex goal mode
122
+ omx performance-goal
123
+ Create, hand off, and gate evaluator-backed performance goals
124
+ omx autoresearch-goal
125
+ Create, hand off, and gate professor-critic research goals
126
+ omx autoresearch [DEPRECATED] Use $autoresearch; direct CLI launch removed
127
+ omx version Show version information
128
+ omx tmux-hook Manage tmux prompt injection workaround (init|status|validate|test)
129
+ omx hooks Manage hook plugins (init|status|validate|test)
130
+ omx hud Show HUD statusline (--watch, --json, --preset=NAME)
131
+ omx sidecar Show read-only team/multi-agent visualization (--watch, --json, --tmux)
132
+ omx state Read/write/list OMX mode state via CLI parity surface
133
+ omx notepad JSON CLI surface for OMX notepad operations
134
+ omx project-memory
135
+ JSON CLI surface for OMX project-memory operations
136
+ omx trace JSON CLI surface for OMX trace operations
137
+ omx code-intel
138
+ JSON CLI surface for OMX code-intel operations
139
+ omx wiki JSON CLI surface for OMX wiki operations
140
+ omx mcp-serve Launch an OMX stdio MCP server target (plugin/runtime use)
141
+ omx sparkshell <command> [args...]
142
+ omx sparkshell --tmux-pane <pane-id> [--tail-lines <100-1000>]
143
+ Run native sparkshell sidecar for direct command execution or explicit tmux-pane summarization
144
+ (also used as an adaptive backend for qualifying read-only explore tasks)
145
+ omx help Show this help message
146
+ omx status Show active modes and state
147
+ omx cancel Cancel active execution modes
148
+ omx reasoning Show or set model reasoning effort (low|medium|high|xhigh)
149
+
150
+ Options:
151
+ --yolo Launch Codex in yolo mode (shorthand for: omx launch --yolo)
152
+ --high Launch Codex with high reasoning effort
153
+ (shorthand for: -c model_reasoning_effort="high")
154
+ --xhigh Launch Codex with xhigh reasoning effort
155
+ (shorthand for: -c model_reasoning_effort="xhigh")
156
+ --madmax DANGEROUS: bypass Codex approvals and sandbox
157
+ (alias for --dangerously-bypass-approvals-and-sandbox)
158
+ --spark Use the Codex spark model (~1.3x faster) for team workers only
159
+ Workers get the configured low-complexity team model; leader model unchanged
160
+ --madmax-spark spark model for workers + bypass approvals for leader and workers
161
+ (shorthand for: --spark --madmax)
162
+ --notify-temp Enable temporary notification routing for this run/session only
163
+ --hotswap Run a direct Codex session that rotates auth slots on 429/quota and resumes
164
+ --direct Launch the interactive leader directly without OMX tmux/HUD management
165
+ --tmux Launch the interactive leader session in detached tmux
166
+ --discord Select Discord provider for temporary notification mode
167
+ --slack Select Slack provider for temporary notification mode
168
+ --telegram Select Telegram provider for temporary notification mode
169
+ --custom <name>
170
+ Select custom/OpenClaw gateway name for temporary notification mode
171
+ -w, --worktree[=<name>]
172
+ Launch Codex in a git worktree (detached when no name is given)
173
+ --force Force reinstall (overwrite existing files)
174
+ --merge-agents
175
+ Merge OMX-managed AGENTS.md sections into an existing AGENTS.md
176
+ instead of overwriting user-authored content
177
+ --dry-run Show what would be done without doing it
178
+ --plugin Use Codex plugin delivery for omx setup and remove legacy OMX-managed user/project components
179
+ --legacy Use legacy setup delivery for omx setup, overriding persisted plugin mode
180
+ --install-mode <legacy|plugin>
181
+ Explicit setup install mode (canonical form; --legacy/--plugin are aliases)
182
+ --mcp <none|compat>
183
+ Explicit setup MCP mode (default: none; compat enables first-party MCP compatibility and shared registry sync)
184
+ --no-mcp Alias for --mcp=none
185
+ --with-mcp Alias for --mcp=compat
186
+ --disable-team
187
+ Disable Team skill/context generation for setup (default remains enabled)
188
+ --enable-team Re-enable Team skill/context generation for setup
189
+ --team-mode <enabled|disabled>
190
+ Explicit Team setup mode
191
+ --keep-config Skip config.toml cleanup during uninstall
192
+ --purge Remove .omx/ cache directory during uninstall
193
+ --verbose Show detailed output
194
+ --scope Setup scope for "omx setup" only:
195
+ user | project
196
+
197
+ Launch policy:
198
+ OMX_LAUNCH_POLICY=auto
199
+ Use the default policy: detached tmux when supported, direct otherwise
200
+ OMX_LAUNCH_POLICY=direct
201
+ Run without OMX tmux/HUD management
202
+ OMX_LAUNCH_POLICY=tmux
203
+ Force OMX-managed detached tmux launch
204
+ OMX_LAUNCH_POLICY=detached-tmux
205
+ Force OMX-managed detached tmux launch
206
+ CLI policy flags (--direct/--tmux) override OMX_LAUNCH_POLICY; the last flag before -- wins.
207
+ Unset or empty OMX_LAUNCH_POLICY returns to auto/default behavior.
208
+ Config files are intentionally not used for launch policy in this release.
209
+ `;
210
+ const REASONING_KEY = "model_reasoning_effort";
211
+ const MODEL_INSTRUCTIONS_FILE_KEY = "model_instructions_file";
212
+ const TEAM_WORKER_LAUNCH_ARGS_ENV = "OMX_TEAM_WORKER_LAUNCH_ARGS";
213
+ const TEAM_INHERIT_LEADER_FLAGS_ENV = "OMX_TEAM_INHERIT_LEADER_FLAGS";
214
+ const OMX_BYPASS_DEFAULT_SYSTEM_PROMPT_ENV = "OMX_BYPASS_DEFAULT_SYSTEM_PROMPT";
215
+ const OMX_MODEL_INSTRUCTIONS_FILE_ENV = "OMX_MODEL_INSTRUCTIONS_FILE";
216
+ const OMX_INSTANCE_OPTION = "@omx_instance_id";
217
+ const OMX_RALPH_APPEND_INSTRUCTIONS_FILE_ENV = "OMX_RALPH_APPEND_INSTRUCTIONS_FILE";
218
+ const OMX_AUTORESEARCH_APPEND_INSTRUCTIONS_FILE_ENV = "OMX_AUTORESEARCH_APPEND_INSTRUCTIONS_FILE";
219
+ const REASONING_MODES = ["low", "medium", "high", "xhigh"];
220
+ const REASONING_MODE_SET = new Set(REASONING_MODES);
221
+ const REASONING_USAGE = "Usage: omx reasoning <low|medium|high|xhigh>";
222
+ const ALLOWED_SHELLS = new Set([
223
+ "/bin/sh",
224
+ "/bin/bash",
225
+ "/bin/zsh",
226
+ "/bin/dash",
227
+ "/bin/fish",
228
+ "/usr/bin/sh",
229
+ "/usr/bin/bash",
230
+ "/usr/bin/zsh",
231
+ "/usr/bin/dash",
232
+ "/usr/bin/fish",
233
+ "/usr/local/bin/bash",
234
+ "/usr/local/bin/zsh",
235
+ "/usr/local/bin/fish",
236
+ "/opt/local/bin/zsh",
237
+ "/opt/homebrew/bin/zsh",
238
+ ]);
239
+ const WINDOWS_DETACHED_BOOTSTRAP_DELAY_MS = 2500;
240
+ const CODEX_VERSION_FLAGS = new Set(["--version", "-V"]);
241
+ const TMUX_EXTENDED_KEYS_MODE = "always";
242
+ const TMUX_EXTENDED_KEYS_FALLBACK_MODE = "off";
243
+ const TMUX_EXTENDED_KEYS_LEASE_DIR = "tmux-extended-keys";
244
+ const TMUX_EXTENDED_KEYS_LOCK_RETRY_MS = 20;
245
+ const TMUX_EXTENDED_KEYS_LOCK_MAX_ATTEMPTS = 100;
246
+ const TMUX_EXTENDED_KEYS_LOCK_STALE_MS = 30_000;
247
+ const NESTED_HELP_COMMANDS = new Set([
248
+ "ask",
249
+ "question",
250
+ "cleanup",
251
+ "auth",
252
+ "adapt",
253
+ "explore",
254
+ "autoresearch",
255
+ "autoresearch-goal",
256
+ "agents",
257
+ "agents-init",
258
+ "deepinit",
259
+ "exec",
260
+ "imagegen",
261
+ "hooks",
262
+ "list",
263
+ "hud",
264
+ "sidecar",
265
+ "state",
266
+ "wiki",
267
+ "mcp-serve",
268
+ "ralph",
269
+ "ultragoal",
270
+ "performance-goal",
271
+ "resume",
272
+ "session",
273
+ "api",
274
+ "sparkshell",
275
+ "team",
276
+ "tmux-hook",
277
+ ]);
278
+ export function resolveSetupInstallModeArg(args) {
279
+ let value;
280
+ const setValue = (next, source) => {
281
+ if (value && value !== next) {
282
+ throw new Error(`Conflicting setup install mode flags: ${source} selects ${next}, but another flag already selected ${value}`);
283
+ }
284
+ value = next;
285
+ };
286
+ for (let index = 0; index < args.length; index += 1) {
287
+ const arg = args[index];
288
+ if (arg === "--plugin") {
289
+ setValue("plugin", arg);
290
+ continue;
291
+ }
292
+ if (arg === "--legacy") {
293
+ setValue("legacy", arg);
294
+ continue;
295
+ }
296
+ if (arg === "--install-mode") {
297
+ const next = args[index + 1];
298
+ if (!next || next.startsWith("-")) {
299
+ throw new Error(`Missing setup install mode value after --install-mode. Expected one of: legacy, plugin`);
300
+ }
301
+ if (next !== "legacy" && next !== "plugin") {
302
+ throw new Error(`Invalid setup install mode: ${next}. Expected one of: legacy, plugin`);
303
+ }
304
+ setValue(next, arg);
305
+ index += 1;
306
+ continue;
307
+ }
308
+ if (arg.startsWith("--install-mode=")) {
309
+ const next = arg.slice("--install-mode=".length);
310
+ if (next !== "legacy" && next !== "plugin") {
311
+ throw new Error(`Invalid setup install mode: ${next}. Expected one of: legacy, plugin`);
312
+ }
313
+ setValue(next, "--install-mode");
314
+ }
315
+ }
316
+ return value;
317
+ }
318
+ export function resolveSetupMcpModeArg(args) {
319
+ let value;
320
+ const setValue = (next, source) => {
321
+ if (value && value !== next) {
322
+ throw new Error(`Conflicting setup MCP mode flags: ${source} selects ${next}, but another flag already selected ${value}`);
323
+ }
324
+ value = next;
325
+ };
326
+ const parseValue = (next) => {
327
+ if (!SETUP_MCP_MODES.includes(next)) {
328
+ throw new Error(`Invalid setup MCP mode: ${next}. Expected one of: none, compat`);
329
+ }
330
+ return next;
331
+ };
332
+ for (let index = 0; index < args.length; index += 1) {
333
+ const arg = args[index];
334
+ if (arg === "--no-mcp") {
335
+ setValue("none", arg);
336
+ continue;
337
+ }
338
+ if (arg === "--with-mcp") {
339
+ setValue("compat", arg);
340
+ continue;
341
+ }
342
+ if (arg === "--mcp") {
343
+ const next = args[index + 1];
344
+ if (!next || next.startsWith("-")) {
345
+ throw new Error(`Missing setup MCP mode value after --mcp. Expected one of: none, compat`);
346
+ }
347
+ setValue(parseValue(next), arg);
348
+ index += 1;
349
+ continue;
350
+ }
351
+ if (arg.startsWith("--mcp=")) {
352
+ setValue(parseValue(arg.slice("--mcp=".length)), "--mcp");
353
+ }
354
+ }
355
+ return value;
356
+ }
357
+ export function resolveSetupScopeArg(args) {
358
+ let value;
359
+ for (let index = 0; index < args.length; index += 1) {
360
+ const arg = args[index];
361
+ if (arg === "--scope") {
362
+ const next = args[index + 1];
363
+ if (!next || next.startsWith("-")) {
364
+ throw new Error(`Missing setup scope value after --scope. Expected one of: ${SETUP_SCOPES.join(", ")}`);
365
+ }
366
+ value = next;
367
+ index += 1;
368
+ continue;
369
+ }
370
+ if (arg.startsWith("--scope=")) {
371
+ value = arg.slice("--scope=".length);
372
+ }
373
+ }
374
+ if (!value)
375
+ return undefined;
376
+ if (SETUP_SCOPES.includes(value)) {
377
+ return value;
378
+ }
379
+ throw new Error(`Invalid setup scope: ${value}. Expected one of: ${SETUP_SCOPES.join(", ")}`);
380
+ }
381
+ export function resolveSetupTeamModeArg(args) {
382
+ let value;
383
+ const setValue = (next, source) => {
384
+ if (value && value !== next) {
385
+ throw new Error(`Conflicting setup Team mode flags: ${source} selects ${next}, but another flag already selected ${value}`);
386
+ }
387
+ value = next;
388
+ };
389
+ const parseValue = (next) => {
390
+ if (!SETUP_TEAM_MODES.includes(next)) {
391
+ throw new Error(`Invalid setup Team mode: ${next}. Expected one of: enabled, disabled`);
392
+ }
393
+ return next;
394
+ };
395
+ for (let index = 0; index < args.length; index += 1) {
396
+ const arg = args[index];
397
+ if (arg === "--disable-team" || arg === "--no-team") {
398
+ setValue("disabled", arg);
399
+ continue;
400
+ }
401
+ if (arg === "--enable-team" || arg === "--team") {
402
+ setValue("enabled", arg);
403
+ continue;
404
+ }
405
+ if (arg === "--team-mode") {
406
+ const next = args[index + 1];
407
+ if (!next || next.startsWith("-")) {
408
+ throw new Error(`Missing setup Team mode value after --team-mode. Expected one of: enabled, disabled`);
409
+ }
410
+ setValue(parseValue(next), arg);
411
+ index += 1;
412
+ continue;
413
+ }
414
+ if (arg.startsWith("--team-mode=")) {
415
+ setValue(parseValue(arg.slice("--team-mode=".length)), "--team-mode");
416
+ }
417
+ }
418
+ return value;
419
+ }
420
+ export function resolveCliInvocation(args) {
421
+ const firstArg = args[0];
422
+ if (firstArg === "--help" || firstArg === "-h") {
423
+ return { command: "help", launchArgs: [] };
424
+ }
425
+ if (firstArg === "--version" || firstArg === "-v") {
426
+ return { command: "version", launchArgs: [] };
427
+ }
428
+ if (!firstArg || firstArg.startsWith("--")) {
429
+ return { command: "launch", launchArgs: firstArg ? args : [] };
430
+ }
431
+ if (firstArg === "launch") {
432
+ return { command: "launch", launchArgs: args.slice(1) };
433
+ }
434
+ if (firstArg === "exec") {
435
+ return { command: "exec", launchArgs: args.slice(1) };
436
+ }
437
+ if (firstArg === "resume") {
438
+ return { command: "resume", launchArgs: args.slice(1) };
439
+ }
440
+ return { command: firstArg, launchArgs: [] };
441
+ }
442
+ export function resolveUpdateChannelArg(args) {
443
+ let channel = 'stable';
444
+ let sawStable = false;
445
+ let sawDev = false;
446
+ for (const arg of args) {
447
+ if (arg === '--stable') {
448
+ sawStable = true;
449
+ channel = 'stable';
450
+ continue;
451
+ }
452
+ if (arg === '--dev') {
453
+ sawDev = true;
454
+ channel = 'dev';
455
+ continue;
456
+ }
457
+ throw new Error(`Unknown omx update option: ${arg}. Expected no flags, --stable, or --dev.`);
458
+ }
459
+ if (sawStable && sawDev) {
460
+ throw new Error('omx update --dev and --stable are mutually exclusive.');
461
+ }
462
+ return channel;
463
+ }
464
+ export function resolveNotifyTempContract(args, env = process.env) {
465
+ return parseNotifyTempContractFromArgs(args, env);
466
+ }
467
+ export function commandOwnsLocalHelp(command) {
468
+ return NESTED_HELP_COMMANDS.has(command);
469
+ }
470
+ const OMX_LAUNCH_POLICY_ENV = "OMX_LAUNCH_POLICY";
471
+ let warnedInvalidEnvLaunchPolicy = false;
472
+ function splitLeaderLaunchPolicyArgs(args) {
473
+ const remainingArgs = [];
474
+ let explicitPolicy;
475
+ let passthroughOnly = false;
476
+ for (const arg of args) {
477
+ if (passthroughOnly) {
478
+ remainingArgs.push(arg);
479
+ continue;
480
+ }
481
+ if (arg === "--") {
482
+ passthroughOnly = true;
483
+ remainingArgs.push(arg);
484
+ continue;
485
+ }
486
+ if (arg === "--direct") {
487
+ explicitPolicy = "direct";
488
+ continue;
489
+ }
490
+ if (arg === "--tmux") {
491
+ explicitPolicy = "detached-tmux";
492
+ continue;
493
+ }
494
+ remainingArgs.push(arg);
495
+ }
496
+ return { explicitPolicy, remainingArgs };
497
+ }
498
+ export function resolveLeaderLaunchPolicyOverride(args) {
499
+ return splitLeaderLaunchPolicyArgs(args).explicitPolicy;
500
+ }
501
+ export function resolveEnvLaunchPolicyOverride(env = process.env) {
502
+ const rawValue = env[OMX_LAUNCH_POLICY_ENV]?.trim();
503
+ if (!rawValue)
504
+ return undefined;
505
+ const value = rawValue.toLowerCase();
506
+ if (value === "auto")
507
+ return undefined;
508
+ if (value === "direct")
509
+ return "direct";
510
+ if (value === "tmux" || value === "detached-tmux")
511
+ return "detached-tmux";
512
+ if (!warnedInvalidEnvLaunchPolicy) {
513
+ warnedInvalidEnvLaunchPolicy = true;
514
+ console.warn(`[omx] warning: invalid ${OMX_LAUNCH_POLICY_ENV}="${rawValue}". ` +
515
+ "Expected direct, tmux, detached-tmux, or auto. Falling back to auto/default launch policy.");
516
+ }
517
+ return undefined;
518
+ }
519
+ export function resolveEffectiveLeaderLaunchPolicyOverride(args, env = process.env) {
520
+ return (resolveLeaderLaunchPolicyOverride(args) ?? resolveEnvLaunchPolicyOverride(env));
521
+ }
522
+ export function resolveCodexLaunchPolicy(env = process.env, _platform = process.platform, tmuxAvailable = isTmuxAvailable(), nativeWindows = isNativeWindows(), stdinIsTTY = Boolean(process.stdin.isTTY), stdoutIsTTY = Boolean(process.stdout.isTTY), explicitPolicy) {
523
+ if (explicitPolicy === "direct")
524
+ return "direct";
525
+ if (env.TMUX)
526
+ return "inside-tmux";
527
+ if (explicitPolicy === "detached-tmux")
528
+ return tmuxAvailable ? "detached-tmux" : "direct";
529
+ if (_platform === "win32")
530
+ return "direct";
531
+ if (nativeWindows)
532
+ return "direct";
533
+ if (!stdinIsTTY || !stdoutIsTTY)
534
+ return "direct";
535
+ return tmuxAvailable ? "detached-tmux" : "direct";
536
+ }
537
+ function resolveTmuxExecutableForLaunch() {
538
+ return resolveTmuxBinaryForPlatform() || "tmux";
539
+ }
540
+ export const CODEX_SQLITE_HOME_ENV = "CODEX_SQLITE_HOME";
541
+ export function runtimeCodexHomePath(cwd, sessionId) {
542
+ return join(omxRoot(cwd), "runtime", "codex-home", sessionId);
543
+ }
544
+ async function linkOrCopyCodexHomeEntry(source, destination) {
545
+ const stat = await lstat(source);
546
+ try {
547
+ await symlink(source, destination, stat.isDirectory() && process.platform === "win32" ? "junction" : undefined);
548
+ }
549
+ catch {
550
+ if (stat.isDirectory()) {
551
+ await cp(source, destination, { recursive: true, force: true, verbatimSymlinks: true });
552
+ return;
553
+ }
554
+ await copyFile(source, destination);
555
+ }
556
+ }
557
+ function isCodexSqliteArtifact(entryName) {
558
+ return /^(?:state|logs)_\d+\.sqlite(?:-(?:shm|wal))?$/.test(entryName);
559
+ }
560
+ const PROJECT_LAUNCH_PERSISTED_RUNTIME_ENTRY_NAMES = new Set([
561
+ // Codex CLI writes browser/OTP login state here when CODEX_HOME points at
562
+ // the per-session mirror. Persist only the opaque file itself; never parse or
563
+ // log the contents.
564
+ "auth.json",
565
+ ]);
566
+ // Mirroring these files into the runtime CODEX_HOME would cause Codex to load
567
+ // them as user-scope config alongside the canonical project-scope copies under
568
+ // <cwd>/.codex, duplicating every native hook and asking the user to re-trust
569
+ // hooks on every launch. See GH issue #2470.
570
+ const PROJECT_LAUNCH_RUNTIME_SKIPPED_ENTRY_NAMES = new Set(["hooks.json"]);
571
+ function shouldPersistProjectLaunchRuntimeEntry(entryName) {
572
+ return PROJECT_LAUNCH_PERSISTED_RUNTIME_ENTRY_NAMES.has(entryName);
573
+ }
574
+ export async function persistProjectLaunchRuntimeAuthState(runtimeCodexHome, projectCodexHome) {
575
+ if (!runtimeCodexHome || !projectCodexHome)
576
+ return;
577
+ if (!existsSync(runtimeCodexHome))
578
+ return;
579
+ await mkdir(projectCodexHome, { recursive: true });
580
+ for (const entry of await readdir(runtimeCodexHome, { withFileTypes: true })) {
581
+ if (!shouldPersistProjectLaunchRuntimeEntry(entry.name) || !entry.isFile())
582
+ continue;
583
+ await copyFile(join(runtimeCodexHome, entry.name), join(projectCodexHome, entry.name));
584
+ }
585
+ }
586
+ export async function prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, projectCodexHome, options = {}) {
587
+ const runtimeCodexHome = runtimeCodexHomePath(cwd, sessionId);
588
+ await rm(runtimeCodexHome, { recursive: true, force: true });
589
+ await mkdir(runtimeCodexHome, { recursive: true });
590
+ if (!existsSync(projectCodexHome))
591
+ return runtimeCodexHome;
592
+ for (const entry of await readdir(projectCodexHome, { withFileTypes: true })) {
593
+ if (isCodexSqliteArtifact(entry.name) && !options.includeHistoryArtifacts)
594
+ continue;
595
+ if (PROJECT_LAUNCH_RUNTIME_SKIPPED_ENTRY_NAMES.has(entry.name))
596
+ continue;
597
+ const source = join(projectCodexHome, entry.name);
598
+ const destination = join(runtimeCodexHome, entry.name);
599
+ if (entry.name === "config.toml") {
600
+ const projectHooksPath = join(projectCodexHome, "hooks.json");
601
+ const projectConfig = await readFile(source, "utf-8");
602
+ const launchConfig = repairProjectScopeTrustStateForLaunch(projectConfig, projectHooksPath);
603
+ if (launchConfig !== projectConfig) {
604
+ await writeFile(source, launchConfig, "utf-8");
605
+ }
606
+ await writeFile(destination, launchConfig, "utf-8");
607
+ continue;
608
+ }
609
+ await linkOrCopyCodexHomeEntry(source, destination);
610
+ }
611
+ return runtimeCodexHome;
612
+ }
613
+ function resolveProjectSqliteHomeForLaunch(projectCodexHome, env) {
614
+ const configured = env[CODEX_SQLITE_HOME_ENV];
615
+ if (typeof configured === "string" && configured.trim() !== "")
616
+ return undefined;
617
+ return projectCodexHome;
618
+ }
619
+ export async function prepareCodexHomeForLaunch(cwd, sessionId, env = process.env, options = {}) {
620
+ const projectLocalCodexHomeForCleanup = resolveProjectLocalCodexHomeForLaunch(cwd, env);
621
+ if (projectLocalCodexHomeForCleanup) {
622
+ const runtimeCodexHome = await prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, projectLocalCodexHomeForCleanup, { includeHistoryArtifacts: options.includeHistoryArtifacts });
623
+ return {
624
+ codexHomeOverride: runtimeCodexHome,
625
+ sqliteHomeOverride: resolveProjectSqliteHomeForLaunch(projectLocalCodexHomeForCleanup, env),
626
+ projectLocalCodexHomeForCleanup,
627
+ runtimeCodexHomeForCleanup: runtimeCodexHome,
628
+ };
629
+ }
630
+ return {
631
+ codexHomeOverride: resolveCodexHomeForLaunch(cwd, env),
632
+ projectLocalCodexHomeForCleanup,
633
+ };
634
+ }
635
+ export async function persistProjectLaunchRuntimeProjectTrustState(runtimeCodexHome, projectCodexHome) {
636
+ if (!runtimeCodexHome || !projectCodexHome)
637
+ return;
638
+ const runtimeConfigPath = join(runtimeCodexHome, "config.toml");
639
+ if (!existsSync(runtimeConfigPath))
640
+ return;
641
+ const projectConfigPath = join(projectCodexHome, "config.toml");
642
+ const runtimeConfig = await readFile(runtimeConfigPath, "utf-8");
643
+ const projectConfig = existsSync(projectConfigPath)
644
+ ? await readFile(projectConfigPath, "utf-8")
645
+ : "";
646
+ const projectHooksPath = join(projectCodexHome, "hooks.json");
647
+ const nextProjectConfig = syncProjectScopeTrustStateFromRuntime(projectConfig, runtimeConfig, projectHooksPath);
648
+ if (nextProjectConfig !== projectConfig) {
649
+ await mkdir(projectCodexHome, { recursive: true });
650
+ await writeFile(projectConfigPath, nextProjectConfig, "utf-8");
651
+ }
652
+ }
653
+ export async function cleanupRuntimeCodexHome(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence) {
654
+ if (!runtimeCodexHomeForCleanup)
655
+ return;
656
+ await persistProjectLaunchRuntimeAuthState(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence);
657
+ await persistProjectLaunchRuntimeProjectTrustState(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence);
658
+ await rm(runtimeCodexHomeForCleanup, { recursive: true, force: true });
659
+ }
660
+ function execTmuxFileSync(args, options) {
661
+ return execFileSync(resolveTmuxExecutableForLaunch(), args, {
662
+ ...(options ?? {}),
663
+ ...(process.platform === "win32" ? { windowsHide: true } : {}),
664
+ });
665
+ }
666
+ function readTmuxEnvValueForTarget(targetPaneId) {
667
+ if (!targetPaneId.startsWith("%"))
668
+ return undefined;
669
+ try {
670
+ const raw = execTmuxFileSync(["display-message", "-p", "-t", targetPaneId, "#{socket_path},#{pid},#{session_id}"], { encoding: "utf-8" }).trim();
671
+ return raw.replace(/,\$(\d+)$/, ",$1") || undefined;
672
+ }
673
+ catch {
674
+ return undefined;
675
+ }
676
+ }
677
+ export function buildInsideTmuxHudHookEnv(baseEnv, sessionId, currentPaneId, omxRootOverride) {
678
+ return {
679
+ ...baseEnv,
680
+ OMX_SESSION_ID: sessionId,
681
+ [OMX_TMUX_HUD_OWNER_ENV]: "1",
682
+ ...(currentPaneId ? { [OMX_TMUX_HUD_LEADER_PANE_ENV]: currentPaneId } : {}),
683
+ ...(omxRootOverride ? { OMX_ROOT: omxRootOverride } : {}),
684
+ };
685
+ }
686
+ export function registerInsideTmuxHudResizeHook(options) {
687
+ const { hudPaneId, currentPaneId } = options;
688
+ if (!hudPaneId || !currentPaneId)
689
+ return false;
690
+ return (options.register ?? registerHudResizeHook)(hudPaneId, currentPaneId, HUD_TMUX_HEIGHT_LINES, {
691
+ cwd: options.cwd,
692
+ env: buildInsideTmuxHudHookEnv(options.baseEnv ?? process.env, options.sessionId, currentPaneId, options.omxRootOverride),
693
+ });
694
+ }
695
+ export function buildDetachedHudHookEnv(baseEnv, sessionId, detachedLeaderPaneId, tmuxEnvValue, omxBin, omxRootOverride) {
696
+ return {
697
+ ...baseEnv,
698
+ TMUX: tmuxEnvValue,
699
+ TMUX_PANE: detachedLeaderPaneId,
700
+ OMX_SESSION_ID: sessionId,
701
+ [OMX_TMUX_HUD_OWNER_ENV]: "1",
702
+ ...(omxRootOverride ? { OMX_ROOT: omxRootOverride } : {}),
703
+ OMX_ENTRY_PATH: omxBin,
704
+ };
705
+ }
706
+ export function registerDetachedHudLayoutReconcileHook(options) {
707
+ const { hudPaneId, detachedLeaderPaneId } = options;
708
+ if (!hudPaneId || !detachedLeaderPaneId)
709
+ return false;
710
+ const tmuxEnvValue = (options.readTmuxEnvValue ?? readTmuxEnvValueForTarget)(detachedLeaderPaneId);
711
+ if (!tmuxEnvValue)
712
+ return false;
713
+ return (options.register ?? registerHudResizeHook)(hudPaneId, detachedLeaderPaneId, HUD_TMUX_HEIGHT_LINES, {
714
+ cwd: options.cwd,
715
+ env: buildDetachedHudHookEnv(options.baseEnv ?? process.env, options.sessionId, detachedLeaderPaneId, tmuxEnvValue, options.omxBin, options.omxRootOverride),
716
+ });
717
+ }
718
+ export const DETACHED_TMUX_HISTORY_LIMIT = 500;
719
+ const TMUX_HOOK_INDEX_MAX = 1_000_000;
720
+ function setDetachedTmuxSessionHistoryLimit(sessionName, leaderPaneId) {
721
+ const boundedHistoryLimit = String(DETACHED_TMUX_HISTORY_LIMIT);
722
+ try {
723
+ execTmuxFileSync(["set-option", "-q", "-t", sessionName, "history-limit", boundedHistoryLimit], { stdio: "ignore" });
724
+ }
725
+ catch (err) {
726
+ logCliOperationFailure(err);
727
+ }
728
+ if (!leaderPaneId)
729
+ return;
730
+ try {
731
+ execTmuxFileSync(["set-option", "-pq", "-t", leaderPaneId, "history-limit", boundedHistoryLimit], { stdio: "ignore" });
732
+ }
733
+ catch (err) {
734
+ logCliOperationFailure(err);
735
+ }
736
+ }
737
+ function clearDetachedTmuxSessionHistoryIfUnattached(sessionName, leaderPaneId) {
738
+ try {
739
+ const attached = execTmuxFileSync(["display-message", "-p", "-t", sessionName, "#{session_attached}"], {
740
+ stdio: ["ignore", "pipe", "ignore"],
741
+ encoding: "utf-8",
742
+ }).trim();
743
+ if (attached !== "0")
744
+ return;
745
+ execTmuxFileSync(["clear-history", "-t", leaderPaneId], {
746
+ stdio: "ignore",
747
+ });
748
+ }
749
+ catch (err) {
750
+ logCliOperationFailure(err);
751
+ }
752
+ }
753
+ function readTmuxSessionInstanceId(sessionName) {
754
+ try {
755
+ return execTmuxFileSync(["show-options", "-qv", "-t", sessionName, OMX_INSTANCE_OPTION], {
756
+ stdio: ["ignore", "pipe", "ignore"],
757
+ encoding: "utf-8",
758
+ }).trim();
759
+ }
760
+ catch {
761
+ return null;
762
+ }
763
+ }
764
+ function tmuxPaneBelongsToSession(paneId, sessionName) {
765
+ try {
766
+ const paneSessionName = execTmuxFileSync(["display-message", "-p", "-t", paneId, "#{session_name}"], {
767
+ stdio: ["ignore", "pipe", "ignore"],
768
+ encoding: "utf-8",
769
+ }).trim();
770
+ return paneSessionName === sessionName;
771
+ }
772
+ catch {
773
+ return false;
774
+ }
775
+ }
776
+ function buildDetachedHistoryPruneHookCommand(leaderPaneId) {
777
+ // The leader pane can be gone by the time the hook fires (e.g. crashed
778
+ // leader with a lingering session); suppress errors so tmux does not queue
779
+ // "(null):0: can't find pane" for the next attaching client.
780
+ return `if-shell -F '#{==:#{session_attached},0}' 'run-shell -b "tmux clear-history -t ${leaderPaneId} >/dev/null 2>&1 || true"'`;
781
+ }
782
+ function buildDetachedHistoryPruneHookSlot(sessionName, leaderPaneId) {
783
+ const key = `${sessionName}:${leaderPaneId}:omx-history-prune`;
784
+ let hash = 0;
785
+ for (let i = 0; i < key.length; i++) {
786
+ hash = ((hash << 5) - hash + key.charCodeAt(i)) | 0;
787
+ }
788
+ return `client-detached[${Math.abs(hash) % TMUX_HOOK_INDEX_MAX}]`;
789
+ }
790
+ function hasErrnoCode(error, code) {
791
+ return Boolean(error &&
792
+ typeof error === "object" &&
793
+ "code" in error &&
794
+ error.code === code);
795
+ }
796
+ function isMissingTmuxLaunchNoise(error) {
797
+ return error instanceof Error && /spawnSync tmux ENOENT/i.test(error.message);
798
+ }
799
+ function logCliOperationFailure(error) {
800
+ if (isMissingTmuxLaunchNoise(error))
801
+ return;
802
+ process.stderr.write(`[cli/index] operation failed: ${error}
803
+ `);
804
+ }
805
+ function tmuxFailureMessage(error) {
806
+ if (!error || typeof error !== "object")
807
+ return String(error);
808
+ const err = error;
809
+ const stderr = typeof err.stderr === "string" ? err.stderr : err.stderr?.toString();
810
+ const stdout = typeof err.stdout === "string" ? err.stdout : err.stdout?.toString();
811
+ const detail = (stderr || stdout || err.message || String(error)).trim();
812
+ return detail.replace(/\s+/g, " ");
813
+ }
814
+ function isUnsupportedTmuxExtendedKeysFailure(error) {
815
+ const message = tmuxFailureMessage(error).toLowerCase();
816
+ return (message.includes("extended-keys") &&
817
+ /(?:invalid|unknown|unsupported) (?:option|flag|argument)|no such option|unknown option/.test(message));
818
+ }
819
+ function isBenignMissingTmuxServerMessage(message) {
820
+ return (/no server running/i.test(message) ||
821
+ /error connecting to .*\(No such file or directory\)/i.test(message));
822
+ }
823
+ export function checkDetachedTmuxLaunchHealth() {
824
+ try {
825
+ execTmuxFileSync(["list-sessions"], {
826
+ stdio: ["ignore", "pipe", "pipe"],
827
+ encoding: "utf-8",
828
+ });
829
+ return { usable: true };
830
+ }
831
+ catch (err) {
832
+ const reason = tmuxFailureMessage(err);
833
+ if (isBenignMissingTmuxServerMessage(reason)) {
834
+ return { usable: true };
835
+ }
836
+ return { usable: false, reason };
837
+ }
838
+ }
839
+ function warnDetachedTmuxFallback(reason) {
840
+ const suffix = reason ? ` (${reason})` : "";
841
+ console.warn(`[omx] warning: tmux is installed but its server/socket is unusable${suffix}. Falling back to direct Codex launch.`);
842
+ }
843
+ const QUICK_ATTACH_NOOP_THRESHOLD_MS = 2_000;
844
+ function isWslWindowsTerminalEnvironment(env) {
845
+ return Boolean(env.WT_SESSION?.trim() &&
846
+ (env.WSL_INTEROP?.trim() ||
847
+ env.WSL_DISTRO_NAME?.trim() ||
848
+ env.WSLENV?.trim()));
849
+ }
850
+ function readDetachedSessionAttachedClientCount(sessionName) {
851
+ try {
852
+ const output = execTmuxFileSync(["display-message", "-p", "-t", sessionName, "#{session_attached}"], {
853
+ stdio: ["ignore", "pipe", "pipe"],
854
+ encoding: "utf-8",
855
+ }).trim();
856
+ const parsed = Number.parseInt(output, 10);
857
+ return Number.isFinite(parsed) ? parsed : null;
858
+ }
859
+ catch (err) {
860
+ logCliOperationFailure(err);
861
+ return null;
862
+ }
863
+ }
864
+ function assertDetachedAttachDidNotNoop(sessionName, elapsedMs, env) {
865
+ if (!isWslWindowsTerminalEnvironment(env))
866
+ return;
867
+ if (elapsedMs >= QUICK_ATTACH_NOOP_THRESHOLD_MS)
868
+ return;
869
+ const attachedClients = readDetachedSessionAttachedClientCount(sessionName);
870
+ if (attachedClients === null || attachedClients > 0)
871
+ return;
872
+ throw new Error([
873
+ "tmux attach-session returned immediately without attaching a client",
874
+ `(session=${sessionName}).`,
875
+ "This can happen on WSL2 under Windows Terminal.",
876
+ "Falling back to direct Codex launch.",
877
+ ].join(" "));
878
+ }
879
+ function resolveTmuxAwareLaunchPolicy(explicitLaunchPolicy, nativeWindows) {
880
+ const launchPolicy = resolveCodexLaunchPolicy(process.env, process.platform, undefined, nativeWindows, undefined, undefined, explicitLaunchPolicy);
881
+ if (launchPolicy !== "detached-tmux") {
882
+ return { launchPolicy, effectiveExplicitLaunchPolicy: explicitLaunchPolicy };
883
+ }
884
+ const tmuxHealth = checkDetachedTmuxLaunchHealth();
885
+ if (tmuxHealth.usable) {
886
+ return { launchPolicy, effectiveExplicitLaunchPolicy: explicitLaunchPolicy };
887
+ }
888
+ warnDetachedTmuxFallback(tmuxHealth.reason);
889
+ return { launchPolicy: "direct", effectiveExplicitLaunchPolicy: "direct" };
890
+ }
891
+ export function resolveSignalExitCode(signal) {
892
+ if (!signal)
893
+ return 1;
894
+ const signalNumber = osConstants.signals[signal];
895
+ if (typeof signalNumber === "number" && Number.isFinite(signalNumber)) {
896
+ return 128 + signalNumber;
897
+ }
898
+ return 1;
899
+ }
900
+ export function classifyCodexExecFailure(error) {
901
+ if (!error || typeof error !== "object") {
902
+ return {
903
+ kind: "launch-error",
904
+ message: String(error),
905
+ };
906
+ }
907
+ const err = error;
908
+ const code = typeof err.code === "string" ? err.code : undefined;
909
+ const message = typeof err.message === "string" && err.message.length > 0
910
+ ? err.message
911
+ : "unknown codex launch failure";
912
+ const hasExitStatus = typeof err.status === "number";
913
+ const hasSignal = typeof err.signal === "string" && err.signal.length > 0;
914
+ if (hasExitStatus || hasSignal) {
915
+ return {
916
+ kind: "exit",
917
+ code,
918
+ message,
919
+ exitCode: hasExitStatus
920
+ ? err.status
921
+ : resolveSignalExitCode(err.signal),
922
+ signal: hasSignal ? err.signal : undefined,
923
+ };
924
+ }
925
+ return {
926
+ kind: "launch-error",
927
+ code,
928
+ message,
929
+ };
930
+ }
931
+ export async function resolveLaunchConfigRepairOptions(cwd, configPath) {
932
+ let content;
933
+ const readConfig = async () => {
934
+ if (content !== undefined)
935
+ return content;
936
+ if (!existsSync(configPath))
937
+ return undefined;
938
+ content = await readFile(configPath, "utf-8");
939
+ return content;
940
+ };
941
+ const existingContent = await readConfig();
942
+ const sharedMcpRegistry = existingContent
943
+ ? extractSharedMcpRegistryServersFromConfig(existingContent)
944
+ : { servers: [] };
945
+ const sharedMcpOptions = sharedMcpRegistry.servers.length > 0
946
+ ? {
947
+ sharedMcpServers: sharedMcpRegistry.servers,
948
+ sharedMcpRegistrySource: sharedMcpRegistry.sourcePath,
949
+ }
950
+ : {};
951
+ if (readPersistedSetupPreferences(cwd)?.mcpMode === "compat") {
952
+ return { includeFirstPartyMcp: true, ...sharedMcpOptions };
953
+ }
954
+ if (existingContent) {
955
+ const hasExistingFirstPartyMcp = OMX_FIRST_PARTY_MCP_SERVER_NAMES.some((name) => new RegExp(`^\\s*\\[mcp_servers\\.${name}\\]\\s*$`, "m").test(existingContent));
956
+ if (hasExistingFirstPartyMcp || sharedMcpRegistry.servers.length > 0) {
957
+ return { includeFirstPartyMcp: hasExistingFirstPartyMcp, ...sharedMcpOptions };
958
+ }
959
+ }
960
+ return {
961
+ includeFirstPartyMcp: false,
962
+ };
963
+ }
964
+ function runCodexBlocking(cwd, launchArgs, codexEnv) {
965
+ const { result } = spawnPlatformCommandSync("codex", launchArgs, {
966
+ cwd,
967
+ stdio: "inherit",
968
+ env: codexEnv,
969
+ encoding: "utf-8",
970
+ });
971
+ if (result.error) {
972
+ const errno = result.error;
973
+ const kind = classifySpawnError(errno);
974
+ if (kind === "missing") {
975
+ console.error("[omx] failed to launch codex: executable not found in PATH");
976
+ }
977
+ else if (kind === "blocked") {
978
+ console.error(`[omx] failed to launch codex: executable is present but blocked in the current environment (${errno.code || "blocked"})`);
979
+ }
980
+ else {
981
+ console.error(`[omx] failed to launch codex: ${errno.message}`);
982
+ }
983
+ throw result.error;
984
+ }
985
+ if (result.status !== 0) {
986
+ process.exitCode =
987
+ typeof result.status === "number"
988
+ ? result.status
989
+ : resolveSignalExitCode(result.signal);
990
+ if (result.signal) {
991
+ console.error(`[omx] codex exited due to signal ${result.signal}`);
992
+ }
993
+ else if (typeof result.status === "number") {
994
+ console.error(`[omx] codex exited with code ${result.status}`);
995
+ }
996
+ }
997
+ }
998
+ export function omxRuntimeCommandShimFileName(platform = process.platform) {
999
+ return platform === "win32" ? "omx.cmd" : "omx";
1000
+ }
1001
+ export function omxRuntimeCommandShimPath(cwd, platform = process.platform) {
1002
+ return join(omxRoot(cwd), "runtime", "bin", omxRuntimeCommandShimFileName(platform));
1003
+ }
1004
+ function ensureRuntimeShimDirectory(path) {
1005
+ if (existsSync(path)) {
1006
+ const current = lstatSync(path);
1007
+ if (current.isSymbolicLink()) {
1008
+ throw new Error(`Refusing to create OMX runtime command shim through symlink directory: ${path}`);
1009
+ }
1010
+ if (!current.isDirectory()) {
1011
+ throw new Error(`Refusing to create OMX runtime command shim because path is not a directory: ${path}`);
1012
+ }
1013
+ return;
1014
+ }
1015
+ mkdirSync(path, { mode: 0o700 });
1016
+ }
1017
+ function buildOmxRuntimeCommandShim(nodePath, omxBin, platform = process.platform) {
1018
+ if (platform === "win32") {
1019
+ return [
1020
+ "@echo off",
1021
+ `"${nodePath}" "${omxBin}" %*`,
1022
+ "",
1023
+ ].join("\r\n");
1024
+ }
1025
+ return [
1026
+ "#!/bin/sh",
1027
+ `exec ${quoteShellArg(nodePath)} ${quoteShellArg(omxBin)} "$@"`,
1028
+ "",
1029
+ ].join("\n");
1030
+ }
1031
+ export function ensureOmxRuntimeCommandShim(cwd, omxBin, nodePath = process.execPath, platform = process.platform) {
1032
+ const shimPath = omxRuntimeCommandShimPath(cwd, platform);
1033
+ const shimDir = dirname(shimPath);
1034
+ const rootDir = omxRoot(cwd);
1035
+ const runtimeDir = dirname(shimDir);
1036
+ ensureRuntimeShimDirectory(rootDir);
1037
+ ensureRuntimeShimDirectory(runtimeDir);
1038
+ ensureRuntimeShimDirectory(shimDir);
1039
+ if (existsSync(shimPath)) {
1040
+ const current = lstatSync(shimPath);
1041
+ if (current.isDirectory()) {
1042
+ throw new Error(`Refusing to replace OMX runtime command shim directory: ${shimPath}`);
1043
+ }
1044
+ if (current.isSymbolicLink()) {
1045
+ rmSync(shimPath, { force: true });
1046
+ }
1047
+ }
1048
+ writeFileSync(shimPath, buildOmxRuntimeCommandShim(nodePath, omxBin, platform), {
1049
+ encoding: "utf-8",
1050
+ mode: 0o700,
1051
+ });
1052
+ if (platform !== "win32") {
1053
+ chmodSync(shimPath, 0o700);
1054
+ }
1055
+ return shimDir;
1056
+ }
1057
+ export function prependOmxRuntimeCommandShimToEnv(cwd, env, omxBin, nodePath = process.execPath, platform = process.platform) {
1058
+ const shimDir = ensureOmxRuntimeCommandShim(cwd, omxBin, nodePath, platform);
1059
+ const pathDelimiter = platform === "win32" ? win32.delimiter : posix.delimiter;
1060
+ const result = { ...env };
1061
+ if (platform === "win32") {
1062
+ // Windows env var names are case-insensitive; the inherited key is usually
1063
+ // `Path`, not `PATH`. Find every case variant, preserve the existing value,
1064
+ // prepend the shim directory, and collapse to a single key so the child does
1065
+ // not see an empty `PATH` shadowing the real `Path` (which drops System32,
1066
+ // WindowsPowerShell, etc.).
1067
+ const pathVariants = Object.keys(result).filter((key) => key.toLowerCase() === "path");
1068
+ let pathKey = "Path";
1069
+ let currentPath = "";
1070
+ for (const variant of pathVariants) {
1071
+ const value = result[variant];
1072
+ if (typeof value === "string" && value.length > 0) {
1073
+ pathKey = variant;
1074
+ currentPath = value;
1075
+ break;
1076
+ }
1077
+ }
1078
+ for (const variant of pathVariants) {
1079
+ delete result[variant];
1080
+ }
1081
+ result[pathKey] = currentPath
1082
+ ? `${shimDir}${pathDelimiter}${currentPath}`
1083
+ : shimDir;
1084
+ }
1085
+ else {
1086
+ const currentPath = typeof result.PATH === "string" ? result.PATH : "";
1087
+ result.PATH = currentPath ? `${shimDir}${pathDelimiter}${currentPath}` : shimDir;
1088
+ }
1089
+ result.OMX_ENTRY_PATH = omxBin;
1090
+ result.OMX_STARTUP_CWD =
1091
+ typeof result.OMX_STARTUP_CWD === "string" && result.OMX_STARTUP_CWD.trim()
1092
+ ? result.OMX_STARTUP_CWD
1093
+ : cwd;
1094
+ return result;
1095
+ }
1096
+ export function buildHudPaneCleanupTargets(existingPaneIds, createdPaneId, leaderPaneId) {
1097
+ const targets = new Set(existingPaneIds.filter((id) => id.startsWith("%")));
1098
+ if (createdPaneId && createdPaneId.startsWith("%")) {
1099
+ targets.add(createdPaneId);
1100
+ }
1101
+ // Guard: never kill the leader's own pane under any circumstances.
1102
+ if (leaderPaneId && leaderPaneId.startsWith("%")) {
1103
+ targets.delete(leaderPaneId);
1104
+ }
1105
+ return [...targets];
1106
+ }
1107
+ function isCrossPlatformAbsolutePath(raw) {
1108
+ return posix.isAbsolute(raw) || win32.isAbsolute(raw);
1109
+ }
1110
+ export function resolveOmxRootForLaunch(cwd, env = process.env) {
1111
+ const raw = env.OMX_ROOT || env.OMX_STATE_ROOT;
1112
+ if (typeof raw !== "string" || raw.trim() === "")
1113
+ return undefined;
1114
+ return isCrossPlatformAbsolutePath(raw) ? raw : join(cwd, raw);
1115
+ }
1116
+ function resolveLaunchPath(cwd, raw) {
1117
+ return isCrossPlatformAbsolutePath(raw) ? raw : join(cwd, raw);
1118
+ }
1119
+ function resolveHudRuntimeRootSource(omxRootOverride, env = process.env) {
1120
+ if (env.OMX_TEAM_STATE_ROOT?.trim())
1121
+ return 'team-env';
1122
+ if (env.OMX_ROOT?.trim() || omxRootOverride)
1123
+ return 'omx-root-env';
1124
+ if (env.OMX_STATE_ROOT?.trim())
1125
+ return 'omx-state-root-env';
1126
+ return 'cwd-default';
1127
+ }
1128
+ export function resolveHudRuntimeRootForLaunch(cwd, env = process.env) {
1129
+ const omxTeamStateRoot = env.OMX_TEAM_STATE_ROOT?.trim();
1130
+ if (omxTeamStateRoot) {
1131
+ return {
1132
+ omxTeamStateRoot: resolveLaunchPath(cwd, omxTeamStateRoot),
1133
+ rootSource: 'team-env',
1134
+ };
1135
+ }
1136
+ const omxRoot = env.OMX_ROOT?.trim();
1137
+ if (omxRoot) {
1138
+ return {
1139
+ omxRoot: resolveLaunchPath(cwd, omxRoot),
1140
+ rootSource: 'omx-root-env',
1141
+ };
1142
+ }
1143
+ const omxStateRoot = env.OMX_STATE_ROOT?.trim();
1144
+ if (omxStateRoot) {
1145
+ return {
1146
+ omxStateRoot: resolveLaunchPath(cwd, omxStateRoot),
1147
+ rootSource: 'omx-state-root-env',
1148
+ };
1149
+ }
1150
+ return { rootSource: 'cwd-default' };
1151
+ }
1152
+ function hasExplicitOmxRootEnv(env = process.env) {
1153
+ return [env.OMX_ROOT, env.OMX_STATE_ROOT].some((value) => typeof value === "string" && value.trim() !== "");
1154
+ }
1155
+ export function resolveDisposableWorktreeOmxRootForLaunch(ensuredWorktree, env = process.env) {
1156
+ if (!ensuredWorktree?.enabled)
1157
+ return undefined;
1158
+ if (hasExplicitOmxRootEnv(env))
1159
+ return undefined;
1160
+ return ensuredWorktree.repoRoot;
1161
+ }
1162
+ function applyDisposableWorktreeOmxRootForLaunch(ensuredWorktree, env = process.env) {
1163
+ const omxRootOverride = resolveDisposableWorktreeOmxRootForLaunch(ensuredWorktree, env);
1164
+ if (!omxRootOverride)
1165
+ return;
1166
+ env.OMX_ROOT = omxRootOverride;
1167
+ }
1168
+ export function shouldAutoIsolateMadmaxLaunch(command, launchArgs, env = process.env) {
1169
+ if (command !== "launch" && command !== "exec")
1170
+ return false;
1171
+ if (env.OMX_NO_BOX === "1" || env.OMXBOX_ACTIVE === "1")
1172
+ return false;
1173
+ if (env.OMX_ROOT || env.OMX_STATE_ROOT)
1174
+ return false;
1175
+ return launchArgs.some((arg) => arg === MADMAX_FLAG || arg === MADMAX_SPARK_FLAG);
1176
+ }
1177
+ function sanitizeRunIdSegment(value) {
1178
+ return value.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
1179
+ }
1180
+ const MADMAX_DETACHED_ACTIVE_DIR = "active-detached";
1181
+ const MADMAX_DETACHED_LOCK_STALE_MS = 30_000;
1182
+ const MADMAX_DETACHED_LOCK_RETRY_MS = 50;
1183
+ const MADMAX_DETACHED_LOCK_MAX_ATTEMPTS = 100;
1184
+ const OMX_MADMAX_DETACHED_CONTEXT_ENV = "OMX_MADMAX_DETACHED_CONTEXT";
1185
+ function resolveMadmaxRunsRoot(env = process.env) {
1186
+ return env.OMX_RUNS_DIR || join(homedir(), ".omx-runs");
1187
+ }
1188
+ function canonicalizeLaunchCwd(cwd) {
1189
+ try {
1190
+ return execFileSync("git", ["rev-parse", "--show-toplevel"], {
1191
+ cwd,
1192
+ encoding: "utf-8",
1193
+ stdio: ["ignore", "pipe", "ignore"],
1194
+ }).trim() || cwd;
1195
+ }
1196
+ catch {
1197
+ return cwd;
1198
+ }
1199
+ }
1200
+ function normalizeMadmaxDetachedLaunchArgv(argv) {
1201
+ const passthrough = [];
1202
+ const semanticFlags = new Set();
1203
+ let reasoningFlag = null;
1204
+ let afterEndOfOptions = false;
1205
+ for (const arg of argv) {
1206
+ if (afterEndOfOptions) {
1207
+ passthrough.push(arg);
1208
+ continue;
1209
+ }
1210
+ if (arg === "--") {
1211
+ afterEndOfOptions = true;
1212
+ passthrough.push(arg);
1213
+ continue;
1214
+ }
1215
+ if (arg === "--tmux" || arg === "--direct") {
1216
+ continue;
1217
+ }
1218
+ if (arg === MADMAX_FLAG ||
1219
+ arg === MADMAX_SPARK_FLAG) {
1220
+ semanticFlags.add(arg);
1221
+ continue;
1222
+ }
1223
+ if (arg === HIGH_REASONING_FLAG || arg === XHIGH_REASONING_FLAG) {
1224
+ reasoningFlag = arg;
1225
+ continue;
1226
+ }
1227
+ passthrough.push(arg);
1228
+ }
1229
+ return [
1230
+ ...Array.from(semanticFlags).sort(),
1231
+ ...(reasoningFlag ? [reasoningFlag] : []),
1232
+ ...passthrough,
1233
+ ];
1234
+ }
1235
+ export function buildMadmaxDetachedLaunchContextKey(sourceCwd, argv, runIdentity = "") {
1236
+ // The boxed run root is part of the lock identity for auto-isolated madmax
1237
+ // launches. That lets independent `omx --madmax --high` sessions share the
1238
+ // same source cwd/argv without contending on one active-detached lock, while
1239
+ // callers that intentionally reuse the same boxed context keep one key.
1240
+ const payload = JSON.stringify({
1241
+ source_cwd: canonicalizeLaunchCwd(sourceCwd),
1242
+ argv: normalizeMadmaxDetachedLaunchArgv(argv),
1243
+ run_identity: runIdentity,
1244
+ });
1245
+ return createHash("sha256").update(payload).digest("hex").slice(0, 32);
1246
+ }
1247
+ function madmaxDetachedActiveRecordPath(runsRoot, contextKey) {
1248
+ return join(runsRoot, MADMAX_DETACHED_ACTIVE_DIR, `${contextKey}.json`);
1249
+ }
1250
+ function readMadmaxDetachedActiveRecord(recordPath) {
1251
+ if (!existsSync(recordPath))
1252
+ return null;
1253
+ try {
1254
+ const parsed = JSON.parse(readFileSync(recordPath, "utf-8"));
1255
+ if (parsed.version !== 1 ||
1256
+ typeof parsed.context_key !== "string" ||
1257
+ typeof parsed.source_cwd !== "string" ||
1258
+ typeof parsed.run_dir !== "string" ||
1259
+ typeof parsed.tmux_session_name !== "string" ||
1260
+ !Array.isArray(parsed.argv) ||
1261
+ !parsed.argv.every((arg) => typeof arg === "string")) {
1262
+ return null;
1263
+ }
1264
+ return {
1265
+ version: 1,
1266
+ context_key: parsed.context_key,
1267
+ created_at: typeof parsed.created_at === "string" ? parsed.created_at : "",
1268
+ source_cwd: parsed.source_cwd,
1269
+ argv: [...parsed.argv],
1270
+ run_dir: parsed.run_dir,
1271
+ tmux_session_name: parsed.tmux_session_name,
1272
+ ...(typeof parsed.session_id === "string" ? { session_id: parsed.session_id } : {}),
1273
+ ...(typeof parsed.tmux_pane_id === "string" ? { tmux_pane_id: parsed.tmux_pane_id } : {}),
1274
+ };
1275
+ }
1276
+ catch {
1277
+ return null;
1278
+ }
1279
+ }
1280
+ function isReusableMadmaxDetachedActiveRecord(record) {
1281
+ if (!detachedTmuxSessionExists(record.tmux_session_name))
1282
+ return false;
1283
+ if (!record.session_id || !record.tmux_pane_id)
1284
+ return false;
1285
+ if (readTmuxSessionInstanceId(record.tmux_session_name) !== record.session_id) {
1286
+ return false;
1287
+ }
1288
+ return tmuxPaneBelongsToSession(record.tmux_pane_id, record.tmux_session_name);
1289
+ }
1290
+ function detachedTmuxSessionExists(sessionName) {
1291
+ try {
1292
+ execTmuxFileSync(["has-session", "-t", sessionName], { stdio: "ignore" });
1293
+ return true;
1294
+ }
1295
+ catch {
1296
+ return false;
1297
+ }
1298
+ }
1299
+ function readMadmaxDetachedLockOwner(lockPath) {
1300
+ try {
1301
+ const parsed = JSON.parse(readFileSync(join(lockPath, "owner.json"), "utf-8"));
1302
+ if (parsed.version !== 1 ||
1303
+ typeof parsed.pid !== "number" ||
1304
+ !Number.isSafeInteger(parsed.pid) ||
1305
+ parsed.pid <= 0 ||
1306
+ typeof parsed.context_key !== "string" ||
1307
+ typeof parsed.acquired_at !== "string") {
1308
+ return null;
1309
+ }
1310
+ return {
1311
+ version: 1,
1312
+ pid: parsed.pid,
1313
+ context_key: parsed.context_key,
1314
+ acquired_at: parsed.acquired_at,
1315
+ };
1316
+ }
1317
+ catch {
1318
+ return null;
1319
+ }
1320
+ }
1321
+ function readMadmaxDetachedLockPid(lockPath) {
1322
+ const owner = readMadmaxDetachedLockOwner(lockPath);
1323
+ if (owner)
1324
+ return owner.pid;
1325
+ try {
1326
+ const holderPid = Number.parseInt(readFileSync(join(lockPath, "pid"), "utf-8").trim(), 10);
1327
+ return Number.isSafeInteger(holderPid) && holderPid > 0 ? holderPid : null;
1328
+ }
1329
+ catch {
1330
+ return null;
1331
+ }
1332
+ }
1333
+ function inspectMadmaxDetachedContextLock(lockPath) {
1334
+ const lockStat = statSync(lockPath, { throwIfNoEntry: false });
1335
+ if (!lockStat) {
1336
+ return { stale: false, diagnostic: "lock disappeared while waiting" };
1337
+ }
1338
+ const ageMs = Math.max(0, Date.now() - lockStat.mtimeMs);
1339
+ const owner = readMadmaxDetachedLockOwner(lockPath);
1340
+ const holderPid = owner?.pid ?? readMadmaxDetachedLockPid(lockPath);
1341
+ if (holderPid) {
1342
+ if (!isProcessAlive(holderPid)) {
1343
+ return {
1344
+ stale: true,
1345
+ diagnostic: `stale holder pid ${holderPid} is not running; lock age ${Math.round(ageMs)}ms`,
1346
+ };
1347
+ }
1348
+ const ownerContext = owner ? `, owner context ${owner.context_key}` : ", legacy pid-only lock";
1349
+ const sameDirectoryGuidance = "Another madmax detached launch is active for this directory; close the existing madmax session or use --worktree for concurrent work. Multiple madmax sessions in one directory are unsafe";
1350
+ return {
1351
+ stale: false,
1352
+ diagnostic: `holder pid ${holderPid} is still running${ownerContext}; lock age ${Math.round(ageMs)}ms. ${sameDirectoryGuidance}`,
1353
+ };
1354
+ }
1355
+ if (ageMs > MADMAX_DETACHED_LOCK_STALE_MS) {
1356
+ return {
1357
+ stale: true,
1358
+ diagnostic: `legacy lock has no readable owner pid and is older than ${MADMAX_DETACHED_LOCK_STALE_MS}ms; lock age ${Math.round(ageMs)}ms`,
1359
+ };
1360
+ }
1361
+ return {
1362
+ stale: false,
1363
+ diagnostic: `lock has no readable owner pid yet; lock age ${Math.round(ageMs)}ms`,
1364
+ };
1365
+ }
1366
+ export function withMadmaxDetachedContextLock(runsRoot, contextKey, run, options = {}) {
1367
+ const lockPath = join(runsRoot, MADMAX_DETACHED_ACTIVE_DIR, `${contextKey}.lock`);
1368
+ const maxAttempts = options.maxAttempts ?? MADMAX_DETACHED_LOCK_MAX_ATTEMPTS;
1369
+ const retryMs = options.retryMs ?? MADMAX_DETACHED_LOCK_RETRY_MS;
1370
+ let lastDiagnostic = "lock was busy";
1371
+ mkdirSync(dirname(lockPath), { recursive: true });
1372
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
1373
+ try {
1374
+ mkdirSync(lockPath);
1375
+ try {
1376
+ const owner = {
1377
+ version: 1,
1378
+ pid: process.pid,
1379
+ context_key: contextKey,
1380
+ acquired_at: new Date().toISOString(),
1381
+ };
1382
+ writeFileSync(join(lockPath, "owner.json"), `${JSON.stringify(owner, null, 2)}\n`, { mode: 0o600 });
1383
+ writeFileSync(join(lockPath, "pid"), String(process.pid));
1384
+ return run();
1385
+ }
1386
+ finally {
1387
+ rmSync(lockPath, { recursive: true, force: true });
1388
+ }
1389
+ }
1390
+ catch (err) {
1391
+ const code = err && typeof err === "object" && "code" in err
1392
+ ? String(err.code)
1393
+ : "";
1394
+ if (code !== "EEXIST")
1395
+ throw err;
1396
+ const inspection = inspectMadmaxDetachedContextLock(lockPath);
1397
+ lastDiagnostic = inspection.diagnostic;
1398
+ if (inspection.stale) {
1399
+ rmSync(lockPath, { recursive: true, force: true });
1400
+ continue;
1401
+ }
1402
+ blockMs(retryMs);
1403
+ }
1404
+ }
1405
+ throw new MadmaxDetachedGuardError(`timed out waiting for madmax detached launch context lock: ${lockPath} (${lastDiagnostic})`);
1406
+ }
1407
+ function isMadmaxDetachedGuardEnabled(env) {
1408
+ return env.OMXBOX_ACTIVE === "1" && typeof env[OMX_MADMAX_DETACHED_CONTEXT_ENV] === "string";
1409
+ }
1410
+ function cleanupCurrentMadmaxReuseRunRoot(env, runsRoot) {
1411
+ const runRoot = env.OMX_ROOT;
1412
+ if (!runRoot || !env.OMXBOX_ACTIVE)
1413
+ return;
1414
+ const normalizedRunsRoot = runsRoot.endsWith("/") ? runsRoot : `${runsRoot}/`;
1415
+ if (runRoot !== runsRoot && !runRoot.startsWith(normalizedRunsRoot))
1416
+ return;
1417
+ rmSync(runRoot, { recursive: true, force: true });
1418
+ }
1419
+ function writeMadmaxDetachedActiveRecord(recordPath, record) {
1420
+ mkdirSync(dirname(recordPath), { recursive: true });
1421
+ writeFileSync(recordPath, `${JSON.stringify(record, null, 2)}\n`, { mode: 0o600 });
1422
+ }
1423
+ class MadmaxDetachedReuseError extends Error {
1424
+ failClosed = true;
1425
+ }
1426
+ class MadmaxDetachedGuardError extends Error {
1427
+ failClosed = true;
1428
+ }
1429
+ export function createMadmaxIsolatedRoot(sourceCwd, argv, env = process.env) {
1430
+ const runsRoot = resolveMadmaxRunsRoot(env);
1431
+ mkdirSync(runsRoot, { recursive: true });
1432
+ const stamp = new Date().toISOString().replace(/[-:TZ.]/g, "").slice(0, 14);
1433
+ const suffix = Math.random().toString(16).slice(2, 6);
1434
+ const runDir = join(runsRoot, sanitizeRunIdSegment(`run-${stamp}-${suffix}`));
1435
+ mkdirSync(runDir, { recursive: false });
1436
+ const detachedLaunchContext = buildMadmaxDetachedLaunchContextKey(sourceCwd, argv, runDir);
1437
+ const metadata = {
1438
+ launcher: "omx --madmax",
1439
+ created_at: new Date().toISOString(),
1440
+ cwd: runDir,
1441
+ source_cwd: sourceCwd,
1442
+ argv,
1443
+ detached_launch_context: detachedLaunchContext,
1444
+ };
1445
+ writeFileSync(join(runDir, ".omxbox-run.json"), `${JSON.stringify(metadata, null, 2)}\n`);
1446
+ writeFileSync(join(runsRoot, "registry.jsonl"), `${JSON.stringify(metadata)}\n`, { flag: "a" });
1447
+ env[OMX_MADMAX_DETACHED_CONTEXT_ENV] = detachedLaunchContext;
1448
+ return runDir;
1449
+ }
1450
+ function activateMadmaxIsolationIfNeeded(command, launchArgs, cwd, env = process.env) {
1451
+ if (!shouldAutoIsolateMadmaxLaunch(command, launchArgs, env))
1452
+ return;
1453
+ const runDir = createMadmaxIsolatedRoot(cwd, launchArgs, env);
1454
+ env.OMX_ROOT = runDir;
1455
+ env.OMXBOX_ACTIVE = "1";
1456
+ env.OMX_SOURCE_CWD = cwd;
1457
+ process.stderr.write(`[omx] madmax isolated state: ${runDir} (source: ${cwd})\n`);
1458
+ }
1459
+ export async function main(args) {
1460
+ const knownCommands = new Set([
1461
+ "launch",
1462
+ "exec",
1463
+ "imagegen",
1464
+ "setup",
1465
+ "update",
1466
+ "list",
1467
+ "agents",
1468
+ "agents-init",
1469
+ "deepinit",
1470
+ "uninstall",
1471
+ "doctor",
1472
+ "cleanup",
1473
+ "auth",
1474
+ "ask",
1475
+ "question",
1476
+ "autoresearch",
1477
+ "autoresearch-goal",
1478
+ "explore",
1479
+ "api",
1480
+ "sparkshell",
1481
+ "team",
1482
+ "ralph",
1483
+ "ultragoal",
1484
+ "performance-goal",
1485
+ "session",
1486
+ "resume",
1487
+ "version",
1488
+ "tmux-hook",
1489
+ "hooks",
1490
+ "hud",
1491
+ "sidecar",
1492
+ "state",
1493
+ "mcp-serve",
1494
+ "status",
1495
+ "cancel",
1496
+ "help",
1497
+ "--help",
1498
+ "-h",
1499
+ ]);
1500
+ const firstArg = args[0];
1501
+ const { command, launchArgs } = resolveCliInvocation(args);
1502
+ const flags = new Set(args.filter((a) => a.startsWith("--")));
1503
+ const options = {
1504
+ force: flags.has("--force"),
1505
+ mergeAgents: flags.has("--merge-agents"),
1506
+ dryRun: flags.has("--dry-run"),
1507
+ verbose: flags.has("--verbose"),
1508
+ team: flags.has("--team"),
1509
+ };
1510
+ if (flags.has("--help") && !commandOwnsLocalHelp(command)) {
1511
+ console.log(HELP);
1512
+ return;
1513
+ }
1514
+ activateMadmaxIsolationIfNeeded(command, launchArgs, process.cwd(), process.env);
1515
+ try {
1516
+ switch (command) {
1517
+ case "launch":
1518
+ if (launchArgs.includes("--hotswap")) {
1519
+ await launchWithAuthHotswap(launchArgs);
1520
+ }
1521
+ else {
1522
+ await launchWithHud(launchArgs);
1523
+ }
1524
+ break;
1525
+ case "resume":
1526
+ await launchWithHud(["resume", ...launchArgs]);
1527
+ break;
1528
+ case "setup":
1529
+ await setup({
1530
+ force: options.force,
1531
+ mergeAgents: options.mergeAgents,
1532
+ dryRun: options.dryRun,
1533
+ verbose: options.verbose,
1534
+ scope: resolveSetupScopeArg(args.slice(1)),
1535
+ installMode: resolveSetupInstallModeArg(args.slice(1)),
1536
+ mcpMode: resolveSetupMcpModeArg(args.slice(1)),
1537
+ teamMode: resolveSetupTeamModeArg(args.slice(1)),
1538
+ });
1539
+ break;
1540
+ case "update":
1541
+ await runImmediateUpdate(process.cwd(), {}, { channel: resolveUpdateChannelArg(args.slice(1)) });
1542
+ break;
1543
+ case "list":
1544
+ await listCommand(args.slice(1));
1545
+ break;
1546
+ case "agents":
1547
+ await agentsCommand(args.slice(1));
1548
+ break;
1549
+ case "agents-init":
1550
+ await agentsInitCommand(args.slice(1));
1551
+ break;
1552
+ case "deepinit":
1553
+ await agentsInitCommand(args.slice(1));
1554
+ break;
1555
+ case "uninstall":
1556
+ await uninstall({
1557
+ dryRun: options.dryRun,
1558
+ keepConfig: flags.has("--keep-config"),
1559
+ verbose: options.verbose,
1560
+ purge: flags.has("--purge"),
1561
+ scope: resolveSetupScopeArg(args.slice(1)),
1562
+ });
1563
+ break;
1564
+ case "doctor": {
1565
+ const { doctor } = await import("./doctor.js");
1566
+ await doctor(options);
1567
+ break;
1568
+ }
1569
+ case "ask":
1570
+ await askCommand(args.slice(1));
1571
+ break;
1572
+ case "question":
1573
+ await questionCommand(args.slice(1));
1574
+ break;
1575
+ case "adapt":
1576
+ await adaptCommand(args.slice(1));
1577
+ break;
1578
+ case "cleanup":
1579
+ await cleanupCommand(args.slice(1));
1580
+ break;
1581
+ case "auth":
1582
+ await authCommand(args.slice(1));
1583
+ break;
1584
+ case "autoresearch":
1585
+ await autoresearchCommand(args.slice(1));
1586
+ break;
1587
+ case "autoresearch-goal":
1588
+ await autoresearchGoalCommand(args.slice(1));
1589
+ break;
1590
+ case "explore":
1591
+ await exploreCommand(args.slice(1));
1592
+ break;
1593
+ case "api":
1594
+ await apiCommand(args.slice(1));
1595
+ break;
1596
+ case "exec":
1597
+ if (launchArgs[0] === "inject") {
1598
+ await execInjectCommand(launchArgs);
1599
+ }
1600
+ else {
1601
+ await execWithOverlay(launchArgs);
1602
+ }
1603
+ break;
1604
+ case "imagegen":
1605
+ await imagegenCommand(args.slice(1));
1606
+ break;
1607
+ case "sparkshell":
1608
+ await sparkshellCommand(args.slice(1));
1609
+ break;
1610
+ case "team":
1611
+ await teamCommand(args.slice(1), options);
1612
+ break;
1613
+ case "session":
1614
+ await sessionCommand(args.slice(1));
1615
+ break;
1616
+ case "ralph":
1617
+ await ralphCommand(args.slice(1));
1618
+ break;
1619
+ case "ultragoal":
1620
+ await ultragoalCommand(args.slice(1));
1621
+ break;
1622
+ case "performance-goal":
1623
+ await performanceGoalCommand(args.slice(1));
1624
+ break;
1625
+ case "version":
1626
+ version();
1627
+ break;
1628
+ case "hud":
1629
+ await hudCommand(args.slice(1));
1630
+ break;
1631
+ case "sidecar":
1632
+ await sidecarCommand(args.slice(1));
1633
+ break;
1634
+ case "state":
1635
+ await stateCommand(args.slice(1));
1636
+ break;
1637
+ case "notepad":
1638
+ await mcpParityCommand("notepad", args.slice(1));
1639
+ break;
1640
+ case "project-memory":
1641
+ await mcpParityCommand("project-memory", args.slice(1));
1642
+ break;
1643
+ case "trace":
1644
+ await mcpParityCommand("trace", args.slice(1));
1645
+ break;
1646
+ case "code-intel":
1647
+ await mcpParityCommand("code-intel", args.slice(1));
1648
+ break;
1649
+ case "wiki":
1650
+ await mcpParityCommand("wiki", args.slice(1));
1651
+ break;
1652
+ case "mcp-serve":
1653
+ await mcpServeCommand(args.slice(1));
1654
+ break;
1655
+ case "tmux-hook":
1656
+ await tmuxHookCommand(args.slice(1));
1657
+ break;
1658
+ case "hooks":
1659
+ await hooksCommand(args.slice(1));
1660
+ break;
1661
+ case "status":
1662
+ await showStatus();
1663
+ break;
1664
+ case "cancel":
1665
+ await cancelModes();
1666
+ break;
1667
+ case "reasoning":
1668
+ await reasoningCommand(args.slice(1));
1669
+ break;
1670
+ case "codex-native-hook": {
1671
+ const { runCodexNativeHookCli } = await import("../scripts/codex-native-hook.js");
1672
+ await runCodexNativeHookCli();
1673
+ break;
1674
+ }
1675
+ case "help":
1676
+ case "--help":
1677
+ case "-h":
1678
+ console.log(HELP);
1679
+ break;
1680
+ default:
1681
+ if (firstArg &&
1682
+ firstArg.startsWith("-") &&
1683
+ !knownCommands.has(firstArg)) {
1684
+ await launchWithHud(args);
1685
+ break;
1686
+ }
1687
+ console.error(`Unknown command: ${command}`);
1688
+ console.log(HELP);
1689
+ process.exit(1);
1690
+ }
1691
+ }
1692
+ catch (err) {
1693
+ console.error(`Error: ${err instanceof Error ? err.message : err}`);
1694
+ process.exit(1);
1695
+ }
1696
+ }
1697
+ async function showStatus() {
1698
+ const { readFile } = await import("fs/promises");
1699
+ const cwd = process.cwd();
1700
+ try {
1701
+ let refs = await listModeStateFilesWithScopePreference(cwd);
1702
+ // Reconcile with hook-visible run-dir state when the worktree-scoped state
1703
+ // list reports no active workflow mode (parity with `omx cancel`). This
1704
+ // surfaces detached/madmax sessions whose state lives under the run dir.
1705
+ const hasActiveWorkflowMode = async (candidate) => {
1706
+ for (const ref of candidate) {
1707
+ const mode = basename(ref.path).replace("-state.json", "");
1708
+ if (mode === SKILL_ACTIVE_STATE_MODE)
1709
+ continue;
1710
+ try {
1711
+ const parsed = JSON.parse(await readFile(ref.path, "utf-8"));
1712
+ if (parsed.active === true)
1713
+ return true;
1714
+ }
1715
+ catch {
1716
+ continue;
1717
+ }
1718
+ }
1719
+ return false;
1720
+ };
1721
+ if (!(await hasActiveWorkflowMode(refs))) {
1722
+ const runDirRefs = await listHookVisibleRunDirStateRefs(cwd);
1723
+ if (await hasActiveWorkflowMode(runDirRefs))
1724
+ refs = runDirRefs;
1725
+ }
1726
+ const states = refs.map((ref) => ref.path);
1727
+ const ultragoalState = await readUltragoalState(cwd).catch(() => null);
1728
+ if (states.length === 0) {
1729
+ if (ultragoalState?.active) {
1730
+ console.log(`ultragoal: ACTIVE (phase: ${ultragoalState.status})`);
1731
+ return;
1732
+ }
1733
+ console.log("No active modes.");
1734
+ return;
1735
+ }
1736
+ for (const path of states) {
1737
+ const content = await readFile(path, "utf-8");
1738
+ let state;
1739
+ try {
1740
+ state = JSON.parse(content);
1741
+ }
1742
+ catch (err) {
1743
+ logCliOperationFailure(err);
1744
+ continue;
1745
+ }
1746
+ const file = basename(path);
1747
+ const mode = file.replace("-state.json", "");
1748
+ if (mode === "ultragoal" && ultragoalState?.active)
1749
+ continue;
1750
+ console.log(`${mode}: ${state.active === true ? "ACTIVE" : "inactive"} (phase: ${String(state.current_phase || "n/a")})`);
1751
+ }
1752
+ if (ultragoalState?.active) {
1753
+ console.log(`ultragoal: ACTIVE (phase: ${ultragoalState.status})`);
1754
+ }
1755
+ }
1756
+ catch (err) {
1757
+ logCliOperationFailure(err);
1758
+ console.log("No active modes.");
1759
+ }
1760
+ }
1761
+ async function reasoningCommand(args) {
1762
+ const mode = args[0];
1763
+ const configPath = codexConfigPath();
1764
+ if (!mode) {
1765
+ if (!existsSync(configPath)) {
1766
+ console.log(`model_reasoning_effort is not set (${configPath} does not exist).`);
1767
+ console.log(REASONING_USAGE);
1768
+ return;
1769
+ }
1770
+ const { readFile } = await import("fs/promises");
1771
+ const content = await readFile(configPath, "utf-8");
1772
+ const current = readTopLevelTomlString(content, REASONING_KEY);
1773
+ if (current) {
1774
+ console.log(`Current ${REASONING_KEY}: ${current}`);
1775
+ return;
1776
+ }
1777
+ console.log(`${REASONING_KEY} is not set in ${configPath}.`);
1778
+ console.log(REASONING_USAGE);
1779
+ return;
1780
+ }
1781
+ if (!REASONING_MODE_SET.has(mode)) {
1782
+ throw new Error(`Invalid reasoning mode "${mode}". Expected one of: ${REASONING_MODES.join(", ")}.\n${REASONING_USAGE}`);
1783
+ }
1784
+ const { mkdir, readFile, writeFile } = await import("fs/promises");
1785
+ await mkdir(dirname(configPath), { recursive: true });
1786
+ const existing = existsSync(configPath)
1787
+ ? await readFile(configPath, "utf-8")
1788
+ : "";
1789
+ const updated = upsertTopLevelTomlString(existing, REASONING_KEY, mode);
1790
+ await writeFile(configPath, updated);
1791
+ console.log(`Set ${REASONING_KEY}="${mode}" in ${configPath}`);
1792
+ }
1793
+ export async function launchWithAuthHotswap(args) {
1794
+ const launchCwd = process.cwd();
1795
+ const parsedWorktree = parseWorktreeMode(args);
1796
+ let cwd = launchCwd;
1797
+ let worktreeDirty = false;
1798
+ let ensuredLaunchWorktree;
1799
+ if (parsedWorktree.mode.enabled) {
1800
+ const planned = planWorktreeTarget({
1801
+ cwd: launchCwd,
1802
+ scope: "launch",
1803
+ mode: parsedWorktree.mode,
1804
+ });
1805
+ const ensured = ensureWorktree(planned, { allowDirtyReuse: true });
1806
+ ensuredLaunchWorktree = ensured;
1807
+ if (ensured.enabled) {
1808
+ cwd = ensured.worktreePath;
1809
+ worktreeDirty = Boolean(ensured.dirty);
1810
+ if (ensured.dirty) {
1811
+ process.stderr.write(`[omx] Caution: worktree at ${cwd} has uncommitted changes.\n` +
1812
+ ` The hotswap session will launch as-is.\n`);
1813
+ }
1814
+ const depBootstrap = ensureReusableNodeModules(cwd);
1815
+ if (depBootstrap.strategy === "symlink") {
1816
+ console.log(`[omx] Reusing node_modules from ${depBootstrap.sourceNodeModulesPath}`);
1817
+ }
1818
+ else if (depBootstrap.strategy === "missing" && depBootstrap.warning) {
1819
+ console.warn(`[omx] ${depBootstrap.warning}`);
1820
+ }
1821
+ }
1822
+ }
1823
+ applyDisposableWorktreeOmxRootForLaunch(ensuredLaunchWorktree);
1824
+ try {
1825
+ await maybeCheckAndPromptUpdate(cwd);
1826
+ }
1827
+ catch (err) {
1828
+ logCliOperationFailure(err);
1829
+ }
1830
+ try {
1831
+ await maybePromptGithubStar();
1832
+ }
1833
+ catch (err) {
1834
+ logCliOperationFailure(err);
1835
+ }
1836
+ try {
1837
+ const configPath = resolveCodexConfigPathForLaunch(launchCwd, process.env);
1838
+ const repaired = await repairConfigIfNeeded(configPath, getPackageRoot(), await resolveLaunchConfigRepairOptions(launchCwd, configPath));
1839
+ if (repaired)
1840
+ console.log("[omx] Repaired managed config.toml compatibility issue.");
1841
+ }
1842
+ catch {
1843
+ // Non-fatal: repair failure must not block launch
1844
+ }
1845
+ const status = await runAuthHotswap({
1846
+ cwd,
1847
+ argv: parsedWorktree.remainingArgs,
1848
+ lifecycle: {
1849
+ prepareCodexHomeForLaunch,
1850
+ preLaunch: (launchPath, sessionId, notifyTempContract, codexHomeOverride, enableAuthority) => preLaunch(launchPath, sessionId, notifyTempContract, codexHomeOverride, enableAuthority, worktreeDirty),
1851
+ postLaunch,
1852
+ cleanupRuntimeCodexHome,
1853
+ normalizeCodexLaunchArgs,
1854
+ injectModelInstructionsBypassArgs,
1855
+ sessionModelInstructionsPath,
1856
+ resolveOmxRootForLaunch,
1857
+ resolveNotifyTempContract,
1858
+ },
1859
+ });
1860
+ process.exitCode = status;
1861
+ }
1862
+ export async function launchWithHud(args) {
1863
+ if (isNativeWindows()) {
1864
+ const { result } = spawnPlatformCommandSync("tmux", ["-V"], {
1865
+ encoding: "utf-8",
1866
+ stdio: ["pipe", "pipe", "pipe"],
1867
+ });
1868
+ if (result.error) {
1869
+ const errno = result.error;
1870
+ const kind = classifySpawnError(errno);
1871
+ if (kind === "missing") {
1872
+ console.warn("[omx] warning: tmux was not found on native Windows. Continuing without tmux/HUD.\n" +
1873
+ "[omx] To enable tmux-backed features, install psmux:\n" +
1874
+ "[omx] winget install psmux\n" +
1875
+ "[omx] See: https://github.com/marlocarlo/psmux");
1876
+ }
1877
+ else {
1878
+ console.warn(`[omx] warning: tmux probe failed on native Windows (${errno.code || errno.message}). Continuing without tmux/HUD.`);
1879
+ }
1880
+ }
1881
+ else if (result.status !== 0 && !isTmuxAvailable()) {
1882
+ const stderr = (result.stderr || "").trim();
1883
+ console.warn(`[omx] warning: tmux reported an error on native Windows${stderr ? ` (${stderr})` : ""}. Continuing without tmux/HUD.`);
1884
+ }
1885
+ }
1886
+ const launchCwd = process.cwd();
1887
+ const parsedWorktree = parseWorktreeMode(args);
1888
+ const notifyTempResult = resolveNotifyTempContract(parsedWorktree.remainingArgs, process.env);
1889
+ const explicitLaunchPolicy = resolveEffectiveLeaderLaunchPolicyOverride(notifyTempResult.passthroughArgs, process.env);
1890
+ const persistentCodexHomeForLaunch = resolveCodexHomeForLaunch(launchCwd, process.env);
1891
+ const { launchPolicy, effectiveExplicitLaunchPolicy } = resolveTmuxAwareLaunchPolicy(explicitLaunchPolicy, isNativeWindows());
1892
+ const enableNotifyFallbackAuthority = launchPolicy === "direct";
1893
+ const workerSparkModel = resolveWorkerSparkModel(notifyTempResult.passthroughArgs, persistentCodexHomeForLaunch);
1894
+ const normalizedArgs = normalizeCodexLaunchArgs(notifyTempResult.passthroughArgs);
1895
+ let cwd = launchCwd;
1896
+ let worktreeDirty = false;
1897
+ let ensuredLaunchWorktree;
1898
+ if (parsedWorktree.mode.enabled) {
1899
+ const planned = planWorktreeTarget({
1900
+ cwd: launchCwd,
1901
+ scope: "launch",
1902
+ mode: parsedWorktree.mode,
1903
+ });
1904
+ const ensured = ensureWorktree(planned, { allowDirtyReuse: true });
1905
+ ensuredLaunchWorktree = ensured;
1906
+ if (ensured.enabled) {
1907
+ cwd = ensured.worktreePath;
1908
+ if (ensured.dirty) {
1909
+ worktreeDirty = true;
1910
+ process.stderr.write(`[omx] Caution: worktree at ${cwd} has uncommitted changes.\n` +
1911
+ ` The session will launch as-is. Resolve the dirty state with OMX after launch, then proceed with your task.\n`);
1912
+ }
1913
+ const depBootstrap = ensureReusableNodeModules(cwd);
1914
+ if (depBootstrap.strategy === "symlink") {
1915
+ console.log(`[omx] Reusing node_modules from ${depBootstrap.sourceNodeModulesPath}`);
1916
+ }
1917
+ else if (depBootstrap.strategy === "missing" && depBootstrap.warning) {
1918
+ console.warn(`[omx] ${depBootstrap.warning}`);
1919
+ }
1920
+ }
1921
+ }
1922
+ applyDisposableWorktreeOmxRootForLaunch(ensuredLaunchWorktree);
1923
+ const sessionId = `omx-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
1924
+ try {
1925
+ await maybeCheckAndPromptUpdate(cwd);
1926
+ }
1927
+ catch (err) {
1928
+ logCliOperationFailure(err);
1929
+ // Non-fatal: update checks must never block launch
1930
+ }
1931
+ try {
1932
+ await maybePromptGithubStar();
1933
+ }
1934
+ catch (err) {
1935
+ logCliOperationFailure(err);
1936
+ // Non-fatal: star prompt must never block launch
1937
+ }
1938
+ // ── Phase 0.5: config repair ────────────────────────────────────────────
1939
+ // After an omx version upgrade the OLD setup code (still in memory) may
1940
+ // have written a config.toml with duplicate [tui] sections. Codex CLI's
1941
+ // TOML parser rejects duplicates, so we repair before spawning the CLI.
1942
+ try {
1943
+ const configPath = resolveCodexConfigPathForLaunch(launchCwd, process.env);
1944
+ const repaired = await repairConfigIfNeeded(configPath, getPackageRoot(), await resolveLaunchConfigRepairOptions(launchCwd, configPath));
1945
+ if (repaired) {
1946
+ console.log("[omx] Repaired managed config.toml compatibility issue.");
1947
+ }
1948
+ }
1949
+ catch {
1950
+ // Non-fatal: repair failure must not block launch
1951
+ }
1952
+ const preparedCodexHome = await prepareCodexHomeForLaunch(launchCwd, sessionId, process.env, {
1953
+ includeHistoryArtifacts: normalizedArgs[0] === "resume",
1954
+ });
1955
+ const codexHomeOverride = preparedCodexHome.codexHomeOverride;
1956
+ const sqliteHomeOverride = preparedCodexHome.sqliteHomeOverride;
1957
+ const projectLocalCodexHomeForCleanup = preparedCodexHome.projectLocalCodexHomeForCleanup;
1958
+ // ── Phase 1: preLaunch ──────────────────────────────────────────────────
1959
+ try {
1960
+ await preLaunch(cwd, sessionId, notifyTempResult.contract, codexHomeOverride, enableNotifyFallbackAuthority, worktreeDirty);
1961
+ }
1962
+ catch (err) {
1963
+ // preLaunch errors must NOT prevent Codex from starting
1964
+ console.error(`[omx] preLaunch warning: ${err instanceof Error ? err.message : err}`);
1965
+ }
1966
+ // ── Phase 2: run ────────────────────────────────────────────────────────
1967
+ let postLaunchHandledExternally = false;
1968
+ try {
1969
+ const notifyTempContractRaw = notifyTempResult.contract.active
1970
+ ? serializeNotifyTempContract(notifyTempResult.contract)
1971
+ : null;
1972
+ const launchResult = runCodex(cwd, normalizedArgs, sessionId, workerSparkModel, codexHomeOverride, sqliteHomeOverride, notifyTempContractRaw, effectiveExplicitLaunchPolicy, projectLocalCodexHomeForCleanup, preparedCodexHome.runtimeCodexHomeForCleanup);
1973
+ postLaunchHandledExternally = launchResult.postLaunchHandledExternally;
1974
+ }
1975
+ finally {
1976
+ // ── Phase 3: postLaunch ─────────────────────────────────────────────
1977
+ if (!postLaunchHandledExternally) {
1978
+ await postLaunch(cwd, sessionId, codexHomeOverride, enableNotifyFallbackAuthority, projectLocalCodexHomeForCleanup);
1979
+ await cleanupRuntimeCodexHome(preparedCodexHome.runtimeCodexHomeForCleanup, projectLocalCodexHomeForCleanup).catch(logCliOperationFailure);
1980
+ }
1981
+ }
1982
+ }
1983
+ export async function execWithOverlay(args) {
1984
+ const launchCwd = process.cwd();
1985
+ const parsedWorktree = parseWorktreeMode(args);
1986
+ const notifyTempResult = resolveNotifyTempContract(parsedWorktree.remainingArgs, process.env);
1987
+ const normalizedArgs = normalizeCodexLaunchArgs(notifyTempResult.passthroughArgs);
1988
+ let cwd = launchCwd;
1989
+ let worktreeDirty = false;
1990
+ let ensuredLaunchWorktree;
1991
+ if (parsedWorktree.mode.enabled) {
1992
+ const planned = planWorktreeTarget({
1993
+ cwd: launchCwd,
1994
+ scope: "launch",
1995
+ mode: parsedWorktree.mode,
1996
+ });
1997
+ const ensured = ensureWorktree(planned, { allowDirtyReuse: true });
1998
+ ensuredLaunchWorktree = ensured;
1999
+ if (ensured.enabled) {
2000
+ cwd = ensured.worktreePath;
2001
+ if (ensured.dirty) {
2002
+ worktreeDirty = true;
2003
+ process.stderr.write(`[omx] Caution: worktree at ${cwd} has uncommitted changes.\n` +
2004
+ ` The session will launch as-is. Resolve the dirty state with OMX after launch, then proceed with your task.\n`);
2005
+ }
2006
+ const depBootstrap = ensureReusableNodeModules(cwd);
2007
+ if (depBootstrap.strategy === "symlink") {
2008
+ console.log(`[omx] Reusing node_modules from ${depBootstrap.sourceNodeModulesPath}`);
2009
+ }
2010
+ else if (depBootstrap.strategy === "missing" && depBootstrap.warning) {
2011
+ console.warn(`[omx] ${depBootstrap.warning}`);
2012
+ }
2013
+ }
2014
+ }
2015
+ applyDisposableWorktreeOmxRootForLaunch(ensuredLaunchWorktree);
2016
+ const sessionId = `omx-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
2017
+ try {
2018
+ await maybeCheckAndPromptUpdate(cwd);
2019
+ }
2020
+ catch (err) {
2021
+ logCliOperationFailure(err);
2022
+ }
2023
+ try {
2024
+ await maybePromptGithubStar();
2025
+ }
2026
+ catch (err) {
2027
+ logCliOperationFailure(err);
2028
+ }
2029
+ try {
2030
+ const configPath = resolveCodexConfigPathForLaunch(launchCwd, process.env);
2031
+ const repaired = await repairConfigIfNeeded(configPath, getPackageRoot(), await resolveLaunchConfigRepairOptions(launchCwd, configPath));
2032
+ if (repaired) {
2033
+ console.log("[omx] Repaired managed config.toml compatibility issue.");
2034
+ }
2035
+ }
2036
+ catch {
2037
+ // Non-fatal
2038
+ }
2039
+ const preparedCodexHome = await prepareCodexHomeForLaunch(launchCwd, sessionId, process.env);
2040
+ const codexHomeOverride = preparedCodexHome.codexHomeOverride;
2041
+ const sqliteHomeOverride = preparedCodexHome.sqliteHomeOverride;
2042
+ const projectLocalCodexHomeForCleanup = preparedCodexHome.projectLocalCodexHomeForCleanup;
2043
+ try {
2044
+ await preLaunch(cwd, sessionId, notifyTempResult.contract, codexHomeOverride, true, worktreeDirty);
2045
+ }
2046
+ catch (err) {
2047
+ console.error(`[omx] preLaunch warning: ${err instanceof Error ? err.message : err}`);
2048
+ }
2049
+ try {
2050
+ const notifyTempContractRaw = notifyTempResult.contract.active
2051
+ ? serializeNotifyTempContract(notifyTempResult.contract)
2052
+ : null;
2053
+ const codexArgs = injectModelInstructionsBypassArgs(cwd, ["exec", ...normalizedArgs], process.env, sessionModelInstructionsPath(cwd, sessionId));
2054
+ const omxRootOverride = resolveOmxRootForLaunch(cwd, process.env);
2055
+ const codexEnvBase = {
2056
+ ...process.env,
2057
+ ...(codexHomeOverride ? { CODEX_HOME: codexHomeOverride } : {}),
2058
+ ...(sqliteHomeOverride ? { [CODEX_SQLITE_HOME_ENV]: sqliteHomeOverride } : {}),
2059
+ ...(omxRootOverride ? { OMX_ROOT: omxRootOverride } : {}),
2060
+ };
2061
+ const codexEnv = notifyTempContractRaw
2062
+ ? {
2063
+ ...codexEnvBase,
2064
+ [OMX_NOTIFY_TEMP_CONTRACT_ENV]: notifyTempContractRaw,
2065
+ }
2066
+ : codexEnvBase;
2067
+ runCodexBlocking(cwd, codexArgs, codexEnv);
2068
+ }
2069
+ finally {
2070
+ await postLaunch(cwd, sessionId, codexHomeOverride, true, projectLocalCodexHomeForCleanup);
2071
+ await cleanupRuntimeCodexHome(preparedCodexHome.runtimeCodexHomeForCleanup, projectLocalCodexHomeForCleanup).catch(logCliOperationFailure);
2072
+ }
2073
+ }
2074
+ export function normalizeCodexLaunchArgs(args) {
2075
+ const parsed = parseWorktreeMode(args);
2076
+ const launchPolicyParsed = splitLeaderLaunchPolicyArgs(parsed.remainingArgs);
2077
+ const normalized = [];
2078
+ let wantsBypass = false;
2079
+ let hasBypass = false;
2080
+ let reasoningMode = null;
2081
+ for (const arg of launchPolicyParsed.remainingArgs) {
2082
+ if (arg === MADMAX_FLAG) {
2083
+ wantsBypass = true;
2084
+ continue;
2085
+ }
2086
+ if (arg === CODEX_BYPASS_FLAG) {
2087
+ wantsBypass = true;
2088
+ if (!hasBypass) {
2089
+ normalized.push(arg);
2090
+ hasBypass = true;
2091
+ }
2092
+ continue;
2093
+ }
2094
+ if (arg === HIGH_REASONING_FLAG) {
2095
+ reasoningMode = "high";
2096
+ continue;
2097
+ }
2098
+ if (arg === XHIGH_REASONING_FLAG) {
2099
+ reasoningMode = "xhigh";
2100
+ continue;
2101
+ }
2102
+ if (arg === SPARK_FLAG) {
2103
+ // Spark model is injected into worker env only (not the leader). Consume flag.
2104
+ continue;
2105
+ }
2106
+ if (arg === MADMAX_SPARK_FLAG) {
2107
+ // Bypass applies to leader; spark model goes to workers only. Consume flag.
2108
+ wantsBypass = true;
2109
+ continue;
2110
+ }
2111
+ normalized.push(arg);
2112
+ }
2113
+ if (wantsBypass && !hasBypass) {
2114
+ normalized.push(CODEX_BYPASS_FLAG);
2115
+ }
2116
+ if (reasoningMode) {
2117
+ normalized.push(CONFIG_FLAG, `${REASONING_KEY}="${reasoningMode}"`);
2118
+ }
2119
+ return normalized;
2120
+ }
2121
+ /**
2122
+ * Returns the spark model string if --spark or --madmax-spark appears in the
2123
+ * raw (pre-normalize) args, or undefined if neither flag is present.
2124
+ * Used to route the spark model to team workers without affecting the leader.
2125
+ */
2126
+ export function resolveWorkerSparkModel(args, codexHomeOverride) {
2127
+ for (const arg of args) {
2128
+ if (arg === SPARK_FLAG || arg === MADMAX_SPARK_FLAG) {
2129
+ return resolveTeamLowComplexityDefaultModel(codexHomeOverride);
2130
+ }
2131
+ }
2132
+ return undefined;
2133
+ }
2134
+ function isModelInstructionsOverride(value) {
2135
+ return new RegExp(`^${MODEL_INSTRUCTIONS_FILE_KEY}\\s*=`).test(value.trim());
2136
+ }
2137
+ function hasModelInstructionsOverride(args) {
2138
+ for (let i = 0; i < args.length; i++) {
2139
+ const arg = args[i];
2140
+ if (arg === CONFIG_FLAG || arg === LONG_CONFIG_FLAG) {
2141
+ const maybeValue = args[i + 1];
2142
+ if (typeof maybeValue === "string" &&
2143
+ isModelInstructionsOverride(maybeValue)) {
2144
+ return true;
2145
+ }
2146
+ continue;
2147
+ }
2148
+ if (arg.startsWith(`${LONG_CONFIG_FLAG}=`)) {
2149
+ const inlineValue = arg.slice(`${LONG_CONFIG_FLAG}=`.length);
2150
+ if (isModelInstructionsOverride(inlineValue))
2151
+ return true;
2152
+ }
2153
+ }
2154
+ return false;
2155
+ }
2156
+ function shouldBypassDefaultSystemPrompt(env) {
2157
+ return env[OMX_BYPASS_DEFAULT_SYSTEM_PROMPT_ENV] !== "0";
2158
+ }
2159
+ function buildModelInstructionsOverride(cwd, env, defaultFilePath) {
2160
+ const filePath = env[OMX_MODEL_INSTRUCTIONS_FILE_ENV] ||
2161
+ defaultFilePath ||
2162
+ join(cwd, "AGENTS.md");
2163
+ return `${MODEL_INSTRUCTIONS_FILE_KEY}="${escapeTomlString(filePath)}"`;
2164
+ }
2165
+ function tryReadGitValue(cwd, args) {
2166
+ try {
2167
+ const value = execFileSync("git", args, {
2168
+ cwd,
2169
+ encoding: "utf-8",
2170
+ stdio: ["ignore", "pipe", "ignore"],
2171
+ timeout: 2000,
2172
+ }).trim();
2173
+ return value || undefined;
2174
+ }
2175
+ catch {
2176
+ return undefined;
2177
+ }
2178
+ }
2179
+ function extractIssueNumber(text) {
2180
+ const explicit = text.match(/\bissue\s*#(\d+)\b/i);
2181
+ if (explicit)
2182
+ return Number.parseInt(explicit[1], 10);
2183
+ const generic = text.match(/(^|[^\w/])#(\d+)\b/);
2184
+ return generic ? Number.parseInt(generic[2], 10) : undefined;
2185
+ }
2186
+ export function resolveNativeSessionName(cwd, sessionId, env = process.env) {
2187
+ if (env.TMUX) {
2188
+ try {
2189
+ const tmuxPaneTarget = env.TMUX_PANE?.trim();
2190
+ const displayArgs = tmuxPaneTarget
2191
+ ? ["display-message", "-p", "-t", tmuxPaneTarget, "#S"]
2192
+ : ["display-message", "-p", "#S"];
2193
+ const tmuxSession = execTmuxFileSync(displayArgs, {
2194
+ encoding: "utf-8",
2195
+ stdio: ["ignore", "pipe", "ignore"],
2196
+ timeout: 2000,
2197
+ }).trim();
2198
+ if (tmuxSession)
2199
+ return tmuxSession;
2200
+ }
2201
+ catch {
2202
+ // best effort only
2203
+ }
2204
+ }
2205
+ return buildTmuxSessionName(cwd, sessionId);
2206
+ }
2207
+ function tagTmuxSessionWithInstance(sessionName, sessionId) {
2208
+ const target = sessionName.trim();
2209
+ const instanceId = sessionId.trim();
2210
+ if (!target || !instanceId)
2211
+ return;
2212
+ execFileSync("tmux", ["set-option", "-t", target, OMX_INSTANCE_OPTION, instanceId], {
2213
+ stdio: ["ignore", "ignore", "ignore"],
2214
+ timeout: 2000,
2215
+ });
2216
+ }
2217
+ function tagCurrentTmuxSessionWithInstance(sessionId) {
2218
+ if (!process.env.TMUX)
2219
+ return;
2220
+ try {
2221
+ const tmuxPaneTarget = process.env.TMUX_PANE;
2222
+ const displayArgs = tmuxPaneTarget
2223
+ ? ["display-message", "-p", "-t", tmuxPaneTarget, "#S"]
2224
+ : ["display-message", "-p", "#S"];
2225
+ const sessionName = execFileSync("tmux", displayArgs, {
2226
+ encoding: "utf-8",
2227
+ stdio: ["ignore", "pipe", "ignore"],
2228
+ timeout: 2000,
2229
+ }).trim();
2230
+ if (sessionName)
2231
+ tagTmuxSessionWithInstance(sessionName, sessionId);
2232
+ }
2233
+ catch {
2234
+ // Best effort only: launch should not fail just because tmux tagging failed.
2235
+ }
2236
+ }
2237
+ function buildNativeHookBaseContext(cwd, sessionId, normalizedEvent, extra = {}) {
2238
+ const repoPath = tryReadGitValue(cwd, ["rev-parse", "--show-toplevel"]) || cwd;
2239
+ const branch = tryReadGitValue(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
2240
+ const issueNumber = extractIssueNumber([branch, basename(cwd)].filter(Boolean).join(" "));
2241
+ return {
2242
+ normalized_event: normalizedEvent,
2243
+ session_name: resolveNativeSessionName(cwd, sessionId),
2244
+ repo_path: repoPath,
2245
+ repo_name: basename(repoPath),
2246
+ worktree_path: cwd,
2247
+ ...(branch ? { branch } : {}),
2248
+ ...(issueNumber !== undefined ? { issue_number: issueNumber } : {}),
2249
+ ...extra,
2250
+ };
2251
+ }
2252
+ export function injectModelInstructionsBypassArgs(cwd, args, env = process.env, defaultFilePath) {
2253
+ if (!shouldBypassDefaultSystemPrompt(env))
2254
+ return [...args];
2255
+ if (hasModelInstructionsOverride(args))
2256
+ return [...args];
2257
+ return [
2258
+ ...args,
2259
+ CONFIG_FLAG,
2260
+ buildModelInstructionsOverride(cwd, env, defaultFilePath),
2261
+ ];
2262
+ }
2263
+ export function collectInheritableTeamWorkerArgs(codexArgs) {
2264
+ return collectInheritableTeamWorkerArgsShared(codexArgs);
2265
+ }
2266
+ export function resolveTeamWorkerLaunchArgsEnv(existingRaw, codexArgs, inheritLeaderFlags = true, defaultModel) {
2267
+ const inheritedArgs = inheritLeaderFlags
2268
+ ? collectInheritableTeamWorkerArgs(codexArgs)
2269
+ : [];
2270
+ const normalized = resolveTeamWorkerLaunchArgs({
2271
+ existingRaw,
2272
+ inheritedArgs,
2273
+ fallbackModel: defaultModel,
2274
+ });
2275
+ if (normalized.length === 0)
2276
+ return null;
2277
+ return normalized.join(" ");
2278
+ }
2279
+ export { readTopLevelTomlString, upsertTopLevelTomlString } from "../utils/toml.js";
2280
+ function sanitizeTmuxToken(value) {
2281
+ const cleaned = value
2282
+ .toLowerCase()
2283
+ .replace(/[^a-z0-9]+/g, "-")
2284
+ .replace(/^-+|-+$/g, "");
2285
+ return cleaned || "unknown";
2286
+ }
2287
+ export function buildTmuxSessionName(cwd, sessionId) {
2288
+ const parentPath = dirname(cwd);
2289
+ const parentDir = basename(parentPath);
2290
+ const dirName = basename(cwd);
2291
+ const grandparentPath = dirname(parentPath);
2292
+ const grandparentDir = basename(grandparentPath);
2293
+ const repoDir = parentDir.endsWith(".omx-worktrees")
2294
+ ? parentDir.slice(0, -".omx-worktrees".length)
2295
+ : parentDir === "worktrees" && grandparentDir === ".omx"
2296
+ ? basename(dirname(grandparentPath))
2297
+ : null;
2298
+ const dirToken = repoDir
2299
+ ? sanitizeTmuxToken(`${repoDir}-${dirName}`)
2300
+ : sanitizeTmuxToken(dirName);
2301
+ let branchToken = "detached";
2302
+ const branch = tryReadGitValue(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
2303
+ if (branch)
2304
+ branchToken = sanitizeTmuxToken(branch);
2305
+ const sessionToken = sanitizeTmuxToken(sessionId.replace(/^omx-/, ""));
2306
+ const prefix = `omx-${dirToken}-${branchToken}`;
2307
+ const name = `${prefix}-${sessionToken}`;
2308
+ if (name.length <= 120)
2309
+ return name;
2310
+ const prefixBudget = Math.max(4, 120 - sessionToken.length - 1);
2311
+ const trimmedPrefix = prefix.slice(0, prefixBudget).replace(/-+$/g, "");
2312
+ return `${trimmedPrefix}-${sessionToken}`.slice(0, 120);
2313
+ }
2314
+ export function buildDetachedTmuxSessionName(cwd, sessionId) {
2315
+ return buildTmuxSessionName(cwd, sessionId);
2316
+ }
2317
+ function parseWindowIndexFromTmuxOutput(rawOutput) {
2318
+ const windowIndex = rawOutput.split("\n")[0]?.trim() || "";
2319
+ return /^[0-9]+$/.test(windowIndex) ? windowIndex : null;
2320
+ }
2321
+ export function detectDetachedSessionWindowIndex(sessionName) {
2322
+ try {
2323
+ const output = execTmuxFileSync(["display-message", "-p", "-t", sessionName, "#{window_index}"], { encoding: "utf-8" });
2324
+ return parseWindowIndexFromTmuxOutput(output);
2325
+ }
2326
+ catch (err) {
2327
+ logCliOperationFailure(err);
2328
+ return null;
2329
+ }
2330
+ }
2331
+ function escapeShellDoubleQuotedValue(value) {
2332
+ return value.replace(/["\\$`]/g, "\\$&");
2333
+ }
2334
+ function sanitizeTmuxLeaseKey(value) {
2335
+ const cleaned = value
2336
+ .toLowerCase()
2337
+ .replace(/[^a-z0-9]+/g, "-")
2338
+ .replace(/^-+|-+$/g, "");
2339
+ return cleaned || "default";
2340
+ }
2341
+ function blockMs(ms) {
2342
+ const delay = Math.max(1, Math.floor(ms));
2343
+ const shared = new SharedArrayBuffer(4);
2344
+ const view = new Int32Array(shared);
2345
+ Atomics.wait(view, 0, 0, delay);
2346
+ }
2347
+ function tmuxExtendedKeysLeaseRoot(cwd) {
2348
+ return join(omxRoot(cwd), "state", TMUX_EXTENDED_KEYS_LEASE_DIR);
2349
+ }
2350
+ function resolveTmuxSocketPath(execFileSyncImpl = (file, tmuxArgs) => execFileSync(file, tmuxArgs, {
2351
+ encoding: "utf-8",
2352
+ })) {
2353
+ return (execTmuxSync(["display-message", "-p", "#{socket_path}"], execFileSyncImpl) ||
2354
+ "default");
2355
+ }
2356
+ function tmuxExtendedKeysLeasePath(cwd, socketPath) {
2357
+ return join(tmuxExtendedKeysLeaseRoot(cwd), `${sanitizeTmuxLeaseKey(socketPath)}.json`);
2358
+ }
2359
+ function isTmuxExtendedKeysLeaseHolderRecord(holder) {
2360
+ if (!holder || typeof holder !== "object")
2361
+ return false;
2362
+ const record = holder;
2363
+ if (typeof record.id !== "string" || !record.id.trim())
2364
+ return false;
2365
+ if (!Number.isSafeInteger(record.pid) || Number(record.pid) <= 0)
2366
+ return false;
2367
+ if (record.platform !== undefined && typeof record.platform !== "string")
2368
+ return false;
2369
+ if (record.linuxStartTicks !== undefined &&
2370
+ !Number.isSafeInteger(record.linuxStartTicks))
2371
+ return false;
2372
+ return true;
2373
+ }
2374
+ function isTmuxExtendedKeysLeaseHolder(holder) {
2375
+ return typeof holder === "string" || isTmuxExtendedKeysLeaseHolderRecord(holder);
2376
+ }
2377
+ function readTmuxExtendedKeysLeaseState(leasePath) {
2378
+ if (!existsSync(leasePath))
2379
+ return null;
2380
+ try {
2381
+ const parsed = JSON.parse(readFileSync(leasePath, "utf-8"));
2382
+ if (typeof parsed.originalMode !== "string" ||
2383
+ !Array.isArray(parsed.holders) ||
2384
+ !parsed.holders.every(isTmuxExtendedKeysLeaseHolder)) {
2385
+ return null;
2386
+ }
2387
+ return {
2388
+ originalMode: parsed.originalMode,
2389
+ holders: [...parsed.holders],
2390
+ };
2391
+ }
2392
+ catch {
2393
+ return null;
2394
+ }
2395
+ }
2396
+ function writeTmuxExtendedKeysLeaseState(leasePath, state) {
2397
+ mkdirSync(dirname(leasePath), { recursive: true });
2398
+ writeFileSync(leasePath, JSON.stringify(state, null, 2));
2399
+ }
2400
+ function parseTmuxExtendedKeysLeaseHolderPid(holder) {
2401
+ const match = /^([1-9]\d*)-/.exec(holder);
2402
+ if (!match)
2403
+ return null;
2404
+ const pid = Number.parseInt(match[1], 10);
2405
+ return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
2406
+ }
2407
+ function getTmuxExtendedKeysLeaseHolderId(holder) {
2408
+ return typeof holder === "string" ? holder : holder.id;
2409
+ }
2410
+ function getTmuxExtendedKeysLeaseHolderPid(holder) {
2411
+ if (typeof holder === "string")
2412
+ return parseTmuxExtendedKeysLeaseHolderPid(holder);
2413
+ return Number.isSafeInteger(holder.pid) && holder.pid > 0 ? holder.pid : null;
2414
+ }
2415
+ function parseLinuxProcStartTicks(statContent) {
2416
+ const commandEnd = statContent.lastIndexOf(")");
2417
+ if (commandEnd === -1)
2418
+ return null;
2419
+ const remainder = statContent.slice(commandEnd + 1).trim();
2420
+ const fields = remainder.split(/\s+/);
2421
+ if (fields.length <= 19)
2422
+ return null;
2423
+ const startTicks = Number(fields[19]);
2424
+ return Number.isSafeInteger(startTicks) ? startTicks : null;
2425
+ }
2426
+ function readLinuxProcessStartTicks(pid) {
2427
+ try {
2428
+ return parseLinuxProcStartTicks(readFileSync(`/proc/${pid}/stat`, "utf-8"));
2429
+ }
2430
+ catch {
2431
+ return null;
2432
+ }
2433
+ }
2434
+ function createTmuxExtendedKeysLeaseHolder(id, pid) {
2435
+ const linuxStartTicks = process.platform === "linux"
2436
+ ? readLinuxProcessStartTicks(pid) ?? undefined
2437
+ : undefined;
2438
+ return {
2439
+ id,
2440
+ pid,
2441
+ platform: process.platform,
2442
+ ...(linuxStartTicks !== undefined ? { linuxStartTicks } : {}),
2443
+ };
2444
+ }
2445
+ function isProcessAlive(pid) {
2446
+ try {
2447
+ process.kill(pid, 0);
2448
+ return true;
2449
+ }
2450
+ catch (err) {
2451
+ const code = err && typeof err === "object" && "code" in err
2452
+ ? String(err.code)
2453
+ : "";
2454
+ return code === "EPERM";
2455
+ }
2456
+ }
2457
+ function isTmuxExtendedKeysLeaseHolderAlive(holder) {
2458
+ const pid = getTmuxExtendedKeysLeaseHolderPid(holder);
2459
+ if (pid === null || !isProcessAlive(pid))
2460
+ return false;
2461
+ if (typeof holder === "string")
2462
+ return true;
2463
+ if (holder.platform !== "linux" || process.platform !== "linux")
2464
+ return true;
2465
+ if (holder.linuxStartTicks === undefined)
2466
+ return true;
2467
+ return readLinuxProcessStartTicks(pid) === holder.linuxStartTicks;
2468
+ }
2469
+ function reapDeadTmuxExtendedKeysLeaseHolders(state) {
2470
+ return {
2471
+ originalMode: state.originalMode,
2472
+ holders: state.holders.filter(isTmuxExtendedKeysLeaseHolderAlive),
2473
+ };
2474
+ }
2475
+ function withTmuxExtendedKeysLeaseLock(cwd, socketPath, run) {
2476
+ const leaseRoot = tmuxExtendedKeysLeaseRoot(cwd);
2477
+ mkdirSync(leaseRoot, { recursive: true });
2478
+ const lockPath = join(leaseRoot, `${sanitizeTmuxLeaseKey(socketPath)}.lock`);
2479
+ for (let attempt = 0; attempt < TMUX_EXTENDED_KEYS_LOCK_MAX_ATTEMPTS; attempt++) {
2480
+ try {
2481
+ mkdirSync(lockPath);
2482
+ try {
2483
+ writeFileSync(join(lockPath, "pid"), String(process.pid));
2484
+ return run();
2485
+ }
2486
+ finally {
2487
+ rmSync(lockPath, { recursive: true, force: true });
2488
+ }
2489
+ }
2490
+ catch (err) {
2491
+ const code = err && typeof err === "object" && "code" in err
2492
+ ? String(err.code)
2493
+ : "";
2494
+ if (code !== "EEXIST")
2495
+ throw err;
2496
+ const lockStat = statSync(lockPath, { throwIfNoEntry: false });
2497
+ if (lockStat && Date.now() - lockStat.mtimeMs > TMUX_EXTENDED_KEYS_LOCK_STALE_MS) {
2498
+ let holderAlive = false;
2499
+ try {
2500
+ const holderPid = Number.parseInt(readFileSync(join(lockPath, "pid"), "utf-8").trim(), 10);
2501
+ if (Number.isFinite(holderPid) && holderPid > 0) {
2502
+ process.kill(holderPid, 0);
2503
+ holderAlive = true;
2504
+ }
2505
+ }
2506
+ catch {
2507
+ // PID file missing/unreadable or process dead (ESRCH) — treat as stale
2508
+ }
2509
+ if (!holderAlive) {
2510
+ rmSync(lockPath, { recursive: true, force: true });
2511
+ continue;
2512
+ }
2513
+ }
2514
+ blockMs(TMUX_EXTENDED_KEYS_LOCK_RETRY_MS);
2515
+ }
2516
+ }
2517
+ throw new Error(`timed out waiting for tmux extended-keys lease lock: ${lockPath}`);
2518
+ }
2519
+ function buildDetachedSessionLeaderCommand(cwd, sessionName, codexCmd, sessionId, codexHomeOverride, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup, parentEnvFilePath) {
2520
+ const detachedPostLaunchHelper = sessionId
2521
+ ? `${buildDetachedSessionPostLaunchHelperCommand(cwd, sessionId, codexHomeOverride, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup)} >/dev/null 2>&1 || true;`
2522
+ : "";
2523
+ const parentEnvSource = parentEnvFilePath && parentEnvFilePath.trim()
2524
+ ? `if [ -r ${quoteShellArg(parentEnvFilePath)} ]; then . ${quoteShellArg(parentEnvFilePath)}; rm -f ${quoteShellArg(parentEnvFilePath)}; fi;`
2525
+ : "";
2526
+ const parentEnvCleanup = parentEnvFilePath && parentEnvFilePath.trim()
2527
+ ? `rm -f ${quoteShellArg(parentEnvFilePath)} 2>/dev/null || true;`
2528
+ : "";
2529
+ const wrapped = [
2530
+ buildTmuxExtendedKeysAcquireShellSnippet(cwd),
2531
+ 'exec 3<&0;',
2532
+ 'omx_codex_pid="";',
2533
+ "omx_detached_session_cleanup() {",
2534
+ "status=$?;",
2535
+ "trap - 0 INT TERM HUP;",
2536
+ 'if [ -n "$omx_codex_pid" ] && kill -0 "$omx_codex_pid" 2>/dev/null; then',
2537
+ 'kill -TERM "$omx_codex_pid" 2>/dev/null || true;',
2538
+ 'wait "$omx_codex_pid" 2>/dev/null || true;',
2539
+ "fi;",
2540
+ 'exec 3<&- 2>/dev/null || true;',
2541
+ buildTmuxExtendedKeysReleaseShellSnippet(cwd),
2542
+ parentEnvCleanup,
2543
+ detachedPostLaunchHelper,
2544
+ 'if [ "$status" -eq 0 ]; then',
2545
+ `tmux kill-session -t "${escapeShellDoubleQuotedValue(sessionName)}" >/dev/null 2>&1 || true;`,
2546
+ "fi;",
2547
+ "exit $status;",
2548
+ "};",
2549
+ "trap omx_detached_session_cleanup 0 INT TERM HUP;",
2550
+ parentEnvSource,
2551
+ "unset OMX_HERMES_MCP_BRIDGE;",
2552
+ "omx_codex_started_at=$(date +%s 2>/dev/null || printf 0);",
2553
+ `${codexCmd} <&3 &`,
2554
+ "omx_codex_pid=$!;",
2555
+ 'wait "$omx_codex_pid";',
2556
+ "omx_codex_status=$?;",
2557
+ "omx_codex_finished_at=$(date +%s 2>/dev/null || printf 0);",
2558
+ 'omx_codex_elapsed=$((omx_codex_finished_at - omx_codex_started_at));',
2559
+ 'if [ "$omx_codex_status" -eq 0 ] && [ "$omx_codex_elapsed" -le 2 ]; then',
2560
+ 'printf "\\n[omx] codex exited immediately with code 0 during startup. The detached tmux session is being kept open so any output above remains visible. Press Enter to close this OMX session.\\n" >&2;',
2561
+ 'IFS= read -r _omx_close || true;',
2562
+ 'elif [ "$omx_codex_status" -gt 0 ] && [ "$omx_codex_status" -lt 128 ] && [ "$omx_codex_elapsed" -le 2 ]; then',
2563
+ 'printf "\\n[omx] codex exited with code %s during startup. The detached tmux session is being kept open so the error above remains visible. Press Enter to close this OMX session.\\n" "$omx_codex_status" >&2;',
2564
+ 'IFS= read -r _omx_close || true;',
2565
+ 'elif [ "$omx_codex_status" -gt 0 ] && [ "$omx_codex_status" -lt 128 ]; then',
2566
+ 'printf "\\n[omx] codex exited with code %s. The detached tmux session is being kept open so the error above remains visible. Press Enter to close this OMX session.\\n" "$omx_codex_status" >&2;',
2567
+ 'IFS= read -r _omx_close || true;',
2568
+ "fi;",
2569
+ 'exit "$omx_codex_status";',
2570
+ ].join(" ");
2571
+ return `/bin/sh -c ${quoteShellArg(wrapped)}`;
2572
+ }
2573
+ function buildDetachedSessionPostLaunchHelperCommand(cwd, sessionId, codexHomeOverride, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup) {
2574
+ const cwdLiteral = JSON.stringify(cwd);
2575
+ const sessionIdLiteral = JSON.stringify(sessionId);
2576
+ const codexHomeLiteral = typeof codexHomeOverride === "string" && codexHomeOverride.length > 0
2577
+ ? JSON.stringify(codexHomeOverride)
2578
+ : "undefined";
2579
+ const projectLocalCleanupLiteral = typeof projectLocalCodexHomeForCleanup === "string" &&
2580
+ projectLocalCodexHomeForCleanup.length > 0
2581
+ ? JSON.stringify(projectLocalCodexHomeForCleanup)
2582
+ : "undefined";
2583
+ const runtimeCodexHomeCleanupLiteral = typeof runtimeCodexHomeForCleanup === "string" &&
2584
+ runtimeCodexHomeForCleanup.length > 0
2585
+ ? JSON.stringify(runtimeCodexHomeForCleanup)
2586
+ : "undefined";
2587
+ const moduleUrlLiteral = JSON.stringify(import.meta.url);
2588
+ const script = [
2589
+ `const mod = await import(${moduleUrlLiteral});`,
2590
+ `await mod.runDetachedSessionPostLaunch(${cwdLiteral}, ${sessionIdLiteral}, ${codexHomeLiteral}, ${projectLocalCleanupLiteral}, ${runtimeCodexHomeCleanupLiteral});`,
2591
+ ].join(" ");
2592
+ return `${quoteShellArg(process.execPath)} --input-type=module -e ${quoteShellArg(script)}`;
2593
+ }
2594
+ function execTmuxSync(args, execFileSyncImpl = (file, tmuxArgs) => execFileSync(file, tmuxArgs, {
2595
+ encoding: "utf-8",
2596
+ ...(process.platform === "win32" ? { windowsHide: true } : {}),
2597
+ })) {
2598
+ return execFileSyncImpl(resolveTmuxExecutableForLaunch(), [...args]).trim();
2599
+ }
2600
+ export function acquireTmuxExtendedKeysLease(cwd, execFileSyncImpl = (file, tmuxArgs) => execFileSync(file, tmuxArgs, {
2601
+ encoding: "utf-8",
2602
+ ...(process.platform === "win32" ? { windowsHide: true } : {}),
2603
+ }), ownerPid = process.pid) {
2604
+ try {
2605
+ const socketPath = resolveTmuxSocketPath(execFileSyncImpl);
2606
+ const leasePath = tmuxExtendedKeysLeasePath(cwd, socketPath);
2607
+ const holderPid = Number.isSafeInteger(ownerPid) && ownerPid > 0 ? ownerPid : process.pid;
2608
+ const leaseId = `${holderPid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
2609
+ withTmuxExtendedKeysLeaseLock(cwd, socketPath, () => {
2610
+ const stateRaw = readTmuxExtendedKeysLeaseState(leasePath);
2611
+ const state = stateRaw ? reapDeadTmuxExtendedKeysLeaseHolders(stateRaw) : null;
2612
+ if (stateRaw && state?.holders.length === 0) {
2613
+ execTmuxSync(["set-option", "-sq", "extended-keys", state.originalMode], execFileSyncImpl);
2614
+ rmSync(leasePath, { force: true });
2615
+ }
2616
+ if (!state || state.holders.length === 0) {
2617
+ const previousMode = execTmuxSync(["show-options", "-sv", "extended-keys"], execFileSyncImpl) ||
2618
+ TMUX_EXTENDED_KEYS_FALLBACK_MODE;
2619
+ execTmuxSync(["set-option", "-sq", "extended-keys", TMUX_EXTENDED_KEYS_MODE], execFileSyncImpl);
2620
+ writeTmuxExtendedKeysLeaseState(leasePath, {
2621
+ originalMode: previousMode,
2622
+ holders: [createTmuxExtendedKeysLeaseHolder(leaseId, holderPid)],
2623
+ });
2624
+ return;
2625
+ }
2626
+ state.holders.push(createTmuxExtendedKeysLeaseHolder(leaseId, holderPid));
2627
+ writeTmuxExtendedKeysLeaseState(leasePath, state);
2628
+ });
2629
+ return `${socketPath}\t${leaseId}`;
2630
+ }
2631
+ catch (err) {
2632
+ if (!isUnsupportedTmuxExtendedKeysFailure(err)) {
2633
+ logCliOperationFailure(err);
2634
+ }
2635
+ return null;
2636
+ }
2637
+ }
2638
+ export function releaseTmuxExtendedKeysLease(cwd, leaseHandle, execFileSyncImpl = (file, tmuxArgs) => execFileSync(file, tmuxArgs, {
2639
+ encoding: "utf-8",
2640
+ ...(process.platform === "win32" ? { windowsHide: true } : {}),
2641
+ })) {
2642
+ if (!leaseHandle.trim())
2643
+ return;
2644
+ const [socketPathRaw = "", leaseId = ""] = leaseHandle.split("\t");
2645
+ const socketPath = socketPathRaw.trim() || "default";
2646
+ if (!leaseId)
2647
+ return;
2648
+ try {
2649
+ const leasePath = tmuxExtendedKeysLeasePath(cwd, socketPath);
2650
+ withTmuxExtendedKeysLeaseLock(cwd, socketPath, () => {
2651
+ const stateRaw = readTmuxExtendedKeysLeaseState(leasePath);
2652
+ const state = stateRaw ? reapDeadTmuxExtendedKeysLeaseHolders(stateRaw) : null;
2653
+ if (!state || state.holders.length === 0) {
2654
+ if (stateRaw) {
2655
+ execTmuxSync(["set-option", "-sq", "extended-keys", stateRaw.originalMode], execFileSyncImpl);
2656
+ }
2657
+ rmSync(leasePath, { force: true });
2658
+ return;
2659
+ }
2660
+ const holders = state.holders.filter((holder) => getTmuxExtendedKeysLeaseHolderId(holder) !== leaseId);
2661
+ if (holders.length > 0) {
2662
+ writeTmuxExtendedKeysLeaseState(leasePath, {
2663
+ originalMode: state.originalMode,
2664
+ holders,
2665
+ });
2666
+ return;
2667
+ }
2668
+ execTmuxSync(["set-option", "-sq", "extended-keys", state.originalMode], execFileSyncImpl);
2669
+ rmSync(leasePath, { force: true });
2670
+ });
2671
+ }
2672
+ catch (err) {
2673
+ if (!isUnsupportedTmuxExtendedKeysFailure(err)) {
2674
+ logCliOperationFailure(err);
2675
+ }
2676
+ }
2677
+ }
2678
+ function buildTmuxExtendedKeysHelperCommand(cwd, operation) {
2679
+ const cwdLiteral = JSON.stringify(cwd);
2680
+ const moduleUrlLiteral = JSON.stringify(import.meta.url);
2681
+ const script = operation === "acquire"
2682
+ ? `const mod = await import(${moduleUrlLiteral}); const ownerPid = Number.parseInt(process.argv[1] ?? "", 10); const lease = mod.acquireTmuxExtendedKeysLease(${cwdLiteral}, undefined, Number.isSafeInteger(ownerPid) && ownerPid > 0 ? ownerPid : undefined); if (lease) process.stdout.write(lease);`
2683
+ : `const mod = await import(${moduleUrlLiteral}); mod.releaseTmuxExtendedKeysLease(${cwdLiteral}, process.argv[1] ?? "");`;
2684
+ return `${quoteShellArg(process.execPath)} --input-type=module -e ${quoteShellArg(script)}`;
2685
+ }
2686
+ function buildTmuxExtendedKeysAcquireShellSnippet(cwd) {
2687
+ return `OMX_TMUX_EXTENDED_KEYS_LEASE=$(${buildTmuxExtendedKeysHelperCommand(cwd, "acquire")} "$$" 2>/dev/null || true);`;
2688
+ }
2689
+ function buildTmuxExtendedKeysReleaseShellSnippet(cwd) {
2690
+ return `if [ -n "\${OMX_TMUX_EXTENDED_KEYS_LEASE:-}" ]; then ${buildTmuxExtendedKeysHelperCommand(cwd, "release")} "\${OMX_TMUX_EXTENDED_KEYS_LEASE}" >/dev/null 2>&1 || true; fi;`;
2691
+ }
2692
+ const SHELL_ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
2693
+ export function serializeDetachedSessionParentEnv(env) {
2694
+ const lines = [];
2695
+ for (const key of Object.keys(env).sort()) {
2696
+ if (!SHELL_ENV_NAME_PATTERN.test(key))
2697
+ continue;
2698
+ const value = env[key];
2699
+ if (typeof value !== "string")
2700
+ continue;
2701
+ if (value.includes("\0"))
2702
+ continue;
2703
+ lines.push(`export ${key}=${quoteShellArg(value)}`);
2704
+ }
2705
+ return `${lines.join("\n")}\n`;
2706
+ }
2707
+ export function detachedSessionParentEnvFilePath(cwd, sessionId) {
2708
+ const safeSessionId = sessionId.replace(/[^A-Za-z0-9_.-]/g, "_");
2709
+ return join(omxRoot(cwd), "runtime", "tmux-env", `${safeSessionId}.env`);
2710
+ }
2711
+ export function writeDetachedSessionParentEnvFile(cwd, sessionId, env) {
2712
+ const filePath = detachedSessionParentEnvFilePath(cwd, sessionId);
2713
+ mkdirSync(dirname(filePath), { recursive: true, mode: 0o700 });
2714
+ writeFileSync(filePath, serializeDetachedSessionParentEnv(env), {
2715
+ encoding: "utf-8",
2716
+ mode: 0o600,
2717
+ });
2718
+ return filePath;
2719
+ }
2720
+ export function withTmuxExtendedKeys(cwd, run, execFileSyncImpl = (file, tmuxArgs) => execFileSync(file, tmuxArgs, {
2721
+ encoding: "utf-8",
2722
+ ...(process.platform === "win32" ? { windowsHide: true } : {}),
2723
+ })) {
2724
+ const leaseHandle = acquireTmuxExtendedKeysLease(cwd, execFileSyncImpl);
2725
+ try {
2726
+ return run();
2727
+ }
2728
+ finally {
2729
+ if (leaseHandle)
2730
+ releaseTmuxExtendedKeysLease(cwd, leaseHandle, execFileSyncImpl);
2731
+ }
2732
+ }
2733
+ export function buildDetachedSessionBootstrapSteps(sessionName, cwd, codexCmd, hudCmd, workerLaunchArgs, codexHomeOverride, notifyTempContractRaw, nativeWindows = false, sessionId, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup, omxRootOverride, env = process.env, sqliteHomeOverride, parentEnvFilePath) {
2734
+ const detachedLeaderCmd = nativeWindows
2735
+ ? "powershell.exe"
2736
+ : buildDetachedSessionLeaderCommand(cwd, sessionName, codexCmd, sessionId, codexHomeOverride, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup, parentEnvFilePath);
2737
+ const resolvedEnvStateRoot = env.OMX_STATE_ROOT?.trim()
2738
+ ? resolveLaunchPath(cwd, env.OMX_STATE_ROOT.trim())
2739
+ : undefined;
2740
+ const hasExplicitRootOverride = Boolean(env.OMX_ROOT?.trim()
2741
+ || (omxRootOverride && omxRootOverride !== resolvedEnvStateRoot));
2742
+ const hudRuntimeRoot = env.OMX_TEAM_STATE_ROOT?.trim()
2743
+ ? resolveHudRuntimeRootForLaunch(cwd, env)
2744
+ : hasExplicitRootOverride
2745
+ ? {
2746
+ omxRoot: omxRootOverride,
2747
+ rootSource: resolveHudRuntimeRootSource(omxRootOverride, env),
2748
+ }
2749
+ : resolveHudRuntimeRootForLaunch(cwd, env);
2750
+ const hudRuntimeEnv = buildHudRuntimeEnv({
2751
+ sessionId,
2752
+ ...hudRuntimeRoot,
2753
+ }).env;
2754
+ const newSessionArgs = [
2755
+ "new-session",
2756
+ "-d",
2757
+ "-P",
2758
+ "-F",
2759
+ "#{pane_id}",
2760
+ "-s",
2761
+ sessionName,
2762
+ "-c",
2763
+ cwd,
2764
+ ...(workerLaunchArgs
2765
+ ? ["-e", `${TEAM_WORKER_LAUNCH_ARGS_ENV}=${workerLaunchArgs}`]
2766
+ : []),
2767
+ ...Object.entries(hudRuntimeEnv).map(([key, value]) => ["-e", `${key}=${value}`]).flat(),
2768
+ ...(codexHomeOverride ? ["-e", `CODEX_HOME=${codexHomeOverride}`] : []),
2769
+ ...(sqliteHomeOverride ? ["-e", `${CODEX_SQLITE_HOME_ENV}=${sqliteHomeOverride}`] : []),
2770
+ ...(env.OMXBOX_ACTIVE ? ["-e", `OMXBOX_ACTIVE=${env.OMXBOX_ACTIVE}`] : []),
2771
+ ...(env.OMX_SOURCE_CWD ? ["-e", `OMX_SOURCE_CWD=${env.OMX_SOURCE_CWD}`] : []),
2772
+ ...(notifyTempContractRaw
2773
+ ? ["-e", `${OMX_NOTIFY_TEMP_CONTRACT_ENV}=${notifyTempContractRaw}`]
2774
+ : []),
2775
+ detachedLeaderCmd,
2776
+ ];
2777
+ const splitCaptureArgs = [
2778
+ "split-window",
2779
+ "-v",
2780
+ "-l",
2781
+ String(HUD_TMUX_HEIGHT_LINES),
2782
+ "-d",
2783
+ "-t",
2784
+ sessionName,
2785
+ "-c",
2786
+ cwd,
2787
+ "-P",
2788
+ "-F",
2789
+ "#{pane_id}",
2790
+ hudCmd,
2791
+ ];
2792
+ return [
2793
+ { name: "new-session", args: newSessionArgs },
2794
+ ...(sessionId
2795
+ ? [
2796
+ {
2797
+ name: "tag-session",
2798
+ args: ["set-option", "-t", sessionName, OMX_INSTANCE_OPTION, sessionId],
2799
+ },
2800
+ ]
2801
+ : []),
2802
+ { name: "split-and-capture-hud-pane", args: splitCaptureArgs },
2803
+ ];
2804
+ }
2805
+ async function readLaunchAppendInstructions() {
2806
+ const appendixCandidates = [
2807
+ process.env[OMX_RALPH_APPEND_INSTRUCTIONS_FILE_ENV]?.trim(),
2808
+ process.env[OMX_AUTORESEARCH_APPEND_INSTRUCTIONS_FILE_ENV]?.trim(),
2809
+ ].filter((value) => typeof value === "string" && value.length > 0);
2810
+ if (appendixCandidates.length === 0)
2811
+ return "";
2812
+ const appendixPath = appendixCandidates[0];
2813
+ if (!existsSync(appendixPath)) {
2814
+ throw new Error(`launch instructions file not found: ${appendixPath}`);
2815
+ }
2816
+ const { readFile } = await import("fs/promises");
2817
+ return (await readFile(appendixPath, "utf-8")).trim();
2818
+ }
2819
+ export function shouldAttachDetachedTmuxSession(env = process.env) {
2820
+ return env.OMX_HERMES_MCP_BRIDGE !== "1";
2821
+ }
2822
+ function stripHermesMcpBridgeEnv(env) {
2823
+ const { OMX_HERMES_MCP_BRIDGE: _bridge, ...rest } = env;
2824
+ return rest;
2825
+ }
2826
+ export function buildDetachedSessionFinalizeSteps(sessionName, hudPaneId, hookWindowIndex, enableMouse, nativeWindows = false, attachSession = true, leaderPaneId = null) {
2827
+ const steps = [];
2828
+ if (!nativeWindows && leaderPaneId) {
2829
+ steps.push({
2830
+ name: "register-detached-history-prune-hook",
2831
+ args: [
2832
+ "set-hook",
2833
+ "-t",
2834
+ sessionName,
2835
+ buildDetachedHistoryPruneHookSlot(sessionName, leaderPaneId),
2836
+ buildDetachedHistoryPruneHookCommand(leaderPaneId),
2837
+ ],
2838
+ });
2839
+ }
2840
+ if (!nativeWindows && hudPaneId && hookWindowIndex) {
2841
+ const hookTarget = buildResizeHookTarget(sessionName, hookWindowIndex);
2842
+ const hookName = buildResizeHookName("launch", sessionName, hookWindowIndex, hudPaneId);
2843
+ const clientAttachedHookName = buildClientAttachedReconcileHookName("launch", sessionName, hookWindowIndex, hudPaneId);
2844
+ steps.push({
2845
+ name: "register-resize-hook",
2846
+ args: buildRegisterResizeHookArgs(hookTarget, hookName, hudPaneId, HUD_TMUX_HEIGHT_LINES),
2847
+ });
2848
+ steps.push({
2849
+ name: "register-client-attached-reconcile",
2850
+ args: buildRegisterClientAttachedReconcileArgs(hookTarget, clientAttachedHookName, hudPaneId, HUD_TMUX_HEIGHT_LINES),
2851
+ });
2852
+ steps.push({
2853
+ name: "schedule-delayed-resize",
2854
+ args: buildScheduleDelayedHudResizeArgs(hudPaneId, undefined, HUD_TMUX_HEIGHT_LINES),
2855
+ });
2856
+ steps.push({
2857
+ name: "reconcile-hud-resize",
2858
+ args: buildReconcileHudResizeArgs(hudPaneId, HUD_TMUX_HEIGHT_LINES),
2859
+ });
2860
+ }
2861
+ if (enableMouse) {
2862
+ steps.push({
2863
+ name: "set-mouse",
2864
+ args: ["set-option", "-t", sessionName, "mouse", "on"],
2865
+ });
2866
+ steps.push({
2867
+ name: "sanitize-copy-mode-style",
2868
+ args: [],
2869
+ });
2870
+ }
2871
+ if (attachSession) {
2872
+ steps.push({
2873
+ name: "attach-session",
2874
+ args: ["attach-session", "-t", sessionName],
2875
+ });
2876
+ }
2877
+ return steps;
2878
+ }
2879
+ export function buildDetachedSessionRollbackSteps(sessionName, hookTarget, hookName, clientAttachedHookName) {
2880
+ const steps = [];
2881
+ if (hookTarget && clientAttachedHookName) {
2882
+ steps.push({
2883
+ name: "unregister-client-attached-reconcile",
2884
+ args: buildUnregisterClientAttachedReconcileArgs(hookTarget, clientAttachedHookName),
2885
+ });
2886
+ }
2887
+ if (hookTarget && hookName) {
2888
+ steps.push({
2889
+ name: "unregister-resize-hook",
2890
+ args: buildUnregisterResizeHookArgs(hookTarget, hookName),
2891
+ });
2892
+ }
2893
+ steps.push({
2894
+ name: "kill-session",
2895
+ args: ["kill-session", "-t", sessionName],
2896
+ });
2897
+ return steps;
2898
+ }
2899
+ export function buildNotifyTempStartupMessages(contract, hasValidProviders) {
2900
+ const providers = contract.canonicalSelectors.length > 0
2901
+ ? contract.canonicalSelectors.join(",")
2902
+ : "none";
2903
+ const infoLines = [
2904
+ `notify temp: active | providers=${providers} | persistent-routing=bypassed`,
2905
+ ];
2906
+ const warningLines = [...contract.warnings];
2907
+ if (!hasValidProviders) {
2908
+ warningLines.push("notify temp: no valid providers resolved; notifications skipped");
2909
+ }
2910
+ return { infoLines, warningLines };
2911
+ }
2912
+ export function buildNotifyFallbackWatcherEnv(env = process.env, options = {}) {
2913
+ const nextEnv = { ...env };
2914
+ delete nextEnv.TMUX;
2915
+ delete nextEnv.TMUX_PANE;
2916
+ return {
2917
+ ...nextEnv,
2918
+ ...(options.codexHomeOverride ? { CODEX_HOME: options.codexHomeOverride } : {}),
2919
+ ...(options.omxRootOverride ? { OMX_ROOT: options.omxRootOverride } : {}),
2920
+ ...(options.sessionId ? { OMX_SESSION_ID: options.sessionId } : {}),
2921
+ OMX_HUD_AUTHORITY: options.enableAuthority ? "1" : "0",
2922
+ };
2923
+ }
2924
+ export function shouldEnableNotifyFallbackWatcher(env = process.env, platform = process.platform) {
2925
+ const toggle = String(env.OMX_NOTIFY_FALLBACK ?? "").trim();
2926
+ if (platform === "win32") {
2927
+ return toggle === "1";
2928
+ }
2929
+ return toggle !== "0";
2930
+ }
2931
+ export async function cleanupLaunchOrphanedMcpProcesses(dependencies = {}) {
2932
+ return cleanupOmxMcpProcesses([], {
2933
+ ...dependencies,
2934
+ selectCandidates: dependencies.selectCandidates ?? findLaunchSafeCleanupCandidates,
2935
+ writeLine: dependencies.writeLine ?? (() => { }),
2936
+ });
2937
+ }
2938
+ const POST_LAUNCH_MODE_STATE_RETRY_DELAY_MS = 10;
2939
+ const POST_LAUNCH_MODE_STATE_MAX_READ_ATTEMPTS = 2;
2940
+ function isLikelyTransientModeStateParseFailure(raw, err) {
2941
+ const trimmed = raw.trim();
2942
+ if (trimmed.length === 0)
2943
+ return true;
2944
+ if (!(err instanceof SyntaxError))
2945
+ return false;
2946
+ if (!trimmed.startsWith("{") || trimmed.endsWith("}"))
2947
+ return false;
2948
+ return (/Unexpected end of JSON input/.test(err.message) ||
2949
+ /Unterminated string in JSON/.test(err.message) ||
2950
+ /Expected double-quoted property name in JSON/.test(err.message) ||
2951
+ /Expected property name or '}' in JSON/.test(err.message) ||
2952
+ /Expected ':' after property name in JSON/.test(err.message) ||
2953
+ /Expected ',' or '}' after property value in JSON/.test(err.message));
2954
+ }
2955
+ async function readPostLaunchModeStateFile(path, dependencies = {}) {
2956
+ const readFile = dependencies.readFile ?? (await import("fs/promises")).readFile;
2957
+ const sleep = dependencies.sleep
2958
+ ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
2959
+ for (let attempt = 1; attempt <= POST_LAUNCH_MODE_STATE_MAX_READ_ATTEMPTS; attempt += 1) {
2960
+ try {
2961
+ const raw = await readFile(path, "utf-8");
2962
+ const trimmed = raw.trim();
2963
+ if (trimmed.length === 0) {
2964
+ if (attempt < POST_LAUNCH_MODE_STATE_MAX_READ_ATTEMPTS) {
2965
+ await sleep(POST_LAUNCH_MODE_STATE_RETRY_DELAY_MS);
2966
+ continue;
2967
+ }
2968
+ return { kind: "recoverable" };
2969
+ }
2970
+ let parsed;
2971
+ try {
2972
+ parsed = JSON.parse(raw);
2973
+ }
2974
+ catch (err) {
2975
+ if (isLikelyTransientModeStateParseFailure(raw, err)) {
2976
+ if (attempt < POST_LAUNCH_MODE_STATE_MAX_READ_ATTEMPTS) {
2977
+ await sleep(POST_LAUNCH_MODE_STATE_RETRY_DELAY_MS);
2978
+ continue;
2979
+ }
2980
+ return { kind: "recoverable" };
2981
+ }
2982
+ return {
2983
+ kind: "malformed",
2984
+ message: err instanceof Error ? err.message : String(err),
2985
+ };
2986
+ }
2987
+ if (!parsed || Array.isArray(parsed) || typeof parsed !== "object") {
2988
+ return { kind: "malformed", message: "mode state must be a JSON object" };
2989
+ }
2990
+ return { kind: "ok", state: parsed };
2991
+ }
2992
+ catch (err) {
2993
+ const error = err;
2994
+ if (error?.code === "ENOENT")
2995
+ return { kind: "missing" };
2996
+ return {
2997
+ kind: "malformed",
2998
+ message: err instanceof Error ? err.message : String(err),
2999
+ };
3000
+ }
3001
+ }
3002
+ return { kind: "recoverable" };
3003
+ }
3004
+ function cleanPostLaunchString(value) {
3005
+ return typeof value === "string" ? value.trim() : "";
3006
+ }
3007
+ function isAutopilotReviewPendingPostLaunchState(state) {
3008
+ if (!state || state.active !== true)
3009
+ return false;
3010
+ const mode = cleanPostLaunchString(state.mode).toLowerCase();
3011
+ if (mode && mode !== "autopilot")
3012
+ return false;
3013
+ const phase = cleanPostLaunchString(state.current_phase ?? state.currentPhase)
3014
+ .toLowerCase()
3015
+ .replace(/_/g, "-");
3016
+ if (phase === "code-review" || phase === "review" || phase === "reviewing" || phase === "review-pending") {
3017
+ return true;
3018
+ }
3019
+ const nestedState = state.state && typeof state.state === "object"
3020
+ ? state.state
3021
+ : {};
3022
+ return state.review_pending === true
3023
+ || state.reviewPending === true
3024
+ || nestedState.review_pending === true
3025
+ || nestedState.reviewPending === true;
3026
+ }
3027
+ function postLaunchUniqueStrings(values) {
3028
+ return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
3029
+ }
3030
+ async function scrubPostLaunchRootSkillActiveForSession(stateDir, sessionId, nowIso, writeFileFn, rootStateBeforeCleanup) {
3031
+ const normalizedSessionId = cleanPostLaunchString(sessionId);
3032
+ if (!normalizedSessionId)
3033
+ return;
3034
+ const { rootPath } = getSkillActiveStatePathsForStateDir(stateDir);
3035
+ const rootState = rootStateBeforeCleanup ?? await readSkillActiveState(rootPath);
3036
+ if (!rootState)
3037
+ return;
3038
+ const rootSessionIds = postLaunchUniqueStrings([
3039
+ cleanPostLaunchString(rootState.session_id),
3040
+ cleanPostLaunchString(extractSessionIdFromInitializedStatePath(rootState.initialized_state_path)),
3041
+ ]);
3042
+ const rootBelongsToSession = rootSessionIds.includes(normalizedSessionId);
3043
+ const entries = listActiveSkills(rootState);
3044
+ const keptEntries = entries.filter((entry) => {
3045
+ const entrySessionId = cleanPostLaunchString(entry.session_id);
3046
+ if (entrySessionId)
3047
+ return entrySessionId !== normalizedSessionId;
3048
+ return !rootBelongsToSession;
3049
+ });
3050
+ if (keptEntries.length === entries.length && rootState.active !== true)
3051
+ return;
3052
+ if (keptEntries.length === entries.length && !rootBelongsToSession)
3053
+ return;
3054
+ const nextRoot = {
3055
+ ...rootState,
3056
+ active: keptEntries.length > 0,
3057
+ skill: keptEntries[0]?.skill ?? (keptEntries.length > 0 ? cleanPostLaunchString(rootState.skill) : ""),
3058
+ phase: keptEntries[0]?.phase ?? (keptEntries.length > 0 ? cleanPostLaunchString(rootState.phase) : "complete"),
3059
+ updated_at: nowIso,
3060
+ active_skills: keptEntries,
3061
+ post_launch_reconciled_at: nowIso,
3062
+ post_launch_reconciliation_reason: "terminal_session_cleanup",
3063
+ };
3064
+ await writeFileFn(rootPath, JSON.stringify(nextRoot, null, 2));
3065
+ }
3066
+ function buildRecoveredPostLaunchModeState(mode, completedAt) {
3067
+ return {
3068
+ active: false,
3069
+ mode,
3070
+ current_phase: "cancelled",
3071
+ completed_at: completedAt,
3072
+ last_turn_at: completedAt,
3073
+ };
3074
+ }
3075
+ function buildRecoveredPostLaunchSkillActiveState(completedAt) {
3076
+ return {
3077
+ version: 1,
3078
+ active: false,
3079
+ skill: "",
3080
+ phase: "complete",
3081
+ updated_at: completedAt,
3082
+ active_skills: [],
3083
+ };
3084
+ }
3085
+ function markRalphCompletionAuditBlockedForPostLaunch(state, cwd, nowIso) {
3086
+ if (!isRalphCompletePhase(state.current_phase ?? state.currentPhase))
3087
+ return false;
3088
+ const audit = evaluateRalphCompletionAuditEvidence(state, cwd);
3089
+ if (audit.complete)
3090
+ return false;
3091
+ state.active = false;
3092
+ state.current_phase = "cancelled";
3093
+ state.completed_at = nowIso;
3094
+ state.last_turn_at = nowIso;
3095
+ state.interrupted_at = nowIso;
3096
+ state.stop_reason = `missing_completion_audit:${audit.reason}`;
3097
+ state.completion_audit_gate = "blocked";
3098
+ state.completion_audit_missing_reason = audit.reason;
3099
+ state.completion_audit_blocked_at = nowIso;
3100
+ return true;
3101
+ }
3102
+ export async function cleanupPostLaunchModeStateFiles(cwd, sessionId, dependencies = {}) {
3103
+ const readdir = dependencies.readdir ?? (await import("fs/promises")).readdir;
3104
+ const writeFile = dependencies.writeFile ?? (await import("fs/promises")).writeFile;
3105
+ const writeWarn = dependencies.writeWarn ?? console.warn;
3106
+ const now = dependencies.now ?? (() => new Date());
3107
+ const scopedDirs = sessionId
3108
+ ? [getStateDir(cwd, sessionId)]
3109
+ : [getBaseStateDir(cwd)];
3110
+ const rootStateDir = getBaseStateDir(cwd);
3111
+ const rootSkillActiveStateBeforeCleanup = sessionId
3112
+ ? await readSkillActiveState(getSkillActiveStatePathsForStateDir(rootStateDir).rootPath)
3113
+ : null;
3114
+ let preserveSkillActiveForReviewPendingAutopilot = false;
3115
+ for (const stateDir of scopedDirs) {
3116
+ const files = await readdir(stateDir).catch(() => []);
3117
+ const autopilotPath = join(stateDir, "autopilot-state.json");
3118
+ const autopilotPrecheck = files.includes("autopilot-state.json")
3119
+ ? await readPostLaunchModeStateFile(autopilotPath, dependencies)
3120
+ : null;
3121
+ const preserveReviewPendingAutopilot = autopilotPrecheck?.kind === "ok"
3122
+ && isAutopilotReviewPendingPostLaunchState(autopilotPrecheck.state);
3123
+ preserveSkillActiveForReviewPendingAutopilot ||= preserveReviewPendingAutopilot;
3124
+ for (const file of files) {
3125
+ if (!file.endsWith("-state.json") || file === "session.json")
3126
+ continue;
3127
+ const path = join(stateDir, file);
3128
+ const mode = file.slice(0, -"-state.json".length);
3129
+ const result = await readPostLaunchModeStateFile(path, dependencies);
3130
+ if (result.kind !== "ok") {
3131
+ if (result.kind === "recoverable") {
3132
+ try {
3133
+ const completedAt = now().toISOString();
3134
+ await writeFile(path, JSON.stringify(mode === SKILL_ACTIVE_STATE_MODE
3135
+ ? buildRecoveredPostLaunchSkillActiveState(completedAt)
3136
+ : buildRecoveredPostLaunchModeState(mode, completedAt), null, 2));
3137
+ if (isTrackedWorkflowMode(mode)) {
3138
+ await syncCanonicalSkillStateForMode({
3139
+ cwd,
3140
+ baseStateDir: rootStateDir,
3141
+ mode,
3142
+ active: false,
3143
+ currentPhase: "cancelled",
3144
+ sessionId: stateDir === getStateDir(cwd, sessionId) ? sessionId : undefined,
3145
+ nowIso: completedAt,
3146
+ source: "postLaunchCleanup",
3147
+ });
3148
+ }
3149
+ }
3150
+ catch (err) {
3151
+ writeWarn(`[omx] postLaunch: failed to recover mode state ${path}: ${err instanceof Error ? err.message : err}`);
3152
+ }
3153
+ }
3154
+ else if (result.kind === "malformed") {
3155
+ writeWarn(`[omx] postLaunch: skipped malformed mode state ${path}: ${result.message}`);
3156
+ }
3157
+ continue;
3158
+ }
3159
+ const skillStateStillVisible = mode === SKILL_ACTIVE_STATE_MODE
3160
+ && Array.isArray(result.state.active_skills)
3161
+ && result.state.active_skills.length > 0;
3162
+ if (result.state.active !== true && !skillStateStillVisible) {
3163
+ if (mode === "ralph") {
3164
+ const completedAt = now().toISOString();
3165
+ if (markRalphCompletionAuditBlockedForPostLaunch(result.state, cwd, completedAt)) {
3166
+ await writeFile(path, JSON.stringify(result.state, null, 2));
3167
+ await syncCanonicalSkillStateForMode({
3168
+ cwd,
3169
+ baseStateDir: rootStateDir,
3170
+ mode,
3171
+ active: false,
3172
+ currentPhase: "cancelled",
3173
+ sessionId: stateDir === getStateDir(cwd, sessionId) ? sessionId : undefined,
3174
+ nowIso: completedAt,
3175
+ source: "postLaunchCleanup",
3176
+ });
3177
+ }
3178
+ }
3179
+ continue;
3180
+ }
3181
+ if (preserveReviewPendingAutopilot
3182
+ && (mode === "autopilot" || mode === SKILL_ACTIVE_STATE_MODE)) {
3183
+ continue;
3184
+ }
3185
+ try {
3186
+ const completedAt = now().toISOString();
3187
+ if (mode === SKILL_ACTIVE_STATE_MODE) {
3188
+ result.state.active = false;
3189
+ result.state.phase = "complete";
3190
+ result.state.updated_at = completedAt;
3191
+ result.state.active_skills = [];
3192
+ await writeFile(path, JSON.stringify(result.state, null, 2));
3193
+ continue;
3194
+ }
3195
+ result.state.active = false;
3196
+ result.state.current_phase = "cancelled";
3197
+ result.state.completed_at = completedAt;
3198
+ if (mode === "ralph") {
3199
+ result.state.interrupted_at = completedAt;
3200
+ result.state.stop_reason = cleanPostLaunchString(result.state.stop_reason) || "session_exit";
3201
+ }
3202
+ await writeFile(path, JSON.stringify(result.state, null, 2));
3203
+ if (isTrackedWorkflowMode(mode)) {
3204
+ await syncCanonicalSkillStateForMode({
3205
+ cwd,
3206
+ baseStateDir: rootStateDir,
3207
+ mode,
3208
+ active: false,
3209
+ currentPhase: "cancelled",
3210
+ sessionId: stateDir === getStateDir(cwd, sessionId) ? sessionId : undefined,
3211
+ nowIso: completedAt,
3212
+ source: "postLaunchCleanup",
3213
+ });
3214
+ }
3215
+ }
3216
+ catch (err) {
3217
+ writeWarn(`[omx] postLaunch: failed to update mode state ${path}: ${err instanceof Error ? err.message : err}`);
3218
+ }
3219
+ }
3220
+ }
3221
+ if (sessionId) {
3222
+ try {
3223
+ if (!preserveSkillActiveForReviewPendingAutopilot) {
3224
+ await scrubPostLaunchRootSkillActiveForSession(rootStateDir, sessionId, now().toISOString(), writeFile, rootSkillActiveStateBeforeCleanup);
3225
+ }
3226
+ }
3227
+ catch (err) {
3228
+ writeWarn(`[omx] postLaunch: failed to reconcile root skill-active state: ${err instanceof Error ? err.message : err}`);
3229
+ }
3230
+ }
3231
+ }
3232
+ export async function reapPostLaunchOrphanedMcpProcesses(dependencies = {}) {
3233
+ const cleanup = dependencies.cleanup ?? cleanupLaunchOrphanedMcpProcesses;
3234
+ const writeInfo = dependencies.writeInfo ?? console.log;
3235
+ const writeWarn = dependencies.writeWarn ?? console.warn;
3236
+ const writeError = dependencies.writeError ?? ((line) => process.stderr.write(line));
3237
+ try {
3238
+ const result = await cleanup();
3239
+ if (result.terminatedCount > 0) {
3240
+ writeInfo(`[omx] postLaunch: reaped ${result.terminatedCount} orphaned OMX MCP process(es).`);
3241
+ }
3242
+ if (result.failedPids.length > 0) {
3243
+ writeWarn(`[omx] postLaunch: failed to reap ${result.failedPids.length} orphaned OMX MCP process(es); continuing cleanup.`);
3244
+ }
3245
+ }
3246
+ catch (err) {
3247
+ writeError(`[cli/index] postLaunch MCP cleanup failed: ${err}\n`);
3248
+ }
3249
+ }
3250
+ /**
3251
+ * preLaunch: Prepare environment before Codex starts.
3252
+ * 1. Best-effort launch-safe orphan cleanup for detached OMX MCP processes
3253
+ * 2. Generate runtime overlay + write session-scoped model instructions file
3254
+ * 3. Write session.json
3255
+ *
3256
+ * Automatic broad stale-session cleanup remains disabled here. Only detached
3257
+ * OMX MCP processes without a live Codex ancestor are reaped so new launches
3258
+ * do not accumulate stale processes from prior crashed/closed sessions.
3259
+ */
3260
+ export async function preLaunch(cwd, sessionId, notifyTempContract, codexHomeOverride, enableNotifyFallbackAuthority = false, worktreeDirty = false) {
3261
+ // 1. Best-effort launch-safe orphan cleanup
3262
+ try {
3263
+ const cleanup = await cleanupLaunchOrphanedMcpProcesses();
3264
+ if (cleanup.terminatedCount > 0) {
3265
+ console.log(`[omx] Reaped ${cleanup.terminatedCount} orphaned OMX MCP process(es) before launch.`);
3266
+ }
3267
+ if (cleanup.failedPids.length > 0) {
3268
+ console.warn(`[omx] Failed to reap ${cleanup.failedPids.length} orphaned OMX MCP process(es); continuing launch.`);
3269
+ }
3270
+ }
3271
+ catch (err) {
3272
+ logCliOperationFailure(err);
3273
+ // Non-fatal
3274
+ }
3275
+ // 2. Generate runtime overlay + write session-scoped model instructions file
3276
+ const orchestrationMode = await resolveSessionOrchestrationMode(cwd, sessionId);
3277
+ const overlay = await generateOverlay(cwd, sessionId, { orchestrationMode });
3278
+ const launchAppendix = await readLaunchAppendInstructions();
3279
+ const dirtyWorktreeGuidance = worktreeDirty
3280
+ ? `\n\n## Session start: dirty worktree detected\n\nThis worktree has uncommitted changes that were present when the session launched.\nBefore executing the requested task, resolve the dirty state first:\n1. Review uncommitted changes with \`git status\` and \`git diff\`.\n2. Commit, stash, or discard changes as appropriate.\n3. Then proceed with the original task.`
3281
+ : "";
3282
+ const sessionInstructions = launchAppendix.trim().length > 0
3283
+ ? `${overlay}
3284
+
3285
+ ${launchAppendix}${dirtyWorktreeGuidance}`
3286
+ : `${overlay}${dirtyWorktreeGuidance}`;
3287
+ await writeSessionModelInstructionsFile(cwd, sessionId, sessionInstructions);
3288
+ // 3. Write session state
3289
+ await resetSessionMetrics(cwd, sessionId);
3290
+ await writeSessionStart(cwd, sessionId);
3291
+ tagCurrentTmuxSessionWithInstance(sessionId);
3292
+ // 4. Start notify fallback watcher (best effort)
3293
+ try {
3294
+ await startNotifyFallbackWatcher(cwd, { codexHomeOverride, enableAuthority: enableNotifyFallbackAuthority, sessionId });
3295
+ }
3296
+ catch (err) {
3297
+ logCliOperationFailure(err);
3298
+ // Non-fatal
3299
+ }
3300
+ // 5. Start derived watcher (best effort, opt-in)
3301
+ try {
3302
+ await startHookDerivedWatcher(cwd);
3303
+ }
3304
+ catch (err) {
3305
+ logCliOperationFailure(err);
3306
+ // Non-fatal
3307
+ }
3308
+ // 6. Emit temp notification startup summary + warnings, then send session-start lifecycle notification (best effort)
3309
+ try {
3310
+ if (notifyTempContract?.active) {
3311
+ process.env[OMX_NOTIFY_TEMP_CONTRACT_ENV] =
3312
+ serializeNotifyTempContract(notifyTempContract);
3313
+ const { getNotificationConfig } = await import("../notifications/config.js");
3314
+ const resolved = getNotificationConfig();
3315
+ const startup = buildNotifyTempStartupMessages(notifyTempContract, Boolean(resolved?.enabled));
3316
+ for (const info of startup.infoLines) {
3317
+ console.log(`[omx] ${info}`);
3318
+ }
3319
+ for (const warning of startup.warningLines) {
3320
+ console.warn(`[omx] ${warning}`);
3321
+ }
3322
+ }
3323
+ else {
3324
+ delete process.env[OMX_NOTIFY_TEMP_CONTRACT_ENV];
3325
+ }
3326
+ const { notifyLifecycle } = await import("../notifications/index.js");
3327
+ await notifyLifecycle("session-start", {
3328
+ sessionId,
3329
+ projectPath: cwd,
3330
+ projectName: basename(cwd),
3331
+ });
3332
+ }
3333
+ catch (err) {
3334
+ logCliOperationFailure(err);
3335
+ // Non-fatal: notification failures must never block launch
3336
+ }
3337
+ // 7. Dispatch native hook event (best effort)
3338
+ try {
3339
+ await emitNativeHookEvent(cwd, "session-start", {
3340
+ session_id: sessionId,
3341
+ context: buildNativeHookBaseContext(cwd, sessionId, "started", {
3342
+ project_path: cwd,
3343
+ project_name: basename(cwd),
3344
+ status: "started",
3345
+ }),
3346
+ });
3347
+ }
3348
+ catch (err) {
3349
+ logCliOperationFailure(err);
3350
+ // Non-fatal
3351
+ }
3352
+ }
3353
+ /**
3354
+ * runCodex: Launch Codex CLI (blocks until exit).
3355
+ * All 3 paths (new tmux, existing tmux, no tmux) block via execSync/execFileSync.
3356
+ */
3357
+ function runCodex(cwd, args, sessionId, workerDefaultModel, codexHomeOverride, sqliteHomeOverride, notifyTempContractRaw, explicitLaunchPolicy, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup) {
3358
+ const launchArgs = injectModelInstructionsBypassArgs(cwd, args, process.env, sessionModelInstructionsPath(cwd, sessionId));
3359
+ const nativeWindows = isNativeWindows();
3360
+ const omxBin = resolveOmxCliEntryPath({ argv1: process.argv[1], cwd, env: process.env });
3361
+ if (!omxBin) {
3362
+ throw new Error("Unable to resolve OMX launcher path for tmux HUD bootstrap");
3363
+ }
3364
+ const omxRootOverride = resolveOmxRootForLaunch(cwd, process.env);
3365
+ const currentPaneId = process.env.TMUX_PANE;
3366
+ const hudRuntimeRoot = resolveHudRuntimeRootForLaunch(cwd, process.env);
3367
+ const hudEnvArgs = Object.entries(buildHudRuntimeEnv({
3368
+ sessionId,
3369
+ leaderPaneId: currentPaneId,
3370
+ ...hudRuntimeRoot,
3371
+ }).env).map(([key, value]) => `${key}=${value}`);
3372
+ const hudCmd = nativeWindows
3373
+ ? buildWindowsPromptCommand("node", [omxBin, "hud", "--watch"])
3374
+ : buildTmuxPaneCommand("env", [...hudEnvArgs, "node", omxBin, "hud", "--watch"]);
3375
+ const inheritLeaderFlags = process.env[TEAM_INHERIT_LEADER_FLAGS_ENV] !== "0";
3376
+ const workerLaunchArgs = resolveTeamWorkerLaunchArgsEnv(process.env[TEAM_WORKER_LAUNCH_ARGS_ENV], launchArgs, inheritLeaderFlags, workerDefaultModel);
3377
+ const codexBaseEnv = prependOmxRuntimeCommandShimToEnv(cwd, {
3378
+ ...stripHermesMcpBridgeEnv(process.env),
3379
+ ...(codexHomeOverride ? { CODEX_HOME: codexHomeOverride } : {}),
3380
+ ...(sqliteHomeOverride ? { [CODEX_SQLITE_HOME_ENV]: sqliteHomeOverride } : {}),
3381
+ ...(omxRootOverride ? { OMX_ROOT: omxRootOverride } : {}),
3382
+ }, omxBin);
3383
+ const codexEnvWithSession = {
3384
+ ...codexBaseEnv,
3385
+ ...buildHudRuntimeEnv({ sessionId }).env,
3386
+ };
3387
+ const codexEnv = workerLaunchArgs
3388
+ ? { ...codexEnvWithSession, [TEAM_WORKER_LAUNCH_ARGS_ENV]: workerLaunchArgs }
3389
+ : codexEnvWithSession;
3390
+ const codexEnvWithNotify = notifyTempContractRaw
3391
+ ? { ...codexEnv, [OMX_NOTIFY_TEMP_CONTRACT_ENV]: notifyTempContractRaw }
3392
+ : codexEnv;
3393
+ const { launchPolicy } = resolveTmuxAwareLaunchPolicy(explicitLaunchPolicy, nativeWindows);
3394
+ if (isCodexVersionRequest(launchArgs)) {
3395
+ runCodexBlocking(cwd, launchArgs, codexEnvWithNotify);
3396
+ return { postLaunchHandledExternally: false };
3397
+ }
3398
+ if (launchPolicy === "inside-tmux") {
3399
+ // Already in tmux: launch codex in current pane, HUD in bottom split
3400
+ const currentWindowPanes = currentPaneId ? listCurrentWindowPanes(undefined, currentPaneId) : [];
3401
+ reapDeadHudPanes(currentWindowPanes, {
3402
+ killPane: (paneId) => {
3403
+ try {
3404
+ return killSharedTmuxPane(paneId);
3405
+ }
3406
+ catch (err) {
3407
+ logCliOperationFailure(err);
3408
+ return false;
3409
+ }
3410
+ },
3411
+ });
3412
+ const staleHudPaneIds = currentPaneId
3413
+ ? listHudWatchPaneIdsInCurrentWindow(currentPaneId, { sessionId, leaderPaneId: currentPaneId })
3414
+ : [];
3415
+ let hudPaneId = null;
3416
+ const [keeperHudPaneId, ...duplicateHudPaneIds] = staleHudPaneIds;
3417
+ for (const paneId of duplicateHudPaneIds) {
3418
+ killTmuxPane(paneId);
3419
+ }
3420
+ if (keeperHudPaneId) {
3421
+ hudPaneId = keeperHudPaneId;
3422
+ try {
3423
+ resizeTmuxPane(hudPaneId, HUD_TMUX_HEIGHT_LINES);
3424
+ registerInsideTmuxHudResizeHook({
3425
+ hudPaneId,
3426
+ currentPaneId,
3427
+ cwd,
3428
+ sessionId,
3429
+ omxRootOverride,
3430
+ });
3431
+ }
3432
+ catch (err) {
3433
+ logCliOperationFailure(err);
3434
+ }
3435
+ }
3436
+ else if (isExistingTmuxWindowTooCrampedForLaunchHud(readCurrentWindowSize(undefined, currentPaneId).height)) {
3437
+ // Existing tmux window is height-constrained: forcing a launch-time HUD
3438
+ // split here would steal rows from the Codex TUI and make the
3439
+ // transcript/input area unreadable. Skip the split at launch; the
3440
+ // prompt-submit reconcile path can add the HUD later when there is room.
3441
+ // (closes #2754)
3442
+ hudPaneId = null;
3443
+ }
3444
+ else {
3445
+ try {
3446
+ hudPaneId = createHudWatchPane(cwd, hudCmd, {
3447
+ heightLines: HUD_TMUX_HEIGHT_LINES,
3448
+ targetPaneId: currentPaneId,
3449
+ });
3450
+ registerInsideTmuxHudResizeHook({
3451
+ hudPaneId,
3452
+ currentPaneId,
3453
+ cwd,
3454
+ sessionId,
3455
+ omxRootOverride,
3456
+ });
3457
+ }
3458
+ catch (err) {
3459
+ logCliOperationFailure(err);
3460
+ // HUD split failed, continue without it
3461
+ }
3462
+ }
3463
+ // Enable mouse scrolling at session start so scroll works before team
3464
+ // expansion. Previously this was only called from createTeamSession().
3465
+ // Opt-out: set OMX_MOUSE=0. (closes #128)
3466
+ if (process.env.OMX_MOUSE !== "0") {
3467
+ try {
3468
+ const tmuxPaneTarget = process.env.TMUX_PANE;
3469
+ const displayArgs = tmuxPaneTarget
3470
+ ? ["display-message", "-p", "-t", tmuxPaneTarget, "#S"]
3471
+ : ["display-message", "-p", "#S"];
3472
+ const tmuxSession = execTmuxFileSync(displayArgs, {
3473
+ encoding: "utf-8",
3474
+ }).trim();
3475
+ if (tmuxSession)
3476
+ enableMouseScrolling(tmuxSession);
3477
+ }
3478
+ catch (err) {
3479
+ logCliOperationFailure(err);
3480
+ // Non-fatal: mouse scrolling is a convenience feature
3481
+ }
3482
+ }
3483
+ const activePaneId = process.env.TMUX_PANE?.trim();
3484
+ if (activePaneId) {
3485
+ try {
3486
+ execTmuxFileSync(["display-message", "-p", "-t", activePaneId, "#S"], {
3487
+ encoding: "utf-8",
3488
+ });
3489
+ }
3490
+ catch { }
3491
+ }
3492
+ try {
3493
+ withTmuxExtendedKeys(cwd, () => {
3494
+ runCodexBlocking(cwd, launchArgs, codexEnvWithNotify);
3495
+ });
3496
+ }
3497
+ finally {
3498
+ if (currentPaneId) {
3499
+ unregisterHudResizeHook(currentPaneId);
3500
+ }
3501
+ const cleanupPaneIds = buildHudPaneCleanupTargets(listHudWatchPaneIdsInCurrentWindow(currentPaneId, { sessionId, leaderPaneId: currentPaneId }), hudPaneId, currentPaneId);
3502
+ for (const paneId of cleanupPaneIds) {
3503
+ killTmuxPane(paneId);
3504
+ }
3505
+ }
3506
+ return { postLaunchHandledExternally: false };
3507
+ }
3508
+ else if (launchPolicy === "direct") {
3509
+ // Detached HUD sessions require tmux. Skip the bootstrap entirely when the
3510
+ // binary is unavailable so direct launches do not emit noisy ENOENT logs.
3511
+ runCodexBlocking(cwd, launchArgs, codexEnvWithNotify);
3512
+ return { postLaunchHandledExternally: false };
3513
+ }
3514
+ else {
3515
+ // Not in tmux: create a new tmux session with codex + HUD pane
3516
+ const codexCmd = buildTmuxPaneCommand("codex", launchArgs);
3517
+ const detachedWindowsCodexCmd = nativeWindows
3518
+ ? buildWindowsPromptCommand("codex", launchArgs)
3519
+ : null;
3520
+ const sessionName = buildDetachedTmuxSessionName(cwd, sessionId);
3521
+ const launchDetachedSession = () => {
3522
+ const contextKey = process.env[OMX_MADMAX_DETACHED_CONTEXT_ENV]?.trim();
3523
+ const runsRoot = resolveMadmaxRunsRoot(process.env);
3524
+ const activeRecordPath = contextKey
3525
+ ? madmaxDetachedActiveRecordPath(runsRoot, contextKey)
3526
+ : null;
3527
+ const activeRecord = activeRecordPath
3528
+ ? readMadmaxDetachedActiveRecord(activeRecordPath)
3529
+ : null;
3530
+ if (activeRecord &&
3531
+ activeRecord.context_key === contextKey &&
3532
+ isReusableMadmaxDetachedActiveRecord(activeRecord)) {
3533
+ cleanupCurrentMadmaxReuseRunRoot(process.env, runsRoot);
3534
+ setDetachedTmuxSessionHistoryLimit(activeRecord.tmux_session_name, activeRecord.tmux_pane_id);
3535
+ if (!shouldAttachDetachedTmuxSession(process.env)) {
3536
+ clearDetachedTmuxSessionHistoryIfUnattached(activeRecord.tmux_session_name, activeRecord.tmux_pane_id);
3537
+ process.stderr.write(`[omx] madmax detached launch already active for this context; reusing ${activeRecord.tmux_session_name} without attaching because this launch is a Hermes MCP bridge.\n`);
3538
+ return { postLaunchHandledExternally: true };
3539
+ }
3540
+ process.stderr.write(`[omx] madmax detached launch already active for this context; attaching ${activeRecord.tmux_session_name} instead of starting a duplicate.\n`);
3541
+ try {
3542
+ execTmuxFileSync(["attach-session", "-t", activeRecord.tmux_session_name], {
3543
+ stdio: "inherit",
3544
+ });
3545
+ }
3546
+ catch (err) {
3547
+ logCliOperationFailure(err);
3548
+ throw new MadmaxDetachedReuseError(`refusing duplicate madmax detached launch: existing session ${activeRecord.tmux_session_name} is active but attach failed`);
3549
+ }
3550
+ return { postLaunchHandledExternally: true };
3551
+ }
3552
+ if (activeRecordPath && activeRecord) {
3553
+ rmSync(activeRecordPath, { force: true });
3554
+ }
3555
+ let detachedSessionBindingWrite = Promise.resolve();
3556
+ const writeDetachedSessionBinding = (tmuxPaneId) => {
3557
+ detachedSessionBindingWrite = detachedSessionBindingWrite
3558
+ .catch((err) => {
3559
+ logCliOperationFailure(err);
3560
+ })
3561
+ .then(() => writeSessionStart(cwd, sessionId, {
3562
+ tmuxSessionName: sessionName,
3563
+ ...(tmuxPaneId ? { tmuxPaneId } : {}),
3564
+ }));
3565
+ void detachedSessionBindingWrite.catch((err) => {
3566
+ logCliOperationFailure(err);
3567
+ // Non-fatal: managed tmux recovery can still use compatibility fallback.
3568
+ });
3569
+ };
3570
+ writeDetachedSessionBinding();
3571
+ let createdDetachedSession = false;
3572
+ let registeredHookTarget = null;
3573
+ let registeredHookName = null;
3574
+ let registeredClientAttachedHookName = null;
3575
+ let detachedParentEnvFilePath;
3576
+ let detachedLeaderPaneId = null;
3577
+ try {
3578
+ // This path is the user-shell interactive launch: OMX creates a tmux
3579
+ // session and immediately attaches the user's terminal to it. If a tmux
3580
+ // server already exists, `new-session -e` only forwards explicit values,
3581
+ // so provider-specific parent-shell keys would disappear. Source a
3582
+ // private env file inside the leader shell instead of putting every
3583
+ // parent env value on the tmux command line or in logs.
3584
+ if (!nativeWindows) {
3585
+ detachedParentEnvFilePath = writeDetachedSessionParentEnvFile(cwd, sessionId, codexEnvWithNotify);
3586
+ }
3587
+ const bootstrapSteps = buildDetachedSessionBootstrapSteps(sessionName, cwd, codexCmd, hudCmd, workerLaunchArgs, codexHomeOverride, notifyTempContractRaw, nativeWindows, sessionId, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup, omxRootOverride, process.env, sqliteHomeOverride, detachedParentEnvFilePath);
3588
+ for (const step of bootstrapSteps) {
3589
+ const output = execTmuxFileSync(step.args, {
3590
+ stdio: "pipe",
3591
+ encoding: "utf-8",
3592
+ });
3593
+ if (step.name === "new-session") {
3594
+ createdDetachedSession = true;
3595
+ const leaderPaneId = parsePaneIdFromTmuxOutput(output || "");
3596
+ if (leaderPaneId) {
3597
+ detachedLeaderPaneId = leaderPaneId;
3598
+ setDetachedTmuxSessionHistoryLimit(sessionName, leaderPaneId);
3599
+ if (activeRecordPath && contextKey) {
3600
+ writeMadmaxDetachedActiveRecord(activeRecordPath, {
3601
+ version: 1,
3602
+ context_key: contextKey,
3603
+ created_at: new Date().toISOString(),
3604
+ source_cwd: process.env.OMX_SOURCE_CWD || cwd,
3605
+ argv: args,
3606
+ run_dir: process.env.OMX_ROOT || cwd,
3607
+ tmux_session_name: sessionName,
3608
+ session_id: sessionId,
3609
+ tmux_pane_id: leaderPaneId,
3610
+ });
3611
+ }
3612
+ writeDetachedSessionBinding(leaderPaneId);
3613
+ }
3614
+ }
3615
+ if (step.name === "split-and-capture-hud-pane") {
3616
+ const hudPaneId = parsePaneIdFromTmuxOutput(output || "");
3617
+ const hookWindowIndex = hudPaneId
3618
+ ? detectDetachedSessionWindowIndex(sessionName)
3619
+ : null;
3620
+ const hookTarget = hudPaneId && hookWindowIndex
3621
+ ? buildResizeHookTarget(sessionName, hookWindowIndex)
3622
+ : null;
3623
+ const hookName = hudPaneId && hookWindowIndex
3624
+ ? buildResizeHookName("launch", sessionName, hookWindowIndex, hudPaneId)
3625
+ : null;
3626
+ const clientAttachedHookName = hudPaneId && hookWindowIndex
3627
+ ? buildClientAttachedReconcileHookName("launch", sessionName, hookWindowIndex, hudPaneId)
3628
+ : null;
3629
+ const finalizeSteps = buildDetachedSessionFinalizeSteps(sessionName, hudPaneId, hookWindowIndex, process.env.OMX_MOUSE !== "0", nativeWindows, shouldAttachDetachedTmuxSession(process.env), detachedLeaderPaneId);
3630
+ if (nativeWindows && detachedWindowsCodexCmd) {
3631
+ scheduleDetachedWindowsCodexLaunch(sessionName, detachedWindowsCodexCmd);
3632
+ }
3633
+ for (const finalizeStep of finalizeSteps) {
3634
+ if (finalizeStep.name === "sanitize-copy-mode-style") {
3635
+ try {
3636
+ mitigateCopyModeUnderlineArtifacts(sessionName);
3637
+ }
3638
+ catch (err) {
3639
+ logCliOperationFailure(err);
3640
+ }
3641
+ continue;
3642
+ }
3643
+ const stdio = finalizeStep.name === "attach-session" ? "inherit" : "ignore";
3644
+ try {
3645
+ const startedAtMs = Date.now();
3646
+ execTmuxFileSync(finalizeStep.args, { stdio });
3647
+ if (finalizeStep.name === "attach-session") {
3648
+ assertDetachedAttachDidNotNoop(sessionName, Date.now() - startedAtMs, process.env);
3649
+ }
3650
+ }
3651
+ catch (err) {
3652
+ logCliOperationFailure(err);
3653
+ if (finalizeStep.name === "attach-session")
3654
+ throw new Error("failed to attach detached tmux session");
3655
+ continue;
3656
+ }
3657
+ if (finalizeStep.name === "register-resize-hook" &&
3658
+ hookTarget &&
3659
+ hookName) {
3660
+ registeredHookTarget = hookTarget;
3661
+ registeredHookName = hookName;
3662
+ }
3663
+ if (finalizeStep.name === "register-client-attached-reconcile" &&
3664
+ clientAttachedHookName) {
3665
+ registeredClientAttachedHookName = clientAttachedHookName;
3666
+ }
3667
+ if (finalizeStep.name === "reconcile-hud-resize") {
3668
+ registerDetachedHudLayoutReconcileHook({
3669
+ hudPaneId,
3670
+ detachedLeaderPaneId,
3671
+ cwd,
3672
+ sessionId,
3673
+ omxBin,
3674
+ omxRootOverride,
3675
+ });
3676
+ }
3677
+ }
3678
+ }
3679
+ }
3680
+ return { postLaunchHandledExternally: !nativeWindows };
3681
+ }
3682
+ catch (err) {
3683
+ if (detachedParentEnvFilePath) {
3684
+ rmSync(detachedParentEnvFilePath, { force: true });
3685
+ }
3686
+ if (activeRecordPath) {
3687
+ rmSync(activeRecordPath, { force: true });
3688
+ }
3689
+ if (createdDetachedSession) {
3690
+ const rollbackSteps = buildDetachedSessionRollbackSteps(sessionName, registeredHookTarget, registeredHookName, registeredClientAttachedHookName);
3691
+ for (const rollbackStep of rollbackSteps) {
3692
+ try {
3693
+ execTmuxFileSync(rollbackStep.args, { stdio: "ignore" });
3694
+ }
3695
+ catch (rollbackErr) {
3696
+ logCliOperationFailure(rollbackErr);
3697
+ // best-effort rollback only
3698
+ }
3699
+ }
3700
+ }
3701
+ throw err;
3702
+ }
3703
+ };
3704
+ const contextKey = process.env[OMX_MADMAX_DETACHED_CONTEXT_ENV]?.trim();
3705
+ const runsRoot = resolveMadmaxRunsRoot(process.env);
3706
+ try {
3707
+ if (isMadmaxDetachedGuardEnabled(process.env) && contextKey) {
3708
+ return withMadmaxDetachedContextLock(runsRoot, contextKey, launchDetachedSession);
3709
+ }
3710
+ return launchDetachedSession();
3711
+ }
3712
+ catch (err) {
3713
+ if (err instanceof MadmaxDetachedReuseError || err instanceof MadmaxDetachedGuardError) {
3714
+ throw err;
3715
+ }
3716
+ logCliOperationFailure(err);
3717
+ // tmux not available or failed, just run codex directly
3718
+ runCodexBlocking(cwd, launchArgs, codexEnvWithNotify);
3719
+ return { postLaunchHandledExternally: false };
3720
+ }
3721
+ }
3722
+ }
3723
+ function listHudWatchPaneIdsInCurrentWindow(currentPaneId, owner = {}) {
3724
+ try {
3725
+ return listCurrentWindowHudPaneIds(currentPaneId, undefined, owner);
3726
+ }
3727
+ catch (err) {
3728
+ logCliOperationFailure(err);
3729
+ return [];
3730
+ }
3731
+ }
3732
+ /**
3733
+ * Decide whether an existing tmux window is too short to spend rows on a
3734
+ * launch-time HUD split. When the window height is unknown (null), we keep the
3735
+ * default behavior and create the HUD. (closes #2754)
3736
+ */
3737
+ export function isExistingTmuxWindowTooCrampedForLaunchHud(windowHeight, minWindowHeight = HUD_TMUX_MIN_LAUNCH_WINDOW_HEIGHT_LINES) {
3738
+ return isTmuxWindowTooCrampedForHudSplit(windowHeight, minWindowHeight);
3739
+ }
3740
+ function createHudWatchPane(cwd, hudCmd, options = {}) {
3741
+ return createSharedHudWatchPane(cwd, hudCmd, {
3742
+ heightLines: options.heightLines ?? HUD_TMUX_HEIGHT_LINES,
3743
+ targetPaneId: options.targetPaneId,
3744
+ });
3745
+ }
3746
+ function killTmuxPane(paneId) {
3747
+ if (!paneId.startsWith("%"))
3748
+ return;
3749
+ try {
3750
+ killSharedTmuxPane(paneId);
3751
+ }
3752
+ catch (err) {
3753
+ logCliOperationFailure(err);
3754
+ // Pane may already be gone; ignore.
3755
+ }
3756
+ }
3757
+ export function buildTmuxShellCommand(command, args) {
3758
+ return [quoteShellArg(command), ...args.map(quoteShellArg)].join(" ");
3759
+ }
3760
+ function encodePowerShellCommand(commandText) {
3761
+ return Buffer.from(commandText, "utf16le").toString("base64");
3762
+ }
3763
+ function isCodexVersionRequest(args) {
3764
+ return args.some((arg) => CODEX_VERSION_FLAGS.has(arg));
3765
+ }
3766
+ export function buildWindowsPromptCommand(command, args) {
3767
+ const invocation = [
3768
+ "&",
3769
+ quotePowerShellArg(command),
3770
+ ...args.map(quotePowerShellArg),
3771
+ ].join(" ");
3772
+ const wrappedCommand = [
3773
+ "$ErrorActionPreference = 'Stop'",
3774
+ `& { ${invocation} }`,
3775
+ ].join("; ");
3776
+ return `powershell.exe -NoLogo -NoExit -EncodedCommand ${encodePowerShellCommand(wrappedCommand)}`;
3777
+ }
3778
+ /**
3779
+ * Wrap a command for tmux pane execution while preserving the tmux pane cwd.
3780
+ * tmux already starts the pane at `-c <cwd>`; using a login shell here can
3781
+ * reset that cwd back to the shell's startup directory on some setups.
3782
+ *
3783
+ * Do not source user shell rc files by default. In issue #2282 the surviving
3784
+ * OOM signature was thousands of bash processes, not MCP node children;
3785
+ * non-interactive tmux panes sourcing ~/.bashrc can recursively trigger user
3786
+ * automation and fan out before Codex starts. Users who need legacy PATH setup
3787
+ * can opt in with OMX_TMUX_SOURCE_SHELL_RC=1.
3788
+ */
3789
+ export function shouldSourceTmuxPaneShellRc(env = process.env) {
3790
+ return String(env.OMX_TMUX_SOURCE_SHELL_RC ?? "").trim() === "1";
3791
+ }
3792
+ export function buildTmuxPaneCommand(command, args, shellPath = process.env.SHELL, env = process.env) {
3793
+ const bareCmd = buildTmuxShellCommand(command, args);
3794
+ let rcSource = "";
3795
+ if (shouldSourceTmuxPaneShellRc(env)) {
3796
+ if (shellPath && /\/zsh$/i.test(shellPath)) {
3797
+ rcSource = "if [ -f ~/.zshrc ]; then source ~/.zshrc; fi; ";
3798
+ }
3799
+ else if (shellPath && /\/bash$/i.test(shellPath)) {
3800
+ rcSource = "if [ -f ~/.bashrc ]; then source ~/.bashrc; fi; ";
3801
+ }
3802
+ }
3803
+ const rawShell = shellPath && shellPath.trim() !== "" ? shellPath.trim() : "/bin/sh";
3804
+ const shellBin = ALLOWED_SHELLS.has(rawShell) ? rawShell : "/bin/sh";
3805
+ const inner = `${rcSource}exec ${bareCmd}`;
3806
+ return `${quoteShellArg(shellBin)} -c ${quoteShellArg(inner)}`;
3807
+ }
3808
+ function quoteShellArg(value) {
3809
+ return `'${value.replace(/'/g, `'\"'\"'`)}'`;
3810
+ }
3811
+ function quotePowerShellArg(value) {
3812
+ return `'${value.replace(/'/g, "''")}'`;
3813
+ }
3814
+ export function buildDetachedWindowsBootstrapScript(sessionName, commandText, delayMs = WINDOWS_DETACHED_BOOTSTRAP_DELAY_MS, tmuxCommand = resolveTmuxExecutableForLaunch()) {
3815
+ const delay = Number.isFinite(delayMs) && delayMs > 0
3816
+ ? Math.floor(delayMs)
3817
+ : WINDOWS_DETACHED_BOOTSTRAP_DELAY_MS;
3818
+ const targetLiteral = JSON.stringify(`${sessionName}:0.0`);
3819
+ const commandLiteral = JSON.stringify(commandText);
3820
+ const tmuxCommandLiteral = JSON.stringify(tmuxCommand);
3821
+ return [
3822
+ "const { execFileSync } = require('child_process');",
3823
+ `const tmuxCommand = ${tmuxCommandLiteral};`,
3824
+ `setTimeout(() => {`,
3825
+ `try { execFileSync(tmuxCommand, ['send-keys', '-t', ${targetLiteral}, '-l', '--', ${commandLiteral}], { stdio: 'ignore' }); } catch {}`,
3826
+ `try { execFileSync(tmuxCommand, ['send-keys', '-t', ${targetLiteral}, 'C-m'], { stdio: 'ignore' }); } catch {}`,
3827
+ `}, ${delay});`,
3828
+ ].join("");
3829
+ }
3830
+ function scheduleDetachedWindowsCodexLaunch(sessionName, commandText) {
3831
+ const child = spawn(process.execPath, ["-e", buildDetachedWindowsBootstrapScript(sessionName, commandText)], {
3832
+ detached: true,
3833
+ stdio: "ignore",
3834
+ windowsHide: true,
3835
+ });
3836
+ child.unref();
3837
+ }
3838
+ /**
3839
+ * postLaunch: Clean up after Codex exits.
3840
+ * Each step is independently fault-tolerant (try/catch per step).
3841
+ */
3842
+ export async function postLaunch(cwd, sessionId, codexHomeOverride, enableNotifyFallbackAuthority = false, projectLocalCodexHomeForCleanup) {
3843
+ // Capture session start time before cleanup (writeSessionEnd deletes session.json)
3844
+ let sessionStartedAt;
3845
+ try {
3846
+ const sessionState = await readSessionState(cwd);
3847
+ sessionStartedAt = sessionState?.started_at;
3848
+ }
3849
+ catch (err) {
3850
+ logCliOperationFailure(err);
3851
+ // Non-fatal
3852
+ }
3853
+ // 0. Reap MCP orphans left behind by the session that just exited.
3854
+ await reapPostLaunchOrphanedMcpProcesses();
3855
+ // 0. Flush fallback watcher once to reduce race with fast codex exit.
3856
+ try {
3857
+ await flushNotifyFallbackOnce(cwd, { codexHomeOverride, enableAuthority: enableNotifyFallbackAuthority, sessionId });
3858
+ }
3859
+ catch (err) {
3860
+ logCliOperationFailure(err);
3861
+ // Non-fatal
3862
+ }
3863
+ // 0. Stop notify fallback watcher first.
3864
+ try {
3865
+ await stopNotifyFallbackWatcher(cwd);
3866
+ }
3867
+ catch (err) {
3868
+ logCliOperationFailure(err);
3869
+ // Non-fatal
3870
+ }
3871
+ // 0. Flush derived watcher once on shutdown (opt-in, best effort).
3872
+ try {
3873
+ await flushHookDerivedWatcherOnce(cwd);
3874
+ }
3875
+ catch (err) {
3876
+ logCliOperationFailure(err);
3877
+ // Non-fatal
3878
+ }
3879
+ // 0.1 Stop derived watcher first (opt-in, best effort).
3880
+ try {
3881
+ await stopHookDerivedWatcher(cwd);
3882
+ }
3883
+ catch (err) {
3884
+ logCliOperationFailure(err);
3885
+ // Non-fatal
3886
+ }
3887
+ // 0.5. Remove Codex transient TUI NUX counters from project-local config only.
3888
+ try {
3889
+ if (projectLocalCodexHomeForCleanup) {
3890
+ await cleanCodexModelAvailabilityNuxIfNeeded(join(projectLocalCodexHomeForCleanup, "config.toml"));
3891
+ }
3892
+ }
3893
+ catch (err) {
3894
+ console.error(`[omx] postLaunch: project config transient NUX cleanup failed: ${err instanceof Error ? err.message : err}`);
3895
+ }
3896
+ // 1. Remove session-scoped model instructions file
3897
+ try {
3898
+ await removeSessionModelInstructionsFile(cwd, sessionId);
3899
+ }
3900
+ catch (err) {
3901
+ console.error(`[omx] postLaunch: model instructions cleanup failed: ${err instanceof Error ? err.message : err}`);
3902
+ }
3903
+ // 2. Archive session (write history, delete session.json)
3904
+ try {
3905
+ await writeSessionEnd(cwd, sessionId);
3906
+ }
3907
+ catch (err) {
3908
+ console.error(`[omx] postLaunch: session archive failed: ${err instanceof Error ? err.message : err}`);
3909
+ }
3910
+ // 2.5. Best-effort wiki session capture
3911
+ try {
3912
+ const { onSessionEnd } = await import("../wiki/lifecycle.js");
3913
+ onSessionEnd({ cwd, session_id: sessionId });
3914
+ }
3915
+ catch (err) {
3916
+ logCliOperationFailure(err);
3917
+ // Non-fatal: wiki capture must never block session cleanup
3918
+ }
3919
+ // 3. Cancel any still-active modes
3920
+ try {
3921
+ await cleanupPostLaunchModeStateFiles(cwd, sessionId);
3922
+ }
3923
+ catch (err) {
3924
+ console.error(`[omx] postLaunch: mode cleanup failed: ${err instanceof Error ? err.message : err}`);
3925
+ }
3926
+ // 4. Send session-end lifecycle notification (best effort)
3927
+ try {
3928
+ const { notifyLifecycle } = await import("../notifications/index.js");
3929
+ const durationMs = sessionStartedAt
3930
+ ? Date.now() - new Date(sessionStartedAt).getTime()
3931
+ : undefined;
3932
+ await notifyLifecycle("session-end", {
3933
+ sessionId,
3934
+ projectPath: cwd,
3935
+ projectName: basename(cwd),
3936
+ durationMs,
3937
+ reason: "session_exit",
3938
+ });
3939
+ }
3940
+ catch (err) {
3941
+ logCliOperationFailure(err);
3942
+ // Non-fatal: notification failures must never block session cleanup
3943
+ }
3944
+ // 4.5. Persist team leader attention when an active leader session exits.
3945
+ try {
3946
+ const { markOwnedTeamsLeaderSessionStopped } = await import("../team/state.js");
3947
+ await markOwnedTeamsLeaderSessionStopped(cwd, sessionId);
3948
+ }
3949
+ catch (err) {
3950
+ logCliOperationFailure(err);
3951
+ // Non-fatal
3952
+ }
3953
+ // 5. Dispatch native hook event (best effort)
3954
+ try {
3955
+ const durationMs = sessionStartedAt
3956
+ ? Date.now() - new Date(sessionStartedAt).getTime()
3957
+ : undefined;
3958
+ const normalizedEvent = process.exitCode && process.exitCode !== 0 ? "failed" : "finished";
3959
+ const errorSummary = normalizedEvent === "failed"
3960
+ ? `codex exited with code ${process.exitCode}`
3961
+ : undefined;
3962
+ await emitNativeHookEvent(cwd, "session-end", {
3963
+ session_id: sessionId,
3964
+ context: buildNativeHookBaseContext(cwd, sessionId, normalizedEvent, {
3965
+ project_path: cwd,
3966
+ project_name: basename(cwd),
3967
+ duration_ms: durationMs,
3968
+ reason: "session_exit",
3969
+ status: normalizedEvent === "failed" ? "failed" : "finished",
3970
+ ...(process.exitCode !== undefined
3971
+ ? { exit_code: process.exitCode }
3972
+ : {}),
3973
+ ...(errorSummary ? { error_summary: errorSummary } : {}),
3974
+ }),
3975
+ });
3976
+ }
3977
+ catch (err) {
3978
+ logCliOperationFailure(err);
3979
+ // Non-fatal
3980
+ }
3981
+ }
3982
+ export async function runDetachedSessionPostLaunch(cwd, sessionId, codexHomeOverride, projectLocalCodexHomeForCleanup, runtimeCodexHomeForCleanup) {
3983
+ await postLaunch(cwd, sessionId, codexHomeOverride, false, projectLocalCodexHomeForCleanup);
3984
+ await cleanupRuntimeCodexHome(runtimeCodexHomeForCleanup, projectLocalCodexHomeForCleanup).catch(logCliOperationFailure);
3985
+ }
3986
+ async function emitNativeHookEvent(cwd, event, opts = {}) {
3987
+ const payload = buildHookEvent(event, {
3988
+ source: "native",
3989
+ context: opts.context || {},
3990
+ session_id: opts.session_id,
3991
+ thread_id: opts.thread_id,
3992
+ turn_id: opts.turn_id,
3993
+ mode: opts.mode,
3994
+ });
3995
+ await dispatchHookEvent(payload, {
3996
+ cwd,
3997
+ enabled: true,
3998
+ });
3999
+ }
4000
+ function notifyFallbackPidPath(cwd) {
4001
+ return join(omxRoot(cwd), "state", "notify-fallback.pid");
4002
+ }
4003
+ function hookDerivedWatcherPidPath(cwd) {
4004
+ return join(omxRoot(cwd), "state", "hook-derived-watcher.pid");
4005
+ }
4006
+ export function shouldDetachBackgroundHelper(env = process.env, platform = process.platform) {
4007
+ // The long-running watcher/helper itself must stay detached so it can
4008
+ // survive parent loss. Windows Git Bash/MSYS uses a short hidden bootstrap
4009
+ // process so the detached helper is created without stealing focus.
4010
+ void env;
4011
+ void platform;
4012
+ return true;
4013
+ }
4014
+ export function resolveBackgroundHelperLaunchMode(env = process.env, platform = process.platform) {
4015
+ return platform === "win32" && isMsysOrGitBash(env, platform)
4016
+ ? "windows-msys-bootstrap"
4017
+ : "direct-detached";
4018
+ }
4019
+ export function buildWindowsMsysBackgroundHelperBootstrapScript(helperArgs, cwd) {
4020
+ const helperArgsLiteral = JSON.stringify(helperArgs);
4021
+ const cwdLiteral = JSON.stringify(cwd);
4022
+ return [
4023
+ "const { spawn } = require('child_process');",
4024
+ `const child = spawn(process.execPath, ${helperArgsLiteral}, { cwd: ${cwdLiteral}, detached: true, stdio: 'ignore', windowsHide: true, env: process.env });`,
4025
+ "if (!child.pid) process.exit(1);",
4026
+ "process.stdout.write(String(child.pid));",
4027
+ "child.unref();",
4028
+ ].join("");
4029
+ }
4030
+ async function launchBackgroundHelper(helperArgs, options) {
4031
+ const launchMode = resolveBackgroundHelperLaunchMode(options.env, process.platform);
4032
+ if (launchMode === "windows-msys-bootstrap") {
4033
+ const { spawnSync } = await import("child_process");
4034
+ const bootstrap = spawnSync(process.execPath, [
4035
+ "-e",
4036
+ buildWindowsMsysBackgroundHelperBootstrapScript(helperArgs, options.cwd),
4037
+ ], {
4038
+ cwd: options.cwd,
4039
+ encoding: "utf-8",
4040
+ stdio: ["ignore", "pipe", "pipe"],
4041
+ windowsHide: true,
4042
+ env: options.env,
4043
+ });
4044
+ if (bootstrap.error) {
4045
+ throw bootstrap.error;
4046
+ }
4047
+ if (bootstrap.status !== 0) {
4048
+ const detail = (bootstrap.stderr || bootstrap.stdout || "").trim();
4049
+ throw new Error(detail || `background helper bootstrap exited ${bootstrap.status}`);
4050
+ }
4051
+ const helperPid = Number.parseInt((bootstrap.stdout || "").trim(), 10);
4052
+ return Number.isFinite(helperPid) && helperPid > 0
4053
+ ? helperPid
4054
+ : undefined;
4055
+ }
4056
+ const child = spawn(process.execPath, helperArgs, {
4057
+ cwd: options.cwd,
4058
+ detached: shouldDetachBackgroundHelper(options.env, process.platform),
4059
+ stdio: "ignore",
4060
+ windowsHide: true,
4061
+ env: options.env,
4062
+ });
4063
+ child.unref();
4064
+ return child.pid;
4065
+ }
4066
+ function parseWatcherPidFile(content) {
4067
+ const trimmed = content.trim();
4068
+ if (!trimmed)
4069
+ return null;
4070
+ try {
4071
+ const parsed = JSON.parse(trimmed);
4072
+ if (typeof parsed === "number") {
4073
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
4074
+ }
4075
+ const pid = typeof parsed === "object" && parsed !== null
4076
+ ? parsed.pid
4077
+ : undefined;
4078
+ return typeof pid === "number" && Number.isFinite(pid) && pid > 0 ? pid : null;
4079
+ }
4080
+ catch {
4081
+ const pid = Number.parseInt(trimmed, 10);
4082
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
4083
+ }
4084
+ }
4085
+ const DEFAULT_NOTIFY_FALLBACK_REAP_GRACE_MS = 5000;
4086
+ function resolveNotifyFallbackReapGraceMs(env = process.env) {
4087
+ const parsed = Number.parseInt(env.OMX_NOTIFY_FALLBACK_REAP_GRACE_MS || "", 10);
4088
+ if (Number.isFinite(parsed) && parsed >= 0)
4089
+ return parsed;
4090
+ return DEFAULT_NOTIFY_FALLBACK_REAP_GRACE_MS;
4091
+ }
4092
+ function isWatcherRecordWithinReapGrace(record, nowMs = Date.now(), graceMs = resolveNotifyFallbackReapGraceMs()) {
4093
+ if (graceMs <= 0 || !record.startedAt)
4094
+ return false;
4095
+ const startedMs = Date.parse(record.startedAt);
4096
+ if (!Number.isFinite(startedMs))
4097
+ return false;
4098
+ const ageMs = nowMs - startedMs;
4099
+ return ageMs >= 0 && ageMs < graceMs;
4100
+ }
4101
+ function parseWatcherPidRecord(content) {
4102
+ const trimmed = content.trim();
4103
+ if (!trimmed)
4104
+ return null;
4105
+ try {
4106
+ const parsed = JSON.parse(trimmed);
4107
+ if (typeof parsed === "object" && parsed !== null) {
4108
+ const { pid, started_at: startedAtRaw } = parsed;
4109
+ if (typeof pid === "number" && Number.isFinite(pid) && pid > 0) {
4110
+ return {
4111
+ pid,
4112
+ startedAt: typeof startedAtRaw === "string" ? startedAtRaw : null,
4113
+ };
4114
+ }
4115
+ }
4116
+ }
4117
+ catch {
4118
+ }
4119
+ const pid = parseWatcherPidFile(trimmed);
4120
+ return pid ? { pid, startedAt: null } : null;
4121
+ }
4122
+ function isLikelyOmxWatcherProcess(pid, execFileSyncFn = execFileSync, platform = process.platform) {
4123
+ if (platform === "win32") {
4124
+ // ps is unavailable on native Windows; fall back to unconditional reap
4125
+ // to preserve the pre-identity-check behavior on opted-in Windows hosts.
4126
+ return true;
4127
+ }
4128
+ try {
4129
+ const cmd = execFileSyncFn("ps", ["-p", String(pid), "-o", "command="], {
4130
+ encoding: "utf-8",
4131
+ timeout: 2000,
4132
+ windowsHide: true,
4133
+ });
4134
+ return cmd.includes("notify-fallback-watcher") || cmd.includes("hook-derived-watcher");
4135
+ }
4136
+ catch {
4137
+ return false;
4138
+ }
4139
+ }
4140
+ export async function reapStaleNotifyFallbackWatcher(pidPath, deps = {}) {
4141
+ const exists = deps.exists ?? existsSync;
4142
+ if (!exists(pidPath))
4143
+ return "missing";
4144
+ const { readFile } = await import("fs/promises");
4145
+ const readFileImpl = deps.readFile ?? readFile;
4146
+ const tryKillPidImpl = deps.tryKillPid ?? tryKillPid;
4147
+ const hasErrnoCodeImpl = deps.hasErrnoCode ?? hasErrnoCode;
4148
+ const warn = deps.warn ?? console.warn;
4149
+ const isWatcherProcessImpl = deps.isWatcherProcess ?? isLikelyOmxWatcherProcess;
4150
+ try {
4151
+ const record = parseWatcherPidRecord(await readFileImpl(pidPath, "utf-8"));
4152
+ if (!record)
4153
+ return "invalid";
4154
+ if (!isWatcherProcessImpl(record.pid))
4155
+ return "identity_mismatch";
4156
+ if (isWatcherRecordWithinReapGrace(record, deps.nowMs?.() ?? Date.now(), deps.reapGraceMs ?? resolveNotifyFallbackReapGraceMs())) {
4157
+ return "recent_active";
4158
+ }
4159
+ tryKillPidImpl(record.pid, "SIGTERM");
4160
+ return "reaped";
4161
+ }
4162
+ catch (error) {
4163
+ if (!hasErrnoCodeImpl(error, "ESRCH")) {
4164
+ warn("[omx] warning: failed to stop stale notify fallback watcher", {
4165
+ path: pidPath,
4166
+ error: error instanceof Error ? error.message : String(error),
4167
+ });
4168
+ }
4169
+ return "failed";
4170
+ }
4171
+ }
4172
+ function tryKillPid(pid, signal = "SIGTERM") {
4173
+ try {
4174
+ process.kill(pid, signal);
4175
+ return true;
4176
+ }
4177
+ catch (error) {
4178
+ const code = error.code;
4179
+ if (code === "ESRCH")
4180
+ return false;
4181
+ throw error;
4182
+ }
4183
+ }
4184
+ async function startNotifyFallbackWatcher(cwd, options = {}) {
4185
+ const { mkdir, writeFile } = await import("fs/promises");
4186
+ const pidPath = notifyFallbackPidPath(cwd);
4187
+ const reapResult = await reapStaleNotifyFallbackWatcher(pidPath);
4188
+ if (reapResult === "recent_active")
4189
+ return;
4190
+ if (!shouldEnableNotifyFallbackWatcher(process.env, process.platform))
4191
+ return;
4192
+ const pkgRoot = getPackageRoot();
4193
+ const watcherScript = resolveNotifyFallbackWatcherScript(pkgRoot);
4194
+ const notifyScript = resolveNotifyHookScript(pkgRoot);
4195
+ if (!existsSync(watcherScript) || !existsSync(notifyScript))
4196
+ return;
4197
+ await mkdir(join(omxRoot(cwd), "state"), { recursive: true }).catch((error) => {
4198
+ console.warn("[omx] warning: failed to create notify fallback watcher state directory", {
4199
+ cwd,
4200
+ error: error instanceof Error ? error.message : String(error),
4201
+ });
4202
+ });
4203
+ const watcherEnv = buildNotifyFallbackWatcherEnv(process.env, {
4204
+ codexHomeOverride: options.codexHomeOverride,
4205
+ omxRootOverride: resolveOmxRootForLaunch(cwd, process.env),
4206
+ enableAuthority: options.enableAuthority === true,
4207
+ sessionId: options.sessionId,
4208
+ });
4209
+ let watcherPid;
4210
+ try {
4211
+ watcherPid = await launchBackgroundHelper([
4212
+ watcherScript,
4213
+ "--cwd",
4214
+ cwd,
4215
+ "--notify-script",
4216
+ notifyScript,
4217
+ "--pid-file",
4218
+ pidPath,
4219
+ "--parent-pid",
4220
+ String(process.pid),
4221
+ ...(process.env.OMX_NOTIFY_FALLBACK_MAX_LIFETIME_MS
4222
+ ? [
4223
+ "--max-lifetime-ms",
4224
+ process.env.OMX_NOTIFY_FALLBACK_MAX_LIFETIME_MS,
4225
+ ]
4226
+ : []),
4227
+ ], {
4228
+ cwd,
4229
+ env: watcherEnv,
4230
+ });
4231
+ }
4232
+ catch (error) {
4233
+ console.warn("[omx] warning: failed to launch notify fallback watcher", {
4234
+ cwd,
4235
+ error: error instanceof Error ? error.message : String(error),
4236
+ });
4237
+ return;
4238
+ }
4239
+ if (!watcherPid)
4240
+ return;
4241
+ await writeFile(pidPath, JSON.stringify({ pid: watcherPid, started_at: new Date().toISOString() }, null, 2)).catch((error) => {
4242
+ console.warn("[omx] warning: failed to write notify fallback watcher pid file", {
4243
+ path: pidPath,
4244
+ error: error instanceof Error ? error.message : String(error),
4245
+ });
4246
+ });
4247
+ }
4248
+ async function startHookDerivedWatcher(cwd) {
4249
+ if (process.env.OMX_HOOK_DERIVED_SIGNALS !== "1")
4250
+ return;
4251
+ const { mkdir, writeFile, readFile } = await import("fs/promises");
4252
+ const pidPath = hookDerivedWatcherPidPath(cwd);
4253
+ const pkgRoot = getPackageRoot();
4254
+ const watcherScript = resolveHookDerivedWatcherScript(pkgRoot);
4255
+ if (!existsSync(watcherScript))
4256
+ return;
4257
+ if (existsSync(pidPath)) {
4258
+ try {
4259
+ const prev = JSON.parse(await readFile(pidPath, "utf-8"));
4260
+ if (prev && typeof prev.pid === "number") {
4261
+ process.kill(prev.pid, "SIGTERM");
4262
+ }
4263
+ }
4264
+ catch (error) {
4265
+ console.warn("[omx] warning: failed to stop stale hook-derived watcher", {
4266
+ path: pidPath,
4267
+ error: error instanceof Error ? error.message : String(error),
4268
+ });
4269
+ }
4270
+ }
4271
+ await mkdir(join(omxRoot(cwd), "state"), { recursive: true }).catch((error) => {
4272
+ console.warn("[omx] warning: failed to create hook-derived watcher state directory", {
4273
+ cwd,
4274
+ error: error instanceof Error ? error.message : String(error),
4275
+ });
4276
+ });
4277
+ let watcherPid;
4278
+ try {
4279
+ watcherPid = await launchBackgroundHelper([watcherScript, "--cwd", cwd], {
4280
+ cwd,
4281
+ env: process.env,
4282
+ });
4283
+ }
4284
+ catch (error) {
4285
+ console.warn("[omx] warning: failed to launch hook-derived watcher", {
4286
+ cwd,
4287
+ error: error instanceof Error ? error.message : String(error),
4288
+ });
4289
+ return;
4290
+ }
4291
+ if (!watcherPid)
4292
+ return;
4293
+ await writeFile(pidPath, JSON.stringify({ pid: watcherPid, started_at: new Date().toISOString() }, null, 2)).catch((error) => {
4294
+ console.warn("[omx] warning: failed to write hook-derived watcher pid file", {
4295
+ path: pidPath,
4296
+ error: error instanceof Error ? error.message : String(error),
4297
+ });
4298
+ });
4299
+ }
4300
+ async function stopNotifyFallbackWatcher(cwd) {
4301
+ const { readFile, unlink } = await import("fs/promises");
4302
+ const pidPath = notifyFallbackPidPath(cwd);
4303
+ if (!existsSync(pidPath))
4304
+ return;
4305
+ try {
4306
+ const pid = parseWatcherPidFile(await readFile(pidPath, "utf-8"));
4307
+ if (pid) {
4308
+ tryKillPid(pid, "SIGTERM");
4309
+ }
4310
+ }
4311
+ catch (error) {
4312
+ if (!hasErrnoCode(error, "ESRCH")) {
4313
+ console.warn("[omx] warning: failed to stop notify fallback watcher process", {
4314
+ path: pidPath,
4315
+ error: error instanceof Error ? error.message : String(error),
4316
+ });
4317
+ }
4318
+ }
4319
+ await unlink(pidPath).catch((error) => {
4320
+ console.warn("[omx] warning: failed to remove notify fallback watcher pid file", {
4321
+ path: pidPath,
4322
+ error: error instanceof Error ? error.message : String(error),
4323
+ });
4324
+ });
4325
+ }
4326
+ async function stopHookDerivedWatcher(cwd) {
4327
+ const { readFile, unlink } = await import("fs/promises");
4328
+ const pidPath = hookDerivedWatcherPidPath(cwd);
4329
+ if (!existsSync(pidPath))
4330
+ return;
4331
+ try {
4332
+ const parsed = JSON.parse(await readFile(pidPath, "utf-8"));
4333
+ if (parsed && typeof parsed.pid === "number") {
4334
+ process.kill(parsed.pid, "SIGTERM");
4335
+ }
4336
+ }
4337
+ catch (error) {
4338
+ console.warn("[omx] warning: failed to stop hook-derived watcher process", {
4339
+ path: pidPath,
4340
+ error: error instanceof Error ? error.message : String(error),
4341
+ });
4342
+ }
4343
+ await unlink(pidPath).catch((error) => {
4344
+ console.warn("[omx] warning: failed to remove hook-derived watcher pid file", {
4345
+ path: pidPath,
4346
+ error: error instanceof Error ? error.message : String(error),
4347
+ });
4348
+ });
4349
+ }
4350
+ async function flushNotifyFallbackOnce(cwd, options = {}) {
4351
+ if (!shouldEnableNotifyFallbackWatcher(process.env, process.platform))
4352
+ return;
4353
+ const { spawnSync } = await import("child_process");
4354
+ const pkgRoot = getPackageRoot();
4355
+ const watcherScript = resolveNotifyFallbackWatcherScript(pkgRoot);
4356
+ const notifyScript = resolveNotifyHookScript(pkgRoot);
4357
+ if (!existsSync(watcherScript) || !existsSync(notifyScript))
4358
+ return;
4359
+ spawnSync(process.execPath, [watcherScript, "--once", "--cwd", cwd, "--notify-script", notifyScript], {
4360
+ cwd,
4361
+ stdio: "ignore",
4362
+ timeout: 3000,
4363
+ windowsHide: true,
4364
+ env: buildNotifyFallbackWatcherEnv(process.env, {
4365
+ codexHomeOverride: options.codexHomeOverride,
4366
+ enableAuthority: options.enableAuthority === true,
4367
+ sessionId: options.sessionId,
4368
+ }),
4369
+ });
4370
+ }
4371
+ async function flushHookDerivedWatcherOnce(cwd) {
4372
+ if (process.env.OMX_HOOK_DERIVED_SIGNALS !== "1")
4373
+ return;
4374
+ const { spawnSync } = await import("child_process");
4375
+ const pkgRoot = getPackageRoot();
4376
+ const watcherScript = resolveHookDerivedWatcherScript(pkgRoot);
4377
+ if (!existsSync(watcherScript))
4378
+ return;
4379
+ spawnSync(process.execPath, [watcherScript, "--once", "--cwd", cwd], {
4380
+ cwd,
4381
+ stdio: "ignore",
4382
+ timeout: 3000,
4383
+ windowsHide: true,
4384
+ env: {
4385
+ ...process.env,
4386
+ OMX_HOOK_DERIVED_SIGNALS: "1",
4387
+ },
4388
+ });
4389
+ }
4390
+ // Canonicalize a path for comparing a registry `source_cwd` against the current
4391
+ // working directory. `process.cwd()` resolves symlinks (e.g. macOS `/var` ->
4392
+ // `/private/var`), so registry values must be canonicalized the same way or the
4393
+ // run-dir fallback never matches. Falls back to `resolve` when the path is
4394
+ // missing (realpathSync requires an existing target).
4395
+ function canonicalizePathForRunDirMatch(p) {
4396
+ try {
4397
+ return realpathSync(resolve(p));
4398
+ }
4399
+ catch {
4400
+ return resolve(p);
4401
+ }
4402
+ }
4403
+ async function listHookVisibleRunDirStateRefs(cwd) {
4404
+ const runsRoot = resolveMadmaxRunsRoot(process.env);
4405
+ const registryPath = join(runsRoot, "registry.jsonl");
4406
+ const runDirs = new Set();
4407
+ const canonicalCwd = canonicalizePathForRunDirMatch(cwd);
4408
+ const canonicalRunsRoot = resolve(runsRoot);
4409
+ const addRecord = (raw) => {
4410
+ if (!raw || typeof raw !== "object")
4411
+ return;
4412
+ const record = raw;
4413
+ const sourceCwd = typeof record.source_cwd === "string" ? record.source_cwd.trim() : "";
4414
+ const runDir = typeof record.run_dir === "string"
4415
+ ? record.run_dir.trim()
4416
+ : typeof record.cwd === "string"
4417
+ ? record.cwd.trim()
4418
+ : "";
4419
+ if (!sourceCwd || !runDir)
4420
+ return;
4421
+ try {
4422
+ if (canonicalizePathForRunDirMatch(sourceCwd) !== canonicalCwd)
4423
+ return;
4424
+ const resolvedRunDir = resolve(runDir);
4425
+ if (resolvedRunDir !== canonicalRunsRoot
4426
+ && !resolvedRunDir.startsWith(`${canonicalRunsRoot}/`)) {
4427
+ return;
4428
+ }
4429
+ runDirs.add(resolvedRunDir);
4430
+ }
4431
+ catch {
4432
+ return;
4433
+ }
4434
+ };
4435
+ try {
4436
+ const rawRegistry = await readFile(registryPath, "utf-8");
4437
+ for (const line of rawRegistry.split(/\r?\n/)) {
4438
+ const trimmed = line.trim();
4439
+ if (!trimmed)
4440
+ continue;
4441
+ try {
4442
+ addRecord(JSON.parse(trimmed));
4443
+ }
4444
+ catch {
4445
+ continue;
4446
+ }
4447
+ }
4448
+ }
4449
+ catch { }
4450
+ try {
4451
+ const activeDir = join(runsRoot, MADMAX_DETACHED_ACTIVE_DIR);
4452
+ const files = await readdir(activeDir).catch(() => []);
4453
+ for (const file of files) {
4454
+ if (!file.endsWith(".json"))
4455
+ continue;
4456
+ try {
4457
+ addRecord(JSON.parse(await readFile(join(activeDir, file), "utf-8")));
4458
+ }
4459
+ catch {
4460
+ continue;
4461
+ }
4462
+ }
4463
+ }
4464
+ catch { }
4465
+ const refs = [];
4466
+ const seenPaths = new Set();
4467
+ for (const runDir of runDirs) {
4468
+ const stateDir = join(runDir, ".omx", "state");
4469
+ let sessionId;
4470
+ try {
4471
+ const session = JSON.parse(await readFile(join(stateDir, "session.json"), "utf-8"));
4472
+ if (typeof session.session_id === "string" && session.session_id.trim()) {
4473
+ sessionId = session.session_id.trim();
4474
+ }
4475
+ }
4476
+ catch { }
4477
+ const candidateDirs = sessionId ? [join(stateDir, "sessions", sessionId), stateDir] : [stateDir];
4478
+ for (const dir of candidateDirs) {
4479
+ const files = await readdir(dir).catch(() => []);
4480
+ for (const file of files) {
4481
+ if (!file.endsWith("-state.json") || file === "session.json")
4482
+ continue;
4483
+ const path = join(dir, file);
4484
+ if (seenPaths.has(path))
4485
+ continue;
4486
+ seenPaths.add(path);
4487
+ refs.push({
4488
+ mode: file.slice(0, -"-state.json".length),
4489
+ path,
4490
+ scope: dir === stateDir ? "root" : "session",
4491
+ });
4492
+ }
4493
+ }
4494
+ }
4495
+ return refs.sort((a, b) => a.mode.localeCompare(b.mode));
4496
+ }
4497
+ async function cancelModes() {
4498
+ const { writeFile, readFile } = await import("fs/promises");
4499
+ const cwd = process.cwd();
4500
+ const nowIso = new Date().toISOString();
4501
+ try {
4502
+ const loadStates = async (refs) => {
4503
+ const loaded = new Map();
4504
+ for (const ref of refs) {
4505
+ const content = await readFile(ref.path, "utf-8");
4506
+ let parsedState;
4507
+ try {
4508
+ parsedState = JSON.parse(content);
4509
+ }
4510
+ catch (err) {
4511
+ logCliOperationFailure(err);
4512
+ continue;
4513
+ }
4514
+ loaded.set(ref.mode, {
4515
+ path: ref.path,
4516
+ scope: ref.scope,
4517
+ state: parsedState,
4518
+ });
4519
+ }
4520
+ return loaded;
4521
+ };
4522
+ let states = await loadStates(await listModeStateFilesWithScopePreference(cwd));
4523
+ const hasActiveWorkflowMode = (entries) => [...entries.entries()].some(([mode, entry]) => mode !== SKILL_ACTIVE_STATE_MODE && entry.state.active === true);
4524
+ if (!hasActiveWorkflowMode(states)) {
4525
+ const runDirStates = await loadStates(await listHookVisibleRunDirStateRefs(cwd));
4526
+ if (hasActiveWorkflowMode(runDirStates))
4527
+ states = runDirStates;
4528
+ }
4529
+ const changed = new Set();
4530
+ const reported = new Set();
4531
+ const cancelMode = (mode, phase = "cancelled", reportIfWasActive = true) => {
4532
+ const entry = states.get(mode);
4533
+ if (!entry)
4534
+ return;
4535
+ const wasActive = entry.state.active === true;
4536
+ const needsChange = entry.state.active !== false ||
4537
+ entry.state.current_phase !== phase ||
4538
+ typeof entry.state.completed_at !== "string" ||
4539
+ String(entry.state.completed_at).trim() === "";
4540
+ if (!needsChange)
4541
+ return;
4542
+ entry.state.active = false;
4543
+ entry.state.current_phase = phase;
4544
+ entry.state.completed_at = nowIso;
4545
+ entry.state.last_turn_at = nowIso;
4546
+ if (mode === SKILL_ACTIVE_STATE_MODE) {
4547
+ entry.state.phase = phase;
4548
+ const activeSkills = Array.isArray(entry.state.active_skills)
4549
+ ? entry.state.active_skills
4550
+ : [];
4551
+ entry.state.active_skills = activeSkills.map((skill) => (skill && typeof skill === "object"
4552
+ ? { ...skill, active: false, phase }
4553
+ : skill));
4554
+ }
4555
+ changed.add(mode);
4556
+ if (reportIfWasActive && wasActive && mode !== SKILL_ACTIVE_STATE_MODE)
4557
+ reported.add(mode);
4558
+ };
4559
+ const ralphLinksUltrawork = (state) => state.linked_ultrawork === true || state.linked_mode === "ultrawork";
4560
+ const ralph = states.get("ralph");
4561
+ const hadActiveRalph = !!(ralph && ralph.state.active === true);
4562
+ if (ralph && ralph.state.active === true) {
4563
+ cancelMode("ralph", "cancelled", true);
4564
+ if (ralphLinksUltrawork(ralph.state))
4565
+ cancelMode("ultrawork", "cancelled", true);
4566
+ }
4567
+ if (!hadActiveRalph) {
4568
+ for (const [mode, entry] of states.entries()) {
4569
+ if (entry.state.active === true)
4570
+ cancelMode(mode, "cancelled", true);
4571
+ }
4572
+ }
4573
+ for (const [mode, entry] of states.entries()) {
4574
+ if (!changed.has(mode))
4575
+ continue;
4576
+ await writeFile(entry.path, JSON.stringify(entry.state, null, 2));
4577
+ }
4578
+ for (const mode of reported) {
4579
+ console.log(`Cancelled: ${mode}`);
4580
+ }
4581
+ if (reported.size === 0) {
4582
+ console.log("No active modes to cancel.");
4583
+ }
4584
+ }
4585
+ catch (err) {
4586
+ logCliOperationFailure(err);
4587
+ console.log("No active modes to cancel.");
4588
+ }
4589
+ }
4590
+ //# sourceMappingURL=index.js.map