claudecode-omc 4.4.5 → 4.4.7
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/.mcp.json +2 -6
- package/README.es.md +64 -8
- package/README.ja.md +64 -8
- package/README.ko.md +64 -8
- package/README.pt.md +29 -0
- package/README.vi.md +29 -0
- package/README.zh.md +64 -8
- package/agents/architect.md +17 -7
- package/agents/code-reviewer.md +6 -7
- package/agents/critic.md +14 -1
- package/agents/deep-executor.md +6 -7
- package/agents/designer.md +6 -8
- package/agents/executor.md +6 -7
- package/agents/planner.md +21 -0
- package/agents/quality-reviewer.md +6 -7
- package/agents/security-reviewer.md +6 -7
- package/agents/test-engineer.md +6 -7
- package/bridge/mcp-server.cjs +517 -202
- package/bridge/runtime-cli.cjs +1550 -0
- package/bridge/team-bridge.cjs +362 -103
- package/bridge/{gemini-server.cjs → team-mcp.cjs} +10914 -10240
- package/dist/__tests__/auto-update.test.js +1 -1
- package/dist/__tests__/auto-update.test.js.map +1 -1
- package/dist/__tests__/cli-win32-warning.test.d.ts +2 -0
- package/dist/__tests__/cli-win32-warning.test.d.ts.map +1 -0
- package/dist/__tests__/cli-win32-warning.test.js +46 -0
- package/dist/__tests__/cli-win32-warning.test.js.map +1 -0
- package/dist/__tests__/codex-callsite-normalization.test.js +112 -0
- package/dist/__tests__/consensus-execution-handoff.test.d.ts +2 -0
- package/dist/__tests__/consensus-execution-handoff.test.d.ts.map +1 -1
- package/dist/__tests__/consensus-execution-handoff.test.js +48 -0
- package/dist/__tests__/consensus-execution-handoff.test.js.map +1 -1
- package/dist/__tests__/context-safety.test.d.ts +2 -0
- package/dist/__tests__/context-safety.test.d.ts.map +1 -0
- package/dist/__tests__/context-safety.test.js +59 -0
- package/dist/__tests__/context-safety.test.js.map +1 -0
- package/dist/__tests__/hooks.test.js +15 -0
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/hud/call-counts.test.js +0 -3
- package/dist/__tests__/hud/call-counts.test.js.map +1 -1
- package/dist/__tests__/hud/defaults.test.js +3 -5
- package/dist/__tests__/hud/defaults.test.js.map +1 -1
- package/dist/__tests__/hud/prompt-time.test.d.ts +2 -0
- package/dist/__tests__/hud/prompt-time.test.d.ts.map +1 -0
- package/dist/__tests__/hud/prompt-time.test.js +24 -0
- package/dist/__tests__/hud/prompt-time.test.js.map +1 -0
- package/dist/__tests__/hud/render.test.js +0 -1
- package/dist/__tests__/hud/render.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api.test.js +5 -0
- package/dist/__tests__/hud/usage-api.test.js.map +1 -1
- package/dist/__tests__/hud/version-display.test.js +1 -0
- package/dist/__tests__/hud/version-display.test.js.map +1 -1
- package/dist/__tests__/hud/windows-platform.test.js +0 -4
- package/dist/__tests__/hud/windows-platform.test.js.map +1 -1
- package/dist/__tests__/hud-windows.test.js +5 -3
- package/dist/__tests__/hud-windows.test.js.map +1 -1
- package/dist/__tests__/installer-hud-skip.test.js +12 -2
- package/dist/__tests__/installer-hud-skip.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +1 -1
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/__tests__/job-management-sqlite.test.js +0 -15
- package/dist/__tests__/job-management-sqlite.test.js.map +1 -1
- package/dist/__tests__/job-management.test.js +0 -16
- package/dist/__tests__/job-management.test.js.map +1 -1
- package/dist/__tests__/load-agent-prompt.test.js +0 -23
- package/dist/__tests__/load-agent-prompt.test.js.map +1 -1
- package/dist/__tests__/model-routing.test.js +3 -2
- package/dist/__tests__/model-routing.test.js.map +1 -1
- package/dist/__tests__/omc-tools-server-interop.test.js +1 -1
- package/dist/__tests__/omc-tools-server-interop.test.js.map +1 -1
- package/dist/__tests__/pre-tool-enforcer.test.d.ts +2 -0
- package/dist/__tests__/pre-tool-enforcer.test.d.ts.map +1 -0
- package/dist/__tests__/pre-tool-enforcer.test.js +194 -0
- package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -0
- package/dist/__tests__/prompt-injection.test.js +0 -26
- package/dist/__tests__/prompt-injection.test.js.map +1 -1
- package/dist/__tests__/purge-stale-cache.test.js +3 -2
- package/dist/__tests__/purge-stale-cache.test.js.map +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.d.ts +2 -0
- package/dist/__tests__/run-cjs-graceful-fallback.test.d.ts.map +1 -0
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +167 -0
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -0
- package/dist/__tests__/session-start-cache-cleanup.test.d.ts +2 -0
- package/dist/__tests__/session-start-cache-cleanup.test.d.ts.map +1 -0
- package/dist/__tests__/session-start-cache-cleanup.test.js +150 -0
- package/dist/__tests__/session-start-cache-cleanup.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +7 -10
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/__tests__/team-server-validation.test.d.ts +2 -0
- package/dist/__tests__/team-server-validation.test.d.ts.map +1 -0
- package/dist/__tests__/team-server-validation.test.js +122 -0
- package/dist/__tests__/team-server-validation.test.js.map +1 -0
- package/dist/agents/index.d.ts +0 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +0 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prompt-helpers.d.ts +74 -0
- package/dist/agents/prompt-helpers.d.ts.map +1 -0
- package/dist/agents/prompt-helpers.js +187 -0
- package/dist/agents/prompt-helpers.js.map +1 -0
- package/dist/agents/utils.d.ts +1 -5
- package/dist/agents/utils.d.ts.map +1 -1
- package/dist/agents/utils.js +1 -34
- package/dist/agents/utils.js.map +1 -1
- package/dist/cli/__tests__/launch.test.d.ts +1 -2
- package/dist/cli/__tests__/launch.test.d.ts.map +1 -1
- package/dist/cli/__tests__/launch.test.js +442 -48
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/teleport-help.test.d.ts +2 -0
- package/dist/cli/__tests__/teleport-help.test.d.ts.map +1 -0
- package/dist/cli/__tests__/teleport-help.test.js +17 -0
- package/dist/cli/__tests__/teleport-help.test.js.map +1 -0
- package/dist/cli/commands/teleport.d.ts +2 -1
- package/dist/cli/commands/teleport.d.ts.map +1 -1
- package/dist/cli/commands/teleport.js +6 -3
- package/dist/cli/commands/teleport.js.map +1 -1
- package/dist/cli/index.js +40 -290
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch.d.ts +83 -3
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +213 -48
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/win32-warning.d.ts +6 -0
- package/dist/cli/win32-warning.d.ts.map +1 -0
- package/dist/cli/win32-warning.js +15 -0
- package/dist/cli/win32-warning.js.map +1 -0
- package/dist/config/loader.d.ts +9 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +29 -19
- package/dist/config/loader.js.map +1 -1
- package/dist/config/models.d.ts +33 -0
- package/dist/config/models.d.ts.map +1 -0
- package/dist/config/models.js +49 -0
- package/dist/config/models.js.map +1 -0
- package/dist/constants/names.d.ts +2 -0
- package/dist/constants/names.d.ts.map +1 -1
- package/dist/constants/names.js +2 -0
- package/dist/constants/names.js.map +1 -1
- package/dist/features/auto-update.d.ts.map +1 -1
- package/dist/features/auto-update.js +21 -11
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/background-agent/manager.d.ts.map +1 -1
- package/dist/features/background-agent/manager.js +1 -2
- package/dist/features/background-agent/manager.js.map +1 -1
- package/dist/features/boulder-state/storage.d.ts.map +1 -1
- package/dist/features/boulder-state/storage.js +9 -5
- package/dist/features/boulder-state/storage.js.map +1 -1
- package/dist/features/boulder-state/types.d.ts +4 -0
- package/dist/features/boulder-state/types.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.js +25 -78
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +4 -1
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/features/delegation-routing/__tests__/resolver.test.js +47 -122
- package/dist/features/delegation-routing/__tests__/resolver.test.js.map +1 -1
- package/dist/features/delegation-routing/resolver.d.ts.map +1 -1
- package/dist/features/delegation-routing/resolver.js +24 -47
- package/dist/features/delegation-routing/resolver.js.map +1 -1
- package/dist/features/delegation-routing/types.d.ts.map +1 -1
- package/dist/features/delegation-routing/types.js +2 -0
- package/dist/features/delegation-routing/types.js.map +1 -1
- package/dist/features/model-routing/external-model-policy.d.ts.map +1 -1
- package/dist/features/model-routing/external-model-policy.js.map +1 -1
- package/dist/features/model-routing/router.d.ts.map +1 -1
- package/dist/features/model-routing/router.js +12 -2
- package/dist/features/model-routing/router.js.map +1 -1
- package/dist/features/model-routing/types.d.ts +5 -1
- package/dist/features/model-routing/types.d.ts.map +1 -1
- package/dist/features/model-routing/types.js +7 -6
- package/dist/features/model-routing/types.js.map +1 -1
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +40 -4
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/features/task-decomposer/index.js +14 -4
- package/dist/features/task-decomposer/index.js.map +1 -1
- package/dist/hooks/__tests__/bridge-openclaw.test.d.ts +2 -0
- package/dist/hooks/__tests__/bridge-openclaw.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/bridge-openclaw.test.js +124 -0
- package/dist/hooks/__tests__/bridge-openclaw.test.js.map +1 -0
- package/dist/hooks/__tests__/bridge-security.test.js +1 -1
- package/dist/hooks/__tests__/bridge-security.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +38 -61
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/bridge.d.ts +11 -0
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +154 -82
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/comment-checker/index.d.ts.map +1 -1
- package/dist/hooks/comment-checker/index.js +3 -1
- package/dist/hooks/comment-checker/index.js.map +1 -1
- package/dist/hooks/conductor/__tests__/state.test.js +4 -2
- package/dist/hooks/conductor/__tests__/state.test.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js +348 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +29 -0
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +123 -1
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/learner/bridge.d.ts.map +1 -1
- package/dist/hooks/learner/bridge.js +19 -4
- package/dist/hooks/learner/bridge.js.map +1 -1
- package/dist/hooks/learner/finder.d.ts.map +1 -1
- package/dist/hooks/learner/finder.js +19 -4
- package/dist/hooks/learner/finder.js.map +1 -1
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js +40 -0
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js.map +1 -1
- package/dist/hooks/mode-registry/index.d.ts.map +1 -1
- package/dist/hooks/mode-registry/index.js +135 -52
- package/dist/hooks/mode-registry/index.js.map +1 -1
- package/dist/hooks/notepad/index.d.ts.map +1 -1
- package/dist/hooks/notepad/index.js +5 -3
- package/dist/hooks/notepad/index.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js +73 -0
- package/dist/hooks/persistent-mode/__tests__/cancel-race.test.js.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/idle-cooldown.test.js +89 -13
- package/dist/hooks/persistent-mode/__tests__/idle-cooldown.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.js +156 -0
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.js.map +1 -0
- package/dist/hooks/persistent-mode/idle-cooldown.test.d.ts +2 -3
- package/dist/hooks/persistent-mode/idle-cooldown.test.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/idle-cooldown.test.js +19 -4
- package/dist/hooks/persistent-mode/idle-cooldown.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts +2 -2
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +144 -26
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/plugin-patterns/index.d.ts.map +1 -1
- package/dist/hooks/plugin-patterns/index.js +22 -31
- package/dist/hooks/plugin-patterns/index.js.map +1 -1
- package/dist/hooks/pre-compact/index.js +1 -1
- package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -1
- package/dist/hooks/preemptive-compaction/index.js +3 -1
- package/dist/hooks/preemptive-compaction/index.js.map +1 -1
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +9 -0
- package/dist/hooks/project-memory/index.js.map +1 -1
- package/dist/hooks/project-memory/learner.d.ts.map +1 -1
- package/dist/hooks/project-memory/learner.js +107 -85
- package/dist/hooks/project-memory/learner.js.map +1 -1
- package/dist/hooks/project-memory/storage.d.ts.map +1 -1
- package/dist/hooks/project-memory/storage.js +3 -2
- package/dist/hooks/project-memory/storage.js.map +1 -1
- package/dist/hooks/recovery/context-window.d.ts +4 -0
- package/dist/hooks/recovery/context-window.d.ts.map +1 -1
- package/dist/hooks/recovery/context-window.js +22 -1
- package/dist/hooks/recovery/context-window.js.map +1 -1
- package/dist/hooks/recovery/session-recovery.js +1 -1
- package/dist/hooks/recovery/session-recovery.js.map +1 -1
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +13 -22
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/setup/__tests__/windows-patch.test.d.ts +2 -0
- package/dist/hooks/setup/__tests__/windows-patch.test.d.ts.map +1 -0
- package/dist/hooks/setup/__tests__/windows-patch.test.js +110 -0
- package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -0
- package/dist/hooks/setup/index.d.ts +18 -0
- package/dist/hooks/setup/index.d.ts.map +1 -1
- package/dist/hooks/setup/index.js +59 -1
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/skill-bridge.cjs +17 -3
- package/dist/hooks/skill-state/__tests__/skill-state.test.d.ts +2 -0
- package/dist/hooks/skill-state/__tests__/skill-state.test.d.ts.map +1 -0
- package/dist/hooks/skill-state/__tests__/skill-state.test.js +301 -0
- package/dist/hooks/skill-state/__tests__/skill-state.test.js.map +1 -0
- package/dist/hooks/skill-state/index.d.ts +79 -0
- package/dist/hooks/skill-state/index.d.ts.map +1 -0
- package/dist/hooks/skill-state/index.js +245 -0
- package/dist/hooks/skill-state/index.js.map +1 -0
- package/dist/hooks/team-pipeline/state.d.ts.map +1 -1
- package/dist/hooks/team-pipeline/state.js +5 -0
- package/dist/hooks/team-pipeline/state.js.map +1 -1
- package/dist/hooks/todo-continuation/index.d.ts +17 -0
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -1
- package/dist/hooks/todo-continuation/index.js +44 -2
- package/dist/hooks/todo-continuation/index.js.map +1 -1
- package/dist/hud/elements/call-counts.d.ts.map +1 -1
- package/dist/hud/elements/call-counts.js +6 -4
- package/dist/hud/elements/call-counts.js.map +1 -1
- package/dist/hud/elements/index.d.ts +1 -0
- package/dist/hud/elements/index.d.ts.map +1 -1
- package/dist/hud/elements/index.js +1 -0
- package/dist/hud/elements/index.js.map +1 -1
- package/dist/hud/elements/prompt-time.d.ts +13 -0
- package/dist/hud/elements/prompt-time.d.ts.map +1 -0
- package/dist/hud/elements/prompt-time.js +21 -0
- package/dist/hud/elements/prompt-time.js.map +1 -0
- package/dist/hud/index.d.ts +2 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +40 -215
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +7 -108
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +4 -3
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/stdin.d.ts +10 -0
- package/dist/hud/stdin.d.ts.map +1 -1
- package/dist/hud/stdin.js +43 -0
- package/dist/hud/stdin.js.map +1 -1
- package/dist/hud/types.d.ts +6 -18
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +6 -46
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +12 -0
- package/dist/hud/usage-api.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -11
- package/dist/index.js.map +1 -1
- package/dist/installer/hooks.d.ts +5 -0
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +8 -0
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +26 -11
- package/dist/installer/index.js.map +1 -1
- package/dist/interop/omx-team-state.d.ts.map +1 -1
- package/dist/interop/omx-team-state.js +38 -6
- package/dist/interop/omx-team-state.js.map +1 -1
- package/dist/interop/shared-state.d.ts.map +1 -1
- package/dist/interop/shared-state.js +58 -7
- package/dist/interop/shared-state.js.map +1 -1
- package/dist/lib/__tests__/worktree-paths.test.js +250 -1
- package/dist/lib/__tests__/worktree-paths.test.js.map +1 -1
- package/dist/lib/job-state-db.d.ts +150 -0
- package/dist/lib/job-state-db.d.ts.map +1 -0
- package/dist/lib/job-state-db.js +650 -0
- package/dist/lib/job-state-db.js.map +1 -0
- package/dist/lib/mode-names.d.ts +46 -0
- package/dist/lib/mode-names.d.ts.map +1 -0
- package/dist/lib/mode-names.js +73 -0
- package/dist/lib/mode-names.js.map +1 -0
- package/dist/lib/session-isolation.d.ts +32 -0
- package/dist/lib/session-isolation.d.ts.map +1 -0
- package/dist/lib/session-isolation.js +39 -0
- package/dist/lib/session-isolation.js.map +1 -0
- package/dist/lib/worktree-paths.d.ts +38 -8
- package/dist/lib/worktree-paths.d.ts.map +1 -1
- package/dist/lib/worktree-paths.js +124 -56
- package/dist/lib/worktree-paths.js.map +1 -1
- package/dist/mcp/__tests__/team-cleanup.test.d.ts +11 -0
- package/dist/mcp/__tests__/team-cleanup.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/team-cleanup.test.js +228 -0
- package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -0
- package/dist/mcp/cli-detection.d.ts +4 -8
- package/dist/mcp/cli-detection.d.ts.map +1 -1
- package/dist/mcp/cli-detection.js +5 -8
- package/dist/mcp/cli-detection.js.map +1 -1
- package/dist/mcp/codex-request-normalizer.js +59 -0
- package/dist/mcp/codex-server.js +16 -4
- package/dist/mcp/codex-standalone-server.js +13 -4
- package/dist/mcp/index.d.ts +2 -4
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/job-management.d.ts.map +1 -1
- package/dist/mcp/job-management.js +11 -9
- package/dist/mcp/job-management.js.map +1 -1
- package/dist/mcp/job-state-db.d.ts +1 -149
- package/dist/mcp/job-state-db.d.ts.map +1 -1
- package/dist/mcp/job-state-db.js +2 -649
- package/dist/mcp/job-state-db.js.map +1 -1
- package/dist/mcp/mcp-config.d.ts +1 -1
- package/dist/mcp/mcp-config.js +1 -1
- package/dist/mcp/prompt-injection.d.ts +14 -76
- package/dist/mcp/prompt-injection.d.ts.map +1 -1
- package/dist/mcp/prompt-injection.js +34 -175
- package/dist/mcp/prompt-injection.js.map +1 -1
- package/dist/mcp/standalone-server.js +2 -0
- package/dist/mcp/standalone-server.js.map +1 -1
- package/dist/mcp/team-server.d.ts +16 -0
- package/dist/mcp/team-server.d.ts.map +1 -0
- package/dist/mcp/team-server.js +356 -0
- package/dist/mcp/team-server.js.map +1 -0
- package/dist/notifications/__tests__/formatter.test.js +62 -0
- package/dist/notifications/__tests__/formatter.test.js.map +1 -1
- package/dist/notifications/__tests__/hook-config.test.d.ts +14 -0
- package/dist/notifications/__tests__/hook-config.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/hook-config.test.js +210 -0
- package/dist/notifications/__tests__/hook-config.test.js.map +1 -0
- package/dist/notifications/__tests__/platform-gating.test.d.ts +12 -0
- package/dist/notifications/__tests__/platform-gating.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/platform-gating.test.js +140 -0
- package/dist/notifications/__tests__/platform-gating.test.js.map +1 -0
- package/dist/notifications/__tests__/template-engine.test.d.ts +13 -0
- package/dist/notifications/__tests__/template-engine.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/template-engine.test.js +378 -0
- package/dist/notifications/__tests__/template-engine.test.js.map +1 -0
- package/dist/notifications/config.d.ts.map +1 -1
- package/dist/notifications/config.js +54 -18
- package/dist/notifications/config.js.map +1 -1
- package/dist/notifications/dispatcher.d.ts +2 -2
- package/dist/notifications/dispatcher.d.ts.map +1 -1
- package/dist/notifications/dispatcher.js +10 -6
- package/dist/notifications/dispatcher.js.map +1 -1
- package/dist/notifications/formatter.d.ts.map +1 -1
- package/dist/notifications/formatter.js +22 -0
- package/dist/notifications/formatter.js.map +1 -1
- package/dist/notifications/hook-config-types.d.ts +44 -0
- package/dist/notifications/hook-config-types.d.ts.map +1 -0
- package/dist/notifications/hook-config-types.js +8 -0
- package/dist/notifications/hook-config-types.js.map +1 -0
- package/dist/notifications/hook-config.d.ts +36 -0
- package/dist/notifications/hook-config.d.ts.map +1 -0
- package/dist/notifications/hook-config.js +95 -0
- package/dist/notifications/hook-config.js.map +1 -0
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +31 -3
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +1 -0
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/session-registry.d.ts.map +1 -1
- package/dist/notifications/session-registry.js +13 -5
- package/dist/notifications/session-registry.js.map +1 -1
- package/dist/notifications/template-engine.d.ts +34 -0
- package/dist/notifications/template-engine.d.ts.map +1 -0
- package/dist/notifications/template-engine.js +248 -0
- package/dist/notifications/template-engine.js.map +1 -0
- package/dist/notifications/types.d.ts +0 -2
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/openclaw/__tests__/config.test.d.ts +2 -0
- package/dist/openclaw/__tests__/config.test.d.ts.map +1 -0
- package/dist/openclaw/__tests__/config.test.js +200 -0
- package/dist/openclaw/__tests__/config.test.js.map +1 -0
- package/dist/openclaw/__tests__/dispatcher.test.d.ts +2 -0
- package/dist/openclaw/__tests__/dispatcher.test.d.ts.map +1 -0
- package/dist/openclaw/__tests__/dispatcher.test.js +348 -0
- package/dist/openclaw/__tests__/dispatcher.test.js.map +1 -0
- package/dist/openclaw/__tests__/index.test.d.ts +2 -0
- package/dist/openclaw/__tests__/index.test.d.ts.map +1 -0
- package/dist/openclaw/__tests__/index.test.js +235 -0
- package/dist/openclaw/__tests__/index.test.js.map +1 -0
- package/dist/openclaw/config.d.ts +33 -0
- package/dist/openclaw/config.d.ts.map +1 -0
- package/dist/openclaw/config.js +83 -0
- package/dist/openclaw/config.js.map +1 -0
- package/dist/openclaw/dispatcher.d.ts +47 -0
- package/dist/openclaw/dispatcher.d.ts.map +1 -0
- package/dist/openclaw/dispatcher.js +138 -0
- package/dist/openclaw/dispatcher.js.map +1 -0
- package/dist/openclaw/index.d.ts +25 -0
- package/dist/openclaw/index.d.ts.map +1 -0
- package/dist/openclaw/index.js +132 -0
- package/dist/openclaw/index.js.map +1 -0
- package/dist/openclaw/types.d.ts +102 -0
- package/dist/openclaw/types.d.ts.map +1 -0
- package/dist/openclaw/types.js +8 -0
- package/dist/openclaw/types.js.map +1 -0
- package/dist/platform/index.d.ts +5 -0
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +17 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/process-utils.d.ts.map +1 -1
- package/dist/platform/process-utils.js +55 -9
- package/dist/platform/process-utils.js.map +1 -1
- package/dist/shared/types.d.ts +7 -5
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/team/__tests__/bridge-integration.test.js +10 -8
- package/dist/team/__tests__/bridge-integration.test.js.map +1 -1
- package/dist/team/__tests__/edge-cases.test.js +40 -29
- package/dist/team/__tests__/edge-cases.test.js.map +1 -1
- package/dist/team/__tests__/idle-nudge.test.d.ts +11 -0
- package/dist/team/__tests__/idle-nudge.test.d.ts.map +1 -0
- package/dist/team/__tests__/idle-nudge.test.js +282 -0
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -0
- package/dist/team/__tests__/mcp-team-bridge.spawn-args.test.js +2 -2
- package/dist/team/__tests__/mcp-team-bridge.spawn-args.test.js.map +1 -1
- package/dist/team/__tests__/mcp-team-bridge.usage.test.d.ts +2 -0
- package/dist/team/__tests__/mcp-team-bridge.usage.test.d.ts.map +1 -0
- package/dist/team/__tests__/mcp-team-bridge.usage.test.js +49 -0
- package/dist/team/__tests__/mcp-team-bridge.usage.test.js.map +1 -0
- package/dist/team/__tests__/merge-coordinator.test.js +1 -1
- package/dist/team/__tests__/merge-coordinator.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.d.ts +2 -0
- package/dist/team/__tests__/model-contract.test.d.ts.map +1 -0
- package/dist/team/__tests__/model-contract.test.js +121 -0
- package/dist/team/__tests__/model-contract.test.js.map +1 -0
- package/dist/team/__tests__/phase-controller.test.d.ts +2 -0
- package/dist/team/__tests__/phase-controller.test.d.ts.map +1 -0
- package/dist/team/__tests__/phase-controller.test.js +45 -0
- package/dist/team/__tests__/phase-controller.test.js.map +1 -0
- package/dist/team/__tests__/runtime-assign.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-assign.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-assign.test.js +43 -0
- package/dist/team/__tests__/runtime-assign.test.js.map +1 -0
- package/dist/team/__tests__/runtime-gemini-prompt.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-gemini-prompt.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-gemini-prompt.test.js +153 -0
- package/dist/team/__tests__/runtime-gemini-prompt.test.js.map +1 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.js +162 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -0
- package/dist/team/__tests__/runtime.test.d.ts +2 -0
- package/dist/team/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime.test.js +37 -0
- package/dist/team/__tests__/runtime.test.js.map +1 -0
- package/dist/team/__tests__/task-file-ops.test.js +63 -59
- package/dist/team/__tests__/task-file-ops.test.js.map +1 -1
- package/dist/team/__tests__/team-name.test.d.ts +2 -0
- package/dist/team/__tests__/team-name.test.d.ts.map +1 -0
- package/dist/team/__tests__/team-name.test.js +18 -0
- package/dist/team/__tests__/team-name.test.js.map +1 -0
- package/dist/team/__tests__/team-status.test.js +52 -6
- package/dist/team/__tests__/team-status.test.js.map +1 -1
- package/dist/team/__tests__/tmux-comm.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-comm.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-comm.test.js +26 -0
- package/dist/team/__tests__/tmux-comm.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.create-team.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-session.create-team.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.create-team.test.js +104 -0
- package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.spawn.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-session.spawn.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js +61 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.test.js +161 -2
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.d.ts +2 -0
- package/dist/team/__tests__/worker-bootstrap.test.d.ts.map +1 -0
- package/dist/team/__tests__/worker-bootstrap.test.js +58 -0
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -0
- package/dist/team/bridge-entry.d.ts.map +1 -1
- package/dist/team/bridge-entry.js +4 -0
- package/dist/team/bridge-entry.js.map +1 -1
- package/dist/team/capabilities.d.ts.map +1 -1
- package/dist/team/capabilities.js +3 -0
- package/dist/team/capabilities.js.map +1 -1
- package/dist/team/cli-detection.d.ts +9 -0
- package/dist/team/cli-detection.d.ts.map +1 -0
- package/dist/team/cli-detection.js +29 -0
- package/dist/team/cli-detection.js.map +1 -0
- package/dist/team/fs-utils.d.ts.map +1 -1
- package/dist/team/fs-utils.js +25 -4
- package/dist/team/fs-utils.js.map +1 -1
- package/dist/team/idle-nudge.d.ts +53 -0
- package/dist/team/idle-nudge.d.ts.map +1 -0
- package/dist/team/idle-nudge.js +124 -0
- package/dist/team/idle-nudge.js.map +1 -0
- package/dist/team/inbox-outbox.d.ts.map +1 -1
- package/dist/team/inbox-outbox.js +7 -3
- package/dist/team/inbox-outbox.js.map +1 -1
- package/dist/team/index.d.ts +14 -1
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +12 -1
- package/dist/team/index.js.map +1 -1
- package/dist/team/mcp-team-bridge.d.ts +9 -0
- package/dist/team/mcp-team-bridge.d.ts.map +1 -1
- package/dist/team/mcp-team-bridge.js +82 -3
- package/dist/team/mcp-team-bridge.js.map +1 -1
- package/dist/team/model-contract.d.ts +37 -0
- package/dist/team/model-contract.d.ts.map +1 -0
- package/dist/team/model-contract.js +139 -0
- package/dist/team/model-contract.js.map +1 -0
- package/dist/team/phase-controller.d.ts +33 -0
- package/dist/team/phase-controller.d.ts.map +1 -0
- package/dist/team/phase-controller.js +79 -0
- package/dist/team/phase-controller.js.map +1 -0
- package/dist/team/runtime-cli.d.ts +9 -0
- package/dist/team/runtime-cli.d.ts.map +1 -0
- package/dist/team/runtime-cli.js +188 -0
- package/dist/team/runtime-cli.js.map +1 -0
- package/dist/team/runtime.d.ts +95 -0
- package/dist/team/runtime.d.ts.map +1 -0
- package/dist/team/runtime.js +692 -0
- package/dist/team/runtime.js.map +1 -0
- package/dist/team/state-paths.d.ts +72 -0
- package/dist/team/state-paths.d.ts.map +1 -0
- package/dist/team/state-paths.js +87 -0
- package/dist/team/state-paths.js.map +1 -0
- package/dist/team/task-file-ops.d.ts +27 -7
- package/dist/team/task-file-ops.d.ts.map +1 -1
- package/dist/team/task-file-ops.js +116 -55
- package/dist/team/task-file-ops.js.map +1 -1
- package/dist/team/team-name.d.ts +2 -0
- package/dist/team/team-name.d.ts.map +1 -0
- package/dist/team/team-name.js +8 -0
- package/dist/team/team-name.js.map +1 -0
- package/dist/team/team-registration.d.ts +1 -1
- package/dist/team/team-registration.d.ts.map +1 -1
- package/dist/team/team-registration.js.map +1 -1
- package/dist/team/team-status.d.ts +11 -1
- package/dist/team/team-status.d.ts.map +1 -1
- package/dist/team/team-status.js +32 -3
- package/dist/team/team-status.js.map +1 -1
- package/dist/team/tmux-comm.d.ts +36 -0
- package/dist/team/tmux-comm.d.ts.map +1 -0
- package/dist/team/tmux-comm.js +115 -0
- package/dist/team/tmux-comm.js.map +1 -0
- package/dist/team/tmux-session.d.ts +92 -0
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +533 -2
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +10 -3
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/unified-team.d.ts.map +1 -1
- package/dist/team/unified-team.js +13 -3
- package/dist/team/unified-team.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts +39 -0
- package/dist/team/worker-bootstrap.d.ts.map +1 -0
- package/dist/team/worker-bootstrap.js +117 -0
- package/dist/team/worker-bootstrap.js.map +1 -0
- package/dist/team/worker-health.d.ts.map +1 -1
- package/dist/team/worker-health.js +15 -3
- package/dist/team/worker-health.js.map +1 -1
- package/dist/tools/ast-tools.js +1 -1
- package/dist/tools/ast-tools.js.map +1 -1
- package/dist/tools/diagnostics/lsp-aggregator.d.ts.map +1 -1
- package/dist/tools/diagnostics/lsp-aggregator.js +4 -2
- package/dist/tools/diagnostics/lsp-aggregator.js.map +1 -1
- package/dist/tools/lsp/__tests__/client-handle-data.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/client-handle-data.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/client-handle-data.test.js +138 -0
- package/dist/tools/lsp/__tests__/client-handle-data.test.js.map +1 -0
- package/dist/tools/lsp/client.d.ts +13 -0
- package/dist/tools/lsp/client.d.ts.map +1 -1
- package/dist/tools/lsp/client.js +64 -8
- package/dist/tools/lsp/client.js.map +1 -1
- package/dist/tools/lsp/servers.d.ts.map +1 -1
- package/dist/tools/lsp/servers.js +4 -9
- package/dist/tools/lsp/servers.js.map +1 -1
- package/dist/tools/lsp-tools.d.ts.map +1 -1
- package/dist/tools/lsp-tools.js +4 -0
- package/dist/tools/lsp-tools.js.map +1 -1
- package/dist/tools/python-repl/bridge-manager.d.ts.map +1 -1
- package/dist/tools/python-repl/bridge-manager.js +15 -1
- package/dist/tools/python-repl/bridge-manager.js.map +1 -1
- package/dist/tools/python-repl/session-lock.d.ts.map +1 -1
- package/dist/tools/python-repl/session-lock.js +35 -15
- package/dist/tools/python-repl/session-lock.js.map +1 -1
- package/dist/tools/state-tools.d.ts.map +1 -1
- package/dist/tools/state-tools.js +10 -0
- package/dist/tools/state-tools.js.map +1 -1
- package/dist/utils/__tests__/frontmatter.test.d.ts +2 -0
- package/dist/utils/__tests__/frontmatter.test.d.ts.map +1 -0
- package/dist/utils/__tests__/frontmatter.test.js +147 -0
- package/dist/utils/__tests__/frontmatter.test.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +24 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +62 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +4 -2
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/string-width.d.ts.map +1 -1
- package/dist/utils/string-width.js +15 -4
- package/dist/utils/string-width.js.map +1 -1
- package/dist/verification/tier-selector.js +1 -1
- package/dist/verification/tier-selector.js.map +1 -1
- package/docs/AGENTS.md +4 -2
- package/docs/CLAUDE.md +8 -48
- package/docs/MIGRATION.md +114 -0
- package/docs/REFERENCE.md +35 -102
- package/hooks/hooks.json +23 -23
- package/package.json +8 -8
- package/scripts/build-runtime-cli.mjs +24 -0
- package/scripts/build-team-server.mjs +28 -0
- package/scripts/cleanup-orphans.mjs +22 -5
- package/scripts/context-safety.mjs +5 -1
- package/scripts/demo-team.mjs +26 -0
- package/scripts/keyword-detector.mjs +6 -76
- package/scripts/openclaw-gateway-demo.mjs +168 -0
- package/scripts/persistent-mode.cjs +30 -4
- package/scripts/persistent-mode.mjs +48 -3
- package/scripts/plugin-setup.mjs +66 -3
- package/scripts/post-tool-use-failure.mjs +20 -2
- package/scripts/post-tool-verifier.mjs +57 -6
- package/scripts/pre-tool-enforcer.mjs +125 -5
- package/scripts/run.cjs +114 -0
- package/scripts/session-start.mjs +56 -7
- package/scripts/status.mjs +144 -0
- package/scripts/test-codex-gemini-team.mjs +78 -0
- package/skills/AGENTS.md +5 -2
- package/skills/analyze/SKILL.md +5 -11
- package/skills/autopilot/SKILL.md +5 -6
- package/skills/ccg/SKILL.md +88 -99
- package/skills/configure-notifications/SKILL.md +177 -0
- package/skills/configure-openclaw/SKILL.md +320 -0
- package/skills/external-context/SKILL.md +7 -83
- package/skills/hud/SKILL.md +68 -46
- package/skills/omc-setup/SKILL.md +58 -19
- package/skills/omc-teams/SKILL.md +178 -0
- package/skills/pipeline/SKILL.md +4 -4
- package/skills/plan/SKILL.md +28 -16
- package/skills/ralph/SKILL.md +3 -4
- package/skills/ralph-init/SKILL.md +3 -1
- package/skills/ralplan/SKILL.md +93 -8
- package/skills/security-review/SKILL.md +5 -6
- package/skills/tdd/SKILL.md +5 -6
- package/skills/team/SKILL.md +35 -34
- package/templates/hooks/keyword-detector.mjs +11 -82
- package/templates/hooks/persistent-mode.mjs +120 -3
- package/templates/hooks/post-tool-use-failure.mjs +20 -2
- package/templates/hooks/session-start.mjs +2 -16
- package/dist/__tests__/analytics/backfill-dedup.test.d.ts +0 -2
- package/dist/__tests__/analytics/backfill-dedup.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/backfill-dedup.test.js +0 -179
- package/dist/__tests__/analytics/backfill-dedup.test.js.map +0 -1
- package/dist/__tests__/analytics/backfill-engine.test.d.ts +0 -2
- package/dist/__tests__/analytics/backfill-engine.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/backfill-engine.test.js +0 -362
- package/dist/__tests__/analytics/backfill-engine.test.js.map +0 -1
- package/dist/__tests__/analytics/output-estimator.test.d.ts +0 -2
- package/dist/__tests__/analytics/output-estimator.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/output-estimator.test.js +0 -124
- package/dist/__tests__/analytics/output-estimator.test.js.map +0 -1
- package/dist/__tests__/analytics/token-extractor.test.d.ts +0 -2
- package/dist/__tests__/analytics/token-extractor.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/token-extractor.test.js +0 -165
- package/dist/__tests__/analytics/token-extractor.test.js.map +0 -1
- package/dist/__tests__/analytics/token-tracker.test.d.ts +0 -2
- package/dist/__tests__/analytics/token-tracker.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/token-tracker.test.js +0 -189
- package/dist/__tests__/analytics/token-tracker.test.js.map +0 -1
- package/dist/__tests__/analytics/tokscale-adapter.test.d.ts +0 -2
- package/dist/__tests__/analytics/tokscale-adapter.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/tokscale-adapter.test.js +0 -79
- package/dist/__tests__/analytics/tokscale-adapter.test.js.map +0 -1
- package/dist/__tests__/analytics/transcript-parser.test.d.ts +0 -2
- package/dist/__tests__/analytics/transcript-parser.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/transcript-parser.test.js +0 -285
- package/dist/__tests__/analytics/transcript-parser.test.js.map +0 -1
- package/dist/__tests__/analytics/transcript-scanner.test.d.ts +0 -2
- package/dist/__tests__/analytics/transcript-scanner.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/transcript-scanner.test.js +0 -443
- package/dist/__tests__/analytics/transcript-scanner.test.js.map +0 -1
- package/dist/__tests__/analytics/transcript-token-extractor.test.d.ts +0 -2
- package/dist/__tests__/analytics/transcript-token-extractor.test.d.ts.map +0 -1
- package/dist/__tests__/analytics/transcript-token-extractor.test.js +0 -177
- package/dist/__tests__/analytics/transcript-token-extractor.test.js.map +0 -1
- package/dist/analytics/analytics-summary.d.ts +0 -47
- package/dist/analytics/analytics-summary.d.ts.map +0 -1
- package/dist/analytics/analytics-summary.js +0 -171
- package/dist/analytics/analytics-summary.js.map +0 -1
- package/dist/analytics/backfill-dedup.d.ts +0 -49
- package/dist/analytics/backfill-dedup.d.ts.map +0 -1
- package/dist/analytics/backfill-dedup.js +0 -115
- package/dist/analytics/backfill-dedup.js.map +0 -1
- package/dist/analytics/backfill-engine.d.ts +0 -59
- package/dist/analytics/backfill-engine.d.ts.map +0 -1
- package/dist/analytics/backfill-engine.js +0 -172
- package/dist/analytics/backfill-engine.js.map +0 -1
- package/dist/analytics/cost-estimator.d.ts +0 -29
- package/dist/analytics/cost-estimator.d.ts.map +0 -1
- package/dist/analytics/cost-estimator.js +0 -135
- package/dist/analytics/cost-estimator.js.map +0 -1
- package/dist/analytics/export.d.ts +0 -7
- package/dist/analytics/export.d.ts.map +0 -1
- package/dist/analytics/export.js +0 -93
- package/dist/analytics/export.js.map +0 -1
- package/dist/analytics/index.d.ts +0 -24
- package/dist/analytics/index.d.ts.map +0 -1
- package/dist/analytics/index.js +0 -30
- package/dist/analytics/index.js.map +0 -1
- package/dist/analytics/metrics-collector.d.ts +0 -30
- package/dist/analytics/metrics-collector.d.ts.map +0 -1
- package/dist/analytics/metrics-collector.js +0 -96
- package/dist/analytics/metrics-collector.js.map +0 -1
- package/dist/analytics/output-estimator.d.ts +0 -26
- package/dist/analytics/output-estimator.d.ts.map +0 -1
- package/dist/analytics/output-estimator.js +0 -65
- package/dist/analytics/output-estimator.js.map +0 -1
- package/dist/analytics/query-engine.d.ts +0 -35
- package/dist/analytics/query-engine.d.ts.map +0 -1
- package/dist/analytics/query-engine.js +0 -239
- package/dist/analytics/query-engine.js.map +0 -1
- package/dist/analytics/session-catalog.d.ts +0 -45
- package/dist/analytics/session-catalog.d.ts.map +0 -1
- package/dist/analytics/session-catalog.js +0 -153
- package/dist/analytics/session-catalog.js.map +0 -1
- package/dist/analytics/session-manager.d.ts +0 -58
- package/dist/analytics/session-manager.d.ts.map +0 -1
- package/dist/analytics/session-manager.js +0 -396
- package/dist/analytics/session-manager.js.map +0 -1
- package/dist/analytics/session-types.d.ts +0 -37
- package/dist/analytics/session-types.d.ts.map +0 -1
- package/dist/analytics/session-types.js +0 -2
- package/dist/analytics/session-types.js.map +0 -1
- package/dist/analytics/token-extractor.d.ts +0 -31
- package/dist/analytics/token-extractor.d.ts.map +0 -1
- package/dist/analytics/token-extractor.js +0 -57
- package/dist/analytics/token-extractor.js.map +0 -1
- package/dist/analytics/token-tracker.d.ts +0 -33
- package/dist/analytics/token-tracker.d.ts.map +0 -1
- package/dist/analytics/token-tracker.js +0 -443
- package/dist/analytics/token-tracker.js.map +0 -1
- package/dist/analytics/tokscale-adapter.d.ts +0 -71
- package/dist/analytics/tokscale-adapter.d.ts.map +0 -1
- package/dist/analytics/tokscale-adapter.js +0 -223
- package/dist/analytics/tokscale-adapter.js.map +0 -1
- package/dist/analytics/transcript-parser.d.ts +0 -42
- package/dist/analytics/transcript-parser.d.ts.map +0 -1
- package/dist/analytics/transcript-parser.js +0 -90
- package/dist/analytics/transcript-parser.js.map +0 -1
- package/dist/analytics/transcript-scanner.d.ts +0 -51
- package/dist/analytics/transcript-scanner.d.ts.map +0 -1
- package/dist/analytics/transcript-scanner.js +0 -279
- package/dist/analytics/transcript-scanner.js.map +0 -1
- package/dist/analytics/transcript-token-extractor.d.ts +0 -35
- package/dist/analytics/transcript-token-extractor.d.ts.map +0 -1
- package/dist/analytics/transcript-token-extractor.js +0 -136
- package/dist/analytics/transcript-token-extractor.js.map +0 -1
- package/dist/analytics/types.d.ts +0 -119
- package/dist/analytics/types.d.ts.map +0 -1
- package/dist/analytics/types.js +0 -32
- package/dist/analytics/types.js.map +0 -1
- package/dist/cli/analytics.d.ts +0 -3
- package/dist/cli/analytics.d.ts.map +0 -1
- package/dist/cli/analytics.js +0 -105
- package/dist/cli/analytics.js.map +0 -1
- package/dist/cli/commands/agents.d.ts +0 -5
- package/dist/cli/commands/agents.d.ts.map +0 -1
- package/dist/cli/commands/agents.js +0 -31
- package/dist/cli/commands/agents.js.map +0 -1
- package/dist/cli/commands/backfill.d.ts +0 -15
- package/dist/cli/commands/backfill.d.ts.map +0 -1
- package/dist/cli/commands/backfill.js +0 -146
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/cleanup.d.ts +0 -4
- package/dist/cli/commands/cleanup.d.ts.map +0 -1
- package/dist/cli/commands/cleanup.js +0 -31
- package/dist/cli/commands/cleanup.js.map +0 -1
- package/dist/cli/commands/cost.d.ts +0 -4
- package/dist/cli/commands/cost.d.ts.map +0 -1
- package/dist/cli/commands/cost.js +0 -53
- package/dist/cli/commands/cost.js.map +0 -1
- package/dist/cli/commands/export.d.ts +0 -5
- package/dist/cli/commands/export.d.ts.map +0 -1
- package/dist/cli/commands/export.js +0 -30
- package/dist/cli/commands/export.js.map +0 -1
- package/dist/cli/commands/sessions.d.ts +0 -5
- package/dist/cli/commands/sessions.d.ts.map +0 -1
- package/dist/cli/commands/sessions.js +0 -89
- package/dist/cli/commands/sessions.js.map +0 -1
- package/dist/cli/commands/stats.d.ts +0 -5
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -84
- package/dist/cli/commands/stats.js.map +0 -1
- package/dist/cli/utils/tokscale-launcher.d.ts +0 -25
- package/dist/cli/utils/tokscale-launcher.d.ts.map +0 -1
- package/dist/cli/utils/tokscale-launcher.js +0 -70
- package/dist/cli/utils/tokscale-launcher.js.map +0 -1
- package/dist/hud/analytics-display.d.ts +0 -63
- package/dist/hud/analytics-display.d.ts.map +0 -1
- package/dist/hud/analytics-display.js +0 -190
- package/dist/hud/analytics-display.js.map +0 -1
- package/scripts/build-codex-server.mjs +0 -95
package/bridge/mcp-server.cjs
CHANGED
|
@@ -17904,13 +17904,9 @@ var LSP_SERVERS = {
|
|
|
17904
17904
|
}
|
|
17905
17905
|
};
|
|
17906
17906
|
function commandExists(command) {
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
return true;
|
|
17911
|
-
} catch {
|
|
17912
|
-
return false;
|
|
17913
|
-
}
|
|
17907
|
+
const checkCommand = process.platform === "win32" ? "where" : "which";
|
|
17908
|
+
const result = (0, import_child_process.spawnSync)(checkCommand, [command], { stdio: "ignore" });
|
|
17909
|
+
return result.status === 0;
|
|
17914
17910
|
}
|
|
17915
17911
|
function getServerForFile(filePath) {
|
|
17916
17912
|
const ext = (0, import_path.extname)(filePath).toLowerCase();
|
|
@@ -17936,9 +17932,10 @@ var LspClient = class {
|
|
|
17936
17932
|
process = null;
|
|
17937
17933
|
requestId = 0;
|
|
17938
17934
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
17939
|
-
buffer =
|
|
17935
|
+
buffer = Buffer.alloc(0);
|
|
17940
17936
|
openDocuments = /* @__PURE__ */ new Set();
|
|
17941
17937
|
diagnostics = /* @__PURE__ */ new Map();
|
|
17938
|
+
diagnosticWaiters = /* @__PURE__ */ new Map();
|
|
17942
17939
|
workspaceRoot;
|
|
17943
17940
|
serverConfig;
|
|
17944
17941
|
initialized = false;
|
|
@@ -17968,7 +17965,7 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
17968
17965
|
shell: process.platform === "win32"
|
|
17969
17966
|
});
|
|
17970
17967
|
this.process.stdout?.on("data", (data) => {
|
|
17971
|
-
this.handleData(data
|
|
17968
|
+
this.handleData(data);
|
|
17972
17969
|
});
|
|
17973
17970
|
this.process.stderr?.on("data", (data) => {
|
|
17974
17971
|
console.error(`LSP stderr: ${data.toString()}`);
|
|
@@ -17982,6 +17979,7 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
17982
17979
|
if (code !== 0) {
|
|
17983
17980
|
console.error(`LSP server exited with code ${code}`);
|
|
17984
17981
|
}
|
|
17982
|
+
this.rejectPendingRequests(new Error(`LSP server exited (code ${code})`));
|
|
17985
17983
|
});
|
|
17986
17984
|
this.initialize().then(() => {
|
|
17987
17985
|
this.initialized = true;
|
|
@@ -18006,18 +18004,29 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18006
18004
|
this.openDocuments.clear();
|
|
18007
18005
|
this.diagnostics.clear();
|
|
18008
18006
|
}
|
|
18007
|
+
/**
|
|
18008
|
+
* Reject all pending requests with the given error.
|
|
18009
|
+
* Called on process exit to avoid dangling unresolved promises.
|
|
18010
|
+
*/
|
|
18011
|
+
rejectPendingRequests(error2) {
|
|
18012
|
+
for (const [id, pending] of this.pendingRequests.entries()) {
|
|
18013
|
+
clearTimeout(pending.timeout);
|
|
18014
|
+
pending.reject(error2);
|
|
18015
|
+
this.pendingRequests.delete(id);
|
|
18016
|
+
}
|
|
18017
|
+
}
|
|
18009
18018
|
/**
|
|
18010
18019
|
* Handle incoming data from the server
|
|
18011
18020
|
*/
|
|
18012
18021
|
handleData(data) {
|
|
18013
|
-
this.buffer
|
|
18022
|
+
this.buffer = Buffer.concat([this.buffer, data]);
|
|
18014
18023
|
while (true) {
|
|
18015
18024
|
const headerEnd = this.buffer.indexOf("\r\n\r\n");
|
|
18016
18025
|
if (headerEnd === -1) break;
|
|
18017
|
-
const header = this.buffer.
|
|
18026
|
+
const header = this.buffer.subarray(0, headerEnd).toString();
|
|
18018
18027
|
const contentLengthMatch = header.match(/Content-Length: (\d+)/i);
|
|
18019
18028
|
if (!contentLengthMatch) {
|
|
18020
|
-
this.buffer = this.buffer.
|
|
18029
|
+
this.buffer = this.buffer.subarray(headerEnd + 4);
|
|
18021
18030
|
continue;
|
|
18022
18031
|
}
|
|
18023
18032
|
const contentLength = parseInt(contentLengthMatch[1], 10);
|
|
@@ -18026,8 +18035,8 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18026
18035
|
if (this.buffer.length < messageEnd) {
|
|
18027
18036
|
break;
|
|
18028
18037
|
}
|
|
18029
|
-
const messageJson = this.buffer.
|
|
18030
|
-
this.buffer = this.buffer.
|
|
18038
|
+
const messageJson = this.buffer.subarray(messageStart, messageEnd).toString();
|
|
18039
|
+
this.buffer = this.buffer.subarray(messageEnd);
|
|
18031
18040
|
try {
|
|
18032
18041
|
const message = JSON.parse(messageJson);
|
|
18033
18042
|
this.handleMessage(message);
|
|
@@ -18061,6 +18070,11 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18061
18070
|
if (notification.method === "textDocument/publishDiagnostics") {
|
|
18062
18071
|
const params = notification.params;
|
|
18063
18072
|
this.diagnostics.set(params.uri, params.diagnostics);
|
|
18073
|
+
const waiters = this.diagnosticWaiters.get(params.uri);
|
|
18074
|
+
if (waiters && waiters.length > 0) {
|
|
18075
|
+
this.diagnosticWaiters.delete(params.uri);
|
|
18076
|
+
for (const wake of waiters) wake();
|
|
18077
|
+
}
|
|
18064
18078
|
}
|
|
18065
18079
|
}
|
|
18066
18080
|
/**
|
|
@@ -18173,7 +18187,7 @@ ${content}`;
|
|
|
18173
18187
|
* Get the language ID for a file
|
|
18174
18188
|
*/
|
|
18175
18189
|
getLanguageId(filePath) {
|
|
18176
|
-
const ext =
|
|
18190
|
+
const ext = (0, import_path2.parse)(filePath).ext.slice(1).toLowerCase();
|
|
18177
18191
|
const langMap = {
|
|
18178
18192
|
"ts": "typescript",
|
|
18179
18193
|
"tsx": "typescriptreact",
|
|
@@ -18276,6 +18290,37 @@ ${content}`;
|
|
|
18276
18290
|
const uri = fileUri(filePath);
|
|
18277
18291
|
return this.diagnostics.get(uri) || [];
|
|
18278
18292
|
}
|
|
18293
|
+
/**
|
|
18294
|
+
* Wait for the server to publish diagnostics for a file.
|
|
18295
|
+
* Resolves as soon as textDocument/publishDiagnostics fires for the URI,
|
|
18296
|
+
* or after `timeoutMs` milliseconds (whichever comes first).
|
|
18297
|
+
* This replaces fixed-delay sleeps with a notification-driven approach.
|
|
18298
|
+
*/
|
|
18299
|
+
waitForDiagnostics(filePath, timeoutMs = 2e3) {
|
|
18300
|
+
const uri = fileUri(filePath);
|
|
18301
|
+
if (this.diagnostics.has(uri)) {
|
|
18302
|
+
return Promise.resolve();
|
|
18303
|
+
}
|
|
18304
|
+
return new Promise((resolve5) => {
|
|
18305
|
+
let resolved = false;
|
|
18306
|
+
const timer = setTimeout(() => {
|
|
18307
|
+
if (!resolved) {
|
|
18308
|
+
resolved = true;
|
|
18309
|
+
this.diagnosticWaiters.delete(uri);
|
|
18310
|
+
resolve5();
|
|
18311
|
+
}
|
|
18312
|
+
}, timeoutMs);
|
|
18313
|
+
const existing = this.diagnosticWaiters.get(uri) || [];
|
|
18314
|
+
existing.push(() => {
|
|
18315
|
+
if (!resolved) {
|
|
18316
|
+
resolved = true;
|
|
18317
|
+
clearTimeout(timer);
|
|
18318
|
+
resolve5();
|
|
18319
|
+
}
|
|
18320
|
+
});
|
|
18321
|
+
this.diagnosticWaiters.set(uri, existing);
|
|
18322
|
+
});
|
|
18323
|
+
}
|
|
18279
18324
|
/**
|
|
18280
18325
|
* Prepare rename (check if rename is valid)
|
|
18281
18326
|
*/
|
|
@@ -18762,7 +18807,7 @@ async function runLspAggregatedDiagnostics(directory, extensions = [".ts", ".tsx
|
|
|
18762
18807
|
try {
|
|
18763
18808
|
await lspClientManager.runWithClientLease(file, async (client) => {
|
|
18764
18809
|
await client.openDocument(file);
|
|
18765
|
-
await
|
|
18810
|
+
await client.waitForDiagnostics(file, LSP_DIAGNOSTICS_WAIT_MS);
|
|
18766
18811
|
const diagnostics = client.getDiagnostics(file);
|
|
18767
18812
|
for (const diagnostic of diagnostics) {
|
|
18768
18813
|
allDiagnostics.push({
|
|
@@ -18879,6 +18924,7 @@ async function withLspClient(filePath, operation, fn) {
|
|
|
18879
18924
|
const serverConfig = getServerForFile(filePath);
|
|
18880
18925
|
if (!serverConfig) {
|
|
18881
18926
|
return {
|
|
18927
|
+
isError: true,
|
|
18882
18928
|
content: [{
|
|
18883
18929
|
type: "text",
|
|
18884
18930
|
text: `No language server available for file type: ${filePath}
|
|
@@ -18900,6 +18946,7 @@ Use lsp_servers tool to see available language servers.`
|
|
|
18900
18946
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
18901
18947
|
if (message.includes("not found")) {
|
|
18902
18948
|
return {
|
|
18949
|
+
isError: true,
|
|
18903
18950
|
content: [{
|
|
18904
18951
|
type: "text",
|
|
18905
18952
|
text: `${message}`
|
|
@@ -18907,6 +18954,7 @@ Use lsp_servers tool to see available language servers.`
|
|
|
18907
18954
|
};
|
|
18908
18955
|
}
|
|
18909
18956
|
return {
|
|
18957
|
+
isError: true,
|
|
18910
18958
|
content: [{
|
|
18911
18959
|
type: "text",
|
|
18912
18960
|
text: `Error in ${operation}: ${message}`
|
|
@@ -19217,6 +19265,7 @@ ${result.diagnostics}`;
|
|
|
19217
19265
|
};
|
|
19218
19266
|
} catch (error2) {
|
|
19219
19267
|
return {
|
|
19268
|
+
isError: true,
|
|
19220
19269
|
content: [{
|
|
19221
19270
|
type: "text",
|
|
19222
19271
|
text: `Error running directory diagnostics: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
@@ -19594,7 +19643,7 @@ Error: ${sgLoadError}`
|
|
|
19594
19643
|
const varName = metaVar.replace(/^\$+/, "");
|
|
19595
19644
|
const captured = match.getMatch(varName);
|
|
19596
19645
|
if (captured) {
|
|
19597
|
-
finalReplacement = finalReplacement.
|
|
19646
|
+
finalReplacement = finalReplacement.replaceAll(
|
|
19598
19647
|
metaVar,
|
|
19599
19648
|
captured.text()
|
|
19600
19649
|
);
|
|
@@ -19898,6 +19947,7 @@ async function safeReadJson(filePath) {
|
|
|
19898
19947
|
|
|
19899
19948
|
// src/platform/index.ts
|
|
19900
19949
|
var path3 = __toESM(require("path"), 1);
|
|
19950
|
+
var import_fs6 = require("fs");
|
|
19901
19951
|
|
|
19902
19952
|
// src/platform/process-utils.ts
|
|
19903
19953
|
var import_child_process4 = require("child_process");
|
|
@@ -19934,20 +19984,68 @@ async function getProcessStartTimeWindows(pid) {
|
|
|
19934
19984
|
"CreationDate",
|
|
19935
19985
|
"/format:csv"
|
|
19936
19986
|
], { timeout: 5e3, windowsHide: true });
|
|
19937
|
-
const
|
|
19938
|
-
if (
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19987
|
+
const wmicTime = parseWmicCreationDate(stdout);
|
|
19988
|
+
if (wmicTime !== void 0) return wmicTime;
|
|
19989
|
+
} catch {
|
|
19990
|
+
}
|
|
19991
|
+
const cimTime = await getProcessStartTimeWindowsPowerShellCim(pid);
|
|
19992
|
+
if (cimTime !== void 0) return cimTime;
|
|
19993
|
+
return getProcessStartTimeWindowsPowerShellProcess(pid);
|
|
19994
|
+
}
|
|
19995
|
+
function parseWmicCreationDate(stdout) {
|
|
19996
|
+
const lines = stdout.trim().split(/\r?\n/).filter((l) => l.trim());
|
|
19997
|
+
if (lines.length < 2) return void 0;
|
|
19998
|
+
const candidate = lines.find((line) => /,\d{14}/.test(line)) ?? lines[1];
|
|
19999
|
+
const match = candidate.match(/,(\d{14})/);
|
|
20000
|
+
if (!match) return void 0;
|
|
20001
|
+
const d = match[1];
|
|
20002
|
+
const date3 = new Date(
|
|
20003
|
+
parseInt(d.slice(0, 4), 10),
|
|
20004
|
+
parseInt(d.slice(4, 6), 10) - 1,
|
|
20005
|
+
parseInt(d.slice(6, 8), 10),
|
|
20006
|
+
parseInt(d.slice(8, 10), 10),
|
|
20007
|
+
parseInt(d.slice(10, 12), 10),
|
|
20008
|
+
parseInt(d.slice(12, 14), 10)
|
|
20009
|
+
);
|
|
20010
|
+
const value = date3.getTime();
|
|
20011
|
+
return Number.isNaN(value) ? void 0 : value;
|
|
20012
|
+
}
|
|
20013
|
+
function parseWindowsEpochMilliseconds(stdout) {
|
|
20014
|
+
const match = stdout.trim().match(/-?\d+/);
|
|
20015
|
+
if (!match) return void 0;
|
|
20016
|
+
const value = parseInt(match[0], 10);
|
|
20017
|
+
return Number.isFinite(value) ? value : void 0;
|
|
20018
|
+
}
|
|
20019
|
+
async function getProcessStartTimeWindowsPowerShellCim(pid) {
|
|
20020
|
+
try {
|
|
20021
|
+
const { stdout } = await execFileAsync(
|
|
20022
|
+
"powershell",
|
|
20023
|
+
[
|
|
20024
|
+
"-NoProfile",
|
|
20025
|
+
"-NonInteractive",
|
|
20026
|
+
"-Command",
|
|
20027
|
+
`$p = Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" -ErrorAction Stop; if ($p -and $p.CreationDate) { [DateTimeOffset]$p.CreationDate | ForEach-Object { $_.ToUnixTimeMilliseconds() } }`
|
|
20028
|
+
],
|
|
20029
|
+
{ timeout: 5e3, windowsHide: true }
|
|
20030
|
+
);
|
|
20031
|
+
return parseWindowsEpochMilliseconds(stdout);
|
|
20032
|
+
} catch {
|
|
20033
|
+
return void 0;
|
|
20034
|
+
}
|
|
20035
|
+
}
|
|
20036
|
+
async function getProcessStartTimeWindowsPowerShellProcess(pid) {
|
|
20037
|
+
try {
|
|
20038
|
+
const { stdout } = await execFileAsync(
|
|
20039
|
+
"powershell",
|
|
20040
|
+
[
|
|
20041
|
+
"-NoProfile",
|
|
20042
|
+
"-NonInteractive",
|
|
20043
|
+
"-Command",
|
|
20044
|
+
`$p = Get-Process -Id ${pid} -ErrorAction SilentlyContinue; if ($p -and $p.StartTime) { [DateTimeOffset]$p.StartTime | ForEach-Object { $_.ToUnixTimeMilliseconds() } }`
|
|
20045
|
+
],
|
|
20046
|
+
{ timeout: 5e3, windowsHide: true }
|
|
19949
20047
|
);
|
|
19950
|
-
return
|
|
20048
|
+
return parseWindowsEpochMilliseconds(stdout);
|
|
19951
20049
|
} catch {
|
|
19952
20050
|
return void 0;
|
|
19953
20051
|
}
|
|
@@ -20038,24 +20136,45 @@ async function isProcessAlive2(pid, recordedStartTime) {
|
|
|
20038
20136
|
return false;
|
|
20039
20137
|
}
|
|
20040
20138
|
} else if (process.platform === "win32") {
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
if (recordedStartTime !== void 0) {
|
|
20044
|
-
const currentStartTime = await getProcessStartTime(pid);
|
|
20045
|
-
if (currentStartTime === void 0) {
|
|
20046
|
-
return false;
|
|
20047
|
-
}
|
|
20048
|
-
if (currentStartTime !== recordedStartTime) {
|
|
20049
|
-
return false;
|
|
20050
|
-
}
|
|
20051
|
-
}
|
|
20052
|
-
return true;
|
|
20053
|
-
} catch {
|
|
20139
|
+
const exists = await isWindowsProcessAlive(pid);
|
|
20140
|
+
if (!exists) {
|
|
20054
20141
|
return false;
|
|
20055
20142
|
}
|
|
20143
|
+
if (recordedStartTime !== void 0) {
|
|
20144
|
+
const currentStartTime = await getProcessStartTime(pid);
|
|
20145
|
+
if (currentStartTime !== void 0 && currentStartTime !== recordedStartTime) {
|
|
20146
|
+
return false;
|
|
20147
|
+
}
|
|
20148
|
+
}
|
|
20149
|
+
return true;
|
|
20056
20150
|
}
|
|
20057
20151
|
return true;
|
|
20058
20152
|
}
|
|
20153
|
+
async function isWindowsProcessAlive(pid) {
|
|
20154
|
+
try {
|
|
20155
|
+
process.kill(pid, 0);
|
|
20156
|
+
return true;
|
|
20157
|
+
} catch {
|
|
20158
|
+
return isWindowsProcessAlivePowerShell(pid);
|
|
20159
|
+
}
|
|
20160
|
+
}
|
|
20161
|
+
async function isWindowsProcessAlivePowerShell(pid) {
|
|
20162
|
+
try {
|
|
20163
|
+
const { stdout } = await execFileAsync2(
|
|
20164
|
+
"powershell",
|
|
20165
|
+
[
|
|
20166
|
+
"-NoProfile",
|
|
20167
|
+
"-NonInteractive",
|
|
20168
|
+
"-Command",
|
|
20169
|
+
`$p = Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" -ErrorAction SilentlyContinue; if (-not $p) { $p = Get-Process -Id ${pid} -ErrorAction SilentlyContinue }; if ($p) { '1' }`
|
|
20170
|
+
],
|
|
20171
|
+
{ timeout: 5e3, windowsHide: true }
|
|
20172
|
+
);
|
|
20173
|
+
return stdout.trim() === "1";
|
|
20174
|
+
} catch {
|
|
20175
|
+
return false;
|
|
20176
|
+
}
|
|
20177
|
+
}
|
|
20059
20178
|
async function openNoFollow(filePath, flags, mode) {
|
|
20060
20179
|
const O_NOFOLLOW = fsSync2.constants.O_NOFOLLOW ?? 0;
|
|
20061
20180
|
const flagsWithNoFollow = flags | O_NOFOLLOW;
|
|
@@ -20564,8 +20683,20 @@ async function spawnBridgeServer(sessionId, projectDir) {
|
|
|
20564
20683
|
stderrBuffer += text;
|
|
20565
20684
|
}
|
|
20566
20685
|
});
|
|
20686
|
+
let procExitCode = null;
|
|
20687
|
+
proc.on("exit", (code) => {
|
|
20688
|
+
procExitCode = code ?? 1;
|
|
20689
|
+
});
|
|
20567
20690
|
const startTime = Date.now();
|
|
20568
20691
|
while (!isSocket(socketPath)) {
|
|
20692
|
+
if (procExitCode !== null) {
|
|
20693
|
+
if (fs4.existsSync(socketPath) && !isSocket(socketPath)) {
|
|
20694
|
+
safeUnlinkSocket(socketPath);
|
|
20695
|
+
}
|
|
20696
|
+
throw new Error(
|
|
20697
|
+
`Bridge process exited with code ${procExitCode} before creating socket. Stderr: ${stderrBuffer || "(empty)"}`
|
|
20698
|
+
);
|
|
20699
|
+
}
|
|
20569
20700
|
if (Date.now() - startTime > BRIDGE_SPAWN_TIMEOUT_MS) {
|
|
20570
20701
|
if (proc.pid) {
|
|
20571
20702
|
killProcessGroup(proc.pid, "SIGKILL");
|
|
@@ -21114,11 +21245,12 @@ var pythonReplTool = {
|
|
|
21114
21245
|
};
|
|
21115
21246
|
|
|
21116
21247
|
// src/tools/state-tools.ts
|
|
21117
|
-
var
|
|
21248
|
+
var import_fs9 = require("fs");
|
|
21118
21249
|
|
|
21119
21250
|
// src/lib/worktree-paths.ts
|
|
21251
|
+
var import_crypto2 = require("crypto");
|
|
21120
21252
|
var import_child_process8 = require("child_process");
|
|
21121
|
-
var
|
|
21253
|
+
var import_fs7 = require("fs");
|
|
21122
21254
|
var import_path7 = require("path");
|
|
21123
21255
|
var OmcPaths = {
|
|
21124
21256
|
ROOT: ".omc",
|
|
@@ -21135,11 +21267,15 @@ var OmcPaths = {
|
|
|
21135
21267
|
AUTOPILOT: ".omc/autopilot",
|
|
21136
21268
|
SKILLS: ".omc/skills"
|
|
21137
21269
|
};
|
|
21138
|
-
var
|
|
21270
|
+
var MAX_WORKTREE_CACHE_SIZE = 8;
|
|
21271
|
+
var worktreeCacheMap = /* @__PURE__ */ new Map();
|
|
21139
21272
|
function getWorktreeRoot(cwd) {
|
|
21140
21273
|
const effectiveCwd = cwd || process.cwd();
|
|
21141
|
-
if (
|
|
21142
|
-
|
|
21274
|
+
if (worktreeCacheMap.has(effectiveCwd)) {
|
|
21275
|
+
const root = worktreeCacheMap.get(effectiveCwd);
|
|
21276
|
+
worktreeCacheMap.delete(effectiveCwd);
|
|
21277
|
+
worktreeCacheMap.set(effectiveCwd, root);
|
|
21278
|
+
return root || null;
|
|
21143
21279
|
}
|
|
21144
21280
|
try {
|
|
21145
21281
|
const root = (0, import_child_process8.execSync)("git rev-parse --show-toplevel", {
|
|
@@ -21147,7 +21283,13 @@ function getWorktreeRoot(cwd) {
|
|
|
21147
21283
|
encoding: "utf-8",
|
|
21148
21284
|
stdio: ["pipe", "pipe", "pipe"]
|
|
21149
21285
|
}).trim();
|
|
21150
|
-
|
|
21286
|
+
if (worktreeCacheMap.size >= MAX_WORKTREE_CACHE_SIZE) {
|
|
21287
|
+
const oldest = worktreeCacheMap.keys().next().value;
|
|
21288
|
+
if (oldest !== void 0) {
|
|
21289
|
+
worktreeCacheMap.delete(oldest);
|
|
21290
|
+
}
|
|
21291
|
+
}
|
|
21292
|
+
worktreeCacheMap.set(effectiveCwd, root);
|
|
21151
21293
|
return root;
|
|
21152
21294
|
} catch {
|
|
21153
21295
|
return null;
|
|
@@ -21161,14 +21303,50 @@ function validatePath(inputPath) {
|
|
|
21161
21303
|
throw new Error(`Invalid path: absolute paths not allowed (${inputPath})`);
|
|
21162
21304
|
}
|
|
21163
21305
|
}
|
|
21306
|
+
var dualDirWarnings = /* @__PURE__ */ new Set();
|
|
21307
|
+
function getProjectIdentifier(worktreeRoot) {
|
|
21308
|
+
const root = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21309
|
+
let source;
|
|
21310
|
+
try {
|
|
21311
|
+
const remoteUrl = (0, import_child_process8.execSync)("git remote get-url origin", {
|
|
21312
|
+
cwd: root,
|
|
21313
|
+
encoding: "utf-8",
|
|
21314
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
21315
|
+
}).trim();
|
|
21316
|
+
source = remoteUrl || root;
|
|
21317
|
+
} catch {
|
|
21318
|
+
source = root;
|
|
21319
|
+
}
|
|
21320
|
+
const hash = (0, import_crypto2.createHash)("sha256").update(source).digest("hex").slice(0, 16);
|
|
21321
|
+
const dirName = (0, import_path7.basename)(root).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
21322
|
+
return `${dirName}-${hash}`;
|
|
21323
|
+
}
|
|
21324
|
+
function getOmcRoot(worktreeRoot) {
|
|
21325
|
+
const customDir = process.env.OMC_STATE_DIR;
|
|
21326
|
+
if (customDir) {
|
|
21327
|
+
const root2 = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21328
|
+
const projectId = getProjectIdentifier(root2);
|
|
21329
|
+
const centralizedPath = (0, import_path7.join)(customDir, projectId);
|
|
21330
|
+
const legacyPath = (0, import_path7.join)(root2, OmcPaths.ROOT);
|
|
21331
|
+
const warningKey = `${legacyPath}:${centralizedPath}`;
|
|
21332
|
+
if (!dualDirWarnings.has(warningKey) && (0, import_fs7.existsSync)(legacyPath) && (0, import_fs7.existsSync)(centralizedPath)) {
|
|
21333
|
+
dualDirWarnings.add(warningKey);
|
|
21334
|
+
console.warn(
|
|
21335
|
+
`[omc] Both legacy state dir (${legacyPath}) and centralized state dir (${centralizedPath}) exist. Using centralized dir. Consider migrating data from the legacy dir and removing it.`
|
|
21336
|
+
);
|
|
21337
|
+
}
|
|
21338
|
+
return centralizedPath;
|
|
21339
|
+
}
|
|
21340
|
+
const root = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21341
|
+
return (0, import_path7.join)(root, OmcPaths.ROOT);
|
|
21342
|
+
}
|
|
21164
21343
|
function resolveOmcPath(relativePath, worktreeRoot) {
|
|
21165
21344
|
validatePath(relativePath);
|
|
21166
|
-
const
|
|
21167
|
-
const omcDir = (0, import_path7.join)(root, OmcPaths.ROOT);
|
|
21345
|
+
const omcDir = getOmcRoot(worktreeRoot);
|
|
21168
21346
|
const fullPath = (0, import_path7.normalize)((0, import_path7.resolve)(omcDir, relativePath));
|
|
21169
|
-
const
|
|
21170
|
-
if (
|
|
21171
|
-
throw new Error(`Path escapes
|
|
21347
|
+
const relativeToOmc = (0, import_path7.relative)(omcDir, fullPath);
|
|
21348
|
+
if (relativeToOmc.startsWith("..") || relativeToOmc.startsWith(import_path7.sep + "..")) {
|
|
21349
|
+
throw new Error(`Path escapes omc boundary: ${relativePath}`);
|
|
21172
21350
|
}
|
|
21173
21351
|
return fullPath;
|
|
21174
21352
|
}
|
|
@@ -21181,18 +21359,16 @@ function resolveStatePath(stateName, worktreeRoot) {
|
|
|
21181
21359
|
}
|
|
21182
21360
|
function ensureOmcDir(relativePath, worktreeRoot) {
|
|
21183
21361
|
const fullPath = resolveOmcPath(relativePath, worktreeRoot);
|
|
21184
|
-
if (!(0,
|
|
21185
|
-
(0,
|
|
21362
|
+
if (!(0, import_fs7.existsSync)(fullPath)) {
|
|
21363
|
+
(0, import_fs7.mkdirSync)(fullPath, { recursive: true });
|
|
21186
21364
|
}
|
|
21187
21365
|
return fullPath;
|
|
21188
21366
|
}
|
|
21189
21367
|
function getWorktreeNotepadPath(worktreeRoot) {
|
|
21190
|
-
|
|
21191
|
-
return (0, import_path7.join)(root, OmcPaths.NOTEPAD);
|
|
21368
|
+
return (0, import_path7.join)(getOmcRoot(worktreeRoot), "notepad.md");
|
|
21192
21369
|
}
|
|
21193
21370
|
function getWorktreeProjectMemoryPath(worktreeRoot) {
|
|
21194
|
-
|
|
21195
|
-
return (0, import_path7.join)(root, OmcPaths.PROJECT_MEMORY);
|
|
21371
|
+
return (0, import_path7.join)(getOmcRoot(worktreeRoot), "project-memory.json");
|
|
21196
21372
|
}
|
|
21197
21373
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/;
|
|
21198
21374
|
function validateSessionId(sessionId) {
|
|
@@ -21216,17 +21392,15 @@ function resolveSessionStatePath(stateName, sessionId, worktreeRoot) {
|
|
|
21216
21392
|
}
|
|
21217
21393
|
function getSessionStateDir(sessionId, worktreeRoot) {
|
|
21218
21394
|
validateSessionId(sessionId);
|
|
21219
|
-
|
|
21220
|
-
return (0, import_path7.join)(root, OmcPaths.SESSIONS, sessionId);
|
|
21395
|
+
return (0, import_path7.join)(getOmcRoot(worktreeRoot), "state", "sessions", sessionId);
|
|
21221
21396
|
}
|
|
21222
21397
|
function listSessionIds(worktreeRoot) {
|
|
21223
|
-
const
|
|
21224
|
-
|
|
21225
|
-
if (!(0, import_fs6.existsSync)(sessionsDir)) {
|
|
21398
|
+
const sessionsDir = (0, import_path7.join)(getOmcRoot(worktreeRoot), "state", "sessions");
|
|
21399
|
+
if (!(0, import_fs7.existsSync)(sessionsDir)) {
|
|
21226
21400
|
return [];
|
|
21227
21401
|
}
|
|
21228
21402
|
try {
|
|
21229
|
-
const entries = (0,
|
|
21403
|
+
const entries = (0, import_fs7.readdirSync)(sessionsDir, { withFileTypes: true });
|
|
21230
21404
|
return entries.filter((entry) => entry.isDirectory() && SESSION_ID_REGEX.test(entry.name)).map((entry) => entry.name);
|
|
21231
21405
|
} catch {
|
|
21232
21406
|
return [];
|
|
@@ -21234,8 +21408,8 @@ function listSessionIds(worktreeRoot) {
|
|
|
21234
21408
|
}
|
|
21235
21409
|
function ensureSessionStateDir(sessionId, worktreeRoot) {
|
|
21236
21410
|
const sessionDir = getSessionStateDir(sessionId, worktreeRoot);
|
|
21237
|
-
if (!(0,
|
|
21238
|
-
(0,
|
|
21411
|
+
if (!(0, import_fs7.existsSync)(sessionDir)) {
|
|
21412
|
+
(0, import_fs7.mkdirSync)(sessionDir, { recursive: true });
|
|
21239
21413
|
}
|
|
21240
21414
|
return sessionDir;
|
|
21241
21415
|
}
|
|
@@ -21247,7 +21421,7 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21247
21421
|
const resolved = (0, import_path7.resolve)(workingDirectory);
|
|
21248
21422
|
let trustedRootReal;
|
|
21249
21423
|
try {
|
|
21250
|
-
trustedRootReal = (0,
|
|
21424
|
+
trustedRootReal = (0, import_fs7.realpathSync)(trustedRoot);
|
|
21251
21425
|
} catch {
|
|
21252
21426
|
trustedRootReal = trustedRoot;
|
|
21253
21427
|
}
|
|
@@ -21255,7 +21429,7 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21255
21429
|
if (providedRoot) {
|
|
21256
21430
|
let providedRootReal;
|
|
21257
21431
|
try {
|
|
21258
|
-
providedRootReal = (0,
|
|
21432
|
+
providedRootReal = (0, import_fs7.realpathSync)(providedRoot);
|
|
21259
21433
|
} catch {
|
|
21260
21434
|
throw new Error(`workingDirectory '${workingDirectory}' does not exist or is not accessible.`);
|
|
21261
21435
|
}
|
|
@@ -21271,7 +21445,7 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21271
21445
|
}
|
|
21272
21446
|
let resolvedReal;
|
|
21273
21447
|
try {
|
|
21274
|
-
resolvedReal = (0,
|
|
21448
|
+
resolvedReal = (0, import_fs7.realpathSync)(resolved);
|
|
21275
21449
|
} catch {
|
|
21276
21450
|
throw new Error(`workingDirectory '${workingDirectory}' does not exist or is not accessible.`);
|
|
21277
21451
|
}
|
|
@@ -21283,30 +21457,83 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21283
21457
|
}
|
|
21284
21458
|
|
|
21285
21459
|
// src/hooks/mode-registry/index.ts
|
|
21286
|
-
var
|
|
21460
|
+
var import_fs8 = require("fs");
|
|
21287
21461
|
var import_path8 = require("path");
|
|
21462
|
+
|
|
21463
|
+
// src/lib/mode-names.ts
|
|
21464
|
+
var MODE_NAMES = {
|
|
21465
|
+
AUTOPILOT: "autopilot",
|
|
21466
|
+
ULTRAPILOT: "ultrapilot",
|
|
21467
|
+
SWARM: "swarm",
|
|
21468
|
+
PIPELINE: "pipeline",
|
|
21469
|
+
TEAM: "team",
|
|
21470
|
+
RALPH: "ralph",
|
|
21471
|
+
ULTRAWORK: "ultrawork",
|
|
21472
|
+
ULTRAQA: "ultraqa"
|
|
21473
|
+
};
|
|
21474
|
+
var ALL_MODE_NAMES = [
|
|
21475
|
+
MODE_NAMES.AUTOPILOT,
|
|
21476
|
+
MODE_NAMES.ULTRAPILOT,
|
|
21477
|
+
MODE_NAMES.SWARM,
|
|
21478
|
+
MODE_NAMES.PIPELINE,
|
|
21479
|
+
MODE_NAMES.TEAM,
|
|
21480
|
+
MODE_NAMES.RALPH,
|
|
21481
|
+
MODE_NAMES.ULTRAWORK,
|
|
21482
|
+
MODE_NAMES.ULTRAQA
|
|
21483
|
+
];
|
|
21484
|
+
var MODE_STATE_FILE_MAP = {
|
|
21485
|
+
[MODE_NAMES.AUTOPILOT]: "autopilot-state.json",
|
|
21486
|
+
[MODE_NAMES.ULTRAPILOT]: "ultrapilot-state.json",
|
|
21487
|
+
[MODE_NAMES.SWARM]: "swarm.db",
|
|
21488
|
+
[MODE_NAMES.PIPELINE]: "pipeline-state.json",
|
|
21489
|
+
[MODE_NAMES.TEAM]: "team-state.json",
|
|
21490
|
+
[MODE_NAMES.RALPH]: "ralph-state.json",
|
|
21491
|
+
[MODE_NAMES.ULTRAWORK]: "ultrawork-state.json",
|
|
21492
|
+
[MODE_NAMES.ULTRAQA]: "ultraqa-state.json"
|
|
21493
|
+
};
|
|
21494
|
+
var SESSION_END_MODE_STATE_FILES = [
|
|
21495
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.AUTOPILOT], mode: MODE_NAMES.AUTOPILOT },
|
|
21496
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAPILOT], mode: MODE_NAMES.ULTRAPILOT },
|
|
21497
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPH], mode: MODE_NAMES.RALPH },
|
|
21498
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK], mode: MODE_NAMES.ULTRAWORK },
|
|
21499
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAQA], mode: MODE_NAMES.ULTRAQA },
|
|
21500
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.PIPELINE], mode: MODE_NAMES.PIPELINE },
|
|
21501
|
+
// Swarm uses marker file + SQLite
|
|
21502
|
+
{ file: "swarm-active.marker", mode: MODE_NAMES.SWARM },
|
|
21503
|
+
{ file: "swarm-summary.json", mode: MODE_NAMES.SWARM }
|
|
21504
|
+
];
|
|
21505
|
+
var SESSION_METRICS_MODE_FILES = [
|
|
21506
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.AUTOPILOT], mode: MODE_NAMES.AUTOPILOT },
|
|
21507
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAPILOT], mode: MODE_NAMES.ULTRAPILOT },
|
|
21508
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPH], mode: MODE_NAMES.RALPH },
|
|
21509
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK], mode: MODE_NAMES.ULTRAWORK },
|
|
21510
|
+
{ file: "swarm-state.json", mode: MODE_NAMES.SWARM },
|
|
21511
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.PIPELINE], mode: MODE_NAMES.PIPELINE }
|
|
21512
|
+
];
|
|
21513
|
+
|
|
21514
|
+
// src/hooks/mode-registry/index.ts
|
|
21288
21515
|
var STALE_MARKER_THRESHOLD = 60 * 60 * 1e3;
|
|
21289
21516
|
var MODE_CONFIGS = {
|
|
21290
|
-
|
|
21517
|
+
[MODE_NAMES.AUTOPILOT]: {
|
|
21291
21518
|
name: "Autopilot",
|
|
21292
|
-
stateFile:
|
|
21519
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.AUTOPILOT],
|
|
21293
21520
|
activeProperty: "active"
|
|
21294
21521
|
},
|
|
21295
|
-
|
|
21522
|
+
[MODE_NAMES.ULTRAPILOT]: {
|
|
21296
21523
|
name: "Ultrapilot",
|
|
21297
|
-
stateFile:
|
|
21524
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAPILOT],
|
|
21298
21525
|
markerFile: "ultrapilot-ownership.json",
|
|
21299
21526
|
activeProperty: "active"
|
|
21300
21527
|
},
|
|
21301
|
-
|
|
21528
|
+
[MODE_NAMES.SWARM]: {
|
|
21302
21529
|
name: "Swarm",
|
|
21303
|
-
stateFile:
|
|
21530
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.SWARM],
|
|
21304
21531
|
markerFile: "swarm-active.marker",
|
|
21305
21532
|
isSqlite: true
|
|
21306
21533
|
},
|
|
21307
|
-
|
|
21534
|
+
[MODE_NAMES.PIPELINE]: {
|
|
21308
21535
|
name: "Pipeline",
|
|
21309
|
-
stateFile:
|
|
21536
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.PIPELINE],
|
|
21310
21537
|
activeProperty: "active"
|
|
21311
21538
|
},
|
|
21312
21539
|
conductor: {
|
|
@@ -21316,29 +21543,30 @@ var MODE_CONFIGS = {
|
|
|
21316
21543
|
},
|
|
21317
21544
|
team: {
|
|
21318
21545
|
name: "Team",
|
|
21319
|
-
stateFile:
|
|
21546
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.TEAM],
|
|
21320
21547
|
activeProperty: "active",
|
|
21321
21548
|
hasGlobalState: false
|
|
21322
21549
|
},
|
|
21323
|
-
|
|
21550
|
+
[MODE_NAMES.RALPH]: {
|
|
21324
21551
|
name: "Ralph",
|
|
21325
|
-
stateFile:
|
|
21552
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.RALPH],
|
|
21326
21553
|
markerFile: "ralph-verification.json",
|
|
21327
21554
|
activeProperty: "active",
|
|
21328
21555
|
hasGlobalState: false
|
|
21329
21556
|
},
|
|
21330
|
-
|
|
21557
|
+
[MODE_NAMES.ULTRAWORK]: {
|
|
21331
21558
|
name: "Ultrawork",
|
|
21332
|
-
stateFile:
|
|
21559
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK],
|
|
21333
21560
|
activeProperty: "active",
|
|
21334
21561
|
hasGlobalState: false
|
|
21335
21562
|
},
|
|
21336
|
-
|
|
21563
|
+
[MODE_NAMES.ULTRAQA]: {
|
|
21337
21564
|
name: "UltraQA",
|
|
21338
|
-
stateFile:
|
|
21565
|
+
stateFile: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAQA],
|
|
21339
21566
|
activeProperty: "active"
|
|
21340
21567
|
}
|
|
21341
21568
|
};
|
|
21569
|
+
var EXCLUSIVE_MODES = [MODE_NAMES.AUTOPILOT, MODE_NAMES.ULTRAPILOT, MODE_NAMES.SWARM, MODE_NAMES.PIPELINE];
|
|
21342
21570
|
function getStateDir(cwd) {
|
|
21343
21571
|
return (0, import_path8.join)(cwd, ".omc", "state");
|
|
21344
21572
|
}
|
|
@@ -21358,11 +21586,11 @@ function isJsonModeActive(cwd, mode, sessionId) {
|
|
|
21358
21586
|
const config2 = MODE_CONFIGS[mode];
|
|
21359
21587
|
if (sessionId && !config2.isSqlite) {
|
|
21360
21588
|
const sessionStateFile = resolveSessionStatePath(mode, sessionId, cwd);
|
|
21361
|
-
if (!(0,
|
|
21589
|
+
if (!(0, import_fs8.existsSync)(sessionStateFile)) {
|
|
21362
21590
|
return false;
|
|
21363
21591
|
}
|
|
21364
21592
|
try {
|
|
21365
|
-
const content = (0,
|
|
21593
|
+
const content = (0, import_fs8.readFileSync)(sessionStateFile, "utf-8");
|
|
21366
21594
|
const state = JSON.parse(content);
|
|
21367
21595
|
if (state.session_id && state.session_id !== sessionId) {
|
|
21368
21596
|
return false;
|
|
@@ -21376,11 +21604,11 @@ function isJsonModeActive(cwd, mode, sessionId) {
|
|
|
21376
21604
|
}
|
|
21377
21605
|
}
|
|
21378
21606
|
const stateFile = getStateFilePath(cwd, mode);
|
|
21379
|
-
if (!(0,
|
|
21607
|
+
if (!(0, import_fs8.existsSync)(stateFile)) {
|
|
21380
21608
|
return false;
|
|
21381
21609
|
}
|
|
21382
21610
|
try {
|
|
21383
|
-
const content = (0,
|
|
21611
|
+
const content = (0, import_fs8.readFileSync)(stateFile, "utf-8");
|
|
21384
21612
|
const state = JSON.parse(content);
|
|
21385
21613
|
if (config2.activeProperty) {
|
|
21386
21614
|
return state[config2.activeProperty] === true;
|
|
@@ -21392,16 +21620,16 @@ function isJsonModeActive(cwd, mode, sessionId) {
|
|
|
21392
21620
|
}
|
|
21393
21621
|
function isSqliteModeActive(cwd, mode) {
|
|
21394
21622
|
const markerPath = getMarkerFilePath(cwd, mode);
|
|
21395
|
-
if (markerPath && (0,
|
|
21623
|
+
if (markerPath && (0, import_fs8.existsSync)(markerPath)) {
|
|
21396
21624
|
try {
|
|
21397
|
-
const content = (0,
|
|
21625
|
+
const content = (0, import_fs8.readFileSync)(markerPath, "utf-8");
|
|
21398
21626
|
const marker = JSON.parse(content);
|
|
21399
21627
|
if (marker.startedAt) {
|
|
21400
21628
|
const startTime = new Date(marker.startedAt).getTime();
|
|
21401
21629
|
const age = Date.now() - startTime;
|
|
21402
21630
|
if (age > STALE_MARKER_THRESHOLD) {
|
|
21403
21631
|
console.warn(`Stale ${mode} marker detected (${Math.round(age / 6e4)} min old). Auto-removing.`);
|
|
21404
|
-
(0,
|
|
21632
|
+
(0, import_fs8.unlinkSync)(markerPath);
|
|
21405
21633
|
return false;
|
|
21406
21634
|
}
|
|
21407
21635
|
}
|
|
@@ -21411,7 +21639,7 @@ function isSqliteModeActive(cwd, mode) {
|
|
|
21411
21639
|
}
|
|
21412
21640
|
}
|
|
21413
21641
|
const dbPath = getStateFilePath(cwd, mode);
|
|
21414
|
-
return (0,
|
|
21642
|
+
return (0, import_fs8.existsSync)(dbPath);
|
|
21415
21643
|
}
|
|
21416
21644
|
function isModeActive(mode, cwd, sessionId) {
|
|
21417
21645
|
const config2 = MODE_CONFIGS[mode];
|
|
@@ -21439,49 +21667,107 @@ function getAllModeStatuses(cwd, sessionId) {
|
|
|
21439
21667
|
function clearModeState(mode, cwd, sessionId) {
|
|
21440
21668
|
const config2 = MODE_CONFIGS[mode];
|
|
21441
21669
|
let success = true;
|
|
21442
|
-
|
|
21670
|
+
const markerFile = getMarkerFilePath(cwd, mode);
|
|
21671
|
+
const isSessionScopedClear = Boolean(sessionId && !config2.isSqlite);
|
|
21672
|
+
if (isSessionScopedClear && sessionId) {
|
|
21443
21673
|
const sessionStateFile = resolveSessionStatePath(mode, sessionId, cwd);
|
|
21444
|
-
|
|
21674
|
+
try {
|
|
21675
|
+
(0, import_fs8.unlinkSync)(sessionStateFile);
|
|
21676
|
+
} catch (err) {
|
|
21677
|
+
if (err.code !== "ENOENT") {
|
|
21678
|
+
success = false;
|
|
21679
|
+
}
|
|
21680
|
+
}
|
|
21681
|
+
if (config2.markerFile) {
|
|
21682
|
+
const markerStateName = config2.markerFile.replace(/\.json$/i, "");
|
|
21683
|
+
const sessionMarkerFile = resolveSessionStatePath(markerStateName, sessionId, cwd);
|
|
21684
|
+
try {
|
|
21685
|
+
(0, import_fs8.unlinkSync)(sessionMarkerFile);
|
|
21686
|
+
} catch (err) {
|
|
21687
|
+
if (err.code !== "ENOENT") {
|
|
21688
|
+
success = false;
|
|
21689
|
+
}
|
|
21690
|
+
}
|
|
21691
|
+
}
|
|
21692
|
+
if (markerFile) {
|
|
21445
21693
|
try {
|
|
21446
|
-
(0,
|
|
21694
|
+
const markerRaw = JSON.parse((0, import_fs8.readFileSync)(markerFile, "utf-8"));
|
|
21695
|
+
const markerSessionId = markerRaw.session_id ?? markerRaw.sessionId;
|
|
21696
|
+
if (!markerSessionId || markerSessionId === sessionId) {
|
|
21697
|
+
try {
|
|
21698
|
+
(0, import_fs8.unlinkSync)(markerFile);
|
|
21699
|
+
} catch (err) {
|
|
21700
|
+
if (err.code !== "ENOENT") {
|
|
21701
|
+
success = false;
|
|
21702
|
+
}
|
|
21703
|
+
}
|
|
21704
|
+
}
|
|
21447
21705
|
} catch {
|
|
21448
|
-
|
|
21706
|
+
try {
|
|
21707
|
+
(0, import_fs8.unlinkSync)(markerFile);
|
|
21708
|
+
} catch (err) {
|
|
21709
|
+
if (err.code !== "ENOENT") {
|
|
21710
|
+
success = false;
|
|
21711
|
+
}
|
|
21712
|
+
}
|
|
21449
21713
|
}
|
|
21450
21714
|
}
|
|
21451
|
-
return success;
|
|
21452
21715
|
}
|
|
21453
21716
|
const stateFile = getStateFilePath(cwd, mode);
|
|
21454
|
-
if (
|
|
21717
|
+
if (!isSessionScopedClear) {
|
|
21455
21718
|
try {
|
|
21456
|
-
(0,
|
|
21457
|
-
} catch {
|
|
21458
|
-
|
|
21459
|
-
}
|
|
21460
|
-
}
|
|
21461
|
-
if (config2.isSqlite) {
|
|
21462
|
-
const walFile = stateFile + "-wal";
|
|
21463
|
-
const shmFile = stateFile + "-shm";
|
|
21464
|
-
if ((0, import_fs7.existsSync)(walFile)) {
|
|
21465
|
-
try {
|
|
21466
|
-
(0, import_fs7.unlinkSync)(walFile);
|
|
21467
|
-
} catch {
|
|
21719
|
+
(0, import_fs8.unlinkSync)(stateFile);
|
|
21720
|
+
} catch (err) {
|
|
21721
|
+
if (err.code !== "ENOENT") {
|
|
21468
21722
|
success = false;
|
|
21469
21723
|
}
|
|
21470
21724
|
}
|
|
21471
|
-
if (
|
|
21725
|
+
if (config2.isSqlite) {
|
|
21726
|
+
const walFile = stateFile + "-wal";
|
|
21727
|
+
const shmFile = stateFile + "-shm";
|
|
21472
21728
|
try {
|
|
21473
|
-
(0,
|
|
21474
|
-
} catch {
|
|
21475
|
-
success = false;
|
|
21729
|
+
(0, import_fs8.unlinkSync)(walFile);
|
|
21730
|
+
} catch (e) {
|
|
21731
|
+
if (e.code !== "ENOENT") success = false;
|
|
21732
|
+
}
|
|
21733
|
+
try {
|
|
21734
|
+
(0, import_fs8.unlinkSync)(shmFile);
|
|
21735
|
+
} catch (e) {
|
|
21736
|
+
if (e.code !== "ENOENT") success = false;
|
|
21476
21737
|
}
|
|
21477
21738
|
}
|
|
21478
21739
|
}
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
|
|
21483
|
-
|
|
21484
|
-
|
|
21740
|
+
if (markerFile) {
|
|
21741
|
+
if (isSessionScopedClear) {
|
|
21742
|
+
try {
|
|
21743
|
+
const markerRaw = JSON.parse((0, import_fs8.readFileSync)(markerFile, "utf-8"));
|
|
21744
|
+
const markerSessionId = markerRaw.session_id ?? markerRaw.sessionId;
|
|
21745
|
+
if (!markerSessionId || markerSessionId === sessionId) {
|
|
21746
|
+
try {
|
|
21747
|
+
(0, import_fs8.unlinkSync)(markerFile);
|
|
21748
|
+
} catch (err) {
|
|
21749
|
+
if (err.code !== "ENOENT") {
|
|
21750
|
+
success = false;
|
|
21751
|
+
}
|
|
21752
|
+
}
|
|
21753
|
+
}
|
|
21754
|
+
} catch {
|
|
21755
|
+
try {
|
|
21756
|
+
(0, import_fs8.unlinkSync)(markerFile);
|
|
21757
|
+
} catch (err) {
|
|
21758
|
+
if (err.code !== "ENOENT") {
|
|
21759
|
+
success = false;
|
|
21760
|
+
}
|
|
21761
|
+
}
|
|
21762
|
+
}
|
|
21763
|
+
} else {
|
|
21764
|
+
try {
|
|
21765
|
+
(0, import_fs8.unlinkSync)(markerFile);
|
|
21766
|
+
} catch (err) {
|
|
21767
|
+
if (err.code !== "ENOENT") {
|
|
21768
|
+
success = false;
|
|
21769
|
+
}
|
|
21770
|
+
}
|
|
21485
21771
|
}
|
|
21486
21772
|
}
|
|
21487
21773
|
return success;
|
|
@@ -21507,6 +21793,7 @@ var EXECUTION_MODES = [
|
|
|
21507
21793
|
"ultraqa"
|
|
21508
21794
|
];
|
|
21509
21795
|
var STATE_TOOL_MODES = [...EXECUTION_MODES, "ralplan"];
|
|
21796
|
+
var CANCEL_SIGNAL_TTL_MS = 3e4;
|
|
21510
21797
|
function getStatePath(mode, root) {
|
|
21511
21798
|
if (MODE_CONFIGS[mode]) {
|
|
21512
21799
|
return getStateFilePath(root, mode);
|
|
@@ -21528,7 +21815,7 @@ var stateReadTool = {
|
|
|
21528
21815
|
const sessionId = session_id;
|
|
21529
21816
|
if (mode === "swarm") {
|
|
21530
21817
|
const statePath2 = getStatePath(mode, root);
|
|
21531
|
-
if (!(0,
|
|
21818
|
+
if (!(0, import_fs9.existsSync)(statePath2)) {
|
|
21532
21819
|
return {
|
|
21533
21820
|
content: [{
|
|
21534
21821
|
type: "text",
|
|
@@ -21551,7 +21838,7 @@ Note: Swarm uses SQLite database. Use swarm-specific tools to query state.`
|
|
|
21551
21838
|
if (sessionId) {
|
|
21552
21839
|
validateSessionId(sessionId);
|
|
21553
21840
|
const statePath2 = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sessionId) : resolveSessionStatePath(mode, sessionId, root);
|
|
21554
|
-
if (!(0,
|
|
21841
|
+
if (!(0, import_fs9.existsSync)(statePath2)) {
|
|
21555
21842
|
return {
|
|
21556
21843
|
content: [{
|
|
21557
21844
|
type: "text",
|
|
@@ -21560,7 +21847,7 @@ Expected path: ${statePath2}`
|
|
|
21560
21847
|
}]
|
|
21561
21848
|
};
|
|
21562
21849
|
}
|
|
21563
|
-
const content = (0,
|
|
21850
|
+
const content = (0, import_fs9.readFileSync)(statePath2, "utf-8");
|
|
21564
21851
|
const state = JSON.parse(content);
|
|
21565
21852
|
return {
|
|
21566
21853
|
content: [{
|
|
@@ -21576,12 +21863,12 @@ ${JSON.stringify(state, null, 2)}
|
|
|
21576
21863
|
};
|
|
21577
21864
|
}
|
|
21578
21865
|
const statePath = getStatePath(mode, root);
|
|
21579
|
-
const legacyExists = (0,
|
|
21866
|
+
const legacyExists = (0, import_fs9.existsSync)(statePath);
|
|
21580
21867
|
const sessionIds = listSessionIds(root);
|
|
21581
21868
|
const activeSessions = [];
|
|
21582
21869
|
for (const sid of sessionIds) {
|
|
21583
21870
|
const sessionStatePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sid) : resolveSessionStatePath(mode, sid, root);
|
|
21584
|
-
if ((0,
|
|
21871
|
+
if ((0, import_fs9.existsSync)(sessionStatePath)) {
|
|
21585
21872
|
activeSessions.push(sid);
|
|
21586
21873
|
}
|
|
21587
21874
|
}
|
|
@@ -21604,7 +21891,7 @@ Note: Reading from legacy/aggregate path (no session_id). This may include state
|
|
|
21604
21891
|
`;
|
|
21605
21892
|
if (legacyExists) {
|
|
21606
21893
|
try {
|
|
21607
|
-
const content = (0,
|
|
21894
|
+
const content = (0, import_fs9.readFileSync)(statePath, "utf-8");
|
|
21608
21895
|
const state = JSON.parse(content);
|
|
21609
21896
|
output += `### Legacy Path (shared)
|
|
21610
21897
|
Path: ${statePath}
|
|
@@ -21629,7 +21916,7 @@ Path: ${statePath}
|
|
|
21629
21916
|
for (const sid of activeSessions) {
|
|
21630
21917
|
const sessionStatePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sid) : resolveSessionStatePath(mode, sid, root);
|
|
21631
21918
|
try {
|
|
21632
|
-
const content = (0,
|
|
21919
|
+
const content = (0, import_fs9.readFileSync)(sessionStatePath, "utf-8");
|
|
21633
21920
|
const state = JSON.parse(content);
|
|
21634
21921
|
output += `**Session: ${sid}**
|
|
21635
21922
|
Path: ${sessionStatePath}
|
|
@@ -21786,6 +22073,15 @@ var stateClearTool = {
|
|
|
21786
22073
|
const sessionId = session_id;
|
|
21787
22074
|
if (sessionId) {
|
|
21788
22075
|
validateSessionId(sessionId);
|
|
22076
|
+
const now = Date.now();
|
|
22077
|
+
const cancelSignalPath = resolveSessionStatePath("cancel-signal", sessionId, root);
|
|
22078
|
+
atomicWriteJsonSync(cancelSignalPath, {
|
|
22079
|
+
active: true,
|
|
22080
|
+
requested_at: new Date(now).toISOString(),
|
|
22081
|
+
expires_at: new Date(now + CANCEL_SIGNAL_TTL_MS).toISOString(),
|
|
22082
|
+
mode,
|
|
22083
|
+
source: "state_clear"
|
|
22084
|
+
});
|
|
21789
22085
|
if (MODE_CONFIGS[mode]) {
|
|
21790
22086
|
const success = clearModeState(mode, root, sessionId);
|
|
21791
22087
|
if (success) {
|
|
@@ -21805,8 +22101,8 @@ var stateClearTool = {
|
|
|
21805
22101
|
}
|
|
21806
22102
|
}
|
|
21807
22103
|
const statePath = resolveSessionStatePath(mode, sessionId, root);
|
|
21808
|
-
if ((0,
|
|
21809
|
-
(0,
|
|
22104
|
+
if ((0, import_fs9.existsSync)(statePath)) {
|
|
22105
|
+
(0, import_fs9.unlinkSync)(statePath);
|
|
21810
22106
|
return {
|
|
21811
22107
|
content: [{
|
|
21812
22108
|
type: "text",
|
|
@@ -21827,7 +22123,7 @@ Removed: ${statePath}`
|
|
|
21827
22123
|
const errors = [];
|
|
21828
22124
|
if (MODE_CONFIGS[mode]) {
|
|
21829
22125
|
const legacyStatePath = getStateFilePath(root, mode);
|
|
21830
|
-
if ((0,
|
|
22126
|
+
if ((0, import_fs9.existsSync)(legacyStatePath)) {
|
|
21831
22127
|
if (clearModeState(mode, root)) {
|
|
21832
22128
|
clearedCount++;
|
|
21833
22129
|
} else {
|
|
@@ -21836,9 +22132,9 @@ Removed: ${statePath}`
|
|
|
21836
22132
|
}
|
|
21837
22133
|
} else {
|
|
21838
22134
|
const statePath = getStatePath(mode, root);
|
|
21839
|
-
if ((0,
|
|
22135
|
+
if ((0, import_fs9.existsSync)(statePath)) {
|
|
21840
22136
|
try {
|
|
21841
|
-
(0,
|
|
22137
|
+
(0, import_fs9.unlinkSync)(statePath);
|
|
21842
22138
|
clearedCount++;
|
|
21843
22139
|
} catch {
|
|
21844
22140
|
errors.push("legacy path");
|
|
@@ -21849,7 +22145,7 @@ Removed: ${statePath}`
|
|
|
21849
22145
|
for (const sid of sessionIds) {
|
|
21850
22146
|
if (MODE_CONFIGS[mode]) {
|
|
21851
22147
|
const sessionStatePath = getStateFilePath(root, mode, sid);
|
|
21852
|
-
if ((0,
|
|
22148
|
+
if ((0, import_fs9.existsSync)(sessionStatePath)) {
|
|
21853
22149
|
if (clearModeState(mode, root, sid)) {
|
|
21854
22150
|
clearedCount++;
|
|
21855
22151
|
} else {
|
|
@@ -21858,9 +22154,9 @@ Removed: ${statePath}`
|
|
|
21858
22154
|
}
|
|
21859
22155
|
} else {
|
|
21860
22156
|
const statePath = resolveSessionStatePath(mode, sid, root);
|
|
21861
|
-
if ((0,
|
|
22157
|
+
if ((0, import_fs9.existsSync)(statePath)) {
|
|
21862
22158
|
try {
|
|
21863
|
-
(0,
|
|
22159
|
+
(0, import_fs9.unlinkSync)(statePath);
|
|
21864
22160
|
clearedCount++;
|
|
21865
22161
|
} catch {
|
|
21866
22162
|
errors.push(`session: ${sid}`);
|
|
@@ -21917,8 +22213,8 @@ var stateListActiveTool = {
|
|
|
21917
22213
|
const activeModes = [...getActiveModes(root, sessionId)];
|
|
21918
22214
|
try {
|
|
21919
22215
|
const ralplanPath2 = resolveSessionStatePath("ralplan", sessionId, root);
|
|
21920
|
-
if ((0,
|
|
21921
|
-
const content = (0,
|
|
22216
|
+
if ((0, import_fs9.existsSync)(ralplanPath2)) {
|
|
22217
|
+
const content = (0, import_fs9.readFileSync)(ralplanPath2, "utf-8");
|
|
21922
22218
|
const state = JSON.parse(content);
|
|
21923
22219
|
if (state.active) {
|
|
21924
22220
|
activeModes.push("ralplan");
|
|
@@ -21949,9 +22245,9 @@ ${modeList}`
|
|
|
21949
22245
|
const modeSessionMap = /* @__PURE__ */ new Map();
|
|
21950
22246
|
const legacyActiveModes = [...getActiveModes(root)];
|
|
21951
22247
|
const ralplanPath = getStatePath("ralplan", root);
|
|
21952
|
-
if ((0,
|
|
22248
|
+
if ((0, import_fs9.existsSync)(ralplanPath)) {
|
|
21953
22249
|
try {
|
|
21954
|
-
const content = (0,
|
|
22250
|
+
const content = (0, import_fs9.readFileSync)(ralplanPath, "utf-8");
|
|
21955
22251
|
const state = JSON.parse(content);
|
|
21956
22252
|
if (state.active) {
|
|
21957
22253
|
legacyActiveModes.push("ralplan");
|
|
@@ -21970,8 +22266,8 @@ ${modeList}`
|
|
|
21970
22266
|
const sessionActiveModes = [...getActiveModes(root, sid)];
|
|
21971
22267
|
try {
|
|
21972
22268
|
const ralplanSessionPath = resolveSessionStatePath("ralplan", sid, root);
|
|
21973
|
-
if ((0,
|
|
21974
|
-
const content = (0,
|
|
22269
|
+
if ((0, import_fs9.existsSync)(ralplanSessionPath)) {
|
|
22270
|
+
const content = (0, import_fs9.readFileSync)(ralplanSessionPath, "utf-8");
|
|
21975
22271
|
const state = JSON.parse(content);
|
|
21976
22272
|
if (state.active) {
|
|
21977
22273
|
sessionActiveModes.push("ralplan");
|
|
@@ -22035,9 +22331,9 @@ var stateGetStatusTool = {
|
|
|
22035
22331
|
if (sessionId) {
|
|
22036
22332
|
validateSessionId(sessionId);
|
|
22037
22333
|
const statePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sessionId) : resolveSessionStatePath(mode, sessionId, root);
|
|
22038
|
-
const active = MODE_CONFIGS[mode] ? isModeActive(mode, root, sessionId) : (0,
|
|
22334
|
+
const active = MODE_CONFIGS[mode] ? isModeActive(mode, root, sessionId) : (0, import_fs9.existsSync)(statePath) && (() => {
|
|
22039
22335
|
try {
|
|
22040
|
-
const content = (0,
|
|
22336
|
+
const content = (0, import_fs9.readFileSync)(statePath, "utf-8");
|
|
22041
22337
|
const state = JSON.parse(content);
|
|
22042
22338
|
return state.active === true;
|
|
22043
22339
|
} catch {
|
|
@@ -22045,9 +22341,9 @@ var stateGetStatusTool = {
|
|
|
22045
22341
|
}
|
|
22046
22342
|
})();
|
|
22047
22343
|
let statePreview = "No state file";
|
|
22048
|
-
if ((0,
|
|
22344
|
+
if ((0, import_fs9.existsSync)(statePath)) {
|
|
22049
22345
|
try {
|
|
22050
|
-
const content = (0,
|
|
22346
|
+
const content = (0, import_fs9.readFileSync)(statePath, "utf-8");
|
|
22051
22347
|
const state = JSON.parse(content);
|
|
22052
22348
|
statePreview = JSON.stringify(state, null, 2).slice(0, 500);
|
|
22053
22349
|
if (statePreview.length >= 500) statePreview += "\n...(truncated)";
|
|
@@ -22058,7 +22354,7 @@ var stateGetStatusTool = {
|
|
|
22058
22354
|
lines2.push(`### Session: ${sessionId}`);
|
|
22059
22355
|
lines2.push(`- **Active:** ${active ? "Yes" : "No"}`);
|
|
22060
22356
|
lines2.push(`- **State Path:** ${statePath}`);
|
|
22061
|
-
lines2.push(`- **Exists:** ${(0,
|
|
22357
|
+
lines2.push(`- **Exists:** ${(0, import_fs9.existsSync)(statePath) ? "Yes" : "No"}`);
|
|
22062
22358
|
lines2.push(`
|
|
22063
22359
|
### State Preview
|
|
22064
22360
|
\`\`\`json
|
|
@@ -22072,9 +22368,9 @@ ${statePreview}
|
|
|
22072
22368
|
};
|
|
22073
22369
|
}
|
|
22074
22370
|
const legacyPath = getStatePath(mode, root);
|
|
22075
|
-
const legacyActive = MODE_CONFIGS[mode] ? isModeActive(mode, root) : (0,
|
|
22371
|
+
const legacyActive = MODE_CONFIGS[mode] ? isModeActive(mode, root) : (0, import_fs9.existsSync)(legacyPath) && (() => {
|
|
22076
22372
|
try {
|
|
22077
|
-
const content = (0,
|
|
22373
|
+
const content = (0, import_fs9.readFileSync)(legacyPath, "utf-8");
|
|
22078
22374
|
const state = JSON.parse(content);
|
|
22079
22375
|
return state.active === true;
|
|
22080
22376
|
} catch {
|
|
@@ -22084,13 +22380,13 @@ ${statePreview}
|
|
|
22084
22380
|
lines2.push(`### Legacy Path`);
|
|
22085
22381
|
lines2.push(`- **Active:** ${legacyActive ? "Yes" : "No"}`);
|
|
22086
22382
|
lines2.push(`- **State Path:** ${legacyPath}`);
|
|
22087
|
-
lines2.push(`- **Exists:** ${(0,
|
|
22383
|
+
lines2.push(`- **Exists:** ${(0, import_fs9.existsSync)(legacyPath) ? "Yes" : "No"}
|
|
22088
22384
|
`);
|
|
22089
22385
|
const activeSessions = MODE_CONFIGS[mode] ? getActiveSessionsForMode(mode, root) : listSessionIds(root).filter((sid) => {
|
|
22090
22386
|
try {
|
|
22091
22387
|
const sessionPath = resolveSessionStatePath(mode, sid, root);
|
|
22092
|
-
if ((0,
|
|
22093
|
-
const content = (0,
|
|
22388
|
+
if ((0, import_fs9.existsSync)(sessionPath)) {
|
|
22389
|
+
const content = (0, import_fs9.readFileSync)(sessionPath, "utf-8");
|
|
22094
22390
|
const state = JSON.parse(content);
|
|
22095
22391
|
return state.active === true;
|
|
22096
22392
|
}
|
|
@@ -22131,9 +22427,9 @@ No active sessions for this mode.`);
|
|
|
22131
22427
|
}
|
|
22132
22428
|
const ralplanPath = sessionId ? resolveSessionStatePath("ralplan", sessionId, root) : getStatePath("ralplan", root);
|
|
22133
22429
|
let ralplanActive = false;
|
|
22134
|
-
if ((0,
|
|
22430
|
+
if ((0, import_fs9.existsSync)(ralplanPath)) {
|
|
22135
22431
|
try {
|
|
22136
|
-
const content = (0,
|
|
22432
|
+
const content = (0, import_fs9.readFileSync)(ralplanPath, "utf-8");
|
|
22137
22433
|
const state = JSON.parse(content);
|
|
22138
22434
|
ralplanActive = state.active === true;
|
|
22139
22435
|
} catch {
|
|
@@ -22168,7 +22464,7 @@ var stateTools = [
|
|
|
22168
22464
|
];
|
|
22169
22465
|
|
|
22170
22466
|
// src/hooks/notepad/index.ts
|
|
22171
|
-
var
|
|
22467
|
+
var import_fs10 = require("fs");
|
|
22172
22468
|
var import_path9 = require("path");
|
|
22173
22469
|
var NOTEPAD_FILENAME = "notepad.md";
|
|
22174
22470
|
var DEFAULT_CONFIG = {
|
|
@@ -22185,15 +22481,15 @@ function getNotepadPath(directory) {
|
|
|
22185
22481
|
}
|
|
22186
22482
|
function initNotepad(directory) {
|
|
22187
22483
|
const omcDir = (0, import_path9.join)(directory, ".omc");
|
|
22188
|
-
if (!(0,
|
|
22484
|
+
if (!(0, import_fs10.existsSync)(omcDir)) {
|
|
22189
22485
|
try {
|
|
22190
|
-
(0,
|
|
22486
|
+
(0, import_fs10.mkdirSync)(omcDir, { recursive: true });
|
|
22191
22487
|
} catch {
|
|
22192
22488
|
return false;
|
|
22193
22489
|
}
|
|
22194
22490
|
}
|
|
22195
22491
|
const notepadPath = getNotepadPath(directory);
|
|
22196
|
-
if ((0,
|
|
22492
|
+
if ((0, import_fs10.existsSync)(notepadPath)) {
|
|
22197
22493
|
return true;
|
|
22198
22494
|
}
|
|
22199
22495
|
const content = `# Notepad
|
|
@@ -22218,11 +22514,11 @@ ${MANUAL_HEADER}
|
|
|
22218
22514
|
}
|
|
22219
22515
|
function readNotepad(directory) {
|
|
22220
22516
|
const notepadPath = getNotepadPath(directory);
|
|
22221
|
-
if (!(0,
|
|
22517
|
+
if (!(0, import_fs10.existsSync)(notepadPath)) {
|
|
22222
22518
|
return null;
|
|
22223
22519
|
}
|
|
22224
22520
|
try {
|
|
22225
|
-
return (0,
|
|
22521
|
+
return (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22226
22522
|
} catch {
|
|
22227
22523
|
return null;
|
|
22228
22524
|
}
|
|
@@ -22269,13 +22565,13 @@ function getManualSection(directory) {
|
|
|
22269
22565
|
return extractSection(content, MANUAL_HEADER);
|
|
22270
22566
|
}
|
|
22271
22567
|
function setPriorityContext(directory, content, config2 = DEFAULT_CONFIG) {
|
|
22272
|
-
if (!(0,
|
|
22568
|
+
if (!(0, import_fs10.existsSync)(getNotepadPath(directory))) {
|
|
22273
22569
|
if (!initNotepad(directory)) {
|
|
22274
22570
|
return { success: false };
|
|
22275
22571
|
}
|
|
22276
22572
|
}
|
|
22277
22573
|
const notepadPath = getNotepadPath(directory);
|
|
22278
|
-
let notepadContent = (0,
|
|
22574
|
+
let notepadContent = (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22279
22575
|
const warning = content.length > config2.priorityMaxChars ? `Priority Context exceeds ${config2.priorityMaxChars} chars (${content.length} chars). Consider condensing.` : void 0;
|
|
22280
22576
|
notepadContent = replaceSection(notepadContent, PRIORITY_HEADER, content);
|
|
22281
22577
|
try {
|
|
@@ -22286,13 +22582,13 @@ function setPriorityContext(directory, content, config2 = DEFAULT_CONFIG) {
|
|
|
22286
22582
|
}
|
|
22287
22583
|
}
|
|
22288
22584
|
function addWorkingMemoryEntry(directory, content) {
|
|
22289
|
-
if (!(0,
|
|
22585
|
+
if (!(0, import_fs10.existsSync)(getNotepadPath(directory))) {
|
|
22290
22586
|
if (!initNotepad(directory)) {
|
|
22291
22587
|
return false;
|
|
22292
22588
|
}
|
|
22293
22589
|
}
|
|
22294
22590
|
const notepadPath = getNotepadPath(directory);
|
|
22295
|
-
let notepadContent = (0,
|
|
22591
|
+
let notepadContent = (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22296
22592
|
const currentMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER) || "";
|
|
22297
22593
|
const now = /* @__PURE__ */ new Date();
|
|
22298
22594
|
const timestamp = now.toISOString().slice(0, 16).replace("T", " ");
|
|
@@ -22313,13 +22609,13 @@ ${content}
|
|
|
22313
22609
|
}
|
|
22314
22610
|
}
|
|
22315
22611
|
function addManualEntry(directory, content) {
|
|
22316
|
-
if (!(0,
|
|
22612
|
+
if (!(0, import_fs10.existsSync)(getNotepadPath(directory))) {
|
|
22317
22613
|
if (!initNotepad(directory)) {
|
|
22318
22614
|
return false;
|
|
22319
22615
|
}
|
|
22320
22616
|
}
|
|
22321
22617
|
const notepadPath = getNotepadPath(directory);
|
|
22322
|
-
let notepadContent = (0,
|
|
22618
|
+
let notepadContent = (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22323
22619
|
const currentManual = extractSection(notepadContent, MANUAL_HEADER) || "";
|
|
22324
22620
|
const now = /* @__PURE__ */ new Date();
|
|
22325
22621
|
const timestamp = now.toISOString().slice(0, 16).replace("T", " ");
|
|
@@ -22337,10 +22633,10 @@ ${content}
|
|
|
22337
22633
|
}
|
|
22338
22634
|
function pruneOldEntries(directory, daysOld = DEFAULT_CONFIG.workingMemoryDays) {
|
|
22339
22635
|
const notepadPath = getNotepadPath(directory);
|
|
22340
|
-
if (!(0,
|
|
22636
|
+
if (!(0, import_fs10.existsSync)(notepadPath)) {
|
|
22341
22637
|
return { pruned: 0, remaining: 0 };
|
|
22342
22638
|
}
|
|
22343
|
-
let notepadContent = (0,
|
|
22639
|
+
let notepadContent = (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22344
22640
|
const workingMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER);
|
|
22345
22641
|
if (!workingMemory) {
|
|
22346
22642
|
return { pruned: 0, remaining: 0 };
|
|
@@ -22378,7 +22674,7 @@ ${entry.content}`).join("\n\n");
|
|
|
22378
22674
|
}
|
|
22379
22675
|
function getNotepadStats(directory) {
|
|
22380
22676
|
const notepadPath = getNotepadPath(directory);
|
|
22381
|
-
if (!(0,
|
|
22677
|
+
if (!(0, import_fs10.existsSync)(notepadPath)) {
|
|
22382
22678
|
return {
|
|
22383
22679
|
exists: false,
|
|
22384
22680
|
totalSize: 0,
|
|
@@ -22387,16 +22683,20 @@ function getNotepadStats(directory) {
|
|
|
22387
22683
|
oldestEntry: null
|
|
22388
22684
|
};
|
|
22389
22685
|
}
|
|
22390
|
-
const content = (0,
|
|
22686
|
+
const content = (0, import_fs10.readFileSync)(notepadPath, "utf-8");
|
|
22391
22687
|
const priorityContext = extractSection(content, PRIORITY_HEADER) || "";
|
|
22392
22688
|
const workingMemory = extractSection(content, WORKING_MEMORY_HEADER) || "";
|
|
22393
|
-
const
|
|
22394
|
-
|
|
22689
|
+
const wmMatches = workingMemory.match(
|
|
22690
|
+
/<\!-- WM:\d{4}-\d{2}-\d{2} \d{2}:\d{2} -->/g
|
|
22395
22691
|
);
|
|
22692
|
+
const legacyMatches = workingMemory.match(/### \d{4}-\d{2}-\d{2} \d{2}:\d{2}/g);
|
|
22693
|
+
const entryMatches = wmMatches ?? legacyMatches;
|
|
22396
22694
|
const entryCount = entryMatches ? entryMatches.length : 0;
|
|
22397
22695
|
let oldestEntry = null;
|
|
22398
22696
|
if (entryMatches && entryMatches.length > 0) {
|
|
22399
|
-
const timestamps = entryMatches.map(
|
|
22697
|
+
const timestamps = entryMatches.map(
|
|
22698
|
+
(m) => m.startsWith("<!--") ? m.replace(/^<\!-- WM:| -->$/g, "") : m.replace("### ", "")
|
|
22699
|
+
);
|
|
22400
22700
|
timestamps.sort();
|
|
22401
22701
|
oldestEntry = timestamps[0];
|
|
22402
22702
|
}
|
|
@@ -22803,7 +23103,7 @@ var ContextCollector = class {
|
|
|
22803
23103
|
var contextCollector = new ContextCollector();
|
|
22804
23104
|
|
|
22805
23105
|
// src/hooks/rules-injector/finder.ts
|
|
22806
|
-
var
|
|
23106
|
+
var import_fs11 = require("fs");
|
|
22807
23107
|
var import_path11 = require("path");
|
|
22808
23108
|
|
|
22809
23109
|
// src/hooks/rules-injector/constants.ts
|
|
@@ -22843,7 +23143,7 @@ async function saveProjectMemory(projectRoot, memory) {
|
|
|
22843
23143
|
const memoryPath = getMemoryPath(projectRoot);
|
|
22844
23144
|
try {
|
|
22845
23145
|
await import_promises.default.mkdir(omcDir, { recursive: true });
|
|
22846
|
-
await
|
|
23146
|
+
await atomicWriteJson(memoryPath, memory);
|
|
22847
23147
|
} catch (error2) {
|
|
22848
23148
|
console.error("Failed to save project memory:", error2);
|
|
22849
23149
|
}
|
|
@@ -22881,25 +23181,40 @@ function addDirective(directives, newDirective) {
|
|
|
22881
23181
|
var import_path15 = __toESM(require("path"), 1);
|
|
22882
23182
|
|
|
22883
23183
|
// src/hooks/project-memory/learner.ts
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
23184
|
+
var writeMutexes = /* @__PURE__ */ new Map();
|
|
23185
|
+
function withMutex(projectRoot, fn) {
|
|
23186
|
+
const prev = writeMutexes.get(projectRoot) ?? Promise.resolve();
|
|
23187
|
+
const next = prev.then(() => fn()).catch(() => fn());
|
|
23188
|
+
const tail = next.then(
|
|
23189
|
+
() => {
|
|
23190
|
+
},
|
|
23191
|
+
() => {
|
|
22889
23192
|
}
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
memory
|
|
23193
|
+
);
|
|
23194
|
+
writeMutexes.set(projectRoot, tail);
|
|
23195
|
+
return next;
|
|
23196
|
+
}
|
|
23197
|
+
async function addCustomNote(projectRoot, category, content) {
|
|
23198
|
+
return withMutex(projectRoot, async () => {
|
|
23199
|
+
try {
|
|
23200
|
+
const memory = await loadProjectMemory(projectRoot);
|
|
23201
|
+
if (!memory) {
|
|
23202
|
+
return;
|
|
23203
|
+
}
|
|
23204
|
+
memory.customNotes.push({
|
|
23205
|
+
timestamp: Date.now(),
|
|
23206
|
+
source: "manual",
|
|
23207
|
+
category,
|
|
23208
|
+
content
|
|
23209
|
+
});
|
|
23210
|
+
if (memory.customNotes.length > 20) {
|
|
23211
|
+
memory.customNotes = memory.customNotes.slice(-20);
|
|
23212
|
+
}
|
|
23213
|
+
await saveProjectMemory(projectRoot, memory);
|
|
23214
|
+
} catch (error2) {
|
|
23215
|
+
console.error("Error adding custom note:", error2);
|
|
22898
23216
|
}
|
|
22899
|
-
|
|
22900
|
-
} catch (error2) {
|
|
22901
|
-
console.error("Error adding custom note:", error2);
|
|
22902
|
-
}
|
|
23217
|
+
});
|
|
22903
23218
|
}
|
|
22904
23219
|
|
|
22905
23220
|
// src/tools/memory-tools.ts
|
|
@@ -23115,27 +23430,27 @@ var memoryTools = [
|
|
|
23115
23430
|
];
|
|
23116
23431
|
|
|
23117
23432
|
// src/tools/trace-tools.ts
|
|
23118
|
-
var
|
|
23433
|
+
var import_fs13 = require("fs");
|
|
23119
23434
|
var import_path17 = require("path");
|
|
23120
23435
|
|
|
23121
23436
|
// src/hooks/subagent-tracker/session-replay.ts
|
|
23122
|
-
var
|
|
23437
|
+
var import_fs12 = require("fs");
|
|
23123
23438
|
var import_path16 = require("path");
|
|
23124
23439
|
var REPLAY_PREFIX = "agent-replay-";
|
|
23125
23440
|
var MAX_REPLAY_SIZE_BYTES = 5 * 1024 * 1024;
|
|
23126
23441
|
function getReplayFilePath(directory, sessionId) {
|
|
23127
23442
|
const stateDir = (0, import_path16.join)(directory, ".omc", "state");
|
|
23128
|
-
if (!(0,
|
|
23129
|
-
(0,
|
|
23443
|
+
if (!(0, import_fs12.existsSync)(stateDir)) {
|
|
23444
|
+
(0, import_fs12.mkdirSync)(stateDir, { recursive: true });
|
|
23130
23445
|
}
|
|
23131
23446
|
const safeId = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
23132
23447
|
return (0, import_path16.join)(stateDir, `${REPLAY_PREFIX}${safeId}.jsonl`);
|
|
23133
23448
|
}
|
|
23134
23449
|
function readReplayEvents(directory, sessionId) {
|
|
23135
23450
|
const filePath = getReplayFilePath(directory, sessionId);
|
|
23136
|
-
if (!(0,
|
|
23451
|
+
if (!(0, import_fs12.existsSync)(filePath)) return [];
|
|
23137
23452
|
try {
|
|
23138
|
-
const content = (0,
|
|
23453
|
+
const content = (0, import_fs12.readFileSync)(filePath, "utf-8");
|
|
23139
23454
|
return content.split("\n").filter((line) => line.trim()).map((line) => {
|
|
23140
23455
|
try {
|
|
23141
23456
|
return JSON.parse(line);
|
|
@@ -23310,10 +23625,10 @@ var REPLAY_PREFIX2 = "agent-replay-";
|
|
|
23310
23625
|
function findLatestSessionId(directory) {
|
|
23311
23626
|
const stateDir = (0, import_path17.join)(directory, ".omc", "state");
|
|
23312
23627
|
try {
|
|
23313
|
-
const files = (0,
|
|
23628
|
+
const files = (0, import_fs13.readdirSync)(stateDir).filter((f) => f.startsWith(REPLAY_PREFIX2) && f.endsWith(".jsonl")).map((f) => ({
|
|
23314
23629
|
name: f,
|
|
23315
23630
|
sessionId: f.slice(REPLAY_PREFIX2.length, -".jsonl".length),
|
|
23316
|
-
mtime: (0,
|
|
23631
|
+
mtime: (0, import_fs13.statSync)((0, import_path17.join)(stateDir, f)).mtimeMs
|
|
23317
23632
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
23318
23633
|
return files.length > 0 ? files[0].sessionId : null;
|
|
23319
23634
|
} catch {
|