oh-my-codex 0.11.13 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/Cargo.lock +5 -5
  2. package/Cargo.toml +1 -1
  3. package/README.md +27 -17
  4. package/crates/omx-runtime/src/main.rs +6 -2
  5. package/dist/agents/native-config.js +1 -1
  6. package/dist/agents/native-config.js.map +1 -1
  7. package/dist/cli/__tests__/autoresearch-guided.test.js +74 -2
  8. package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
  9. package/dist/cli/__tests__/cleanup.test.js +22 -30
  10. package/dist/cli/__tests__/cleanup.test.js.map +1 -1
  11. package/dist/cli/__tests__/error-handling-warnings.test.js +3 -1
  12. package/dist/cli/__tests__/error-handling-warnings.test.js.map +1 -1
  13. package/dist/cli/__tests__/index.test.js +217 -4
  14. package/dist/cli/__tests__/index.test.js.map +1 -1
  15. package/dist/cli/__tests__/setup-refresh.test.js +49 -9
  16. package/dist/cli/__tests__/setup-refresh.test.js.map +1 -1
  17. package/dist/cli/__tests__/setup-scope.test.js +9 -0
  18. package/dist/cli/__tests__/setup-scope.test.js.map +1 -1
  19. package/dist/cli/__tests__/team.test.js +136 -11
  20. package/dist/cli/__tests__/team.test.js.map +1 -1
  21. package/dist/cli/__tests__/uninstall.test.js +10 -0
  22. package/dist/cli/__tests__/uninstall.test.js.map +1 -1
  23. package/dist/cli/__tests__/windows-popup-loop-contract.test.js +1 -0
  24. package/dist/cli/__tests__/windows-popup-loop-contract.test.js.map +1 -1
  25. package/dist/cli/autoresearch-guided.d.ts.map +1 -1
  26. package/dist/cli/autoresearch-guided.js +2 -1
  27. package/dist/cli/autoresearch-guided.js.map +1 -1
  28. package/dist/cli/autoresearch.d.ts.map +1 -1
  29. package/dist/cli/autoresearch.js +2 -1
  30. package/dist/cli/autoresearch.js.map +1 -1
  31. package/dist/cli/cleanup.d.ts.map +1 -1
  32. package/dist/cli/cleanup.js +4 -2
  33. package/dist/cli/cleanup.js.map +1 -1
  34. package/dist/cli/index.d.ts +12 -0
  35. package/dist/cli/index.d.ts.map +1 -1
  36. package/dist/cli/index.js +238 -30
  37. package/dist/cli/index.js.map +1 -1
  38. package/dist/cli/omx.js +2 -0
  39. package/dist/cli/omx.js.map +1 -1
  40. package/dist/cli/setup.d.ts +1 -0
  41. package/dist/cli/setup.d.ts.map +1 -1
  42. package/dist/cli/setup.js +41 -7
  43. package/dist/cli/setup.js.map +1 -1
  44. package/dist/cli/team.d.ts.map +1 -1
  45. package/dist/cli/team.js +16 -557
  46. package/dist/cli/team.js.map +1 -1
  47. package/dist/cli/uninstall.d.ts.map +1 -1
  48. package/dist/cli/uninstall.js +34 -9
  49. package/dist/cli/uninstall.js.map +1 -1
  50. package/dist/config/__tests__/generator-idempotent.test.js +79 -2
  51. package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
  52. package/dist/config/__tests__/generator-notify.test.js +2 -0
  53. package/dist/config/__tests__/generator-notify.test.js.map +1 -1
  54. package/dist/config/codex-hooks.d.ts +11 -0
  55. package/dist/config/codex-hooks.d.ts.map +1 -0
  56. package/dist/config/codex-hooks.js +50 -0
  57. package/dist/config/codex-hooks.js.map +1 -0
  58. package/dist/config/generator.d.ts +5 -3
  59. package/dist/config/generator.d.ts.map +1 -1
  60. package/dist/config/generator.js +24 -14
  61. package/dist/config/generator.js.map +1 -1
  62. package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts +2 -0
  63. package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts.map +1 -0
  64. package/dist/hooks/__tests__/debugger-log-recency-contract.test.js +20 -0
  65. package/dist/hooks/__tests__/debugger-log-recency-contract.test.js.map +1 -0
  66. package/dist/hooks/__tests__/notify-fallback-watcher.test.js +236 -2
  67. package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
  68. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +86 -0
  69. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -1
  70. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +40 -0
  71. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
  72. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts +2 -0
  73. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts.map +1 -0
  74. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js +54 -0
  75. package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js.map +1 -0
  76. package/dist/hooks/__tests__/notify-hook-modules.test.js +31 -0
  77. package/dist/hooks/__tests__/notify-hook-modules.test.js.map +1 -1
  78. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js +51 -0
  79. package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js.map +1 -1
  80. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts +2 -0
  81. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts.map +1 -0
  82. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js +136 -0
  83. package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js.map +1 -0
  84. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +120 -0
  85. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
  86. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +145 -20
  87. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
  88. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js +116 -0
  89. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -1
  90. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +86 -0
  91. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
  92. package/dist/hooks/__tests__/pre-context-gate-skills.test.js +1 -0
  93. package/dist/hooks/__tests__/pre-context-gate-skills.test.js.map +1 -1
  94. package/dist/hooks/extensibility/__tests__/runtime.test.js +49 -0
  95. package/dist/hooks/extensibility/__tests__/runtime.test.js.map +1 -1
  96. package/dist/hooks/extensibility/runtime.d.ts.map +1 -1
  97. package/dist/hooks/extensibility/runtime.js +10 -0
  98. package/dist/hooks/extensibility/runtime.js.map +1 -1
  99. package/dist/hooks/extensibility/types.d.ts +1 -1
  100. package/dist/hooks/extensibility/types.d.ts.map +1 -1
  101. package/dist/hooks/prompt-guidance-contract.d.ts.map +1 -1
  102. package/dist/hooks/prompt-guidance-contract.js +12 -8
  103. package/dist/hooks/prompt-guidance-contract.js.map +1 -1
  104. package/dist/hooks/session.d.ts +5 -1
  105. package/dist/hooks/session.d.ts.map +1 -1
  106. package/dist/hooks/session.js +10 -6
  107. package/dist/hooks/session.js.map +1 -1
  108. package/dist/hud/index.d.ts.map +1 -1
  109. package/dist/hud/index.js +6 -1
  110. package/dist/hud/index.js.map +1 -1
  111. package/dist/mcp/__tests__/bootstrap.test.js +0 -3
  112. package/dist/mcp/__tests__/bootstrap.test.js.map +1 -1
  113. package/dist/mcp/__tests__/code-intel-server.test.js +27 -1
  114. package/dist/mcp/__tests__/code-intel-server.test.js.map +1 -1
  115. package/dist/mcp/__tests__/server-lifecycle.test.js +0 -5
  116. package/dist/mcp/__tests__/server-lifecycle.test.js.map +1 -1
  117. package/dist/mcp/bootstrap.d.ts +1 -1
  118. package/dist/mcp/bootstrap.d.ts.map +1 -1
  119. package/dist/mcp/bootstrap.js +0 -1
  120. package/dist/mcp/bootstrap.js.map +1 -1
  121. package/dist/mcp/code-intel-server.d.ts +20 -0
  122. package/dist/mcp/code-intel-server.d.ts.map +1 -1
  123. package/dist/mcp/code-intel-server.js +6 -5
  124. package/dist/mcp/code-intel-server.js.map +1 -1
  125. package/dist/notifications/__tests__/idle-cooldown.test.js +24 -1
  126. package/dist/notifications/__tests__/idle-cooldown.test.js.map +1 -1
  127. package/dist/notifications/__tests__/reply-listener.test.js +20 -1
  128. package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
  129. package/dist/notifications/__tests__/tmux.test.js +41 -0
  130. package/dist/notifications/__tests__/tmux.test.js.map +1 -1
  131. package/dist/notifications/idle-cooldown.d.ts +13 -0
  132. package/dist/notifications/idle-cooldown.d.ts.map +1 -1
  133. package/dist/notifications/idle-cooldown.js +50 -16
  134. package/dist/notifications/idle-cooldown.js.map +1 -1
  135. package/dist/notifications/reply-listener.d.ts.map +1 -1
  136. package/dist/notifications/reply-listener.js +2 -0
  137. package/dist/notifications/reply-listener.js.map +1 -1
  138. package/dist/notifications/tmux.d.ts.map +1 -1
  139. package/dist/notifications/tmux.js +4 -0
  140. package/dist/notifications/tmux.js.map +1 -1
  141. package/dist/scripts/__tests__/codex-native-hook.test.d.ts +2 -0
  142. package/dist/scripts/__tests__/codex-native-hook.test.d.ts.map +1 -0
  143. package/dist/scripts/__tests__/codex-native-hook.test.js +720 -0
  144. package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -0
  145. package/dist/scripts/codex-native-hook.d.ts +22 -0
  146. package/dist/scripts/codex-native-hook.d.ts.map +1 -0
  147. package/dist/scripts/codex-native-hook.js +594 -0
  148. package/dist/scripts/codex-native-hook.js.map +1 -0
  149. package/dist/scripts/codex-native-pre-post.d.ts +26 -0
  150. package/dist/scripts/codex-native-pre-post.d.ts.map +1 -0
  151. package/dist/scripts/codex-native-pre-post.js +118 -0
  152. package/dist/scripts/codex-native-pre-post.js.map +1 -0
  153. package/dist/scripts/notify-fallback-watcher.js +262 -18
  154. package/dist/scripts/notify-fallback-watcher.js.map +1 -1
  155. package/dist/scripts/notify-hook/auto-nudge.d.ts.map +1 -1
  156. package/dist/scripts/notify-hook/auto-nudge.js +5 -6
  157. package/dist/scripts/notify-hook/auto-nudge.js.map +1 -1
  158. package/dist/scripts/notify-hook/log.d.ts +2 -2
  159. package/dist/scripts/notify-hook/log.d.ts.map +1 -1
  160. package/dist/scripts/notify-hook/log.js +10 -2
  161. package/dist/scripts/notify-hook/log.js.map +1 -1
  162. package/dist/scripts/notify-hook/managed-tmux.d.ts.map +1 -1
  163. package/dist/scripts/notify-hook/managed-tmux.js +2 -0
  164. package/dist/scripts/notify-hook/managed-tmux.js.map +1 -1
  165. package/dist/scripts/notify-hook/orchestration-intent.d.ts +18 -0
  166. package/dist/scripts/notify-hook/orchestration-intent.d.ts.map +1 -0
  167. package/dist/scripts/notify-hook/orchestration-intent.js +72 -0
  168. package/dist/scripts/notify-hook/orchestration-intent.js.map +1 -0
  169. package/dist/scripts/notify-hook/process-runner.js.map +1 -1
  170. package/dist/scripts/notify-hook/ralph-session-resume.d.ts.map +1 -1
  171. package/dist/scripts/notify-hook/ralph-session-resume.js +7 -0
  172. package/dist/scripts/notify-hook/ralph-session-resume.js.map +1 -1
  173. package/dist/scripts/notify-hook/team-dispatch.d.ts +15 -6
  174. package/dist/scripts/notify-hook/team-dispatch.d.ts.map +1 -1
  175. package/dist/scripts/notify-hook/team-dispatch.js +125 -6
  176. package/dist/scripts/notify-hook/team-dispatch.js.map +1 -1
  177. package/dist/scripts/notify-hook/team-leader-nudge.d.ts +3 -2
  178. package/dist/scripts/notify-hook/team-leader-nudge.d.ts.map +1 -1
  179. package/dist/scripts/notify-hook/team-leader-nudge.js +165 -37
  180. package/dist/scripts/notify-hook/team-leader-nudge.js.map +1 -1
  181. package/dist/scripts/notify-hook/team-tmux-guard.d.ts +4 -1
  182. package/dist/scripts/notify-hook/team-tmux-guard.d.ts.map +1 -1
  183. package/dist/scripts/notify-hook/team-tmux-guard.js +33 -44
  184. package/dist/scripts/notify-hook/team-tmux-guard.js.map +1 -1
  185. package/dist/scripts/notify-hook/team-worker.d.ts.map +1 -1
  186. package/dist/scripts/notify-hook/team-worker.js +68 -5
  187. package/dist/scripts/notify-hook/team-worker.js.map +1 -1
  188. package/dist/scripts/notify-hook/utils.d.ts +1 -1
  189. package/dist/scripts/notify-hook/utils.d.ts.map +1 -1
  190. package/dist/scripts/notify-hook/utils.js.map +1 -1
  191. package/dist/scripts/notify-hook.js +55 -32
  192. package/dist/scripts/notify-hook.js.map +1 -1
  193. package/dist/team/__tests__/api-interop.test.js +344 -18
  194. package/dist/team/__tests__/api-interop.test.js.map +1 -1
  195. package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts +2 -0
  196. package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts.map +1 -0
  197. package/dist/team/__tests__/delivery-e2e-smoke.test.js +671 -0
  198. package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -0
  199. package/dist/team/__tests__/mcp-comm.test.js +5 -0
  200. package/dist/team/__tests__/mcp-comm.test.js.map +1 -1
  201. package/dist/team/__tests__/runtime.test.js +422 -12
  202. package/dist/team/__tests__/runtime.test.js.map +1 -1
  203. package/dist/team/__tests__/state.test.js +126 -8
  204. package/dist/team/__tests__/state.test.js.map +1 -1
  205. package/dist/team/__tests__/team-ops-contract.test.js +4 -0
  206. package/dist/team/__tests__/team-ops-contract.test.js.map +1 -1
  207. package/dist/team/__tests__/tmux-session.test.js +160 -0
  208. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  209. package/dist/team/__tests__/worker-bootstrap.test.js +19 -1
  210. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  211. package/dist/team/api-interop.d.ts.map +1 -1
  212. package/dist/team/api-interop.js +95 -23
  213. package/dist/team/api-interop.js.map +1 -1
  214. package/dist/team/contracts.d.ts +11 -1
  215. package/dist/team/contracts.d.ts.map +1 -1
  216. package/dist/team/contracts.js +29 -0
  217. package/dist/team/contracts.js.map +1 -1
  218. package/dist/team/delivery-log.d.ts +14 -0
  219. package/dist/team/delivery-log.d.ts.map +1 -0
  220. package/dist/team/delivery-log.js +35 -0
  221. package/dist/team/delivery-log.js.map +1 -0
  222. package/dist/team/idle-nudge.d.ts +2 -2
  223. package/dist/team/idle-nudge.js +2 -2
  224. package/dist/team/mcp-comm.d.ts +4 -0
  225. package/dist/team/mcp-comm.d.ts.map +1 -1
  226. package/dist/team/mcp-comm.js +84 -1
  227. package/dist/team/mcp-comm.js.map +1 -1
  228. package/dist/team/pane-status.d.ts +149 -0
  229. package/dist/team/pane-status.d.ts.map +1 -0
  230. package/dist/team/pane-status.js +558 -0
  231. package/dist/team/pane-status.js.map +1 -0
  232. package/dist/team/reminder-intents.d.ts +11 -0
  233. package/dist/team/reminder-intents.d.ts.map +1 -0
  234. package/dist/team/reminder-intents.js +40 -0
  235. package/dist/team/reminder-intents.js.map +1 -0
  236. package/dist/team/runtime-cli.d.ts +1 -1
  237. package/dist/team/runtime-cli.js +2 -2
  238. package/dist/team/runtime-cli.js.map +1 -1
  239. package/dist/team/runtime.d.ts +2 -1
  240. package/dist/team/runtime.d.ts.map +1 -1
  241. package/dist/team/runtime.js +407 -190
  242. package/dist/team/runtime.js.map +1 -1
  243. package/dist/team/scaling.d.ts.map +1 -1
  244. package/dist/team/scaling.js +6 -5
  245. package/dist/team/scaling.js.map +1 -1
  246. package/dist/team/state/dispatch.d.ts +4 -1
  247. package/dist/team/state/dispatch.d.ts.map +1 -1
  248. package/dist/team/state/dispatch.js +59 -18
  249. package/dist/team/state/dispatch.js.map +1 -1
  250. package/dist/team/state/mailbox.d.ts.map +1 -1
  251. package/dist/team/state/mailbox.js +39 -2
  252. package/dist/team/state/mailbox.js.map +1 -1
  253. package/dist/team/state/monitor.d.ts +2 -1
  254. package/dist/team/state/monitor.d.ts.map +1 -1
  255. package/dist/team/state/monitor.js +30 -1
  256. package/dist/team/state/monitor.js.map +1 -1
  257. package/dist/team/state/types.d.ts +5 -2
  258. package/dist/team/state/types.d.ts.map +1 -1
  259. package/dist/team/state/types.js.map +1 -1
  260. package/dist/team/state.d.ts +30 -3
  261. package/dist/team/state.d.ts.map +1 -1
  262. package/dist/team/state.js +170 -2
  263. package/dist/team/state.js.map +1 -1
  264. package/dist/team/team-ops.d.ts +5 -1
  265. package/dist/team/team-ops.d.ts.map +1 -1
  266. package/dist/team/team-ops.js +4 -0
  267. package/dist/team/team-ops.js.map +1 -1
  268. package/dist/team/tmux-session.d.ts +2 -0
  269. package/dist/team/tmux-session.d.ts.map +1 -1
  270. package/dist/team/tmux-session.js +19 -3
  271. package/dist/team/tmux-session.js.map +1 -1
  272. package/dist/team/worker-bootstrap.d.ts +4 -0
  273. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  274. package/dist/team/worker-bootstrap.js +33 -6
  275. package/dist/team/worker-bootstrap.js.map +1 -1
  276. package/dist/utils/__tests__/paths.test.js +63 -1
  277. package/dist/utils/__tests__/paths.test.js.map +1 -1
  278. package/dist/utils/__tests__/platform-command.test.js +50 -4
  279. package/dist/utils/__tests__/platform-command.test.js.map +1 -1
  280. package/dist/utils/paths.d.ts +12 -0
  281. package/dist/utils/paths.d.ts.map +1 -1
  282. package/dist/utils/paths.js +44 -2
  283. package/dist/utils/paths.js.map +1 -1
  284. package/dist/utils/platform-command.d.ts.map +1 -1
  285. package/dist/utils/platform-command.js +13 -5
  286. package/dist/utils/platform-command.js.map +1 -1
  287. package/dist/utils/sleep.d.ts.map +1 -1
  288. package/dist/utils/sleep.js +10 -1
  289. package/dist/utils/sleep.js.map +1 -1
  290. package/package.json +1 -1
  291. package/prompts/analyst.md +2 -2
  292. package/prompts/api-reviewer.md +2 -2
  293. package/prompts/architect.md +2 -2
  294. package/prompts/build-fixer.md +2 -2
  295. package/prompts/code-reviewer.md +2 -2
  296. package/prompts/code-simplifier.md +1 -1
  297. package/prompts/critic.md +2 -2
  298. package/prompts/debugger.md +3 -2
  299. package/prompts/dependency-expert.md +2 -2
  300. package/prompts/designer.md +2 -2
  301. package/prompts/executor.md +3 -2
  302. package/prompts/explore.md +2 -2
  303. package/prompts/git-master.md +2 -2
  304. package/prompts/information-architect.md +2 -2
  305. package/prompts/performance-reviewer.md +2 -2
  306. package/prompts/planner.md +3 -2
  307. package/prompts/product-analyst.md +2 -2
  308. package/prompts/product-manager.md +2 -2
  309. package/prompts/qa-tester.md +2 -2
  310. package/prompts/quality-reviewer.md +2 -2
  311. package/prompts/quality-strategist.md +2 -2
  312. package/prompts/researcher.md +2 -2
  313. package/prompts/security-reviewer.md +2 -2
  314. package/prompts/sisyphus-lite.md +2 -2
  315. package/prompts/style-reviewer.md +2 -2
  316. package/prompts/team-executor.md +2 -2
  317. package/prompts/test-engineer.md +2 -2
  318. package/prompts/ux-researcher.md +2 -2
  319. package/prompts/verifier.md +3 -2
  320. package/prompts/vision.md +2 -2
  321. package/prompts/writer.md +2 -2
  322. package/skills/team/SKILL.md +18 -33
  323. package/src/scripts/__tests__/codex-native-hook.test.ts +931 -0
  324. package/src/scripts/codex-native-hook.ts +721 -0
  325. package/src/scripts/codex-native-pre-post.ts +161 -0
  326. package/src/scripts/notify-fallback-watcher.ts +318 -26
  327. package/src/scripts/notify-hook/auto-nudge.ts +5 -10
  328. package/src/scripts/notify-hook/log.ts +18 -4
  329. package/src/scripts/notify-hook/managed-tmux.ts +1 -0
  330. package/src/scripts/notify-hook/orchestration-intent.ts +82 -0
  331. package/src/scripts/notify-hook/process-runner.ts +4 -4
  332. package/src/scripts/notify-hook/ralph-session-resume.ts +9 -0
  333. package/src/scripts/notify-hook/team-dispatch.ts +134 -6
  334. package/src/scripts/notify-hook/team-leader-nudge.ts +183 -37
  335. package/src/scripts/notify-hook/team-tmux-guard.ts +35 -43
  336. package/src/scripts/notify-hook/team-worker.ts +73 -4
  337. package/src/scripts/notify-hook/utils.ts +1 -1
  338. package/src/scripts/notify-hook.ts +64 -32
  339. package/templates/AGENTS.md +21 -11
  340. package/README.de.md +0 -263
  341. package/README.el.md +0 -223
  342. package/README.es.md +0 -263
  343. package/README.fr.md +0 -263
  344. package/README.it.md +0 -263
  345. package/README.ja.md +0 -264
  346. package/README.ko.md +0 -264
  347. package/README.pl.md +0 -216
  348. package/README.pt.md +0 -263
  349. package/README.ru.md +0 -263
  350. package/README.tr.md +0 -263
  351. package/README.vi.md +0 -223
  352. package/README.zh-TW.md +0 -293
  353. package/README.zh.md +0 -264
  354. package/dist/mcp/__tests__/team-server-cleanup.test.d.ts +0 -2
  355. package/dist/mcp/__tests__/team-server-cleanup.test.d.ts.map +0 -1
  356. package/dist/mcp/__tests__/team-server-cleanup.test.js +0 -219
  357. package/dist/mcp/__tests__/team-server-cleanup.test.js.map +0 -1
  358. package/dist/mcp/__tests__/team-server-runtime-deps.test.d.ts +0 -2
  359. package/dist/mcp/__tests__/team-server-runtime-deps.test.d.ts.map +0 -1
  360. package/dist/mcp/__tests__/team-server-runtime-deps.test.js +0 -13
  361. package/dist/mcp/__tests__/team-server-runtime-deps.test.js.map +0 -1
  362. package/dist/mcp/__tests__/team-server-wait.test.d.ts +0 -2
  363. package/dist/mcp/__tests__/team-server-wait.test.d.ts.map +0 -1
  364. package/dist/mcp/__tests__/team-server-wait.test.js +0 -155
  365. package/dist/mcp/__tests__/team-server-wait.test.js.map +0 -1
  366. package/dist/mcp/team-server.d.ts +0 -24
  367. package/dist/mcp/team-server.d.ts.map +0 -1
  368. package/dist/mcp/team-server.js +0 -482
  369. package/dist/mcp/team-server.js.map +0 -1
@@ -0,0 +1,82 @@
1
+ // @ts-nocheck
2
+
3
+ import { safeString } from './utils.js';
4
+
5
+ export const TEAM_ORCHESTRATION_INTENTS = [
6
+ 'followup-reuse',
7
+ 'followup-relaunch',
8
+ 'stalled-unblock',
9
+ 'done-review-or-shutdown',
10
+ 'pending-mailbox-review',
11
+ ] as const;
12
+
13
+ export const ORCHESTRATION_INTENT_TAG_PREFIX = '[OMX_INTENT:';
14
+
15
+ const ORCHESTRATION_INTENT_TAG_RE = /\s*\[OMX_INTENT:[a-z0-9-]+\]/gi;
16
+
17
+ export function buildOrchestrationIntentTag(intent) {
18
+ const normalizedIntent = safeString(intent).trim();
19
+ return normalizedIntent ? `${ORCHESTRATION_INTENT_TAG_PREFIX}${normalizedIntent}]` : '';
20
+ }
21
+
22
+ export function appendOrchestrationIntentTag(text, intent) {
23
+ const normalizedText = safeString(text).trim();
24
+ const tag = buildOrchestrationIntentTag(intent);
25
+ if (!tag) return normalizedText;
26
+ return normalizedText ? `${normalizedText} ${tag}` : tag;
27
+ }
28
+
29
+ export function stripOrchestrationIntentTags(text) {
30
+ return safeString(text).replace(ORCHESTRATION_INTENT_TAG_RE, '');
31
+ }
32
+
33
+ export function classifyLeaderActionState({
34
+ allWorkersIdle = false,
35
+ workerPanesAlive = false,
36
+ taskCounts = {},
37
+ teamProgressStalled = false,
38
+ } = {}) {
39
+ const pending = Number.isFinite(taskCounts.pending) ? taskCounts.pending : 0;
40
+ const blocked = Number.isFinite(taskCounts.blocked) ? taskCounts.blocked : 0;
41
+ const inProgress = Number.isFinite(taskCounts.in_progress) ? taskCounts.in_progress : 0;
42
+ const tasksComplete = pending === 0 && blocked === 0 && inProgress === 0;
43
+ const pendingFollowUpTasks = allWorkersIdle && pending > 0 && blocked === 0 && inProgress === 0;
44
+ const blockedWaitingOnLeader = allWorkersIdle && blocked > 0 && pending === 0 && inProgress === 0;
45
+ const terminalWaitingOnLeader = allWorkersIdle && tasksComplete && workerPanesAlive;
46
+ const stalledWaitingOnLeader = blockedWaitingOnLeader || teamProgressStalled;
47
+
48
+ if (terminalWaitingOnLeader) return 'done_waiting_on_leader';
49
+ if (stalledWaitingOnLeader) return 'stuck_waiting_on_leader';
50
+ if (pendingFollowUpTasks) return 'still_actionable';
51
+ return 'still_actionable';
52
+ }
53
+
54
+ export function resolveAllWorkersIdleIntent(leaderActionState = 'still_actionable') {
55
+ if (leaderActionState === 'done_waiting_on_leader') return 'done-review-or-shutdown';
56
+ if (leaderActionState === 'stuck_waiting_on_leader') return 'stalled-unblock';
57
+ return 'followup-reuse';
58
+ }
59
+
60
+ export function resolveLeaderNudgeIntent({ nudgeReason = '', leaderActionState = 'still_actionable' } = {}) {
61
+ switch (safeString(nudgeReason).trim()) {
62
+ case 'new_mailbox_message':
63
+ case 'stale_leader_with_messages':
64
+ return 'pending-mailbox-review';
65
+ case 'ack_without_start_evidence':
66
+ return 'followup-relaunch';
67
+ case 'stuck_waiting_on_leader':
68
+ case 'stale_leader_panes_alive':
69
+ return 'stalled-unblock';
70
+ case 'done_waiting_on_leader':
71
+ return 'done-review-or-shutdown';
72
+ case 'all_workers_idle':
73
+ default:
74
+ return resolveAllWorkersIdleIntent(leaderActionState);
75
+ }
76
+ }
77
+
78
+ export function resolveWorkerIdleIntent(currentState = 'idle') {
79
+ return safeString(currentState).trim() === 'done'
80
+ ? 'done-review-or-shutdown'
81
+ : 'followup-reuse';
82
+ }
@@ -18,19 +18,19 @@ export function runProcess(command: string, args: string[], timeoutMs = 3000): P
18
18
  reject(new Error(`timeout after ${timeoutMs}ms`));
19
19
  }, timeoutMs);
20
20
 
21
- child.stdout.on('data', (chunk: any) => {
21
+ child.stdout.on('data', (chunk: Buffer) => {
22
22
  stdout += chunk.toString();
23
23
  });
24
- child.stderr.on('data', (chunk: any) => {
24
+ child.stderr.on('data', (chunk: Buffer) => {
25
25
  stderr += chunk.toString();
26
26
  });
27
- child.on('error', (err: any) => {
27
+ child.on('error', (err: Error) => {
28
28
  if (finished) return;
29
29
  finished = true;
30
30
  clearTimeout(timer);
31
31
  reject(err);
32
32
  });
33
- child.on('close', (code: any) => {
33
+ child.on('close', (code: number | null) => {
34
34
  if (finished) return;
35
35
  finished = true;
36
36
  clearTimeout(timer);
@@ -214,6 +214,7 @@ export async function reconcileRalphSessionResume({
214
214
  if (currentRalphState && currentRalphState.active === true) {
215
215
  let changed = false;
216
216
  const updated: Record<string, unknown> = { ...currentRalphState };
217
+ const normalizedPayloadThreadId = safeString(payloadThreadId).trim();
217
218
  if (safeString(updated.owner_omx_session_id).trim() !== currentOmxSessionId) {
218
219
  updated.owner_omx_session_id = currentOmxSessionId;
219
220
  changed = true;
@@ -222,6 +223,14 @@ export async function reconcileRalphSessionResume({
222
223
  updated.owner_codex_session_id = payloadSessionId;
223
224
  changed = true;
224
225
  }
226
+ if (
227
+ !safeString(updated.owner_codex_session_id).trim()
228
+ && normalizedPayloadThreadId
229
+ && safeString(updated.owner_codex_thread_id).trim() !== normalizedPayloadThreadId
230
+ ) {
231
+ updated.owner_codex_thread_id = normalizedPayloadThreadId;
232
+ changed = true;
233
+ }
225
234
  if (
226
235
  typeof updated.owner_codex_thread_id === 'string'
227
236
  && safeString(updated.owner_codex_session_id).trim()
@@ -6,6 +6,7 @@ import { dirname, join, resolve } from 'path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { safeString } from './utils.js';
8
8
  import { resolveBridgeStateDir, resolveRuntimeBinaryPath } from '../../runtime/bridge.js';
9
+ import { appendTeamDeliveryLog } from '../../team/delivery-log.js';
9
10
 
10
11
  const __filename = fileURLToPath(import.meta.url);
11
12
  const __dirname = dirname(__filename);
@@ -372,6 +373,7 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
372
373
  if (!target) {
373
374
  return { ok: false, reason: 'missing_tmux_target' };
374
375
  }
376
+ const leaderTargeted = request.to_worker === 'leader-fixed';
375
377
  let resolution;
376
378
  if (target.type === 'session') {
377
379
  const paneId = await resolveSessionToPane(target.value).catch(() => null);
@@ -384,14 +386,24 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
384
386
  if (!resolution.paneTarget) {
385
387
  return { ok: false, reason: `target_resolution_failed:${resolution.reason}` };
386
388
  }
389
+ const isLeaderMailboxDispatch = request.to_worker === 'leader-fixed';
387
390
  const paneGuard = await evaluatePaneInjectionReadiness(resolution.paneTarget, {
388
391
  skipIfScrolling: true,
389
- requireRunningAgent: false,
392
+ requireRunningAgent: leaderTargeted,
390
393
  requireReady: false,
391
394
  requireIdle: false,
395
+ requireObservableState: leaderTargeted,
392
396
  });
393
397
  if (!paneGuard.ok) {
394
- return { ok: false, reason: paneGuard.reason };
398
+ return {
399
+ ok: false,
400
+ reason: paneGuard.reason,
401
+ pane: resolution.paneTarget,
402
+ pane_source: resolution.source || null,
403
+ readiness_evidence: paneGuard.readinessEvidence || null,
404
+ pane_current_command: paneGuard.paneCurrentCommand || null,
405
+ tmux_injection_attempted: false,
406
+ };
395
407
  }
396
408
 
397
409
  const attemptCountAtStart = Number.isFinite(request.attempt_count)
@@ -427,7 +439,15 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
427
439
  typePrompt: shouldTypePrompt,
428
440
  });
429
441
  if (!sendResult.ok) {
430
- return { ok: false, reason: sendResult.error || sendResult.reason };
442
+ return {
443
+ ok: false,
444
+ reason: sendResult.error || sendResult.reason,
445
+ pane: resolution.paneTarget,
446
+ pane_source: resolution.source || null,
447
+ readiness_evidence: paneGuard.readinessEvidence || null,
448
+ pane_current_command: paneGuard.paneCurrentCommand || null,
449
+ tmux_injection_attempted: true,
450
+ };
431
451
  }
432
452
 
433
453
  // Post-injection verification: confirm the trigger text was consumed.
@@ -448,7 +468,15 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
448
468
  // Worker is actively processing (mirrors sync path tmux-session.ts:1292-1294)
449
469
  if (paneHasActiveTask(wideCap.stdout)) {
450
470
  runtimeExec({ command: 'MarkDelivered', request_id: request.request_id }, stateDir);
451
- return { ok: true, reason: 'tmux_send_keys_confirmed_active_task', pane: resolution.paneTarget };
471
+ return {
472
+ ok: true,
473
+ reason: 'tmux_send_keys_confirmed_active_task',
474
+ pane: resolution.paneTarget,
475
+ pane_source: resolution.source || null,
476
+ readiness_evidence: paneGuard.readinessEvidence || null,
477
+ pane_current_command: paneGuard.paneCurrentCommand || null,
478
+ tmux_injection_attempted: true,
479
+ };
452
480
  }
453
481
  // Do not declare success while a *worker* pane is still bootstrapping / not
454
482
  // input-ready. Otherwise a pre-ready send can be marked "confirmed" and later
@@ -461,7 +489,15 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
461
489
  const triggerNearTail = capturedPaneContainsTriggerNearTail(wideCap.stdout, request.trigger_message);
462
490
  if (!triggerInNarrow && !triggerNearTail) {
463
491
  runtimeExec({ command: 'MarkDelivered', request_id: request.request_id }, stateDir);
464
- return { ok: true, reason: 'tmux_send_keys_confirmed', pane: resolution.paneTarget };
492
+ return {
493
+ ok: true,
494
+ reason: 'tmux_send_keys_confirmed',
495
+ pane: resolution.paneTarget,
496
+ pane_source: resolution.source || null,
497
+ readiness_evidence: paneGuard.readinessEvidence || null,
498
+ pane_current_command: paneGuard.paneCurrentCommand || null,
499
+ tmux_injection_attempted: true,
500
+ };
465
501
  }
466
502
  } catch {
467
503
  // capture failed; fall through to retry C-m
@@ -476,7 +512,15 @@ async function injectDispatchRequest(request, config, cwd, stateDir) {
476
512
  }
477
513
 
478
514
  // Trigger text is still visible after all retry rounds.
479
- return { ok: true, reason: 'tmux_send_keys_unconfirmed', pane: resolution.paneTarget };
515
+ return {
516
+ ok: true,
517
+ reason: 'tmux_send_keys_unconfirmed',
518
+ pane: resolution.paneTarget,
519
+ pane_source: resolution.source || null,
520
+ readiness_evidence: paneGuard.readinessEvidence || null,
521
+ pane_current_command: paneGuard.paneCurrentCommand || null,
522
+ tmux_injection_attempted: true,
523
+ };
480
524
  }
481
525
 
482
526
  function shouldSkipRequest(request) {
@@ -505,12 +549,38 @@ async function appendDispatchLog(logsDir, event) {
505
549
  await appendFile(path, `${JSON.stringify({ timestamp: new Date().toISOString(), ...event })}\n`).catch(() => {});
506
550
  }
507
551
 
552
+ async function appendDeliveryTelemetry(logsDir, event) {
553
+ await appendTeamDeliveryLog(logsDir, {
554
+ source: 'notify-hook.team-dispatch',
555
+ ...event,
556
+ }).catch(() => {});
557
+ }
558
+
559
+ function buildDispatchAttemptEvidence(result, fallback = {}) {
560
+ return {
561
+ pane_target: safeString(result?.pane || fallback.pane || '').trim() || null,
562
+ pane_source: safeString(result?.pane_source || fallback.pane_source || '').trim() || null,
563
+ readiness_evidence: safeString(result?.readiness_evidence || fallback.readiness_evidence || '').trim() || null,
564
+ pane_current_command: safeString(result?.pane_current_command || fallback.pane_current_command || '').trim() || null,
565
+ tmux_injection_attempted:
566
+ typeof result?.tmux_injection_attempted === 'boolean'
567
+ ? result.tmux_injection_attempted
568
+ : (typeof fallback.tmux_injection_attempted === 'boolean' ? fallback.tmux_injection_attempted : null),
569
+ };
570
+ }
571
+
508
572
  export async function drainPendingTeamDispatch({
509
573
  cwd,
510
574
  stateDir = resolveBridgeStateDir(cwd),
511
575
  logsDir = join(cwd, '.omx', 'logs'),
512
576
  maxPerTick = 5,
513
577
  injector = injectDispatchRequest,
578
+ }: {
579
+ cwd?: string;
580
+ stateDir?: string;
581
+ logsDir?: string;
582
+ maxPerTick?: number;
583
+ injector?: typeof injectDispatchRequest;
514
584
  } = {}) {
515
585
  if (safeString(process.env.OMX_TEAM_WORKER)) {
516
586
  return { processed: 0, skipped: 0, failed: 0, reason: 'worker_context' };
@@ -575,6 +645,20 @@ export async function drainPendingTeamDispatch({
575
645
  tmux_session: safeString(config?.tmux_session).trim() || null,
576
646
  leader_pane_id: safeString(config?.leader_pane_id).trim() || null,
577
647
  tmux_injection_attempted: false,
648
+ pane_target: null,
649
+ pane_source: null,
650
+ readiness_evidence: null,
651
+ pane_current_command: null,
652
+ });
653
+ await appendDeliveryTelemetry(logsDir, {
654
+ event: 'dispatch_result',
655
+ team: teamName,
656
+ request_id: request.request_id,
657
+ message_id: request.message_id || null,
658
+ to_worker: request.to_worker,
659
+ transport: 'send-keys',
660
+ result: 'deferred',
661
+ reason: LEADER_PANE_MISSING_DEFERRED_REASON,
578
662
  });
579
663
  // On the legacy fallback lane, requests.json still carries the queue
580
664
  // state for this deferred request; this event stays a progress
@@ -645,6 +729,17 @@ export async function drainPendingTeamDispatch({
645
729
  worker: request.to_worker,
646
730
  attempt: request.attempt_count,
647
731
  reason: result.reason,
732
+ ...buildDispatchAttemptEvidence(result),
733
+ });
734
+ await appendDeliveryTelemetry(logsDir, {
735
+ event: 'dispatch_result',
736
+ team: teamName,
737
+ request_id: request.request_id,
738
+ message_id: request.message_id || null,
739
+ to_worker: request.to_worker,
740
+ transport: 'send-keys',
741
+ result: 'retry',
742
+ reason: result.reason,
648
743
  });
649
744
  await emitOperationalHookEvent(cwd, 'retry-needed', {
650
745
  team: teamName,
@@ -672,6 +767,17 @@ export async function drainPendingTeamDispatch({
672
767
  worker: request.to_worker,
673
768
  message_id: request.message_id || null,
674
769
  reason: request.last_reason,
770
+ ...buildDispatchAttemptEvidence(result),
771
+ });
772
+ await appendDeliveryTelemetry(logsDir, {
773
+ event: 'dispatch_result',
774
+ team: teamName,
775
+ request_id: request.request_id,
776
+ message_id: request.message_id || null,
777
+ to_worker: request.to_worker,
778
+ transport: 'send-keys',
779
+ result: 'failed',
780
+ reason: request.last_reason,
675
781
  });
676
782
  await emitOperationalHookEvent(cwd, 'failed', {
677
783
  team: teamName,
@@ -704,6 +810,17 @@ export async function drainPendingTeamDispatch({
704
810
  worker: request.to_worker,
705
811
  message_id: request.message_id || null,
706
812
  reason: result.reason,
813
+ ...buildDispatchAttemptEvidence(result),
814
+ });
815
+ await appendDeliveryTelemetry(logsDir, {
816
+ event: 'dispatch_result',
817
+ team: teamName,
818
+ request_id: request.request_id,
819
+ message_id: request.message_id || null,
820
+ to_worker: request.to_worker,
821
+ transport: 'send-keys',
822
+ result: 'notified',
823
+ reason: result.reason,
707
824
  });
708
825
  } else {
709
826
  request.status = 'failed';
@@ -720,6 +837,17 @@ export async function drainPendingTeamDispatch({
720
837
  worker: request.to_worker,
721
838
  message_id: request.message_id || null,
722
839
  reason: result.reason,
840
+ ...buildDispatchAttemptEvidence(result),
841
+ });
842
+ await appendDeliveryTelemetry(logsDir, {
843
+ event: 'dispatch_result',
844
+ team: teamName,
845
+ request_id: request.request_id,
846
+ message_id: request.message_id || null,
847
+ to_worker: request.to_worker,
848
+ transport: 'send-keys',
849
+ result: 'failed',
850
+ reason: result.reason,
723
851
  });
724
852
  await emitOperationalHookEvent(cwd, result.reason === LEADER_PANE_MISSING_DEFERRED_REASON ? 'handoff-needed' : 'failed', {
725
853
  team: teamName,