oh-my-copilot 5.26.0 → 5.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (779) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/agents/executor.md +1 -0
  4. package/bridge/claude-md-coordinator.cjs +2 -2
  5. package/bridge/cli.cjs +23572 -17129
  6. package/bridge/mcp-server.cjs +2721 -1497
  7. package/bridge/runtime-cli.cjs +4707 -1925
  8. package/bridge/team-mcp.cjs +2917 -816
  9. package/bridge/team.js +5397 -2381
  10. package/copilot/agents/executor.md +1 -0
  11. package/copilot/hooks.json +3 -3
  12. package/dist/__tests__/arguments-literal-substitution.test.d.ts +2 -0
  13. package/dist/__tests__/arguments-literal-substitution.test.d.ts.map +1 -0
  14. package/dist/__tests__/arguments-literal-substitution.test.js +34 -0
  15. package/dist/__tests__/arguments-literal-substitution.test.js.map +1 -0
  16. package/dist/__tests__/bridge-self-contained.test.d.ts +2 -0
  17. package/dist/__tests__/bridge-self-contained.test.d.ts.map +1 -0
  18. package/dist/__tests__/bridge-self-contained.test.js +44 -0
  19. package/dist/__tests__/bridge-self-contained.test.js.map +1 -0
  20. package/dist/__tests__/context-safety.test.js +1 -1
  21. package/dist/__tests__/context-safety.test.js.map +1 -1
  22. package/dist/__tests__/copilot-hook-dispatch.test.js +5 -1
  23. package/dist/__tests__/copilot-hook-dispatch.test.js.map +1 -1
  24. package/dist/__tests__/copilot-hooks-manifest.test.js +15 -1
  25. package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
  26. package/dist/__tests__/directory-context-injector-registration.test.js +5 -2
  27. package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -1
  28. package/dist/__tests__/doctor-conflicts.test.js +61 -0
  29. package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
  30. package/dist/__tests__/hook-command-normalizer.test.js +96 -58
  31. package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
  32. package/dist/__tests__/hooks/session-end-cleanup.test.js +87 -1
  33. package/dist/__tests__/hooks/session-end-cleanup.test.js.map +1 -1
  34. package/dist/__tests__/hooks-command-escaping.test.js +18 -16
  35. package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
  36. package/dist/__tests__/hud/omc-state.test.js +62 -1
  37. package/dist/__tests__/hud/omc-state.test.js.map +1 -1
  38. package/dist/__tests__/installer-mcp-config.test.js +39 -1
  39. package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
  40. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js +1 -1
  41. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js.map +1 -1
  42. package/dist/__tests__/keyword-detector-echo-guard.test.js +13 -1
  43. package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
  44. package/dist/__tests__/keyword-detector-script.test.js +201 -0
  45. package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
  46. package/dist/__tests__/npm-package-surface-helpers.d.ts.map +1 -1
  47. package/dist/__tests__/npm-package-surface-helpers.js +8 -4
  48. package/dist/__tests__/npm-package-surface-helpers.js.map +1 -1
  49. package/dist/__tests__/plugin-setup-deps.test.js +144 -71
  50. package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
  51. package/dist/__tests__/preemptive-compaction-hook.test.js +62 -5
  52. package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
  53. package/dist/__tests__/ralph-prd-mandatory.test.js +3 -0
  54. package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
  55. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts +10 -0
  56. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts.map +1 -0
  57. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js +241 -0
  58. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js.map +1 -0
  59. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts +9 -0
  60. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts.map +1 -0
  61. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js +162 -0
  62. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js.map +1 -0
  63. package/dist/__tests__/repair-plugin-cache-script.test.js +7 -1
  64. package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
  65. package/dist/__tests__/run-cjs-graceful-fallback.test.js +3 -2
  66. package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
  67. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +4 -1
  68. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
  69. package/dist/__tests__/setup-contracts-regression.test.js +13 -10
  70. package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
  71. package/dist/__tests__/skills.test.js +10 -9
  72. package/dist/__tests__/skills.test.js.map +1 -1
  73. package/dist/alias-retirement/__tests__/registry.test.js +2 -2
  74. package/dist/cli/__tests__/doctor-conflicts-json.test.js +2 -2
  75. package/dist/cli/__tests__/doctor-conflicts-json.test.js.map +1 -1
  76. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts +10 -0
  77. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts.map +1 -0
  78. package/dist/cli/__tests__/herdr-no-raw-calls.test.js +54 -0
  79. package/dist/cli/__tests__/herdr-no-raw-calls.test.js.map +1 -0
  80. package/dist/cli/__tests__/interop-herdr.test.d.ts +9 -0
  81. package/dist/cli/__tests__/interop-herdr.test.d.ts.map +1 -0
  82. package/dist/cli/__tests__/interop-herdr.test.js +138 -0
  83. package/dist/cli/__tests__/interop-herdr.test.js.map +1 -0
  84. package/dist/cli/__tests__/launch-herdr.test.d.ts +10 -0
  85. package/dist/cli/__tests__/launch-herdr.test.d.ts.map +1 -0
  86. package/dist/cli/__tests__/launch-herdr.test.js +141 -0
  87. package/dist/cli/__tests__/launch-herdr.test.js.map +1 -0
  88. package/dist/cli/__tests__/launch.test.js +140 -10
  89. package/dist/cli/__tests__/launch.test.js.map +1 -1
  90. package/dist/cli/__tests__/plugin-dir-capture.test.js +2 -0
  91. package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
  92. package/dist/cli/__tests__/ralph-afk.test.js +392 -2
  93. package/dist/cli/__tests__/ralph-afk.test.js.map +1 -1
  94. package/dist/cli/__tests__/ralph-closeout.test.d.ts +2 -0
  95. package/dist/cli/__tests__/ralph-closeout.test.d.ts.map +1 -0
  96. package/dist/cli/__tests__/ralph-closeout.test.js +156 -0
  97. package/dist/cli/__tests__/ralph-closeout.test.js.map +1 -0
  98. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts +2 -0
  99. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts.map +1 -0
  100. package/dist/cli/__tests__/subcommand-json-flag.test.js +86 -0
  101. package/dist/cli/__tests__/subcommand-json-flag.test.js.map +1 -0
  102. package/dist/cli/__tests__/team-resume-v2.test.js +46 -0
  103. package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -1
  104. package/dist/cli/__tests__/team.test.js +24 -0
  105. package/dist/cli/__tests__/team.test.js.map +1 -1
  106. package/dist/cli/__tests__/wait-teleport-json.test.js +2 -2
  107. package/dist/cli/__tests__/wait-teleport-json.test.js.map +1 -1
  108. package/dist/cli/commands/__tests__/factory-run-cli.test.js +20 -0
  109. package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
  110. package/dist/cli/commands/__tests__/release-cli.test.js +11 -0
  111. package/dist/cli/commands/__tests__/release-cli.test.js.map +1 -1
  112. package/dist/cli/commands/__tests__/ship-cli.test.js +1 -1
  113. package/dist/cli/commands/__tests__/ship-cli.test.js.map +1 -1
  114. package/dist/cli/commands/__tests__/teleport.test.js +42 -0
  115. package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
  116. package/dist/cli/commands/__tests__/wait.test.js +33 -1
  117. package/dist/cli/commands/__tests__/wait.test.js.map +1 -1
  118. package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
  119. package/dist/cli/commands/doctor-conflicts.js +6 -2
  120. package/dist/cli/commands/doctor-conflicts.js.map +1 -1
  121. package/dist/cli/commands/factory-bench.d.ts.map +1 -1
  122. package/dist/cli/commands/factory-bench.js +17 -3
  123. package/dist/cli/commands/factory-bench.js.map +1 -1
  124. package/dist/cli/commands/factory-dashboard.d.ts +5 -1
  125. package/dist/cli/commands/factory-dashboard.d.ts.map +1 -1
  126. package/dist/cli/commands/factory-dashboard.js +6 -2
  127. package/dist/cli/commands/factory-dashboard.js.map +1 -1
  128. package/dist/cli/commands/factory.d.ts +6 -0
  129. package/dist/cli/commands/factory.d.ts.map +1 -1
  130. package/dist/cli/commands/factory.js +45 -4
  131. package/dist/cli/commands/factory.js.map +1 -1
  132. package/dist/cli/commands/ralph.d.ts +36 -1
  133. package/dist/cli/commands/ralph.d.ts.map +1 -1
  134. package/dist/cli/commands/ralph.js +298 -50
  135. package/dist/cli/commands/ralph.js.map +1 -1
  136. package/dist/cli/commands/release.d.ts +3 -1
  137. package/dist/cli/commands/release.d.ts.map +1 -1
  138. package/dist/cli/commands/release.js +12 -3
  139. package/dist/cli/commands/release.js.map +1 -1
  140. package/dist/cli/commands/ship.d.ts.map +1 -1
  141. package/dist/cli/commands/ship.js +8 -4
  142. package/dist/cli/commands/ship.js.map +1 -1
  143. package/dist/cli/commands/team.d.ts.map +1 -1
  144. package/dist/cli/commands/team.js +2 -0
  145. package/dist/cli/commands/team.js.map +1 -1
  146. package/dist/cli/commands/teleport.d.ts.map +1 -1
  147. package/dist/cli/commands/teleport.js +6 -1
  148. package/dist/cli/commands/teleport.js.map +1 -1
  149. package/dist/cli/commands/wait.d.ts.map +1 -1
  150. package/dist/cli/commands/wait.js +3 -1
  151. package/dist/cli/commands/wait.js.map +1 -1
  152. package/dist/cli/index.js +8 -8
  153. package/dist/cli/index.js.map +1 -1
  154. package/dist/cli/interop.d.ts +4 -3
  155. package/dist/cli/interop.d.ts.map +1 -1
  156. package/dist/cli/interop.js +95 -4
  157. package/dist/cli/interop.js.map +1 -1
  158. package/dist/cli/launch.d.ts +17 -2
  159. package/dist/cli/launch.d.ts.map +1 -1
  160. package/dist/cli/launch.js +110 -12
  161. package/dist/cli/launch.js.map +1 -1
  162. package/dist/cli/team.d.ts.map +1 -1
  163. package/dist/cli/team.js +4 -1
  164. package/dist/cli/team.js.map +1 -1
  165. package/dist/commands/index.js +1 -1
  166. package/dist/commands/index.js.map +1 -1
  167. package/dist/config/loader.d.ts.map +1 -1
  168. package/dist/config/loader.js +17 -0
  169. package/dist/config/loader.js.map +1 -1
  170. package/dist/copilot-run/job.d.ts +2 -0
  171. package/dist/copilot-run/job.d.ts.map +1 -1
  172. package/dist/copilot-run/job.js +3 -0
  173. package/dist/copilot-run/job.js.map +1 -1
  174. package/dist/copilot-run/sandbox.d.ts +16 -0
  175. package/dist/copilot-run/sandbox.d.ts.map +1 -1
  176. package/dist/copilot-run/sandbox.js +29 -2
  177. package/dist/copilot-run/sandbox.js.map +1 -1
  178. package/dist/factory/bench/__tests__/bench.units.test.js +133 -1
  179. package/dist/factory/bench/__tests__/bench.units.test.js.map +1 -1
  180. package/dist/factory/bench/score.d.ts +33 -1
  181. package/dist/factory/bench/score.d.ts.map +1 -1
  182. package/dist/factory/bench/score.js +95 -5
  183. package/dist/factory/bench/score.js.map +1 -1
  184. package/dist/factory/board/__tests__/board.test.js +31 -1
  185. package/dist/factory/board/__tests__/board.test.js.map +1 -1
  186. package/dist/factory/board/collect.d.ts +5 -2
  187. package/dist/factory/board/collect.d.ts.map +1 -1
  188. package/dist/factory/board/collect.js +7 -2
  189. package/dist/factory/board/collect.js.map +1 -1
  190. package/dist/factory/check/cli.d.ts.map +1 -1
  191. package/dist/factory/check/cli.js +6 -2
  192. package/dist/factory/check/cli.js.map +1 -1
  193. package/dist/factory/dashboard/__tests__/dashboard.test.js +10 -0
  194. package/dist/factory/dashboard/__tests__/dashboard.test.js.map +1 -1
  195. package/dist/factory/run/__tests__/auto-merge.test.js +2 -0
  196. package/dist/factory/run/__tests__/auto-merge.test.js.map +1 -1
  197. package/dist/factory/run/__tests__/claims.test.js +15 -0
  198. package/dist/factory/run/__tests__/claims.test.js.map +1 -1
  199. package/dist/factory/run/__tests__/container-gate.test.js +59 -1
  200. package/dist/factory/run/__tests__/container-gate.test.js.map +1 -1
  201. package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -1
  202. package/dist/factory/run/__tests__/engine-local-harness.js +6 -0
  203. package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -1
  204. package/dist/factory/run/__tests__/engine-local-harness.test.d.ts +2 -0
  205. package/dist/factory/run/__tests__/engine-local-harness.test.d.ts.map +1 -0
  206. package/dist/factory/run/__tests__/engine-local-harness.test.js +23 -0
  207. package/dist/factory/run/__tests__/engine-local-harness.test.js.map +1 -0
  208. package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts +2 -0
  209. package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts.map +1 -0
  210. package/dist/factory/run/__tests__/engine.gates-git-transport.test.js +392 -0
  211. package/dist/factory/run/__tests__/engine.gates-git-transport.test.js.map +1 -0
  212. package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts +2 -0
  213. package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts.map +1 -0
  214. package/dist/factory/run/__tests__/engine.gates-test-delta.test.js +347 -0
  215. package/dist/factory/run/__tests__/engine.gates-test-delta.test.js.map +1 -0
  216. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts +2 -0
  217. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts.map +1 -0
  218. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js +235 -0
  219. package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js.map +1 -0
  220. package/dist/factory/run/__tests__/engine.human-merged.test.d.ts +2 -0
  221. package/dist/factory/run/__tests__/engine.human-merged.test.d.ts.map +1 -0
  222. package/dist/factory/run/__tests__/engine.human-merged.test.js +171 -0
  223. package/dist/factory/run/__tests__/engine.human-merged.test.js.map +1 -0
  224. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts +2 -0
  225. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts.map +1 -0
  226. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js +56 -0
  227. package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js.map +1 -0
  228. package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts +2 -0
  229. package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts.map +1 -0
  230. package/dist/factory/run/__tests__/engine.local.human-merged.test.js +48 -0
  231. package/dist/factory/run/__tests__/engine.local.human-merged.test.js.map +1 -0
  232. package/dist/factory/run/__tests__/engine.stall.test.d.ts +2 -0
  233. package/dist/factory/run/__tests__/engine.stall.test.d.ts.map +1 -0
  234. package/dist/factory/run/__tests__/engine.stall.test.js +137 -0
  235. package/dist/factory/run/__tests__/engine.stall.test.js.map +1 -0
  236. package/dist/factory/run/__tests__/fake-lanes.d.ts +6 -0
  237. package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
  238. package/dist/factory/run/__tests__/fake-lanes.js +17 -1
  239. package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
  240. package/dist/factory/run/__tests__/human-merged.test.d.ts +2 -0
  241. package/dist/factory/run/__tests__/human-merged.test.d.ts.map +1 -0
  242. package/dist/factory/run/__tests__/human-merged.test.js +301 -0
  243. package/dist/factory/run/__tests__/human-merged.test.js.map +1 -0
  244. package/dist/factory/run/__tests__/lane.test.js +2 -0
  245. package/dist/factory/run/__tests__/lane.test.js.map +1 -1
  246. package/dist/factory/run/__tests__/merge-policy.test.js +16 -0
  247. package/dist/factory/run/__tests__/merge-policy.test.js.map +1 -1
  248. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts +2 -0
  249. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts.map +1 -0
  250. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js +137 -0
  251. package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js.map +1 -0
  252. package/dist/factory/run/__tests__/prepare-gates.crash.test.js +21 -0
  253. package/dist/factory/run/__tests__/prepare-gates.crash.test.js.map +1 -1
  254. package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js +11 -0
  255. package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js.map +1 -1
  256. package/dist/factory/run/__tests__/prepare-gates.test.js +39 -0
  257. package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
  258. package/dist/factory/run/__tests__/private-store.test.js +22 -1
  259. package/dist/factory/run/__tests__/private-store.test.js.map +1 -1
  260. package/dist/factory/run/__tests__/test-delta.test.d.ts +2 -0
  261. package/dist/factory/run/__tests__/test-delta.test.d.ts.map +1 -0
  262. package/dist/factory/run/__tests__/test-delta.test.js +239 -0
  263. package/dist/factory/run/__tests__/test-delta.test.js.map +1 -0
  264. package/dist/factory/run/__tests__/units.test.js +219 -2
  265. package/dist/factory/run/__tests__/units.test.js.map +1 -1
  266. package/dist/factory/run/__tests__/workspace-tree.test.js +16 -4
  267. package/dist/factory/run/__tests__/workspace-tree.test.js.map +1 -1
  268. package/dist/factory/run/auto-merge.d.ts +4 -0
  269. package/dist/factory/run/auto-merge.d.ts.map +1 -1
  270. package/dist/factory/run/auto-merge.js +3 -0
  271. package/dist/factory/run/auto-merge.js.map +1 -1
  272. package/dist/factory/run/budget.d.ts +6 -0
  273. package/dist/factory/run/budget.d.ts.map +1 -1
  274. package/dist/factory/run/budget.js +5 -0
  275. package/dist/factory/run/budget.js.map +1 -1
  276. package/dist/factory/run/claims.d.ts.map +1 -1
  277. package/dist/factory/run/claims.js +5 -3
  278. package/dist/factory/run/claims.js.map +1 -1
  279. package/dist/factory/run/container-gate.d.ts +14 -1
  280. package/dist/factory/run/container-gate.d.ts.map +1 -1
  281. package/dist/factory/run/container-gate.js +42 -4
  282. package/dist/factory/run/container-gate.js.map +1 -1
  283. package/dist/factory/run/engine.d.ts +46 -1
  284. package/dist/factory/run/engine.d.ts.map +1 -1
  285. package/dist/factory/run/engine.js +779 -68
  286. package/dist/factory/run/engine.js.map +1 -1
  287. package/dist/factory/run/human-merged.d.ts +105 -0
  288. package/dist/factory/run/human-merged.d.ts.map +1 -0
  289. package/dist/factory/run/human-merged.js +256 -0
  290. package/dist/factory/run/human-merged.js.map +1 -0
  291. package/dist/factory/run/lane.d.ts +2 -0
  292. package/dist/factory/run/lane.d.ts.map +1 -1
  293. package/dist/factory/run/lane.js +1 -0
  294. package/dist/factory/run/lane.js.map +1 -1
  295. package/dist/factory/run/merge-policy.d.ts +1 -2
  296. package/dist/factory/run/merge-policy.d.ts.map +1 -1
  297. package/dist/factory/run/merge-policy.js +5 -12
  298. package/dist/factory/run/merge-policy.js.map +1 -1
  299. package/dist/factory/run/prepare.d.ts +40 -1
  300. package/dist/factory/run/prepare.d.ts.map +1 -1
  301. package/dist/factory/run/prepare.js +240 -38
  302. package/dist/factory/run/prepare.js.map +1 -1
  303. package/dist/factory/run/private-run.d.ts +2 -1
  304. package/dist/factory/run/private-run.d.ts.map +1 -1
  305. package/dist/factory/run/private-run.js +5 -2
  306. package/dist/factory/run/private-run.js.map +1 -1
  307. package/dist/factory/run/prompts.d.ts +2 -2
  308. package/dist/factory/run/prompts.d.ts.map +1 -1
  309. package/dist/factory/run/prompts.js +7 -6
  310. package/dist/factory/run/prompts.js.map +1 -1
  311. package/dist/factory/run/sandbox-exec.d.ts +9 -1
  312. package/dist/factory/run/sandbox-exec.d.ts.map +1 -1
  313. package/dist/factory/run/sandbox-exec.js.map +1 -1
  314. package/dist/factory/run/state.d.ts +54 -1
  315. package/dist/factory/run/state.d.ts.map +1 -1
  316. package/dist/factory/run/state.js +23 -2
  317. package/dist/factory/run/state.js.map +1 -1
  318. package/dist/factory/run/test-delta.d.ts +123 -0
  319. package/dist/factory/run/test-delta.d.ts.map +1 -0
  320. package/dist/factory/run/test-delta.js +236 -0
  321. package/dist/factory/run/test-delta.js.map +1 -0
  322. package/dist/features/__tests__/checkpoint.test.js +118 -1
  323. package/dist/features/__tests__/checkpoint.test.js.map +1 -1
  324. package/dist/features/__tests__/jev-model-routing.test.js +20 -2
  325. package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
  326. package/dist/features/__tests__/jev-slop-warning.test.js +22 -2
  327. package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -1
  328. package/dist/features/checkpoint/index.d.ts.map +1 -1
  329. package/dist/features/checkpoint/index.js +25 -8
  330. package/dist/features/checkpoint/index.js.map +1 -1
  331. package/dist/features/jev-slop-warning.d.ts +3 -2
  332. package/dist/features/jev-slop-warning.d.ts.map +1 -1
  333. package/dist/features/jev-slop-warning.js +5 -3
  334. package/dist/features/jev-slop-warning.js.map +1 -1
  335. package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
  336. package/dist/features/rate-limit-wait/daemon.js +55 -9
  337. package/dist/features/rate-limit-wait/daemon.js.map +1 -1
  338. package/dist/features/rate-limit-wait/tmux-detector.d.ts +33 -0
  339. package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
  340. package/dist/features/rate-limit-wait/tmux-detector.js +156 -0
  341. package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
  342. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +4 -2
  343. package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
  344. package/dist/forge/ado/__tests__/adapter.test.js +7 -0
  345. package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
  346. package/dist/forge/ado/reviews.d.ts.map +1 -1
  347. package/dist/forge/ado/reviews.js +6 -0
  348. package/dist/forge/ado/reviews.js.map +1 -1
  349. package/dist/forge/github/__tests__/mergeability.test.d.ts +2 -0
  350. package/dist/forge/github/__tests__/mergeability.test.d.ts.map +1 -0
  351. package/dist/forge/github/__tests__/mergeability.test.js +34 -0
  352. package/dist/forge/github/__tests__/mergeability.test.js.map +1 -0
  353. package/dist/forge/github/reviews.d.ts +7 -1
  354. package/dist/forge/github/reviews.d.ts.map +1 -1
  355. package/dist/forge/github/reviews.js +13 -0
  356. package/dist/forge/github/reviews.js.map +1 -1
  357. package/dist/forge/local/__tests__/mirror.test.js +3 -1
  358. package/dist/forge/local/__tests__/mirror.test.js.map +1 -1
  359. package/dist/forge/local/__tests__/reviews.test.js +19 -0
  360. package/dist/forge/local/__tests__/reviews.test.js.map +1 -1
  361. package/dist/forge/local/mirror.d.ts +2 -0
  362. package/dist/forge/local/mirror.d.ts.map +1 -1
  363. package/dist/forge/local/mirror.js +2 -0
  364. package/dist/forge/local/mirror.js.map +1 -1
  365. package/dist/forge/local/reviews.d.ts.map +1 -1
  366. package/dist/forge/local/reviews.js +12 -1
  367. package/dist/forge/local/reviews.js.map +1 -1
  368. package/dist/forge/types.d.ts +13 -0
  369. package/dist/forge/types.d.ts.map +1 -1
  370. package/dist/graph/schema.d.ts +10 -10
  371. package/dist/hooks/__tests__/precompact-restore.test.js +38 -0
  372. package/dist/hooks/__tests__/precompact-restore.test.js.map +1 -1
  373. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +7 -2
  374. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
  375. package/dist/hooks/auto-slash-command/executor.js +1 -1
  376. package/dist/hooks/auto-slash-command/executor.js.map +1 -1
  377. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +24 -2
  378. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -1
  379. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
  380. package/dist/hooks/code-simplifier/jev-shadow.js +6 -4
  381. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
  382. package/dist/hooks/jev/__tests__/client.test.js +20 -1
  383. package/dist/hooks/jev/__tests__/client.test.js.map +1 -1
  384. package/dist/hooks/jev/__tests__/log-context.test.d.ts +2 -0
  385. package/dist/hooks/jev/__tests__/log-context.test.d.ts.map +1 -0
  386. package/dist/hooks/jev/__tests__/log-context.test.js +97 -0
  387. package/dist/hooks/jev/__tests__/log-context.test.js.map +1 -0
  388. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts +2 -0
  389. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts.map +1 -0
  390. package/dist/hooks/jev/__tests__/log-rotation.test.js +148 -0
  391. package/dist/hooks/jev/__tests__/log-rotation.test.js.map +1 -0
  392. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts +2 -0
  393. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts.map +1 -0
  394. package/dist/hooks/jev/__tests__/resolver-request-count.test.js +117 -0
  395. package/dist/hooks/jev/__tests__/resolver-request-count.test.js.map +1 -0
  396. package/dist/hooks/jev/__tests__/resolver.test.js +63 -1
  397. package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
  398. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts +2 -0
  399. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts.map +1 -0
  400. package/dist/hooks/jev/__tests__/shared-breaker.test.js +294 -0
  401. package/dist/hooks/jev/__tests__/shared-breaker.test.js.map +1 -0
  402. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts +2 -0
  403. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts.map +1 -0
  404. package/dist/hooks/jev/__tests__/state-omit-ids.test.js +88 -0
  405. package/dist/hooks/jev/__tests__/state-omit-ids.test.js.map +1 -0
  406. package/dist/hooks/jev/client.d.ts +34 -2
  407. package/dist/hooks/jev/client.d.ts.map +1 -1
  408. package/dist/hooks/jev/client.js +80 -5
  409. package/dist/hooks/jev/client.js.map +1 -1
  410. package/dist/hooks/jev/config.d.ts +78 -4
  411. package/dist/hooks/jev/config.d.ts.map +1 -1
  412. package/dist/hooks/jev/config.js +123 -9
  413. package/dist/hooks/jev/config.js.map +1 -1
  414. package/dist/hooks/jev/points.d.ts +2 -0
  415. package/dist/hooks/jev/points.d.ts.map +1 -1
  416. package/dist/hooks/jev/points.js +41 -10
  417. package/dist/hooks/jev/points.js.map +1 -1
  418. package/dist/hooks/jev/resolver.d.ts +27 -2
  419. package/dist/hooks/jev/resolver.d.ts.map +1 -1
  420. package/dist/hooks/jev/resolver.js +176 -20
  421. package/dist/hooks/jev/resolver.js.map +1 -1
  422. package/dist/hooks/jev/types.d.ts +21 -4
  423. package/dist/hooks/jev/types.d.ts.map +1 -1
  424. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts +2 -0
  425. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts.map +1 -0
  426. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js +209 -0
  427. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js.map +1 -0
  428. package/dist/hooks/keyword-detector/__tests__/index.test.js +6 -1
  429. package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
  430. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +15 -0
  431. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
  432. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  433. package/dist/hooks/keyword-detector/index.js +200 -2
  434. package/dist/hooks/keyword-detector/index.js.map +1 -1
  435. package/dist/hooks/keyword-detector/jev-shadow.js +3 -3
  436. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
  437. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +20 -1
  438. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
  439. package/dist/hooks/learner/jev-shadow.js +3 -3
  440. package/dist/hooks/learner/jev-shadow.js.map +1 -1
  441. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts +2 -0
  442. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts.map +1 -0
  443. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js +280 -0
  444. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js.map +1 -0
  445. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js +2 -2
  446. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js.map +1 -1
  447. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +47 -1
  448. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
  449. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  450. package/dist/hooks/persistent-mode/index.js +136 -40
  451. package/dist/hooks/persistent-mode/index.js.map +1 -1
  452. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
  453. package/dist/hooks/persistent-mode/jev-shadow.js +11 -7
  454. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
  455. package/dist/hooks/pre-compact/index.d.ts.map +1 -1
  456. package/dist/hooks/pre-compact/index.js +8 -5
  457. package/dist/hooks/pre-compact/index.js.map +1 -1
  458. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts +11 -0
  459. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts.map +1 -0
  460. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js +227 -0
  461. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js.map +1 -0
  462. package/dist/hooks/project-memory/index.d.ts.map +1 -1
  463. package/dist/hooks/project-memory/index.js +26 -6
  464. package/dist/hooks/project-memory/index.js.map +1 -1
  465. package/dist/hooks/ralph/__tests__/closeout.test.d.ts +2 -0
  466. package/dist/hooks/ralph/__tests__/closeout.test.d.ts.map +1 -0
  467. package/dist/hooks/ralph/__tests__/closeout.test.js +82 -0
  468. package/dist/hooks/ralph/__tests__/closeout.test.js.map +1 -0
  469. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +572 -4
  470. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
  471. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +23 -2
  472. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -1
  473. package/dist/hooks/ralph/closeout.d.ts +34 -0
  474. package/dist/hooks/ralph/closeout.d.ts.map +1 -0
  475. package/dist/hooks/ralph/closeout.js +66 -0
  476. package/dist/hooks/ralph/closeout.js.map +1 -0
  477. package/dist/hooks/ralph/feedback-baseline.d.ts +60 -6
  478. package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
  479. package/dist/hooks/ralph/feedback-baseline.js +302 -15
  480. package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
  481. package/dist/hooks/ralph/index.d.ts +1 -1
  482. package/dist/hooks/ralph/index.d.ts.map +1 -1
  483. package/dist/hooks/ralph/index.js +1 -1
  484. package/dist/hooks/ralph/index.js.map +1 -1
  485. package/dist/hooks/ralph/jev-shadow.js +3 -3
  486. package/dist/hooks/ralph/jev-shadow.js.map +1 -1
  487. package/dist/hooks/ralph/verifier.d.ts +5 -0
  488. package/dist/hooks/ralph/verifier.d.ts.map +1 -1
  489. package/dist/hooks/ralph/verifier.js +21 -10
  490. package/dist/hooks/ralph/verifier.js.map +1 -1
  491. package/dist/hooks/registry/__tests__/registry.test.js +6 -0
  492. package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
  493. package/dist/hooks/registry/registry.d.ts +6 -2
  494. package/dist/hooks/registry/registry.d.ts.map +1 -1
  495. package/dist/hooks/registry/registry.js +21 -6
  496. package/dist/hooks/registry/registry.js.map +1 -1
  497. package/dist/hooks/registry/types.d.ts +2 -0
  498. package/dist/hooks/registry/types.d.ts.map +1 -1
  499. package/dist/hooks/session-end/__tests__/callbacks.test.js +10 -1
  500. package/dist/hooks/session-end/__tests__/callbacks.test.js.map +1 -1
  501. package/dist/hooks/session-end/__tests__/worker.test.js +111 -2
  502. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  503. package/dist/hooks/session-end/callbacks.js +1 -1
  504. package/dist/hooks/session-end/callbacks.js.map +1 -1
  505. package/dist/hooks/session-end/cleanup-manifest.d.ts +2 -0
  506. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  507. package/dist/hooks/session-end/cleanup-manifest.js +8 -0
  508. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  509. package/dist/hooks/session-end/index.d.ts.map +1 -1
  510. package/dist/hooks/session-end/index.js +21 -3
  511. package/dist/hooks/session-end/index.js.map +1 -1
  512. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  513. package/dist/hooks/session-end/worker.js +32 -2
  514. package/dist/hooks/session-end/worker.js.map +1 -1
  515. package/dist/hooks/setup/__tests__/windows-patch.test.js +89 -17
  516. package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
  517. package/dist/hooks/setup/index.d.ts +10 -21
  518. package/dist/hooks/setup/index.d.ts.map +1 -1
  519. package/dist/hooks/setup/index.js +14 -48
  520. package/dist/hooks/setup/index.js.map +1 -1
  521. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +2 -1
  522. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
  523. package/dist/hud/omc-state.d.ts +8 -0
  524. package/dist/hud/omc-state.d.ts.map +1 -1
  525. package/dist/hud/omc-state.js +23 -2
  526. package/dist/hud/omc-state.js.map +1 -1
  527. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts +2 -0
  528. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts.map +1 -0
  529. package/dist/installer/__tests__/claude-mcp-config-path.test.js +323 -0
  530. package/dist/installer/__tests__/claude-mcp-config-path.test.js.map +1 -0
  531. package/dist/installer/__tests__/mcp-registry.test.js +81 -3
  532. package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
  533. package/dist/installer/__tests__/standalone-hook-reconcile.test.js +36 -0
  534. package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
  535. package/dist/installer/index.d.ts.map +1 -1
  536. package/dist/installer/index.js +16 -4
  537. package/dist/installer/index.js.map +1 -1
  538. package/dist/installer/mcp-registry.d.ts +21 -1
  539. package/dist/installer/mcp-registry.d.ts.map +1 -1
  540. package/dist/installer/mcp-registry.js +101 -20
  541. package/dist/installer/mcp-registry.js.map +1 -1
  542. package/dist/lib/atomic-write.d.ts.map +1 -1
  543. package/dist/lib/atomic-write.js +61 -2
  544. package/dist/lib/atomic-write.js.map +1 -1
  545. package/dist/lib/one-line.d.ts +3 -0
  546. package/dist/lib/one-line.d.ts.map +1 -0
  547. package/dist/lib/one-line.js +5 -0
  548. package/dist/lib/one-line.js.map +1 -0
  549. package/dist/mcp/__tests__/team-cleanup.test.js +13 -0
  550. package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
  551. package/dist/mcp/team-job-convergence.d.ts.map +1 -1
  552. package/dist/mcp/team-job-convergence.js +4 -1
  553. package/dist/mcp/team-job-convergence.js.map +1 -1
  554. package/dist/mcp/team-server.js +2 -2
  555. package/dist/mcp/team-server.js.map +1 -1
  556. package/dist/notifications/__tests__/approval-reply.test.js +8 -0
  557. package/dist/notifications/__tests__/approval-reply.test.js.map +1 -1
  558. package/dist/notifications/__tests__/reply-herdr.test.d.ts +8 -0
  559. package/dist/notifications/__tests__/reply-herdr.test.d.ts.map +1 -0
  560. package/dist/notifications/__tests__/reply-herdr.test.js +125 -0
  561. package/dist/notifications/__tests__/reply-herdr.test.js.map +1 -0
  562. package/dist/notifications/__tests__/tmux.test.js +56 -1
  563. package/dist/notifications/__tests__/tmux.test.js.map +1 -1
  564. package/dist/notifications/index.d.ts +1 -1
  565. package/dist/notifications/index.d.ts.map +1 -1
  566. package/dist/notifications/index.js +22 -7
  567. package/dist/notifications/index.js.map +1 -1
  568. package/dist/notifications/reply-listener.d.ts +28 -12
  569. package/dist/notifications/reply-listener.d.ts.map +1 -1
  570. package/dist/notifications/reply-listener.js +326 -172
  571. package/dist/notifications/reply-listener.js.map +1 -1
  572. package/dist/notifications/tmux.d.ts +22 -2
  573. package/dist/notifications/tmux.d.ts.map +1 -1
  574. package/dist/notifications/tmux.js +57 -2
  575. package/dist/notifications/tmux.js.map +1 -1
  576. package/dist/release/__tests__/engine.test.js +74 -2
  577. package/dist/release/__tests__/engine.test.js.map +1 -1
  578. package/dist/release/engine.d.ts +9 -1
  579. package/dist/release/engine.d.ts.map +1 -1
  580. package/dist/release/engine.js +41 -4
  581. package/dist/release/engine.js.map +1 -1
  582. package/dist/shared/types.d.ts +5 -0
  583. package/dist/shared/types.d.ts.map +1 -1
  584. package/dist/ship/__tests__/check-name.test.d.ts +2 -0
  585. package/dist/ship/__tests__/check-name.test.d.ts.map +1 -0
  586. package/dist/ship/__tests__/check-name.test.js +17 -0
  587. package/dist/ship/__tests__/check-name.test.js.map +1 -0
  588. package/dist/ship/__tests__/gates-settle.test.js +13 -1
  589. package/dist/ship/__tests__/gates-settle.test.js.map +1 -1
  590. package/dist/ship/__tests__/prepare-build.test.d.ts +2 -0
  591. package/dist/ship/__tests__/prepare-build.test.d.ts.map +1 -0
  592. package/dist/ship/__tests__/prepare-build.test.js +287 -0
  593. package/dist/ship/__tests__/prepare-build.test.js.map +1 -0
  594. package/dist/ship/__tests__/prepare-merge.test.js +8 -1
  595. package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
  596. package/dist/ship/__tests__/safety-state.test.js +4 -0
  597. package/dist/ship/__tests__/safety-state.test.js.map +1 -1
  598. package/dist/ship/check-name.d.ts +12 -0
  599. package/dist/ship/check-name.d.ts.map +1 -0
  600. package/dist/ship/check-name.js +13 -0
  601. package/dist/ship/check-name.js.map +1 -0
  602. package/dist/ship/config.d.ts +13 -0
  603. package/dist/ship/config.d.ts.map +1 -1
  604. package/dist/ship/config.js +18 -1
  605. package/dist/ship/config.js.map +1 -1
  606. package/dist/ship/exec.d.ts +8 -0
  607. package/dist/ship/exec.d.ts.map +1 -1
  608. package/dist/ship/exec.js +33 -5
  609. package/dist/ship/exec.js.map +1 -1
  610. package/dist/ship/gates.d.ts.map +1 -1
  611. package/dist/ship/gates.js +3 -2
  612. package/dist/ship/gates.js.map +1 -1
  613. package/dist/ship/merge.d.ts +11 -2
  614. package/dist/ship/merge.d.ts.map +1 -1
  615. package/dist/ship/merge.js +55 -10
  616. package/dist/ship/merge.js.map +1 -1
  617. package/dist/ship/prepare.d.ts +16 -4
  618. package/dist/ship/prepare.d.ts.map +1 -1
  619. package/dist/ship/prepare.js +108 -2
  620. package/dist/ship/prepare.js.map +1 -1
  621. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +9 -0
  622. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
  623. package/dist/team/__tests__/herdr-session-realherdr.test.js +140 -0
  624. package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
  625. package/dist/team/__tests__/herdr-session.test.d.ts +9 -0
  626. package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
  627. package/dist/team/__tests__/herdr-session.test.js +270 -0
  628. package/dist/team/__tests__/herdr-session.test.js.map +1 -0
  629. package/dist/team/__tests__/idle-nudge.test.js +17 -0
  630. package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
  631. package/dist/team/__tests__/mailbox-notification-guard.test.js +403 -181
  632. package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
  633. package/dist/team/__tests__/scaling-launch-config.test.js +12 -0
  634. package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
  635. package/dist/team/__tests__/scaling.test.js +12 -0
  636. package/dist/team/__tests__/scaling.test.js.map +1 -1
  637. package/dist/team/__tests__/task-claim-renewal.test.d.ts +2 -0
  638. package/dist/team/__tests__/task-claim-renewal.test.d.ts.map +1 -0
  639. package/dist/team/__tests__/task-claim-renewal.test.js +421 -0
  640. package/dist/team/__tests__/task-claim-renewal.test.js.map +1 -0
  641. package/dist/team/__tests__/task-storage-integrity.test.js +34 -0
  642. package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -1
  643. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts +11 -0
  644. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts.map +1 -0
  645. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js +99 -0
  646. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js.map +1 -0
  647. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts +10 -0
  648. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts.map +1 -0
  649. package/dist/team/__tests__/tmux-session.herdr-arms.test.js +226 -0
  650. package/dist/team/__tests__/tmux-session.herdr-arms.test.js.map +1 -0
  651. package/dist/team/__tests__/tmux-session.test.js +888 -721
  652. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  653. package/dist/team/__tests__/worker-bootstrap.test.js +19 -0
  654. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  655. package/dist/team/api-interop.d.ts +1 -1
  656. package/dist/team/api-interop.d.ts.map +1 -1
  657. package/dist/team/api-interop.js +13 -1
  658. package/dist/team/api-interop.js.map +1 -1
  659. package/dist/team/herdr-session.d.ts +267 -0
  660. package/dist/team/herdr-session.d.ts.map +1 -0
  661. package/dist/team/herdr-session.js +508 -0
  662. package/dist/team/herdr-session.js.map +1 -0
  663. package/dist/team/idle-nudge.d.ts +1 -1
  664. package/dist/team/idle-nudge.d.ts.map +1 -1
  665. package/dist/team/idle-nudge.js +4 -4
  666. package/dist/team/idle-nudge.js.map +1 -1
  667. package/dist/team/mailbox-notification-guard.d.ts +24 -19
  668. package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
  669. package/dist/team/mailbox-notification-guard.js +241 -148
  670. package/dist/team/mailbox-notification-guard.js.map +1 -1
  671. package/dist/team/model-contract.d.ts.map +1 -1
  672. package/dist/team/model-contract.js +1 -0
  673. package/dist/team/model-contract.js.map +1 -1
  674. package/dist/team/runtime-v2.d.ts +33 -33
  675. package/dist/team/runtime-v2.d.ts.map +1 -1
  676. package/dist/team/runtime-v2.js +2810 -1591
  677. package/dist/team/runtime-v2.js.map +1 -1
  678. package/dist/team/scaling.d.ts +3 -3
  679. package/dist/team/scaling.d.ts.map +1 -1
  680. package/dist/team/scaling.js +766 -402
  681. package/dist/team/scaling.js.map +1 -1
  682. package/dist/team/state/tasks.d.ts +15 -1
  683. package/dist/team/state/tasks.d.ts.map +1 -1
  684. package/dist/team/state/tasks.js +56 -2
  685. package/dist/team/state/tasks.js.map +1 -1
  686. package/dist/team/team-ops.d.ts +3 -2
  687. package/dist/team/team-ops.d.ts.map +1 -1
  688. package/dist/team/team-ops.js +32 -5
  689. package/dist/team/team-ops.js.map +1 -1
  690. package/dist/team/tmux-session.d.ts +66 -40
  691. package/dist/team/tmux-session.d.ts.map +1 -1
  692. package/dist/team/tmux-session.js +1733 -1096
  693. package/dist/team/tmux-session.js.map +1 -1
  694. package/dist/team/types.d.ts +8 -0
  695. package/dist/team/types.d.ts.map +1 -1
  696. package/dist/team/types.js.map +1 -1
  697. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  698. package/dist/team/worker-bootstrap.js +3 -0
  699. package/dist/team/worker-bootstrap.js.map +1 -1
  700. package/dist/tools/lsp/__tests__/devcontainer.test.js +39 -5
  701. package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -1
  702. package/dist/tools/lsp/devcontainer.d.ts.map +1 -1
  703. package/dist/tools/lsp/devcontainer.js +25 -8
  704. package/dist/tools/lsp/devcontainer.js.map +1 -1
  705. package/dist/utils/__tests__/windows-search.test.js +17 -3
  706. package/dist/utils/__tests__/windows-search.test.js.map +1 -1
  707. package/dist/utils/plugin-cache-validation.d.ts.map +1 -1
  708. package/dist/utils/plugin-cache-validation.js +27 -18
  709. package/dist/utils/plugin-cache-validation.js.map +1 -1
  710. package/dist/workflow/__tests__/projections.test.js +3 -3
  711. package/dist/workflow/__tests__/projections.test.js.map +1 -1
  712. package/dist/workflow/__tests__/registry.test.js +3 -3
  713. package/dist/workflow/__tests__/registry.test.js.map +1 -1
  714. package/dist/workflow/registry.d.ts.map +1 -1
  715. package/dist/workflow/registry.js +1 -0
  716. package/dist/workflow/registry.js.map +1 -1
  717. package/docs/ARCHITECTURE.md +1 -1
  718. package/docs/CLAUDE.md +1 -1
  719. package/docs/CREDITS.md +1 -0
  720. package/docs/FEATURES.md +18 -0
  721. package/docs/FIELD-TESTING.md +10 -0
  722. package/docs/HOOKS.md +339 -36
  723. package/docs/REFERENCE.md +82 -17
  724. package/docs/TEAM-MULTIPLEXER.md +107 -0
  725. package/hooks/hooks.json +204 -66
  726. package/hooks/jev-compaction.mjs +2404 -0
  727. package/package.json +2 -2
  728. package/plugin.json +1 -1
  729. package/scripts/check-omc-playbooks.mjs +214 -124
  730. package/scripts/code-simplifier.mjs +26 -3
  731. package/scripts/copilot/build-hooks.mjs +24 -7
  732. package/scripts/generate-inventory-graph.mjs +77 -92
  733. package/scripts/jev-eval.mjs +123 -22
  734. package/scripts/jev-repair-transcript.mjs +331 -0
  735. package/scripts/jev-resolve.mjs +374 -22
  736. package/scripts/keyword-detector.mjs +427 -29
  737. package/scripts/lib/hook-command-normalizer.d.mts +33 -0
  738. package/scripts/lib/hook-command-normalizer.mjs +157 -60
  739. package/scripts/lib/jev-breaker.d.mts +73 -0
  740. package/scripts/lib/jev-breaker.mjs +830 -0
  741. package/scripts/lib/jev-compaction-state.mjs +320 -0
  742. package/scripts/lib/jev-delivery-guard.mjs +567 -0
  743. package/scripts/lib/jev-mask.mjs +36 -0
  744. package/scripts/lib/jev-shadow.mjs +363 -14
  745. package/scripts/lib/shell-checks.mjs +1121 -0
  746. package/scripts/lib/state-root.cjs +19 -8
  747. package/scripts/lib/state-root.mjs +19 -8
  748. package/scripts/persistent-mode.cjs +289 -1
  749. package/scripts/persistent-mode.mjs +540 -91
  750. package/scripts/plugin-setup.mjs +26 -30
  751. package/scripts/plugin-shipping-surface.mjs +4 -1
  752. package/scripts/post-tool-use-failure.mjs +18 -0
  753. package/scripts/post-tool-verifier.mjs +49 -3
  754. package/scripts/pre-tool-enforcer.mjs +658 -64
  755. package/scripts/run.cjs +4 -2
  756. package/scripts/session-start.mjs +54 -0
  757. package/skills/AGENTS.md +1 -0
  758. package/skills/ai-slop-cleaner/SKILL.md +14 -0
  759. package/skills/arena/SKILL.md +8 -1
  760. package/skills/babysit/SKILL.md +2 -1
  761. package/skills/create-formal-verification-skill/SKILL.md +6 -4
  762. package/skills/figure-it-out/SKILL.md +5 -0
  763. package/skills/fix-ci/SKILL.md +3 -1
  764. package/skills/how/references/explainer-prompt.md +7 -4
  765. package/skills/interrogate/SKILL.md +10 -6
  766. package/skills/ralph/SKILL.md +27 -2
  767. package/skills/ralph-experiment/SKILL.md +1 -1
  768. package/skills/sdd/SKILL.md +67 -0
  769. package/skills/sdd/phases/criteria.md +144 -0
  770. package/skills/sdd/phases/execute.md +226 -0
  771. package/skills/sdd/phases/review.md +216 -0
  772. package/skills/sdd/phases/rules.md +195 -0
  773. package/skills/sdd/phases/spec.md +75 -0
  774. package/skills/sdd/phases/tasks.md +162 -0
  775. package/skills/statechart/scripts/run.ts +6 -3
  776. package/skills/statechart/scripts/test/child-env.test.ts +53 -0
  777. package/templates/hooks/keyword-detector.mjs +172 -5
  778. package/templates/hooks/lib/state-root.mjs +19 -8
  779. package/templates/hooks/persistent-mode.mjs +296 -1
@@ -15,23 +15,26 @@
15
15
  *
16
16
  * Follows the daemon pattern from src/features/rate-limit-wait/daemon.ts
17
17
  */
18
- import { childEnv } from '../utils/windows-search.js';
19
- import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, chmodSync, statSync, appendFileSync, renameSync } from 'fs';
20
- import { join } from 'path';
21
- import { fileURLToPath, pathToFileURL } from 'url';
22
- import { spawn } from 'child_process';
23
- import { randomUUID } from 'crypto';
24
- import { tmuxExec } from '../cli/tmux-utils.js';
25
- import { request as httpsRequest } from 'https';
26
- import { resolveDaemonModulePath } from '../utils/daemon-module-path.js';
27
- import { getGlobalOmcStateRoot } from '../utils/paths.js';
28
- import { capturePaneContent, sendToPane, isTmuxAvailable, } from '../features/rate-limit-wait/tmux-detector.js';
29
- import { isPaneReplyBlocked, lookupByMessageId, lockRegistryIfEmpty, removeMessagesByPane, pruneStale, } from './session-registry.js';
30
- import { writeApprovalDecision } from '../graph/runtime/remote-approval.js';
31
- import { parseMentionAllowedMentions } from './config.js';
32
- import { redactTokens } from './redact.js';
33
- import { getProcessStartIdentity, isProcessAlive, isProcessIdentityLive, terminateOwnedProcessTree, } from '../platform/index.js';
34
- import { validateSlackMessage, } from './slack-socket.js';
18
+ import { childEnv } from "../utils/windows-search.js";
19
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, chmodSync, statSync, appendFileSync, renameSync, } from "fs";
20
+ import { join } from "path";
21
+ import { fileURLToPath, pathToFileURL } from "url";
22
+ import { spawn } from "child_process";
23
+ import { randomUUID } from "crypto";
24
+ import { tmuxExec } from "../cli/tmux-utils.js";
25
+ import { request as httpsRequest } from "https";
26
+ import { resolveDaemonModulePath } from "../utils/daemon-module-path.js";
27
+ import { getGlobalOmcStateRoot } from "../utils/paths.js";
28
+ import { capturePaneContent, sendToPane, isTmuxAvailable, } from "../features/rate-limit-wait/tmux-detector.js";
29
+ import { captureHerdrWorkerPane, herdrSendPrompt, isHerdrWorkerAlive, } from "../team/herdr-session.js";
30
+ import { isHerdrPaneId, resolveTeamMultiplexer } from "../team/tmux-session.js";
31
+ import { getCurrentHerdrPaneId } from "./tmux.js";
32
+ import { isPaneReplyBlocked, lookupByMessageId, lockRegistryIfEmpty, removeMessagesByPane, pruneStale, } from "./session-registry.js";
33
+ import { writeApprovalDecision } from "../graph/runtime/remote-approval.js";
34
+ import { parseMentionAllowedMentions } from "./config.js";
35
+ import { redactTokens } from "./redact.js";
36
+ import { getProcessStartIdentity, isProcessAlive, isProcessIdentityLive, terminateOwnedProcessTree, } from "../platform/index.js";
37
+ import { validateSlackMessage, } from "./slack-socket.js";
35
38
  // ESM compatibility: __filename is not available in ES modules
36
39
  const __filename = fileURLToPath(import.meta.url);
37
40
  // ============================================================================
@@ -47,30 +50,54 @@ const MAX_LOG_SIZE_BYTES = 1 * 1024 * 1024;
47
50
  * OMC_* notification env vars are forwarded so the daemon can call getNotificationConfig().
48
51
  */
49
52
  const DAEMON_ENV_ALLOWLIST = [
50
- 'PATH', 'HOME', 'USERPROFILE',
51
- 'USER', 'USERNAME', 'LOGNAME',
52
- 'LANG', 'LC_ALL', 'LC_CTYPE',
53
- 'TERM', 'TMUX', 'TMUX_PANE',
54
- 'TMPDIR', 'TMP', 'TEMP',
55
- 'XDG_RUNTIME_DIR', 'XDG_DATA_HOME', 'XDG_CONFIG_HOME',
56
- 'SHELL',
57
- 'NODE_ENV', 'NODE_EXTRA_CA_CERTS',
58
- 'HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy', 'NO_PROXY', 'no_proxy',
59
- 'SystemRoot', 'SYSTEMROOT', 'windir', 'COMSPEC',
53
+ "PATH",
54
+ "HOME",
55
+ "USERPROFILE",
56
+ "USER",
57
+ "USERNAME",
58
+ "LOGNAME",
59
+ "LANG",
60
+ "LC_ALL",
61
+ "LC_CTYPE",
62
+ "TERM",
63
+ "TMUX",
64
+ "TMUX_PANE",
65
+ "HERDR_PANE_ID",
66
+ "HERDR_BIN_PATH",
67
+ "TMPDIR",
68
+ "TMP",
69
+ "TEMP",
70
+ "XDG_RUNTIME_DIR",
71
+ "XDG_DATA_HOME",
72
+ "XDG_CONFIG_HOME",
73
+ "SHELL",
74
+ "NODE_ENV",
75
+ "NODE_EXTRA_CA_CERTS",
76
+ "HTTP_PROXY",
77
+ "HTTPS_PROXY",
78
+ "http_proxy",
79
+ "https_proxy",
80
+ "NO_PROXY",
81
+ "no_proxy",
82
+ "SystemRoot",
83
+ "SYSTEMROOT",
84
+ "windir",
85
+ "COMSPEC",
60
86
  ];
61
87
  /** Default paths */
62
88
  const DEFAULT_STATE_DIR = getGlobalOmcStateRoot();
63
- const PID_FILE_PATH = join(DEFAULT_STATE_DIR, 'reply-listener.pid');
64
- const STATE_FILE_PATH = join(DEFAULT_STATE_DIR, 'reply-listener-state.json');
65
- const LOG_FILE_PATH = join(DEFAULT_STATE_DIR, 'reply-listener.log');
89
+ const PID_FILE_PATH = join(DEFAULT_STATE_DIR, "reply-listener.pid");
90
+ const STATE_FILE_PATH = join(DEFAULT_STATE_DIR, "reply-listener-state.json");
91
+ const LOG_FILE_PATH = join(DEFAULT_STATE_DIR, "reply-listener.log");
66
92
  // ============================================================================
67
93
  // Utility Functions
68
94
  // ============================================================================
69
95
  /**
70
96
  * Create a minimal environment for daemon child processes.
71
97
  * Only includes allowlisted variables to prevent credential leakage.
98
+ * @internal Exported for testing only.
72
99
  */
73
- function createMinimalDaemonEnv() {
100
+ export function createMinimalDaemonEnv() {
74
101
  const env = {};
75
102
  for (const key of DAEMON_ENV_ALLOWLIST) {
76
103
  if (process.env[key] !== undefined) {
@@ -149,7 +176,7 @@ function readDaemonState() {
149
176
  if (!existsSync(STATE_FILE_PATH)) {
150
177
  return null;
151
178
  }
152
- const content = readFileSync(STATE_FILE_PATH, 'utf-8');
179
+ const content = readFileSync(STATE_FILE_PATH, "utf-8");
153
180
  const state = JSON.parse(content);
154
181
  return state;
155
182
  }
@@ -169,7 +196,7 @@ function writeDaemonState(state) {
169
196
  */
170
197
  export async function buildDaemonConfig() {
171
198
  try {
172
- const { getReplyConfig, getNotificationConfig, getReplyListenerPlatformConfig } = await import('./config.js');
199
+ const { getReplyConfig, getNotificationConfig, getReplyListenerPlatformConfig, } = await import("./config.js");
173
200
  const replyConfig = getReplyConfig();
174
201
  if (!replyConfig)
175
202
  return null;
@@ -186,15 +213,21 @@ function readPidRecord() {
186
213
  try {
187
214
  if (!existsSync(PID_FILE_PATH))
188
215
  return null;
189
- const content = readFileSync(PID_FILE_PATH, 'utf-8').trim();
216
+ const content = readFileSync(PID_FILE_PATH, "utf-8").trim();
190
217
  const parsed = JSON.parse(content);
191
- return typeof parsed.pid === 'number' && Number.isInteger(parsed.pid) && parsed.pid > 0
192
- ? { pid: parsed.pid, generation: parsed.generation, processStartIdentity: parsed.processStartIdentity }
218
+ return typeof parsed.pid === "number" &&
219
+ Number.isInteger(parsed.pid) &&
220
+ parsed.pid > 0
221
+ ? {
222
+ pid: parsed.pid,
223
+ generation: parsed.generation,
224
+ processStartIdentity: parsed.processStartIdentity,
225
+ }
193
226
  : null;
194
227
  }
195
228
  catch {
196
229
  try {
197
- const pid = Number.parseInt(readFileSync(PID_FILE_PATH, 'utf-8').trim(), 10);
230
+ const pid = Number.parseInt(readFileSync(PID_FILE_PATH, "utf-8").trim(), 10);
198
231
  return Number.isInteger(pid) && pid > 0 ? { pid } : null;
199
232
  }
200
233
  catch {
@@ -248,13 +281,13 @@ export function isDaemonRunning() {
248
281
  */
249
282
  export function sanitizeReplyInput(text) {
250
283
  return text
251
- .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, '') // Strip control chars (keep \n, \r, \t)
252
- .replace(/[\u202a-\u202e\u2066-\u2069]/g, '') // Strip bidi override characters
253
- .replace(/\r\n|[\r\n]/g, ' ') // Newlines -> spaces
254
- .replace(/\\/g, '\\\\') // Escape backslashes
255
- .replace(/`/g, '\\`') // Escape backticks
256
- .replace(/\$\(/g, '\\$(') // Escape $()
257
- .replace(/\$\{/g, '\\${') // Escape ${}
284
+ .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "") // Strip control chars (keep \n, \r, \t)
285
+ .replace(/[\u202a-\u202e\u2066-\u2069]/g, "") // Strip bidi override characters
286
+ .replace(/\r\n|[\r\n]/g, " ") // Newlines -> spaces
287
+ .replace(/\\/g, "\\\\") // Escape backslashes
288
+ .replace(/`/g, "\\`") // Escape backticks
289
+ .replace(/\$\(/g, "\\$(") // Escape $()
290
+ .replace(/\$\{/g, "\\${") // Escape ${}
258
291
  .trim();
259
292
  }
260
293
  // ============================================================================
@@ -262,23 +295,45 @@ export function sanitizeReplyInput(text) {
262
295
  // ============================================================================
263
296
  /** Keywords that resolve an approval gate (first word of the reply, case-insensitive). */
264
297
  const APPROVAL_APPROVE_WORDS = new Set([
265
- 'approve', 'approved', 'yes', 'y',
266
- '批准', '同意',
298
+ "approve",
299
+ "approved",
300
+ "yes",
301
+ "y",
302
+ "批准",
303
+ "同意",
267
304
  ]);
268
305
  const APPROVAL_DENY_WORDS = new Set([
269
- 'deny', 'denied', 'no', 'n', 'reject', 'rejected',
270
- '拒绝', '驳回',
306
+ "deny",
307
+ "denied",
308
+ "no",
309
+ "n",
310
+ "reject",
311
+ "rejected",
312
+ "拒绝",
313
+ "驳回",
271
314
  ]);
272
315
  /**
273
316
  * Parse a reply as an approval decision. Returns null when the reply does
274
317
  * not look like a decision (the message is then left for normal handling).
318
+ * Question marks indicate uncertainty and always return null.
275
319
  */
276
320
  export function parseApprovalReply(text) {
277
- const firstWord = text.trim().toLowerCase().split(/\s+/)[0] || '';
278
- if (APPROVAL_APPROVE_WORDS.has(firstWord))
279
- return 'approved';
280
- if (APPROVAL_DENY_WORDS.has(firstWord))
281
- return 'denied';
321
+ const trimmed = text.trim().toLowerCase();
322
+ if (!trimmed)
323
+ return null;
324
+ // Question marks indicate uncertainty, so reject immediately
325
+ if (trimmed.includes("?") || trimmed.includes("?"))
326
+ return null;
327
+ // Extract the first word as a sequence of non-whitespace, non-punctuation characters.
328
+ // This handles cases like "Yes, ship it" → "yes" and "拒绝,先修测试" → "拒绝".
329
+ const match = trimmed.match(/^([^\s.!,、,。??]+)/u);
330
+ if (!match)
331
+ return null;
332
+ const cleanedWord = match[1];
333
+ if (APPROVAL_APPROVE_WORDS.has(cleanedWord))
334
+ return "approved";
335
+ if (APPROVAL_DENY_WORDS.has(cleanedWord))
336
+ return "denied";
282
337
  return null;
283
338
  }
284
339
  /**
@@ -316,7 +371,7 @@ class RateLimiter {
316
371
  canProceed() {
317
372
  const now = Date.now();
318
373
  // Remove timestamps outside the window
319
- this.timestamps = this.timestamps.filter(t => now - t < this.windowMs);
374
+ this.timestamps = this.timestamps.filter((t) => now - t < this.windowMs);
320
375
  if (this.timestamps.length >= this.maxPerMinute) {
321
376
  return false;
322
377
  }
@@ -328,33 +383,42 @@ class RateLimiter {
328
383
  }
329
384
  }
330
385
  export function buildReplyInjectionSteps(text, platform, config, mapping) {
331
- const prefix = config.includePrefix ? `[reply:${platform}] ` : '';
386
+ const prefix = config.includePrefix ? `[reply:${platform}] ` : "";
332
387
  const sanitized = sanitizeReplyInput(prefix + text);
333
388
  const truncated = sanitized.slice(0, config.maxMessageLength);
334
- if (mapping?.event === 'ask-user-question' &&
389
+ if (mapping?.event === "ask-user-question" &&
335
390
  mapping.askUserQuestionAllowOther !== false &&
336
391
  Number.isFinite(mapping.askUserQuestionOptionCount)) {
337
392
  const optionCount = Math.max(0, Math.floor(mapping.askUserQuestionOptionCount ?? 0));
338
393
  return [
339
- ...Array.from({ length: optionCount }, () => ({ kind: 'key', value: 'Down' })),
340
- { kind: 'key', value: 'Enter' },
341
- { kind: 'literal', value: truncated },
342
- { kind: 'key', value: 'Enter' },
394
+ ...Array.from({ length: optionCount }, () => ({
395
+ kind: "key",
396
+ value: "Down",
397
+ })),
398
+ { kind: "key", value: "Enter" },
399
+ { kind: "literal", value: truncated },
400
+ { kind: "key", value: "Enter" },
343
401
  ];
344
402
  }
345
403
  return [
346
- { kind: 'literal', value: truncated },
347
- { kind: 'key', value: 'Enter' },
404
+ { kind: "literal", value: truncated },
405
+ { kind: "key", value: "Enter" },
348
406
  ];
349
407
  }
350
408
  function sendReplyInjectionSteps(paneId, steps) {
351
409
  try {
352
410
  for (const step of steps) {
353
- if (step.kind === 'literal') {
354
- tmuxExec(['send-keys', '-t', paneId, '-l', step.value], { stripTmux: true, timeout: 2000 });
411
+ if (step.kind === "literal") {
412
+ tmuxExec(["send-keys", "-t", paneId, "-l", step.value], {
413
+ stripTmux: true,
414
+ timeout: 2000,
415
+ });
355
416
  }
356
417
  else {
357
- tmuxExec(['send-keys', '-t', paneId, step.value], { stripTmux: true, timeout: 2000 });
418
+ tmuxExec(["send-keys", "-t", paneId, step.value], {
419
+ stripTmux: true,
420
+ timeout: 2000,
421
+ });
358
422
  }
359
423
  }
360
424
  return true;
@@ -364,7 +428,60 @@ function sendReplyInjectionSteps(paneId, steps) {
364
428
  return false;
365
429
  }
366
430
  }
367
- function injectReply(paneId, text, platform, config, mapping) {
431
+ /**
432
+ * Inject a reply into a Herdr agent pane through the semantic agent surface.
433
+ *
434
+ * herdrSendPrompt types the sanitized text and submits it in one
435
+ * submission-verified step (the literal + Enter pair the tmux path sends).
436
+ * The ask-user-question Down/Enter menu walk is a tmux-keyboard artifact;
437
+ * Herdr delivers the typed reply itself, which Claude's question UI accepts.
438
+ */
439
+ export async function injectReplyIntoHerdrPane(paneId, text, platform, config, mapping) {
440
+ let content = "";
441
+ try {
442
+ content = await captureHerdrWorkerPane(paneId, 15);
443
+ }
444
+ catch (error) {
445
+ log(`WARN: Failed to capture herdr pane ${paneId}: ${error instanceof Error ? error.message : String(error)}`);
446
+ }
447
+ if (!content.trim()) {
448
+ // An empty or failed capture alone is inconclusive. Prune the mapping only
449
+ // when Herdr confirms no agent runs in the pane; keep it when Herdr itself
450
+ // cannot be queried so the next poll can retry.
451
+ let alive;
452
+ try {
453
+ alive = await isHerdrWorkerAlive(paneId);
454
+ }
455
+ catch {
456
+ alive = true;
457
+ }
458
+ if (!alive) {
459
+ log(`WARN: Herdr pane ${paneId} has no running agent. Removing its mappings.`);
460
+ removeMessagesByPane(paneId);
461
+ }
462
+ else {
463
+ log(`WARN: Herdr pane ${paneId} capture was empty or inconclusive. Retrying on next poll.`);
464
+ }
465
+ return false;
466
+ }
467
+ const steps = buildReplyInjectionSteps(text, platform, config, mapping);
468
+ const preview = steps.find((step) => step.kind === "literal")?.value ?? "";
469
+ try {
470
+ await herdrSendPrompt(paneId, preview);
471
+ log(`Injected reply from ${platform} into herdr pane ${paneId}: "${preview.slice(0, 50)}${preview.length > 50 ? "..." : ""}"`);
472
+ return true;
473
+ }
474
+ catch (error) {
475
+ log(`ERROR: Failed to inject reply into herdr pane ${paneId}: ${error instanceof Error ? error.message : String(error)}`);
476
+ return false;
477
+ }
478
+ }
479
+ async function injectReply(paneId, text, platform, config, mapping) {
480
+ // Herdr pane ids (wN:pM) route to the Herdr agent surface; tmux panes
481
+ // keep the send-keys path below.
482
+ if (isHerdrPaneId(paneId)) {
483
+ return injectReplyIntoHerdrPane(paneId, text, platform, config, mapping);
484
+ }
368
485
  // 0. A non-replyable message (Copilot permission menu) was sent to the pane
369
486
  // after this mapping was created: Enter would answer that menu.
370
487
  if (isPaneReplyBlocked(paneId, mapping)) {
@@ -379,12 +496,12 @@ function injectReply(paneId, text, platform, config, mapping) {
379
496
  return false;
380
497
  }
381
498
  const steps = buildReplyInjectionSteps(text, platform, config, mapping);
382
- const preview = steps.find((step) => step.kind === 'literal')?.value ?? '';
383
- const success = mapping?.event === 'ask-user-question'
499
+ const preview = steps.find((step) => step.kind === "literal")?.value ?? "";
500
+ const success = mapping?.event === "ask-user-question"
384
501
  ? sendReplyInjectionSteps(paneId, steps)
385
502
  : sendToPane(paneId, preview, true);
386
503
  if (success) {
387
- log(`Injected reply from ${platform} into pane ${paneId}: "${preview.slice(0, 50)}${preview.length > 50 ? '...' : ''}"`);
504
+ log(`Injected reply from ${platform} into pane ${paneId}: "${preview.slice(0, 50)}${preview.length > 50 ? "..." : ""}"`);
388
505
  }
389
506
  else {
390
507
  log(`ERROR: Failed to inject reply into pane ${paneId}`);
@@ -412,18 +529,20 @@ async function pollDiscord(config, state, rateLimiter) {
412
529
  return;
413
530
  }
414
531
  try {
415
- const after = state.discordLastMessageId ? `?after=${state.discordLastMessageId}&limit=10` : '?limit=10';
532
+ const after = state.discordLastMessageId
533
+ ? `?after=${state.discordLastMessageId}&limit=10`
534
+ : "?limit=10";
416
535
  const url = `https://discord.com/api/v10/channels/${config.discordChannelId}/messages${after}`;
417
536
  const response = await fetch(url, {
418
- method: 'GET',
537
+ method: "GET",
419
538
  headers: {
420
- 'Authorization': `Bot ${config.discordBotToken}`,
539
+ Authorization: `Bot ${config.discordBotToken}`,
421
540
  },
422
541
  signal: AbortSignal.timeout(10000),
423
542
  });
424
543
  // Read rate limit headers and back off when remaining < 2
425
- const remaining = response.headers.get('x-ratelimit-remaining');
426
- const reset = response.headers.get('x-ratelimit-reset');
544
+ const remaining = response.headers.get("x-ratelimit-remaining");
545
+ const reset = response.headers.get("x-ratelimit-reset");
427
546
  if (remaining !== null && parseInt(remaining, 10) < 2) {
428
547
  const resetTime = reset ? parseFloat(reset) * 1000 : Date.now() + 10_000;
429
548
  discordBackoffUntil = resetTime;
@@ -433,7 +552,7 @@ async function pollDiscord(config, state, rateLimiter) {
433
552
  log(`Discord API error: HTTP ${response.status}`);
434
553
  return;
435
554
  }
436
- const messages = await response.json();
555
+ const messages = (await response.json());
437
556
  if (!Array.isArray(messages) || messages.length === 0)
438
557
  return;
439
558
  // Process messages in chronological order (oldest first; Discord returns newest first)
@@ -453,7 +572,7 @@ async function pollDiscord(config, state, rateLimiter) {
453
572
  continue;
454
573
  }
455
574
  // Filter: referenced message exists in session registry
456
- const mapping = lookupByMessageId('discord-bot', msg.message_reference.message_id);
575
+ const mapping = lookupByMessageId("discord-bot", msg.message_reference.message_id);
457
576
  if (!mapping) {
458
577
  state.discordLastMessageId = msg.id;
459
578
  writeDaemonState(state);
@@ -464,14 +583,14 @@ async function pollDiscord(config, state, rateLimiter) {
464
583
  // AT-MOST-ONCE: persist offset BEFORE processing
465
584
  state.discordLastMessageId = msg.id;
466
585
  writeDaemonState(state);
467
- const decision = handleApprovalReply(mapping.approvalRef, msg.content, 'discord');
586
+ const decision = handleApprovalReply(mapping.approvalRef, msg.content, "discord");
468
587
  if (decision !== null) {
469
588
  // Confirmation reaction (non-critical)
470
- const reaction = decision === 'approved' ? '%E2%9C%85' : '%E2%9D%8C';
589
+ const reaction = decision === "approved" ? "%E2%9C%85" : "%E2%9D%8C";
471
590
  try {
472
591
  await fetch(`https://discord.com/api/v10/channels/${config.discordChannelId}/messages/${msg.id}/reactions/${reaction}/@me`, {
473
- method: 'PUT',
474
- headers: { 'Authorization': `Bot ${config.discordBotToken}` },
592
+ method: "PUT",
593
+ headers: { Authorization: `Bot ${config.discordBotToken}` },
475
594
  signal: AbortSignal.timeout(5000),
476
595
  });
477
596
  }
@@ -496,14 +615,14 @@ async function pollDiscord(config, state, rateLimiter) {
496
615
  state.discordLastMessageId = msg.id;
497
616
  writeDaemonState(state);
498
617
  // Inject reply
499
- const success = injectReply(mapping.tmuxPaneId, msg.content, 'discord', config, mapping);
618
+ const success = await injectReply(mapping.tmuxPaneId, msg.content, "discord", config, mapping);
500
619
  if (success) {
501
620
  state.messagesInjected++;
502
621
  // Send confirmation reaction (non-critical)
503
622
  try {
504
623
  await fetch(`https://discord.com/api/v10/channels/${config.discordChannelId}/messages/${msg.id}/reactions/%E2%9C%85/@me`, {
505
- method: 'PUT',
506
- headers: { 'Authorization': `Bot ${config.discordBotToken}` },
624
+ method: "PUT",
625
+ headers: { Authorization: `Bot ${config.discordBotToken}` },
507
626
  signal: AbortSignal.timeout(5000),
508
627
  });
509
628
  }
@@ -512,15 +631,17 @@ async function pollDiscord(config, state, rateLimiter) {
512
631
  }
513
632
  // Send injection notification to channel (non-critical)
514
633
  try {
515
- const mentionPrefix = config.discordMention ? `${config.discordMention} ` : '';
634
+ const mentionPrefix = config.discordMention
635
+ ? `${config.discordMention} `
636
+ : "";
516
637
  const feedbackAllowedMentions = config.discordMention
517
638
  ? parseMentionAllowedMentions(config.discordMention)
518
639
  : { parse: [] };
519
640
  await fetch(`https://discord.com/api/v10/channels/${config.discordChannelId}/messages`, {
520
- method: 'POST',
641
+ method: "POST",
521
642
  headers: {
522
- 'Authorization': `Bot ${config.discordBotToken}`,
523
- 'Content-Type': 'application/json',
643
+ Authorization: `Bot ${config.discordBotToken}`,
644
+ "Content-Type": "application/json",
524
645
  },
525
646
  body: JSON.stringify({
526
647
  content: `${mentionPrefix}Injected into Claude Code session.`,
@@ -557,22 +678,26 @@ async function pollTelegram(config, state, rateLimiter) {
557
678
  return;
558
679
  }
559
680
  try {
560
- const offset = state.telegramLastUpdateId ? state.telegramLastUpdateId + 1 : 0;
681
+ const offset = state.telegramLastUpdateId
682
+ ? state.telegramLastUpdateId + 1
683
+ : 0;
561
684
  const path = `/bot${config.telegramBotToken}/getUpdates?offset=${offset}&timeout=0`;
562
685
  const updates = await new Promise((resolve, reject) => {
563
686
  const req = httpsRequest({
564
- hostname: 'api.telegram.org',
687
+ hostname: "api.telegram.org",
565
688
  path,
566
- method: 'GET',
689
+ method: "GET",
567
690
  family: 4, // Force IPv4
568
691
  timeout: 10000,
569
692
  }, (res) => {
570
693
  const chunks = [];
571
- res.on('data', (chunk) => chunks.push(chunk));
572
- res.on('end', () => {
694
+ res.on("data", (chunk) => chunks.push(chunk));
695
+ res.on("end", () => {
573
696
  try {
574
- const body = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
575
- if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
697
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf-8"));
698
+ if (res.statusCode &&
699
+ res.statusCode >= 200 &&
700
+ res.statusCode < 300) {
576
701
  resolve(body.result || []);
577
702
  }
578
703
  else {
@@ -584,10 +709,10 @@ async function pollTelegram(config, state, rateLimiter) {
584
709
  }
585
710
  });
586
711
  });
587
- req.on('error', reject);
588
- req.on('timeout', () => {
712
+ req.on("error", reject);
713
+ req.on("timeout", () => {
589
714
  req.destroy();
590
- reject(new Error('Request timeout'));
715
+ reject(new Error("Request timeout"));
591
716
  });
592
717
  req.end();
593
718
  });
@@ -612,7 +737,7 @@ async function pollTelegram(config, state, rateLimiter) {
612
737
  continue;
613
738
  }
614
739
  // Filter: referenced message exists in session registry
615
- const mapping = lookupByMessageId('telegram', String(msg.reply_to_message.message_id));
740
+ const mapping = lookupByMessageId("telegram", String(msg.reply_to_message.message_id));
616
741
  if (!mapping) {
617
742
  state.telegramLastUpdateId = update.update_id;
618
743
  writeDaemonState(state);
@@ -623,7 +748,7 @@ async function pollTelegram(config, state, rateLimiter) {
623
748
  // AT-MOST-ONCE: persist offset BEFORE processing
624
749
  state.telegramLastUpdateId = update.update_id;
625
750
  writeDaemonState(state);
626
- const decision = handleApprovalReply(mapping.approvalRef, msg.text || '', 'telegram');
751
+ const decision = handleApprovalReply(mapping.approvalRef, msg.text || "", "telegram");
627
752
  if (decision !== null) {
628
753
  // Confirmation reply (non-critical)
629
754
  try {
@@ -634,21 +759,21 @@ async function pollTelegram(config, state, rateLimiter) {
634
759
  });
635
760
  await new Promise((resolve) => {
636
761
  const confirmReq = httpsRequest({
637
- hostname: 'api.telegram.org',
762
+ hostname: "api.telegram.org",
638
763
  path: `/bot${config.telegramBotToken}/sendMessage`,
639
- method: 'POST',
764
+ method: "POST",
640
765
  family: 4,
641
766
  headers: {
642
- 'Content-Type': 'application/json',
643
- 'Content-Length': Buffer.byteLength(confirmBody),
767
+ "Content-Type": "application/json",
768
+ "Content-Length": Buffer.byteLength(confirmBody),
644
769
  },
645
770
  timeout: 5000,
646
771
  }, (res) => {
647
772
  res.resume();
648
773
  resolve();
649
774
  });
650
- confirmReq.on('error', () => resolve());
651
- confirmReq.on('timeout', () => {
775
+ confirmReq.on("error", () => resolve());
776
+ confirmReq.on("timeout", () => {
652
777
  confirmReq.destroy();
653
778
  resolve();
654
779
  });
@@ -665,7 +790,7 @@ async function pollTelegram(config, state, rateLimiter) {
665
790
  }
666
791
  continue;
667
792
  }
668
- const text = msg.text || '';
793
+ const text = msg.text || "";
669
794
  if (!text) {
670
795
  state.telegramLastUpdateId = update.update_id;
671
796
  writeDaemonState(state);
@@ -683,33 +808,33 @@ async function pollTelegram(config, state, rateLimiter) {
683
808
  state.telegramLastUpdateId = update.update_id;
684
809
  writeDaemonState(state);
685
810
  // Inject reply
686
- const success = injectReply(mapping.tmuxPaneId, text, 'telegram', config, mapping);
811
+ const success = await injectReply(mapping.tmuxPaneId, text, "telegram", config, mapping);
687
812
  if (success) {
688
813
  state.messagesInjected++;
689
814
  // Send confirmation reply (non-critical)
690
815
  try {
691
816
  const replyBody = JSON.stringify({
692
817
  chat_id: config.telegramChatId,
693
- text: 'Injected into Claude Code session.',
818
+ text: "Injected into Claude Code session.",
694
819
  reply_to_message_id: msg.message_id,
695
820
  });
696
821
  await new Promise((resolve) => {
697
822
  const replyReq = httpsRequest({
698
- hostname: 'api.telegram.org',
823
+ hostname: "api.telegram.org",
699
824
  path: `/bot${config.telegramBotToken}/sendMessage`,
700
- method: 'POST',
825
+ method: "POST",
701
826
  family: 4,
702
827
  headers: {
703
- 'Content-Type': 'application/json',
704
- 'Content-Length': Buffer.byteLength(replyBody),
828
+ "Content-Type": "application/json",
829
+ "Content-Length": Buffer.byteLength(replyBody),
705
830
  },
706
831
  timeout: 5000,
707
832
  }, (res) => {
708
833
  res.resume(); // Drain response
709
834
  resolve();
710
835
  });
711
- replyReq.on('error', () => resolve());
712
- replyReq.on('timeout', () => {
836
+ replyReq.on("error", () => resolve());
837
+ replyReq.on("timeout", () => {
713
838
  replyReq.destroy();
714
839
  resolve();
715
840
  });
@@ -741,10 +866,10 @@ const PRUNE_INTERVAL_MS = 60 * 60 * 1000;
741
866
  * Main daemon polling loop
742
867
  */
743
868
  async function pollLoop() {
744
- log('Reply listener daemon starting poll loop');
869
+ log("Reply listener daemon starting poll loop");
745
870
  const config = await buildDaemonConfig();
746
871
  if (!config) {
747
- log('ERROR: No notification config found for reply listener, exiting');
872
+ log("ERROR: No notification config found for reply listener, exiting");
748
873
  process.exit(1);
749
874
  }
750
875
  const state = readDaemonState() || {
@@ -764,12 +889,12 @@ async function pollLoop() {
764
889
  // Start Slack Socket Mode listener if configured
765
890
  let slackSocket = null;
766
891
  if (config.slackAppToken && config.slackBotToken && config.slackChannelId) {
767
- if (typeof WebSocket === 'undefined') {
768
- log('WARN: WebSocket not available (requires Node 20.10+), Slack Socket Mode disabled');
892
+ if (typeof WebSocket === "undefined") {
893
+ log("WARN: WebSocket not available (requires Node 20.10+), Slack Socket Mode disabled");
769
894
  }
770
895
  else {
771
896
  try {
772
- const { SlackSocketClient, addSlackReaction } = await import('./slack-socket.js');
897
+ const { SlackSocketClient, addSlackReaction } = await import("./slack-socket.js");
773
898
  const slackChannelId = config.slackChannelId;
774
899
  const slackBotToken = config.slackBotToken;
775
900
  slackSocket = new SlackSocketClient({
@@ -778,8 +903,9 @@ async function pollLoop() {
778
903
  channelId: slackChannelId,
779
904
  }, async (event) => {
780
905
  // Authorization: fail-closed — reject when no authorized users configured
781
- if (!config.authorizedSlackUserIds || config.authorizedSlackUserIds.length === 0) {
782
- log('WARN: No authorized Slack user IDs configured, rejecting all messages (fail-closed)');
906
+ if (!config.authorizedSlackUserIds ||
907
+ config.authorizedSlackUserIds.length === 0) {
908
+ log("WARN: No authorized Slack user IDs configured, rejecting all messages (fail-closed)");
783
909
  return;
784
910
  }
785
911
  if (!config.authorizedSlackUserIds.includes(event.user)) {
@@ -797,11 +923,11 @@ async function pollLoop() {
797
923
  let targetMapping;
798
924
  // Thread replies: look up parent message in session registry
799
925
  if (event.thread_ts && event.thread_ts !== event.ts) {
800
- const mapping = lookupByMessageId('slack-bot', event.thread_ts);
926
+ const mapping = lookupByMessageId("slack-bot", event.thread_ts);
801
927
  if (mapping) {
802
928
  // Approval-gate replies resolve the gate instead of injecting a pane
803
929
  if (mapping.approvalRef) {
804
- const decision = handleApprovalReply(mapping.approvalRef, event.text, 'slack');
930
+ const decision = handleApprovalReply(mapping.approvalRef, event.text, "slack");
805
931
  if (decision !== null) {
806
932
  try {
807
933
  await addSlackReaction(slackBotToken, slackChannelId, event.ts);
@@ -822,11 +948,11 @@ async function pollLoop() {
822
948
  // No thread match: skip injection to avoid sending to an unrelated session.
823
949
  // Discord and Telegram already skip when no match is found.
824
950
  if (!targetPaneId) {
825
- log('WARN: No target pane found for Slack message, skipping');
951
+ log("WARN: No target pane found for Slack message, skipping");
826
952
  return;
827
953
  }
828
954
  // Inject reply
829
- const success = injectReply(targetPaneId, event.text, 'slack', config, targetMapping);
955
+ const success = await injectReply(targetPaneId, event.text, "slack", config, targetMapping);
830
956
  if (success) {
831
957
  state.messagesInjected++;
832
958
  writeDaemonState(state);
@@ -844,7 +970,7 @@ async function pollLoop() {
844
970
  }
845
971
  }, log);
846
972
  await slackSocket.start();
847
- log('Slack Socket Mode listener started');
973
+ log("Slack Socket Mode listener started");
848
974
  }
849
975
  catch (e) {
850
976
  log(`ERROR: Failed to start Slack Socket Mode: ${e instanceof Error ? e.message : String(e)}`);
@@ -854,7 +980,7 @@ async function pollLoop() {
854
980
  }
855
981
  // Graceful shutdown handlers
856
982
  const shutdown = () => {
857
- log('Shutdown signal received');
983
+ log("Shutdown signal received");
858
984
  state.isRunning = false;
859
985
  if (slackSocket) {
860
986
  slackSocket.stop();
@@ -864,12 +990,12 @@ async function pollLoop() {
864
990
  removePidFile();
865
991
  process.exit(0);
866
992
  };
867
- process.on('SIGTERM', shutdown);
868
- process.on('SIGINT', shutdown);
993
+ process.on("SIGTERM", shutdown);
994
+ process.on("SIGINT", shutdown);
869
995
  // Prune stale registry entries on startup
870
996
  try {
871
997
  pruneStale();
872
- log('Pruned stale registry entries');
998
+ log("Pruned stale registry entries");
873
999
  }
874
1000
  catch (e) {
875
1001
  log(`WARN: Failed to prune stale entries: ${e}`);
@@ -885,7 +1011,7 @@ async function pollLoop() {
885
1011
  try {
886
1012
  pruneStale();
887
1013
  lastPruneAt = Date.now();
888
- log('Pruned stale registry entries');
1014
+ log("Pruned stale registry entries");
889
1015
  }
890
1016
  catch (e) {
891
1017
  log(`WARN: Prune failed: ${e instanceof Error ? e.message : String(e)}`);
@@ -904,7 +1030,7 @@ async function pollLoop() {
904
1030
  await new Promise((resolve) => setTimeout(resolve, config.pollIntervalMs * 2));
905
1031
  }
906
1032
  }
907
- log('Poll loop ended');
1033
+ log("Poll loop ended");
908
1034
  }
909
1035
  // ============================================================================
910
1036
  // Daemon Control
@@ -925,15 +1051,19 @@ export function startReplyListener(_config) {
925
1051
  const state = readDaemonState();
926
1052
  return {
927
1053
  success: true,
928
- message: 'Reply listener daemon is already running',
1054
+ message: "Reply listener daemon is already running",
929
1055
  state: state ?? undefined,
930
1056
  };
931
1057
  }
932
- // Check for tmux
933
- if (!isTmuxAvailable()) {
1058
+ // Check for tmux or Herdr context. Herdr-backed panes (team multiplexer=herdr
1059
+ // or ambient HERDR_PANE_ID) inject through the Herdr agent surface, so either
1060
+ // setting unlocks startup even when tmux is absent.
1061
+ const ambientHerdrPane = getCurrentHerdrPaneId();
1062
+ const herdrBackend = resolveTeamMultiplexer() === "herdr";
1063
+ if (!isTmuxAvailable() && !herdrBackend && !ambientHerdrPane) {
934
1064
  return {
935
1065
  success: false,
936
- message: 'tmux not available - reply injection requires tmux',
1066
+ message: "tmux not available and no Herdr context found - reply injection requires tmux or Herdr",
937
1067
  };
938
1068
  }
939
1069
  ensureStateDir();
@@ -951,7 +1081,7 @@ export function startReplyListener(_config) {
951
1081
  // exist, and the listener would silently fail to start.
952
1082
  const child = spawn(process.execPath, ['-e', daemonScript], {
953
1083
  detached: true,
954
- stdio: 'ignore',
1084
+ stdio: "ignore",
955
1085
  cwd: process.cwd(),
956
1086
  env: childEnv(createMinimalDaemonEnv()),
957
1087
  });
@@ -972,17 +1102,21 @@ export function startReplyListener(_config) {
972
1102
  generation,
973
1103
  };
974
1104
  writeDaemonState(state);
975
- void getProcessStartIdentity(pid).then((processStartIdentity) => {
1105
+ void getProcessStartIdentity(pid)
1106
+ .then((processStartIdentity) => {
976
1107
  if (!processStartIdentity)
977
1108
  return;
978
1109
  const current = readDaemonState();
979
1110
  const currentPid = readPidRecord();
980
- if (current?.pid !== pid || current.generation !== generation || currentPid?.generation !== generation)
1111
+ if (current?.pid !== pid ||
1112
+ current.generation !== generation ||
1113
+ currentPid?.generation !== generation)
981
1114
  return;
982
1115
  current.processStartIdentity = processStartIdentity;
983
1116
  writeDaemonState(current);
984
1117
  writePidFile({ pid, generation, processStartIdentity });
985
- }).catch(() => { });
1118
+ })
1119
+ .catch(() => { });
986
1120
  log(`Reply listener daemon started with PID ${pid}`);
987
1121
  return {
988
1122
  success: true,
@@ -992,13 +1126,13 @@ export function startReplyListener(_config) {
992
1126
  }
993
1127
  return {
994
1128
  success: false,
995
- message: 'Failed to start daemon process',
1129
+ message: "Failed to start daemon process",
996
1130
  };
997
1131
  }
998
1132
  catch (error) {
999
1133
  return {
1000
1134
  success: false,
1001
- message: 'Failed to start daemon',
1135
+ message: "Failed to start daemon",
1002
1136
  error: error instanceof Error ? error.message : String(error),
1003
1137
  };
1004
1138
  }
@@ -1007,10 +1141,13 @@ export function startReplyListener(_config) {
1007
1141
  export async function stopReplyListener() {
1008
1142
  const record = readPidRecord();
1009
1143
  if (!record)
1010
- return { success: true, message: 'Reply listener daemon is not running' };
1144
+ return { success: true, message: "Reply listener daemon is not running" };
1011
1145
  if (!isProcessAlive(record.pid)) {
1012
1146
  removePidFile();
1013
- return { success: true, message: 'Reply listener daemon was not running (cleaned up stale PID file)' };
1147
+ return {
1148
+ success: true,
1149
+ message: "Reply listener daemon was not running (cleaned up stale PID file)",
1150
+ };
1014
1151
  }
1015
1152
  const state = readDaemonState();
1016
1153
  if (!record.generation ||
@@ -1018,26 +1155,36 @@ export async function stopReplyListener() {
1018
1155
  state?.pid !== record.pid ||
1019
1156
  state.generation !== record.generation ||
1020
1157
  state.processStartIdentity !== record.processStartIdentity) {
1021
- return { success: false, message: 'Refusing to stop listener without an exact live identity' };
1158
+ return {
1159
+ success: false,
1160
+ message: "Refusing to stop listener without an exact live identity",
1161
+ };
1022
1162
  }
1023
1163
  // Revalidate under the registry lock. It is held through termination so a
1024
1164
  // concurrent registration cannot be accepted for a listener we are stopping.
1025
1165
  const emptyRegistryLock = lockRegistryIfEmpty();
1026
- if (emptyRegistryLock === 'active') {
1027
- return { success: true, message: 'Reply listener retained for active sessions', state };
1166
+ if (emptyRegistryLock === "active") {
1167
+ return {
1168
+ success: true,
1169
+ message: "Reply listener retained for active sessions",
1170
+ state,
1171
+ };
1028
1172
  }
1029
1173
  if (emptyRegistryLock === null) {
1030
- return { success: false, message: 'Could not durably verify an empty reply registry' };
1174
+ return {
1175
+ success: false,
1176
+ message: "Could not durably verify an empty reply registry",
1177
+ };
1031
1178
  }
1032
1179
  try {
1033
1180
  const deadlineAt = Date.now() + 500;
1034
1181
  const liveness = await isProcessIdentityLive(record.pid, record.processStartIdentity, deadlineAt);
1035
- if (liveness !== 'live') {
1182
+ if (liveness !== "live") {
1036
1183
  return {
1037
- success: liveness === 'dead',
1038
- message: liveness === 'dead'
1039
- ? 'Reply listener was not running'
1040
- : 'Refusing to stop listener after identity revalidation failed',
1184
+ success: liveness === "dead",
1185
+ message: liveness === "dead"
1186
+ ? "Reply listener was not running"
1187
+ : "Refusing to stop listener after identity revalidation failed",
1041
1188
  };
1042
1189
  }
1043
1190
  const termination = await terminateOwnedProcessTree({
@@ -1045,20 +1192,27 @@ export async function stopReplyListener() {
1045
1192
  expectedStartIdentity: record.processStartIdentity,
1046
1193
  deadlineAt: new Date(deadlineAt).toISOString(),
1047
1194
  });
1048
- if (termination !== 'terminated' && termination !== 'already-dead') {
1049
- return { success: false, message: 'Refusing to stop listener after termination identity revalidation failed' };
1195
+ if (termination !== "terminated" && termination !== "already-dead") {
1196
+ return {
1197
+ success: false,
1198
+ message: "Refusing to stop listener after termination identity revalidation failed",
1199
+ };
1050
1200
  }
1051
1201
  removePidFile();
1052
1202
  state.isRunning = false;
1053
1203
  state.pid = null;
1054
1204
  writeDaemonState(state);
1055
1205
  log(`Reply listener daemon stopped (PID ${record.pid})`);
1056
- return { success: true, message: `Reply listener daemon stopped (PID ${record.pid})`, state };
1206
+ return {
1207
+ success: true,
1208
+ message: `Reply listener daemon stopped (PID ${record.pid})`,
1209
+ state,
1210
+ };
1057
1211
  }
1058
1212
  catch (error) {
1059
1213
  return {
1060
1214
  success: false,
1061
- message: 'Failed to stop daemon',
1215
+ message: "Failed to stop daemon",
1062
1216
  error: error instanceof Error ? error.message : String(error),
1063
1217
  };
1064
1218
  }
@@ -1075,19 +1229,19 @@ export function getReplyListenerStatus() {
1075
1229
  if (!running && !state) {
1076
1230
  return {
1077
1231
  success: true,
1078
- message: 'Reply listener daemon has never been started',
1232
+ message: "Reply listener daemon has never been started",
1079
1233
  };
1080
1234
  }
1081
1235
  if (!running && state) {
1082
1236
  return {
1083
1237
  success: true,
1084
- message: 'Reply listener daemon is not running',
1238
+ message: "Reply listener daemon is not running",
1085
1239
  state: { ...state, isRunning: false, pid: null },
1086
1240
  };
1087
1241
  }
1088
1242
  return {
1089
1243
  success: true,
1090
- message: 'Reply listener daemon is running',
1244
+ message: "Reply listener daemon is running",
1091
1245
  state: state ?? undefined,
1092
1246
  };
1093
1247
  }
@@ -1116,7 +1270,7 @@ export function getReplyListenerStatus() {
1116
1270
  * @param timestamp - Slack request timestamp header (x-slack-request-timestamp)
1117
1271
  * @returns Object with injection result and validation details
1118
1272
  */
1119
- export function processSlackSocketMessage(rawMessage, connectionState, paneId, config, state, rateLimiter, signature, timestamp) {
1273
+ export async function processSlackSocketMessage(rawMessage, connectionState, paneId, config, state, rateLimiter, signature, timestamp) {
1120
1274
  // 1. Validate the Slack message
1121
1275
  const validation = validateSlackMessage(rawMessage, connectionState, config.slackSigningSecret, signature, timestamp);
1122
1276
  if (!validation.valid) {
@@ -1126,20 +1280,20 @@ export function processSlackSocketMessage(rawMessage, connectionState, paneId, c
1126
1280
  }
1127
1281
  // 2. Must have a target pane
1128
1282
  if (!paneId) {
1129
- log('REJECTED Slack message: no target pane ID');
1283
+ log("REJECTED Slack message: no target pane ID");
1130
1284
  state.errors++;
1131
1285
  return {
1132
1286
  injected: false,
1133
- validation: { valid: false, reason: 'No target pane ID' },
1287
+ validation: { valid: false, reason: "No target pane ID" },
1134
1288
  };
1135
1289
  }
1136
1290
  // 3. Rate limiting
1137
1291
  if (!rateLimiter.canProceed()) {
1138
- log('WARN: Rate limit exceeded, dropping Slack message');
1292
+ log("WARN: Rate limit exceeded, dropping Slack message");
1139
1293
  state.errors++;
1140
1294
  return {
1141
1295
  injected: false,
1142
- validation: { valid: false, reason: 'Rate limit exceeded' },
1296
+ validation: { valid: false, reason: "Rate limit exceeded" },
1143
1297
  };
1144
1298
  }
1145
1299
  // 4. Extract text from the validated message
@@ -1147,25 +1301,25 @@ export function processSlackSocketMessage(rawMessage, connectionState, paneId, c
1147
1301
  try {
1148
1302
  const parsed = JSON.parse(rawMessage);
1149
1303
  const payload = parsed.payload;
1150
- text = payload?.event?.text || payload?.text || '';
1304
+ text = payload?.event?.text || payload?.text || "";
1151
1305
  }
1152
1306
  catch {
1153
- log('REJECTED Slack message: failed to extract text from validated message');
1307
+ log("REJECTED Slack message: failed to extract text from validated message");
1154
1308
  state.errors++;
1155
1309
  return {
1156
1310
  injected: false,
1157
- validation: { valid: false, reason: 'Failed to extract message text' },
1311
+ validation: { valid: false, reason: "Failed to extract message text" },
1158
1312
  };
1159
1313
  }
1160
1314
  if (!text) {
1161
- log('REJECTED Slack message: empty message text');
1315
+ log("REJECTED Slack message: empty message text");
1162
1316
  return {
1163
1317
  injected: false,
1164
- validation: { valid: false, reason: 'Empty message text' },
1318
+ validation: { valid: false, reason: "Empty message text" },
1165
1319
  };
1166
1320
  }
1167
1321
  // 5. Inject reply (applies sanitization + pane verification)
1168
- const success = injectReply(paneId, text, 'slack', config);
1322
+ const success = await injectReply(paneId, text, "slack", config);
1169
1323
  if (success) {
1170
1324
  state.messagesInjected++;
1171
1325
  }
@@ -1175,7 +1329,7 @@ export function processSlackSocketMessage(rawMessage, connectionState, paneId, c
1175
1329
  return { injected: success, validation };
1176
1330
  }
1177
1331
  // Re-export for Slack integration
1178
- export { SlackConnectionStateTracker } from './slack-socket.js';
1332
+ export { SlackConnectionStateTracker } from "./slack-socket.js";
1179
1333
  // Export RateLimiter for external use (e.g., Slack Socket Mode handler)
1180
1334
  export { RateLimiter };
1181
1335
  // Export pollLoop for use by the daemon subprocess