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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, it, expect, vi, afterEach } from
|
|
2
|
-
import { readFileSync } from
|
|
3
|
-
import { join } from
|
|
4
|
-
import { sanitizeName, sessionName, shouldAttemptAdaptiveRetry, getDefaultShell, buildWorkerStartCommand, paneLooksReady, paneHasActiveTask, paneHasTrustPrompt, verifyTeamTargetOwnership, TeamSessionCreationError, normalizeDetachedSessionTarget, buildDetachedTmuxServerKeepaliveArgs, buildPrivateTmuxSocketPath, captureTmuxServerIdentity, observeTmuxServerIdentity, runTmuxServerIdentityGuard, } from
|
|
5
|
-
import { isValidTmuxServerIdentity } from
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from "vitest";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { sanitizeName, sessionName, shouldAttemptAdaptiveRetry, getDefaultShell, buildWorkerStartCommand, paneLooksReady, paneHasActiveTask, paneHasTrustPrompt, verifyTeamTargetOwnership, TeamSessionCreationError, normalizeDetachedSessionTarget, buildDetachedTmuxServerKeepaliveArgs, buildPrivateTmuxSocketPath, captureTmuxServerIdentity, observeTmuxServerIdentity, runTmuxServerIdentityGuard, } from "../tmux-session.js";
|
|
5
|
+
import { isValidTmuxServerIdentity, } from "../types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Native Windows is win32 *without* the MSYS markers a Git Bash launch exports.
|
|
8
8
|
* Stubbing only process.platform leaves the launching shell's MSYSTEM in place,
|
|
@@ -10,238 +10,309 @@ import { isValidTmuxServerIdentity } from '../types.js';
|
|
|
10
10
|
* and fail under Git Bash. Tests that mean MSYS set MSYSTEM themselves.
|
|
11
11
|
*/
|
|
12
12
|
function stubNativeWindows() {
|
|
13
|
-
vi.spyOn(process,
|
|
14
|
-
vi.stubEnv(
|
|
15
|
-
vi.stubEnv(
|
|
13
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("win32");
|
|
14
|
+
vi.stubEnv("MSYSTEM", "");
|
|
15
|
+
vi.stubEnv("MINGW_PREFIX", "");
|
|
16
16
|
}
|
|
17
17
|
afterEach(() => {
|
|
18
18
|
vi.unstubAllEnvs();
|
|
19
19
|
vi.restoreAllMocks();
|
|
20
20
|
});
|
|
21
|
-
const testProcessStartedAt = process.platform ===
|
|
22
|
-
?
|
|
23
|
-
: process.platform ===
|
|
24
|
-
?
|
|
25
|
-
: process.platform ===
|
|
26
|
-
?
|
|
27
|
-
:
|
|
28
|
-
describe(
|
|
29
|
-
it(
|
|
30
|
-
expect(sanitizeName(
|
|
31
|
-
});
|
|
32
|
-
it(
|
|
33
|
-
expect(sanitizeName(
|
|
34
|
-
});
|
|
35
|
-
it(
|
|
36
|
-
expect(sanitizeName(
|
|
37
|
-
});
|
|
38
|
-
it(
|
|
39
|
-
const long =
|
|
21
|
+
const testProcessStartedAt = process.platform === "linux"
|
|
22
|
+
? "linux:test-boot:1"
|
|
23
|
+
: process.platform === "darwin"
|
|
24
|
+
? "darwin:1:1"
|
|
25
|
+
: process.platform === "win32"
|
|
26
|
+
? "win32:1"
|
|
27
|
+
: "unsupported:identity";
|
|
28
|
+
describe("sanitizeName", () => {
|
|
29
|
+
it("passes alphanumeric names", () => {
|
|
30
|
+
expect(sanitizeName("worker1")).toBe("worker1");
|
|
31
|
+
});
|
|
32
|
+
it("removes invalid characters", () => {
|
|
33
|
+
expect(sanitizeName("worker@1!")).toBe("worker1");
|
|
34
|
+
});
|
|
35
|
+
it("allows hyphens", () => {
|
|
36
|
+
expect(sanitizeName("my-worker")).toBe("my-worker");
|
|
37
|
+
});
|
|
38
|
+
it("truncates to 50 chars", () => {
|
|
39
|
+
const long = "a".repeat(100);
|
|
40
40
|
expect(sanitizeName(long).length).toBe(50);
|
|
41
41
|
});
|
|
42
|
-
it(
|
|
43
|
-
expect(() => sanitizeName(
|
|
42
|
+
it("throws for all-invalid names", () => {
|
|
43
|
+
expect(() => sanitizeName("!!!@@@")).toThrow("no valid characters");
|
|
44
44
|
});
|
|
45
|
-
it(
|
|
46
|
-
expect(() => sanitizeName(
|
|
45
|
+
it("rejects 1-char result after sanitization", () => {
|
|
46
|
+
expect(() => sanitizeName("a")).toThrow("too short");
|
|
47
47
|
});
|
|
48
|
-
it(
|
|
49
|
-
expect(sanitizeName(
|
|
48
|
+
it("accepts 2-char result after sanitization", () => {
|
|
49
|
+
expect(sanitizeName("ab")).toBe("ab");
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
|
-
describe(
|
|
53
|
-
it(
|
|
54
|
-
expect(sessionName(
|
|
52
|
+
describe("sessionName", () => {
|
|
53
|
+
it("builds correct session name", () => {
|
|
54
|
+
expect(sessionName("myteam", "codex1")).toBe("omc-team-myteam-codex1");
|
|
55
55
|
});
|
|
56
|
-
it(
|
|
57
|
-
expect(sessionName(
|
|
56
|
+
it("sanitizes both parts", () => {
|
|
57
|
+
expect(sessionName("my team!", "work@er")).toBe("omc-team-myteam-worker");
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
-
describe(
|
|
61
|
-
it(
|
|
60
|
+
describe("detached session target normalization", () => {
|
|
61
|
+
it("normalizes numeric window indices from new-session responses", () => {
|
|
62
62
|
// Base-index 0: new-session creates window 0
|
|
63
|
-
expect(normalizeDetachedSessionTarget(
|
|
63
|
+
expect(normalizeDetachedSessionTarget("worker-detached-session:0")).toBe("worker-detached-session");
|
|
64
64
|
// Base-index 1: new-session creates window 1
|
|
65
|
-
expect(normalizeDetachedSessionTarget(
|
|
65
|
+
expect(normalizeDetachedSessionTarget("worker-detached-session:1")).toBe("worker-detached-session");
|
|
66
66
|
// Base-index with custom offset: new-session might create window 5
|
|
67
|
-
expect(normalizeDetachedSessionTarget(
|
|
67
|
+
expect(normalizeDetachedSessionTarget("worker-detached-session:5")).toBe("worker-detached-session");
|
|
68
68
|
// Non-numeric suffixes are rejected
|
|
69
|
-
expect(normalizeDetachedSessionTarget(
|
|
69
|
+
expect(normalizeDetachedSessionTarget("worker-detached-session:workers")).toBeNull();
|
|
70
70
|
// Session name alone is accepted
|
|
71
|
-
expect(normalizeDetachedSessionTarget(
|
|
71
|
+
expect(normalizeDetachedSessionTarget("worker-detached-session")).toBe("worker-detached-session");
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
|
-
describe(
|
|
75
|
-
it(
|
|
76
|
-
const error = new TeamSessionCreationError(
|
|
77
|
-
sessionName:
|
|
78
|
-
leaderPaneId:
|
|
74
|
+
describe("tmux creation allocation evidence", () => {
|
|
75
|
+
it("retains typed evidence when creation cleanup is unknown", () => {
|
|
76
|
+
const error = new TeamSessionCreationError("tmux_creation_cleanup_unverified", {
|
|
77
|
+
sessionName: "team:0",
|
|
78
|
+
leaderPaneId: "%1",
|
|
79
79
|
workerPaneIds: [],
|
|
80
|
-
sessionMode:
|
|
80
|
+
sessionMode: "split-pane",
|
|
81
81
|
tmuxServerIdentity: {
|
|
82
|
-
socket_path:
|
|
82
|
+
socket_path: "/tmp/team.sock",
|
|
83
83
|
server_pid: 7,
|
|
84
84
|
process_started_at: testProcessStartedAt,
|
|
85
85
|
},
|
|
86
86
|
}, {
|
|
87
|
-
provider:
|
|
88
|
-
operation:
|
|
89
|
-
rawOutput:
|
|
90
|
-
stderr:
|
|
87
|
+
provider: "tmux",
|
|
88
|
+
operation: "split-window",
|
|
89
|
+
rawOutput: "unexpected output",
|
|
90
|
+
stderr: "",
|
|
91
91
|
});
|
|
92
|
-
expect(error.cleanupStatus).toBe(
|
|
93
|
-
expect(error.creationEvidence?.rawOutput).toBe(
|
|
92
|
+
expect(error.cleanupStatus).toBe("unknown");
|
|
93
|
+
expect(error.creationEvidence?.rawOutput).toBe("unexpected output");
|
|
94
94
|
expect(error.partialSession.workerPaneIds).toEqual([]);
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
|
-
describe(
|
|
98
|
-
const processStartedAt = process.platform ===
|
|
99
|
-
?
|
|
100
|
-
: process.platform ===
|
|
101
|
-
?
|
|
102
|
-
: process.platform ===
|
|
103
|
-
?
|
|
104
|
-
:
|
|
97
|
+
describe("verifyTeamTargetOwnership tmux target kinds", () => {
|
|
98
|
+
const processStartedAt = process.platform === "linux"
|
|
99
|
+
? "linux:test-boot:1"
|
|
100
|
+
: process.platform === "darwin"
|
|
101
|
+
? "darwin:1:1"
|
|
102
|
+
: process.platform === "win32"
|
|
103
|
+
? "win32:1"
|
|
104
|
+
: "unsupported:identity";
|
|
105
105
|
const serverIdentity = {
|
|
106
|
-
socket_path:
|
|
106
|
+
socket_path: "/tmp/omc-tmux-membership.sock",
|
|
107
107
|
server_pid: 42,
|
|
108
108
|
process_started_at: processStartedAt,
|
|
109
109
|
};
|
|
110
110
|
const dependenciesFor = (tmuxExec) => ({
|
|
111
111
|
tmuxExec,
|
|
112
|
-
cmuxExec: vi.fn(async () => ({ stdout:
|
|
112
|
+
cmuxExec: vi.fn(async () => ({ stdout: "", stderr: "" })),
|
|
113
113
|
serverIdentityDependencies: {
|
|
114
|
-
tmuxQuery: vi.fn(async () => ({ stdout:
|
|
114
|
+
tmuxQuery: vi.fn(async () => ({ stdout: "42\n", stderr: "" })),
|
|
115
115
|
processIdentity: () => processStartedAt,
|
|
116
|
-
processObservation: () =>
|
|
116
|
+
processObservation: () => "matching",
|
|
117
117
|
},
|
|
118
118
|
});
|
|
119
119
|
const target = (providerTarget) => ({
|
|
120
|
-
provider:
|
|
120
|
+
provider: "tmux",
|
|
121
121
|
providerTarget,
|
|
122
|
-
recipient:
|
|
123
|
-
recipientRole:
|
|
124
|
-
paneId:
|
|
122
|
+
recipient: "worker-1",
|
|
123
|
+
recipientRole: "worker",
|
|
124
|
+
paneId: "%9",
|
|
125
125
|
workerIndex: 1,
|
|
126
126
|
tmuxServerIdentity: serverIdentity,
|
|
127
127
|
});
|
|
128
|
-
it(
|
|
129
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
130
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
131
|
-
kind:
|
|
132
|
-
provider:
|
|
133
|
-
providerTarget:
|
|
134
|
-
paneId:
|
|
128
|
+
it("uses an exact session selector for bare named-session membership", async () => {
|
|
129
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
130
|
+
await expect(verifyTeamTargetOwnership(target("dispatch-session"), dependenciesFor(tmuxExec))).resolves.toEqual({
|
|
131
|
+
kind: "owned",
|
|
132
|
+
provider: "tmux",
|
|
133
|
+
providerTarget: "dispatch-session",
|
|
134
|
+
paneId: "%9",
|
|
135
135
|
tmuxServerIdentity: serverIdentity,
|
|
136
136
|
});
|
|
137
137
|
expect(tmuxExec).toHaveBeenCalledWith([
|
|
138
|
-
|
|
138
|
+
"-S",
|
|
139
|
+
serverIdentity.socket_path,
|
|
140
|
+
"list-panes",
|
|
141
|
+
"-s",
|
|
142
|
+
"-t",
|
|
143
|
+
"=dispatch-session:",
|
|
144
|
+
"-F",
|
|
145
|
+
"#{pane_id}",
|
|
139
146
|
]);
|
|
140
147
|
});
|
|
141
|
-
it(
|
|
142
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
143
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
144
|
-
|
|
148
|
+
it("keeps an explicit session:window target exact without session scope", async () => {
|
|
149
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
150
|
+
await expect(verifyTeamTargetOwnership(target("dispatch-session:0"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
|
|
151
|
+
kind: "owned",
|
|
152
|
+
paneId: "%9",
|
|
153
|
+
tmuxServerIdentity: serverIdentity,
|
|
154
|
+
});
|
|
145
155
|
expect(tmuxExec).toHaveBeenCalledWith([
|
|
146
|
-
|
|
156
|
+
"-S",
|
|
157
|
+
serverIdentity.socket_path,
|
|
158
|
+
"list-panes",
|
|
159
|
+
"-t",
|
|
160
|
+
"=dispatch-session:0",
|
|
161
|
+
"-F",
|
|
162
|
+
"#{pane_id}",
|
|
147
163
|
]);
|
|
148
164
|
});
|
|
149
|
-
it(
|
|
150
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
151
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
152
|
-
|
|
165
|
+
it("adds exact matching to named windows to prevent prefix collisions", async () => {
|
|
166
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
167
|
+
await expect(verifyTeamTargetOwnership(target("dispatch-session:worker"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
|
|
168
|
+
kind: "owned",
|
|
169
|
+
paneId: "%9",
|
|
170
|
+
tmuxServerIdentity: serverIdentity,
|
|
171
|
+
});
|
|
153
172
|
expect(tmuxExec).toHaveBeenCalledWith([
|
|
154
|
-
|
|
173
|
+
"-S",
|
|
174
|
+
serverIdentity.socket_path,
|
|
175
|
+
"list-panes",
|
|
176
|
+
"-t",
|
|
177
|
+
"=dispatch-session:=worker",
|
|
178
|
+
"-F",
|
|
179
|
+
"#{pane_id}",
|
|
155
180
|
]);
|
|
156
181
|
});
|
|
157
|
-
it(
|
|
158
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
182
|
+
it("passes supported native session/window IDs without name prefixes", async () => {
|
|
183
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
159
184
|
const dependencies = dependenciesFor(tmuxExec);
|
|
160
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
161
|
-
|
|
185
|
+
await expect(verifyTeamTargetOwnership(target("$7"), dependencies)).resolves.toMatchObject({
|
|
186
|
+
kind: "owned",
|
|
187
|
+
paneId: "%9",
|
|
188
|
+
tmuxServerIdentity: serverIdentity,
|
|
189
|
+
});
|
|
162
190
|
expect(tmuxExec).toHaveBeenLastCalledWith([
|
|
163
|
-
|
|
191
|
+
"-S",
|
|
192
|
+
serverIdentity.socket_path,
|
|
193
|
+
"list-panes",
|
|
194
|
+
"-s",
|
|
195
|
+
"-t",
|
|
196
|
+
"$7",
|
|
197
|
+
"-F",
|
|
198
|
+
"#{pane_id}",
|
|
164
199
|
]);
|
|
165
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
166
|
-
|
|
200
|
+
await expect(verifyTeamTargetOwnership(target("@13"), dependencies)).resolves.toMatchObject({
|
|
201
|
+
kind: "owned",
|
|
202
|
+
paneId: "%9",
|
|
203
|
+
tmuxServerIdentity: serverIdentity,
|
|
204
|
+
});
|
|
167
205
|
expect(tmuxExec).toHaveBeenLastCalledWith([
|
|
168
|
-
|
|
206
|
+
"-S",
|
|
207
|
+
serverIdentity.socket_path,
|
|
208
|
+
"list-panes",
|
|
209
|
+
"-t",
|
|
210
|
+
"@13",
|
|
211
|
+
"-F",
|
|
212
|
+
"#{pane_id}",
|
|
169
213
|
]);
|
|
170
214
|
});
|
|
171
|
-
it(
|
|
172
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
173
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
174
|
-
.resolves.toEqual({ kind: 'unavailable' });
|
|
215
|
+
it("fails closed for malformed native-looking target IDs", async () => {
|
|
216
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
217
|
+
await expect(verifyTeamTargetOwnership(target("$session"), dependenciesFor(tmuxExec))).resolves.toEqual({ kind: "unavailable" });
|
|
175
218
|
expect(tmuxExec).not.toHaveBeenCalled();
|
|
176
219
|
});
|
|
177
|
-
it(
|
|
178
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
179
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
180
|
-
|
|
220
|
+
it("handles base-index 0: numeric windows with index 0", async () => {
|
|
221
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
222
|
+
await expect(verifyTeamTargetOwnership(target("dispatch-session:0"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
|
|
223
|
+
kind: "owned",
|
|
224
|
+
paneId: "%9",
|
|
225
|
+
tmuxServerIdentity: serverIdentity,
|
|
226
|
+
});
|
|
181
227
|
expect(tmuxExec).toHaveBeenCalledWith([
|
|
182
|
-
|
|
228
|
+
"-S",
|
|
229
|
+
serverIdentity.socket_path,
|
|
230
|
+
"list-panes",
|
|
231
|
+
"-t",
|
|
232
|
+
"=dispatch-session:0",
|
|
233
|
+
"-F",
|
|
234
|
+
"#{pane_id}",
|
|
183
235
|
]);
|
|
184
236
|
});
|
|
185
|
-
it(
|
|
186
|
-
const tmuxExec = vi.fn(async () => ({ stdout:
|
|
187
|
-
await expect(verifyTeamTargetOwnership(target(
|
|
188
|
-
|
|
237
|
+
it("handles base-index 1: numeric windows with index 1", async () => {
|
|
238
|
+
const tmuxExec = vi.fn(async () => ({ stdout: "%9\n", stderr: "" }));
|
|
239
|
+
await expect(verifyTeamTargetOwnership(target("dispatch-session:1"), dependenciesFor(tmuxExec))).resolves.toMatchObject({
|
|
240
|
+
kind: "owned",
|
|
241
|
+
paneId: "%9",
|
|
242
|
+
tmuxServerIdentity: serverIdentity,
|
|
243
|
+
});
|
|
189
244
|
expect(tmuxExec).toHaveBeenCalledWith([
|
|
190
|
-
|
|
245
|
+
"-S",
|
|
246
|
+
serverIdentity.socket_path,
|
|
247
|
+
"list-panes",
|
|
248
|
+
"-t",
|
|
249
|
+
"=dispatch-session:1",
|
|
250
|
+
"-F",
|
|
251
|
+
"#{pane_id}",
|
|
191
252
|
]);
|
|
192
253
|
});
|
|
193
254
|
});
|
|
194
|
-
describe(
|
|
195
|
-
const startIdentity = process.platform ===
|
|
196
|
-
?
|
|
197
|
-
: process.platform ===
|
|
198
|
-
?
|
|
199
|
-
: process.platform ===
|
|
200
|
-
?
|
|
255
|
+
describe("tmux server incarnation identity", () => {
|
|
256
|
+
const startIdentity = process.platform === "linux"
|
|
257
|
+
? "linux:test-boot:1"
|
|
258
|
+
: process.platform === "darwin"
|
|
259
|
+
? "darwin:1:1"
|
|
260
|
+
: process.platform === "win32"
|
|
261
|
+
? "win32:1"
|
|
201
262
|
: `${process.platform}:native`;
|
|
202
263
|
const identity = {
|
|
203
|
-
socket_path:
|
|
264
|
+
socket_path: "/tmp/omc-tmux-test.sock",
|
|
204
265
|
server_pid: 42,
|
|
205
266
|
process_started_at: startIdentity,
|
|
206
267
|
};
|
|
207
|
-
it(
|
|
208
|
-
const tmuxQuery = vi.fn(async () => ({
|
|
209
|
-
|
|
268
|
+
it("captures socket and PID from tmux output, then binds strict process identity", async () => {
|
|
269
|
+
const tmuxQuery = vi.fn(async () => ({
|
|
270
|
+
stdout: `${identity.socket_path}\t${identity.server_pid}\n`,
|
|
271
|
+
stderr: "",
|
|
272
|
+
}));
|
|
273
|
+
const kill = vi.spyOn(process, "kill").mockReturnValue(true);
|
|
210
274
|
try {
|
|
211
275
|
await expect(captureTmuxServerIdentity(undefined, {
|
|
212
276
|
tmuxQuery,
|
|
213
277
|
processIdentity: () => identity.process_started_at,
|
|
214
278
|
})).resolves.toEqual(identity);
|
|
215
|
-
expect(tmuxQuery).toHaveBeenCalledWith([
|
|
279
|
+
expect(tmuxQuery).toHaveBeenCalledWith(["display-message", "-p", "#{socket_path}\t#{pid}"], undefined);
|
|
216
280
|
}
|
|
217
281
|
finally {
|
|
218
282
|
kill.mockRestore();
|
|
219
283
|
}
|
|
220
284
|
});
|
|
221
285
|
it.each([
|
|
222
|
-
[
|
|
223
|
-
[
|
|
224
|
-
[
|
|
225
|
-
])(
|
|
286
|
+
["matching", "matching", "matching"],
|
|
287
|
+
["dead", "dead", "dead"],
|
|
288
|
+
["unknown", "unknown", "unknown"],
|
|
289
|
+
])("keeps process identity observation distinct for %s", async (_label, processState, expected) => {
|
|
226
290
|
const actual = await observeTmuxServerIdentity(identity, {
|
|
227
|
-
tmuxQuery: vi.fn(async () => ({ stdout:
|
|
291
|
+
tmuxQuery: vi.fn(async () => ({ stdout: "42\n", stderr: "" })),
|
|
228
292
|
processIdentity: () => identity.process_started_at,
|
|
229
293
|
processObservation: () => processState,
|
|
230
294
|
});
|
|
231
295
|
expect(actual).toBe(expected);
|
|
232
296
|
});
|
|
233
|
-
it(
|
|
234
|
-
const platform = vi
|
|
235
|
-
|
|
297
|
+
it("checks the Windows server incarnation once after confirming its PID", async () => {
|
|
298
|
+
const platform = vi
|
|
299
|
+
.spyOn(process, "platform", "get")
|
|
300
|
+
.mockReturnValue("win32");
|
|
301
|
+
const kill = vi.spyOn(process, "kill").mockReturnValue(true);
|
|
236
302
|
const windowsIdentity = {
|
|
237
303
|
...identity,
|
|
238
|
-
process_started_at:
|
|
304
|
+
process_started_at: "win32:638878752000000000",
|
|
239
305
|
};
|
|
240
306
|
const processIdentity = vi.fn(() => windowsIdentity.process_started_at);
|
|
241
|
-
const tmuxQuery = vi.fn(async () => ({
|
|
307
|
+
const tmuxQuery = vi.fn(async () => ({
|
|
308
|
+
stdout: `${windowsIdentity.server_pid}\n`,
|
|
309
|
+
stderr: "",
|
|
310
|
+
}));
|
|
242
311
|
try {
|
|
243
|
-
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
244
|
-
|
|
312
|
+
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
313
|
+
tmuxQuery,
|
|
314
|
+
processIdentity,
|
|
315
|
+
})).resolves.toBe("matching");
|
|
245
316
|
expect(kill).toHaveBeenNthCalledWith(1, windowsIdentity.server_pid, 0);
|
|
246
317
|
expect(kill).toHaveBeenNthCalledWith(2, windowsIdentity.server_pid, 0);
|
|
247
318
|
expect(kill).toHaveBeenCalledTimes(2);
|
|
@@ -252,27 +323,35 @@ describe('tmux server incarnation identity', () => {
|
|
|
252
323
|
platform.mockRestore();
|
|
253
324
|
}
|
|
254
325
|
});
|
|
255
|
-
it(
|
|
256
|
-
const platform = vi
|
|
257
|
-
|
|
326
|
+
it("fails closed when a Windows PID has been reused or its identity probe is invalid", async () => {
|
|
327
|
+
const platform = vi
|
|
328
|
+
.spyOn(process, "platform", "get")
|
|
329
|
+
.mockReturnValue("win32");
|
|
330
|
+
const kill = vi.spyOn(process, "kill").mockReturnValue(true);
|
|
258
331
|
const windowsIdentity = {
|
|
259
332
|
...identity,
|
|
260
|
-
process_started_at:
|
|
333
|
+
process_started_at: "win32:638878752000000000",
|
|
261
334
|
};
|
|
262
|
-
const tmuxQuery = vi.fn(async () => ({
|
|
263
|
-
|
|
335
|
+
const tmuxQuery = vi.fn(async () => ({
|
|
336
|
+
stdout: `${windowsIdentity.server_pid}\n`,
|
|
337
|
+
stderr: "",
|
|
338
|
+
}));
|
|
339
|
+
const differentIncarnation = vi.fn(() => "win32:638878752000000001");
|
|
264
340
|
const emptyProbe = vi.fn(() => null);
|
|
265
|
-
const malformedProbe = vi.fn(() =>
|
|
341
|
+
const malformedProbe = vi.fn(() => "garbage");
|
|
266
342
|
try {
|
|
267
343
|
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
268
|
-
tmuxQuery,
|
|
269
|
-
|
|
344
|
+
tmuxQuery,
|
|
345
|
+
processIdentity: differentIncarnation,
|
|
346
|
+
})).resolves.toBe("dead");
|
|
270
347
|
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
271
|
-
tmuxQuery,
|
|
272
|
-
|
|
348
|
+
tmuxQuery,
|
|
349
|
+
processIdentity: emptyProbe,
|
|
350
|
+
})).resolves.toBe("unknown");
|
|
273
351
|
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
274
|
-
tmuxQuery,
|
|
275
|
-
|
|
352
|
+
tmuxQuery,
|
|
353
|
+
processIdentity: malformedProbe,
|
|
354
|
+
})).resolves.toBe("unknown");
|
|
276
355
|
expect(differentIncarnation).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
|
|
277
356
|
expect(emptyProbe).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
|
|
278
357
|
expect(malformedProbe).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
|
|
@@ -282,21 +361,29 @@ describe('tmux server incarnation identity', () => {
|
|
|
282
361
|
platform.mockRestore();
|
|
283
362
|
}
|
|
284
363
|
});
|
|
285
|
-
it(
|
|
286
|
-
const platform = vi
|
|
287
|
-
|
|
364
|
+
it("does not match a Windows process when the post-probe liveness check fails", async () => {
|
|
365
|
+
const platform = vi
|
|
366
|
+
.spyOn(process, "platform", "get")
|
|
367
|
+
.mockReturnValue("win32");
|
|
368
|
+
const kill = vi
|
|
369
|
+
.spyOn(process, "kill")
|
|
288
370
|
.mockReturnValueOnce(true)
|
|
289
|
-
.mockImplementationOnce(() => {
|
|
371
|
+
.mockImplementationOnce(() => {
|
|
372
|
+
throw Object.assign(new Error("denied"), { code: "EPERM" });
|
|
373
|
+
});
|
|
290
374
|
const windowsIdentity = {
|
|
291
375
|
...identity,
|
|
292
|
-
process_started_at:
|
|
376
|
+
process_started_at: "win32:638878752000000000",
|
|
293
377
|
};
|
|
294
378
|
const processIdentity = vi.fn(() => windowsIdentity.process_started_at);
|
|
295
379
|
try {
|
|
296
380
|
await expect(observeTmuxServerIdentity(windowsIdentity, {
|
|
297
|
-
tmuxQuery: vi.fn(async () => ({
|
|
381
|
+
tmuxQuery: vi.fn(async () => ({
|
|
382
|
+
stdout: `${windowsIdentity.server_pid}\n`,
|
|
383
|
+
stderr: "",
|
|
384
|
+
})),
|
|
298
385
|
processIdentity,
|
|
299
|
-
})).resolves.toBe(
|
|
386
|
+
})).resolves.toBe("unknown");
|
|
300
387
|
expect(processIdentity).toHaveBeenCalledExactlyOnceWith(windowsIdentity.server_pid);
|
|
301
388
|
expect(kill).toHaveBeenCalledTimes(2);
|
|
302
389
|
}
|
|
@@ -305,16 +392,18 @@ describe('tmux server incarnation identity', () => {
|
|
|
305
392
|
platform.mockRestore();
|
|
306
393
|
}
|
|
307
394
|
});
|
|
308
|
-
it(
|
|
309
|
-
const platform = vi
|
|
395
|
+
it("probes a Windows server only after reading its PID and checks liveness afterward", async () => {
|
|
396
|
+
const platform = vi
|
|
397
|
+
.spyOn(process, "platform", "get")
|
|
398
|
+
.mockReturnValue("win32");
|
|
310
399
|
const calls = [];
|
|
311
|
-
const kill = vi.spyOn(process,
|
|
312
|
-
calls.push(
|
|
400
|
+
const kill = vi.spyOn(process, "kill").mockImplementation(() => {
|
|
401
|
+
calls.push("alive");
|
|
313
402
|
return true;
|
|
314
403
|
});
|
|
315
404
|
const windowsIdentity = {
|
|
316
405
|
...identity,
|
|
317
|
-
process_started_at:
|
|
406
|
+
process_started_at: "win32:638878752000000000",
|
|
318
407
|
};
|
|
319
408
|
const processIdentity = vi.fn((pid) => {
|
|
320
409
|
calls.push(`probe:${pid}`);
|
|
@@ -324,24 +413,28 @@ describe('tmux server incarnation identity', () => {
|
|
|
324
413
|
await expect(captureTmuxServerIdentity(undefined, {
|
|
325
414
|
tmuxQuery: vi.fn(async () => ({
|
|
326
415
|
stdout: `${windowsIdentity.socket_path}\t${windowsIdentity.server_pid}\n`,
|
|
327
|
-
stderr:
|
|
416
|
+
stderr: "",
|
|
328
417
|
})),
|
|
329
418
|
processIdentity,
|
|
330
419
|
})).resolves.toEqual(windowsIdentity);
|
|
331
|
-
expect(calls).toEqual([`probe:${windowsIdentity.server_pid}`,
|
|
420
|
+
expect(calls).toEqual([`probe:${windowsIdentity.server_pid}`, "alive"]);
|
|
332
421
|
}
|
|
333
422
|
finally {
|
|
334
423
|
kill.mockRestore();
|
|
335
424
|
platform.mockRestore();
|
|
336
425
|
}
|
|
337
426
|
});
|
|
338
|
-
it(
|
|
339
|
-
expect(isValidTmuxServerIdentity({
|
|
340
|
-
|
|
427
|
+
it("rejects malformed identity before querying and rejects a mismatched server response", async () => {
|
|
428
|
+
expect(isValidTmuxServerIdentity({
|
|
429
|
+
socket_path: "relative",
|
|
430
|
+
server_pid: 42,
|
|
431
|
+
process_started_at: startIdentity,
|
|
432
|
+
})).toBe(false);
|
|
433
|
+
const tmuxQuery = vi.fn(async () => ({ stdout: "42\n", stderr: "" }));
|
|
341
434
|
await expect(observeTmuxServerIdentity({
|
|
342
435
|
...identity,
|
|
343
|
-
socket_path:
|
|
344
|
-
}, { tmuxQuery })).resolves.toBe(
|
|
436
|
+
socket_path: "relative",
|
|
437
|
+
}, { tmuxQuery })).resolves.toBe("unknown");
|
|
345
438
|
expect(tmuxQuery).not.toHaveBeenCalled();
|
|
346
439
|
await expect(observeTmuxServerIdentity({
|
|
347
440
|
...identity,
|
|
@@ -349,102 +442,111 @@ describe('tmux server incarnation identity', () => {
|
|
|
349
442
|
}, {
|
|
350
443
|
tmuxQuery,
|
|
351
444
|
processIdentity: () => identity.process_started_at,
|
|
352
|
-
processObservation: () =>
|
|
353
|
-
})).resolves.toBe(
|
|
354
|
-
expect(tmuxQuery).toHaveBeenCalledExactlyOnceWith([
|
|
445
|
+
processObservation: () => "matching",
|
|
446
|
+
})).resolves.toBe("unknown");
|
|
447
|
+
expect(tmuxQuery).toHaveBeenCalledExactlyOnceWith(["-S", identity.socket_path, "display-message", "-p", "#{pid}"], { timeout: 2_000, stripTmux: true });
|
|
355
448
|
});
|
|
356
|
-
it(
|
|
357
|
-
expect(runTmuxServerIdentityGuard(identity,
|
|
449
|
+
it("returns guard success only for exact PID/socket and strict process identity", () => {
|
|
450
|
+
expect(runTmuxServerIdentityGuard(identity, "42", identity.socket_path, {
|
|
358
451
|
processIdentity: () => identity.process_started_at,
|
|
359
452
|
})).toBe(0);
|
|
360
|
-
expect(runTmuxServerIdentityGuard(identity,
|
|
453
|
+
expect(runTmuxServerIdentityGuard(identity, "43", identity.socket_path, {
|
|
361
454
|
processIdentity: () => identity.process_started_at,
|
|
362
455
|
})).toBe(1);
|
|
363
|
-
expect(runTmuxServerIdentityGuard(identity,
|
|
456
|
+
expect(runTmuxServerIdentityGuard(identity, "42", "/tmp/other.sock", {
|
|
364
457
|
processIdentity: () => identity.process_started_at,
|
|
365
458
|
})).toBe(1);
|
|
366
459
|
});
|
|
367
460
|
});
|
|
368
|
-
describe(
|
|
369
|
-
it(
|
|
461
|
+
describe("detached tmux no-server startup handshake", () => {
|
|
462
|
+
it("starts the first session directly on a short private endpoint", () => {
|
|
370
463
|
const socketPath = buildPrivateTmuxSocketPath();
|
|
371
464
|
const keepalive = buildDetachedTmuxServerKeepaliveArgs(socketPath);
|
|
372
465
|
expect(keepalive).toEqual([
|
|
373
|
-
|
|
466
|
+
"-S",
|
|
467
|
+
socketPath,
|
|
468
|
+
"start-server",
|
|
469
|
+
";",
|
|
470
|
+
"set-option",
|
|
471
|
+
"-g",
|
|
472
|
+
"exit-empty",
|
|
473
|
+
"off",
|
|
374
474
|
]);
|
|
375
|
-
if (process.platform ===
|
|
376
|
-
expect(Buffer.byteLength(socketPath,
|
|
475
|
+
if (process.platform === "darwin" || process.platform === "linux") {
|
|
476
|
+
expect(Buffer.byteLength(socketPath, "utf8")).toBeLessThan(104);
|
|
377
477
|
}
|
|
378
478
|
});
|
|
379
479
|
});
|
|
380
|
-
describe(
|
|
480
|
+
describe("getWorkerLiveness tmux inventory fallback", () => {
|
|
381
481
|
async function loadLivenessWithTmuxOutputs(displayOutput, inventoryOutput) {
|
|
382
482
|
const calls = [];
|
|
383
483
|
const tmuxCmdAsync = vi.fn(async (args) => {
|
|
384
484
|
calls.push(args);
|
|
385
|
-
if (args[0] ===
|
|
386
|
-
return { stdout: displayOutput, stderr:
|
|
387
|
-
return { stdout: inventoryOutput, stderr:
|
|
485
|
+
if (args[0] === "display-message")
|
|
486
|
+
return { stdout: displayOutput, stderr: "" };
|
|
487
|
+
return { stdout: inventoryOutput, stderr: "" };
|
|
388
488
|
});
|
|
389
489
|
vi.resetModules();
|
|
390
|
-
vi.doMock(
|
|
490
|
+
vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
|
|
391
491
|
const actual = await importOriginal();
|
|
392
492
|
return { ...actual, tmuxCmdAsync };
|
|
393
493
|
});
|
|
394
494
|
try {
|
|
395
|
-
const { getWorkerLiveness } = await import(
|
|
396
|
-
return { liveness: await getWorkerLiveness(
|
|
495
|
+
const { getWorkerLiveness } = await import("../tmux-session.js");
|
|
496
|
+
return { liveness: await getWorkerLiveness("%1"), calls };
|
|
397
497
|
}
|
|
398
498
|
finally {
|
|
399
|
-
vi.doUnmock(
|
|
499
|
+
vi.doUnmock("../../cli/tmux-utils.js");
|
|
400
500
|
vi.resetModules();
|
|
401
501
|
}
|
|
402
502
|
}
|
|
403
|
-
it(
|
|
404
|
-
const result = await loadLivenessWithTmuxOutputs(
|
|
405
|
-
expect(result.liveness).toBe(
|
|
503
|
+
it("proves a removed pane dead from a valid non-empty native inventory", async () => {
|
|
504
|
+
const result = await loadLivenessWithTmuxOutputs("", "%0 0\n");
|
|
505
|
+
expect(result.liveness).toBe("dead");
|
|
406
506
|
expect(result.calls).toEqual([
|
|
407
|
-
[
|
|
408
|
-
[
|
|
507
|
+
["display-message", "-t", "%1", "-p", "#{pane_dead}"],
|
|
508
|
+
["list-panes", "-a", "-F", "#{pane_id} #{pane_dead}"],
|
|
409
509
|
]);
|
|
410
510
|
});
|
|
411
|
-
it.each([
|
|
412
|
-
const result = await loadLivenessWithTmuxOutputs(
|
|
413
|
-
expect(result.liveness).toBe(
|
|
511
|
+
it.each(["", "not-a-pane\n", "%0 malformed\n", "%0 0\nmalformed\n"])("preserves unknown when fallback inventory is empty or malformed: %j", async (inventoryOutput) => {
|
|
512
|
+
const result = await loadLivenessWithTmuxOutputs("", inventoryOutput);
|
|
513
|
+
expect(result.liveness).toBe("unknown");
|
|
414
514
|
});
|
|
415
|
-
it(
|
|
416
|
-
const result = await loadLivenessWithTmuxOutputs(
|
|
417
|
-
expect(result.liveness).toBe(
|
|
515
|
+
it("matches native pane IDs exactly instead of treating a prefix as present", async () => {
|
|
516
|
+
const result = await loadLivenessWithTmuxOutputs("", "%10 0\n");
|
|
517
|
+
expect(result.liveness).toBe("dead");
|
|
418
518
|
});
|
|
419
519
|
});
|
|
420
|
-
describe(
|
|
520
|
+
describe("applyMainVerticalLayout", () => {
|
|
421
521
|
const identity = {
|
|
422
|
-
socket_path:
|
|
522
|
+
socket_path: "/tmp/layout-test.sock",
|
|
423
523
|
server_pid: 42,
|
|
424
|
-
process_started_at: process.platform ===
|
|
425
|
-
?
|
|
426
|
-
: process.platform ===
|
|
524
|
+
process_started_at: process.platform === "linux"
|
|
525
|
+
? "linux:fixture:42"
|
|
526
|
+
: process.platform === "win32"
|
|
527
|
+
? "win32:42"
|
|
528
|
+
: "darwin:42:123456",
|
|
427
529
|
};
|
|
428
530
|
function guardedResult(args) {
|
|
429
|
-
expect(args.slice(0, 3)).toEqual([
|
|
430
|
-
expect(args[3]).toContain(
|
|
531
|
+
expect(args.slice(0, 3)).toEqual(["-S", identity.socket_path, "if-shell"]);
|
|
532
|
+
expect(args[3]).toContain("--tmux-server-identity-guard");
|
|
431
533
|
const marker = args[4]?.match(/OMC_TMUX_GUARD_OK_[A-Za-z0-9_]+/)?.[0];
|
|
432
534
|
expect(marker).toBeDefined();
|
|
433
|
-
return { stdout: `${marker}\n`, stderr:
|
|
535
|
+
return { stdout: `${marker}\n`, stderr: "" };
|
|
434
536
|
}
|
|
435
|
-
it(
|
|
537
|
+
it("sets the 80-column main width before its sole layout selection", async () => {
|
|
436
538
|
const calls = [];
|
|
437
539
|
let mainPaneWidth;
|
|
438
540
|
const selectedPaneWidths = [];
|
|
439
541
|
vi.resetModules();
|
|
440
|
-
vi.doMock(
|
|
542
|
+
vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
|
|
441
543
|
const actual = await importOriginal();
|
|
442
544
|
return {
|
|
443
545
|
...actual,
|
|
444
546
|
tmuxCmdAsync: vi.fn(async (args) => {
|
|
445
547
|
calls.push(args);
|
|
446
|
-
if (args[2] ===
|
|
447
|
-
const command = args[4] ??
|
|
548
|
+
if (args[2] === "if-shell") {
|
|
549
|
+
const command = args[4] ?? "";
|
|
448
550
|
const width = command.match(/'main-pane-width' '(\d+)'/)?.[1];
|
|
449
551
|
if (width)
|
|
450
552
|
mainPaneWidth = Number(width);
|
|
@@ -452,490 +554,555 @@ describe('applyMainVerticalLayout', () => {
|
|
|
452
554
|
selectedPaneWidths.push(mainPaneWidth);
|
|
453
555
|
return guardedResult(args);
|
|
454
556
|
}
|
|
455
|
-
return { stdout:
|
|
557
|
+
return { stdout: "80\n", stderr: "" };
|
|
456
558
|
}),
|
|
457
559
|
tmuxExecAsync: vi.fn(async (args) => {
|
|
458
|
-
throw new Error(`unguarded layout effect: ${args.join(
|
|
560
|
+
throw new Error(`unguarded layout effect: ${args.join(" ")}`);
|
|
459
561
|
}),
|
|
460
562
|
};
|
|
461
563
|
});
|
|
462
564
|
try {
|
|
463
565
|
// Stock tmux guard path, even on a win32 host with psmux installed.
|
|
464
|
-
(await import(
|
|
465
|
-
const { applyMainVerticalLayout } = await import(
|
|
466
|
-
await applyMainVerticalLayout(
|
|
566
|
+
(await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
|
|
567
|
+
const { applyMainVerticalLayout } = await import("../tmux-session.js");
|
|
568
|
+
await applyMainVerticalLayout("team-session", {
|
|
569
|
+
tmuxServerIdentity: identity,
|
|
570
|
+
});
|
|
467
571
|
}
|
|
468
572
|
finally {
|
|
469
|
-
vi.doUnmock(
|
|
573
|
+
vi.doUnmock("../../cli/tmux-utils.js");
|
|
470
574
|
vi.resetModules();
|
|
471
575
|
}
|
|
472
576
|
expect(calls).toEqual([
|
|
473
|
-
[
|
|
474
|
-
|
|
475
|
-
|
|
577
|
+
[
|
|
578
|
+
"-S",
|
|
579
|
+
identity.socket_path,
|
|
580
|
+
"display-message",
|
|
581
|
+
"-p",
|
|
582
|
+
"-t",
|
|
583
|
+
"team-session",
|
|
584
|
+
"#{window_width}",
|
|
585
|
+
],
|
|
586
|
+
[
|
|
587
|
+
"-S",
|
|
588
|
+
identity.socket_path,
|
|
589
|
+
"if-shell",
|
|
590
|
+
expect.any(String),
|
|
591
|
+
expect.stringContaining("'main-pane-width' '40'"),
|
|
592
|
+
expect.any(String),
|
|
593
|
+
],
|
|
594
|
+
[
|
|
595
|
+
"-S",
|
|
596
|
+
identity.socket_path,
|
|
597
|
+
"if-shell",
|
|
598
|
+
expect.any(String),
|
|
599
|
+
expect.stringContaining("'select-layout' '-t' 'team-session' 'main-vertical'"),
|
|
600
|
+
expect.any(String),
|
|
601
|
+
],
|
|
476
602
|
]);
|
|
477
|
-
expect(calls.filter(args => args[4]?.includes("'select-layout'"))).toHaveLength(1);
|
|
603
|
+
expect(calls.filter((args) => args[4]?.includes("'select-layout'"))).toHaveLength(1);
|
|
478
604
|
expect(selectedPaneWidths).toEqual([40]);
|
|
479
605
|
});
|
|
480
|
-
it(
|
|
606
|
+
it("fails required startup layout before selecting when width is invalid", async () => {
|
|
481
607
|
const calls = [];
|
|
482
608
|
vi.resetModules();
|
|
483
|
-
vi.doMock(
|
|
609
|
+
vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
|
|
484
610
|
const actual = await importOriginal();
|
|
485
611
|
return {
|
|
486
612
|
...actual,
|
|
487
613
|
tmuxCmdAsync: vi.fn(async (args) => {
|
|
488
614
|
calls.push(args);
|
|
489
|
-
return { stdout:
|
|
615
|
+
return { stdout: "not-a-width\n", stderr: "" };
|
|
490
616
|
}),
|
|
491
617
|
tmuxExecAsync: vi.fn(async (args) => {
|
|
492
618
|
calls.push(args);
|
|
493
|
-
return { stdout:
|
|
619
|
+
return { stdout: "", stderr: "" };
|
|
494
620
|
}),
|
|
495
621
|
};
|
|
496
622
|
});
|
|
497
623
|
try {
|
|
498
624
|
// Stock tmux guard path, even on a win32 host with psmux installed.
|
|
499
|
-
(await import(
|
|
500
|
-
const { applyMainVerticalLayout } = await import(
|
|
501
|
-
await expect(applyMainVerticalLayout(
|
|
502
|
-
|
|
625
|
+
(await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
|
|
626
|
+
const { applyMainVerticalLayout } = await import("../tmux-session.js");
|
|
627
|
+
await expect(applyMainVerticalLayout("team-session", {
|
|
628
|
+
required: true,
|
|
629
|
+
tmuxServerIdentity: identity,
|
|
630
|
+
})).rejects.toThrow("team_layout_window_width_invalid:not-a-width");
|
|
503
631
|
}
|
|
504
632
|
finally {
|
|
505
|
-
vi.doUnmock(
|
|
633
|
+
vi.doUnmock("../../cli/tmux-utils.js");
|
|
506
634
|
vi.resetModules();
|
|
507
635
|
}
|
|
508
636
|
expect(calls).toEqual([
|
|
509
|
-
[
|
|
637
|
+
[
|
|
638
|
+
"-S",
|
|
639
|
+
identity.socket_path,
|
|
640
|
+
"display-message",
|
|
641
|
+
"-p",
|
|
642
|
+
"-t",
|
|
643
|
+
"team-session",
|
|
644
|
+
"#{window_width}",
|
|
645
|
+
],
|
|
510
646
|
]);
|
|
511
647
|
});
|
|
512
|
-
it(
|
|
648
|
+
it("rejects a required layout below the startup width boundary", async () => {
|
|
513
649
|
const calls = [];
|
|
514
650
|
vi.resetModules();
|
|
515
|
-
vi.doMock(
|
|
651
|
+
vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
|
|
516
652
|
const actual = await importOriginal();
|
|
517
653
|
return {
|
|
518
654
|
...actual,
|
|
519
655
|
tmuxCmdAsync: vi.fn(async (args) => {
|
|
520
656
|
calls.push(args);
|
|
521
|
-
return { stdout:
|
|
657
|
+
return { stdout: "39\n", stderr: "" };
|
|
522
658
|
}),
|
|
523
659
|
tmuxExecAsync: vi.fn(async (args) => {
|
|
524
660
|
calls.push(args);
|
|
525
|
-
return { stdout:
|
|
661
|
+
return { stdout: "", stderr: "" };
|
|
526
662
|
}),
|
|
527
663
|
};
|
|
528
664
|
});
|
|
529
665
|
try {
|
|
530
666
|
// Stock tmux guard path, even on a win32 host with psmux installed.
|
|
531
|
-
(await import(
|
|
532
|
-
const { applyMainVerticalLayout } = await import(
|
|
533
|
-
await expect(applyMainVerticalLayout(
|
|
534
|
-
|
|
667
|
+
(await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
|
|
668
|
+
const { applyMainVerticalLayout } = await import("../tmux-session.js");
|
|
669
|
+
await expect(applyMainVerticalLayout("team-session", {
|
|
670
|
+
required: true,
|
|
671
|
+
tmuxServerIdentity: identity,
|
|
672
|
+
})).rejects.toThrow("team_layout_window_width_invalid:39");
|
|
535
673
|
}
|
|
536
674
|
finally {
|
|
537
|
-
vi.doUnmock(
|
|
675
|
+
vi.doUnmock("../../cli/tmux-utils.js");
|
|
538
676
|
vi.resetModules();
|
|
539
677
|
}
|
|
540
678
|
expect(calls).toEqual([
|
|
541
|
-
[
|
|
679
|
+
[
|
|
680
|
+
"-S",
|
|
681
|
+
identity.socket_path,
|
|
682
|
+
"display-message",
|
|
683
|
+
"-p",
|
|
684
|
+
"-t",
|
|
685
|
+
"team-session",
|
|
686
|
+
"#{window_width}",
|
|
687
|
+
],
|
|
542
688
|
]);
|
|
543
689
|
});
|
|
544
|
-
it(
|
|
690
|
+
it("never selects a best-effort layout when main-pane-width cannot be set", async () => {
|
|
545
691
|
const calls = [];
|
|
546
692
|
vi.resetModules();
|
|
547
|
-
vi.doMock(
|
|
693
|
+
vi.doMock("../../cli/tmux-utils.js", async (importOriginal) => {
|
|
548
694
|
const actual = await importOriginal();
|
|
549
695
|
return {
|
|
550
696
|
...actual,
|
|
551
697
|
tmuxCmdAsync: vi.fn(async (args) => {
|
|
552
698
|
calls.push(args);
|
|
553
|
-
if (args[2] ===
|
|
699
|
+
if (args[2] === "if-shell") {
|
|
554
700
|
guardedResult(args);
|
|
555
|
-
return { stdout:
|
|
701
|
+
return { stdout: "", stderr: "set failed" };
|
|
556
702
|
}
|
|
557
|
-
return { stdout:
|
|
703
|
+
return { stdout: "80\n", stderr: "" };
|
|
558
704
|
}),
|
|
559
705
|
tmuxExecAsync: vi.fn(async (args) => {
|
|
560
706
|
calls.push(args);
|
|
561
|
-
if (args[0] ===
|
|
562
|
-
throw new Error(
|
|
563
|
-
return { stdout:
|
|
707
|
+
if (args[0] === "set-window-option")
|
|
708
|
+
throw new Error("set failed");
|
|
709
|
+
return { stdout: "", stderr: "" };
|
|
564
710
|
}),
|
|
565
711
|
};
|
|
566
712
|
});
|
|
567
713
|
try {
|
|
568
714
|
// Stock tmux guard path, even on a win32 host with psmux installed.
|
|
569
|
-
(await import(
|
|
570
|
-
const { applyMainVerticalLayout } = await import(
|
|
571
|
-
await expect(applyMainVerticalLayout(
|
|
572
|
-
|
|
715
|
+
(await import("../psmux-adapter.js")).__setPsmuxDetectionForTests(false);
|
|
716
|
+
const { applyMainVerticalLayout } = await import("../tmux-session.js");
|
|
717
|
+
await expect(applyMainVerticalLayout("team-session", {
|
|
718
|
+
tmuxServerIdentity: identity,
|
|
719
|
+
})).rejects.toThrow("team_layout_server_guard_failed");
|
|
573
720
|
}
|
|
574
721
|
finally {
|
|
575
|
-
vi.doUnmock(
|
|
722
|
+
vi.doUnmock("../../cli/tmux-utils.js");
|
|
576
723
|
vi.resetModules();
|
|
577
724
|
}
|
|
578
725
|
expect(calls).toEqual([
|
|
579
|
-
[
|
|
580
|
-
|
|
726
|
+
[
|
|
727
|
+
"-S",
|
|
728
|
+
identity.socket_path,
|
|
729
|
+
"display-message",
|
|
730
|
+
"-p",
|
|
731
|
+
"-t",
|
|
732
|
+
"team-session",
|
|
733
|
+
"#{window_width}",
|
|
734
|
+
],
|
|
735
|
+
[
|
|
736
|
+
"-S",
|
|
737
|
+
identity.socket_path,
|
|
738
|
+
"if-shell",
|
|
739
|
+
expect.any(String),
|
|
740
|
+
expect.stringContaining("'main-pane-width' '40'"),
|
|
741
|
+
expect.any(String),
|
|
742
|
+
],
|
|
581
743
|
]);
|
|
582
744
|
});
|
|
583
745
|
});
|
|
584
|
-
describe(
|
|
585
|
-
it(
|
|
746
|
+
describe("getDefaultShell", () => {
|
|
747
|
+
it("uses COMSPEC on win32", () => {
|
|
586
748
|
stubNativeWindows();
|
|
587
|
-
vi.stubEnv(
|
|
588
|
-
expect(getDefaultShell()).toBe(
|
|
589
|
-
});
|
|
590
|
-
it(
|
|
591
|
-
vi.spyOn(process,
|
|
592
|
-
vi.stubEnv(
|
|
593
|
-
expect(getDefaultShell()).toBe(
|
|
594
|
-
});
|
|
595
|
-
it(
|
|
596
|
-
vi.spyOn(process,
|
|
597
|
-
vi.stubEnv(
|
|
598
|
-
vi.stubEnv(
|
|
599
|
-
vi.stubEnv(
|
|
600
|
-
expect(getDefaultShell()).toBe(
|
|
601
|
-
});
|
|
602
|
-
it(
|
|
603
|
-
vi.spyOn(process,
|
|
604
|
-
vi.stubEnv(
|
|
605
|
-
vi.stubEnv(
|
|
606
|
-
vi.stubEnv(
|
|
607
|
-
expect(getDefaultShell()).toBe(
|
|
749
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
750
|
+
expect(getDefaultShell()).toBe("C:\\Windows\\System32\\cmd.exe");
|
|
751
|
+
});
|
|
752
|
+
it("uses SHELL on non-win32", () => {
|
|
753
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
754
|
+
vi.stubEnv("SHELL", "/bin/zsh");
|
|
755
|
+
expect(getDefaultShell()).toBe("/bin/zsh");
|
|
756
|
+
});
|
|
757
|
+
it("uses SHELL instead of COMSPEC on win32 when MSYSTEM is set (MSYS2)", () => {
|
|
758
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("win32");
|
|
759
|
+
vi.stubEnv("MSYSTEM", "MINGW64");
|
|
760
|
+
vi.stubEnv("SHELL", "/usr/bin/bash");
|
|
761
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
762
|
+
expect(getDefaultShell()).toBe("/usr/bin/bash");
|
|
763
|
+
});
|
|
764
|
+
it("uses SHELL instead of COMSPEC on win32 when MINGW_PREFIX is set", () => {
|
|
765
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("win32");
|
|
766
|
+
vi.stubEnv("MINGW_PREFIX", "/mingw64");
|
|
767
|
+
vi.stubEnv("SHELL", "/usr/bin/bash");
|
|
768
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
769
|
+
expect(getDefaultShell()).toBe("/usr/bin/bash");
|
|
608
770
|
});
|
|
609
771
|
});
|
|
610
|
-
describe(
|
|
611
|
-
it(
|
|
612
|
-
vi.spyOn(process,
|
|
613
|
-
vi.stubEnv(
|
|
614
|
-
vi.stubEnv(
|
|
772
|
+
describe("buildWorkerStartCommand", () => {
|
|
773
|
+
it("throws when deprecated launchCmd is used (security: C2)", () => {
|
|
774
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
775
|
+
vi.stubEnv("SHELL", "/bin/zsh");
|
|
776
|
+
vi.stubEnv("HOME", "/home/tester");
|
|
615
777
|
expect(() => buildWorkerStartCommand({
|
|
616
|
-
teamName:
|
|
617
|
-
workerName:
|
|
618
|
-
envVars: { A:
|
|
619
|
-
launchCmd:
|
|
620
|
-
cwd:
|
|
621
|
-
})).toThrow(
|
|
622
|
-
});
|
|
623
|
-
it(
|
|
624
|
-
vi.spyOn(process,
|
|
625
|
-
vi.stubEnv(
|
|
778
|
+
teamName: "t",
|
|
779
|
+
workerName: "w",
|
|
780
|
+
envVars: { A: "1" },
|
|
781
|
+
launchCmd: "node app.js",
|
|
782
|
+
cwd: "/tmp",
|
|
783
|
+
})).toThrow("launchCmd is deprecated");
|
|
784
|
+
});
|
|
785
|
+
it("throws when neither launchBinary nor launchCmd is provided", () => {
|
|
786
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
787
|
+
vi.stubEnv("SHELL", "/bin/zsh");
|
|
626
788
|
expect(() => buildWorkerStartCommand({
|
|
627
|
-
teamName:
|
|
628
|
-
workerName:
|
|
789
|
+
teamName: "t",
|
|
790
|
+
workerName: "w",
|
|
629
791
|
envVars: {},
|
|
630
|
-
cwd:
|
|
631
|
-
})).toThrow(
|
|
792
|
+
cwd: "/tmp",
|
|
793
|
+
})).toThrow("Missing worker launch command");
|
|
632
794
|
});
|
|
633
|
-
it(
|
|
795
|
+
it("accepts absolute Windows launchBinary paths with spaces", () => {
|
|
634
796
|
stubNativeWindows();
|
|
635
|
-
vi.stubEnv(
|
|
797
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
636
798
|
expect(() => buildWorkerStartCommand({
|
|
637
|
-
teamName:
|
|
638
|
-
workerName:
|
|
639
|
-
envVars: { OMC_TEAM_WORKER:
|
|
640
|
-
launchBinary:
|
|
641
|
-
launchArgs: [
|
|
642
|
-
cwd:
|
|
799
|
+
teamName: "t",
|
|
800
|
+
workerName: "w",
|
|
801
|
+
envVars: { OMC_TEAM_WORKER: "t/w" },
|
|
802
|
+
launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
|
|
803
|
+
launchArgs: ["--full-auto"],
|
|
804
|
+
cwd: "C:\\repo",
|
|
643
805
|
})).not.toThrow();
|
|
644
806
|
});
|
|
645
|
-
it(
|
|
807
|
+
it("uses cmd.exe syntax for native Windows psmux worker start commands", () => {
|
|
646
808
|
stubNativeWindows();
|
|
647
|
-
vi.stubEnv(
|
|
648
|
-
vi.stubEnv(
|
|
809
|
+
vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
|
|
810
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
649
811
|
const cmd = buildWorkerStartCommand({
|
|
650
|
-
teamName:
|
|
651
|
-
workerName:
|
|
652
|
-
envVars: { OMC_TEAM_WORKER:
|
|
653
|
-
launchBinary:
|
|
654
|
-
launchArgs: [
|
|
655
|
-
cwd:
|
|
812
|
+
teamName: "t",
|
|
813
|
+
workerName: "w",
|
|
814
|
+
envVars: { OMC_TEAM_WORKER: "team/worker-1" },
|
|
815
|
+
launchBinary: "C:\\Users\\tester\\AppData\\Local\\Programs\\claude\\claude.exe",
|
|
816
|
+
launchArgs: ["--agent-id", "worker-1"],
|
|
817
|
+
cwd: "C:\\repo",
|
|
656
818
|
});
|
|
657
819
|
expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && set "OMC_TEAM_WORKER=team/worker-1" && ' +
|
|
658
820
|
'"C:\\Users\\tester\\AppData\\Local\\Programs\\claude\\claude.exe" "--agent-id" "worker-1"" & exit /b');
|
|
659
|
-
expect(cmd).not.toContain(
|
|
821
|
+
expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
|
|
660
822
|
});
|
|
661
|
-
it(
|
|
662
|
-
vi.spyOn(process,
|
|
663
|
-
vi.stubEnv(
|
|
823
|
+
it("preserves POSIX argv-style exec while routing launch through the acknowledgement bootstrap", () => {
|
|
824
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
825
|
+
vi.stubEnv("SHELL", "/bin/bash");
|
|
664
826
|
const cmd = buildWorkerStartCommand({
|
|
665
|
-
teamName:
|
|
666
|
-
workerName:
|
|
667
|
-
envVars: { OMC_TEAM_WORKER:
|
|
668
|
-
launchBinary:
|
|
669
|
-
launchArgs: [
|
|
670
|
-
cwd:
|
|
671
|
-
provider:
|
|
827
|
+
teamName: "t",
|
|
828
|
+
workerName: "w",
|
|
829
|
+
envVars: { OMC_TEAM_WORKER: "t/w" },
|
|
830
|
+
launchBinary: "/opt/codex/bin/codex",
|
|
831
|
+
launchArgs: ["--label", "worker one"],
|
|
832
|
+
cwd: "/tmp/team workspace",
|
|
833
|
+
provider: "codex",
|
|
672
834
|
launchAttempt: {
|
|
673
835
|
schema_version: 1,
|
|
674
|
-
attempt_id:
|
|
675
|
-
nonce:
|
|
676
|
-
instance_id:
|
|
677
|
-
team_name:
|
|
678
|
-
worker_name:
|
|
679
|
-
pane_id:
|
|
680
|
-
provider:
|
|
681
|
-
created_at:
|
|
682
|
-
currentPath:
|
|
683
|
-
expectedPath:
|
|
684
|
-
ackPath:
|
|
685
|
-
decisionPath:
|
|
686
|
-
startedPath:
|
|
687
|
-
transportOwnerPath:
|
|
688
|
-
bootstrapDescriptorPath:
|
|
689
|
-
wrapperPath:
|
|
690
|
-
transportCleanupCompletePath:
|
|
691
|
-
runtimeCliPath:
|
|
836
|
+
attempt_id: "11111111-1111-4111-8111-111111111111",
|
|
837
|
+
nonce: "22222222-2222-4222-8222-222222222222",
|
|
838
|
+
instance_id: "33333333-3333-4333-8333-333333333333",
|
|
839
|
+
team_name: "t",
|
|
840
|
+
worker_name: "w",
|
|
841
|
+
pane_id: "%2",
|
|
842
|
+
provider: "codex",
|
|
843
|
+
created_at: "2026-01-01T00:00:00.000Z",
|
|
844
|
+
currentPath: "/tmp/current.json",
|
|
845
|
+
expectedPath: "/tmp/expected.json",
|
|
846
|
+
ackPath: "/tmp/ack.json",
|
|
847
|
+
decisionPath: "/tmp/decision.json",
|
|
848
|
+
startedPath: "/tmp/provider-started.json",
|
|
849
|
+
transportOwnerPath: "/tmp/transport-owner.json",
|
|
850
|
+
bootstrapDescriptorPath: "/tmp/bootstrap.json",
|
|
851
|
+
wrapperPath: "/tmp/launch.cmd",
|
|
852
|
+
transportCleanupCompletePath: "/tmp/transport-cleanup-complete.json",
|
|
853
|
+
runtimeCliPath: "/opt/omc/runtime-cli.cjs",
|
|
692
854
|
},
|
|
693
855
|
});
|
|
694
856
|
// Supervised POSIX launches reference the attempt-owned descriptor by path
|
|
695
857
|
// (issue #3655); the bootstrap spec itself must never travel inline.
|
|
696
858
|
expect(cmd).toContain("OMC_WORKER_LAUNCH_SPEC_FILE='/tmp/bootstrap.json'");
|
|
697
|
-
expect(cmd).not.toContain(
|
|
698
|
-
expect(cmd).toContain(
|
|
859
|
+
expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC=");
|
|
860
|
+
expect(cmd).toContain('exec "$@"');
|
|
699
861
|
expect(cmd).toContain("'--worker-launch'");
|
|
700
862
|
expect(cmd).toContain("'/opt/omc/runtime-cli.cjs'");
|
|
701
863
|
});
|
|
702
|
-
it(
|
|
864
|
+
it("keeps provider percent/quote metacharacters out of the native Windows cmd command", () => {
|
|
703
865
|
stubNativeWindows();
|
|
704
|
-
vi.stubEnv(
|
|
866
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
705
867
|
const cmd = buildWorkerStartCommand({
|
|
706
|
-
teamName:
|
|
707
|
-
workerName:
|
|
708
|
-
envVars: { OMC_TEAM_WORKER:
|
|
709
|
-
launchBinary:
|
|
710
|
-
launchArgs: [
|
|
711
|
-
cwd:
|
|
712
|
-
provider:
|
|
868
|
+
teamName: "t",
|
|
869
|
+
workerName: "w",
|
|
870
|
+
envVars: { OMC_TEAM_WORKER: "t/w" },
|
|
871
|
+
launchBinary: "C:\\Program Files\\Codex\\codex.exe",
|
|
872
|
+
launchArgs: ["--label", "100% ready %USERPROFILE%", '--title="quoted"'],
|
|
873
|
+
cwd: "C:\\team workspace",
|
|
874
|
+
provider: "codex",
|
|
713
875
|
launchAttempt: {
|
|
714
876
|
schema_version: 1,
|
|
715
|
-
attempt_id:
|
|
716
|
-
nonce:
|
|
717
|
-
instance_id:
|
|
718
|
-
team_name:
|
|
719
|
-
worker_name:
|
|
720
|
-
pane_id:
|
|
721
|
-
provider:
|
|
722
|
-
created_at:
|
|
723
|
-
currentPath:
|
|
724
|
-
expectedPath:
|
|
725
|
-
ackPath:
|
|
726
|
-
decisionPath:
|
|
727
|
-
startedPath:
|
|
728
|
-
transportOwnerPath:
|
|
729
|
-
bootstrapDescriptorPath:
|
|
730
|
-
wrapperPath:
|
|
731
|
-
transportCleanupCompletePath:
|
|
732
|
-
runtimeCliPath:
|
|
877
|
+
attempt_id: "11111111-1111-4111-8111-111111111111",
|
|
878
|
+
nonce: "22222222-2222-4222-8222-222222222222",
|
|
879
|
+
instance_id: "33333333-3333-4333-8333-333333333333",
|
|
880
|
+
team_name: "t",
|
|
881
|
+
worker_name: "w",
|
|
882
|
+
pane_id: "%2",
|
|
883
|
+
provider: "codex",
|
|
884
|
+
created_at: "2026-01-01T00:00:00.000Z",
|
|
885
|
+
currentPath: "C:\\state\\current.json",
|
|
886
|
+
expectedPath: "C:\\state\\expected.json",
|
|
887
|
+
ackPath: "C:\\state\\ack.json",
|
|
888
|
+
decisionPath: "C:\\state\\decision.json",
|
|
889
|
+
startedPath: "C:\\state\\provider-started.json",
|
|
890
|
+
transportOwnerPath: "C:\\state\\transport-owner.json",
|
|
891
|
+
bootstrapDescriptorPath: "C:\\state\\bootstrap.json",
|
|
892
|
+
wrapperPath: "C:\\state\\launch.cmd",
|
|
893
|
+
transportCleanupCompletePath: "C:\\state\\transport-cleanup-complete.json",
|
|
894
|
+
runtimeCliPath: "C:\\Program Files\\omc\\runtime-cli.cjs",
|
|
733
895
|
},
|
|
734
896
|
});
|
|
735
|
-
expect(cmd).toContain(
|
|
897
|
+
expect(cmd).toContain("C:\\Windows\\System32\\cmd.exe /d /s /c");
|
|
736
898
|
// Supervised launches deliver the attempt-owned descriptor by path; the
|
|
737
899
|
// bootstrap spec (and its percent/quote metacharacters) never travels in
|
|
738
900
|
// the command line or cmd environment (issue #3655).
|
|
739
901
|
expect(cmd).toContain('set "OMC_WORKER_LAUNCH_SPEC_FILE=C:\\state\\bootstrap.json"');
|
|
740
|
-
expect(cmd).not.toContain(
|
|
741
|
-
expect(cmd).not.toContain(
|
|
742
|
-
expect(cmd).not.toContain(
|
|
743
|
-
expect(cmd).not.toContain(
|
|
902
|
+
expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC_B64=");
|
|
903
|
+
expect(cmd).not.toContain("OMC_WORKER_LAUNCH_SPEC=");
|
|
904
|
+
expect(cmd).not.toContain("100% ready %USERPROFILE%");
|
|
905
|
+
expect(cmd).not.toContain("pane_id=%%2");
|
|
744
906
|
});
|
|
745
|
-
it(
|
|
907
|
+
it("rejects CRLF injection in native Windows provider argv", () => {
|
|
746
908
|
stubNativeWindows();
|
|
747
|
-
vi.stubEnv(
|
|
909
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
748
910
|
expect(() => buildWorkerStartCommand({
|
|
749
|
-
teamName:
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
911
|
+
teamName: "t",
|
|
912
|
+
workerName: "w",
|
|
913
|
+
envVars: {},
|
|
914
|
+
launchBinary: "C:\\Program Files\\Cursor\\cursor-agent.exe",
|
|
915
|
+
launchArgs: ["--model", "safe\r\nset PWNED=1"],
|
|
916
|
+
cwd: "C:\\repo",
|
|
917
|
+
})).toThrow("contains CR, LF, or NUL");
|
|
753
918
|
});
|
|
754
|
-
it(
|
|
919
|
+
it("escapes psmux cmd.exe env vars and quoted launch args without PowerShell syntax", () => {
|
|
755
920
|
stubNativeWindows();
|
|
756
|
-
vi.stubEnv(
|
|
757
|
-
vi.stubEnv(
|
|
921
|
+
vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
|
|
922
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
758
923
|
const cmd = buildWorkerStartCommand({
|
|
759
|
-
teamName:
|
|
760
|
-
workerName:
|
|
924
|
+
teamName: "t",
|
|
925
|
+
workerName: "w",
|
|
761
926
|
envVars: {
|
|
762
927
|
OMC_TEAM_WORKER: "team name/worker 'one'",
|
|
763
|
-
OMC_TEAM_STATE_ROOT:
|
|
928
|
+
OMC_TEAM_STATE_ROOT: "C:\\Users\\Test User\\AppData\\Local\\omc state",
|
|
764
929
|
CLAUDE_CODE_USE_BEDROCK: 'value with spaces & [brackets] "quotes"',
|
|
765
930
|
},
|
|
766
|
-
launchBinary:
|
|
767
|
-
launchArgs: [
|
|
768
|
-
|
|
769
|
-
'sonnet "quoted"',
|
|
770
|
-
"--label=worker 'one'",
|
|
771
|
-
],
|
|
772
|
-
cwd: 'C:\\repo'
|
|
931
|
+
launchBinary: "C:\\Program Files\\Claude Code\\claude.exe",
|
|
932
|
+
launchArgs: ["--model", 'sonnet "quoted"', "--label=worker 'one'"],
|
|
933
|
+
cwd: "C:\\repo",
|
|
773
934
|
});
|
|
774
|
-
expect(cmd).toContain(
|
|
935
|
+
expect(cmd).toContain("set \"OMC_TEAM_WORKER=team name/worker 'one'\"");
|
|
775
936
|
expect(cmd).toContain('set "OMC_TEAM_STATE_ROOT=C:\\Users\\Test User\\AppData\\Local\\omc state"');
|
|
776
937
|
expect(cmd).toContain('set "CLAUDE_CODE_USE_BEDROCK=value with spaces & [brackets] ""quotes"""');
|
|
777
938
|
expect(cmd).toContain('"C:\\Program Files\\Claude Code\\claude.exe" "--model" "sonnet ""quoted""" "--label=worker \'one\'"');
|
|
778
|
-
expect(cmd).not.toContain(
|
|
939
|
+
expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
|
|
779
940
|
});
|
|
780
|
-
it(
|
|
941
|
+
it("escapes literal percent signs in native Windows cmd env values and launch args", () => {
|
|
781
942
|
stubNativeWindows();
|
|
782
|
-
vi.stubEnv(
|
|
943
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
783
944
|
const cmd = buildWorkerStartCommand({
|
|
784
|
-
teamName:
|
|
785
|
-
workerName:
|
|
945
|
+
teamName: "t",
|
|
946
|
+
workerName: "w",
|
|
786
947
|
envVars: {
|
|
787
|
-
OMC_TEAM_WORKER:
|
|
788
|
-
OMC_TOKEN:
|
|
948
|
+
OMC_TEAM_WORKER: "team/worker-1",
|
|
949
|
+
OMC_TOKEN: "literal%USERPROFILE%token%25",
|
|
789
950
|
},
|
|
790
|
-
launchBinary:
|
|
791
|
-
launchArgs: [
|
|
792
|
-
cwd:
|
|
951
|
+
launchBinary: "C:\\Program Files\\Claude Code\\claude.exe",
|
|
952
|
+
launchArgs: ["--label", "100% ready %USERPROFILE%", "--token=abc%25"],
|
|
953
|
+
cwd: "C:\\repo",
|
|
793
954
|
});
|
|
794
955
|
expect(cmd).toContain('set "OMC_TOKEN=literal%%USERPROFILE%%token%%25"');
|
|
795
956
|
expect(cmd).toContain('"100%% ready %%USERPROFILE%%"');
|
|
796
957
|
expect(cmd).toContain('"--token=abc%%25"');
|
|
797
|
-
expect(cmd).not.toContain(
|
|
958
|
+
expect(cmd).not.toContain("literal%USERPROFILE%token%25");
|
|
798
959
|
});
|
|
799
|
-
it(
|
|
960
|
+
it("base64-encodes recovery gate launch identities for native Windows cmd", () => {
|
|
800
961
|
stubNativeWindows();
|
|
801
|
-
vi.stubEnv(
|
|
802
|
-
const gate = {
|
|
962
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
963
|
+
const gate = {
|
|
964
|
+
recoveryId: "recovery-1",
|
|
965
|
+
launchAttempt: {
|
|
966
|
+
attempt_id: "attempt-1",
|
|
967
|
+
nonce: "nonce-1",
|
|
968
|
+
pane_id: "%2",
|
|
969
|
+
},
|
|
970
|
+
};
|
|
803
971
|
const cmd = buildWorkerStartCommand({
|
|
804
|
-
teamName:
|
|
805
|
-
workerName:
|
|
972
|
+
teamName: "t",
|
|
973
|
+
workerName: "w",
|
|
806
974
|
envVars: { OMC_RECOVERY_GATE_SPEC: JSON.stringify(gate) },
|
|
807
|
-
launchBinary:
|
|
808
|
-
launchArgs: [
|
|
809
|
-
cwd:
|
|
975
|
+
launchBinary: "C:\\Program Files\\nodejs\\node.exe",
|
|
976
|
+
launchArgs: ["C:\\omc\\runtime-cli.cjs", "--recovery-gate"],
|
|
977
|
+
cwd: "C:\\repo",
|
|
810
978
|
});
|
|
811
979
|
const marker = 'set "OMC_RECOVERY_GATE_SPEC_B64=';
|
|
812
980
|
const encodedStart = cmd.indexOf(marker) + marker.length;
|
|
813
981
|
const encodedEnd = cmd.indexOf('" &&', encodedStart);
|
|
814
|
-
expect(JSON.parse(Buffer.from(cmd.slice(encodedStart, encodedEnd),
|
|
815
|
-
|
|
816
|
-
expect(cmd).not.toContain(
|
|
817
|
-
expect(cmd).not.toContain('pane_id=%%2');
|
|
982
|
+
expect(JSON.parse(Buffer.from(cmd.slice(encodedStart, encodedEnd), "base64").toString("utf8"))).toMatchObject({ launchAttempt: { pane_id: "%2" } });
|
|
983
|
+
expect(cmd).not.toContain("OMC_RECOVERY_GATE_SPEC=");
|
|
984
|
+
expect(cmd).not.toContain("pane_id=%%2");
|
|
818
985
|
});
|
|
819
|
-
it(
|
|
986
|
+
it("does not cmd-escape percent signs on MSYS Windows worker startup", () => {
|
|
820
987
|
stubNativeWindows();
|
|
821
|
-
vi.stubEnv(
|
|
822
|
-
vi.stubEnv(
|
|
823
|
-
vi.stubEnv(
|
|
824
|
-
vi.stubEnv(
|
|
988
|
+
vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
|
|
989
|
+
vi.stubEnv("MSYSTEM", "MINGW64");
|
|
990
|
+
vi.stubEnv("SHELL", "/usr/bin/bash");
|
|
991
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
825
992
|
const cmd = buildWorkerStartCommand({
|
|
826
|
-
teamName:
|
|
827
|
-
workerName:
|
|
828
|
-
envVars: { OMC_TOKEN:
|
|
829
|
-
launchBinary:
|
|
830
|
-
launchArgs: [
|
|
831
|
-
cwd:
|
|
993
|
+
teamName: "t",
|
|
994
|
+
workerName: "w",
|
|
995
|
+
envVars: { OMC_TOKEN: "literal%USERPROFILE%token%25" },
|
|
996
|
+
launchBinary: "/c/Program Files/Git/bin/bash.exe",
|
|
997
|
+
launchArgs: ["--label=100% ready"],
|
|
998
|
+
cwd: "/c/repo",
|
|
832
999
|
});
|
|
833
1000
|
expect(cmd).toContain("OMC_TOKEN='literal%USERPROFILE%token%25'");
|
|
834
1001
|
expect(cmd).toContain("'--label=100% ready'");
|
|
835
|
-
expect(cmd).not.toContain(
|
|
1002
|
+
expect(cmd).not.toContain("%%USERPROFILE%%");
|
|
836
1003
|
});
|
|
837
|
-
it(
|
|
1004
|
+
it("keeps cmd.exe worker startup syntax for native Windows without psmux", () => {
|
|
838
1005
|
stubNativeWindows();
|
|
839
|
-
vi.stubEnv(
|
|
1006
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
840
1007
|
const cmd = buildWorkerStartCommand({
|
|
841
|
-
teamName:
|
|
842
|
-
workerName:
|
|
843
|
-
envVars: { OMC_TEAM_WORKER:
|
|
844
|
-
launchBinary:
|
|
845
|
-
launchArgs: [
|
|
846
|
-
cwd:
|
|
1008
|
+
teamName: "t",
|
|
1009
|
+
workerName: "w",
|
|
1010
|
+
envVars: { OMC_TEAM_WORKER: "team/worker-1" },
|
|
1011
|
+
launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
|
|
1012
|
+
launchArgs: ["--full-auto"],
|
|
1013
|
+
cwd: "C:\\repo",
|
|
847
1014
|
});
|
|
848
1015
|
expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && set "OMC_TEAM_WORKER=team/worker-1" && ' +
|
|
849
1016
|
'"C:\\Program Files\\OpenAI\\Codex\\codex.exe" "--full-auto"" & exit /b');
|
|
850
1017
|
});
|
|
851
|
-
it(
|
|
1018
|
+
it("turns off the cwd executable search in the cmd.exe fallback even when the caller sets it to 0", () => {
|
|
852
1019
|
stubNativeWindows();
|
|
853
|
-
vi.stubEnv(
|
|
1020
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
854
1021
|
const cmd = buildWorkerStartCommand({
|
|
855
|
-
teamName:
|
|
856
|
-
workerName:
|
|
857
|
-
envVars: { nodefaultcurrentdirectoryinexepath:
|
|
858
|
-
launchBinary:
|
|
1022
|
+
teamName: "t",
|
|
1023
|
+
workerName: "w",
|
|
1024
|
+
envVars: { nodefaultcurrentdirectoryinexepath: "0" },
|
|
1025
|
+
launchBinary: "C:\\Program Files\\OpenAI\\Codex\\codex.exe",
|
|
859
1026
|
launchArgs: [],
|
|
860
|
-
cwd:
|
|
1027
|
+
cwd: "C:\\repo",
|
|
861
1028
|
});
|
|
862
1029
|
expect(cmd).toBe('C:\\Windows\\System32\\cmd.exe /d /s /c "set "NoDefaultCurrentDirectoryInExePath=1" && ' +
|
|
863
1030
|
'"C:\\Program Files\\OpenAI\\Codex\\codex.exe"" & exit /b');
|
|
864
1031
|
});
|
|
865
|
-
it(
|
|
1032
|
+
it("keeps MSYS/Git Bash worker startup syntax even when psmux env is present", () => {
|
|
866
1033
|
stubNativeWindows();
|
|
867
|
-
vi.stubEnv(
|
|
868
|
-
vi.stubEnv(
|
|
869
|
-
vi.stubEnv(
|
|
870
|
-
vi.stubEnv(
|
|
1034
|
+
vi.stubEnv("PSMUX_SESSION", "psmux-session-1");
|
|
1035
|
+
vi.stubEnv("MSYSTEM", "MINGW64");
|
|
1036
|
+
vi.stubEnv("SHELL", "/usr/bin/bash");
|
|
1037
|
+
vi.stubEnv("COMSPEC", "C:\\Windows\\System32\\cmd.exe");
|
|
871
1038
|
const cmd = buildWorkerStartCommand({
|
|
872
|
-
teamName:
|
|
873
|
-
workerName:
|
|
874
|
-
envVars: { OMC_TEAM_WORKER:
|
|
875
|
-
launchBinary:
|
|
876
|
-
launchArgs: [
|
|
877
|
-
cwd:
|
|
1039
|
+
teamName: "t",
|
|
1040
|
+
workerName: "w",
|
|
1041
|
+
envVars: { OMC_TEAM_WORKER: "team/worker-1" },
|
|
1042
|
+
launchBinary: "/c/Program Files/Git/bin/bash.exe",
|
|
1043
|
+
launchArgs: ["--login"],
|
|
1044
|
+
cwd: "/c/repo",
|
|
878
1045
|
});
|
|
879
1046
|
expect(cmd).toContain("'env' OMC_TEAM_WORKER='team/worker-1'");
|
|
880
1047
|
expect(cmd).toContain("'/usr/bin/bash' '-lc'");
|
|
881
1048
|
expect(cmd).toContain("'--' '/c/Program Files/Git/bin/bash.exe' '--login'");
|
|
882
|
-
expect(cmd).not.toContain(
|
|
883
|
-
expect(cmd).not.toContain(
|
|
1049
|
+
expect(cmd).not.toContain("/d /s /c");
|
|
1050
|
+
expect(cmd).not.toContain("$env:OMC_TEAM_WORKER");
|
|
884
1051
|
});
|
|
885
1052
|
it('uses exec \"$@\" for launchBinary with non-fish shells', () => {
|
|
886
|
-
vi.spyOn(process,
|
|
887
|
-
vi.stubEnv(
|
|
888
|
-
vi.stubEnv(
|
|
1053
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1054
|
+
vi.stubEnv("SHELL", "/bin/zsh");
|
|
1055
|
+
vi.stubEnv("HOME", "/home/tester");
|
|
889
1056
|
const cmd = buildWorkerStartCommand({
|
|
890
|
-
teamName:
|
|
891
|
-
workerName:
|
|
892
|
-
envVars: { OMC_TEAM_WORKER:
|
|
893
|
-
launchBinary:
|
|
894
|
-
launchArgs: [
|
|
895
|
-
cwd:
|
|
1057
|
+
teamName: "t",
|
|
1058
|
+
workerName: "w",
|
|
1059
|
+
envVars: { OMC_TEAM_WORKER: "t/w" },
|
|
1060
|
+
launchBinary: "codex",
|
|
1061
|
+
launchArgs: ["--full-auto"],
|
|
1062
|
+
cwd: "/tmp",
|
|
896
1063
|
});
|
|
897
|
-
expect(cmd).toContain(
|
|
1064
|
+
expect(cmd).toContain('exec "$@"');
|
|
898
1065
|
expect(cmd).toContain("'--' 'codex' '--full-auto'");
|
|
899
1066
|
});
|
|
900
|
-
it(
|
|
901
|
-
vi.spyOn(process,
|
|
902
|
-
vi.stubEnv(
|
|
903
|
-
vi.stubEnv(
|
|
1067
|
+
it("uses exec $argv for launchBinary with fish shell", () => {
|
|
1068
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1069
|
+
vi.stubEnv("SHELL", "/usr/bin/fish");
|
|
1070
|
+
vi.stubEnv("HOME", "/home/tester");
|
|
904
1071
|
const cmd = buildWorkerStartCommand({
|
|
905
|
-
teamName:
|
|
906
|
-
workerName:
|
|
907
|
-
envVars: { OMC_TEAM_WORKER:
|
|
908
|
-
launchBinary:
|
|
909
|
-
launchArgs: [
|
|
910
|
-
cwd:
|
|
1072
|
+
teamName: "t",
|
|
1073
|
+
workerName: "w",
|
|
1074
|
+
envVars: { OMC_TEAM_WORKER: "t/w" },
|
|
1075
|
+
launchBinary: "codex",
|
|
1076
|
+
launchArgs: ["--full-auto"],
|
|
1077
|
+
cwd: "/tmp",
|
|
911
1078
|
});
|
|
912
|
-
expect(cmd).toContain(
|
|
1079
|
+
expect(cmd).toContain("exec $argv");
|
|
913
1080
|
expect(cmd).not.toContain('exec "$@"');
|
|
914
1081
|
expect(cmd).toContain("'--' 'codex' '--full-auto'");
|
|
915
1082
|
// Fish uses separate -l -c flags (not combined -lc)
|
|
916
1083
|
expect(cmd).toContain("'-l' '-c'");
|
|
917
1084
|
expect(cmd).not.toContain("'-lc'");
|
|
918
1085
|
// Fish sources ~/.config/fish/config.fish, not ~/.fishrc
|
|
919
|
-
expect(cmd).toContain(
|
|
920
|
-
expect(cmd).not.toContain(
|
|
1086
|
+
expect(cmd).toContain(".config/fish/config.fish");
|
|
1087
|
+
expect(cmd).not.toContain(".fishrc");
|
|
921
1088
|
// Fish uses test/and syntax, not [ ] && .
|
|
922
|
-
expect(cmd).toContain(
|
|
923
|
-
expect(cmd).toContain(
|
|
1089
|
+
expect(cmd).toContain("test -f");
|
|
1090
|
+
expect(cmd).toContain("; and source");
|
|
924
1091
|
});
|
|
925
|
-
it(
|
|
926
|
-
vi.spyOn(process,
|
|
927
|
-
vi.stubEnv(
|
|
928
|
-
vi.stubEnv(
|
|
1092
|
+
it("does not double-escape env vars in launchBinary mode (issue #1415)", () => {
|
|
1093
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1094
|
+
vi.stubEnv("SHELL", "/bin/zsh");
|
|
1095
|
+
vi.stubEnv("HOME", "/home/tester");
|
|
929
1096
|
const cmd = buildWorkerStartCommand({
|
|
930
|
-
teamName:
|
|
931
|
-
workerName:
|
|
1097
|
+
teamName: "t",
|
|
1098
|
+
workerName: "w",
|
|
932
1099
|
envVars: {
|
|
933
|
-
ANTHROPIC_MODEL:
|
|
934
|
-
CLAUDE_CODE_USE_BEDROCK:
|
|
1100
|
+
ANTHROPIC_MODEL: "us.anthropic.claude-sonnet-4-6-v1[1m]",
|
|
1101
|
+
CLAUDE_CODE_USE_BEDROCK: "1",
|
|
935
1102
|
},
|
|
936
|
-
launchBinary:
|
|
937
|
-
launchArgs: [
|
|
938
|
-
cwd:
|
|
1103
|
+
launchBinary: "/usr/local/bin/claude",
|
|
1104
|
+
launchArgs: ["--dangerously-skip-permissions"],
|
|
1105
|
+
cwd: "/tmp",
|
|
939
1106
|
});
|
|
940
1107
|
// env assignments must appear WITHOUT extra wrapping quotes.
|
|
941
1108
|
// Correct: ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-6-v1[1m]'
|
|
@@ -947,330 +1114,330 @@ describe('buildWorkerStartCommand', () => {
|
|
|
947
1114
|
expect(cmd).toContain("'/usr/local/bin/claude'");
|
|
948
1115
|
expect(cmd).toContain("'--dangerously-skip-permissions'");
|
|
949
1116
|
});
|
|
950
|
-
it(
|
|
951
|
-
vi.spyOn(process,
|
|
952
|
-
vi.stubEnv(
|
|
953
|
-
vi.stubEnv(
|
|
1117
|
+
it("env vars with special characters survive single escaping correctly", () => {
|
|
1118
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1119
|
+
vi.stubEnv("SHELL", "/bin/bash");
|
|
1120
|
+
vi.stubEnv("HOME", "/home/tester");
|
|
954
1121
|
const cmd = buildWorkerStartCommand({
|
|
955
|
-
teamName:
|
|
956
|
-
workerName:
|
|
1122
|
+
teamName: "t",
|
|
1123
|
+
workerName: "w",
|
|
957
1124
|
envVars: {
|
|
958
|
-
OMC_TEAM_WORKER:
|
|
959
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL:
|
|
1125
|
+
OMC_TEAM_WORKER: "my-team/worker-1",
|
|
1126
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6[1m]",
|
|
960
1127
|
},
|
|
961
|
-
launchBinary:
|
|
1128
|
+
launchBinary: "/usr/local/bin/claude",
|
|
962
1129
|
launchArgs: [],
|
|
963
|
-
cwd:
|
|
1130
|
+
cwd: "/tmp",
|
|
964
1131
|
});
|
|
965
1132
|
// Values with / and [] must be preserved without extra quoting
|
|
966
1133
|
expect(cmd).toContain("OMC_TEAM_WORKER='my-team/worker-1'");
|
|
967
1134
|
expect(cmd).toContain("ANTHROPIC_DEFAULT_SONNET_MODEL='global.anthropic.claude-sonnet-4-6[1m]'");
|
|
968
1135
|
});
|
|
969
|
-
it(
|
|
970
|
-
vi.spyOn(process,
|
|
1136
|
+
it("rejects relative launchBinary containing spaces", () => {
|
|
1137
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
971
1138
|
expect(() => buildWorkerStartCommand({
|
|
972
|
-
teamName:
|
|
973
|
-
workerName:
|
|
1139
|
+
teamName: "t",
|
|
1140
|
+
workerName: "w",
|
|
974
1141
|
envVars: {},
|
|
975
|
-
launchBinary:
|
|
976
|
-
cwd:
|
|
977
|
-
})).toThrow(
|
|
1142
|
+
launchBinary: "Program Files/codex",
|
|
1143
|
+
cwd: "/tmp",
|
|
1144
|
+
})).toThrow("Invalid launchBinary: paths with spaces must be absolute");
|
|
978
1145
|
});
|
|
979
|
-
it(
|
|
980
|
-
vi.spyOn(process,
|
|
1146
|
+
it("rejects dangerous shell metacharacters in launchBinary", () => {
|
|
1147
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
981
1148
|
expect(() => buildWorkerStartCommand({
|
|
982
|
-
teamName:
|
|
983
|
-
workerName:
|
|
1149
|
+
teamName: "t",
|
|
1150
|
+
workerName: "w",
|
|
984
1151
|
envVars: {},
|
|
985
|
-
launchBinary:
|
|
986
|
-
cwd:
|
|
987
|
-
})).toThrow(
|
|
1152
|
+
launchBinary: "/usr/bin/codex;touch /tmp/pwn",
|
|
1153
|
+
cwd: "/tmp",
|
|
1154
|
+
})).toThrow("Invalid launchBinary: contains dangerous shell metacharacters");
|
|
988
1155
|
});
|
|
989
1156
|
});
|
|
990
|
-
describe(
|
|
991
|
-
it(
|
|
1157
|
+
describe("shouldAttemptAdaptiveRetry", () => {
|
|
1158
|
+
it("only enables adaptive retry for busy panes with visible unsent message", () => {
|
|
992
1159
|
delete process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY;
|
|
993
1160
|
expect(shouldAttemptAdaptiveRetry({
|
|
994
1161
|
paneBusy: false,
|
|
995
|
-
latestCapture:
|
|
996
|
-
message:
|
|
1162
|
+
latestCapture: "❯ check-inbox",
|
|
1163
|
+
message: "check-inbox",
|
|
997
1164
|
paneInCopyMode: false,
|
|
998
1165
|
retriesAttempted: 0,
|
|
999
1166
|
})).toBe(false);
|
|
1000
1167
|
expect(shouldAttemptAdaptiveRetry({
|
|
1001
1168
|
paneBusy: true,
|
|
1002
|
-
latestCapture:
|
|
1003
|
-
message:
|
|
1169
|
+
latestCapture: "❯ ready prompt",
|
|
1170
|
+
message: "check-inbox",
|
|
1004
1171
|
paneInCopyMode: false,
|
|
1005
1172
|
retriesAttempted: 0,
|
|
1006
1173
|
})).toBe(false);
|
|
1007
1174
|
expect(shouldAttemptAdaptiveRetry({
|
|
1008
1175
|
paneBusy: true,
|
|
1009
|
-
latestCapture:
|
|
1010
|
-
message:
|
|
1176
|
+
latestCapture: "❯ check-inbox",
|
|
1177
|
+
message: "check-inbox",
|
|
1011
1178
|
paneInCopyMode: true,
|
|
1012
1179
|
retriesAttempted: 0,
|
|
1013
1180
|
})).toBe(false);
|
|
1014
1181
|
expect(shouldAttemptAdaptiveRetry({
|
|
1015
1182
|
paneBusy: true,
|
|
1016
|
-
latestCapture:
|
|
1017
|
-
message:
|
|
1183
|
+
latestCapture: "❯ check-inbox",
|
|
1184
|
+
message: "check-inbox",
|
|
1018
1185
|
paneInCopyMode: false,
|
|
1019
1186
|
retriesAttempted: 1,
|
|
1020
1187
|
})).toBe(false);
|
|
1021
1188
|
expect(shouldAttemptAdaptiveRetry({
|
|
1022
1189
|
paneBusy: true,
|
|
1023
|
-
latestCapture:
|
|
1024
|
-
message:
|
|
1190
|
+
latestCapture: "❯ check-inbox\ngpt-5.3-codex high · 80% left",
|
|
1191
|
+
message: "check-inbox",
|
|
1025
1192
|
paneInCopyMode: false,
|
|
1026
1193
|
retriesAttempted: 0,
|
|
1027
1194
|
})).toBe(true);
|
|
1028
1195
|
});
|
|
1029
|
-
it(
|
|
1030
|
-
process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY =
|
|
1196
|
+
it("respects OMC_TEAM_AUTO_INTERRUPT_RETRY=0", () => {
|
|
1197
|
+
process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY = "0";
|
|
1031
1198
|
expect(shouldAttemptAdaptiveRetry({
|
|
1032
1199
|
paneBusy: true,
|
|
1033
|
-
latestCapture:
|
|
1034
|
-
message:
|
|
1200
|
+
latestCapture: "❯ check-inbox",
|
|
1201
|
+
message: "check-inbox",
|
|
1035
1202
|
paneInCopyMode: false,
|
|
1036
1203
|
retriesAttempted: 0,
|
|
1037
1204
|
})).toBe(false);
|
|
1038
1205
|
delete process.env.OMC_TEAM_AUTO_INTERRUPT_RETRY;
|
|
1039
1206
|
});
|
|
1040
1207
|
});
|
|
1041
|
-
describe(
|
|
1042
|
-
it(
|
|
1208
|
+
describe("pane readiness startup banners", () => {
|
|
1209
|
+
it("does not treat Claude bypass-permissions startup banner as ready", () => {
|
|
1043
1210
|
const capture = [
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
].join(
|
|
1211
|
+
"Read .omg/state/team/example/workers/worker-1/inbox.md, execute now, report concrete progress.",
|
|
1212
|
+
"─────────────────────────────────────────────",
|
|
1213
|
+
"[OMC] Starting...",
|
|
1214
|
+
"⏵⏵ bypass permissions on (shift+tab to cycle)",
|
|
1215
|
+
].join("\n");
|
|
1049
1216
|
expect(paneLooksReady(capture)).toBe(false);
|
|
1050
1217
|
});
|
|
1051
|
-
it(
|
|
1218
|
+
it("treats an exact directory trust selector as ready for legacy delivery", () => {
|
|
1052
1219
|
const capture = [
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
].join(
|
|
1220
|
+
"Do you trust the contents of this directory?",
|
|
1221
|
+
"› 1. Yes, continue",
|
|
1222
|
+
" 2. No, quit",
|
|
1223
|
+
].join("\n");
|
|
1057
1224
|
expect(paneHasTrustPrompt(capture)).toBe(true);
|
|
1058
1225
|
expect(paneLooksReady(capture)).toBe(true);
|
|
1059
1226
|
expect(paneHasActiveTask(capture)).toBe(false);
|
|
1060
1227
|
});
|
|
1061
|
-
it(
|
|
1228
|
+
it("detects Codex CLI hook-trust review screen as a trust prompt", () => {
|
|
1062
1229
|
const capture = [
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1230
|
+
" Hooks need review",
|
|
1231
|
+
" 3 hooks are new or changed.",
|
|
1232
|
+
" Hooks can run outside the sandbox after you trust them.",
|
|
1233
|
+
"",
|
|
1234
|
+
"› 1. Review hooks",
|
|
1235
|
+
" 2. Trust all and continue",
|
|
1069
1236
|
" 3. Continue without trusting (hooks won't run)",
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
].join(
|
|
1237
|
+
"",
|
|
1238
|
+
" Press enter to confirm or esc to go back",
|
|
1239
|
+
].join("\n");
|
|
1073
1240
|
expect(paneHasTrustPrompt(capture)).toBe(true);
|
|
1074
1241
|
expect(paneLooksReady(capture)).toBe(true);
|
|
1075
1242
|
expect(paneHasActiveTask(capture)).toBe(false);
|
|
1076
1243
|
});
|
|
1077
|
-
it(
|
|
1244
|
+
it("detects the cursor-agent workspace-trust banner and refuses to call it ready", () => {
|
|
1078
1245
|
// Verbatim capture from `cursor-agent` launched in tmux on an untrusted
|
|
1079
1246
|
// directory. It offers no numbered choice and the process exits, unlike
|
|
1080
1247
|
// the dismissible Claude/Codex prompts above.
|
|
1081
1248
|
const capture = [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1249
|
+
"⚠ Workspace Trust Required",
|
|
1250
|
+
"",
|
|
1251
|
+
" Cursor Agent can execute code and access files in this directory.",
|
|
1252
|
+
" Do you trust the contents of this directory?",
|
|
1253
|
+
"",
|
|
1254
|
+
" /private/tmp/ct-nf2",
|
|
1255
|
+
"",
|
|
1256
|
+
" To proceed, you can either:",
|
|
1090
1257
|
" • Run 'agent' interactively to decide",
|
|
1091
|
-
|
|
1092
|
-
].join(
|
|
1258
|
+
" • Pass --trust, --yolo, or -f if you trust this directory",
|
|
1259
|
+
].join("\n");
|
|
1093
1260
|
expect(paneHasTrustPrompt(capture)).toBe(true);
|
|
1094
1261
|
// The pane is dead: treating it as ready would hand work to a gone process.
|
|
1095
|
-
expect(paneLooksReady(capture,
|
|
1096
|
-
expect(paneHasActiveTask(capture,
|
|
1262
|
+
expect(paneLooksReady(capture, "cursor")).toBe(false);
|
|
1263
|
+
expect(paneHasActiveTask(capture, "cursor")).toBe(false);
|
|
1097
1264
|
});
|
|
1098
|
-
it(
|
|
1265
|
+
it("gives the Cursor trust banner precedence and keeps it provider-scoped", () => {
|
|
1099
1266
|
const capture = [
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1267
|
+
"⚠ Workspace Trust Required",
|
|
1268
|
+
"Do you trust the contents of this directory?",
|
|
1269
|
+
"› 1. Yes, continue",
|
|
1270
|
+
" 2. No, quit",
|
|
1104
1271
|
" • Pass --trust, --yolo, or -f if you trust this directory",
|
|
1105
|
-
].join(
|
|
1106
|
-
expect(paneHasTrustPrompt(capture,
|
|
1107
|
-
expect(paneLooksReady(capture,
|
|
1108
|
-
expect(paneLooksReady(capture,
|
|
1272
|
+
].join("\n");
|
|
1273
|
+
expect(paneHasTrustPrompt(capture, "cursor")).toBe(true);
|
|
1274
|
+
expect(paneLooksReady(capture, "cursor")).toBe(false);
|
|
1275
|
+
expect(paneLooksReady(capture, "claude")).toBe(true);
|
|
1109
1276
|
});
|
|
1110
1277
|
// Fork fix: verbatim Copilot CLI 1.0.91 idle capture from a psmux pane.
|
|
1111
|
-
it(
|
|
1278
|
+
it("treats the Copilot CLI 1.0.9x empty input box as ready for copilot only", () => {
|
|
1112
1279
|
const capture = [
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
].join(
|
|
1125
|
-
expect(paneLooksReady(capture,
|
|
1126
|
-
expect(paneLooksReady(capture,
|
|
1127
|
-
expect(paneLooksReady(capture.replace(
|
|
1128
|
-
});
|
|
1129
|
-
it(
|
|
1280
|
+
" ╭─╮╭─╮",
|
|
1281
|
+
" ╰─╯╰─╯ Copilot v1.0.91 uses AI.",
|
|
1282
|
+
" █ ▘▝ █ Check for mistakes.",
|
|
1283
|
+
" ● MCP Servers reloaded: 2 servers connected",
|
|
1284
|
+
" ~\\AppData\\L... [⎇ master%] Session: 0 AIC used",
|
|
1285
|
+
"╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
|
|
1286
|
+
"┃",
|
|
1287
|
+
"╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
|
|
1288
|
+
" ← open ·Interactive · · / commands · ? help",
|
|
1289
|
+
" sidebar Allow All · tab next tab",
|
|
1290
|
+
" GitHub Copilot • Auto",
|
|
1291
|
+
].join("\n");
|
|
1292
|
+
expect(paneLooksReady(capture, "copilot")).toBe(true);
|
|
1293
|
+
expect(paneLooksReady(capture, "claude")).toBe(false);
|
|
1294
|
+
expect(paneLooksReady(capture.replace("\n┃\n", "\n┃ typing\n"), "copilot")).toBe(false);
|
|
1295
|
+
});
|
|
1296
|
+
it("treats the Copilot CLI 1.0.9x working status line as an active task", () => {
|
|
1130
1297
|
const capture = [
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
].join(
|
|
1139
|
-
expect(paneHasActiveTask(capture,
|
|
1140
|
-
expect(paneHasActiveTask(capture,
|
|
1141
|
-
expect(paneHasActiveTask(capture.replace(
|
|
1142
|
-
expect(paneHasActiveTask(capture.replace(
|
|
1143
|
-
});
|
|
1144
|
-
it(
|
|
1145
|
-
expect(paneLooksReady(
|
|
1146
|
-
expect(paneLooksReady(
|
|
1147
|
-
expect(paneLooksReady(
|
|
1148
|
-
});
|
|
1149
|
-
it(
|
|
1298
|
+
" ❯ Read .omg/state/team/t/workers/worker-1/inbox.md, execute now",
|
|
1299
|
+
" ○ skill(lean-ctx)",
|
|
1300
|
+
"╻▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
|
|
1301
|
+
"┃",
|
|
1302
|
+
"╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
|
|
1303
|
+
" ○ Working · 25 B esc interrupt",
|
|
1304
|
+
" GitHub Copilot • Auto → gpt-6-luna",
|
|
1305
|
+
].join("\n");
|
|
1306
|
+
expect(paneHasActiveTask(capture, "copilot")).toBe(true);
|
|
1307
|
+
expect(paneHasActiveTask(capture, "claude")).toBe(false);
|
|
1308
|
+
expect(paneHasActiveTask(capture.replace("○ Working · 25 B esc interrupt", "◉ Working esc edit prompt"), "copilot")).toBe(true);
|
|
1309
|
+
expect(paneHasActiveTask(capture.replace(" ○ Working · 25 B esc interrupt\n", ""), "copilot")).toBe(false);
|
|
1310
|
+
});
|
|
1311
|
+
it("still treats actual prompt lines as ready", () => {
|
|
1312
|
+
expect(paneLooksReady("Welcome\n❯ ")).toBe(true);
|
|
1313
|
+
expect(paneLooksReady("Welcome\n> ")).toBe(true);
|
|
1314
|
+
expect(paneLooksReady("⏵⏵ bypass permissions on (shift+tab to cycle)\nReady\n❯ ")).toBe(true);
|
|
1315
|
+
});
|
|
1316
|
+
it("treats Claude Code v2.1.x idle pane (prompt above persistent mode indicator) as ready", () => {
|
|
1150
1317
|
// Claude Code v2.1.142 renders the permission-mode indicator
|
|
1151
1318
|
// ("⏵⏵ bypass permissions on (shift+tab to cycle)") *below* the prompt
|
|
1152
1319
|
// as a persistent idle-state UI element. Before this fix, the pane was
|
|
1153
1320
|
// misread as still bootstrapping and OMC never dispatched the inbox to
|
|
1154
1321
|
// claude workers, leaving them hung with "[OMC] Starting..." forever.
|
|
1155
1322
|
const capture = [
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
].join(
|
|
1323
|
+
"▐▛███▜▌ Claude Code v2.1.142",
|
|
1324
|
+
"▝▜█████▛▘ Opus 4.7 (1M context) · Claude Max",
|
|
1325
|
+
" ▘▘ ▝▝ ~/some/repo",
|
|
1326
|
+
"",
|
|
1327
|
+
"───────────────────────────────────────",
|
|
1328
|
+
"❯ ",
|
|
1329
|
+
"───────────────────────────────────────",
|
|
1330
|
+
" ⏵⏵ bypass permissions on (shift+tab to cycle)",
|
|
1331
|
+
].join("\n");
|
|
1165
1332
|
expect(paneLooksReady(capture)).toBe(true);
|
|
1166
1333
|
expect(paneHasActiveTask(capture)).toBe(false);
|
|
1167
1334
|
});
|
|
1168
|
-
it(
|
|
1335
|
+
it("treats Claude idle prompt inside the TUI gutter as ready for initial dispatch", () => {
|
|
1169
1336
|
const capture = [
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
].join(
|
|
1337
|
+
"╭────────────────────────────────────────────────────────╮",
|
|
1338
|
+
"│ ✻ Welcome to Claude Code v2.1.142 │",
|
|
1339
|
+
"│ │",
|
|
1340
|
+
"│ ❯ │",
|
|
1341
|
+
"╰────────────────────────────────────────────────────────╯",
|
|
1342
|
+
" ⏵⏵ bypass permissions on (shift+tab to cycle)",
|
|
1343
|
+
].join("\n");
|
|
1177
1344
|
expect(paneLooksReady(capture)).toBe(true);
|
|
1178
1345
|
expect(paneHasActiveTask(capture)).toBe(false);
|
|
1179
1346
|
});
|
|
1180
|
-
it(
|
|
1347
|
+
it("still flags Claude Code v2.1.x mid-task panes via paneHasActiveTask", () => {
|
|
1181
1348
|
// Same v2.1.x pane shape with a spinner + "esc to interrupt" — paneLooksReady
|
|
1182
1349
|
// sees the prompt and reports ready, but waitForPaneReady's secondary
|
|
1183
1350
|
// paneHasActiveTask guard catches the in-flight task and keeps the worker
|
|
1184
1351
|
// from being treated as idle.
|
|
1185
1352
|
const capture = [
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
].join(
|
|
1353
|
+
"❯ Run the migration",
|
|
1354
|
+
"· Thinking…",
|
|
1355
|
+
" esc to interrupt",
|
|
1356
|
+
" ⏵⏵ bypass permissions on (shift+tab to cycle)",
|
|
1357
|
+
].join("\n");
|
|
1191
1358
|
expect(paneLooksReady(capture)).toBe(true);
|
|
1192
1359
|
expect(paneHasActiveTask(capture)).toBe(true);
|
|
1193
1360
|
});
|
|
1194
|
-
it.each([
|
|
1361
|
+
it.each(["✢", "✳", "✶", "✽", "✺", "✹", "✸", "✷", "*"])("treats Claude Code spinner glyph %s as an active task", (glyph) => {
|
|
1195
1362
|
expect(paneHasActiveTask(`${glyph} Compacting…`)).toBe(true);
|
|
1196
1363
|
});
|
|
1197
|
-
it(
|
|
1198
|
-
expect(paneHasActiveTask(
|
|
1364
|
+
it("treats a Claude Code spinner status suffix as an active task", () => {
|
|
1365
|
+
expect(paneHasActiveTask("✻ Compacting… (12 tokens, 3s)")).toBe(true);
|
|
1199
1366
|
});
|
|
1200
1367
|
});
|
|
1201
|
-
describe(
|
|
1202
|
-
const source = readFileSync(join(__dirname,
|
|
1203
|
-
it(
|
|
1204
|
-
expect(source).not.toContain(
|
|
1205
|
-
expect(source).toContain(
|
|
1206
|
-
expect(source).toContain(
|
|
1207
|
-
});
|
|
1208
|
-
it(
|
|
1209
|
-
expect(source).toContain(
|
|
1210
|
-
expect(source).toContain(
|
|
1211
|
-
});
|
|
1212
|
-
it(
|
|
1213
|
-
expect(source).toContain(
|
|
1214
|
-
expect(source).toContain(
|
|
1215
|
-
});
|
|
1216
|
-
it(
|
|
1217
|
-
expect(source).toContain(
|
|
1218
|
-
expect(source).toContain(
|
|
1219
|
-
expect(source).toContain(
|
|
1368
|
+
describe("sendToWorker implementation guards", () => {
|
|
1369
|
+
const source = readFileSync(join(__dirname, "..", "tmux-session.ts"), "utf-8");
|
|
1370
|
+
it("points the readiness timeout hint at the env var the worker wait reads", () => {
|
|
1371
|
+
expect(source).not.toContain("OMC_SHELL_READY_TIMEOUT_MS");
|
|
1372
|
+
expect(source).toContain("set OMC_TEAM_READY_TIMEOUT_MS to tune");
|
|
1373
|
+
expect(source).toContain("30_000");
|
|
1374
|
+
});
|
|
1375
|
+
it("checks and exits tmux copy-mode before injection", () => {
|
|
1376
|
+
expect(source).toContain("#{pane_in_mode}");
|
|
1377
|
+
expect(source).toContain("skip injection entirely");
|
|
1378
|
+
});
|
|
1379
|
+
it("supports env-gated adaptive interrupt retry", () => {
|
|
1380
|
+
expect(source).toContain("OMC_TEAM_AUTO_INTERRUPT_RETRY");
|
|
1381
|
+
expect(source).toContain('sendSubmitKey("C-u")');
|
|
1382
|
+
});
|
|
1383
|
+
it("re-checks copy-mode before adaptive and final fallback keys", () => {
|
|
1384
|
+
expect(source).toContain("Safety gate: copy-mode can turn on while we retry");
|
|
1385
|
+
expect(source).toContain("Before fallback control keys, re-check copy-mode");
|
|
1386
|
+
expect(source).toContain("Fail-closed: one final submit attempt");
|
|
1220
1387
|
});
|
|
1221
1388
|
});
|
|
1222
|
-
describe(
|
|
1223
|
-
it(
|
|
1224
|
-
vi.spyOn(process,
|
|
1225
|
-
vi.stubEnv(
|
|
1389
|
+
describe("buildWorkerStartCommand MAX_CANON compliance (issue #4191)", () => {
|
|
1390
|
+
it("keeps supervised launch command under 1024 bytes even with long cwd paths", () => {
|
|
1391
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1392
|
+
vi.stubEnv("SHELL", "/bin/bash");
|
|
1226
1393
|
// Create a long cwd (300+ chars) to simulate real-world paths
|
|
1227
|
-
const longCwd =
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1394
|
+
const longCwd = "/home/user/projects/very/deep/nested/directory/structure/" +
|
|
1395
|
+
"with/many/components/that/add/up/to/make/a/realistically/long/path/to/the/working/" +
|
|
1396
|
+
"directory/where/the/team/would/be/running/from/and/this/represents/typical/monorepo/" +
|
|
1397
|
+
"layouts/or/deeply/nested/project/structures/that/developers/might/encounter/in/" +
|
|
1398
|
+
"their/workflows/on/their/systems/today";
|
|
1232
1399
|
const attempt = {
|
|
1233
1400
|
schema_version: 1,
|
|
1234
|
-
attempt_id:
|
|
1235
|
-
nonce:
|
|
1236
|
-
instance_id:
|
|
1237
|
-
team_name:
|
|
1238
|
-
worker_name:
|
|
1239
|
-
pane_id:
|
|
1240
|
-
provider:
|
|
1241
|
-
created_at:
|
|
1242
|
-
currentPath:
|
|
1243
|
-
expectedPath:
|
|
1244
|
-
ackPath:
|
|
1245
|
-
decisionPath:
|
|
1246
|
-
startedPath:
|
|
1247
|
-
transportOwnerPath:
|
|
1248
|
-
bootstrapDescriptorPath:
|
|
1249
|
-
wrapperPath:
|
|
1250
|
-
transportCleanupCompletePath:
|
|
1251
|
-
runtimeCliPath:
|
|
1401
|
+
attempt_id: "11111111-1111-4111-8111-111111111111",
|
|
1402
|
+
nonce: "22222222-2222-4222-8222-222222222222",
|
|
1403
|
+
instance_id: "33333333-3333-4333-8333-333333333333",
|
|
1404
|
+
team_name: "test-team",
|
|
1405
|
+
worker_name: "worker-1",
|
|
1406
|
+
pane_id: "%2",
|
|
1407
|
+
provider: "codex",
|
|
1408
|
+
created_at: "2026-01-01T00:00:00.000Z",
|
|
1409
|
+
currentPath: "/tmp/current.json",
|
|
1410
|
+
expectedPath: "/tmp/expected.json",
|
|
1411
|
+
ackPath: "/tmp/ack.json",
|
|
1412
|
+
decisionPath: "/tmp/decision.json",
|
|
1413
|
+
startedPath: "/tmp/provider-started.json",
|
|
1414
|
+
transportOwnerPath: "/tmp/transport-owner.json",
|
|
1415
|
+
bootstrapDescriptorPath: "/tmp/bootstrap.json",
|
|
1416
|
+
wrapperPath: "/tmp/launch.cmd",
|
|
1417
|
+
transportCleanupCompletePath: "/tmp/transport-cleanup-complete.json",
|
|
1418
|
+
runtimeCliPath: "/opt/omc/runtime-cli.cjs",
|
|
1252
1419
|
};
|
|
1253
1420
|
// Simulate what runtime-v2 passes in envVars with long paths
|
|
1254
1421
|
const envVarsWithLongPaths = {
|
|
1255
|
-
OMC_TEAM_WORKER:
|
|
1256
|
-
OMC_TEAM_NAME:
|
|
1257
|
-
OMC_WORKER_AGENT_TYPE:
|
|
1422
|
+
OMC_TEAM_WORKER: "test-team/worker-1",
|
|
1423
|
+
OMC_TEAM_NAME: "test-team",
|
|
1424
|
+
OMC_WORKER_AGENT_TYPE: "codex",
|
|
1258
1425
|
OMC_TEAM_STATE_ROOT: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/.omc/state/team/test-team`,
|
|
1259
1426
|
OMC_TEAM_LEADER_CWD: longCwd,
|
|
1260
1427
|
OMC_TEAM_WORKTREE_PATH: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/worktree`,
|
|
1261
1428
|
OMC_TEAM_WORKER_CWD: `/home/user/projects/very/deep/nested/directory/structure/with/many/components/worker-cwd`,
|
|
1262
1429
|
};
|
|
1263
1430
|
const cmd = buildWorkerStartCommand({
|
|
1264
|
-
teamName:
|
|
1265
|
-
workerName:
|
|
1431
|
+
teamName: "test-team",
|
|
1432
|
+
workerName: "worker-1",
|
|
1266
1433
|
envVars: envVarsWithLongPaths,
|
|
1267
|
-
launchBinary:
|
|
1268
|
-
launchArgs: [
|
|
1434
|
+
launchBinary: "/usr/bin/codex",
|
|
1435
|
+
launchArgs: ["--full-auto"],
|
|
1269
1436
|
cwd: longCwd,
|
|
1270
|
-
provider:
|
|
1437
|
+
provider: "codex",
|
|
1271
1438
|
launchAttempt: attempt,
|
|
1272
1439
|
});
|
|
1273
|
-
const cmdBytes = Buffer.byteLength(cmd,
|
|
1440
|
+
const cmdBytes = Buffer.byteLength(cmd, "utf8");
|
|
1274
1441
|
// Key assertion: command must stay under 1024 bytes (macOS MAX_CANON limit)
|
|
1275
1442
|
// to avoid truncation in terminal line discipline
|
|
1276
1443
|
expect(cmdBytes).toBeLessThan(1024);
|
|
@@ -1278,35 +1445,35 @@ describe('buildWorkerStartCommand MAX_CANON compliance (issue #4191)', () => {
|
|
|
1278
1445
|
// Verify supervised launch only includes OMC_WORKER_LAUNCH_SPEC_FILE
|
|
1279
1446
|
// NOT the long env vars that would push it over the limit
|
|
1280
1447
|
expect(cmd).toContain("OMC_WORKER_LAUNCH_SPEC_FILE='/tmp/bootstrap.json'");
|
|
1281
|
-
expect(cmd).not.toContain(
|
|
1282
|
-
expect(cmd).not.toContain(
|
|
1283
|
-
expect(cmd).not.toContain(
|
|
1448
|
+
expect(cmd).not.toContain("OMC_TEAM_STATE_ROOT");
|
|
1449
|
+
expect(cmd).not.toContain("OMC_TEAM_LEADER_CWD");
|
|
1450
|
+
expect(cmd).not.toContain("OMC_TEAM_WORKER_CWD");
|
|
1284
1451
|
expect(cmd).not.toContain(longCwd);
|
|
1285
1452
|
// Verify it still invokes the runtime CLI correctly
|
|
1286
|
-
expect(cmd).toContain(
|
|
1287
|
-
expect(cmd).toContain(
|
|
1453
|
+
expect(cmd).toContain("--worker-launch");
|
|
1454
|
+
expect(cmd).toContain("/opt/omc/runtime-cli.cjs");
|
|
1288
1455
|
});
|
|
1289
|
-
it(
|
|
1290
|
-
vi.spyOn(process,
|
|
1291
|
-
vi.stubEnv(
|
|
1456
|
+
it("non-supervised launches still include env vars normally", () => {
|
|
1457
|
+
vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
|
1458
|
+
vi.stubEnv("SHELL", "/bin/bash");
|
|
1292
1459
|
const cmd = buildWorkerStartCommand({
|
|
1293
|
-
teamName:
|
|
1294
|
-
workerName:
|
|
1460
|
+
teamName: "test-team",
|
|
1461
|
+
workerName: "worker-1",
|
|
1295
1462
|
envVars: {
|
|
1296
|
-
OMC_TEAM_WORKER:
|
|
1297
|
-
OMC_TEAM_NAME:
|
|
1298
|
-
OMC_TEAM_STATE_ROOT:
|
|
1463
|
+
OMC_TEAM_WORKER: "test-team/worker-1",
|
|
1464
|
+
OMC_TEAM_NAME: "test-team",
|
|
1465
|
+
OMC_TEAM_STATE_ROOT: "/tmp/state",
|
|
1299
1466
|
},
|
|
1300
|
-
launchBinary:
|
|
1301
|
-
launchArgs: [
|
|
1302
|
-
cwd:
|
|
1303
|
-
provider:
|
|
1467
|
+
launchBinary: "/usr/bin/codex",
|
|
1468
|
+
launchArgs: ["--full-auto"],
|
|
1469
|
+
cwd: "/tmp",
|
|
1470
|
+
provider: "codex",
|
|
1304
1471
|
// No launchAttempt - non-supervised
|
|
1305
1472
|
});
|
|
1306
1473
|
// Non-supervised launches should include all env vars
|
|
1307
|
-
expect(cmd).toContain(
|
|
1308
|
-
expect(cmd).toContain(
|
|
1309
|
-
expect(cmd).toContain(
|
|
1474
|
+
expect(cmd).toContain("OMC_TEAM_WORKER");
|
|
1475
|
+
expect(cmd).toContain("OMC_TEAM_NAME");
|
|
1476
|
+
expect(cmd).toContain("OMC_TEAM_STATE_ROOT");
|
|
1310
1477
|
});
|
|
1311
1478
|
});
|
|
1312
1479
|
//# sourceMappingURL=tmux-session.test.js.map
|