oh-my-copilot 4.13.1 → 4.13.21
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 +1 -1
- package/README.md +3 -3
- package/bridge/cli.cjs +4709 -1961
- package/bridge/mcp-server.cjs +112 -11
- package/bridge/runtime-cli.cjs +4917 -2645
- package/bridge/team-bridge.cjs +6 -4
- package/bridge/team-mcp.cjs +19607 -0
- package/bridge/team.js +4895 -2215
- package/dist/__tests__/auto-slash-aliases.test.js +91 -0
- package/dist/__tests__/auto-slash-aliases.test.js.map +1 -1
- package/dist/__tests__/hooks/learner/bridge.test.js +25 -0
- package/dist/__tests__/hooks/learner/bridge.test.js.map +1 -1
- package/dist/__tests__/hooks/learner/parser.test.js +30 -0
- package/dist/__tests__/hooks/learner/parser.test.js.map +1 -1
- package/dist/__tests__/hud/extra-usage.test.js +42 -0
- package/dist/__tests__/hud/extra-usage.test.js.map +1 -1
- package/dist/__tests__/hud/labels.test.d.ts +2 -0
- package/dist/__tests__/hud/labels.test.d.ts.map +1 -0
- package/dist/__tests__/hud/labels.test.js +158 -0
- package/dist/__tests__/hud/labels.test.js.map +1 -0
- package/dist/__tests__/hud/render-enterprise.test.d.ts +5 -0
- package/dist/__tests__/hud/render-enterprise.test.d.ts.map +1 -0
- package/dist/__tests__/hud/render-enterprise.test.js +232 -0
- package/dist/__tests__/hud/render-enterprise.test.js.map +1 -0
- package/dist/__tests__/hud/render-rate-limits-priority.test.js +185 -0
- package/dist/__tests__/hud/render-rate-limits-priority.test.js.map +1 -1
- package/dist/__tests__/hud/stdin-session-scope.test.d.ts +2 -0
- package/dist/__tests__/hud/stdin-session-scope.test.d.ts.map +1 -0
- package/dist/__tests__/hud/stdin-session-scope.test.js +169 -0
- package/dist/__tests__/hud/stdin-session-scope.test.js.map +1 -0
- package/dist/__tests__/hud/usage-api.test.js +111 -1
- package/dist/__tests__/hud/usage-api.test.js.map +1 -1
- package/dist/__tests__/hud-marketplace-resolution.test.js +34 -0
- package/dist/__tests__/hud-marketplace-resolution.test.js.map +1 -1
- package/dist/__tests__/installer-hud-skip.test.js +6 -0
- package/dist/__tests__/installer-hud-skip.test.js.map +1 -1
- package/dist/__tests__/installer-omc-reference.test.js +1 -1
- package/dist/__tests__/installer-omc-reference.test.js.map +1 -1
- package/dist/__tests__/keyword-detector-echo-guard.test.d.ts +2 -0
- package/dist/__tests__/keyword-detector-echo-guard.test.d.ts.map +1 -0
- package/dist/__tests__/keyword-detector-echo-guard.test.js +218 -0
- package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -0
- package/dist/__tests__/mnemosyne/detector.test.js +2 -0
- package/dist/__tests__/mnemosyne/detector.test.js.map +1 -1
- package/dist/__tests__/notepad.test.js +2 -2
- package/dist/__tests__/notepad.test.js.map +1 -1
- package/dist/__tests__/pre-tool-enforcer.test.js +84 -1
- package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -1
- package/dist/__tests__/preemptive-compaction-hook.test.js +63 -0
- package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
- package/dist/__tests__/ralph-prd-mandatory.test.js +11 -1
- package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
- package/dist/__tests__/ralph-prd.test.js +40 -2
- package/dist/__tests__/ralph-prd.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +363 -4
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/__tests__/state-root-resolution.test.js +120 -6
- package/dist/__tests__/state-root-resolution.test.js.map +1 -1
- package/dist/autoresearch/__tests__/runtime.test.js +225 -28
- package/dist/autoresearch/__tests__/runtime.test.js.map +1 -1
- package/dist/autoresearch/runtime.d.ts.map +1 -1
- package/dist/autoresearch/runtime.js +9 -5
- package/dist/autoresearch/runtime.js.map +1 -1
- package/dist/cli/__tests__/team-status-worktree.test.d.ts +2 -0
- package/dist/cli/__tests__/team-status-worktree.test.d.ts.map +1 -0
- package/dist/cli/__tests__/team-status-worktree.test.js +96 -0
- package/dist/cli/__tests__/team-status-worktree.test.js.map +1 -0
- package/dist/cli/__tests__/team.test.js +164 -0
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/autoresearch.d.ts +1 -1
- package/dist/cli/autoresearch.d.ts.map +1 -1
- package/dist/cli/autoresearch.js +4 -4
- package/dist/cli/commands/team.d.ts +1 -0
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +15 -3
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/team.d.ts +6 -0
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +126 -5
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/utils/formatting.d.ts +0 -10
- package/dist/cli/utils/formatting.d.ts.map +1 -1
- package/dist/cli/utils/formatting.js +0 -52
- package/dist/cli/utils/formatting.js.map +1 -1
- package/dist/config/__tests__/loader.test.js.map +1 -1
- package/dist/features/boulder-state/constants.d.ts +1 -1
- package/dist/features/boulder-state/constants.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.js +11 -3
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/builtin-skills/types.d.ts +7 -0
- package/dist/features/builtin-skills/types.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.d.ts +2 -0
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +10 -0
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/features/magic-keywords.d.ts.map +1 -1
- package/dist/features/magic-keywords.js +30 -1
- package/dist/features/magic-keywords.js.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.d.ts +4 -4
- package/dist/features/rate-limit-wait/tmux-detector.js +9 -9
- package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
- package/dist/hooks/__tests__/bridge-routing.test.js +156 -0
- package/dist/hooks/__tests__/bridge-routing.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/constants.js +1 -0
- package/dist/hooks/auto-slash-command/constants.js.map +1 -1
- package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +29 -0
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +184 -1
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/learner/bridge.d.ts.map +1 -1
- package/dist/hooks/learner/bridge.js +4 -109
- package/dist/hooks/learner/bridge.js.map +1 -1
- package/dist/hooks/learner/detector.js +1 -1
- package/dist/hooks/learner/parser.d.ts +9 -0
- package/dist/hooks/learner/parser.d.ts.map +1 -1
- package/dist/hooks/learner/parser.js +18 -5
- package/dist/hooks/learner/parser.js.map +1 -1
- package/dist/hooks/learner/types.d.ts +6 -0
- package/dist/hooks/learner/types.d.ts.map +1 -1
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js +16 -0
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js.map +1 -1
- package/dist/hooks/notepad/index.d.ts +4 -1
- package/dist/hooks/notepad/index.d.ts.map +1 -1
- package/dist/hooks/notepad/index.js +7 -4
- package/dist/hooks/notepad/index.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js +70 -3
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +17 -13
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js +175 -3
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/integration.test.js +117 -3
- package/dist/hooks/project-memory/__tests__/integration.test.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/storage.test.js +11 -11
- package/dist/hooks/project-memory/__tests__/storage.test.js.map +1 -1
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +24 -12
- package/dist/hooks/project-memory/index.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/loop.d.ts +6 -6
- package/dist/hooks/ralph/loop.d.ts.map +1 -1
- package/dist/hooks/ralph/loop.js +18 -18
- package/dist/hooks/ralph/loop.js.map +1 -1
- package/dist/hooks/ralph/prd.d.ts +23 -12
- package/dist/hooks/ralph/prd.d.ts.map +1 -1
- package/dist/hooks/ralph/prd.js +88 -42
- package/dist/hooks/ralph/prd.js.map +1 -1
- package/dist/hooks/session-end/__tests__/mode-state-cleanup.test.js +20 -0
- package/dist/hooks/session-end/__tests__/mode-state-cleanup.test.js.map +1 -1
- package/dist/hooks/session-end/index.d.ts +9 -0
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +110 -0
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/skill-bridge.cjs +114 -92
- package/dist/hooks/skill-state/index.d.ts.map +1 -1
- package/dist/hooks/skill-state/index.js +1 -0
- package/dist/hooks/skill-state/index.js.map +1 -1
- package/dist/hud/__tests__/enterprise-cost.test.d.ts +5 -0
- package/dist/hud/__tests__/enterprise-cost.test.d.ts.map +1 -0
- package/dist/hud/__tests__/enterprise-cost.test.js +151 -0
- package/dist/hud/__tests__/enterprise-cost.test.js.map +1 -0
- package/dist/hud/__tests__/git-status.test.js +18 -0
- package/dist/hud/__tests__/git-status.test.js.map +1 -1
- package/dist/hud/__tests__/usage-api-enterprise.test.d.ts +5 -0
- package/dist/hud/__tests__/usage-api-enterprise.test.d.ts.map +1 -0
- package/dist/hud/__tests__/usage-api-enterprise.test.js +249 -0
- package/dist/hud/__tests__/usage-api-enterprise.test.js.map +1 -0
- package/dist/hud/elements/background.d.ts +3 -3
- package/dist/hud/elements/background.d.ts.map +1 -1
- package/dist/hud/elements/background.js +5 -4
- package/dist/hud/elements/background.js.map +1 -1
- package/dist/hud/elements/call-counts.d.ts +2 -2
- package/dist/hud/elements/call-counts.d.ts.map +1 -1
- package/dist/hud/elements/call-counts.js +7 -6
- package/dist/hud/elements/call-counts.js.map +1 -1
- package/dist/hud/elements/context.d.ts +3 -3
- package/dist/hud/elements/context.d.ts.map +1 -1
- package/dist/hud/elements/context.js +5 -4
- package/dist/hud/elements/context.js.map +1 -1
- package/dist/hud/elements/enterprise-cost.d.ts +16 -0
- package/dist/hud/elements/enterprise-cost.d.ts.map +1 -0
- package/dist/hud/elements/enterprise-cost.js +63 -0
- package/dist/hud/elements/enterprise-cost.js.map +1 -0
- package/dist/hud/elements/git.d.ts +2 -1
- package/dist/hud/elements/git.d.ts.map +1 -1
- package/dist/hud/elements/git.js +7 -6
- package/dist/hud/elements/git.js.map +1 -1
- package/dist/hud/elements/permission.d.ts.map +1 -1
- package/dist/hud/elements/permission.js +2 -5
- package/dist/hud/elements/permission.js.map +1 -1
- package/dist/hud/elements/ralph.d.ts +2 -2
- package/dist/hud/elements/ralph.d.ts.map +1 -1
- package/dist/hud/elements/ralph.js +3 -2
- package/dist/hud/elements/ralph.js.map +1 -1
- package/dist/hud/elements/session.d.ts.map +1 -1
- package/dist/hud/elements/session.js +5 -9
- package/dist/hud/elements/session.js.map +1 -1
- package/dist/hud/elements/thinking.d.ts +2 -2
- package/dist/hud/elements/thinking.d.ts.map +1 -1
- package/dist/hud/elements/thinking.js +3 -2
- package/dist/hud/elements/thinking.js.map +1 -1
- package/dist/hud/elements/token-usage.d.ts +2 -2
- package/dist/hud/elements/token-usage.d.ts.map +1 -1
- package/dist/hud/elements/token-usage.js +3 -2
- package/dist/hud/elements/token-usage.js.map +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +5 -1
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +43 -10
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +18 -1
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/stdin.d.ts.map +1 -1
- package/dist/hud/stdin.js +49 -5
- package/dist/hud/stdin.js.map +1 -1
- package/dist/hud/types.d.ts +42 -0
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +59 -1
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts +19 -1
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +101 -18
- package/dist/hud/usage-api.js.map +1 -1
- package/dist/installer/__tests__/hud-cache-wrapper.test.d.ts +2 -0
- package/dist/installer/__tests__/hud-cache-wrapper.test.d.ts.map +1 -0
- package/dist/installer/__tests__/hud-cache-wrapper.test.js +235 -0
- package/dist/installer/__tests__/hud-cache-wrapper.test.js.map +1 -0
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js +2 -0
- package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
- package/dist/installer/index.d.ts +1 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +83 -31
- package/dist/installer/index.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths.test.js +162 -39
- package/dist/lib/__tests__/worktree-paths.test.js.map +1 -1
- package/dist/lib/worktree-paths.d.ts +87 -9
- package/dist/lib/worktree-paths.d.ts.map +1 -1
- package/dist/lib/worktree-paths.js +209 -27
- package/dist/lib/worktree-paths.js.map +1 -1
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js +156 -4
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js.map +1 -1
- package/dist/mcp/omc-tools-server.d.ts +11 -17
- package/dist/mcp/omc-tools-server.d.ts.map +1 -1
- package/dist/mcp/omc-tools-server.js +22 -32
- package/dist/mcp/omc-tools-server.js.map +1 -1
- package/dist/mcp/team-job-convergence.d.ts +9 -2
- package/dist/mcp/team-job-convergence.d.ts.map +1 -1
- package/dist/mcp/team-job-convergence.js +35 -14
- package/dist/mcp/team-job-convergence.js.map +1 -1
- package/dist/mcp/team-server.d.ts.map +1 -1
- package/dist/mcp/team-server.js +93 -13
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/ralphthon/prd.d.ts.map +1 -1
- package/dist/ralphthon/prd.js +13 -17
- package/dist/ralphthon/prd.js.map +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/team/__tests__/api-interop.cleanup.test.d.ts +2 -0
- package/dist/team/__tests__/api-interop.cleanup.test.d.ts.map +1 -0
- package/dist/team/__tests__/api-interop.cleanup.test.js +234 -0
- package/dist/team/__tests__/api-interop.cleanup.test.js.map +1 -0
- package/dist/team/__tests__/api-interop.dispatch.test.js +2 -1
- package/dist/team/__tests__/api-interop.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/auto-merge-restart.test.d.ts +2 -0
- package/dist/team/__tests__/auto-merge-restart.test.d.ts.map +1 -0
- package/dist/team/__tests__/auto-merge-restart.test.js +128 -0
- package/dist/team/__tests__/auto-merge-restart.test.js.map +1 -0
- package/dist/team/__tests__/auto-merge.perf.test.d.ts +2 -0
- package/dist/team/__tests__/auto-merge.perf.test.d.ts.map +1 -0
- package/dist/team/__tests__/auto-merge.perf.test.js +85 -0
- package/dist/team/__tests__/auto-merge.perf.test.js.map +1 -0
- package/dist/team/__tests__/conflict-mailbox.test.d.ts +2 -0
- package/dist/team/__tests__/conflict-mailbox.test.d.ts.map +1 -0
- package/dist/team/__tests__/conflict-mailbox.test.js +238 -0
- package/dist/team/__tests__/conflict-mailbox.test.js.map +1 -0
- package/dist/team/__tests__/git-worktree.test.js +164 -3
- package/dist/team/__tests__/git-worktree.test.js.map +1 -1
- package/dist/team/__tests__/helpers/git-fixture.d.ts +72 -0
- package/dist/team/__tests__/helpers/git-fixture.d.ts.map +1 -0
- package/dist/team/__tests__/helpers/git-fixture.js +252 -0
- package/dist/team/__tests__/helpers/git-fixture.js.map +1 -0
- package/dist/team/__tests__/leader-inbox.test.d.ts +2 -0
- package/dist/team/__tests__/leader-inbox.test.d.ts.map +1 -0
- package/dist/team/__tests__/leader-inbox.test.js +152 -0
- package/dist/team/__tests__/leader-inbox.test.js.map +1 -0
- package/dist/team/__tests__/merge-orchestrator.test.d.ts +2 -0
- package/dist/team/__tests__/merge-orchestrator.test.d.ts.map +1 -0
- package/dist/team/__tests__/merge-orchestrator.test.js +779 -0
- package/dist/team/__tests__/merge-orchestrator.test.js.map +1 -0
- package/dist/team/__tests__/model-contract.test.js +35 -21
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/rebase-smoke.test.d.ts +2 -0
- package/dist/team/__tests__/rebase-smoke.test.d.ts.map +1 -0
- package/dist/team/__tests__/rebase-smoke.test.js +272 -0
- package/dist/team/__tests__/rebase-smoke.test.js.map +1 -0
- package/dist/team/__tests__/runtime-cli.test.js +11 -3
- package/dist/team/__tests__/runtime-cli.test.js.map +1 -1
- package/dist/team/__tests__/runtime-prompt-mode.test.js +14 -16
- package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2-role-routing.test.js +7 -1
- package/dist/team/__tests__/runtime-v2-role-routing.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.dispatch.test.js +293 -15
- package/dist/team/__tests__/runtime-v2.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.monitor.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.monitor.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.monitor.test.js +219 -0
- package/dist/team/__tests__/runtime-v2.monitor.test.js.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.shutdown.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown.test.js +292 -0
- package/dist/team/__tests__/runtime-v2.shutdown.test.js.map +1 -0
- package/dist/team/__tests__/scaling-launch-config.test.js +203 -3
- package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
- package/dist/team/__tests__/team-summary-worktree.test.d.ts +2 -0
- package/dist/team/__tests__/team-summary-worktree.test.d.ts.map +1 -0
- package/dist/team/__tests__/team-summary-worktree.test.js +85 -0
- package/dist/team/__tests__/team-summary-worktree.test.js.map +1 -0
- package/dist/team/__tests__/teardown-invariant.test.d.ts +2 -0
- package/dist/team/__tests__/teardown-invariant.test.d.ts.map +1 -0
- package/dist/team/__tests__/teardown-invariant.test.js +176 -0
- package/dist/team/__tests__/teardown-invariant.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session-liveness.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-session-liveness.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session-liveness.test.js +37 -0
- package/dist/team/__tests__/tmux-session-liveness.test.js.map +1 -0
- package/dist/team/__tests__/worker-bootstrap.test.js +47 -1
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/__tests__/worker-commit-cadence.test.d.ts +2 -0
- package/dist/team/__tests__/worker-commit-cadence.test.d.ts.map +1 -0
- package/dist/team/__tests__/worker-commit-cadence.test.js +315 -0
- package/dist/team/__tests__/worker-commit-cadence.test.js.map +1 -0
- package/dist/team/__tests__/worktree-contract-fields.test.d.ts +2 -0
- package/dist/team/__tests__/worktree-contract-fields.test.d.ts.map +1 -0
- package/dist/team/__tests__/worktree-contract-fields.test.js +157 -0
- package/dist/team/__tests__/worktree-contract-fields.test.js.map +1 -0
- package/dist/team/__tests__/worktree-runtime-e2e.test.d.ts +2 -0
- package/dist/team/__tests__/worktree-runtime-e2e.test.d.ts.map +1 -0
- package/dist/team/__tests__/worktree-runtime-e2e.test.js +182 -0
- package/dist/team/__tests__/worktree-runtime-e2e.test.js.map +1 -0
- package/dist/team/api-interop.d.ts +2 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +121 -14
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/capabilities.d.ts.map +1 -1
- package/dist/team/capabilities.js +2 -0
- package/dist/team/capabilities.js.map +1 -1
- package/dist/team/cli-worker-contract.d.ts +7 -6
- package/dist/team/cli-worker-contract.d.ts.map +1 -1
- package/dist/team/cli-worker-contract.js +7 -6
- package/dist/team/cli-worker-contract.js.map +1 -1
- package/dist/team/conflict-mailbox.d.ts +49 -0
- package/dist/team/conflict-mailbox.d.ts.map +1 -0
- package/dist/team/conflict-mailbox.js +98 -0
- package/dist/team/conflict-mailbox.js.map +1 -0
- package/dist/team/events.d.ts +3 -0
- package/dist/team/events.d.ts.map +1 -1
- package/dist/team/events.js +2 -1
- package/dist/team/events.js.map +1 -1
- package/dist/team/git-worktree.d.ts +78 -10
- package/dist/team/git-worktree.d.ts.map +1 -1
- package/dist/team/git-worktree.js +453 -97
- package/dist/team/git-worktree.js.map +1 -1
- package/dist/team/governance.d.ts +3 -2
- package/dist/team/governance.d.ts.map +1 -1
- package/dist/team/governance.js.map +1 -1
- package/dist/team/leader-inbox.d.ts +28 -0
- package/dist/team/leader-inbox.d.ts.map +1 -0
- package/dist/team/leader-inbox.js +68 -0
- package/dist/team/leader-inbox.js.map +1 -0
- package/dist/team/merge-coordinator.d.ts +6 -0
- package/dist/team/merge-coordinator.d.ts.map +1 -1
- package/dist/team/merge-coordinator.js +6 -2
- package/dist/team/merge-coordinator.js.map +1 -1
- package/dist/team/merge-orchestrator.d.ts +41 -0
- package/dist/team/merge-orchestrator.d.ts.map +1 -0
- package/dist/team/merge-orchestrator.js +736 -0
- package/dist/team/merge-orchestrator.js.map +1 -0
- package/dist/team/model-contract.d.ts +18 -2
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +55 -28
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/monitor.d.ts.map +1 -1
- package/dist/team/monitor.js +47 -3
- package/dist/team/monitor.js.map +1 -1
- package/dist/team/runtime-cli.d.ts +1 -0
- package/dist/team/runtime-cli.d.ts.map +1 -1
- package/dist/team/runtime-cli.js +15 -2
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime-flags.d.ts +5 -0
- package/dist/team/runtime-flags.d.ts.map +1 -0
- package/dist/team/runtime-flags.js +12 -0
- package/dist/team/runtime-flags.js.map +1 -0
- package/dist/team/runtime-v2.d.ts +16 -1
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +531 -127
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +4 -1
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +110 -13
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/tasks.d.ts.map +1 -1
- package/dist/team/state/tasks.js +1 -0
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +112 -16
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/tmux-session.d.ts +17 -29
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +117 -108
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +31 -17
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts +11 -0
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +37 -14
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/team/worker-canonicalization.d.ts.map +1 -1
- package/dist/team/worker-canonicalization.js +2 -0
- package/dist/team/worker-canonicalization.js.map +1 -1
- package/dist/team/worker-commit-cadence.d.ts +70 -0
- package/dist/team/worker-commit-cadence.d.ts.map +1 -0
- package/dist/team/worker-commit-cadence.js +271 -0
- package/dist/team/worker-commit-cadence.js.map +1 -0
- package/dist/tools/__tests__/memory-tools.test.js +4 -4
- package/dist/tools/__tests__/memory-tools.test.js.map +1 -1
- package/dist/tools/__tests__/state-tools.test.js +13 -1
- package/dist/tools/__tests__/state-tools.test.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +1 -16
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/resolve-node.d.ts.map +1 -1
- package/dist/utils/resolve-node.js +22 -28
- package/dist/utils/resolve-node.js.map +1 -1
- package/docs/GETTING-STARTED.md +415 -0
- package/docs/MIGRATION.md +1003 -0
- package/docs/REFERENCE.md +21 -4
- package/docs/TEAM-WORKTREE-MODE.md +86 -0
- package/docs/company-context-interface.md +5 -16
- package/docs/copilot-instructions.md +1 -1
- package/package.json +1 -1
- package/scripts/keyword-detector.mjs +168 -20
- package/scripts/lib/hud-cache-wrapper.sh +122 -0
- package/scripts/persistent-mode.cjs +28 -2
- package/scripts/persistent-mode.mjs +28 -2
- package/scripts/plugin-setup.mjs +10 -1
- package/scripts/post-tool-verifier.mjs +153 -3
- package/scripts/pre-tool-enforcer.mjs +54 -6
- package/scripts/session-start.mjs +194 -2
- package/skills/AGENTS.md +22 -91
- package/skills/ai-slop-cleaner/SKILL.md +118 -120
- package/skills/ask/SKILL.md +6 -8
- package/skills/autopilot/SKILL.md +1 -28
- package/skills/autoresearch/SKILL.md +5 -5
- package/skills/cancel/SKILL.md +13 -13
- package/skills/cccg/SKILL.md +1 -0
- package/skills/configure-notifications/SKILL.md +80 -215
- package/skills/debug/SKILL.md +3 -2
- package/skills/deep-dive/SKILL.md +20 -9
- package/skills/deep-interview/SKILL.md +32 -4
- package/skills/deepinit/SKILL.md +1 -0
- package/skills/external-context/SKILL.md +2 -1
- package/skills/hud/SKILL.md +22 -52
- package/skills/learner/SKILL.md +90 -57
- package/skills/mcp-setup/SKILL.md +45 -60
- package/skills/omc-doctor/SKILL.md +1 -1
- package/skills/omc-reference/SKILL.md +6 -6
- package/skills/omc-setup/SKILL.md +30 -74
- package/skills/omc-setup/phases/01-install-claude-md.md +97 -0
- package/skills/omc-setup/phases/02-configure.md +25 -40
- package/skills/omc-setup/phases/03-integrations.md +100 -69
- package/skills/omc-setup/phases/04-welcome.md +102 -44
- package/skills/omc-teams/SKILL.md +63 -26
- package/skills/plan/SKILL.md +11 -9
- package/skills/ralph/SKILL.md +42 -41
- package/skills/ralplan/SKILL.md +3 -10
- package/skills/release/SKILL.md +168 -57
- package/skills/remember/SKILL.md +2 -1
- package/skills/sciomc/SKILL.md +12 -11
- package/skills/self-improve/SKILL.md +4 -4
- package/skills/setup/SKILL.md +1 -0
- package/skills/skill/SKILL.md +21 -20
- package/skills/skillify/SKILL.md +34 -3
- package/skills/team/SKILL.md +62 -44
- package/skills/ultraqa/SKILL.md +1 -2
- package/skills/ultrawork/SKILL.md +28 -21
- package/skills/verify/SKILL.md +2 -1
- package/skills/writer-memory/SKILL.md +2 -1
- package/templates/hooks/keyword-detector.mjs +129 -11
- package/templates/hooks/persistent-mode.mjs +28 -2
- package/templates/hooks/pre-tool-use.mjs +144 -45
- package/templates/hooks/session-start.mjs +25 -1
|
@@ -572,6 +572,32 @@ function readStateFileWithSession(stateDir, filename, sessionId) {
|
|
|
572
572
|
return readStateFile(stateDir, filename);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
const WORKFLOW_SLOT_TOMBSTONE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
576
|
+
|
|
577
|
+
function isWorkflowSlotTombstonedForMode(stateDir, mode, sessionId) {
|
|
578
|
+
const safeSessionId = sessionId && /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/.test(sessionId) ? sessionId : "";
|
|
579
|
+
const ledgerPath = safeSessionId
|
|
580
|
+
? join(stateDir, "sessions", safeSessionId, "skill-active-state.json")
|
|
581
|
+
: join(stateDir, "skill-active-state.json");
|
|
582
|
+
const ledger = readJsonFile(ledgerPath);
|
|
583
|
+
const slot = ledger?.active_skills?.[mode];
|
|
584
|
+
if (!slot || typeof slot !== "object") return false;
|
|
585
|
+
if (typeof slot.completed_at !== "string" || !slot.completed_at) return false;
|
|
586
|
+
const completedAt = new Date(slot.completed_at).getTime();
|
|
587
|
+
if (!Number.isFinite(completedAt)) return true;
|
|
588
|
+
return Date.now() - completedAt < WORKFLOW_SLOT_TOMBSTONE_TTL_MS;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function isAuthoritativeModeActive(stateDir, mode, loaded, sessionId) {
|
|
592
|
+
const state = loaded?.state;
|
|
593
|
+
if (!state?.active) return false;
|
|
594
|
+
if (isWorkflowSlotTombstonedForMode(stateDir, mode, sessionId)) return false;
|
|
595
|
+
const safeSessionId = sessionId && /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/.test(sessionId) ? sessionId : "";
|
|
596
|
+
if (safeSessionId && state.session_id && state.session_id !== safeSessionId) return false;
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
|
|
575
601
|
function getActiveSubagentCount(stateDir) {
|
|
576
602
|
try {
|
|
577
603
|
const tracking = readJsonFile(join(stateDir, "subagent-tracking.json"));
|
|
@@ -891,7 +917,7 @@ async function main() {
|
|
|
891
917
|
|
|
892
918
|
// Priority 1: Ralph Loop (explicit persistence mode)
|
|
893
919
|
// Skip if state is stale (older than 2 hours) - prevents blocking new sessions
|
|
894
|
-
if (ralph
|
|
920
|
+
if (isAuthoritativeModeActive(stateDir, "ralph", ralph, sessionId) && !isAwaitingConfirmation(ralph.state) && !isStaleState(ralph.state) && isSessionMatch(ralph.state, sessionId)) {
|
|
895
921
|
const iteration = ralph.state.iteration || 1;
|
|
896
922
|
const maxIter = ralph.state.max_iterations || 100;
|
|
897
923
|
|
|
@@ -1212,7 +1238,7 @@ async function main() {
|
|
|
1212
1238
|
// Session isolation: only block if state belongs to this session (issue #311)
|
|
1213
1239
|
// Project isolation: only block if state belongs to this project
|
|
1214
1240
|
if (
|
|
1215
|
-
ultrawork
|
|
1241
|
+
isAuthoritativeModeActive(stateDir, "ultrawork", ultrawork, sessionId) && !isAwaitingConfirmation(ultrawork.state) &&
|
|
1216
1242
|
!isStaleState(ultrawork.state) &&
|
|
1217
1243
|
isSessionMatch(ultrawork.state, sessionId) &&
|
|
1218
1244
|
isStateForCurrentProject(ultrawork.state, directory, ultrawork.isGlobal)
|
|
@@ -370,6 +370,32 @@ function readStateFileWithSession(stateDir, globalStateDir, filename, sessionId)
|
|
|
370
370
|
return readStateFile(stateDir, globalStateDir, filename);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
const WORKFLOW_SLOT_TOMBSTONE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
374
|
+
|
|
375
|
+
function isWorkflowSlotTombstonedForMode(stateDir, mode, sessionId) {
|
|
376
|
+
const safeSessionId = sanitizeSessionId(sessionId);
|
|
377
|
+
const ledgerPath = safeSessionId
|
|
378
|
+
? join(stateDir, "sessions", safeSessionId, "skill-active-state.json")
|
|
379
|
+
: join(stateDir, "skill-active-state.json");
|
|
380
|
+
const ledger = readJsonFile(ledgerPath);
|
|
381
|
+
const slot = ledger?.active_skills?.[mode];
|
|
382
|
+
if (!slot || typeof slot !== "object") return false;
|
|
383
|
+
if (typeof slot.completed_at !== "string" || !slot.completed_at) return false;
|
|
384
|
+
const completedAt = new Date(slot.completed_at).getTime();
|
|
385
|
+
if (!Number.isFinite(completedAt)) return true;
|
|
386
|
+
return Date.now() - completedAt < WORKFLOW_SLOT_TOMBSTONE_TTL_MS;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function isAuthoritativeModeActive(stateDir, mode, loaded, sessionId) {
|
|
390
|
+
const state = loaded?.state;
|
|
391
|
+
if (!state?.active) return false;
|
|
392
|
+
if (isWorkflowSlotTombstonedForMode(stateDir, mode, sessionId)) return false;
|
|
393
|
+
const safeSessionId = sanitizeSessionId(sessionId);
|
|
394
|
+
if (safeSessionId && state.session_id && state.session_id !== safeSessionId) return false;
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
373
399
|
function isSessionCancelInProgress(stateDir, sessionId) {
|
|
374
400
|
const isActiveSignal = (signalPath) => {
|
|
375
401
|
const signal = readJsonFile(signalPath);
|
|
@@ -762,7 +788,7 @@ async function main() {
|
|
|
762
788
|
// Priority 1: Ralph Loop (explicit persistence mode)
|
|
763
789
|
// Skip if state is stale (older than 2 hours) - prevents blocking new sessions
|
|
764
790
|
if (
|
|
765
|
-
ralph
|
|
791
|
+
isAuthoritativeModeActive(stateDir, "ralph", ralph, sessionId) && !isAwaitingConfirmation(ralph.state) &&
|
|
766
792
|
!isStaleState(ralph.state) &&
|
|
767
793
|
isStateForCurrentProject(ralph.state, directory, ralph.isGlobal)
|
|
768
794
|
) {
|
|
@@ -1102,7 +1128,7 @@ async function main() {
|
|
|
1102
1128
|
// If state has session_id, it must match. If no session_id (legacy), allow.
|
|
1103
1129
|
// Project isolation: only block if state belongs to this project
|
|
1104
1130
|
if (
|
|
1105
|
-
ultrawork
|
|
1131
|
+
isAuthoritativeModeActive(stateDir, "ultrawork", ultrawork, sessionId) && !isAwaitingConfirmation(ultrawork.state) &&
|
|
1106
1132
|
!isStaleState(ultrawork.state) &&
|
|
1107
1133
|
(hasValidSessionId
|
|
1108
1134
|
? ultrawork.state.session_id === sessionId
|
package/scripts/plugin-setup.mjs
CHANGED
|
@@ -35,6 +35,11 @@ if (!existsSync(HUD_LIB_DIR)) {
|
|
|
35
35
|
mkdirSync(HUD_LIB_DIR, { recursive: true });
|
|
36
36
|
}
|
|
37
37
|
copyFileSync(join(__dirname, 'lib', 'config-dir.mjs'), join(HUD_LIB_DIR, 'config-dir.mjs'));
|
|
38
|
+
copyFileSync(join(__dirname, 'lib', 'config-dir.sh'), join(HUD_LIB_DIR, 'config-dir.sh'));
|
|
39
|
+
copyFileSync(join(__dirname, 'find-node.sh'), join(HUD_DIR, 'find-node.sh'));
|
|
40
|
+
copyFileSync(join(__dirname, 'lib', 'hud-cache-wrapper.sh'), join(HUD_DIR, 'omcp-hud-cache.sh'));
|
|
41
|
+
try { chmodSync(join(HUD_DIR, 'find-node.sh'), 0o755); } catch { /* Windows doesn't need this */ }
|
|
42
|
+
try { chmodSync(join(HUD_DIR, 'omcp-hud-cache.sh'), 0o755); } catch { /* Windows doesn't need this */ }
|
|
38
43
|
|
|
39
44
|
// 2. Create HUD wrapper script
|
|
40
45
|
const hudScriptPath = join(HUD_DIR, 'omcp-hud.mjs').replace(/\\/g, '/');
|
|
@@ -238,9 +243,13 @@ try {
|
|
|
238
243
|
settings = JSON.parse(readFileSync(SETTINGS_FILE, 'utf-8'));
|
|
239
244
|
}
|
|
240
245
|
|
|
246
|
+
const statusLineCommand = process.platform === 'win32'
|
|
247
|
+
? `"${nodeBin}" "${hudScriptPath.replace(/\\/g, "/")}"`
|
|
248
|
+
: `sh "${join(HUD_DIR, 'omcp-hud-cache.sh').replace(/\\/g, "/")}" "${hudScriptPath.replace(/\\/g, "/")}"`;
|
|
249
|
+
|
|
241
250
|
settings.statusLine = {
|
|
242
251
|
type: 'command',
|
|
243
|
-
command:
|
|
252
|
+
command: statusLineCommand
|
|
244
253
|
};
|
|
245
254
|
writeFileSync(SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
246
255
|
console.log('[OMC] Configured HUD statusLine in settings.json');
|
|
@@ -718,6 +718,145 @@ export function isCopilotCliWriteSuccess(output) {
|
|
|
718
718
|
return successPatterns.some(pattern => pattern.test(cleaned));
|
|
719
719
|
}
|
|
720
720
|
|
|
721
|
+
function extractTextFromKnownToolResponseField(value, depth = 0) {
|
|
722
|
+
if (typeof value === 'string') return [value];
|
|
723
|
+
if (!value || depth > 4) return [];
|
|
724
|
+
|
|
725
|
+
if (Array.isArray(value)) {
|
|
726
|
+
return value.flatMap(item => extractTextFromKnownToolResponseField(item, depth + 1));
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
if (typeof value !== 'object') return [];
|
|
730
|
+
|
|
731
|
+
const textFields = ['text', 'message', 'result', 'output', 'stdout'];
|
|
732
|
+
const texts = [];
|
|
733
|
+
for (const field of textFields) {
|
|
734
|
+
if (typeof value[field] === 'string') {
|
|
735
|
+
texts.push(value[field]);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
if (
|
|
740
|
+
'content' in value &&
|
|
741
|
+
value.content &&
|
|
742
|
+
(Array.isArray(value.content) || typeof value.content === 'object')
|
|
743
|
+
) {
|
|
744
|
+
texts.push(...extractTextFromKnownToolResponseField(value.content, depth + 1));
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
return texts;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function isStructuredEnvelopePayloadField(fieldName) {
|
|
751
|
+
return new Set([
|
|
752
|
+
'content',
|
|
753
|
+
'oldstring',
|
|
754
|
+
'newstring',
|
|
755
|
+
'originalfile',
|
|
756
|
+
'structuredpatch',
|
|
757
|
+
'patch',
|
|
758
|
+
'diff',
|
|
759
|
+
'lines',
|
|
760
|
+
'line',
|
|
761
|
+
]).has(fieldName.toLowerCase());
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function isStructuredEnvelopeStatusTextField(fieldName) {
|
|
765
|
+
return new Set(['message', 'output', 'stdout', 'stderr', 'text', 'result'])
|
|
766
|
+
.has(fieldName.toLowerCase());
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function hasExplicitStructuredFailureIndicator(value, depth = 0, fieldName = '') {
|
|
770
|
+
if (!value || typeof value === 'string' || depth > 4) return false;
|
|
771
|
+
if (fieldName && isStructuredEnvelopePayloadField(fieldName)) return false;
|
|
772
|
+
|
|
773
|
+
if (Array.isArray(value)) {
|
|
774
|
+
return value.some(item => hasExplicitStructuredFailureIndicator(item, depth + 1, fieldName));
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
if (typeof value !== 'object') return false;
|
|
778
|
+
|
|
779
|
+
for (const [key, fieldValue] of Object.entries(value)) {
|
|
780
|
+
const normalizedKey = key.toLowerCase();
|
|
781
|
+
if (
|
|
782
|
+
typeof fieldValue === 'string' &&
|
|
783
|
+
isStructuredEnvelopeStatusTextField(key) &&
|
|
784
|
+
detectWriteFailure(fieldValue)
|
|
785
|
+
) {
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (
|
|
790
|
+
(normalizedKey.includes('error') || normalizedKey.includes('fail')) &&
|
|
791
|
+
fieldValue !== false &&
|
|
792
|
+
fieldValue !== 0 &&
|
|
793
|
+
fieldValue !== null &&
|
|
794
|
+
fieldValue !== undefined &&
|
|
795
|
+
!(typeof fieldValue === 'string' && fieldValue.trim() === '') &&
|
|
796
|
+
!(Array.isArray(fieldValue) && fieldValue.length === 0)
|
|
797
|
+
) {
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (hasExplicitStructuredFailureIndicator(fieldValue, depth + 1, key)) {
|
|
802
|
+
return true;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function hasEditEnvelopeSuccess(value, depth = 0) {
|
|
810
|
+
if (!value || typeof value === 'string' || depth > 4) return false;
|
|
811
|
+
|
|
812
|
+
if (Array.isArray(value)) {
|
|
813
|
+
return value.some(item => hasEditEnvelopeSuccess(item, depth + 1));
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if (typeof value !== 'object') return false;
|
|
817
|
+
|
|
818
|
+
if (hasExplicitStructuredFailureIndicator(value, depth)) return false;
|
|
819
|
+
|
|
820
|
+
if (typeof value.filePath === 'string' && Array.isArray(value.structuredPatch)) {
|
|
821
|
+
return true;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
return Object.values(value).some(item => hasEditEnvelopeSuccess(item, depth + 1));
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function hasWriteEnvelopeSuccess(value, depth = 0) {
|
|
828
|
+
if (!value || typeof value === 'string' || depth > 4) return false;
|
|
829
|
+
|
|
830
|
+
if (Array.isArray(value)) {
|
|
831
|
+
return value.some(item => hasWriteEnvelopeSuccess(item, depth + 1));
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (typeof value !== 'object') return false;
|
|
835
|
+
|
|
836
|
+
if (hasExplicitStructuredFailureIndicator(value, depth)) return false;
|
|
837
|
+
|
|
838
|
+
if (
|
|
839
|
+
typeof value.filePath === 'string' &&
|
|
840
|
+
(value.type === 'create' || value.type === 'update')
|
|
841
|
+
) {
|
|
842
|
+
return true;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
return Object.values(value).some(item => hasWriteEnvelopeSuccess(item, depth + 1));
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function hasStructuredWriteSuccess(rawResponse, toolName = '') {
|
|
849
|
+
if (!rawResponse || typeof rawResponse === 'string') return false;
|
|
850
|
+
if (toolName === 'Edit' && hasEditEnvelopeSuccess(rawResponse)) return true;
|
|
851
|
+
if (toolName === 'Write' && hasWriteEnvelopeSuccess(rawResponse)) return true;
|
|
852
|
+
return extractTextFromKnownToolResponseField(rawResponse).some(isCopilotCliWriteSuccess);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function hasStructuredWriteFailure(rawResponse) {
|
|
856
|
+
if (!rawResponse || typeof rawResponse === 'string') return false;
|
|
857
|
+
return hasExplicitStructuredFailureIndicator(rawResponse);
|
|
858
|
+
}
|
|
859
|
+
|
|
721
860
|
// Get agent completion summary from tracking state
|
|
722
861
|
function getAgentCompletionSummary(directory, quietLevel = QUIET_LEVEL) {
|
|
723
862
|
const trackingFile = join(directory, '.omcp', 'state', 'subagent-tracking.json');
|
|
@@ -746,7 +885,12 @@ function getAgentCompletionSummary(directory, quietLevel = QUIET_LEVEL) {
|
|
|
746
885
|
|
|
747
886
|
// Generate contextual message
|
|
748
887
|
function generateMessage(toolName, toolOutput, sessionId, toolCount, directory, options = {}) {
|
|
749
|
-
const {
|
|
888
|
+
const {
|
|
889
|
+
wasTruncated = false,
|
|
890
|
+
rawLength = 0,
|
|
891
|
+
structuredWriteSuccess = false,
|
|
892
|
+
structuredWriteFailure = false,
|
|
893
|
+
} = options;
|
|
750
894
|
let message = '';
|
|
751
895
|
|
|
752
896
|
switch (toolName) {
|
|
@@ -797,7 +941,7 @@ function generateMessage(toolName, toolOutput, sessionId, toolCount, directory,
|
|
|
797
941
|
}
|
|
798
942
|
|
|
799
943
|
case 'Edit':
|
|
800
|
-
if (!isCopilotCliWriteSuccess(toolOutput) && detectWriteFailure(toolOutput)) {
|
|
944
|
+
if (structuredWriteFailure || (!structuredWriteSuccess && !isCopilotCliWriteSuccess(toolOutput) && detectWriteFailure(toolOutput))) {
|
|
801
945
|
message = 'Edit operation failed. Verify file exists and content matches exactly.';
|
|
802
946
|
} else if (QUIET_LEVEL === 0) {
|
|
803
947
|
message = 'Code modified. Verify changes work as expected before marking complete.';
|
|
@@ -805,7 +949,7 @@ function generateMessage(toolName, toolOutput, sessionId, toolCount, directory,
|
|
|
805
949
|
break;
|
|
806
950
|
|
|
807
951
|
case 'Write':
|
|
808
|
-
if (!isCopilotCliWriteSuccess(toolOutput) && detectWriteFailure(toolOutput)) {
|
|
952
|
+
if (structuredWriteFailure || (!structuredWriteSuccess && !isCopilotCliWriteSuccess(toolOutput) && detectWriteFailure(toolOutput))) {
|
|
809
953
|
message = 'Write operation failed. Check file permissions and directory existence.';
|
|
810
954
|
} else if (QUIET_LEVEL === 0) {
|
|
811
955
|
message = 'File written. Test the changes to ensure they work correctly.';
|
|
@@ -862,6 +1006,10 @@ async function main() {
|
|
|
862
1006
|
|
|
863
1007
|
const toolName = data.tool_name || data.toolName || '';
|
|
864
1008
|
const rawResponse = data.tool_response || data.toolOutput || '';
|
|
1009
|
+
const structuredWriteSuccess =
|
|
1010
|
+
(toolName === 'Write' || toolName === 'Edit') && hasStructuredWriteSuccess(rawResponse, toolName);
|
|
1011
|
+
const structuredWriteFailure =
|
|
1012
|
+
(toolName === 'Write' || toolName === 'Edit') && hasStructuredWriteFailure(rawResponse);
|
|
865
1013
|
const toolOutput = typeof rawResponse === 'string' ? rawResponse : JSON.stringify(rawResponse);
|
|
866
1014
|
const { clipped: clippedToolOutput, wasTruncated } = clipToolOutputForAnalysis(toolName, toolOutput);
|
|
867
1015
|
const sessionId = data.session_id || data.sessionId || 'unknown';
|
|
@@ -907,6 +1055,8 @@ async function main() {
|
|
|
907
1055
|
generateMessage(toolName, clippedToolOutput, sessionId, toolCount, directory, {
|
|
908
1056
|
wasTruncated,
|
|
909
1057
|
rawLength: toolOutput.length,
|
|
1058
|
+
structuredWriteSuccess,
|
|
1059
|
+
structuredWriteFailure,
|
|
910
1060
|
}),
|
|
911
1061
|
maybeBuildPreemptiveCompactionMessage(toolName, data, directory),
|
|
912
1062
|
);
|
|
@@ -10,7 +10,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFile
|
|
|
10
10
|
import { dirname, join, resolve } from 'path';
|
|
11
11
|
import { execSync } from 'child_process';
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
13
|
-
import {
|
|
13
|
+
import { getCopilotConfigDir } from './lib/config-dir.mjs';
|
|
14
14
|
import { evaluateAgentHeavyPreflight } from './lib/pre-tool-enforcer-preflight.mjs';
|
|
15
15
|
import { resolveOmcStateRoot } from './lib/state-root.mjs';
|
|
16
16
|
import { readStdin } from './lib/stdin.mjs';
|
|
@@ -29,6 +29,53 @@ function hasExtendedContextSuffix(modelId) {
|
|
|
29
29
|
function isSubagentSafeModelId(modelId) {
|
|
30
30
|
return isProviderSpecificModelId(modelId) && !hasExtendedContextSuffix(modelId);
|
|
31
31
|
}
|
|
32
|
+
function isBedrockProviderEnv() {
|
|
33
|
+
if (process.env.CLAUDE_CODE_USE_BEDROCK === '1') return true;
|
|
34
|
+
const modelId = process.env.CLAUDE_MODEL || process.env.ANTHROPIC_MODEL || '';
|
|
35
|
+
if (/^((us|eu|ap|global)\.anthropic\.|anthropic\.claude)/i.test(modelId)) return true;
|
|
36
|
+
if (
|
|
37
|
+
/^arn:aws(-[^:]+)?:bedrock:/i.test(modelId)
|
|
38
|
+
&& /:(inference-profile|application-inference-profile)\//i.test(modelId)
|
|
39
|
+
&& modelId.toLowerCase().includes('claude')
|
|
40
|
+
) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function isVertexProviderEnv() {
|
|
46
|
+
if (process.env.CLAUDE_CODE_USE_VERTEX === '1') return true;
|
|
47
|
+
const modelId = process.env.CLAUDE_MODEL || process.env.ANTHROPIC_MODEL || '';
|
|
48
|
+
return !!modelId && modelId.toLowerCase().startsWith('vertex_ai/');
|
|
49
|
+
}
|
|
50
|
+
function getActiveModelIds() {
|
|
51
|
+
return [process.env.CLAUDE_MODEL || '', process.env.ANTHROPIC_MODEL || ''].filter(Boolean);
|
|
52
|
+
}
|
|
53
|
+
function isNormalClaudeModelId(modelId) {
|
|
54
|
+
const lower = (modelId || '').toLowerCase();
|
|
55
|
+
return Boolean(lower) && lower.includes('claude') && !isProviderSpecificModelId(modelId);
|
|
56
|
+
}
|
|
57
|
+
function hasNormalClaudeActiveModel() {
|
|
58
|
+
return getActiveModelIds().some(isNormalClaudeModelId);
|
|
59
|
+
}
|
|
60
|
+
function isConfigForceInheritProxyEnv() {
|
|
61
|
+
const config = loadOmcConfig();
|
|
62
|
+
return config.routing?.forceInherit === true && !hasNormalClaudeActiveModel();
|
|
63
|
+
}
|
|
64
|
+
function isNonClaudeProviderEnv() {
|
|
65
|
+
if (isBedrockProviderEnv() || isVertexProviderEnv()) return true;
|
|
66
|
+
const modelId = process.env.CLAUDE_MODEL || process.env.ANTHROPIC_MODEL || '';
|
|
67
|
+
if (modelId && !modelId.toLowerCase().includes('claude')) return true;
|
|
68
|
+
const baseUrl = process.env.ANTHROPIC_BASE_URL || '';
|
|
69
|
+
if (baseUrl && !baseUrl.includes('anthropic.com')) return true;
|
|
70
|
+
return isConfigForceInheritProxyEnv();
|
|
71
|
+
}
|
|
72
|
+
function acceptsProxyAnthropicDefaultTierValue(key, value) {
|
|
73
|
+
return key.startsWith('ANTHROPIC_DEFAULT_')
|
|
74
|
+
&& Boolean(value)
|
|
75
|
+
&& isNonClaudeProviderEnv()
|
|
76
|
+
&& !isBedrockProviderEnv()
|
|
77
|
+
&& !isVertexProviderEnv();
|
|
78
|
+
}
|
|
32
79
|
const TIER_ALIASES = new Set(['sonnet', 'opus', 'haiku']);
|
|
33
80
|
function isTierAlias(modelId) {
|
|
34
81
|
return TIER_ALIASES.has((modelId || '').toLowerCase());
|
|
@@ -55,9 +102,10 @@ function resolveTierAliasToSafeModel(tierAlias) {
|
|
|
55
102
|
// model resolution, which handles [1m] suffixes correctly for explicit model= calls.
|
|
56
103
|
// OMC-internal vars (OMC_SUBAGENT_MODEL, OMC_MODEL_*) are not read by CC, so a [1m]
|
|
57
104
|
// value there is not a valid routing proof — keep the stricter isSubagentSafeModelId check.
|
|
58
|
-
const
|
|
105
|
+
const isAnthropicDefaultTierVar = key.startsWith('ANTHROPIC_DEFAULT_');
|
|
106
|
+
const isNativeCcVar = isAnthropicDefaultTierVar || key.startsWith('CLAUDE_CODE_BEDROCK_');
|
|
59
107
|
const validator = isNativeCcVar ? isProviderSpecificModelId : isSubagentSafeModelId;
|
|
60
|
-
if (value && validator(value)) return value;
|
|
108
|
+
if (value && (validator(value) || acceptsProxyAnthropicDefaultTierValue(key, value))) return value;
|
|
61
109
|
}
|
|
62
110
|
return '';
|
|
63
111
|
}
|
|
@@ -167,7 +215,7 @@ function resolveTranscriptPath(transcriptPath, cwd) {
|
|
|
167
215
|
const lastSep = transcriptPath.lastIndexOf('/');
|
|
168
216
|
const sessionFile = lastSep !== -1 ? transcriptPath.substring(lastSep + 1) : '';
|
|
169
217
|
if (sessionFile) {
|
|
170
|
-
const configDir =
|
|
218
|
+
const configDir = getCopilotConfigDir();
|
|
171
219
|
const projectsDir = join(configDir, 'projects');
|
|
172
220
|
if (existsSync(projectsDir)) {
|
|
173
221
|
const encodedMain = mainRepoRoot.replace(/[/\\]/g, '-');
|
|
@@ -518,8 +566,8 @@ function getSkillProtectionLevel(skillName, rawSkillName) {
|
|
|
518
566
|
// Load OMC config to check forceInherit setting (issues #1135, #1201)
|
|
519
567
|
function loadOmcConfig() {
|
|
520
568
|
const configPaths = [
|
|
521
|
-
join(
|
|
522
|
-
join(process.cwd(), '.
|
|
569
|
+
join(getCopilotConfigDir(), '.omc-config.json'),
|
|
570
|
+
join(process.cwd(), '.omcp', 'config.json'),
|
|
523
571
|
];
|
|
524
572
|
for (const configPath of configPaths) {
|
|
525
573
|
try {
|
|
@@ -48,6 +48,180 @@ function readJsonFile(path) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
const WORKFLOW_SLOT_TOMBSTONE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
52
|
+
|
|
53
|
+
function isWorkflowSlotTombstonedForMode(omcRoot, mode, sessionId) {
|
|
54
|
+
const safeSessionId = typeof sessionId === 'string' && SAFE_SESSION_ID_PATTERN.test(sessionId) ? sessionId : '';
|
|
55
|
+
const ledgerPath = safeSessionId
|
|
56
|
+
? join(omcRoot, 'state', 'sessions', safeSessionId, 'skill-active-state.json')
|
|
57
|
+
: join(omcRoot, 'state', 'skill-active-state.json');
|
|
58
|
+
const ledger = readJsonFile(ledgerPath);
|
|
59
|
+
const slot = ledger?.active_skills?.[mode];
|
|
60
|
+
if (!slot || typeof slot !== 'object') return false;
|
|
61
|
+
if (typeof slot.completed_at !== 'string' || !slot.completed_at) return false;
|
|
62
|
+
const completedAt = new Date(slot.completed_at).getTime();
|
|
63
|
+
if (!Number.isFinite(completedAt)) return true;
|
|
64
|
+
return Date.now() - completedAt < WORKFLOW_SLOT_TOMBSTONE_TTL_MS;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function shouldRestoreModeState(omcRoot, mode, state, sessionId) {
|
|
68
|
+
if (!state?.active) return false;
|
|
69
|
+
if (isWorkflowSlotTombstonedForMode(omcRoot, mode, sessionId)) return false;
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function readLinuxBootId() {
|
|
74
|
+
try {
|
|
75
|
+
if (!existsSync(LINUX_BOOT_ID_PATH)) return undefined;
|
|
76
|
+
const bootId = readFileSync(LINUX_BOOT_ID_PATH, 'utf-8').trim();
|
|
77
|
+
return bootId || undefined;
|
|
78
|
+
} catch {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function sessionStateDir(omcRoot, sessionId) {
|
|
84
|
+
return join(omcRoot, 'state', 'sessions', sessionId);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function sessionStartedMarkerPath(omcRoot, sessionId) {
|
|
88
|
+
return join(sessionStateDir(omcRoot, sessionId), SESSION_STARTED_MARKER_FILE);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function writeSessionStartedMarker(omcRoot, directory, sessionId) {
|
|
92
|
+
if (!sessionId || !SAFE_SESSION_ID_PATTERN.test(sessionId)) return;
|
|
93
|
+
try {
|
|
94
|
+
const dir = sessionStateDir(omcRoot, sessionId);
|
|
95
|
+
mkdirSync(dir, { recursive: true });
|
|
96
|
+
writeFileSync(
|
|
97
|
+
sessionStartedMarkerPath(omcRoot, sessionId),
|
|
98
|
+
JSON.stringify({
|
|
99
|
+
session_id: sessionId,
|
|
100
|
+
started_at: new Date().toISOString(),
|
|
101
|
+
cwd: directory,
|
|
102
|
+
pid: process.pid,
|
|
103
|
+
// Do not persist process.ppid here: installed hooks run through
|
|
104
|
+
// scripts/run.cjs, whose short-lived process exits as soon as this
|
|
105
|
+
// hook returns. Treating that runner PID as owner liveness caused
|
|
106
|
+
// later SessionStart hooks to falsely clean live session state.
|
|
107
|
+
boot_id: readLinuxBootId(),
|
|
108
|
+
}, null, 2),
|
|
109
|
+
{ encoding: 'utf-8', mode: 0o600 },
|
|
110
|
+
);
|
|
111
|
+
} catch {
|
|
112
|
+
// Best-effort only; SessionStart must remain non-blocking.
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function removeSessionStartedMarker(omcRoot, sessionId) {
|
|
117
|
+
if (!sessionId || !SAFE_SESSION_ID_PATTERN.test(sessionId)) return;
|
|
118
|
+
try {
|
|
119
|
+
const markerPath = sessionStartedMarkerPath(omcRoot, sessionId);
|
|
120
|
+
if (existsSync(markerPath)) unlinkSync(markerPath);
|
|
121
|
+
} catch {
|
|
122
|
+
// Best-effort only.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Return true only when SessionStart has durable abandonment evidence.
|
|
128
|
+
*
|
|
129
|
+
* Claude Code SessionStart input currently provides session metadata such as
|
|
130
|
+
* session_id, transcript_path, cwd, source, model, and agent_type, but no
|
|
131
|
+
* stable owner process for the interactive session. In installed OMC hooks the
|
|
132
|
+
* immediate hook parent belongs to scripts/run.cjs and is intentionally
|
|
133
|
+
* short-lived, so same-boot PID liveness checks are not reliable here. SessionEnd
|
|
134
|
+
* remains the primary same-boot cleanup path; SessionStart only reconciles
|
|
135
|
+
* durable leftovers, such as markers from a previous OS boot.
|
|
136
|
+
*/
|
|
137
|
+
function hasDurableAbandonmentEvidence(marker) {
|
|
138
|
+
const storedBootId = typeof marker?.boot_id === 'string' ? marker.boot_id : undefined;
|
|
139
|
+
const currentBootId = readLinuxBootId();
|
|
140
|
+
if (storedBootId && currentBootId && storedBootId !== currentBootId) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Same-boot hard-kill cleanup requires a durable owner signal. Claude Code
|
|
145
|
+
// does not currently provide one to hooks, so keep active state rather than
|
|
146
|
+
// guessing from hook-runner process ancestry or transcript metadata.
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function cleanupSessionModeState(omcRoot, sessionId) {
|
|
151
|
+
const sessionDir = sessionStateDir(omcRoot, sessionId);
|
|
152
|
+
for (const file of SESSION_END_MODE_STATE_FILES) {
|
|
153
|
+
try {
|
|
154
|
+
const filePath = join(sessionDir, file);
|
|
155
|
+
const state = readJsonFile(filePath);
|
|
156
|
+
if (state?.active === true || file === 'skill-active-state.json') {
|
|
157
|
+
unlinkSync(filePath);
|
|
158
|
+
}
|
|
159
|
+
} catch {
|
|
160
|
+
// Leave ambiguous/unreadable state untouched.
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function cleanupMissionStateForSession(omcRoot, sessionId) {
|
|
166
|
+
const missionStatePath = join(omcRoot, 'state', 'mission-state.json');
|
|
167
|
+
const parsed = readJsonFile(missionStatePath);
|
|
168
|
+
if (!Array.isArray(parsed?.missions)) return;
|
|
169
|
+
|
|
170
|
+
const before = parsed.missions.length;
|
|
171
|
+
parsed.missions = parsed.missions.filter((mission) => {
|
|
172
|
+
if (mission?.source !== 'session') return true;
|
|
173
|
+
const missionId = typeof mission.id === 'string' ? mission.id : '';
|
|
174
|
+
return !missionId.includes(sessionId);
|
|
175
|
+
});
|
|
176
|
+
if (parsed.missions.length !== before) {
|
|
177
|
+
parsed.updatedAt = new Date().toISOString();
|
|
178
|
+
try {
|
|
179
|
+
writeFileSync(missionStatePath, JSON.stringify(parsed, null, 2));
|
|
180
|
+
} catch {
|
|
181
|
+
// Best-effort only.
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function reconcileAbandonedSessionStarts(omcRoot, currentSessionId) {
|
|
187
|
+
const sessionsDir = join(omcRoot, 'state', 'sessions');
|
|
188
|
+
if (!existsSync(sessionsDir)) return;
|
|
189
|
+
|
|
190
|
+
let entries = [];
|
|
191
|
+
try {
|
|
192
|
+
entries = readdirSync(sessionsDir);
|
|
193
|
+
} catch {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
for (const sessionId of entries) {
|
|
198
|
+
if (!SAFE_SESSION_ID_PATTERN.test(sessionId) || sessionId === currentSessionId) continue;
|
|
199
|
+
|
|
200
|
+
const marker = readJsonFile(sessionStartedMarkerPath(omcRoot, sessionId));
|
|
201
|
+
if (!marker || marker.session_id !== sessionId) continue;
|
|
202
|
+
|
|
203
|
+
if (existsSync(join(omcRoot, 'sessions', `${sessionId}.json`))) {
|
|
204
|
+
removeSessionStartedMarker(omcRoot, sessionId);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!hasDurableAbandonmentEvidence(marker)) continue;
|
|
209
|
+
|
|
210
|
+
cleanupSessionModeState(omcRoot, sessionId);
|
|
211
|
+
cleanupMissionStateForSession(omcRoot, sessionId);
|
|
212
|
+
removeSessionStartedMarker(omcRoot, sessionId);
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const sessionDir = sessionStateDir(omcRoot, sessionId);
|
|
216
|
+
if (readdirSync(sessionDir).length === 0) {
|
|
217
|
+
rmSync(sessionDir, { recursive: false, force: true });
|
|
218
|
+
}
|
|
219
|
+
} catch {
|
|
220
|
+
// Leave non-empty/unreadable directories untouched.
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
51
225
|
function getRuntimeBaseDir() {
|
|
52
226
|
return process.env.PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT || join(__dirname, '..');
|
|
53
227
|
}
|
|
@@ -145,6 +319,21 @@ function semverCompare(a, b) {
|
|
|
145
319
|
|
|
146
320
|
const SESSION_START_CONTEXT_BUDGET = 6000;
|
|
147
321
|
const SESSION_START_OMISSION_NOTICE = '[Additional SessionStart context omitted to preserve the 6000-character aggregate budget.]';
|
|
322
|
+
const SESSION_STARTED_MARKER_FILE = 'session-started.json';
|
|
323
|
+
const SAFE_SESSION_ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/;
|
|
324
|
+
const LINUX_BOOT_ID_PATH = '/proc/sys/kernel/random/boot_id';
|
|
325
|
+
const SESSION_END_MODE_STATE_FILES = [
|
|
326
|
+
'autopilot-state.json',
|
|
327
|
+
'autoresearch-state.json',
|
|
328
|
+
'team-state.json',
|
|
329
|
+
'ralph-state.json',
|
|
330
|
+
'ultrawork-state.json',
|
|
331
|
+
'ultraqa-state.json',
|
|
332
|
+
'ralplan-state.json',
|
|
333
|
+
'deep-interview-state.json',
|
|
334
|
+
'self-improve-state.json',
|
|
335
|
+
'skill-active-state.json',
|
|
336
|
+
];
|
|
148
337
|
|
|
149
338
|
function compactBudgetedText(text, maxChars) {
|
|
150
339
|
const notice = '\n...[truncated to preserve SessionStart context budget]';
|
|
@@ -432,6 +621,9 @@ async function main() {
|
|
|
432
621
|
const messages = [];
|
|
433
622
|
const projectMemoryModules = await loadProjectMemoryModules();
|
|
434
623
|
|
|
624
|
+
writeSessionStartedMarker(omcRoot, directory, sessionId);
|
|
625
|
+
reconcileAbandonedSessionStarts(omcRoot, sessionId);
|
|
626
|
+
|
|
435
627
|
// Check for version drift between components
|
|
436
628
|
const driftInfo = detectVersionDrift();
|
|
437
629
|
if (driftInfo && shouldNotifyDrift(driftInfo)) {
|
|
@@ -489,7 +681,7 @@ async function main() {
|
|
|
489
681
|
ultraworkState = readJsonFile(join(omcRoot, 'state', 'ultrawork-state.json'));
|
|
490
682
|
}
|
|
491
683
|
|
|
492
|
-
if (ultraworkState
|
|
684
|
+
if (shouldRestoreModeState(omcRoot, 'ultrawork', ultraworkState, sessionId)) {
|
|
493
685
|
messages.push(`<session-restore>
|
|
494
686
|
|
|
495
687
|
[ULTRAWORK MODE RESTORED]
|
|
@@ -522,7 +714,7 @@ Treat this as prior-session context only. Prioritize the user's newest request,
|
|
|
522
714
|
ralphState = readJsonFile(join(omcRoot, 'ralph-state.json'));
|
|
523
715
|
}
|
|
524
716
|
}
|
|
525
|
-
if (ralphState
|
|
717
|
+
if (shouldRestoreModeState(omcRoot, 'ralph', ralphState, sessionId)) {
|
|
526
718
|
messages.push(`<session-restore>
|
|
527
719
|
|
|
528
720
|
[RALPH LOOP RESTORED]
|