oh-my-codex 0.18.13 → 0.18.15
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/Cargo.lock +6 -6
- package/Cargo.toml +1 -1
- package/README.md +41 -18
- package/dist/agents/__tests__/native-config.test.js +62 -0
- package/dist/agents/__tests__/native-config.test.js.map +1 -1
- package/dist/agents/native-config.d.ts.map +1 -1
- package/dist/agents/native-config.js +15 -2
- package/dist/agents/native-config.js.map +1 -1
- package/dist/autopilot/__tests__/fsm.test.js +7 -0
- package/dist/autopilot/__tests__/fsm.test.js.map +1 -1
- package/dist/autopilot/__tests__/planner-routing.test.d.ts +2 -0
- package/dist/autopilot/__tests__/planner-routing.test.d.ts.map +1 -0
- package/dist/autopilot/__tests__/planner-routing.test.js +74 -0
- package/dist/autopilot/__tests__/planner-routing.test.js.map +1 -0
- package/dist/autopilot/__tests__/ralplan-gate.test.js +315 -0
- package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -1
- package/dist/autopilot/completion-gate.js +1 -1
- package/dist/autopilot/completion-gate.js.map +1 -1
- package/dist/autopilot/fsm.d.ts +2 -2
- package/dist/autopilot/fsm.d.ts.map +1 -1
- package/dist/autopilot/fsm.js +3 -0
- package/dist/autopilot/fsm.js.map +1 -1
- package/dist/autopilot/planner-routing.d.ts +21 -0
- package/dist/autopilot/planner-routing.d.ts.map +1 -0
- package/dist/autopilot/planner-routing.js +59 -0
- package/dist/autopilot/planner-routing.js.map +1 -0
- package/dist/autopilot/ralplan-gate.d.ts.map +1 -1
- package/dist/autopilot/ralplan-gate.js +30 -0
- package/dist/autopilot/ralplan-gate.js.map +1 -1
- package/dist/autoresearch/goal.d.ts.map +1 -1
- package/dist/autoresearch/goal.js +10 -1
- package/dist/autoresearch/goal.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-goal.test.js +33 -0
- package/dist/cli/__tests__/autoresearch-goal.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-guided.test.js +3 -0
- package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
- package/dist/cli/__tests__/codex-plugin-layout.test.js +30 -0
- package/dist/cli/__tests__/codex-plugin-layout.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-artifact-ownership.test.d.ts +2 -0
- package/dist/cli/__tests__/doctor-artifact-ownership.test.d.ts.map +1 -0
- package/dist/cli/__tests__/doctor-artifact-ownership.test.js +158 -0
- package/dist/cli/__tests__/doctor-artifact-ownership.test.js.map +1 -0
- package/dist/cli/__tests__/doctor-explore-deprecated.test.d.ts +2 -0
- package/dist/cli/__tests__/doctor-explore-deprecated.test.d.ts.map +1 -0
- package/dist/cli/__tests__/doctor-explore-deprecated.test.js +33 -0
- package/dist/cli/__tests__/doctor-explore-deprecated.test.js.map +1 -0
- package/dist/cli/__tests__/doctor-spark-routing.test.js +13 -0
- package/dist/cli/__tests__/doctor-spark-routing.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-warning-copy.test.js +132 -2
- package/dist/cli/__tests__/doctor-warning-copy.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +5 -0
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/mcp-parity.test.js +40 -0
- package/dist/cli/__tests__/mcp-parity.test.js.map +1 -1
- package/dist/cli/__tests__/nested-help-routing.test.js +4 -0
- package/dist/cli/__tests__/nested-help-routing.test.js.map +1 -1
- package/dist/cli/__tests__/package-bin-contract.test.js +7 -1
- package/dist/cli/__tests__/package-bin-contract.test.js.map +1 -1
- package/dist/cli/__tests__/performance-goal.test.js +22 -0
- package/dist/cli/__tests__/performance-goal.test.js.map +1 -1
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.d.ts +2 -0
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.d.ts.map +1 -0
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.js +64 -0
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.js.map +1 -0
- package/dist/cli/__tests__/resume.test.js +96 -0
- package/dist/cli/__tests__/resume.test.js.map +1 -1
- package/dist/cli/__tests__/session-scoped-runtime.test.js +162 -0
- package/dist/cli/__tests__/session-scoped-runtime.test.js.map +1 -1
- package/dist/cli/__tests__/session-search.test.js +36 -0
- package/dist/cli/__tests__/session-search.test.js.map +1 -1
- package/dist/cli/__tests__/setup-agents-overwrite.test.js +70 -1
- package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -1
- package/dist/cli/__tests__/setup-install-mode.test.js +33 -0
- package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +17 -3
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/ultragoal.test.js +37 -0
- package/dist/cli/__tests__/ultragoal.test.js.map +1 -1
- package/dist/cli/__tests__/update.test.js +81 -2
- package/dist/cli/__tests__/update.test.js.map +1 -1
- package/dist/cli/__tests__/url.test.d.ts +2 -0
- package/dist/cli/__tests__/url.test.d.ts.map +1 -0
- package/dist/cli/__tests__/url.test.js +82 -0
- package/dist/cli/__tests__/url.test.js.map +1 -0
- package/dist/cli/autoresearch-goal.d.ts.map +1 -1
- package/dist/cli/autoresearch-goal.js +2 -1
- package/dist/cli/autoresearch-goal.js.map +1 -1
- package/dist/cli/autoresearch-intake.d.ts.map +1 -1
- package/dist/cli/autoresearch-intake.js +2 -0
- package/dist/cli/autoresearch-intake.js.map +1 -1
- package/dist/cli/doctor.d.ts +39 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +460 -40
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +71 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/performance-goal.d.ts.map +1 -1
- package/dist/cli/performance-goal.js +4 -2
- package/dist/cli/performance-goal.js.map +1 -1
- package/dist/cli/plugin-marketplace.d.ts +1 -0
- package/dist/cli/plugin-marketplace.d.ts.map +1 -1
- package/dist/cli/plugin-marketplace.js +88 -67
- package/dist/cli/plugin-marketplace.js.map +1 -1
- package/dist/cli/project-runtime-codex-homes.d.ts +2 -0
- package/dist/cli/project-runtime-codex-homes.d.ts.map +1 -1
- package/dist/cli/project-runtime-codex-homes.js +112 -5
- package/dist/cli/project-runtime-codex-homes.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +15 -6
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/ultragoal.d.ts.map +1 -1
- package/dist/cli/ultragoal.js +5 -1
- package/dist/cli/ultragoal.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +23 -4
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/url.d.ts +8 -0
- package/dist/cli/url.d.ts.map +1 -0
- package/dist/cli/url.js +69 -0
- package/dist/cli/url.js.map +1 -0
- package/dist/config/__tests__/codex-hooks.test.js +20 -4
- package/dist/config/__tests__/codex-hooks.test.js.map +1 -1
- package/dist/config/__tests__/models.test.js +21 -1
- package/dist/config/__tests__/models.test.js.map +1 -1
- package/dist/config/codex-hooks.d.ts.map +1 -1
- package/dist/config/codex-hooks.js +1 -4
- package/dist/config/codex-hooks.js.map +1 -1
- package/dist/config/models.d.ts +5 -0
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +23 -0
- package/dist/config/models.js.map +1 -1
- package/dist/goal-workflows/codex-goal-snapshot.d.ts +2 -0
- package/dist/goal-workflows/codex-goal-snapshot.d.ts.map +1 -1
- package/dist/goal-workflows/codex-goal-snapshot.js +10 -0
- package/dist/goal-workflows/codex-goal-snapshot.js.map +1 -1
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js +7 -0
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/keyword-detector.test.js +46 -0
- package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js +100 -0
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +75 -0
- package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +225 -0
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +75 -0
- package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +563 -0
- package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js +187 -12
- package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js +225 -0
- package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js +0 -0
- package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +75 -0
- package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
- package/dist/hooks/keyword-detector.d.ts.map +1 -1
- package/dist/hooks/keyword-detector.js +4 -0
- package/dist/hooks/keyword-detector.js.map +1 -1
- package/dist/hud/__tests__/reconcile.test.js +137 -2
- package/dist/hud/__tests__/reconcile.test.js.map +1 -1
- package/dist/hud/__tests__/state.test.js +107 -0
- package/dist/hud/__tests__/state.test.js.map +1 -1
- package/dist/hud/__tests__/tmux.test.js +17 -0
- package/dist/hud/__tests__/tmux.test.js.map +1 -1
- package/dist/hud/reconcile.d.ts.map +1 -1
- package/dist/hud/reconcile.js +21 -7
- package/dist/hud/reconcile.js.map +1 -1
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +9 -0
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +43 -5
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/types.d.ts +6 -0
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/__tests__/bootstrap.test.js +24 -1
- package/dist/mcp/__tests__/bootstrap.test.js.map +1 -1
- package/dist/mcp/__tests__/state-paths.test.js +53 -0
- package/dist/mcp/__tests__/state-paths.test.js.map +1 -1
- package/dist/mcp/bootstrap.d.ts +2 -0
- package/dist/mcp/bootstrap.d.ts.map +1 -1
- package/dist/mcp/bootstrap.js +32 -6
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/state-paths.d.ts.map +1 -1
- package/dist/mcp/state-paths.js +11 -5
- package/dist/mcp/state-paths.js.map +1 -1
- package/dist/modes/__tests__/base-autopilot-gates.test.js +48 -0
- package/dist/modes/__tests__/base-autopilot-gates.test.js.map +1 -1
- package/dist/modes/base.d.ts.map +1 -1
- package/dist/modes/base.js +1 -0
- package/dist/modes/base.js.map +1 -1
- package/dist/notifications/__tests__/http-client.test.js +9 -0
- package/dist/notifications/__tests__/http-client.test.js.map +1 -1
- package/dist/notifications/http-client.js +1 -1
- package/dist/notifications/http-client.js.map +1 -1
- package/dist/performance-goal/artifacts.d.ts.map +1 -1
- package/dist/performance-goal/artifacts.js +10 -1
- package/dist/performance-goal/artifacts.js.map +1 -1
- package/dist/ralplan/__tests__/consensus-gate.test.js +112 -0
- package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -1
- package/dist/ralplan/consensus-gate.d.ts +23 -0
- package/dist/ralplan/consensus-gate.d.ts.map +1 -1
- package/dist/ralplan/consensus-gate.js +133 -21
- package/dist/ralplan/consensus-gate.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js +1251 -13
- package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
- package/dist/scripts/codex-native-hook.d.ts.map +1 -1
- package/dist/scripts/codex-native-hook.js +601 -24
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/notify-hook/team-leader-nudge.d.ts +1 -0
- package/dist/scripts/notify-hook/team-leader-nudge.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-leader-nudge.js +279 -86
- package/dist/scripts/notify-hook/team-leader-nudge.js.map +1 -1
- package/dist/scripts/notify-hook/team-tmux-guard.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-tmux-guard.js +87 -8
- package/dist/scripts/notify-hook/team-tmux-guard.js.map +1 -1
- package/dist/scripts/notify-hook/tmux-injection.js +1 -1
- package/dist/scripts/notify-hook/tmux-injection.js.map +1 -1
- package/dist/scripts/run-compiled-ci.d.ts +2 -0
- package/dist/scripts/run-compiled-ci.d.ts.map +1 -0
- package/dist/scripts/run-compiled-ci.js +77 -0
- package/dist/scripts/run-compiled-ci.js.map +1 -0
- package/dist/scripts/sync-plugin-mirror.d.ts.map +1 -1
- package/dist/scripts/sync-plugin-mirror.js +1 -0
- package/dist/scripts/sync-plugin-mirror.js.map +1 -1
- package/dist/session-history/search.d.ts.map +1 -1
- package/dist/session-history/search.js +24 -9
- package/dist/session-history/search.js.map +1 -1
- package/dist/sidecar/__tests__/args.test.d.ts +2 -0
- package/dist/sidecar/__tests__/args.test.d.ts.map +1 -0
- package/dist/sidecar/__tests__/args.test.js +18 -0
- package/dist/sidecar/__tests__/args.test.js.map +1 -0
- package/dist/sidecar/index.d.ts.map +1 -1
- package/dist/sidecar/index.js +12 -4
- package/dist/sidecar/index.js.map +1 -1
- package/dist/state/__tests__/operations.test.js +107 -3
- package/dist/state/__tests__/operations.test.js.map +1 -1
- package/dist/state/operations.d.ts.map +1 -1
- package/dist/state/operations.js +57 -2
- package/dist/state/operations.js.map +1 -1
- package/dist/team/__tests__/delivery-e2e-smoke.test.js +22 -1
- package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +57 -1
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +1468 -110
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +63 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/state.test.js +24 -1
- package/dist/team/__tests__/state.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +512 -0
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +42 -9
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/model-contract.d.ts +16 -0
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +41 -1
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +116 -30
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +9 -1
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/types.d.ts +2 -0
- package/dist/team/state/types.d.ts.map +1 -1
- package/dist/team/state/types.js.map +1 -1
- package/dist/team/state.d.ts +3 -0
- package/dist/team/state.d.ts.map +1 -1
- package/dist/team/state.js +20 -0
- package/dist/team/state.js.map +1 -1
- package/dist/team/tmux-session.d.ts +38 -3
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +275 -36
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +26 -1
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/ultragoal/__tests__/artifacts.test.js +388 -0
- package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -1
- package/dist/ultragoal/__tests__/docs-contract.test.js +3 -0
- package/dist/ultragoal/__tests__/docs-contract.test.js.map +1 -1
- package/dist/ultragoal/artifacts.d.ts +23 -0
- package/dist/ultragoal/artifacts.d.ts.map +1 -1
- package/dist/ultragoal/artifacts.js +275 -12
- package/dist/ultragoal/artifacts.js.map +1 -1
- package/dist/url-reader/__tests__/url-reader.test.d.ts +2 -0
- package/dist/url-reader/__tests__/url-reader.test.d.ts.map +1 -0
- package/dist/url-reader/__tests__/url-reader.test.js +433 -0
- package/dist/url-reader/__tests__/url-reader.test.js.map +1 -0
- package/dist/url-reader/index.d.ts +4 -0
- package/dist/url-reader/index.d.ts.map +1 -0
- package/dist/url-reader/index.js +522 -0
- package/dist/url-reader/index.js.map +1 -0
- package/dist/url-reader/types.d.ts +41 -0
- package/dist/url-reader/types.d.ts.map +1 -0
- package/dist/url-reader/types.js +2 -0
- package/dist/url-reader/types.js.map +1 -0
- package/dist/utils/__tests__/agents-md.test.js +39 -1
- package/dist/utils/__tests__/agents-md.test.js.map +1 -1
- package/dist/utils/__tests__/agents-model-table.test.js +28 -0
- package/dist/utils/__tests__/agents-model-table.test.js.map +1 -1
- package/dist/utils/agents-md.d.ts +4 -0
- package/dist/utils/agents-md.d.ts.map +1 -1
- package/dist/utils/agents-md.js +28 -0
- package/dist/utils/agents-md.js.map +1 -1
- package/dist/utils/agents-model-table.d.ts +7 -3
- package/dist/utils/agents-model-table.d.ts.map +1 -1
- package/dist/utils/agents-model-table.js +16 -8
- package/dist/utils/agents-model-table.js.map +1 -1
- package/dist/utils/platform-command.d.ts +7 -1
- package/dist/utils/platform-command.d.ts.map +1 -1
- package/dist/utils/platform-command.js +12 -1
- package/dist/utils/platform-command.js.map +1 -1
- package/dist/verification/__tests__/ci-rust-gates.test.js +4 -0
- package/dist/verification/__tests__/ci-rust-gates.test.js.map +1 -1
- package/dist/vscode/__tests__/index.test.d.ts +2 -0
- package/dist/vscode/__tests__/index.test.d.ts.map +1 -0
- package/dist/vscode/__tests__/index.test.js +236 -0
- package/dist/vscode/__tests__/index.test.js.map +1 -0
- package/dist/vscode/index.d.ts +76 -0
- package/dist/vscode/index.d.ts.map +1 -0
- package/dist/vscode/index.js +196 -0
- package/dist/vscode/index.js.map +1 -0
- package/package.json +3 -3
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/oh-my-codex/hooks/codex-native-hook.mjs +59 -8
- package/plugins/oh-my-codex/skills/autopilot/SKILL.md +9 -5
- package/plugins/oh-my-codex/skills/autoresearch-goal/SKILL.md +3 -0
- package/plugins/oh-my-codex/skills/performance-goal/SKILL.md +3 -0
- package/plugins/oh-my-codex/skills/ralplan/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/ultragoal/SKILL.md +22 -4
- package/plugins/oh-my-codex/skills/ultrawork/SKILL.md +2 -2
- package/plugins/oh-my-codex/skills/ultrawork/references/agent-tiers.md +61 -0
- package/skills/autopilot/SKILL.md +9 -5
- package/skills/autoresearch-goal/SKILL.md +3 -0
- package/skills/ecomode/SKILL.md +1 -1
- package/skills/ecomode/references/agent-tiers.md +61 -0
- package/skills/performance-goal/SKILL.md +3 -0
- package/skills/ralplan/SKILL.md +1 -1
- package/skills/ultragoal/SKILL.md +22 -4
- package/skills/ultrawork/SKILL.md +2 -2
- package/skills/ultrawork/references/agent-tiers.md +61 -0
- package/src/scripts/__tests__/codex-native-hook.test.ts +1560 -181
- package/src/scripts/codex-native-hook.ts +663 -24
- package/src/scripts/notify-hook/team-leader-nudge.ts +298 -91
- package/src/scripts/notify-hook/team-tmux-guard.ts +92 -8
- package/src/scripts/notify-hook/tmux-injection.ts +1 -1
- package/src/scripts/run-compiled-ci.ts +85 -0
- package/src/scripts/sync-plugin-mirror.ts +1 -0
- package/templates/AGENTS.md +6 -0
|
@@ -6,6 +6,7 @@ import { existsSync } from 'node:fs';
|
|
|
6
6
|
import { tmpdir } from 'node:os';
|
|
7
7
|
import { join } from 'node:path';
|
|
8
8
|
import { initTeamState, enqueueDispatchRequest, readDispatchRequest } from '../../team/state.js';
|
|
9
|
+
import { maybeNudgeTeamLeader, setLeaderNudgeTestHooksForTests } from '../../scripts/notify-hook/team-leader-nudge.js';
|
|
9
10
|
const NOTIFY_HOOK_SCRIPT = new URL('../../../dist/scripts/notify-hook.js', import.meta.url);
|
|
10
11
|
async function withTempWorkingDir(run) {
|
|
11
12
|
const cwd = await mkdtemp(join(tmpdir(), 'omx-notify-team-nudge-'));
|
|
@@ -92,6 +93,63 @@ async function writeCanonicalTeamFixture(cwd, { teamName, sessionId, ownerSessio
|
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}
|
|
96
|
+
async function withProcessEnv(env, run) {
|
|
97
|
+
const previous = {};
|
|
98
|
+
for (const [key, value] of Object.entries(env)) {
|
|
99
|
+
previous[key] = process.env[key];
|
|
100
|
+
process.env[key] = value;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await run();
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
for (const [key, value] of Object.entries(previous)) {
|
|
107
|
+
if (value === undefined)
|
|
108
|
+
delete process.env[key];
|
|
109
|
+
else
|
|
110
|
+
process.env[key] = value;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function writeLeaderNudgeRaceFixture(cwd, teamName) {
|
|
115
|
+
const stateDir = join(cwd, '.omx', 'state');
|
|
116
|
+
const logsDir = join(cwd, '.omx', 'logs');
|
|
117
|
+
const teamDir = join(stateDir, 'team', teamName);
|
|
118
|
+
await mkdir(join(teamDir, 'mailbox'), { recursive: true });
|
|
119
|
+
await mkdir(logsDir, { recursive: true });
|
|
120
|
+
await writeJson(join(stateDir, 'team-state.json'), {
|
|
121
|
+
active: true,
|
|
122
|
+
team_name: teamName,
|
|
123
|
+
current_phase: 'team-exec',
|
|
124
|
+
});
|
|
125
|
+
await writeJson(join(teamDir, 'config.json'), {
|
|
126
|
+
name: teamName,
|
|
127
|
+
tmux_session: `${teamName}:0`,
|
|
128
|
+
leader_pane_id: '',
|
|
129
|
+
workers: [{ name: 'worker-1', index: 1, pane_id: '%11' }],
|
|
130
|
+
});
|
|
131
|
+
await mkdir(join(teamDir, 'workers', 'worker-1'), { recursive: true });
|
|
132
|
+
await writeJson(join(teamDir, 'workers', 'worker-1', 'status.json'), {
|
|
133
|
+
state: 'idle',
|
|
134
|
+
updated_at: new Date().toISOString(),
|
|
135
|
+
});
|
|
136
|
+
await writeJson(join(teamDir, 'mailbox', 'leader-fixed.json'), {
|
|
137
|
+
worker: 'leader-fixed',
|
|
138
|
+
messages: [
|
|
139
|
+
{
|
|
140
|
+
message_id: `${teamName}-msg-1`,
|
|
141
|
+
from_worker: 'worker-1',
|
|
142
|
+
to_worker: 'leader-fixed',
|
|
143
|
+
body: 'please review',
|
|
144
|
+
created_at: '2026-02-14T00:00:00.000Z',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async function readNudgeState(cwd) {
|
|
150
|
+
const nudgeStatePath = join(cwd, '.omx', 'state', 'team-leader-nudge.json');
|
|
151
|
+
return JSON.parse(await readFile(nudgeStatePath, 'utf-8'));
|
|
152
|
+
}
|
|
95
153
|
async function readTeamDeliveryLog(cwd) {
|
|
96
154
|
const path = join(cwd, '.omx', 'logs', `team-delivery-${new Date().toISOString().slice(0, 10)}.jsonl`);
|
|
97
155
|
const raw = await readFile(path, 'utf-8').catch(() => '');
|
|
@@ -110,6 +168,31 @@ shift || true
|
|
|
110
168
|
if [[ "$cmd" == "display-message" ]]; then
|
|
111
169
|
exit 0
|
|
112
170
|
fi
|
|
171
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
172
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
173
|
+
exit 0
|
|
174
|
+
fi
|
|
175
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
176
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
177
|
+
exit 0
|
|
178
|
+
fi
|
|
179
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
180
|
+
target=""
|
|
181
|
+
while [[ "$#" -gt 0 ]]; do
|
|
182
|
+
case "$1" in
|
|
183
|
+
-t) target="$2"; shift 2 ;;
|
|
184
|
+
*) shift ;;
|
|
185
|
+
esac
|
|
186
|
+
done
|
|
187
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
188
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
189
|
+
fi
|
|
190
|
+
exit 0
|
|
191
|
+
fi
|
|
192
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
193
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
194
|
+
exit 0
|
|
195
|
+
fi
|
|
113
196
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
114
197
|
exit 0
|
|
115
198
|
fi
|
|
@@ -133,6 +216,31 @@ shift || true
|
|
|
133
216
|
if [[ "$cmd" == "display-message" ]]; then
|
|
134
217
|
exit 0
|
|
135
218
|
fi
|
|
219
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
220
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
221
|
+
exit 0
|
|
222
|
+
fi
|
|
223
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
224
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
225
|
+
exit 0
|
|
226
|
+
fi
|
|
227
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
228
|
+
target=""
|
|
229
|
+
while [[ "$#" -gt 0 ]]; do
|
|
230
|
+
case "$1" in
|
|
231
|
+
-t) target="$2"; shift 2 ;;
|
|
232
|
+
*) shift ;;
|
|
233
|
+
esac
|
|
234
|
+
done
|
|
235
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
236
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
237
|
+
fi
|
|
238
|
+
exit 0
|
|
239
|
+
fi
|
|
240
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
241
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
242
|
+
exit 0
|
|
243
|
+
fi
|
|
136
244
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
137
245
|
exit 0
|
|
138
246
|
fi
|
|
@@ -853,6 +961,311 @@ describe('notify-hook team leader nudge', () => {
|
|
|
853
961
|
&& entry.result === 'sent'));
|
|
854
962
|
});
|
|
855
963
|
});
|
|
964
|
+
it('suppresses leader mailbox nudge when team state disappears before injection', async () => {
|
|
965
|
+
await withTempWorkingDir(async (cwd) => {
|
|
966
|
+
const omxDir = join(cwd, '.omx');
|
|
967
|
+
const stateDir = join(omxDir, 'state');
|
|
968
|
+
const logsDir = join(omxDir, 'logs');
|
|
969
|
+
const teamName = 'leader-nudge-teardown-race';
|
|
970
|
+
const teamDir = join(stateDir, 'team', teamName);
|
|
971
|
+
const mailboxDir = join(teamDir, 'mailbox');
|
|
972
|
+
const fakeBinDir = join(cwd, 'fake-bin');
|
|
973
|
+
const fakeTmuxPath = join(fakeBinDir, 'tmux');
|
|
974
|
+
const tmuxLogPath = join(cwd, 'tmux.log');
|
|
975
|
+
await mkdir(logsDir, { recursive: true });
|
|
976
|
+
await mkdir(mailboxDir, { recursive: true });
|
|
977
|
+
await mkdir(fakeBinDir, { recursive: true });
|
|
978
|
+
await writeJson(join(stateDir, 'team-state.json'), {
|
|
979
|
+
active: true,
|
|
980
|
+
team_name: teamName,
|
|
981
|
+
current_phase: 'team-exec',
|
|
982
|
+
});
|
|
983
|
+
await writeJson(join(teamDir, 'config.json'), {
|
|
984
|
+
name: teamName,
|
|
985
|
+
tmux_session: 'leader-nudge-teardown-race:0',
|
|
986
|
+
leader_pane_id: '%91',
|
|
987
|
+
workers: [{ name: 'worker-1', index: 1, pane_id: '%11' }],
|
|
988
|
+
});
|
|
989
|
+
await writeJson(join(mailboxDir, 'leader-fixed.json'), {
|
|
990
|
+
worker: 'leader-fixed',
|
|
991
|
+
messages: [
|
|
992
|
+
{
|
|
993
|
+
message_id: 'late-after-shutdown',
|
|
994
|
+
from_worker: 'worker-1',
|
|
995
|
+
to_worker: 'leader-fixed',
|
|
996
|
+
body: 'Done; please review',
|
|
997
|
+
created_at: '2026-02-14T00:00:00.000Z',
|
|
998
|
+
},
|
|
999
|
+
],
|
|
1000
|
+
});
|
|
1001
|
+
const quotedTeamDir = JSON.stringify(teamDir);
|
|
1002
|
+
await writeFile(fakeTmuxPath, `#!/usr/bin/env bash
|
|
1003
|
+
set -eu
|
|
1004
|
+
echo "$@" >> "${tmuxLogPath}"
|
|
1005
|
+
cmd="$1"
|
|
1006
|
+
shift || true
|
|
1007
|
+
if [[ "$cmd" == "display-message" ]]; then
|
|
1008
|
+
target=""
|
|
1009
|
+
format=""
|
|
1010
|
+
while (($#)); do
|
|
1011
|
+
case "$1" in
|
|
1012
|
+
-p) shift ;;
|
|
1013
|
+
-t) target="$2"; shift 2 ;;
|
|
1014
|
+
*) format="$1"; shift ;;
|
|
1015
|
+
esac
|
|
1016
|
+
done
|
|
1017
|
+
case "$format" in
|
|
1018
|
+
"#{pane_id}") echo "$target" ;;
|
|
1019
|
+
"#{pane_in_mode}") echo "0" ;;
|
|
1020
|
+
"#{pane_current_command}") echo "codex" ;;
|
|
1021
|
+
"#{pane_start_command}") echo "codex" ;;
|
|
1022
|
+
"#S") echo "leader-nudge-teardown-race" ;;
|
|
1023
|
+
*) echo "" ;;
|
|
1024
|
+
esac
|
|
1025
|
+
exit 0
|
|
1026
|
+
fi
|
|
1027
|
+
if [[ "$cmd" == "list-panes" ]]; then
|
|
1028
|
+
echo "%11 12345"
|
|
1029
|
+
exit 0
|
|
1030
|
+
fi
|
|
1031
|
+
if [[ "$cmd" == "capture-pane" ]]; then
|
|
1032
|
+
rm -rf ${quotedTeamDir}
|
|
1033
|
+
echo "› Ready"
|
|
1034
|
+
exit 0
|
|
1035
|
+
fi
|
|
1036
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1037
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1038
|
+
exit 0
|
|
1039
|
+
fi
|
|
1040
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1041
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1042
|
+
exit 0
|
|
1043
|
+
fi
|
|
1044
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1045
|
+
target=""
|
|
1046
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1047
|
+
case "$1" in
|
|
1048
|
+
-t) target="$2"; shift 2 ;;
|
|
1049
|
+
*) shift ;;
|
|
1050
|
+
esac
|
|
1051
|
+
done
|
|
1052
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1053
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1054
|
+
fi
|
|
1055
|
+
exit 0
|
|
1056
|
+
fi
|
|
1057
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
1058
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
1059
|
+
exit 0
|
|
1060
|
+
fi
|
|
1061
|
+
if [[ "$cmd" == "send-keys" ]]; then
|
|
1062
|
+
exit 0
|
|
1063
|
+
fi
|
|
1064
|
+
exit 0
|
|
1065
|
+
`);
|
|
1066
|
+
await chmod(fakeTmuxPath, 0o755);
|
|
1067
|
+
const result = runNotifyHook(cwd, fakeBinDir);
|
|
1068
|
+
assert.equal(result.status, 0, `notify-hook failed: ${result.stderr || result.stdout}`);
|
|
1069
|
+
assert.equal(existsSync(teamDir), false, 'teardown race should remove the canonical team state');
|
|
1070
|
+
const tmuxLog = await readFile(tmuxLogPath, 'utf-8');
|
|
1071
|
+
assert.doesNotMatch(tmuxLog, /send-keys -t %91 -l Team leader-nudge-teardown-race:/);
|
|
1072
|
+
assert.doesNotMatch(tmuxLog, /paste-buffer -t %91/);
|
|
1073
|
+
const nudgeStatePath = join(stateDir, 'team-leader-nudge.json');
|
|
1074
|
+
if (existsSync(nudgeStatePath)) {
|
|
1075
|
+
const nudgeState = JSON.parse(await readFile(nudgeStatePath, 'utf-8'));
|
|
1076
|
+
assert.equal(nudgeState.progress_by_team?.[teamName], undefined);
|
|
1077
|
+
assert.equal(nudgeState.last_nudged_by_team?.[teamName], undefined);
|
|
1078
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[teamName], undefined);
|
|
1079
|
+
}
|
|
1080
|
+
assert.equal(existsSync(join(teamDir, 'leader-attention.json')), false, 'removed team must not get recreated by leader-attention bookkeeping');
|
|
1081
|
+
const deliveryLog = await readTeamDeliveryLog(cwd);
|
|
1082
|
+
assert.ok(deliveryLog.some((entry) => entry.event === 'nudge_triggered'
|
|
1083
|
+
&& entry.team === teamName
|
|
1084
|
+
&& entry.to_worker === 'leader-fixed'
|
|
1085
|
+
&& entry.transport === 'none'
|
|
1086
|
+
&& entry.result === 'suppressed'
|
|
1087
|
+
&& entry.reason === 'team_state_gone_or_shutdown'), 'teardown-race leader mailbox nudge should be diagnostic suppression, not an actionable injection');
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
it('does not persist bookkeeping when team is removed after the final liveness check', async () => {
|
|
1091
|
+
await withTempWorkingDir(async (cwd) => {
|
|
1092
|
+
const omxDir = join(cwd, '.omx');
|
|
1093
|
+
const stateDir = join(omxDir, 'state');
|
|
1094
|
+
const logsDir = join(omxDir, 'logs');
|
|
1095
|
+
const teamName = 'leader-nudge-late-persist-race';
|
|
1096
|
+
const teamDir = join(stateDir, 'team', teamName);
|
|
1097
|
+
const mailboxDir = join(teamDir, 'mailbox');
|
|
1098
|
+
const fakeBinDir = join(cwd, 'fake-bin');
|
|
1099
|
+
const fakeTmuxPath = join(fakeBinDir, 'tmux');
|
|
1100
|
+
const tmuxLogPath = join(cwd, 'tmux.log');
|
|
1101
|
+
await mkdir(logsDir, { recursive: true });
|
|
1102
|
+
await mkdir(mailboxDir, { recursive: true });
|
|
1103
|
+
await mkdir(fakeBinDir, { recursive: true });
|
|
1104
|
+
await writeJson(join(stateDir, 'team-state.json'), {
|
|
1105
|
+
active: true,
|
|
1106
|
+
team_name: teamName,
|
|
1107
|
+
current_phase: 'team-exec',
|
|
1108
|
+
});
|
|
1109
|
+
await writeJson(join(teamDir, 'config.json'), {
|
|
1110
|
+
name: teamName,
|
|
1111
|
+
tmux_session: 'leader-nudge-late-persist-race:0',
|
|
1112
|
+
leader_pane_id: '%91',
|
|
1113
|
+
workers: [{ name: 'worker-1', index: 1, pane_id: '%11' }],
|
|
1114
|
+
});
|
|
1115
|
+
await writeJson(join(mailboxDir, 'leader-fixed.json'), {
|
|
1116
|
+
worker: 'leader-fixed',
|
|
1117
|
+
messages: [
|
|
1118
|
+
{
|
|
1119
|
+
message_id: 'late-persist-race',
|
|
1120
|
+
from_worker: 'worker-1',
|
|
1121
|
+
to_worker: 'leader-fixed',
|
|
1122
|
+
body: 'please review before shutdown completes',
|
|
1123
|
+
created_at: '2026-02-14T00:00:00.000Z',
|
|
1124
|
+
},
|
|
1125
|
+
],
|
|
1126
|
+
});
|
|
1127
|
+
await writeFile(fakeTmuxPath, buildFakeTmuxWithListPanes(tmuxLogPath, ['%11 12345']));
|
|
1128
|
+
await chmod(fakeTmuxPath, 0o755);
|
|
1129
|
+
try {
|
|
1130
|
+
setLeaderNudgeTestHooksForTests({
|
|
1131
|
+
beforeLeaderAttentionRename: async () => {
|
|
1132
|
+
await rm(teamDir, { recursive: true, force: true });
|
|
1133
|
+
},
|
|
1134
|
+
});
|
|
1135
|
+
await withProcessEnv({
|
|
1136
|
+
PATH: `${fakeBinDir}:${process.env.PATH || ''}`,
|
|
1137
|
+
OMX_TEAM_LEADER_NUDGE_MS: '10000',
|
|
1138
|
+
OMX_TEAM_LEADER_STALE_MS: '10000',
|
|
1139
|
+
}, async () => {
|
|
1140
|
+
await maybeNudgeTeamLeader({
|
|
1141
|
+
cwd,
|
|
1142
|
+
stateDir,
|
|
1143
|
+
logsDir,
|
|
1144
|
+
preComputedLeaderStale: true,
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
finally {
|
|
1149
|
+
setLeaderNudgeTestHooksForTests();
|
|
1150
|
+
}
|
|
1151
|
+
assert.equal(existsSync(teamDir), false, 'test seam should remove canonical team state during persistence');
|
|
1152
|
+
assert.equal(existsSync(join(teamDir, 'leader-attention.json')), false, 'guarded persistence must not recreate leader-attention.json for the removed team');
|
|
1153
|
+
const nudgeStatePath = join(stateDir, 'team-leader-nudge.json');
|
|
1154
|
+
if (existsSync(nudgeStatePath)) {
|
|
1155
|
+
const nudgeState = JSON.parse(await readFile(nudgeStatePath, 'utf-8'));
|
|
1156
|
+
assert.equal(nudgeState.progress_by_team?.[teamName], undefined);
|
|
1157
|
+
assert.equal(nudgeState.last_nudged_by_team?.[teamName], undefined);
|
|
1158
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[teamName], undefined);
|
|
1159
|
+
}
|
|
1160
|
+
const deliveryLog = await readTeamDeliveryLog(cwd);
|
|
1161
|
+
assert.ok(deliveryLog.some((entry) => entry.event === 'nudge_triggered'
|
|
1162
|
+
&& entry.team === teamName
|
|
1163
|
+
&& entry.to_worker === 'leader-fixed'
|
|
1164
|
+
&& entry.transport === 'none'
|
|
1165
|
+
&& entry.result === 'suppressed'
|
|
1166
|
+
&& entry.reason === 'team_state_gone_or_shutdown'), 'late persistence race should emit diagnostic suppression instead of stale bookkeeping');
|
|
1167
|
+
});
|
|
1168
|
+
});
|
|
1169
|
+
it('rolls back team nudge bookkeeping when shutdown wins immediately before global nudge-state write', async () => {
|
|
1170
|
+
await withTempWorkingDir(async (cwd) => {
|
|
1171
|
+
const stateDir = join(cwd, '.omx', 'state');
|
|
1172
|
+
const logsDir = join(cwd, '.omx', 'logs');
|
|
1173
|
+
const teamName = 'nudge-before-global-race';
|
|
1174
|
+
const preservedTeam = 'preserved-live-team';
|
|
1175
|
+
const fakeBinDir = join(cwd, 'fake-bin');
|
|
1176
|
+
const fakeTmuxPath = join(fakeBinDir, 'tmux');
|
|
1177
|
+
await writeLeaderNudgeRaceFixture(cwd, teamName);
|
|
1178
|
+
await mkdir(fakeBinDir, { recursive: true });
|
|
1179
|
+
await writeFile(fakeTmuxPath, buildFakeTmuxWithListPanes(join(cwd, 'tmux.log'), ['%11 12345']));
|
|
1180
|
+
await chmod(fakeTmuxPath, 0o755);
|
|
1181
|
+
await writeJson(join(stateDir, 'team-leader-nudge.json'), {
|
|
1182
|
+
progress_by_team: { [preservedTeam]: { signature: 'keep' } },
|
|
1183
|
+
last_nudged_by_team: { [preservedTeam]: { at: '2026-02-14T00:00:00.000Z' } },
|
|
1184
|
+
last_idle_nudged_by_team: { [preservedTeam]: { at: '2026-02-14T00:00:00.000Z' } },
|
|
1185
|
+
});
|
|
1186
|
+
try {
|
|
1187
|
+
setLeaderNudgeTestHooksForTests({
|
|
1188
|
+
beforeGlobalNudgeStateRename: async () => {
|
|
1189
|
+
await rm(join(stateDir, 'team', teamName), { recursive: true, force: true });
|
|
1190
|
+
},
|
|
1191
|
+
});
|
|
1192
|
+
await withProcessEnv({
|
|
1193
|
+
PATH: `${fakeBinDir}:${process.env.PATH || ''}`,
|
|
1194
|
+
OMX_TEAM_LEADER_NUDGE_MS: '10000',
|
|
1195
|
+
OMX_TEAM_LEADER_STALE_MS: '10000',
|
|
1196
|
+
}, async () => {
|
|
1197
|
+
await maybeNudgeTeamLeader({
|
|
1198
|
+
cwd,
|
|
1199
|
+
stateDir,
|
|
1200
|
+
logsDir,
|
|
1201
|
+
preComputedLeaderStale: true,
|
|
1202
|
+
});
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
finally {
|
|
1206
|
+
setLeaderNudgeTestHooksForTests();
|
|
1207
|
+
}
|
|
1208
|
+
assert.equal(existsSync(join(stateDir, 'team', teamName)), false);
|
|
1209
|
+
assert.equal(existsSync(join(stateDir, 'team', teamName, 'leader-attention.json')), false);
|
|
1210
|
+
const nudgeState = await readNudgeState(cwd);
|
|
1211
|
+
assert.equal(nudgeState.progress_by_team?.[teamName], undefined);
|
|
1212
|
+
assert.equal(nudgeState.last_nudged_by_team?.[teamName], undefined);
|
|
1213
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[teamName], undefined);
|
|
1214
|
+
assert.deepEqual(nudgeState.progress_by_team?.[preservedTeam], { signature: 'keep' });
|
|
1215
|
+
assert.equal(nudgeState.last_nudged_by_team?.[preservedTeam]?.at, '2026-02-14T00:00:00.000Z');
|
|
1216
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[preservedTeam]?.at, '2026-02-14T00:00:00.000Z');
|
|
1217
|
+
});
|
|
1218
|
+
});
|
|
1219
|
+
it('rolls back team nudge bookkeeping when shutdown wins during global nudge-state write', async () => {
|
|
1220
|
+
await withTempWorkingDir(async (cwd) => {
|
|
1221
|
+
const stateDir = join(cwd, '.omx', 'state');
|
|
1222
|
+
const logsDir = join(cwd, '.omx', 'logs');
|
|
1223
|
+
const teamName = 'nudge-during-global-race';
|
|
1224
|
+
const preservedTeam = 'preserved-live-team';
|
|
1225
|
+
const fakeBinDir = join(cwd, 'fake-bin');
|
|
1226
|
+
const fakeTmuxPath = join(fakeBinDir, 'tmux');
|
|
1227
|
+
await writeLeaderNudgeRaceFixture(cwd, teamName);
|
|
1228
|
+
await mkdir(fakeBinDir, { recursive: true });
|
|
1229
|
+
await writeFile(fakeTmuxPath, buildFakeTmuxWithListPanes(join(cwd, 'tmux.log'), ['%11 12345']));
|
|
1230
|
+
await chmod(fakeTmuxPath, 0o755);
|
|
1231
|
+
await writeJson(join(stateDir, 'team-leader-nudge.json'), {
|
|
1232
|
+
progress_by_team: { [preservedTeam]: { signature: 'keep' } },
|
|
1233
|
+
last_nudged_by_team: { [preservedTeam]: { at: '2026-02-14T00:00:00.000Z' } },
|
|
1234
|
+
last_idle_nudged_by_team: { [preservedTeam]: { at: '2026-02-14T00:00:00.000Z' } },
|
|
1235
|
+
});
|
|
1236
|
+
try {
|
|
1237
|
+
setLeaderNudgeTestHooksForTests({
|
|
1238
|
+
afterGlobalNudgeStateRename: async () => {
|
|
1239
|
+
await rm(join(stateDir, 'team', teamName), { recursive: true, force: true });
|
|
1240
|
+
},
|
|
1241
|
+
});
|
|
1242
|
+
await withProcessEnv({
|
|
1243
|
+
PATH: `${fakeBinDir}:${process.env.PATH || ''}`,
|
|
1244
|
+
OMX_TEAM_LEADER_NUDGE_MS: '10000',
|
|
1245
|
+
OMX_TEAM_LEADER_STALE_MS: '10000',
|
|
1246
|
+
}, async () => {
|
|
1247
|
+
await maybeNudgeTeamLeader({
|
|
1248
|
+
cwd,
|
|
1249
|
+
stateDir,
|
|
1250
|
+
logsDir,
|
|
1251
|
+
preComputedLeaderStale: true,
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
finally {
|
|
1256
|
+
setLeaderNudgeTestHooksForTests();
|
|
1257
|
+
}
|
|
1258
|
+
assert.equal(existsSync(join(stateDir, 'team', teamName)), false);
|
|
1259
|
+
assert.equal(existsSync(join(stateDir, 'team', teamName, 'leader-attention.json')), false);
|
|
1260
|
+
const nudgeState = await readNudgeState(cwd);
|
|
1261
|
+
assert.equal(nudgeState.progress_by_team?.[teamName], undefined);
|
|
1262
|
+
assert.equal(nudgeState.last_nudged_by_team?.[teamName], undefined);
|
|
1263
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[teamName], undefined);
|
|
1264
|
+
assert.deepEqual(nudgeState.progress_by_team?.[preservedTeam], { signature: 'keep' });
|
|
1265
|
+
assert.equal(nudgeState.last_nudged_by_team?.[preservedTeam]?.at, '2026-02-14T00:00:00.000Z');
|
|
1266
|
+
assert.equal(nudgeState.last_idle_nudged_by_team?.[preservedTeam]?.at, '2026-02-14T00:00:00.000Z');
|
|
1267
|
+
});
|
|
1268
|
+
});
|
|
856
1269
|
it('injects leader nudge into a busy live Codex pane so the message can queue', async () => {
|
|
857
1270
|
await withTempWorkingDir(async (cwd) => {
|
|
858
1271
|
const omxDir = join(cwd, '.omx');
|
|
@@ -922,6 +1335,31 @@ OpenAI Codex
|
|
|
922
1335
|
EOF
|
|
923
1336
|
exit 0
|
|
924
1337
|
fi
|
|
1338
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1339
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1340
|
+
exit 0
|
|
1341
|
+
fi
|
|
1342
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1343
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1344
|
+
exit 0
|
|
1345
|
+
fi
|
|
1346
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1347
|
+
target=""
|
|
1348
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1349
|
+
case "$1" in
|
|
1350
|
+
-t) target="$2"; shift 2 ;;
|
|
1351
|
+
*) shift ;;
|
|
1352
|
+
esac
|
|
1353
|
+
done
|
|
1354
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1355
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1356
|
+
fi
|
|
1357
|
+
exit 0
|
|
1358
|
+
fi
|
|
1359
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
1360
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
1361
|
+
exit 0
|
|
1362
|
+
fi
|
|
925
1363
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
926
1364
|
exit 0
|
|
927
1365
|
fi
|
|
@@ -1192,6 +1630,31 @@ if [[ "$cmd" == "display-message" ]]; then
|
|
|
1192
1630
|
fi
|
|
1193
1631
|
exit 0
|
|
1194
1632
|
fi
|
|
1633
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1634
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1635
|
+
exit 0
|
|
1636
|
+
fi
|
|
1637
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1638
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1639
|
+
exit 0
|
|
1640
|
+
fi
|
|
1641
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1642
|
+
target=""
|
|
1643
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1644
|
+
case "$1" in
|
|
1645
|
+
-t) target="$2"; shift 2 ;;
|
|
1646
|
+
*) shift ;;
|
|
1647
|
+
esac
|
|
1648
|
+
done
|
|
1649
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1650
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1651
|
+
fi
|
|
1652
|
+
exit 0
|
|
1653
|
+
fi
|
|
1654
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
1655
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
1656
|
+
exit 0
|
|
1657
|
+
fi
|
|
1195
1658
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
1196
1659
|
exit 0
|
|
1197
1660
|
fi
|
|
@@ -1280,6 +1743,31 @@ if [[ "$cmd" == "capture-pane" ]]; then
|
|
|
1280
1743
|
printf "• Running tests (3m 12s • esc to interrupt)\\n"
|
|
1281
1744
|
exit 0
|
|
1282
1745
|
fi
|
|
1746
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1747
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1748
|
+
exit 0
|
|
1749
|
+
fi
|
|
1750
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1751
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1752
|
+
exit 0
|
|
1753
|
+
fi
|
|
1754
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1755
|
+
target=""
|
|
1756
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1757
|
+
case "$1" in
|
|
1758
|
+
-t) target="$2"; shift 2 ;;
|
|
1759
|
+
*) shift ;;
|
|
1760
|
+
esac
|
|
1761
|
+
done
|
|
1762
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1763
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1764
|
+
fi
|
|
1765
|
+
exit 0
|
|
1766
|
+
fi
|
|
1767
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
1768
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
1769
|
+
exit 0
|
|
1770
|
+
fi
|
|
1283
1771
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
1284
1772
|
exit 0
|
|
1285
1773
|
fi
|
|
@@ -1372,6 +1860,31 @@ if [[ "$cmd" == "capture-pane" ]]; then
|
|
|
1372
1860
|
echo "capture failed" >&2
|
|
1373
1861
|
exit 1
|
|
1374
1862
|
fi
|
|
1863
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1864
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1865
|
+
exit 0
|
|
1866
|
+
fi
|
|
1867
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1868
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1869
|
+
exit 0
|
|
1870
|
+
fi
|
|
1871
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1872
|
+
target=""
|
|
1873
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1874
|
+
case "$1" in
|
|
1875
|
+
-t) target="$2"; shift 2 ;;
|
|
1876
|
+
*) shift ;;
|
|
1877
|
+
esac
|
|
1878
|
+
done
|
|
1879
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1880
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1881
|
+
fi
|
|
1882
|
+
exit 0
|
|
1883
|
+
fi
|
|
1884
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
1885
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
1886
|
+
exit 0
|
|
1887
|
+
fi
|
|
1375
1888
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
1376
1889
|
exit 0
|
|
1377
1890
|
fi
|
|
@@ -1463,6 +1976,31 @@ Team same-classified-state: 1 msg(s) for leader. Next: read messages; keep orche
|
|
|
1463
1976
|
EOF
|
|
1464
1977
|
exit 0
|
|
1465
1978
|
fi
|
|
1979
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
1980
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
1981
|
+
exit 0
|
|
1982
|
+
fi
|
|
1983
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
1984
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
1985
|
+
exit 0
|
|
1986
|
+
fi
|
|
1987
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
1988
|
+
target=""
|
|
1989
|
+
while [[ "$#" -gt 0 ]]; do
|
|
1990
|
+
case "$1" in
|
|
1991
|
+
-t) target="$2"; shift 2 ;;
|
|
1992
|
+
*) shift ;;
|
|
1993
|
+
esac
|
|
1994
|
+
done
|
|
1995
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
1996
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
1997
|
+
fi
|
|
1998
|
+
exit 0
|
|
1999
|
+
fi
|
|
2000
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
2001
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
2002
|
+
exit 0
|
|
2003
|
+
fi
|
|
1466
2004
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
1467
2005
|
exit 0
|
|
1468
2006
|
fi
|
|
@@ -1554,6 +2092,31 @@ if [[ "$cmd" == "display-message" ]]; then
|
|
|
1554
2092
|
fi
|
|
1555
2093
|
exit 0
|
|
1556
2094
|
fi
|
|
2095
|
+
if [[ "$cmd" == "set-buffer" ]]; then
|
|
2096
|
+
printf '%s' "\${@: -1}" > "${tmuxLogPath}.buffer"
|
|
2097
|
+
exit 0
|
|
2098
|
+
fi
|
|
2099
|
+
if [[ "$cmd" == "show-buffer" ]]; then
|
|
2100
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then cat "${tmuxLogPath}.buffer"; fi
|
|
2101
|
+
exit 0
|
|
2102
|
+
fi
|
|
2103
|
+
if [[ "$cmd" == "paste-buffer" ]]; then
|
|
2104
|
+
target=""
|
|
2105
|
+
while [[ "$#" -gt 0 ]]; do
|
|
2106
|
+
case "$1" in
|
|
2107
|
+
-t) target="$2"; shift 2 ;;
|
|
2108
|
+
*) shift ;;
|
|
2109
|
+
esac
|
|
2110
|
+
done
|
|
2111
|
+
if [[ -f "${tmuxLogPath}.buffer" ]]; then
|
|
2112
|
+
echo "send-keys -t \${target} -l $(cat "${tmuxLogPath}.buffer")" >> "${tmuxLogPath}"
|
|
2113
|
+
fi
|
|
2114
|
+
exit 0
|
|
2115
|
+
fi
|
|
2116
|
+
if [[ "$cmd" == "delete-buffer" ]]; then
|
|
2117
|
+
rm -f "${tmuxLogPath}.buffer"
|
|
2118
|
+
exit 0
|
|
2119
|
+
fi
|
|
1557
2120
|
if [[ "$cmd" == "send-keys" ]]; then
|
|
1558
2121
|
exit 0
|
|
1559
2122
|
fi
|