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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -1
- package/agents/executor.md +1 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +23572 -17129
- package/bridge/mcp-server.cjs +2721 -1497
- package/bridge/runtime-cli.cjs +4707 -1925
- package/bridge/team-mcp.cjs +2917 -816
- package/bridge/team.js +5397 -2381
- package/copilot/agents/executor.md +1 -0
- package/copilot/hooks.json +3 -3
- package/dist/__tests__/arguments-literal-substitution.test.d.ts +2 -0
- package/dist/__tests__/arguments-literal-substitution.test.d.ts.map +1 -0
- package/dist/__tests__/arguments-literal-substitution.test.js +34 -0
- package/dist/__tests__/arguments-literal-substitution.test.js.map +1 -0
- package/dist/__tests__/bridge-self-contained.test.d.ts +2 -0
- package/dist/__tests__/bridge-self-contained.test.d.ts.map +1 -0
- package/dist/__tests__/bridge-self-contained.test.js +44 -0
- package/dist/__tests__/bridge-self-contained.test.js.map +1 -0
- package/dist/__tests__/context-safety.test.js +1 -1
- package/dist/__tests__/context-safety.test.js.map +1 -1
- package/dist/__tests__/copilot-hook-dispatch.test.js +5 -1
- package/dist/__tests__/copilot-hook-dispatch.test.js.map +1 -1
- package/dist/__tests__/copilot-hooks-manifest.test.js +15 -1
- package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
- package/dist/__tests__/directory-context-injector-registration.test.js +5 -2
- package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -1
- package/dist/__tests__/doctor-conflicts.test.js +61 -0
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/hook-command-normalizer.test.js +96 -58
- package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
- package/dist/__tests__/hooks/session-end-cleanup.test.js +87 -1
- package/dist/__tests__/hooks/session-end-cleanup.test.js.map +1 -1
- package/dist/__tests__/hooks-command-escaping.test.js +18 -16
- package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
- package/dist/__tests__/hud/omc-state.test.js +62 -1
- package/dist/__tests__/hud/omc-state.test.js.map +1 -1
- package/dist/__tests__/installer-mcp-config.test.js +39 -1
- package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
- package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js +1 -1
- package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.js +13 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-script.test.js +201 -0
- package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
- package/dist/__tests__/npm-package-surface-helpers.d.ts.map +1 -1
- package/dist/__tests__/npm-package-surface-helpers.js +8 -4
- package/dist/__tests__/npm-package-surface-helpers.js.map +1 -1
- package/dist/__tests__/plugin-setup-deps.test.js +144 -71
- package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
- package/dist/__tests__/preemptive-compaction-hook.test.js +62 -5
- package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
- package/dist/__tests__/ralph-prd-mandatory.test.js +3 -0
- package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts +10 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js +241 -0
- package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts +9 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts.map +1 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.js +162 -0
- package/dist/__tests__/rate-limit-wait/herdr-detector.test.js.map +1 -0
- package/dist/__tests__/repair-plugin-cache-script.test.js +7 -1
- package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +3 -2
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +4 -1
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
- package/dist/__tests__/setup-contracts-regression.test.js +13 -10
- package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +10 -9
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/alias-retirement/__tests__/registry.test.js +2 -2
- package/dist/cli/__tests__/doctor-conflicts-json.test.js +2 -2
- package/dist/cli/__tests__/doctor-conflicts-json.test.js.map +1 -1
- package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts +10 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts.map +1 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.js +54 -0
- package/dist/cli/__tests__/herdr-no-raw-calls.test.js.map +1 -0
- package/dist/cli/__tests__/interop-herdr.test.d.ts +9 -0
- package/dist/cli/__tests__/interop-herdr.test.d.ts.map +1 -0
- package/dist/cli/__tests__/interop-herdr.test.js +138 -0
- package/dist/cli/__tests__/interop-herdr.test.js.map +1 -0
- package/dist/cli/__tests__/launch-herdr.test.d.ts +10 -0
- package/dist/cli/__tests__/launch-herdr.test.d.ts.map +1 -0
- package/dist/cli/__tests__/launch-herdr.test.js +141 -0
- package/dist/cli/__tests__/launch-herdr.test.js.map +1 -0
- package/dist/cli/__tests__/launch.test.js +140 -10
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/plugin-dir-capture.test.js +2 -0
- package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-afk.test.js +392 -2
- package/dist/cli/__tests__/ralph-afk.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-closeout.test.d.ts +2 -0
- package/dist/cli/__tests__/ralph-closeout.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ralph-closeout.test.js +156 -0
- package/dist/cli/__tests__/ralph-closeout.test.js.map +1 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.d.ts +2 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.d.ts.map +1 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.js +86 -0
- package/dist/cli/__tests__/subcommand-json-flag.test.js.map +1 -0
- package/dist/cli/__tests__/team-resume-v2.test.js +46 -0
- package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +24 -0
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/wait-teleport-json.test.js +2 -2
- package/dist/cli/__tests__/wait-teleport-json.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-run-cli.test.js +20 -0
- package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/release-cli.test.js +11 -0
- package/dist/cli/commands/__tests__/release-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/ship-cli.test.js +1 -1
- package/dist/cli/commands/__tests__/ship-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/teleport.test.js +42 -0
- package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
- package/dist/cli/commands/__tests__/wait.test.js +33 -1
- package/dist/cli/commands/__tests__/wait.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +6 -2
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/factory-bench.d.ts.map +1 -1
- package/dist/cli/commands/factory-bench.js +17 -3
- package/dist/cli/commands/factory-bench.js.map +1 -1
- package/dist/cli/commands/factory-dashboard.d.ts +5 -1
- package/dist/cli/commands/factory-dashboard.d.ts.map +1 -1
- package/dist/cli/commands/factory-dashboard.js +6 -2
- package/dist/cli/commands/factory-dashboard.js.map +1 -1
- package/dist/cli/commands/factory.d.ts +6 -0
- package/dist/cli/commands/factory.d.ts.map +1 -1
- package/dist/cli/commands/factory.js +45 -4
- package/dist/cli/commands/factory.js.map +1 -1
- package/dist/cli/commands/ralph.d.ts +36 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +298 -50
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/release.d.ts +3 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +12 -3
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/ship.d.ts.map +1 -1
- package/dist/cli/commands/ship.js +8 -4
- package/dist/cli/commands/ship.js.map +1 -1
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +2 -0
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/commands/teleport.d.ts.map +1 -1
- package/dist/cli/commands/teleport.js +6 -1
- package/dist/cli/commands/teleport.js.map +1 -1
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +3 -1
- package/dist/cli/commands/wait.js.map +1 -1
- package/dist/cli/index.js +8 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interop.d.ts +4 -3
- package/dist/cli/interop.d.ts.map +1 -1
- package/dist/cli/interop.js +95 -4
- package/dist/cli/interop.js.map +1 -1
- package/dist/cli/launch.d.ts +17 -2
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +110 -12
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +4 -1
- package/dist/cli/team.js.map +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +17 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/copilot-run/job.d.ts +2 -0
- package/dist/copilot-run/job.d.ts.map +1 -1
- package/dist/copilot-run/job.js +3 -0
- package/dist/copilot-run/job.js.map +1 -1
- package/dist/copilot-run/sandbox.d.ts +16 -0
- package/dist/copilot-run/sandbox.d.ts.map +1 -1
- package/dist/copilot-run/sandbox.js +29 -2
- package/dist/copilot-run/sandbox.js.map +1 -1
- package/dist/factory/bench/__tests__/bench.units.test.js +133 -1
- package/dist/factory/bench/__tests__/bench.units.test.js.map +1 -1
- package/dist/factory/bench/score.d.ts +33 -1
- package/dist/factory/bench/score.d.ts.map +1 -1
- package/dist/factory/bench/score.js +95 -5
- package/dist/factory/bench/score.js.map +1 -1
- package/dist/factory/board/__tests__/board.test.js +31 -1
- package/dist/factory/board/__tests__/board.test.js.map +1 -1
- package/dist/factory/board/collect.d.ts +5 -2
- package/dist/factory/board/collect.d.ts.map +1 -1
- package/dist/factory/board/collect.js +7 -2
- package/dist/factory/board/collect.js.map +1 -1
- package/dist/factory/check/cli.d.ts.map +1 -1
- package/dist/factory/check/cli.js +6 -2
- package/dist/factory/check/cli.js.map +1 -1
- package/dist/factory/dashboard/__tests__/dashboard.test.js +10 -0
- package/dist/factory/dashboard/__tests__/dashboard.test.js.map +1 -1
- package/dist/factory/run/__tests__/auto-merge.test.js +2 -0
- package/dist/factory/run/__tests__/auto-merge.test.js.map +1 -1
- package/dist/factory/run/__tests__/claims.test.js +15 -0
- package/dist/factory/run/__tests__/claims.test.js.map +1 -1
- package/dist/factory/run/__tests__/container-gate.test.js +59 -1
- package/dist/factory/run/__tests__/container-gate.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.d.ts.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.js +6 -0
- package/dist/factory/run/__tests__/engine-local-harness.js.map +1 -1
- package/dist/factory/run/__tests__/engine-local-harness.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.js +23 -0
- package/dist/factory/run/__tests__/engine-local-harness.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.js +392 -0
- package/dist/factory/run/__tests__/engine.gates-git-transport.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.js +347 -0
- package/dist/factory/run/__tests__/engine.gates-test-delta.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js +235 -0
- package/dist/factory/run/__tests__/engine.gates-tree-copy.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.js +171 -0
- package/dist/factory/run/__tests__/engine.human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js +56 -0
- package/dist/factory/run/__tests__/engine.local.conflict-reprepare.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.js +48 -0
- package/dist/factory/run/__tests__/engine.local.human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.stall.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.stall.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.stall.test.js +137 -0
- package/dist/factory/run/__tests__/engine.stall.test.js.map +1 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts +6 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
- package/dist/factory/run/__tests__/fake-lanes.js +17 -1
- package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
- package/dist/factory/run/__tests__/human-merged.test.d.ts +2 -0
- package/dist/factory/run/__tests__/human-merged.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/human-merged.test.js +301 -0
- package/dist/factory/run/__tests__/human-merged.test.js.map +1 -0
- package/dist/factory/run/__tests__/lane.test.js +2 -0
- package/dist/factory/run/__tests__/lane.test.js.map +1 -1
- package/dist/factory/run/__tests__/merge-policy.test.js +16 -0
- package/dist/factory/run/__tests__/merge-policy.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts +2 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js +137 -0
- package/dist/factory/run/__tests__/prepare-gates.conflict-reprepare.test.js.map +1 -0
- package/dist/factory/run/__tests__/prepare-gates.crash.test.js +21 -0
- package/dist/factory/run/__tests__/prepare-gates.crash.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js +11 -0
- package/dist/factory/run/__tests__/prepare-gates.gates-resume.test.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.test.js +39 -0
- package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
- package/dist/factory/run/__tests__/private-store.test.js +22 -1
- package/dist/factory/run/__tests__/private-store.test.js.map +1 -1
- package/dist/factory/run/__tests__/test-delta.test.d.ts +2 -0
- package/dist/factory/run/__tests__/test-delta.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/test-delta.test.js +239 -0
- package/dist/factory/run/__tests__/test-delta.test.js.map +1 -0
- package/dist/factory/run/__tests__/units.test.js +219 -2
- package/dist/factory/run/__tests__/units.test.js.map +1 -1
- package/dist/factory/run/__tests__/workspace-tree.test.js +16 -4
- package/dist/factory/run/__tests__/workspace-tree.test.js.map +1 -1
- package/dist/factory/run/auto-merge.d.ts +4 -0
- package/dist/factory/run/auto-merge.d.ts.map +1 -1
- package/dist/factory/run/auto-merge.js +3 -0
- package/dist/factory/run/auto-merge.js.map +1 -1
- package/dist/factory/run/budget.d.ts +6 -0
- package/dist/factory/run/budget.d.ts.map +1 -1
- package/dist/factory/run/budget.js +5 -0
- package/dist/factory/run/budget.js.map +1 -1
- package/dist/factory/run/claims.d.ts.map +1 -1
- package/dist/factory/run/claims.js +5 -3
- package/dist/factory/run/claims.js.map +1 -1
- package/dist/factory/run/container-gate.d.ts +14 -1
- package/dist/factory/run/container-gate.d.ts.map +1 -1
- package/dist/factory/run/container-gate.js +42 -4
- package/dist/factory/run/container-gate.js.map +1 -1
- package/dist/factory/run/engine.d.ts +46 -1
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +779 -68
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/factory/run/human-merged.d.ts +105 -0
- package/dist/factory/run/human-merged.d.ts.map +1 -0
- package/dist/factory/run/human-merged.js +256 -0
- package/dist/factory/run/human-merged.js.map +1 -0
- package/dist/factory/run/lane.d.ts +2 -0
- package/dist/factory/run/lane.d.ts.map +1 -1
- package/dist/factory/run/lane.js +1 -0
- package/dist/factory/run/lane.js.map +1 -1
- package/dist/factory/run/merge-policy.d.ts +1 -2
- package/dist/factory/run/merge-policy.d.ts.map +1 -1
- package/dist/factory/run/merge-policy.js +5 -12
- package/dist/factory/run/merge-policy.js.map +1 -1
- package/dist/factory/run/prepare.d.ts +40 -1
- package/dist/factory/run/prepare.d.ts.map +1 -1
- package/dist/factory/run/prepare.js +240 -38
- package/dist/factory/run/prepare.js.map +1 -1
- package/dist/factory/run/private-run.d.ts +2 -1
- package/dist/factory/run/private-run.d.ts.map +1 -1
- package/dist/factory/run/private-run.js +5 -2
- package/dist/factory/run/private-run.js.map +1 -1
- package/dist/factory/run/prompts.d.ts +2 -2
- package/dist/factory/run/prompts.d.ts.map +1 -1
- package/dist/factory/run/prompts.js +7 -6
- package/dist/factory/run/prompts.js.map +1 -1
- package/dist/factory/run/sandbox-exec.d.ts +9 -1
- package/dist/factory/run/sandbox-exec.d.ts.map +1 -1
- package/dist/factory/run/sandbox-exec.js.map +1 -1
- package/dist/factory/run/state.d.ts +54 -1
- package/dist/factory/run/state.d.ts.map +1 -1
- package/dist/factory/run/state.js +23 -2
- package/dist/factory/run/state.js.map +1 -1
- package/dist/factory/run/test-delta.d.ts +123 -0
- package/dist/factory/run/test-delta.d.ts.map +1 -0
- package/dist/factory/run/test-delta.js +236 -0
- package/dist/factory/run/test-delta.js.map +1 -0
- package/dist/features/__tests__/checkpoint.test.js +118 -1
- package/dist/features/__tests__/checkpoint.test.js.map +1 -1
- package/dist/features/__tests__/jev-model-routing.test.js +20 -2
- package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
- package/dist/features/__tests__/jev-slop-warning.test.js +22 -2
- package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -1
- package/dist/features/checkpoint/index.d.ts.map +1 -1
- package/dist/features/checkpoint/index.js +25 -8
- package/dist/features/checkpoint/index.js.map +1 -1
- package/dist/features/jev-slop-warning.d.ts +3 -2
- package/dist/features/jev-slop-warning.d.ts.map +1 -1
- package/dist/features/jev-slop-warning.js +5 -3
- package/dist/features/jev-slop-warning.js.map +1 -1
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +55 -9
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.d.ts +33 -0
- package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.js +156 -0
- package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +4 -2
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
- package/dist/forge/ado/__tests__/adapter.test.js +7 -0
- package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
- package/dist/forge/ado/reviews.d.ts.map +1 -1
- package/dist/forge/ado/reviews.js +6 -0
- package/dist/forge/ado/reviews.js.map +1 -1
- package/dist/forge/github/__tests__/mergeability.test.d.ts +2 -0
- package/dist/forge/github/__tests__/mergeability.test.d.ts.map +1 -0
- package/dist/forge/github/__tests__/mergeability.test.js +34 -0
- package/dist/forge/github/__tests__/mergeability.test.js.map +1 -0
- package/dist/forge/github/reviews.d.ts +7 -1
- package/dist/forge/github/reviews.d.ts.map +1 -1
- package/dist/forge/github/reviews.js +13 -0
- package/dist/forge/github/reviews.js.map +1 -1
- package/dist/forge/local/__tests__/mirror.test.js +3 -1
- package/dist/forge/local/__tests__/mirror.test.js.map +1 -1
- package/dist/forge/local/__tests__/reviews.test.js +19 -0
- package/dist/forge/local/__tests__/reviews.test.js.map +1 -1
- package/dist/forge/local/mirror.d.ts +2 -0
- package/dist/forge/local/mirror.d.ts.map +1 -1
- package/dist/forge/local/mirror.js +2 -0
- package/dist/forge/local/mirror.js.map +1 -1
- package/dist/forge/local/reviews.d.ts.map +1 -1
- package/dist/forge/local/reviews.js +12 -1
- package/dist/forge/local/reviews.js.map +1 -1
- package/dist/forge/types.d.ts +13 -0
- package/dist/forge/types.d.ts.map +1 -1
- package/dist/graph/schema.d.ts +10 -10
- package/dist/hooks/__tests__/precompact-restore.test.js +38 -0
- package/dist/hooks/__tests__/precompact-restore.test.js.map +1 -1
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +7 -2
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +1 -1
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +24 -2
- package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.js +6 -4
- package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
- package/dist/hooks/jev/__tests__/client.test.js +20 -1
- package/dist/hooks/jev/__tests__/client.test.js.map +1 -1
- package/dist/hooks/jev/__tests__/log-context.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/log-context.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/log-context.test.js +97 -0
- package/dist/hooks/jev/__tests__/log-context.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.js +148 -0
- package/dist/hooks/jev/__tests__/log-rotation.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.js +117 -0
- package/dist/hooks/jev/__tests__/resolver-request-count.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/resolver.test.js +63 -1
- package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
- package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.js +294 -0
- package/dist/hooks/jev/__tests__/shared-breaker.test.js.map +1 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts +2 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.js +88 -0
- package/dist/hooks/jev/__tests__/state-omit-ids.test.js.map +1 -0
- package/dist/hooks/jev/client.d.ts +34 -2
- package/dist/hooks/jev/client.d.ts.map +1 -1
- package/dist/hooks/jev/client.js +80 -5
- package/dist/hooks/jev/client.js.map +1 -1
- package/dist/hooks/jev/config.d.ts +78 -4
- package/dist/hooks/jev/config.d.ts.map +1 -1
- package/dist/hooks/jev/config.js +123 -9
- package/dist/hooks/jev/config.js.map +1 -1
- package/dist/hooks/jev/points.d.ts +2 -0
- package/dist/hooks/jev/points.d.ts.map +1 -1
- package/dist/hooks/jev/points.js +41 -10
- package/dist/hooks/jev/points.js.map +1 -1
- package/dist/hooks/jev/resolver.d.ts +27 -2
- package/dist/hooks/jev/resolver.d.ts.map +1 -1
- package/dist/hooks/jev/resolver.js +176 -20
- package/dist/hooks/jev/resolver.js.map +1 -1
- package/dist/hooks/jev/types.d.ts +21 -4
- package/dist/hooks/jev/types.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts +2 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js +209 -0
- package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js +6 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +15 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +200 -2
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.js +3 -3
- package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +20 -1
- package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
- package/dist/hooks/learner/jev-shadow.js +3 -3
- package/dist/hooks/learner/jev-shadow.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js +280 -0
- package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/error-handling.test.js +2 -2
- package/dist/hooks/persistent-mode/__tests__/error-handling.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +47 -1
- package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +136 -40
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.js +11 -7
- package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
- package/dist/hooks/pre-compact/index.d.ts.map +1 -1
- package/dist/hooks/pre-compact/index.js +8 -5
- package/dist/hooks/pre-compact/index.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts +11 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts.map +1 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js +227 -0
- package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js.map +1 -0
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +26 -6
- package/dist/hooks/project-memory/index.js.map +1 -1
- package/dist/hooks/ralph/__tests__/closeout.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/closeout.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/closeout.test.js +82 -0
- package/dist/hooks/ralph/__tests__/closeout.test.js.map +1 -0
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +572 -4
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +23 -2
- package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -1
- package/dist/hooks/ralph/closeout.d.ts +34 -0
- package/dist/hooks/ralph/closeout.d.ts.map +1 -0
- package/dist/hooks/ralph/closeout.js +66 -0
- package/dist/hooks/ralph/closeout.js.map +1 -0
- package/dist/hooks/ralph/feedback-baseline.d.ts +60 -6
- package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
- package/dist/hooks/ralph/feedback-baseline.js +302 -15
- package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
- package/dist/hooks/ralph/index.d.ts +1 -1
- package/dist/hooks/ralph/index.d.ts.map +1 -1
- package/dist/hooks/ralph/index.js +1 -1
- package/dist/hooks/ralph/index.js.map +1 -1
- package/dist/hooks/ralph/jev-shadow.js +3 -3
- package/dist/hooks/ralph/jev-shadow.js.map +1 -1
- package/dist/hooks/ralph/verifier.d.ts +5 -0
- package/dist/hooks/ralph/verifier.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.js +21 -10
- package/dist/hooks/ralph/verifier.js.map +1 -1
- package/dist/hooks/registry/__tests__/registry.test.js +6 -0
- package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
- package/dist/hooks/registry/registry.d.ts +6 -2
- package/dist/hooks/registry/registry.d.ts.map +1 -1
- package/dist/hooks/registry/registry.js +21 -6
- package/dist/hooks/registry/registry.js.map +1 -1
- package/dist/hooks/registry/types.d.ts +2 -0
- package/dist/hooks/registry/types.d.ts.map +1 -1
- package/dist/hooks/session-end/__tests__/callbacks.test.js +10 -1
- package/dist/hooks/session-end/__tests__/callbacks.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/worker.test.js +111 -2
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/callbacks.js +1 -1
- package/dist/hooks/session-end/callbacks.js.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts +2 -0
- package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.js +8 -0
- package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +21 -3
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/worker.d.ts.map +1 -1
- package/dist/hooks/session-end/worker.js +32 -2
- package/dist/hooks/session-end/worker.js.map +1 -1
- package/dist/hooks/setup/__tests__/windows-patch.test.js +89 -17
- package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
- package/dist/hooks/setup/index.d.ts +10 -21
- package/dist/hooks/setup/index.d.ts.map +1 -1
- package/dist/hooks/setup/index.js +14 -48
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +2 -1
- package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hud/omc-state.d.ts +8 -0
- package/dist/hud/omc-state.d.ts.map +1 -1
- package/dist/hud/omc-state.js +23 -2
- package/dist/hud/omc-state.js.map +1 -1
- package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts +2 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts.map +1 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.js +323 -0
- package/dist/installer/__tests__/claude-mcp-config-path.test.js.map +1 -0
- package/dist/installer/__tests__/mcp-registry.test.js +81 -3
- package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js +36 -0
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +16 -4
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/mcp-registry.d.ts +21 -1
- package/dist/installer/mcp-registry.d.ts.map +1 -1
- package/dist/installer/mcp-registry.js +101 -20
- package/dist/installer/mcp-registry.js.map +1 -1
- package/dist/lib/atomic-write.d.ts.map +1 -1
- package/dist/lib/atomic-write.js +61 -2
- package/dist/lib/atomic-write.js.map +1 -1
- package/dist/lib/one-line.d.ts +3 -0
- package/dist/lib/one-line.d.ts.map +1 -0
- package/dist/lib/one-line.js +5 -0
- package/dist/lib/one-line.js.map +1 -0
- package/dist/mcp/__tests__/team-cleanup.test.js +13 -0
- package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
- package/dist/mcp/team-job-convergence.d.ts.map +1 -1
- package/dist/mcp/team-job-convergence.js +4 -1
- package/dist/mcp/team-job-convergence.js.map +1 -1
- package/dist/mcp/team-server.js +2 -2
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/notifications/__tests__/approval-reply.test.js +8 -0
- package/dist/notifications/__tests__/approval-reply.test.js.map +1 -1
- package/dist/notifications/__tests__/reply-herdr.test.d.ts +8 -0
- package/dist/notifications/__tests__/reply-herdr.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/reply-herdr.test.js +125 -0
- package/dist/notifications/__tests__/reply-herdr.test.js.map +1 -0
- package/dist/notifications/__tests__/tmux.test.js +56 -1
- package/dist/notifications/__tests__/tmux.test.js.map +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +22 -7
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts +28 -12
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +326 -172
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/tmux.d.ts +22 -2
- package/dist/notifications/tmux.d.ts.map +1 -1
- package/dist/notifications/tmux.js +57 -2
- package/dist/notifications/tmux.js.map +1 -1
- package/dist/release/__tests__/engine.test.js +74 -2
- package/dist/release/__tests__/engine.test.js.map +1 -1
- package/dist/release/engine.d.ts +9 -1
- package/dist/release/engine.d.ts.map +1 -1
- package/dist/release/engine.js +41 -4
- package/dist/release/engine.js.map +1 -1
- package/dist/shared/types.d.ts +5 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/ship/__tests__/check-name.test.d.ts +2 -0
- package/dist/ship/__tests__/check-name.test.d.ts.map +1 -0
- package/dist/ship/__tests__/check-name.test.js +17 -0
- package/dist/ship/__tests__/check-name.test.js.map +1 -0
- package/dist/ship/__tests__/gates-settle.test.js +13 -1
- package/dist/ship/__tests__/gates-settle.test.js.map +1 -1
- package/dist/ship/__tests__/prepare-build.test.d.ts +2 -0
- package/dist/ship/__tests__/prepare-build.test.d.ts.map +1 -0
- package/dist/ship/__tests__/prepare-build.test.js +287 -0
- package/dist/ship/__tests__/prepare-build.test.js.map +1 -0
- package/dist/ship/__tests__/prepare-merge.test.js +8 -1
- package/dist/ship/__tests__/prepare-merge.test.js.map +1 -1
- package/dist/ship/__tests__/safety-state.test.js +4 -0
- package/dist/ship/__tests__/safety-state.test.js.map +1 -1
- package/dist/ship/check-name.d.ts +12 -0
- package/dist/ship/check-name.d.ts.map +1 -0
- package/dist/ship/check-name.js +13 -0
- package/dist/ship/check-name.js.map +1 -0
- package/dist/ship/config.d.ts +13 -0
- package/dist/ship/config.d.ts.map +1 -1
- package/dist/ship/config.js +18 -1
- package/dist/ship/config.js.map +1 -1
- package/dist/ship/exec.d.ts +8 -0
- package/dist/ship/exec.d.ts.map +1 -1
- package/dist/ship/exec.js +33 -5
- package/dist/ship/exec.js.map +1 -1
- package/dist/ship/gates.d.ts.map +1 -1
- package/dist/ship/gates.js +3 -2
- package/dist/ship/gates.js.map +1 -1
- package/dist/ship/merge.d.ts +11 -2
- package/dist/ship/merge.d.ts.map +1 -1
- package/dist/ship/merge.js +55 -10
- package/dist/ship/merge.js.map +1 -1
- package/dist/ship/prepare.d.ts +16 -4
- package/dist/ship/prepare.d.ts.map +1 -1
- package/dist/ship/prepare.js +108 -2
- package/dist/ship/prepare.js.map +1 -1
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +9 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js +140 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
- package/dist/team/__tests__/herdr-session.test.d.ts +9 -0
- package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session.test.js +270 -0
- package/dist/team/__tests__/herdr-session.test.js.map +1 -0
- package/dist/team/__tests__/idle-nudge.test.js +17 -0
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
- package/dist/team/__tests__/mailbox-notification-guard.test.js +403 -181
- package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
- package/dist/team/__tests__/scaling-launch-config.test.js +12 -0
- package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +12 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/task-claim-renewal.test.d.ts +2 -0
- package/dist/team/__tests__/task-claim-renewal.test.d.ts.map +1 -0
- package/dist/team/__tests__/task-claim-renewal.test.js +421 -0
- package/dist/team/__tests__/task-claim-renewal.test.js.map +1 -0
- package/dist/team/__tests__/task-storage-integrity.test.js +34 -0
- package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts +11 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.js +99 -0
- package/dist/team/__tests__/tmux-session.create-team-herdr.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts +10 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.js +226 -0
- package/dist/team/__tests__/tmux-session.herdr-arms.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.test.js +888 -721
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +19 -0
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/api-interop.d.ts +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +13 -1
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/herdr-session.d.ts +267 -0
- package/dist/team/herdr-session.d.ts.map +1 -0
- package/dist/team/herdr-session.js +508 -0
- package/dist/team/herdr-session.js.map +1 -0
- package/dist/team/idle-nudge.d.ts +1 -1
- package/dist/team/idle-nudge.d.ts.map +1 -1
- package/dist/team/idle-nudge.js +4 -4
- package/dist/team/idle-nudge.js.map +1 -1
- package/dist/team/mailbox-notification-guard.d.ts +24 -19
- package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
- package/dist/team/mailbox-notification-guard.js +241 -148
- package/dist/team/mailbox-notification-guard.js.map +1 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +1 -0
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +33 -33
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +2810 -1591
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/scaling.d.ts +3 -3
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +766 -402
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/tasks.d.ts +15 -1
- package/dist/team/state/tasks.d.ts.map +1 -1
- package/dist/team/state/tasks.js +56 -2
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/team-ops.d.ts +3 -2
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +32 -5
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/tmux-session.d.ts +66 -40
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +1733 -1096
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +8 -0
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +3 -0
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/tools/lsp/__tests__/devcontainer.test.js +39 -5
- package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -1
- package/dist/tools/lsp/devcontainer.d.ts.map +1 -1
- package/dist/tools/lsp/devcontainer.js +25 -8
- package/dist/tools/lsp/devcontainer.js.map +1 -1
- package/dist/utils/__tests__/windows-search.test.js +17 -3
- package/dist/utils/__tests__/windows-search.test.js.map +1 -1
- package/dist/utils/plugin-cache-validation.d.ts.map +1 -1
- package/dist/utils/plugin-cache-validation.js +27 -18
- package/dist/utils/plugin-cache-validation.js.map +1 -1
- package/dist/workflow/__tests__/projections.test.js +3 -3
- package/dist/workflow/__tests__/projections.test.js.map +1 -1
- package/dist/workflow/__tests__/registry.test.js +3 -3
- package/dist/workflow/__tests__/registry.test.js.map +1 -1
- package/dist/workflow/registry.d.ts.map +1 -1
- package/dist/workflow/registry.js +1 -0
- package/dist/workflow/registry.js.map +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/CREDITS.md +1 -0
- package/docs/FEATURES.md +18 -0
- package/docs/FIELD-TESTING.md +10 -0
- package/docs/HOOKS.md +339 -36
- package/docs/REFERENCE.md +82 -17
- package/docs/TEAM-MULTIPLEXER.md +107 -0
- package/hooks/hooks.json +204 -66
- package/hooks/jev-compaction.mjs +2404 -0
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/check-omc-playbooks.mjs +214 -124
- package/scripts/code-simplifier.mjs +26 -3
- package/scripts/copilot/build-hooks.mjs +24 -7
- package/scripts/generate-inventory-graph.mjs +77 -92
- package/scripts/jev-eval.mjs +123 -22
- package/scripts/jev-repair-transcript.mjs +331 -0
- package/scripts/jev-resolve.mjs +374 -22
- package/scripts/keyword-detector.mjs +427 -29
- package/scripts/lib/hook-command-normalizer.d.mts +33 -0
- package/scripts/lib/hook-command-normalizer.mjs +157 -60
- package/scripts/lib/jev-breaker.d.mts +73 -0
- package/scripts/lib/jev-breaker.mjs +830 -0
- package/scripts/lib/jev-compaction-state.mjs +320 -0
- package/scripts/lib/jev-delivery-guard.mjs +567 -0
- package/scripts/lib/jev-mask.mjs +36 -0
- package/scripts/lib/jev-shadow.mjs +363 -14
- package/scripts/lib/shell-checks.mjs +1121 -0
- package/scripts/lib/state-root.cjs +19 -8
- package/scripts/lib/state-root.mjs +19 -8
- package/scripts/persistent-mode.cjs +289 -1
- package/scripts/persistent-mode.mjs +540 -91
- package/scripts/plugin-setup.mjs +26 -30
- package/scripts/plugin-shipping-surface.mjs +4 -1
- package/scripts/post-tool-use-failure.mjs +18 -0
- package/scripts/post-tool-verifier.mjs +49 -3
- package/scripts/pre-tool-enforcer.mjs +658 -64
- package/scripts/run.cjs +4 -2
- package/scripts/session-start.mjs +54 -0
- package/skills/AGENTS.md +1 -0
- package/skills/ai-slop-cleaner/SKILL.md +14 -0
- package/skills/arena/SKILL.md +8 -1
- package/skills/babysit/SKILL.md +2 -1
- package/skills/create-formal-verification-skill/SKILL.md +6 -4
- package/skills/figure-it-out/SKILL.md +5 -0
- package/skills/fix-ci/SKILL.md +3 -1
- package/skills/how/references/explainer-prompt.md +7 -4
- package/skills/interrogate/SKILL.md +10 -6
- package/skills/ralph/SKILL.md +27 -2
- package/skills/ralph-experiment/SKILL.md +1 -1
- package/skills/sdd/SKILL.md +67 -0
- package/skills/sdd/phases/criteria.md +144 -0
- package/skills/sdd/phases/execute.md +226 -0
- package/skills/sdd/phases/review.md +216 -0
- package/skills/sdd/phases/rules.md +195 -0
- package/skills/sdd/phases/spec.md +75 -0
- package/skills/sdd/phases/tasks.md +162 -0
- package/skills/statechart/scripts/run.ts +6 -3
- package/skills/statechart/scripts/test/child-env.test.ts +53 -0
- package/templates/hooks/keyword-detector.mjs +172 -5
- package/templates/hooks/lib/state-root.mjs +19 -8
- 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
|
|
19
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync, chmodSync, statSync, appendFileSync, renameSync } from
|
|
20
|
-
import { join } from
|
|
21
|
-
import { fileURLToPath, pathToFileURL } from
|
|
22
|
-
import { spawn } from
|
|
23
|
-
import { randomUUID } from
|
|
24
|
-
import { tmuxExec } from
|
|
25
|
-
import { request as httpsRequest } from
|
|
26
|
-
import { resolveDaemonModulePath } from
|
|
27
|
-
import { getGlobalOmcStateRoot } from
|
|
28
|
-
import { capturePaneContent, sendToPane, isTmuxAvailable, } from
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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,
|
|
64
|
-
const STATE_FILE_PATH = join(DEFAULT_STATE_DIR,
|
|
65
|
-
const LOG_FILE_PATH = join(DEFAULT_STATE_DIR,
|
|
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,
|
|
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(
|
|
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,
|
|
216
|
+
const content = readFileSync(PID_FILE_PATH, "utf-8").trim();
|
|
190
217
|
const parsed = JSON.parse(content);
|
|
191
|
-
return typeof parsed.pid ===
|
|
192
|
-
|
|
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,
|
|
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,
|
|
252
|
-
.replace(/[\u202a-\u202e\u2066-\u2069]/g,
|
|
253
|
-
.replace(/\r\n|[\r\n]/g,
|
|
254
|
-
.replace(/\\/g,
|
|
255
|
-
.replace(/`/g,
|
|
256
|
-
.replace(/\$\(/g,
|
|
257
|
-
.replace(/\$\{/g,
|
|
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
|
-
|
|
266
|
-
|
|
298
|
+
"approve",
|
|
299
|
+
"approved",
|
|
300
|
+
"yes",
|
|
301
|
+
"y",
|
|
302
|
+
"批准",
|
|
303
|
+
"同意",
|
|
267
304
|
]);
|
|
268
305
|
const APPROVAL_DENY_WORDS = new Set([
|
|
269
|
-
|
|
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
|
|
278
|
-
if (
|
|
279
|
-
return
|
|
280
|
-
|
|
281
|
-
|
|
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 ===
|
|
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 }, () => ({
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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:
|
|
347
|
-
{ kind:
|
|
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 ===
|
|
354
|
-
tmuxExec([
|
|
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([
|
|
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
|
-
|
|
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 ===
|
|
383
|
-
const success = mapping?.event ===
|
|
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
|
|
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:
|
|
537
|
+
method: "GET",
|
|
419
538
|
headers: {
|
|
420
|
-
|
|
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(
|
|
426
|
-
const reset = response.headers.get(
|
|
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(
|
|
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,
|
|
586
|
+
const decision = handleApprovalReply(mapping.approvalRef, msg.content, "discord");
|
|
468
587
|
if (decision !== null) {
|
|
469
588
|
// Confirmation reaction (non-critical)
|
|
470
|
-
const reaction = decision ===
|
|
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:
|
|
474
|
-
headers: {
|
|
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,
|
|
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:
|
|
506
|
-
headers: {
|
|
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
|
|
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:
|
|
641
|
+
method: "POST",
|
|
521
642
|
headers: {
|
|
522
|
-
|
|
523
|
-
|
|
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
|
|
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:
|
|
687
|
+
hostname: "api.telegram.org",
|
|
565
688
|
path,
|
|
566
|
-
method:
|
|
689
|
+
method: "GET",
|
|
567
690
|
family: 4, // Force IPv4
|
|
568
691
|
timeout: 10000,
|
|
569
692
|
}, (res) => {
|
|
570
693
|
const chunks = [];
|
|
571
|
-
res.on(
|
|
572
|
-
res.on(
|
|
694
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
695
|
+
res.on("end", () => {
|
|
573
696
|
try {
|
|
574
|
-
const body = JSON.parse(Buffer.concat(chunks).toString(
|
|
575
|
-
if (res.statusCode &&
|
|
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(
|
|
588
|
-
req.on(
|
|
712
|
+
req.on("error", reject);
|
|
713
|
+
req.on("timeout", () => {
|
|
589
714
|
req.destroy();
|
|
590
|
-
reject(new Error(
|
|
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(
|
|
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 ||
|
|
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:
|
|
762
|
+
hostname: "api.telegram.org",
|
|
638
763
|
path: `/bot${config.telegramBotToken}/sendMessage`,
|
|
639
|
-
method:
|
|
764
|
+
method: "POST",
|
|
640
765
|
family: 4,
|
|
641
766
|
headers: {
|
|
642
|
-
|
|
643
|
-
|
|
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(
|
|
651
|
-
confirmReq.on(
|
|
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,
|
|
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:
|
|
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:
|
|
823
|
+
hostname: "api.telegram.org",
|
|
699
824
|
path: `/bot${config.telegramBotToken}/sendMessage`,
|
|
700
|
-
method:
|
|
825
|
+
method: "POST",
|
|
701
826
|
family: 4,
|
|
702
827
|
headers: {
|
|
703
|
-
|
|
704
|
-
|
|
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(
|
|
712
|
-
replyReq.on(
|
|
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(
|
|
869
|
+
log("Reply listener daemon starting poll loop");
|
|
745
870
|
const config = await buildDaemonConfig();
|
|
746
871
|
if (!config) {
|
|
747
|
-
log(
|
|
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 ===
|
|
768
|
-
log(
|
|
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(
|
|
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 ||
|
|
782
|
-
|
|
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(
|
|
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,
|
|
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(
|
|
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,
|
|
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(
|
|
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(
|
|
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(
|
|
868
|
-
process.on(
|
|
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(
|
|
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(
|
|
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(
|
|
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:
|
|
1054
|
+
message: "Reply listener daemon is already running",
|
|
929
1055
|
state: state ?? undefined,
|
|
930
1056
|
};
|
|
931
1057
|
}
|
|
932
|
-
// Check for tmux
|
|
933
|
-
|
|
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:
|
|
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:
|
|
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)
|
|
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 ||
|
|
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
|
-
})
|
|
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:
|
|
1129
|
+
message: "Failed to start daemon process",
|
|
996
1130
|
};
|
|
997
1131
|
}
|
|
998
1132
|
catch (error) {
|
|
999
1133
|
return {
|
|
1000
1134
|
success: false,
|
|
1001
|
-
message:
|
|
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:
|
|
1144
|
+
return { success: true, message: "Reply listener daemon is not running" };
|
|
1011
1145
|
if (!isProcessAlive(record.pid)) {
|
|
1012
1146
|
removePidFile();
|
|
1013
|
-
return {
|
|
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 {
|
|
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 ===
|
|
1027
|
-
return {
|
|
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 {
|
|
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 !==
|
|
1182
|
+
if (liveness !== "live") {
|
|
1036
1183
|
return {
|
|
1037
|
-
success: liveness ===
|
|
1038
|
-
message: liveness ===
|
|
1039
|
-
?
|
|
1040
|
-
:
|
|
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 !==
|
|
1049
|
-
return {
|
|
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 {
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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:
|
|
1311
|
+
validation: { valid: false, reason: "Failed to extract message text" },
|
|
1158
1312
|
};
|
|
1159
1313
|
}
|
|
1160
1314
|
if (!text) {
|
|
1161
|
-
log(
|
|
1315
|
+
log("REJECTED Slack message: empty message text");
|
|
1162
1316
|
return {
|
|
1163
1317
|
injected: false,
|
|
1164
|
-
validation: { valid: false, reason:
|
|
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,
|
|
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
|
|
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
|