oh-my-codex 0.11.13 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +5 -5
- package/Cargo.toml +1 -1
- package/README.md +27 -17
- package/crates/omx-runtime/src/main.rs +6 -2
- package/dist/agents/native-config.js +1 -1
- package/dist/agents/native-config.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-guided.test.js +74 -2
- package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -1
- package/dist/cli/__tests__/cleanup.test.js +22 -30
- package/dist/cli/__tests__/cleanup.test.js.map +1 -1
- package/dist/cli/__tests__/error-handling-warnings.test.js +3 -1
- package/dist/cli/__tests__/error-handling-warnings.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +217 -4
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/setup-refresh.test.js +49 -9
- package/dist/cli/__tests__/setup-refresh.test.js.map +1 -1
- package/dist/cli/__tests__/setup-scope.test.js +9 -0
- package/dist/cli/__tests__/setup-scope.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +136 -11
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/uninstall.test.js +10 -0
- package/dist/cli/__tests__/uninstall.test.js.map +1 -1
- package/dist/cli/__tests__/windows-popup-loop-contract.test.js +1 -0
- package/dist/cli/__tests__/windows-popup-loop-contract.test.js.map +1 -1
- package/dist/cli/autoresearch-guided.d.ts.map +1 -1
- package/dist/cli/autoresearch-guided.js +2 -1
- package/dist/cli/autoresearch-guided.js.map +1 -1
- package/dist/cli/autoresearch.d.ts.map +1 -1
- package/dist/cli/autoresearch.js +2 -1
- package/dist/cli/autoresearch.js.map +1 -1
- package/dist/cli/cleanup.d.ts.map +1 -1
- package/dist/cli/cleanup.js +4 -2
- package/dist/cli/cleanup.js.map +1 -1
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +238 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/omx.js +2 -0
- package/dist/cli/omx.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +41 -7
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +16 -557
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +34 -9
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/config/__tests__/generator-idempotent.test.js +79 -2
- package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
- package/dist/config/__tests__/generator-notify.test.js +2 -0
- package/dist/config/__tests__/generator-notify.test.js.map +1 -1
- package/dist/config/codex-hooks.d.ts +11 -0
- package/dist/config/codex-hooks.d.ts.map +1 -0
- package/dist/config/codex-hooks.js +50 -0
- package/dist/config/codex-hooks.js.map +1 -0
- package/dist/config/generator.d.ts +5 -3
- package/dist/config/generator.d.ts.map +1 -1
- package/dist/config/generator.js +24 -14
- package/dist/config/generator.js.map +1 -1
- package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts +2 -0
- package/dist/hooks/__tests__/debugger-log-recency-contract.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/debugger-log-recency-contract.test.js +20 -0
- package/dist/hooks/__tests__/debugger-log-recency-contract.test.js.map +1 -0
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js +236 -2
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +86 -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 +40 -0
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts +2 -0
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js +54 -0
- package/dist/hooks/__tests__/notify-hook-managed-tmux.test.js.map +1 -0
- package/dist/hooks/__tests__/notify-hook-modules.test.js +31 -0
- package/dist/hooks/__tests__/notify-hook-modules.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js +51 -0
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts +2 -0
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js +136 -0
- package/dist/hooks/__tests__/notify-hook-session-idle-dedupe.test.js.map +1 -0
- package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +120 -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 +145 -20
- 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 +116 -0
- package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +86 -0
- package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
- package/dist/hooks/__tests__/pre-context-gate-skills.test.js +1 -0
- package/dist/hooks/__tests__/pre-context-gate-skills.test.js.map +1 -1
- package/dist/hooks/extensibility/__tests__/runtime.test.js +49 -0
- package/dist/hooks/extensibility/__tests__/runtime.test.js.map +1 -1
- package/dist/hooks/extensibility/runtime.d.ts.map +1 -1
- package/dist/hooks/extensibility/runtime.js +10 -0
- package/dist/hooks/extensibility/runtime.js.map +1 -1
- package/dist/hooks/extensibility/types.d.ts +1 -1
- package/dist/hooks/extensibility/types.d.ts.map +1 -1
- package/dist/hooks/prompt-guidance-contract.d.ts.map +1 -1
- package/dist/hooks/prompt-guidance-contract.js +12 -8
- package/dist/hooks/prompt-guidance-contract.js.map +1 -1
- package/dist/hooks/session.d.ts +5 -1
- package/dist/hooks/session.d.ts.map +1 -1
- package/dist/hooks/session.js +10 -6
- package/dist/hooks/session.js.map +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +6 -1
- package/dist/hud/index.js.map +1 -1
- package/dist/mcp/__tests__/bootstrap.test.js +0 -3
- package/dist/mcp/__tests__/bootstrap.test.js.map +1 -1
- package/dist/mcp/__tests__/code-intel-server.test.js +27 -1
- package/dist/mcp/__tests__/code-intel-server.test.js.map +1 -1
- package/dist/mcp/__tests__/server-lifecycle.test.js +0 -5
- package/dist/mcp/__tests__/server-lifecycle.test.js.map +1 -1
- package/dist/mcp/bootstrap.d.ts +1 -1
- package/dist/mcp/bootstrap.d.ts.map +1 -1
- package/dist/mcp/bootstrap.js +0 -1
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/code-intel-server.d.ts +20 -0
- package/dist/mcp/code-intel-server.d.ts.map +1 -1
- package/dist/mcp/code-intel-server.js +6 -5
- package/dist/mcp/code-intel-server.js.map +1 -1
- package/dist/notifications/__tests__/idle-cooldown.test.js +24 -1
- package/dist/notifications/__tests__/idle-cooldown.test.js.map +1 -1
- package/dist/notifications/__tests__/reply-listener.test.js +20 -1
- package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
- package/dist/notifications/__tests__/tmux.test.js +41 -0
- package/dist/notifications/__tests__/tmux.test.js.map +1 -1
- package/dist/notifications/idle-cooldown.d.ts +13 -0
- package/dist/notifications/idle-cooldown.d.ts.map +1 -1
- package/dist/notifications/idle-cooldown.js +50 -16
- package/dist/notifications/idle-cooldown.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +2 -0
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/tmux.d.ts.map +1 -1
- package/dist/notifications/tmux.js +4 -0
- package/dist/notifications/tmux.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.d.ts +2 -0
- package/dist/scripts/__tests__/codex-native-hook.test.d.ts.map +1 -0
- package/dist/scripts/__tests__/codex-native-hook.test.js +720 -0
- package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -0
- package/dist/scripts/codex-native-hook.d.ts +22 -0
- package/dist/scripts/codex-native-hook.d.ts.map +1 -0
- package/dist/scripts/codex-native-hook.js +594 -0
- package/dist/scripts/codex-native-hook.js.map +1 -0
- package/dist/scripts/codex-native-pre-post.d.ts +26 -0
- package/dist/scripts/codex-native-pre-post.d.ts.map +1 -0
- package/dist/scripts/codex-native-pre-post.js +118 -0
- package/dist/scripts/codex-native-pre-post.js.map +1 -0
- package/dist/scripts/notify-fallback-watcher.js +262 -18
- package/dist/scripts/notify-fallback-watcher.js.map +1 -1
- package/dist/scripts/notify-hook/auto-nudge.d.ts.map +1 -1
- package/dist/scripts/notify-hook/auto-nudge.js +5 -6
- package/dist/scripts/notify-hook/auto-nudge.js.map +1 -1
- package/dist/scripts/notify-hook/log.d.ts +2 -2
- package/dist/scripts/notify-hook/log.d.ts.map +1 -1
- package/dist/scripts/notify-hook/log.js +10 -2
- package/dist/scripts/notify-hook/log.js.map +1 -1
- package/dist/scripts/notify-hook/managed-tmux.d.ts.map +1 -1
- package/dist/scripts/notify-hook/managed-tmux.js +2 -0
- package/dist/scripts/notify-hook/managed-tmux.js.map +1 -1
- package/dist/scripts/notify-hook/orchestration-intent.d.ts +18 -0
- package/dist/scripts/notify-hook/orchestration-intent.d.ts.map +1 -0
- package/dist/scripts/notify-hook/orchestration-intent.js +72 -0
- package/dist/scripts/notify-hook/orchestration-intent.js.map +1 -0
- package/dist/scripts/notify-hook/process-runner.js.map +1 -1
- package/dist/scripts/notify-hook/ralph-session-resume.d.ts.map +1 -1
- package/dist/scripts/notify-hook/ralph-session-resume.js +7 -0
- package/dist/scripts/notify-hook/ralph-session-resume.js.map +1 -1
- package/dist/scripts/notify-hook/team-dispatch.d.ts +15 -6
- package/dist/scripts/notify-hook/team-dispatch.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-dispatch.js +125 -6
- package/dist/scripts/notify-hook/team-dispatch.js.map +1 -1
- package/dist/scripts/notify-hook/team-leader-nudge.d.ts +3 -2
- package/dist/scripts/notify-hook/team-leader-nudge.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-leader-nudge.js +165 -37
- package/dist/scripts/notify-hook/team-leader-nudge.js.map +1 -1
- package/dist/scripts/notify-hook/team-tmux-guard.d.ts +4 -1
- package/dist/scripts/notify-hook/team-tmux-guard.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-tmux-guard.js +33 -44
- package/dist/scripts/notify-hook/team-tmux-guard.js.map +1 -1
- package/dist/scripts/notify-hook/team-worker.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-worker.js +68 -5
- package/dist/scripts/notify-hook/team-worker.js.map +1 -1
- package/dist/scripts/notify-hook/utils.d.ts +1 -1
- package/dist/scripts/notify-hook/utils.d.ts.map +1 -1
- package/dist/scripts/notify-hook/utils.js.map +1 -1
- package/dist/scripts/notify-hook.js +55 -32
- package/dist/scripts/notify-hook.js.map +1 -1
- package/dist/team/__tests__/api-interop.test.js +344 -18
- package/dist/team/__tests__/api-interop.test.js.map +1 -1
- package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts +2 -0
- package/dist/team/__tests__/delivery-e2e-smoke.test.d.ts.map +1 -0
- package/dist/team/__tests__/delivery-e2e-smoke.test.js +671 -0
- package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -0
- package/dist/team/__tests__/mcp-comm.test.js +5 -0
- package/dist/team/__tests__/mcp-comm.test.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +422 -12
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/state.test.js +126 -8
- package/dist/team/__tests__/state.test.js.map +1 -1
- package/dist/team/__tests__/team-ops-contract.test.js +4 -0
- package/dist/team/__tests__/team-ops-contract.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +160 -0
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +19 -1
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +95 -23
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/contracts.d.ts +11 -1
- package/dist/team/contracts.d.ts.map +1 -1
- package/dist/team/contracts.js +29 -0
- package/dist/team/contracts.js.map +1 -1
- package/dist/team/delivery-log.d.ts +14 -0
- package/dist/team/delivery-log.d.ts.map +1 -0
- package/dist/team/delivery-log.js +35 -0
- package/dist/team/delivery-log.js.map +1 -0
- package/dist/team/idle-nudge.d.ts +2 -2
- package/dist/team/idle-nudge.js +2 -2
- package/dist/team/mcp-comm.d.ts +4 -0
- package/dist/team/mcp-comm.d.ts.map +1 -1
- package/dist/team/mcp-comm.js +84 -1
- package/dist/team/mcp-comm.js.map +1 -1
- package/dist/team/pane-status.d.ts +149 -0
- package/dist/team/pane-status.d.ts.map +1 -0
- package/dist/team/pane-status.js +558 -0
- package/dist/team/pane-status.js.map +1 -0
- package/dist/team/reminder-intents.d.ts +11 -0
- package/dist/team/reminder-intents.d.ts.map +1 -0
- package/dist/team/reminder-intents.js +40 -0
- package/dist/team/reminder-intents.js.map +1 -0
- package/dist/team/runtime-cli.d.ts +1 -1
- package/dist/team/runtime-cli.js +2 -2
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime.d.ts +2 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +407 -190
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +6 -5
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/dispatch.d.ts +4 -1
- package/dist/team/state/dispatch.d.ts.map +1 -1
- package/dist/team/state/dispatch.js +59 -18
- package/dist/team/state/dispatch.js.map +1 -1
- package/dist/team/state/mailbox.d.ts.map +1 -1
- package/dist/team/state/mailbox.js +39 -2
- package/dist/team/state/mailbox.js.map +1 -1
- package/dist/team/state/monitor.d.ts +2 -1
- package/dist/team/state/monitor.d.ts.map +1 -1
- package/dist/team/state/monitor.js +30 -1
- package/dist/team/state/monitor.js.map +1 -1
- package/dist/team/state/types.d.ts +5 -2
- 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 +30 -3
- package/dist/team/state.d.ts.map +1 -1
- package/dist/team/state.js +170 -2
- package/dist/team/state.js.map +1 -1
- package/dist/team/team-ops.d.ts +5 -1
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +4 -0
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/tmux-session.d.ts +2 -0
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +19 -3
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts +4 -0
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +33 -6
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/utils/__tests__/paths.test.js +63 -1
- package/dist/utils/__tests__/paths.test.js.map +1 -1
- package/dist/utils/__tests__/platform-command.test.js +50 -4
- package/dist/utils/__tests__/platform-command.test.js.map +1 -1
- package/dist/utils/paths.d.ts +12 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +44 -2
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-command.d.ts.map +1 -1
- package/dist/utils/platform-command.js +13 -5
- package/dist/utils/platform-command.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js +10 -1
- package/dist/utils/sleep.js.map +1 -1
- package/package.json +1 -1
- package/prompts/analyst.md +2 -2
- package/prompts/api-reviewer.md +2 -2
- package/prompts/architect.md +2 -2
- package/prompts/build-fixer.md +2 -2
- package/prompts/code-reviewer.md +2 -2
- package/prompts/code-simplifier.md +1 -1
- package/prompts/critic.md +2 -2
- package/prompts/debugger.md +3 -2
- package/prompts/dependency-expert.md +2 -2
- package/prompts/designer.md +2 -2
- package/prompts/executor.md +3 -2
- package/prompts/explore.md +2 -2
- package/prompts/git-master.md +2 -2
- package/prompts/information-architect.md +2 -2
- package/prompts/performance-reviewer.md +2 -2
- package/prompts/planner.md +3 -2
- package/prompts/product-analyst.md +2 -2
- package/prompts/product-manager.md +2 -2
- package/prompts/qa-tester.md +2 -2
- package/prompts/quality-reviewer.md +2 -2
- package/prompts/quality-strategist.md +2 -2
- package/prompts/researcher.md +2 -2
- package/prompts/security-reviewer.md +2 -2
- package/prompts/sisyphus-lite.md +2 -2
- package/prompts/style-reviewer.md +2 -2
- package/prompts/team-executor.md +2 -2
- package/prompts/test-engineer.md +2 -2
- package/prompts/ux-researcher.md +2 -2
- package/prompts/verifier.md +3 -2
- package/prompts/vision.md +2 -2
- package/prompts/writer.md +2 -2
- package/skills/team/SKILL.md +18 -33
- package/src/scripts/__tests__/codex-native-hook.test.ts +931 -0
- package/src/scripts/codex-native-hook.ts +721 -0
- package/src/scripts/codex-native-pre-post.ts +161 -0
- package/src/scripts/notify-fallback-watcher.ts +318 -26
- package/src/scripts/notify-hook/auto-nudge.ts +5 -10
- package/src/scripts/notify-hook/log.ts +18 -4
- package/src/scripts/notify-hook/managed-tmux.ts +1 -0
- package/src/scripts/notify-hook/orchestration-intent.ts +82 -0
- package/src/scripts/notify-hook/process-runner.ts +4 -4
- package/src/scripts/notify-hook/ralph-session-resume.ts +9 -0
- package/src/scripts/notify-hook/team-dispatch.ts +134 -6
- package/src/scripts/notify-hook/team-leader-nudge.ts +183 -37
- package/src/scripts/notify-hook/team-tmux-guard.ts +35 -43
- package/src/scripts/notify-hook/team-worker.ts +73 -4
- package/src/scripts/notify-hook/utils.ts +1 -1
- package/src/scripts/notify-hook.ts +64 -32
- package/templates/AGENTS.md +21 -11
- package/README.de.md +0 -263
- package/README.el.md +0 -223
- package/README.es.md +0 -263
- package/README.fr.md +0 -263
- package/README.it.md +0 -263
- package/README.ja.md +0 -264
- package/README.ko.md +0 -264
- package/README.pl.md +0 -216
- package/README.pt.md +0 -263
- package/README.ru.md +0 -263
- package/README.tr.md +0 -263
- package/README.vi.md +0 -223
- package/README.zh-TW.md +0 -293
- package/README.zh.md +0 -264
- package/dist/mcp/__tests__/team-server-cleanup.test.d.ts +0 -2
- package/dist/mcp/__tests__/team-server-cleanup.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/team-server-cleanup.test.js +0 -219
- package/dist/mcp/__tests__/team-server-cleanup.test.js.map +0 -1
- package/dist/mcp/__tests__/team-server-runtime-deps.test.d.ts +0 -2
- package/dist/mcp/__tests__/team-server-runtime-deps.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/team-server-runtime-deps.test.js +0 -13
- package/dist/mcp/__tests__/team-server-runtime-deps.test.js.map +0 -1
- package/dist/mcp/__tests__/team-server-wait.test.d.ts +0 -2
- package/dist/mcp/__tests__/team-server-wait.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/team-server-wait.test.js +0 -155
- package/dist/mcp/__tests__/team-server-wait.test.js.map +0 -1
- package/dist/mcp/team-server.d.ts +0 -24
- package/dist/mcp/team-server.d.ts.map +0 -1
- package/dist/mcp/team-server.js +0 -482
- package/dist/mcp/team-server.js.map +0 -1
|
@@ -11,8 +11,15 @@ import { readJsonIfExists, getScopedStateDirsForCurrentSession } from './state-i
|
|
|
11
11
|
import { runProcess } from './process-runner.js';
|
|
12
12
|
import { logTmuxHookEvent } from './log.js';
|
|
13
13
|
import { evaluatePaneInjectionReadiness, sendPaneInput } from './team-tmux-guard.js';
|
|
14
|
+
import { resolvePaneTarget } from './tmux-injection.js';
|
|
15
|
+
import {
|
|
16
|
+
classifyLeaderActionState,
|
|
17
|
+
resolveLeaderNudgeIntent,
|
|
18
|
+
} from './orchestration-intent.js';
|
|
14
19
|
import { DEFAULT_MARKER } from '../tmux-hook-engine.js';
|
|
15
20
|
import { isLeaderRuntimeStale } from '../../team/leader-activity.js';
|
|
21
|
+
import { appendTeamDeliveryLog } from '../../team/delivery-log.js';
|
|
22
|
+
import { writeTeamLeaderAttention } from '../../team/state.js';
|
|
16
23
|
const LEADER_PANE_MISSING_NO_INJECTION_REASON = 'leader_pane_missing_no_injection';
|
|
17
24
|
const LEADER_PANE_SHELL_NO_INJECTION_REASON = 'leader_pane_shell_no_injection';
|
|
18
25
|
const LEADER_NOTIFICATION_DEFERRED_TYPE = 'leader_notification_deferred';
|
|
@@ -20,7 +27,7 @@ const ACK_WITHOUT_START_EVIDENCE_REASON = 'ack_without_start_evidence';
|
|
|
20
27
|
const ACK_LIKE_PATTERNS = [
|
|
21
28
|
/^ack(?::\s*[a-z0-9-]+(?:\s+initialized)?)?[.!]*$/i,
|
|
22
29
|
/^(?:ok|okay|k|roger|copy|received|got it|understood|sounds good)[.!]*$/i,
|
|
23
|
-
/^(?:on it|will do|i(?:'
|
|
30
|
+
/^(?:on it|will do|i(?:'|')ll do it|working on it)[.!]*$/i,
|
|
24
31
|
];
|
|
25
32
|
|
|
26
33
|
export function resolveLeaderNudgeIntervalMs() {
|
|
@@ -122,6 +129,31 @@ function buildLeaderActionGuidance(teamName, {
|
|
|
122
129
|
return buildStatusCheckReminder(teamName);
|
|
123
130
|
}
|
|
124
131
|
|
|
132
|
+
function buildIdleContextText(teamName, {
|
|
133
|
+
allWorkersIdle = false,
|
|
134
|
+
workerPanesAlive = false,
|
|
135
|
+
taskCounts = {},
|
|
136
|
+
leaderActionState = 'still_actionable',
|
|
137
|
+
} = {}) {
|
|
138
|
+
const pending = Number.isFinite(taskCounts.pending) ? taskCounts.pending : 0;
|
|
139
|
+
const blocked = Number.isFinite(taskCounts.blocked) ? taskCounts.blocked : 0;
|
|
140
|
+
const inProgress = Number.isFinite(taskCounts.in_progress) ? taskCounts.in_progress : 0;
|
|
141
|
+
const pendingFollowUpTasks = allWorkersIdle && pending > 0 && blocked === 0 && inProgress === 0;
|
|
142
|
+
|
|
143
|
+
if (pendingFollowUpTasks) {
|
|
144
|
+
return workerPanesAlive
|
|
145
|
+
? ` Team ${teamName} has idle workers ready.`
|
|
146
|
+
: ` Team ${teamName} has follow-up work ready.`;
|
|
147
|
+
}
|
|
148
|
+
if (leaderActionState === 'done_waiting_on_leader') {
|
|
149
|
+
return ` Team ${teamName} looks complete.`;
|
|
150
|
+
}
|
|
151
|
+
if (leaderActionState === 'stuck_waiting_on_leader') {
|
|
152
|
+
return ` Team ${teamName} needs leader review.`;
|
|
153
|
+
}
|
|
154
|
+
return '';
|
|
155
|
+
}
|
|
156
|
+
|
|
125
157
|
export async function checkWorkerPanesAlive(tmuxTarget, workerPaneIds = []) {
|
|
126
158
|
const sessionName = tmuxTarget.split(':')[0];
|
|
127
159
|
try {
|
|
@@ -466,7 +498,7 @@ async function getAckWithoutStartEvidence(stateDir, teamName, msg) {
|
|
|
466
498
|
};
|
|
467
499
|
}
|
|
468
500
|
|
|
469
|
-
export async function emitTeamNudgeEvent(cwd, teamName, reason, nowIso) {
|
|
501
|
+
export async function emitTeamNudgeEvent(cwd, teamName, reason, orchestrationIntent, nowIso) {
|
|
470
502
|
const eventsDir = join(cwd, '.omx', 'state', 'team', teamName, 'events');
|
|
471
503
|
const eventsPath = join(eventsDir, 'events.ndjson');
|
|
472
504
|
try {
|
|
@@ -477,6 +509,7 @@ export async function emitTeamNudgeEvent(cwd, teamName, reason, nowIso) {
|
|
|
477
509
|
type: 'team_leader_nudge',
|
|
478
510
|
worker: 'leader-fixed',
|
|
479
511
|
reason,
|
|
512
|
+
orchestration_intent: orchestrationIntent,
|
|
480
513
|
created_at: nowIso,
|
|
481
514
|
};
|
|
482
515
|
await appendFile(eventsPath, JSON.stringify(event) + '\n');
|
|
@@ -485,7 +518,7 @@ export async function emitTeamNudgeEvent(cwd, teamName, reason, nowIso) {
|
|
|
485
518
|
}
|
|
486
519
|
}
|
|
487
520
|
|
|
488
|
-
async function emitLeaderNudgeDeferredEvent(cwd, teamName, reason, nowIso, { tmuxSession = '', leaderPaneId = '', paneCurrentCommand = '', sourceType = 'leader_nudge' } = {}) {
|
|
521
|
+
async function emitLeaderNudgeDeferredEvent(cwd, teamName, reason, orchestrationIntent, nowIso, { tmuxSession = '', leaderPaneId = '', paneCurrentCommand = '', sourceType = 'leader_nudge' } = {}) {
|
|
489
522
|
const eventsDir = join(cwd, '.omx', 'state', 'team', teamName, 'events');
|
|
490
523
|
const eventsPath = join(eventsDir, 'events.ndjson');
|
|
491
524
|
try {
|
|
@@ -500,6 +533,7 @@ async function emitLeaderNudgeDeferredEvent(cwd, teamName, reason, nowIso, { tmu
|
|
|
500
533
|
created_at: nowIso,
|
|
501
534
|
tmux_session: tmuxSession || null,
|
|
502
535
|
leader_pane_id: leaderPaneId || null,
|
|
536
|
+
orchestration_intent: orchestrationIntent,
|
|
503
537
|
tmux_injection_attempted: false,
|
|
504
538
|
pane_current_command: paneCurrentCommand || null,
|
|
505
539
|
source_type: sourceType,
|
|
@@ -516,6 +550,7 @@ export async function maybeNudgeTeamLeader({
|
|
|
516
550
|
logsDir,
|
|
517
551
|
preComputedLeaderStale,
|
|
518
552
|
allowFreshMailboxNudges = true,
|
|
553
|
+
source = 'notify_hook',
|
|
519
554
|
}) {
|
|
520
555
|
const intervalMs = resolveLeaderNudgeIntervalMs();
|
|
521
556
|
const idleCooldownMs = resolveLeaderAllIdleNudgeCooldownMs();
|
|
@@ -608,7 +643,21 @@ export async function maybeNudgeTeamLeader({
|
|
|
608
643
|
: [];
|
|
609
644
|
const canonicalLeaderPaneId = safeString(leaderPaneId).trim();
|
|
610
645
|
if (!tmuxSession && !canonicalLeaderPaneId) continue;
|
|
611
|
-
|
|
646
|
+
let tmuxTarget = canonicalLeaderPaneId;
|
|
647
|
+
if (canonicalLeaderPaneId) {
|
|
648
|
+
const resolvedLeaderTarget = await resolvePaneTarget(
|
|
649
|
+
{ type: 'pane', value: canonicalLeaderPaneId },
|
|
650
|
+
'',
|
|
651
|
+
canonicalLeaderPaneId,
|
|
652
|
+
'',
|
|
653
|
+
{},
|
|
654
|
+
).catch(() => null);
|
|
655
|
+
if (resolvedLeaderTarget?.paneTarget) {
|
|
656
|
+
tmuxTarget = safeString(resolvedLeaderTarget.paneTarget).trim();
|
|
657
|
+
} else if (resolvedLeaderTarget && ['target_is_hud_pane', 'pane_cwd_mismatch'].includes(safeString(resolvedLeaderTarget.reason).trim())) {
|
|
658
|
+
tmuxTarget = '';
|
|
659
|
+
}
|
|
660
|
+
}
|
|
612
661
|
const paneStatus = tmuxSession
|
|
613
662
|
? await checkWorkerPanesAlive(tmuxSession, workerPaneIds)
|
|
614
663
|
: { alive: false, paneCount: 0 };
|
|
@@ -651,15 +700,6 @@ export async function maybeNudgeTeamLeader({
|
|
|
651
700
|
taskCounts: progressSnapshot.taskCounts,
|
|
652
701
|
leaderActionState,
|
|
653
702
|
});
|
|
654
|
-
nudgeState.progress_by_team[teamName] = {
|
|
655
|
-
signature: progressSnapshot.signature,
|
|
656
|
-
last_progress_at: effectiveProgressAtIso,
|
|
657
|
-
observed_at: nowIso,
|
|
658
|
-
missing_signal_workers: progressSnapshot.missingSignalWorkers,
|
|
659
|
-
work_remaining: progressSnapshot.workRemaining,
|
|
660
|
-
leader_action_state: leaderActionState,
|
|
661
|
-
};
|
|
662
|
-
|
|
663
703
|
const prev = nudgeState.last_nudged_by_team[teamName] && typeof nudgeState.last_nudged_by_team[teamName] === 'object'
|
|
664
704
|
? nudgeState.last_nudged_by_team[teamName]
|
|
665
705
|
: {};
|
|
@@ -688,9 +728,7 @@ export async function maybeNudgeTeamLeader({
|
|
|
688
728
|
const previousStalledTeamNudge = prevReason === 'stuck_waiting_on_leader';
|
|
689
729
|
const stalledTeamNudge = teamProgressStalled && (dueByTime || !previousStalledTeamNudge);
|
|
690
730
|
const staleFollowupDue = stalePanesNudge && dueByTime;
|
|
691
|
-
|
|
692
731
|
const hasActionableNewMessage = hasNewMessage && (allowFreshMailboxNudges || leaderStale);
|
|
693
|
-
if (!shouldSendAllIdleNudge && !hasActionableNewMessage && !stalledTeamNudge && !staleFollowupDue) continue;
|
|
694
732
|
|
|
695
733
|
let nudgeReason = '';
|
|
696
734
|
let text = '';
|
|
@@ -701,11 +739,12 @@ export async function maybeNudgeTeamLeader({
|
|
|
701
739
|
? 'stuck_waiting_on_leader'
|
|
702
740
|
: 'all_workers_idle';
|
|
703
741
|
const N = workerNames.length;
|
|
704
|
-
const waitingText =
|
|
705
|
-
|
|
706
|
-
:
|
|
707
|
-
|
|
708
|
-
|
|
742
|
+
const waitingText = buildIdleContextText(teamName, {
|
|
743
|
+
allWorkersIdle,
|
|
744
|
+
workerPanesAlive: paneStatus.alive,
|
|
745
|
+
taskCounts: progressSnapshot.taskCounts,
|
|
746
|
+
leaderActionState,
|
|
747
|
+
});
|
|
709
748
|
text = `[OMX] All ${N} worker${N === 1 ? '' : 's'} idle.${waitingText} ${leaderActionGuidance}`;
|
|
710
749
|
} else if (ackWithoutStartEvidence) {
|
|
711
750
|
nudgeReason = ACK_WITHOUT_START_EVIDENCE_REASON;
|
|
@@ -715,15 +754,10 @@ export async function maybeNudgeTeamLeader({
|
|
|
715
754
|
+ buildWorkerStartEvidenceReminder(teamName, ackWithoutStartEvidence.worker);
|
|
716
755
|
} else if (stalledTeamNudge) {
|
|
717
756
|
nudgeReason = 'stuck_waiting_on_leader';
|
|
718
|
-
const { pending, in_progress, blocked } = progressSnapshot.taskCounts;
|
|
719
|
-
const missingSignals = progressSnapshot.missingSignalWorkers > 0
|
|
720
|
-
? `; ${progressSnapshot.missingSignalWorkers} signal${progressSnapshot.missingSignalWorkers === 1 ? '' : 's'} missing`
|
|
721
|
-
: '';
|
|
722
757
|
const stallPrefix = leaderStale ? 'leader stale, ' : 'worker panes stalled, ';
|
|
723
758
|
text =
|
|
724
759
|
`Team ${teamName}: ${stallPrefix}no progress ${formatDurationMs(stalledForMs)}. `
|
|
725
|
-
+
|
|
726
|
-
+ `(p:${pending} ip:${in_progress} b:${blocked}${missingSignals})`;
|
|
760
|
+
+ leaderActionGuidance;
|
|
727
761
|
} else if (stalePanesNudge && hasActionableNewMessage) {
|
|
728
762
|
nudgeReason = 'stale_leader_with_messages';
|
|
729
763
|
text =
|
|
@@ -737,18 +771,65 @@ export async function maybeNudgeTeamLeader({
|
|
|
737
771
|
} else if (hasActionableNewMessage) {
|
|
738
772
|
nudgeReason = 'new_mailbox_message';
|
|
739
773
|
text = `Team ${teamName}: ${messages.length} msg(s) for leader. ${buildMailboxCheckReminder(teamName)}`;
|
|
740
|
-
} else {
|
|
741
|
-
continue;
|
|
742
774
|
}
|
|
775
|
+
|
|
776
|
+
const unreadLeaderMessageCount = messages.filter((message) => !safeString(message?.delivered_at).trim()).length;
|
|
777
|
+
nudgeState.progress_by_team[teamName] = {
|
|
778
|
+
signature: progressSnapshot.signature,
|
|
779
|
+
last_progress_at: effectiveProgressAtIso,
|
|
780
|
+
observed_at: nowIso,
|
|
781
|
+
missing_signal_workers: progressSnapshot.missingSignalWorkers,
|
|
782
|
+
work_remaining: progressSnapshot.workRemaining,
|
|
783
|
+
leader_action_state: leaderActionState,
|
|
784
|
+
leader_attention_pending: !!nudgeReason,
|
|
785
|
+
leader_attention_reason: nudgeReason || null,
|
|
786
|
+
leader_stale: leaderStale,
|
|
787
|
+
all_workers_idle: allWorkersIdle,
|
|
788
|
+
pending_task_count:
|
|
789
|
+
(progressSnapshot.taskCounts.pending || 0)
|
|
790
|
+
+ (progressSnapshot.taskCounts.blocked || 0)
|
|
791
|
+
+ (progressSnapshot.taskCounts.in_progress || 0),
|
|
792
|
+
unread_leader_message_count: unreadLeaderMessageCount,
|
|
793
|
+
stalled_for_ms: teamProgressStalled ? stalledForMs : null,
|
|
794
|
+
source: source === 'notify_fallback_watcher' ? 'notify_hook' : source,
|
|
795
|
+
};
|
|
796
|
+
await writeTeamLeaderAttention(teamName, {
|
|
797
|
+
team_name: teamName,
|
|
798
|
+
updated_at: nowIso,
|
|
799
|
+
source: 'notify_hook',
|
|
800
|
+
leader_decision_state: leaderActionState,
|
|
801
|
+
leader_attention_pending: !!nudgeReason,
|
|
802
|
+
leader_attention_reason: nudgeReason || null,
|
|
803
|
+
attention_reasons: nudgeReason ? [nudgeReason] : [],
|
|
804
|
+
leader_stale: leaderStale,
|
|
805
|
+
leader_session_active: true,
|
|
806
|
+
leader_session_id: currentSessionId || ownerSessionId || null,
|
|
807
|
+
leader_session_stopped_at: null,
|
|
808
|
+
unread_leader_message_count: unreadLeaderMessageCount,
|
|
809
|
+
work_remaining: progressSnapshot.workRemaining,
|
|
810
|
+
stalled_for_ms: teamProgressStalled ? stalledForMs : null,
|
|
811
|
+
}, cwd).catch(() => {});
|
|
812
|
+
|
|
813
|
+
if (!nudgeReason) continue;
|
|
814
|
+
const orchestrationIntent = resolveLeaderNudgeIntent({ nudgeReason, leaderActionState });
|
|
743
815
|
const capped = text.length > 180 ? `${text.slice(0, 177)}...` : text;
|
|
744
816
|
const markedText = `${capped} ${DEFAULT_MARKER}`;
|
|
745
817
|
|
|
746
818
|
if (!tmuxTarget) {
|
|
747
|
-
nudgeState.last_nudged_by_team[teamName] = {
|
|
819
|
+
nudgeState.last_nudged_by_team[teamName] = {
|
|
820
|
+
at: nowIso,
|
|
821
|
+
last_message_id: newestId || prevMsgId || '',
|
|
822
|
+
reason: nudgeReason,
|
|
823
|
+
orchestration_intent: orchestrationIntent,
|
|
824
|
+
};
|
|
748
825
|
if (shouldSendAllIdleNudge) {
|
|
749
|
-
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
826
|
+
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
827
|
+
at: nowIso,
|
|
828
|
+
worker_count: workerNames.length,
|
|
829
|
+
orchestration_intent: orchestrationIntent,
|
|
830
|
+
};
|
|
750
831
|
}
|
|
751
|
-
await emitLeaderNudgeDeferredEvent(cwd, teamName, LEADER_PANE_MISSING_NO_INJECTION_REASON, nowIso, {
|
|
832
|
+
await emitLeaderNudgeDeferredEvent(cwd, teamName, LEADER_PANE_MISSING_NO_INJECTION_REASON, orchestrationIntent, nowIso, {
|
|
752
833
|
tmuxSession,
|
|
753
834
|
leaderPaneId,
|
|
754
835
|
sourceType: 'leader_nudge',
|
|
@@ -763,10 +844,21 @@ export async function maybeNudgeTeamLeader({
|
|
|
763
844
|
reason: LEADER_PANE_MISSING_NO_INJECTION_REASON,
|
|
764
845
|
leader_pane_id: leaderPaneId || null,
|
|
765
846
|
tmux_session: tmuxSession || null,
|
|
847
|
+
orchestration_intent: orchestrationIntent,
|
|
766
848
|
tmux_injection_attempted: false,
|
|
767
849
|
source_type: 'leader_nudge',
|
|
768
850
|
});
|
|
769
851
|
} catch { /* ignore */ }
|
|
852
|
+
await appendTeamDeliveryLog(logsDir, {
|
|
853
|
+
event: 'nudge_triggered',
|
|
854
|
+
source,
|
|
855
|
+
team: teamName,
|
|
856
|
+
to_worker: 'leader-fixed',
|
|
857
|
+
transport: 'none',
|
|
858
|
+
result: 'deferred',
|
|
859
|
+
reason: LEADER_PANE_MISSING_NO_INJECTION_REASON,
|
|
860
|
+
orchestration_intent: orchestrationIntent,
|
|
861
|
+
}).catch(() => {});
|
|
770
862
|
continue;
|
|
771
863
|
}
|
|
772
864
|
|
|
@@ -782,11 +874,20 @@ export async function maybeNudgeTeamLeader({
|
|
|
782
874
|
const deferredReason = paneGuard.reason === 'pane_running_shell'
|
|
783
875
|
? LEADER_PANE_SHELL_NO_INJECTION_REASON
|
|
784
876
|
: paneGuard.reason;
|
|
785
|
-
nudgeState.last_nudged_by_team[teamName] = {
|
|
877
|
+
nudgeState.last_nudged_by_team[teamName] = {
|
|
878
|
+
at: nowIso,
|
|
879
|
+
last_message_id: newestId || prevMsgId || '',
|
|
880
|
+
reason: nudgeReason,
|
|
881
|
+
orchestration_intent: orchestrationIntent,
|
|
882
|
+
};
|
|
786
883
|
if (shouldSendAllIdleNudge) {
|
|
787
|
-
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
884
|
+
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
885
|
+
at: nowIso,
|
|
886
|
+
worker_count: workerNames.length,
|
|
887
|
+
orchestration_intent: orchestrationIntent,
|
|
888
|
+
};
|
|
788
889
|
}
|
|
789
|
-
await emitLeaderNudgeDeferredEvent(cwd, teamName, deferredReason, nowIso, {
|
|
890
|
+
await emitLeaderNudgeDeferredEvent(cwd, teamName, deferredReason, orchestrationIntent, nowIso, {
|
|
790
891
|
tmuxSession,
|
|
791
892
|
leaderPaneId,
|
|
792
893
|
paneCurrentCommand: paneGuard.paneCurrentCommand,
|
|
@@ -803,11 +904,24 @@ export async function maybeNudgeTeamLeader({
|
|
|
803
904
|
leader_pane_id: leaderPaneId || null,
|
|
804
905
|
tmux_session: tmuxSession || null,
|
|
805
906
|
tmux_injection_attempted: false,
|
|
907
|
+
pane_target: tmuxTarget,
|
|
908
|
+
orchestration_intent: orchestrationIntent,
|
|
909
|
+
readiness_evidence: paneGuard.readinessEvidence || null,
|
|
806
910
|
pane_current_command: paneGuard.paneCurrentCommand || null,
|
|
807
911
|
injection_skip_reason: paneGuard.reason,
|
|
808
912
|
source_type: 'leader_nudge',
|
|
809
913
|
});
|
|
810
914
|
} catch { /* ignore */ }
|
|
915
|
+
await appendTeamDeliveryLog(logsDir, {
|
|
916
|
+
event: 'nudge_triggered',
|
|
917
|
+
source,
|
|
918
|
+
team: teamName,
|
|
919
|
+
to_worker: 'leader-fixed',
|
|
920
|
+
transport: 'none',
|
|
921
|
+
result: 'deferred',
|
|
922
|
+
reason: deferredReason,
|
|
923
|
+
orchestration_intent: orchestrationIntent,
|
|
924
|
+
}).catch(() => {});
|
|
811
925
|
continue;
|
|
812
926
|
}
|
|
813
927
|
|
|
@@ -821,12 +935,21 @@ export async function maybeNudgeTeamLeader({
|
|
|
821
935
|
if (!sendResult.ok) {
|
|
822
936
|
throw new Error(sendResult.error || sendResult.reason);
|
|
823
937
|
}
|
|
824
|
-
nudgeState.last_nudged_by_team[teamName] = {
|
|
938
|
+
nudgeState.last_nudged_by_team[teamName] = {
|
|
939
|
+
at: nowIso,
|
|
940
|
+
last_message_id: newestId || prevMsgId || '',
|
|
941
|
+
reason: nudgeReason,
|
|
942
|
+
orchestration_intent: orchestrationIntent,
|
|
943
|
+
};
|
|
825
944
|
if (shouldSendAllIdleNudge) {
|
|
826
|
-
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
945
|
+
nudgeState.last_idle_nudged_by_team[teamName] = {
|
|
946
|
+
at: nowIso,
|
|
947
|
+
worker_count: workerNames.length,
|
|
948
|
+
orchestration_intent: orchestrationIntent,
|
|
949
|
+
};
|
|
827
950
|
}
|
|
828
951
|
|
|
829
|
-
await emitTeamNudgeEvent(cwd, teamName, nudgeReason, nowIso);
|
|
952
|
+
await emitTeamNudgeEvent(cwd, teamName, nudgeReason, orchestrationIntent, nowIso);
|
|
830
953
|
|
|
831
954
|
try {
|
|
832
955
|
await logTmuxHookEvent(logsDir, {
|
|
@@ -835,6 +958,7 @@ export async function maybeNudgeTeamLeader({
|
|
|
835
958
|
team: teamName,
|
|
836
959
|
tmux_target: tmuxTarget,
|
|
837
960
|
reason: nudgeReason,
|
|
961
|
+
orchestration_intent: orchestrationIntent,
|
|
838
962
|
pane_count: paneStatus.paneCount,
|
|
839
963
|
leader_stale: leaderStale,
|
|
840
964
|
message_count: messages.length,
|
|
@@ -842,6 +966,16 @@ export async function maybeNudgeTeamLeader({
|
|
|
842
966
|
missing_signal_workers: progressSnapshot.missingSignalWorkers,
|
|
843
967
|
});
|
|
844
968
|
} catch { /* ignore */ }
|
|
969
|
+
await appendTeamDeliveryLog(logsDir, {
|
|
970
|
+
event: 'nudge_triggered',
|
|
971
|
+
source,
|
|
972
|
+
team: teamName,
|
|
973
|
+
to_worker: 'leader-fixed',
|
|
974
|
+
transport: 'send-keys',
|
|
975
|
+
result: 'sent',
|
|
976
|
+
reason: nudgeReason,
|
|
977
|
+
orchestration_intent: orchestrationIntent,
|
|
978
|
+
}).catch(() => {});
|
|
845
979
|
} catch (err) {
|
|
846
980
|
try {
|
|
847
981
|
await logTmuxHookEvent(logsDir, {
|
|
@@ -850,9 +984,21 @@ export async function maybeNudgeTeamLeader({
|
|
|
850
984
|
team: teamName,
|
|
851
985
|
tmux_target: tmuxTarget,
|
|
852
986
|
reason: nudgeReason,
|
|
987
|
+
orchestration_intent: orchestrationIntent,
|
|
853
988
|
error: safeString(err && err.message ? err.message : err),
|
|
854
989
|
});
|
|
855
990
|
} catch { /* ignore */ }
|
|
991
|
+
await appendTeamDeliveryLog(logsDir, {
|
|
992
|
+
event: 'nudge_triggered',
|
|
993
|
+
source,
|
|
994
|
+
team: teamName,
|
|
995
|
+
to_worker: 'leader-fixed',
|
|
996
|
+
transport: 'send-keys',
|
|
997
|
+
result: 'failed',
|
|
998
|
+
reason: nudgeReason,
|
|
999
|
+
orchestration_intent: orchestrationIntent,
|
|
1000
|
+
error: safeString(err && err.message ? err.message : err),
|
|
1001
|
+
}).catch(() => {});
|
|
856
1002
|
}
|
|
857
1003
|
}
|
|
858
1004
|
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
paneLooksReady,
|
|
11
11
|
} from '../tmux-hook-engine.js';
|
|
12
12
|
|
|
13
|
+
export const PANE_READINESS_UNVERIFIED_REASON = 'pane_readiness_unverified';
|
|
14
|
+
|
|
13
15
|
export function mapPaneInjectionReadinessReason(reason: any): any {
|
|
14
16
|
return reason === 'pane_running_shell' ? 'agent_not_running' : reason;
|
|
15
17
|
}
|
|
@@ -20,7 +22,10 @@ export async function evaluatePaneInjectionReadiness(paneTarget: any, {
|
|
|
20
22
|
requireRunningAgent = true,
|
|
21
23
|
requireReady = true,
|
|
22
24
|
requireIdle = true,
|
|
25
|
+
requireObservableState = false,
|
|
26
|
+
requireCaptureEvidence = undefined,
|
|
23
27
|
} = {}): Promise<any> {
|
|
28
|
+
const normalizedRequireObservableState = typeof requireCaptureEvidence === 'boolean' ? requireCaptureEvidence : requireObservableState;
|
|
24
29
|
const target = safeString(paneTarget).trim();
|
|
25
30
|
if (!target) {
|
|
26
31
|
return {
|
|
@@ -52,6 +57,15 @@ export async function evaluatePaneInjectionReadiness(paneTarget: any, {
|
|
|
52
57
|
|
|
53
58
|
let paneCurrentCommand = '';
|
|
54
59
|
let paneRunningShell = false;
|
|
60
|
+
const buildReadinessResult = (ok: boolean, reason: string, paneCapture: string, readinessEvidence: string) => ({
|
|
61
|
+
ok,
|
|
62
|
+
sent: false,
|
|
63
|
+
reason,
|
|
64
|
+
paneTarget: target,
|
|
65
|
+
paneCurrentCommand,
|
|
66
|
+
paneCapture,
|
|
67
|
+
readinessEvidence,
|
|
68
|
+
});
|
|
55
69
|
try {
|
|
56
70
|
const result = await runProcess('tmux', buildPaneCurrentCommandArgv(target), 1000);
|
|
57
71
|
paneCurrentCommand = safeString(result.stdout).trim();
|
|
@@ -63,40 +77,33 @@ export async function evaluatePaneInjectionReadiness(paneTarget: any, {
|
|
|
63
77
|
try {
|
|
64
78
|
const capture = await runProcess('tmux', buildCapturePaneArgv(target, captureLines), 1000);
|
|
65
79
|
const paneCapture = safeString(capture.stdout);
|
|
66
|
-
|
|
80
|
+
const hasCaptureEvidence = paneCapture.trim() !== '';
|
|
81
|
+
if (hasCaptureEvidence) {
|
|
67
82
|
const paneShowsLiveAgent = paneLooksReady(paneCapture) || paneHasActiveTask(paneCapture);
|
|
68
83
|
if (paneRunningShell && !paneShowsLiveAgent) {
|
|
69
|
-
return
|
|
70
|
-
ok: false,
|
|
71
|
-
sent: false,
|
|
72
|
-
reason: 'pane_running_shell',
|
|
73
|
-
paneTarget: target,
|
|
74
|
-
paneCurrentCommand,
|
|
75
|
-
paneCapture,
|
|
76
|
-
};
|
|
84
|
+
return buildReadinessResult(false, 'pane_running_shell', paneCapture, 'captured');
|
|
77
85
|
}
|
|
78
86
|
if (requireIdle && paneHasActiveTask(paneCapture)) {
|
|
79
|
-
return
|
|
80
|
-
ok: false,
|
|
81
|
-
sent: false,
|
|
82
|
-
reason: 'pane_has_active_task',
|
|
83
|
-
paneTarget: target,
|
|
84
|
-
paneCurrentCommand,
|
|
85
|
-
paneCapture,
|
|
86
|
-
};
|
|
87
|
+
return buildReadinessResult(false, 'pane_has_active_task', paneCapture, 'captured');
|
|
87
88
|
}
|
|
88
89
|
if (requireReady && !paneLooksReady(paneCapture)) {
|
|
90
|
+
return buildReadinessResult(false, 'pane_not_ready', paneCapture, 'captured');
|
|
91
|
+
}
|
|
92
|
+
if (normalizedRequireObservableState && !paneShowsLiveAgent) {
|
|
93
|
+
return buildReadinessResult(false, PANE_READINESS_UNVERIFIED_REASON, paneCapture, 'captured_unverified');
|
|
94
|
+
}
|
|
95
|
+
if (requireObservableState && !paneShowsLiveAgent) {
|
|
89
96
|
return {
|
|
90
97
|
ok: false,
|
|
91
98
|
sent: false,
|
|
92
|
-
reason: '
|
|
99
|
+
reason: 'pane_state_unverified',
|
|
93
100
|
paneTarget: target,
|
|
94
101
|
paneCurrentCommand,
|
|
95
102
|
paneCapture,
|
|
96
103
|
};
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
|
-
if (paneRunningShell &&
|
|
106
|
+
if (paneRunningShell && !hasCaptureEvidence) {
|
|
100
107
|
return {
|
|
101
108
|
ok: false,
|
|
102
109
|
sent: false,
|
|
@@ -106,33 +113,18 @@ export async function evaluatePaneInjectionReadiness(paneTarget: any, {
|
|
|
106
113
|
paneCapture,
|
|
107
114
|
};
|
|
108
115
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
paneTarget: target,
|
|
114
|
-
paneCurrentCommand,
|
|
115
|
-
paneCapture,
|
|
116
|
-
};
|
|
116
|
+
if (normalizedRequireObservableState && !hasCaptureEvidence && !paneCurrentCommand) {
|
|
117
|
+
return buildReadinessResult(false, PANE_READINESS_UNVERIFIED_REASON, paneCapture, 'capture_empty');
|
|
118
|
+
}
|
|
119
|
+
return buildReadinessResult(true, 'ok', paneCapture, hasCaptureEvidence ? 'captured' : (paneCurrentCommand ? 'command_only' : 'none'));
|
|
117
120
|
} catch {
|
|
118
121
|
if (paneRunningShell) {
|
|
119
|
-
return
|
|
120
|
-
ok: false,
|
|
121
|
-
sent: false,
|
|
122
|
-
reason: 'pane_running_shell',
|
|
123
|
-
paneTarget: target,
|
|
124
|
-
paneCurrentCommand,
|
|
125
|
-
paneCapture: '',
|
|
126
|
-
};
|
|
122
|
+
return buildReadinessResult(false, 'pane_running_shell', '', 'capture_failed');
|
|
127
123
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
paneTarget: target,
|
|
133
|
-
paneCurrentCommand,
|
|
134
|
-
paneCapture: '',
|
|
135
|
-
};
|
|
124
|
+
if (normalizedRequireObservableState) {
|
|
125
|
+
return buildReadinessResult(false, PANE_READINESS_UNVERIFIED_REASON, '', 'capture_failed');
|
|
126
|
+
}
|
|
127
|
+
return buildReadinessResult(true, 'ok', '', paneCurrentCommand ? 'command_only' : 'none');
|
|
136
128
|
}
|
|
137
129
|
}
|
|
138
130
|
|