claudecode-omc 4.8.4 → 4.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +3 -3
- package/README.de.md +26 -0
- package/README.es.md +26 -0
- package/README.fr.md +26 -0
- package/README.it.md +26 -0
- package/README.ja.md +26 -0
- package/README.ko.md +26 -0
- package/README.md +80 -133
- package/README.pt.md +26 -0
- package/README.ru.md +26 -0
- package/README.tr.md +26 -0
- package/README.vi.md +26 -0
- package/README.zh.md +26 -0
- package/agents/analyst.md +1 -0
- package/agents/architect.md +1 -0
- package/agents/code-reviewer.md +1 -0
- package/agents/code-simplifier.md +1 -0
- package/agents/critic.md +1 -0
- package/agents/debugger.md +1 -0
- package/agents/designer.md +1 -0
- package/agents/document-specialist.md +1 -0
- package/agents/executor.md +1 -0
- package/agents/explore.md +21 -19
- package/agents/git-master.md +1 -0
- package/agents/planner.md +1 -0
- package/agents/qa-tester.md +1 -0
- package/agents/scientist.md +1 -0
- package/agents/security-reviewer.md +1 -0
- package/agents/test-engineer.md +1 -0
- package/agents/tracer.md +161 -0
- package/agents/verifier.md +21 -13
- package/agents/writer.md +1 -0
- package/bridge/cli.cjs +37707 -25194
- package/bridge/gyoshu_bridge.py +60 -15
- package/bridge/mcp-server.cjs +1323 -503
- package/bridge/runtime-cli.cjs +1220 -328
- package/bridge/team-bridge.cjs +140 -112
- package/bridge/team-mcp.cjs +325 -107
- package/bridge/team.js +2572 -1462
- package/dist/__tests__/agent-registry.test.js +5 -3
- package/dist/__tests__/agent-registry.test.js.map +1 -1
- package/dist/__tests__/auto-slash-aliases.test.js +149 -68
- package/dist/__tests__/auto-slash-aliases.test.js.map +1 -1
- package/dist/__tests__/auto-update.test.js +502 -3
- package/dist/__tests__/auto-update.test.js.map +1 -1
- package/dist/__tests__/background-cleanup-directory.test.d.ts +2 -0
- package/dist/__tests__/background-cleanup-directory.test.d.ts.map +1 -0
- package/dist/__tests__/background-cleanup-directory.test.js +57 -0
- package/dist/__tests__/background-cleanup-directory.test.js.map +1 -0
- package/dist/__tests__/bedrock-lm-suffix-hook.test.d.ts +24 -0
- package/dist/__tests__/bedrock-lm-suffix-hook.test.d.ts.map +1 -0
- package/dist/__tests__/bedrock-lm-suffix-hook.test.js +210 -0
- package/dist/__tests__/bedrock-lm-suffix-hook.test.js.map +1 -0
- package/dist/__tests__/cleanup-validation.test.js +5 -3
- package/dist/__tests__/cleanup-validation.test.js.map +1 -1
- package/dist/__tests__/context-guard-stop.test.js +20 -0
- package/dist/__tests__/context-guard-stop.test.js.map +1 -1
- package/dist/__tests__/context-safety.test.js +51 -22
- package/dist/__tests__/context-safety.test.js.map +1 -1
- package/dist/__tests__/deep-interview-provider-options.test.d.ts +2 -0
- package/dist/__tests__/deep-interview-provider-options.test.d.ts.map +1 -0
- package/dist/__tests__/deep-interview-provider-options.test.js +79 -0
- package/dist/__tests__/deep-interview-provider-options.test.js.map +1 -0
- package/dist/__tests__/delegation-enforcement-levels.test.js +4 -0
- package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -1
- package/dist/__tests__/delegation-enforcer.test.js +12 -0
- package/dist/__tests__/delegation-enforcer.test.js.map +1 -1
- package/dist/__tests__/doctor-conflicts.test.js +111 -24
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/featured-contributors-generator.test.d.ts +2 -0
- package/dist/__tests__/featured-contributors-generator.test.d.ts.map +1 -0
- package/dist/__tests__/featured-contributors-generator.test.js +118 -0
- package/dist/__tests__/featured-contributors-generator.test.js.map +1 -0
- package/dist/__tests__/hooks/learner/bridge.test.js +27 -1
- package/dist/__tests__/hooks/learner/bridge.test.js.map +1 -1
- package/dist/__tests__/hooks/learner/transliteration-map.test.d.ts +8 -0
- package/dist/__tests__/hooks/learner/transliteration-map.test.d.ts.map +1 -0
- package/dist/__tests__/hooks/learner/transliteration-map.test.js +183 -0
- package/dist/__tests__/hooks/learner/transliteration-map.test.js.map +1 -0
- package/dist/__tests__/hooks-command-escaping.test.d.ts +2 -0
- package/dist/__tests__/hooks-command-escaping.test.d.ts.map +1 -0
- package/dist/__tests__/hooks-command-escaping.test.js +41 -0
- package/dist/__tests__/hooks-command-escaping.test.js.map +1 -0
- package/dist/__tests__/hooks.test.js +13 -9
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/hud/background-tasks.test.d.ts +2 -0
- package/dist/__tests__/hud/background-tasks.test.d.ts.map +1 -0
- package/dist/__tests__/hud/background-tasks.test.js +90 -0
- package/dist/__tests__/hud/background-tasks.test.js.map +1 -0
- package/dist/__tests__/hud/context.test.d.ts +2 -0
- package/dist/__tests__/hud/context.test.d.ts.map +1 -0
- package/dist/__tests__/hud/context.test.js +47 -0
- package/dist/__tests__/hud/context.test.js.map +1 -0
- package/dist/__tests__/hud/defaults.test.js +11 -0
- package/dist/__tests__/hud/defaults.test.js.map +1 -1
- package/dist/__tests__/hud/git.test.js +2 -1
- package/dist/__tests__/hud/git.test.js.map +1 -1
- package/dist/__tests__/hud/mission-board-state.test.js +32 -0
- package/dist/__tests__/hud/mission-board-state.test.js.map +1 -1
- package/dist/__tests__/hud/mission-board.test.js +1 -0
- package/dist/__tests__/hud/mission-board.test.js.map +1 -1
- package/dist/__tests__/hud/omc-state.test.d.ts +2 -0
- package/dist/__tests__/hud/omc-state.test.d.ts.map +1 -0
- package/dist/__tests__/hud/omc-state.test.js +123 -0
- package/dist/__tests__/hud/omc-state.test.js.map +1 -0
- package/dist/__tests__/hud/render-rate-limits-priority.test.js +1 -0
- package/dist/__tests__/hud/render-rate-limits-priority.test.js.map +1 -1
- package/dist/__tests__/hud/render.test.js +125 -0
- package/dist/__tests__/hud/render.test.js.map +1 -1
- package/dist/__tests__/hud/state.test.js +104 -47
- package/dist/__tests__/hud/state.test.js.map +1 -1
- package/dist/__tests__/hud/stdin.test.d.ts +2 -0
- package/dist/__tests__/hud/stdin.test.d.ts.map +1 -0
- package/dist/__tests__/hud/stdin.test.js +108 -0
- package/dist/__tests__/hud/stdin.test.js.map +1 -0
- package/dist/__tests__/hud/token-usage.test.d.ts +2 -0
- package/dist/__tests__/hud/token-usage.test.d.ts.map +1 -0
- package/dist/__tests__/hud/token-usage.test.js +143 -0
- package/dist/__tests__/hud/token-usage.test.js.map +1 -0
- package/dist/__tests__/hud/usage-api-lock.test.js +6 -3
- package/dist/__tests__/hud/usage-api-lock.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api-stale.test.js +4 -2
- package/dist/__tests__/hud/usage-api-stale.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api.test.js +128 -1
- 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/watch-mode-init.test.js +25 -3
- package/dist/__tests__/hud/watch-mode-init.test.js.map +1 -1
- package/dist/__tests__/hud-marketplace-resolution.test.js +25 -0
- package/dist/__tests__/hud-marketplace-resolution.test.js.map +1 -1
- package/dist/__tests__/hud-windows.test.js +11 -0
- package/dist/__tests__/hud-windows.test.js.map +1 -1
- package/dist/__tests__/installer-mcp-config.test.d.ts +2 -0
- package/dist/__tests__/installer-mcp-config.test.d.ts.map +1 -0
- package/dist/__tests__/installer-mcp-config.test.js +119 -0
- package/dist/__tests__/installer-mcp-config.test.js.map +1 -0
- package/dist/__tests__/installer-omc-reference.test.d.ts +2 -0
- package/dist/__tests__/installer-omc-reference.test.d.ts.map +1 -0
- package/dist/__tests__/installer-omc-reference.test.js +85 -0
- package/dist/__tests__/installer-omc-reference.test.js.map +1 -0
- package/dist/__tests__/job-management-sqlite.test.js +1 -1
- package/dist/__tests__/job-state-db.test.js +1 -1
- package/dist/__tests__/jobid-collision-safety.test.d.ts +10 -0
- package/dist/__tests__/jobid-collision-safety.test.d.ts.map +1 -0
- package/dist/__tests__/jobid-collision-safety.test.js +51 -0
- package/dist/__tests__/jobid-collision-safety.test.js.map +1 -0
- package/dist/__tests__/live-data.test.js +21 -0
- package/dist/__tests__/live-data.test.js.map +1 -1
- package/dist/__tests__/load-agent-prompt.test.js +10 -0
- package/dist/__tests__/load-agent-prompt.test.js.map +1 -1
- package/dist/__tests__/lsp-servers.test.js +14 -2
- package/dist/__tests__/lsp-servers.test.js.map +1 -1
- package/dist/__tests__/marketplace-metadata.test.d.ts +2 -0
- package/dist/__tests__/marketplace-metadata.test.d.ts.map +1 -0
- package/dist/__tests__/marketplace-metadata.test.js +20 -0
- package/dist/__tests__/marketplace-metadata.test.js.map +1 -0
- package/dist/__tests__/mcp-comm-inbox-dedup.test.d.ts +2 -0
- package/dist/__tests__/mcp-comm-inbox-dedup.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-comm-inbox-dedup.test.js +105 -0
- package/dist/__tests__/mcp-comm-inbox-dedup.test.js.map +1 -0
- package/dist/__tests__/mnemosyne/finder.test.js +10 -0
- package/dist/__tests__/mnemosyne/finder.test.js.map +1 -1
- package/dist/__tests__/mode-names-ralplan.test.d.ts +2 -0
- package/dist/__tests__/mode-names-ralplan.test.d.ts.map +1 -0
- package/dist/__tests__/mode-names-ralplan.test.js +31 -0
- package/dist/__tests__/mode-names-ralplan.test.js.map +1 -0
- package/dist/__tests__/model-routing-esm.test.d.ts +2 -0
- package/dist/__tests__/model-routing-esm.test.d.ts.map +1 -0
- package/dist/__tests__/model-routing-esm.test.js +26 -0
- package/dist/__tests__/model-routing-esm.test.js.map +1 -0
- package/dist/__tests__/notepad.test.js +20 -0
- package/dist/__tests__/notepad.test.js.map +1 -1
- package/dist/__tests__/omc-cli-rendering.test.d.ts +2 -0
- package/dist/__tests__/omc-cli-rendering.test.d.ts.map +1 -0
- package/dist/__tests__/omc-cli-rendering.test.js +33 -0
- package/dist/__tests__/omc-cli-rendering.test.js.map +1 -0
- package/dist/__tests__/omc-tools-server.test.js +5 -5
- package/dist/__tests__/outbox-reader-partial-lines.test.d.ts +2 -0
- package/dist/__tests__/outbox-reader-partial-lines.test.d.ts.map +1 -0
- package/dist/__tests__/outbox-reader-partial-lines.test.js +49 -0
- package/dist/__tests__/outbox-reader-partial-lines.test.js.map +1 -0
- package/dist/__tests__/package-dir-resolution-regression.test.js +30 -0
- package/dist/__tests__/package-dir-resolution-regression.test.js.map +1 -1
- package/dist/__tests__/pipeline-signal-regex-escape.test.d.ts +2 -0
- package/dist/__tests__/pipeline-signal-regex-escape.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline-signal-regex-escape.test.js +32 -0
- package/dist/__tests__/pipeline-signal-regex-escape.test.js.map +1 -0
- package/dist/__tests__/plugin-setup-devpaths.test.d.ts +2 -0
- package/dist/__tests__/plugin-setup-devpaths.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-setup-devpaths.test.js +47 -0
- package/dist/__tests__/plugin-setup-devpaths.test.js.map +1 -0
- package/dist/__tests__/pre-compact-cwd.test.js +1 -1
- package/dist/__tests__/pre-tool-enforcer.test.js +101 -2
- package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -1
- package/dist/__tests__/project-memory-merge.test.js +17 -0
- package/dist/__tests__/project-memory-merge.test.js.map +1 -1
- package/dist/__tests__/providers/bitbucket.test.js +70 -56
- package/dist/__tests__/providers/bitbucket.test.js.map +1 -1
- package/dist/__tests__/providers/gitea.test.js +36 -0
- package/dist/__tests__/providers/gitea.test.js.map +1 -1
- package/dist/__tests__/purge-stale-cache.test.js +17 -2
- package/dist/__tests__/purge-stale-cache.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js +7 -3
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/integration.test.js +9 -5
- package/dist/__tests__/rate-limit-wait/integration.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/tmux-detector.test.js +11 -11
- package/dist/__tests__/rate-limit-wait/tmux-detector.test.js.map +1 -1
- package/dist/__tests__/repo-slug-dots.test.d.ts +2 -0
- package/dist/__tests__/repo-slug-dots.test.d.ts.map +1 -0
- package/dist/__tests__/repo-slug-dots.test.js +24 -0
- package/dist/__tests__/repo-slug-dots.test.js.map +1 -0
- package/dist/__tests__/routing-force-inherit.test.js +31 -0
- package/dist/__tests__/routing-force-inherit.test.js.map +1 -1
- package/dist/__tests__/runtime-task-orphan.test.d.ts +2 -0
- package/dist/__tests__/runtime-task-orphan.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-task-orphan.test.js +103 -0
- package/dist/__tests__/runtime-task-orphan.test.js.map +1 -0
- package/dist/__tests__/session-start-script-context.test.js +85 -0
- package/dist/__tests__/session-start-script-context.test.js.map +1 -1
- package/dist/__tests__/session-start-timeout-cleanup.test.d.ts +2 -0
- package/dist/__tests__/session-start-timeout-cleanup.test.d.ts.map +1 -0
- package/dist/__tests__/session-start-timeout-cleanup.test.js +26 -0
- package/dist/__tests__/session-start-timeout-cleanup.test.js.map +1 -0
- package/dist/__tests__/session-summary-pid-tracking.test.d.ts +2 -0
- package/dist/__tests__/session-summary-pid-tracking.test.d.ts.map +1 -0
- package/dist/__tests__/session-summary-pid-tracking.test.js +107 -0
- package/dist/__tests__/session-summary-pid-tracking.test.js.map +1 -0
- package/dist/__tests__/setup-claude-md-script.test.d.ts +2 -0
- package/dist/__tests__/setup-claude-md-script.test.d.ts.map +1 -0
- package/dist/__tests__/setup-claude-md-script.test.js +292 -0
- package/dist/__tests__/setup-claude-md-script.test.js.map +1 -0
- package/dist/__tests__/shared-state-locking.test.d.ts +10 -0
- package/dist/__tests__/shared-state-locking.test.d.ts.map +1 -0
- package/dist/__tests__/shared-state-locking.test.js +61 -0
- package/dist/__tests__/shared-state-locking.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +135 -17
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/__tests__/slack-fallback-removal.test.d.ts +2 -0
- package/dist/__tests__/slack-fallback-removal.test.d.ts.map +1 -0
- package/dist/__tests__/slack-fallback-removal.test.js +16 -0
- package/dist/__tests__/slack-fallback-removal.test.js.map +1 -0
- package/dist/__tests__/ssrf-guard.test.js +12 -0
- package/dist/__tests__/ssrf-guard.test.js.map +1 -1
- package/dist/__tests__/team-ops-task-locking.test.d.ts +2 -0
- package/dist/__tests__/team-ops-task-locking.test.d.ts.map +1 -0
- package/dist/__tests__/team-ops-task-locking.test.js +66 -0
- package/dist/__tests__/team-ops-task-locking.test.js.map +1 -0
- package/dist/__tests__/team-server-validation.test.js +6 -5
- package/dist/__tests__/team-server-validation.test.js.map +1 -1
- package/dist/__tests__/team-status-failed-count.test.d.ts +2 -0
- package/dist/__tests__/team-status-failed-count.test.d.ts.map +1 -0
- package/dist/__tests__/team-status-failed-count.test.js +91 -0
- package/dist/__tests__/team-status-failed-count.test.js.map +1 -0
- package/dist/__tests__/team-status-tmux-provider.test.d.ts +2 -0
- package/dist/__tests__/team-status-tmux-provider.test.d.ts.map +1 -0
- package/dist/__tests__/team-status-tmux-provider.test.js +39 -0
- package/dist/__tests__/team-status-tmux-provider.test.js.map +1 -0
- package/dist/__tests__/tier0-docs-consistency.test.js +42 -0
- package/dist/__tests__/tier0-docs-consistency.test.js.map +1 -1
- package/dist/__tests__/tools/ast-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/ast-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/ast-tools.test.js +74 -0
- package/dist/__tests__/tools/ast-tools.test.js.map +1 -0
- package/dist/__tests__/visual-verdict-skill.test.d.ts +2 -0
- package/dist/__tests__/visual-verdict-skill.test.d.ts.map +1 -0
- package/dist/__tests__/visual-verdict-skill.test.js +26 -0
- package/dist/__tests__/visual-verdict-skill.test.js.map +1 -0
- package/dist/__tests__/webhook-timeout-cleanup.test.d.ts +2 -0
- package/dist/__tests__/webhook-timeout-cleanup.test.d.ts.map +1 -0
- package/dist/__tests__/webhook-timeout-cleanup.test.js +18 -0
- package/dist/__tests__/webhook-timeout-cleanup.test.js.map +1 -0
- package/dist/__tests__/worktree-metadata-locking.test.d.ts +2 -0
- package/dist/__tests__/worktree-metadata-locking.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-metadata-locking.test.js +51 -0
- package/dist/__tests__/worktree-metadata-locking.test.js.map +1 -0
- package/dist/agents/definitions.d.ts +2 -1
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +6 -1
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/tracer.d.ts +11 -0
- package/dist/agents/tracer.d.ts.map +1 -0
- package/dist/agents/tracer.js +40 -0
- package/dist/agents/tracer.js.map +1 -0
- package/dist/agents/utils.d.ts.map +1 -1
- package/dist/agents/utils.js +2 -0
- package/dist/agents/utils.js.map +1 -1
- package/dist/autoresearch/__tests__/contracts.test.d.ts +2 -0
- package/dist/autoresearch/__tests__/contracts.test.d.ts.map +1 -0
- package/dist/autoresearch/__tests__/contracts.test.js +90 -0
- package/dist/autoresearch/__tests__/contracts.test.js.map +1 -0
- package/dist/autoresearch/__tests__/runtime-parity-extra.test.d.ts +2 -0
- package/dist/autoresearch/__tests__/runtime-parity-extra.test.d.ts.map +1 -0
- package/dist/autoresearch/__tests__/runtime-parity-extra.test.js +352 -0
- package/dist/autoresearch/__tests__/runtime-parity-extra.test.js.map +1 -0
- package/dist/autoresearch/__tests__/runtime.test.d.ts +2 -0
- package/dist/autoresearch/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/autoresearch/__tests__/runtime.test.js +210 -0
- package/dist/autoresearch/__tests__/runtime.test.js.map +1 -0
- package/dist/autoresearch/__tests__/setup-contract.test.d.ts +2 -0
- package/dist/autoresearch/__tests__/setup-contract.test.d.ts.map +1 -0
- package/dist/autoresearch/__tests__/setup-contract.test.js +57 -0
- package/dist/autoresearch/__tests__/setup-contract.test.js.map +1 -0
- package/dist/autoresearch/contracts.d.ts +31 -0
- package/dist/autoresearch/contracts.d.ts.map +1 -0
- package/dist/autoresearch/contracts.js +189 -0
- package/dist/autoresearch/contracts.js.map +1 -0
- package/dist/autoresearch/runtime.d.ts +137 -0
- package/dist/autoresearch/runtime.d.ts.map +1 -0
- package/dist/autoresearch/runtime.js +1103 -0
- package/dist/autoresearch/runtime.js.map +1 -0
- package/dist/autoresearch/setup-contract.d.ts +18 -0
- package/dist/autoresearch/setup-contract.d.ts.map +1 -0
- package/dist/autoresearch/setup-contract.js +96 -0
- package/dist/autoresearch/setup-contract.js.map +1 -0
- package/dist/cli/__tests__/ask.test.js +32 -130
- package/dist/cli/__tests__/ask.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch-guided.test.d.ts +2 -0
- package/dist/cli/__tests__/autoresearch-guided.test.d.ts.map +1 -0
- package/dist/cli/__tests__/autoresearch-guided.test.js +389 -0
- package/dist/cli/__tests__/autoresearch-guided.test.js.map +1 -0
- package/dist/cli/__tests__/autoresearch-intake.test.d.ts +2 -0
- package/dist/cli/__tests__/autoresearch-intake.test.d.ts.map +1 -0
- package/dist/cli/__tests__/autoresearch-intake.test.js +131 -0
- package/dist/cli/__tests__/autoresearch-intake.test.js.map +1 -0
- package/dist/cli/__tests__/autoresearch-setup-session.test.d.ts +2 -0
- package/dist/cli/__tests__/autoresearch-setup-session.test.d.ts.map +1 -0
- package/dist/cli/__tests__/autoresearch-setup-session.test.js +73 -0
- package/dist/cli/__tests__/autoresearch-setup-session.test.js.map +1 -0
- package/dist/cli/__tests__/autoresearch.test.d.ts +2 -0
- package/dist/cli/__tests__/autoresearch.test.d.ts.map +1 -0
- package/dist/cli/__tests__/autoresearch.test.js +148 -0
- package/dist/cli/__tests__/autoresearch.test.js.map +1 -0
- package/dist/cli/__tests__/hud-watch.test.d.ts +2 -0
- package/dist/cli/__tests__/hud-watch.test.d.ts.map +1 -0
- package/dist/cli/__tests__/hud-watch.test.js +56 -0
- package/dist/cli/__tests__/hud-watch.test.js.map +1 -0
- package/dist/cli/__tests__/launch.test.js +82 -5
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/team.test.js +44 -2
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/tmux-utils.test.js +41 -1
- package/dist/cli/__tests__/tmux-utils.test.js.map +1 -1
- package/dist/cli/autoresearch-guided.d.ts +37 -0
- package/dist/cli/autoresearch-guided.d.ts.map +1 -0
- package/dist/cli/autoresearch-guided.js +312 -0
- package/dist/cli/autoresearch-guided.js.map +1 -0
- package/dist/cli/autoresearch-intake.d.ts +60 -0
- package/dist/cli/autoresearch-intake.d.ts.map +1 -0
- package/dist/cli/autoresearch-intake.js +325 -0
- package/dist/cli/autoresearch-intake.js.map +1 -0
- package/dist/cli/autoresearch-setup-session.d.ts +15 -0
- package/dist/cli/autoresearch-setup-session.d.ts.map +1 -0
- package/dist/cli/autoresearch-setup-session.js +133 -0
- package/dist/cli/autoresearch-setup-session.js.map +1 -0
- package/dist/cli/autoresearch.d.ts +19 -0
- package/dist/cli/autoresearch.d.ts.map +1 -0
- package/dist/cli/autoresearch.js +330 -0
- package/dist/cli/autoresearch.js.map +1 -0
- package/dist/cli/commands/__tests__/team.test.js +88 -1
- package/dist/cli/commands/__tests__/team.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts +2 -0
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +44 -1
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/ralphthon.d.ts +30 -0
- package/dist/cli/commands/ralphthon.d.ts.map +1 -0
- package/dist/cli/commands/ralphthon.js +361 -0
- package/dist/cli/commands/ralphthon.js.map +1 -0
- package/dist/cli/commands/team.d.ts +39 -0
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +178 -19
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/commands/teleport.js +5 -5
- package/dist/cli/commands/teleport.js.map +1 -1
- package/dist/cli/hud-watch.d.ts +15 -0
- package/dist/cli/hud-watch.d.ts.map +1 -0
- package/dist/cli/hud-watch.js +37 -0
- package/dist/cli/hud-watch.js.map +1 -0
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +39 -180
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch.d.ts +9 -1
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +25 -4
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/team.d.ts +1 -0
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +42 -54
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/tmux-utils.d.ts +3 -2
- package/dist/cli/tmux-utils.d.ts.map +1 -1
- package/dist/cli/tmux-utils.js +16 -3
- package/dist/cli/tmux-utils.js.map +1 -1
- package/dist/config/__tests__/loader.test.js +121 -67
- package/dist/config/__tests__/loader.test.js.map +1 -1
- package/dist/config/__tests__/models.test.js +114 -1
- package/dist/config/__tests__/models.test.js.map +1 -1
- package/dist/config/__tests__/plan-output.test.d.ts +2 -0
- package/dist/config/__tests__/plan-output.test.d.ts.map +1 -0
- package/dist/config/__tests__/plan-output.test.js +41 -0
- package/dist/config/__tests__/plan-output.test.js.map +1 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +280 -215
- package/dist/config/loader.js.map +1 -1
- package/dist/config/models.d.ts +33 -0
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +57 -0
- package/dist/config/models.js.map +1 -1
- package/dist/config/plan-output.d.ts +12 -0
- package/dist/config/plan-output.d.ts.map +1 -0
- package/dist/config/plan-output.js +67 -0
- package/dist/config/plan-output.js.map +1 -0
- package/dist/constants/names.d.ts +1 -5
- package/dist/constants/names.d.ts.map +1 -1
- package/dist/constants/names.js +1 -6
- package/dist/constants/names.js.map +1 -1
- package/dist/features/auto-update.d.ts +8 -0
- package/dist/features/auto-update.d.ts.map +1 -1
- package/dist/features/auto-update.js +218 -24
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/boulder-state/storage.d.ts.map +1 -1
- package/dist/features/boulder-state/storage.js +15 -10
- package/dist/features/boulder-state/storage.js.map +1 -1
- package/dist/features/builtin-skills/runtime-guidance.d.ts +9 -0
- package/dist/features/builtin-skills/runtime-guidance.d.ts.map +1 -0
- package/dist/features/builtin-skills/runtime-guidance.js +35 -0
- package/dist/features/builtin-skills/runtime-guidance.js.map +1 -0
- package/dist/features/builtin-skills/skills.d.ts.map +1 -1
- package/dist/features/builtin-skills/skills.js +32 -7
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/continuation-enforcement.d.ts.map +1 -1
- package/dist/features/continuation-enforcement.js +3 -2
- package/dist/features/continuation-enforcement.js.map +1 -1
- package/dist/features/delegation-categories/__tests__/index.test.d.ts.map +1 -0
- package/dist/features/delegation-categories/__tests__/index.test.js +19 -0
- package/dist/features/delegation-categories/__tests__/index.test.js.map +1 -0
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +62 -3
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/features/magic-keywords.d.ts +1 -1
- package/dist/features/magic-keywords.d.ts.map +1 -1
- package/dist/features/magic-keywords.js +42 -12
- package/dist/features/magic-keywords.js.map +1 -1
- package/dist/features/model-routing/__tests__/index.test.d.ts +2 -0
- package/dist/features/model-routing/__tests__/index.test.d.ts.map +1 -0
- package/dist/features/model-routing/__tests__/index.test.js +21 -0
- package/dist/features/model-routing/__tests__/index.test.js.map +1 -0
- package/dist/features/model-routing/index.d.ts.map +1 -1
- package/dist/features/model-routing/index.js +3 -2
- package/dist/features/model-routing/index.js.map +1 -1
- package/dist/features/model-routing/signals.js +1 -1
- package/dist/features/model-routing/signals.js.map +1 -1
- package/dist/features/model-routing/types.d.ts +1 -1
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +11 -22
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.js +6 -6
- package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
- package/dist/features/rate-limit-wait/types.d.ts +3 -3
- package/dist/features/rate-limit-wait/types.d.ts.map +1 -1
- package/dist/features/state-manager/index.d.ts +2 -2
- package/dist/features/state-manager/index.d.ts.map +1 -1
- package/dist/features/state-manager/index.js +12 -8
- package/dist/features/state-manager/index.js.map +1 -1
- package/dist/features/state-manager/types.d.ts +2 -2
- package/dist/features/state-manager/types.d.ts.map +1 -1
- package/dist/features/state-manager/types.js +2 -2
- package/dist/features/state-manager/types.js.map +1 -1
- package/dist/features/task-decomposer/index.js +3 -1
- package/dist/features/task-decomposer/index.js.map +1 -1
- package/dist/features/verification/index.d.ts.map +1 -1
- package/dist/features/verification/index.js +4 -2
- package/dist/features/verification/index.js.map +1 -1
- package/dist/hooks/__tests__/background-process-guard.test.js +151 -3
- package/dist/hooks/__tests__/background-process-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge-openclaw.test.js +15 -0
- package/dist/hooks/__tests__/bridge-openclaw.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge-routing.test.js +130 -0
- package/dist/hooks/__tests__/bridge-routing.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.js +1 -1
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge.test.js +101 -0
- package/dist/hooks/__tests__/bridge.test.js.map +1 -1
- package/dist/hooks/__tests__/team-worker-heartbeat.test.d.ts +10 -0
- package/dist/hooks/__tests__/team-worker-heartbeat.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/team-worker-heartbeat.test.js +87 -0
- package/dist/hooks/__tests__/team-worker-heartbeat.test.js.map +1 -0
- package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/executor.js +134 -70
- package/dist/hooks/auto-slash-command/executor.js.map +1 -1
- package/dist/hooks/auto-slash-command/live-data.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/live-data.js +12 -0
- package/dist/hooks/auto-slash-command/live-data.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/prompts.test.js +61 -52
- package/dist/hooks/autopilot/__tests__/prompts.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/state.test.js +34 -34
- package/dist/hooks/autopilot/adapters/execution-adapter.d.ts +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.d.ts.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.js +6 -5
- package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.d.ts +1 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.d.ts.map +1 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js +8 -7
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js.map +1 -1
- package/dist/hooks/autopilot/enforcement.d.ts +2 -2
- package/dist/hooks/autopilot/enforcement.d.ts.map +1 -1
- package/dist/hooks/autopilot/enforcement.js +98 -70
- package/dist/hooks/autopilot/enforcement.js.map +1 -1
- package/dist/hooks/autopilot/pipeline-types.d.ts +8 -6
- package/dist/hooks/autopilot/pipeline-types.d.ts.map +1 -1
- package/dist/hooks/autopilot/pipeline-types.js +9 -9
- package/dist/hooks/autopilot/pipeline-types.js.map +1 -1
- package/dist/hooks/autopilot/pipeline.d.ts +3 -3
- package/dist/hooks/autopilot/pipeline.d.ts.map +1 -1
- package/dist/hooks/autopilot/pipeline.js +51 -36
- package/dist/hooks/autopilot/pipeline.js.map +1 -1
- package/dist/hooks/autopilot/prompts.d.ts +4 -2
- package/dist/hooks/autopilot/prompts.d.ts.map +1 -1
- package/dist/hooks/autopilot/prompts.js +31 -24
- package/dist/hooks/autopilot/prompts.js.map +1 -1
- package/dist/hooks/autopilot/state.d.ts.map +1 -1
- package/dist/hooks/autopilot/state.js +21 -14
- package/dist/hooks/autopilot/state.js.map +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +329 -71
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/code-simplifier/index.d.ts +3 -2
- package/dist/hooks/code-simplifier/index.d.ts.map +1 -1
- package/dist/hooks/code-simplifier/index.js +15 -12
- package/dist/hooks/code-simplifier/index.js.map +1 -1
- package/dist/hooks/comment-checker/index.d.ts.map +1 -1
- package/dist/hooks/comment-checker/index.js +0 -17
- package/dist/hooks/comment-checker/index.js.map +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js +304 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +46 -16
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/learner/bridge.d.ts +1 -0
- package/dist/hooks/learner/bridge.d.ts.map +1 -1
- package/dist/hooks/learner/bridge.js +30 -19
- package/dist/hooks/learner/bridge.js.map +1 -1
- package/dist/hooks/learner/constants.d.ts +2 -0
- package/dist/hooks/learner/constants.d.ts.map +1 -1
- package/dist/hooks/learner/constants.js +2 -0
- package/dist/hooks/learner/constants.js.map +1 -1
- package/dist/hooks/learner/finder.d.ts.map +1 -1
- package/dist/hooks/learner/finder.js +25 -20
- package/dist/hooks/learner/finder.js.map +1 -1
- package/dist/hooks/learner/transliteration-map.d.ts +30 -0
- package/dist/hooks/learner/transliteration-map.d.ts.map +1 -0
- package/dist/hooks/learner/transliteration-map.js +51 -0
- package/dist/hooks/learner/transliteration-map.js.map +1 -0
- package/dist/hooks/non-interactive-env/index.d.ts.map +1 -1
- package/dist/hooks/non-interactive-env/index.js +5 -5
- package/dist/hooks/non-interactive-env/index.js.map +1 -1
- package/dist/hooks/non-interactive-env/index.test.d.ts +2 -0
- package/dist/hooks/non-interactive-env/index.test.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/index.test.js +30 -0
- package/dist/hooks/non-interactive-env/index.test.js.map +1 -0
- package/dist/hooks/notepad/index.d.ts.map +1 -1
- package/dist/hooks/notepad/index.js +20 -6
- package/dist/hooks/notepad/index.js.map +1 -1
- package/dist/hooks/omc-orchestrator/index.d.ts.map +1 -1
- package/dist/hooks/omc-orchestrator/index.js +6 -2
- package/dist/hooks/omc-orchestrator/index.js.map +1 -1
- package/dist/hooks/permission-handler/__tests__/index.test.js +9 -1
- package/dist/hooks/permission-handler/__tests__/index.test.js.map +1 -1
- package/dist/hooks/permission-handler/index.d.ts +2 -0
- package/dist/hooks/permission-handler/index.d.ts.map +1 -1
- package/dist/hooks/permission-handler/index.js +67 -7
- package/dist/hooks/permission-handler/index.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/idle-cooldown.test.js +79 -15
- package/dist/hooks/persistent-mode/__tests__/idle-cooldown.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js +1 -1
- package/dist/hooks/persistent-mode/__tests__/ralph-verification-flow.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.js +36 -1
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/team-ralplan-stop.test.js +113 -2
- package/dist/hooks/persistent-mode/__tests__/team-ralplan-stop.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +50 -14
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/session-isolation.test.js +20 -14
- package/dist/hooks/persistent-mode/session-isolation.test.js.map +1 -1
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js +173 -5
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/formatter.test.js +244 -191
- package/dist/hooks/project-memory/__tests__/formatter.test.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/integration.test.js +185 -101
- package/dist/hooks/project-memory/__tests__/integration.test.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/pre-compact.test.d.ts +5 -0
- package/dist/hooks/project-memory/__tests__/pre-compact.test.d.ts.map +1 -0
- package/dist/hooks/project-memory/__tests__/pre-compact.test.js +121 -0
- package/dist/hooks/project-memory/__tests__/pre-compact.test.js.map +1 -0
- package/dist/hooks/project-memory/formatter.d.ts +2 -2
- package/dist/hooks/project-memory/formatter.d.ts.map +1 -1
- package/dist/hooks/project-memory/formatter.js +167 -92
- package/dist/hooks/project-memory/formatter.js.map +1 -1
- package/dist/hooks/project-memory/hot-path-tracker.d.ts +3 -3
- package/dist/hooks/project-memory/hot-path-tracker.d.ts.map +1 -1
- package/dist/hooks/project-memory/hot-path-tracker.js +71 -27
- package/dist/hooks/project-memory/hot-path-tracker.js.map +1 -1
- package/dist/hooks/project-memory/index.d.ts +0 -20
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +37 -39
- package/dist/hooks/project-memory/index.js.map +1 -1
- package/dist/hooks/project-memory/pre-compact.d.ts.map +1 -1
- package/dist/hooks/project-memory/pre-compact.js +2 -1
- package/dist/hooks/project-memory/pre-compact.js.map +1 -1
- package/dist/hooks/project-memory/types.d.ts +11 -6
- package/dist/hooks/project-memory/types.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.js +2 -1
- package/dist/hooks/ralph/verifier.js.map +1 -1
- package/dist/hooks/recovery/session-recovery.d.ts.map +1 -1
- package/dist/hooks/recovery/session-recovery.js +7 -4
- package/dist/hooks/recovery/session-recovery.js.map +1 -1
- package/dist/hooks/session-end/__tests__/mode-state-cleanup.test.js +28 -0
- package/dist/hooks/session-end/__tests__/mode-state-cleanup.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.js +91 -0
- package/dist/hooks/session-end/__tests__/session-end-timeout.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/team-cleanup.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/team-cleanup.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/team-cleanup.test.js +150 -0
- package/dist/hooks/session-end/__tests__/team-cleanup.test.js.map +1 -0
- package/dist/hooks/session-end/index.d.ts +9 -0
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +178 -30
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/setup/__tests__/windows-patch.test.js +8 -7
- package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
- package/dist/hooks/setup/index.d.ts +1 -1
- package/dist/hooks/setup/index.js +3 -3
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/skill-bridge.cjs +48 -16
- package/dist/hooks/skill-state/__tests__/skill-state.test.js +74 -8
- package/dist/hooks/skill-state/__tests__/skill-state.test.js.map +1 -1
- package/dist/hooks/skill-state/index.d.ts +18 -4
- package/dist/hooks/skill-state/index.d.ts.map +1 -1
- package/dist/hooks/skill-state/index.js +43 -7
- package/dist/hooks/skill-state/index.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/index.test.js +42 -1
- package/dist/hooks/subagent-tracker/__tests__/index.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/index.d.ts +5 -0
- package/dist/hooks/subagent-tracker/index.d.ts.map +1 -1
- package/dist/hooks/subagent-tracker/index.js +62 -49
- package/dist/hooks/subagent-tracker/index.js.map +1 -1
- package/dist/hooks/team-dispatch-hook.d.ts.map +1 -1
- package/dist/hooks/team-dispatch-hook.js +4 -2
- package/dist/hooks/team-dispatch-hook.js.map +1 -1
- package/dist/hooks/team-leader-nudge-hook.d.ts +6 -0
- package/dist/hooks/team-leader-nudge-hook.d.ts.map +1 -1
- package/dist/hooks/team-leader-nudge-hook.js +113 -15
- package/dist/hooks/team-leader-nudge-hook.js.map +1 -1
- package/dist/hooks/team-worker-hook.d.ts.map +1 -1
- package/dist/hooks/team-worker-hook.js +6 -3
- package/dist/hooks/team-worker-hook.js.map +1 -1
- package/dist/hud/background-cleanup.d.ts +3 -3
- package/dist/hud/background-cleanup.d.ts.map +1 -1
- package/dist/hud/background-cleanup.js +9 -9
- package/dist/hud/background-cleanup.js.map +1 -1
- package/dist/hud/background-tasks.d.ts +7 -0
- package/dist/hud/background-tasks.d.ts.map +1 -1
- package/dist/hud/background-tasks.js +83 -0
- package/dist/hud/background-tasks.js.map +1 -1
- package/dist/hud/elements/context.d.ts +12 -2
- package/dist/hud/elements/context.d.ts.map +1 -1
- package/dist/hud/elements/context.js +86 -35
- package/dist/hud/elements/context.js.map +1 -1
- package/dist/hud/elements/git.d.ts +4 -0
- package/dist/hud/elements/git.d.ts.map +1 -1
- package/dist/hud/elements/git.js +39 -9
- package/dist/hud/elements/git.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/session-summary.d.ts +23 -0
- package/dist/hud/elements/session-summary.d.ts.map +1 -0
- package/dist/hud/elements/session-summary.js +23 -0
- package/dist/hud/elements/session-summary.js.map +1 -0
- package/dist/hud/elements/token-usage.d.ts +8 -0
- package/dist/hud/elements/token-usage.d.ts.map +1 -0
- package/dist/hud/elements/token-usage.js +24 -0
- package/dist/hud/elements/token-usage.js.map +1 -0
- package/dist/hud/index.d.ts +4 -0
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +165 -32
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/mission-board.d.ts.map +1 -1
- package/dist/hud/mission-board.js +8 -2
- package/dist/hud/mission-board.js.map +1 -1
- package/dist/hud/omc-state.d.ts +5 -5
- package/dist/hud/omc-state.d.ts.map +1 -1
- package/dist/hud/omc-state.js +20 -16
- package/dist/hud/omc-state.js.map +1 -1
- package/dist/hud/render.d.ts +1 -1
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +69 -54
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.d.ts +3 -3
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +110 -57
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/stdin.d.ts +8 -1
- package/dist/hud/stdin.d.ts.map +1 -1
- package/dist/hud/stdin.js +60 -13
- package/dist/hud/stdin.js.map +1 -1
- package/dist/hud/transcript.d.ts.map +1 -1
- package/dist/hud/transcript.js +148 -35
- package/dist/hud/transcript.js.map +1 -1
- package/dist/hud/types.d.ts +30 -13
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +24 -0
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +57 -24
- 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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/__tests__/claude-md-merge.test.js +23 -0
- package/dist/installer/__tests__/claude-md-merge.test.js.map +1 -1
- package/dist/installer/__tests__/hook-templates.test.js +50 -5
- package/dist/installer/__tests__/hook-templates.test.js.map +1 -1
- package/dist/installer/__tests__/mcp-registry.test.d.ts +2 -0
- package/dist/installer/__tests__/mcp-registry.test.d.ts.map +1 -0
- package/dist/installer/__tests__/mcp-registry.test.js +316 -0
- package/dist/installer/__tests__/mcp-registry.test.js.map +1 -0
- package/dist/installer/__tests__/session-start-template.test.d.ts +2 -0
- package/dist/installer/__tests__/session-start-template.test.d.ts.map +1 -0
- package/dist/installer/__tests__/session-start-template.test.js +95 -0
- package/dist/installer/__tests__/session-start-template.test.js.map +1 -0
- package/dist/installer/hooks.d.ts +0 -14
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +0 -33
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts +2 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +71 -7
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/mcp-registry.d.ts +48 -0
- package/dist/installer/mcp-registry.d.ts.map +1 -0
- package/dist/installer/mcp-registry.js +453 -0
- package/dist/installer/mcp-registry.js.map +1 -0
- package/dist/interop/omx-team-state.d.ts +2 -0
- package/dist/interop/omx-team-state.d.ts.map +1 -1
- 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 +21 -18
- package/dist/interop/shared-state.js.map +1 -1
- package/dist/lib/__tests__/mode-state-io.test.js +58 -8
- package/dist/lib/__tests__/mode-state-io.test.js.map +1 -1
- package/dist/lib/__tests__/swallowed-error.test.d.ts +2 -0
- package/dist/lib/__tests__/swallowed-error.test.d.ts.map +1 -0
- package/dist/lib/__tests__/swallowed-error.test.js +19 -0
- package/dist/lib/__tests__/swallowed-error.test.js.map +1 -0
- package/dist/lib/featured-contributors.d.ts +54 -0
- package/dist/lib/featured-contributors.d.ts.map +1 -0
- package/dist/lib/featured-contributors.js +290 -0
- package/dist/lib/featured-contributors.js.map +1 -0
- package/dist/lib/file-lock.d.ts.map +1 -1
- package/dist/lib/file-lock.js +49 -51
- package/dist/lib/file-lock.js.map +1 -1
- package/dist/lib/mode-names.d.ts +1 -0
- package/dist/lib/mode-names.d.ts.map +1 -1
- package/dist/lib/mode-names.js +5 -0
- package/dist/lib/mode-names.js.map +1 -1
- package/dist/lib/mode-state-io.d.ts +2 -0
- package/dist/lib/mode-state-io.d.ts.map +1 -1
- package/dist/lib/mode-state-io.js +57 -11
- package/dist/lib/mode-state-io.js.map +1 -1
- package/dist/lib/project-memory-merge.d.ts.map +1 -1
- package/dist/lib/project-memory-merge.js +2 -0
- package/dist/lib/project-memory-merge.js.map +1 -1
- package/dist/lib/shared-memory.d.ts.map +1 -1
- package/dist/lib/shared-memory.js +40 -21
- package/dist/lib/shared-memory.js.map +1 -1
- package/dist/lib/swallowed-error.d.ts +4 -0
- package/dist/lib/swallowed-error.d.ts.map +1 -0
- package/dist/lib/swallowed-error.js +26 -0
- package/dist/lib/swallowed-error.js.map +1 -0
- package/dist/lib/worktree-paths.d.ts +1 -0
- package/dist/lib/worktree-paths.d.ts.map +1 -1
- package/dist/lib/worktree-paths.js +1 -0
- package/dist/lib/worktree-paths.js.map +1 -1
- package/dist/mcp/__tests__/prompt-injection.test.js +15 -0
- package/dist/mcp/__tests__/prompt-injection.test.js.map +1 -1
- package/dist/mcp/__tests__/standalone-shutdown.test.d.ts +2 -0
- package/dist/mcp/__tests__/standalone-shutdown.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/standalone-shutdown.test.js +57 -0
- package/dist/mcp/__tests__/standalone-shutdown.test.js.map +1 -0
- package/dist/mcp/__tests__/team-cleanup.test.js +5 -5
- package/dist/mcp/job-management.d.ts +4 -0
- package/dist/mcp/job-management.d.ts.map +1 -1
- package/dist/mcp/job-management.js +30 -10
- package/dist/mcp/job-management.js.map +1 -1
- package/dist/mcp/omc-tools-server.d.ts +2 -0
- package/dist/mcp/omc-tools-server.d.ts.map +1 -1
- package/dist/mcp/omc-tools-server.js +10 -2
- package/dist/mcp/omc-tools-server.js.map +1 -1
- package/dist/mcp/prompt-injection.d.ts.map +1 -1
- package/dist/mcp/prompt-injection.js +25 -4
- package/dist/mcp/prompt-injection.js.map +1 -1
- package/dist/mcp/prompt-persistence.js +1 -1
- package/dist/mcp/prompt-persistence.js.map +1 -1
- package/dist/mcp/standalone-server.js +15 -4
- package/dist/mcp/standalone-server.js.map +1 -1
- package/dist/mcp/standalone-shutdown.d.ts +25 -0
- package/dist/mcp/standalone-shutdown.d.ts.map +1 -0
- package/dist/mcp/standalone-shutdown.js +68 -0
- package/dist/mcp/standalone-shutdown.js.map +1 -0
- package/dist/mcp/team-job-convergence.d.ts +0 -1
- package/dist/mcp/team-job-convergence.d.ts.map +1 -1
- package/dist/mcp/team-job-convergence.js +0 -9
- package/dist/mcp/team-job-convergence.js.map +1 -1
- package/dist/mcp/team-server.d.ts.map +1 -1
- package/dist/mcp/team-server.js +18 -11
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/notifications/__tests__/reply-listener.test.js +57 -1
- package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
- package/dist/notifications/config.d.ts.map +1 -1
- package/dist/notifications/config.js +36 -3
- package/dist/notifications/config.js.map +1 -1
- package/dist/notifications/dispatcher.d.ts.map +1 -1
- package/dist/notifications/dispatcher.js +18 -14
- package/dist/notifications/dispatcher.js.map +1 -1
- package/dist/notifications/redact.d.ts.map +1 -1
- package/dist/notifications/redact.js +10 -1
- package/dist/notifications/redact.js.map +1 -1
- package/dist/notifications/reply-listener.d.ts +2 -0
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +17 -24
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/session-registry.d.ts +1 -1
- package/dist/notifications/session-registry.d.ts.map +1 -1
- package/dist/notifications/session-registry.js +37 -43
- package/dist/notifications/session-registry.js.map +1 -1
- package/dist/notifications/types.d.ts +2 -0
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/planning/__tests__/artifacts.test.d.ts +2 -0
- package/dist/planning/__tests__/artifacts.test.d.ts.map +1 -0
- package/dist/planning/__tests__/artifacts.test.js +303 -0
- package/dist/planning/__tests__/artifacts.test.js.map +1 -0
- package/dist/planning/artifacts.d.ts +29 -0
- package/dist/planning/artifacts.d.ts.map +1 -0
- package/dist/planning/artifacts.js +144 -0
- package/dist/planning/artifacts.js.map +1 -0
- package/dist/platform/process-utils.d.ts +1 -0
- package/dist/platform/process-utils.d.ts.map +1 -1
- package/dist/platform/process-utils.js +7 -3
- package/dist/platform/process-utils.js.map +1 -1
- package/dist/providers/bitbucket.d.ts +2 -2
- package/dist/providers/bitbucket.d.ts.map +1 -1
- package/dist/providers/bitbucket.js +11 -12
- package/dist/providers/bitbucket.js.map +1 -1
- package/dist/providers/gitea.d.ts.map +1 -1
- package/dist/providers/gitea.js +8 -2
- package/dist/providers/gitea.js.map +1 -1
- package/dist/providers/index.d.ts +4 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +49 -26
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/types.d.ts +2 -2
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/ralphthon/__tests__/cli.test.d.ts +5 -0
- package/dist/ralphthon/__tests__/cli.test.d.ts.map +1 -0
- package/dist/ralphthon/__tests__/cli.test.js +103 -0
- package/dist/ralphthon/__tests__/cli.test.js.map +1 -0
- package/dist/ralphthon/__tests__/orchestrator.test.d.ts +5 -0
- package/dist/ralphthon/__tests__/orchestrator.test.d.ts.map +1 -0
- package/dist/ralphthon/__tests__/orchestrator.test.js +393 -0
- package/dist/ralphthon/__tests__/orchestrator.test.js.map +1 -0
- package/dist/ralphthon/__tests__/prd.test.d.ts +5 -0
- package/dist/ralphthon/__tests__/prd.test.d.ts.map +1 -0
- package/dist/ralphthon/__tests__/prd.test.js +454 -0
- package/dist/ralphthon/__tests__/prd.test.js.map +1 -0
- package/dist/ralphthon/deep-interview-prompt.d.ts +2 -0
- package/dist/ralphthon/deep-interview-prompt.d.ts.map +1 -0
- package/dist/ralphthon/deep-interview-prompt.js +20 -0
- package/dist/ralphthon/deep-interview-prompt.js.map +1 -0
- package/dist/ralphthon/index.d.ts +13 -0
- package/dist/ralphthon/index.d.ts.map +1 -0
- package/dist/ralphthon/index.js +14 -0
- package/dist/ralphthon/index.js.map +1 -0
- package/dist/ralphthon/orchestrator.d.ts +112 -0
- package/dist/ralphthon/orchestrator.d.ts.map +1 -0
- package/dist/ralphthon/orchestrator.js +453 -0
- package/dist/ralphthon/orchestrator.js.map +1 -0
- package/dist/ralphthon/prd.d.ts +111 -0
- package/dist/ralphthon/prd.d.ts.map +1 -0
- package/dist/ralphthon/prd.js +345 -0
- package/dist/ralphthon/prd.js.map +1 -0
- package/dist/ralphthon/types.d.ts +213 -0
- package/dist/ralphthon/types.d.ts.map +1 -0
- package/dist/ralphthon/types.js +21 -0
- package/dist/ralphthon/types.js.map +1 -0
- package/dist/shared/types.d.ts +25 -16
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/skills/__tests__/mingw-escape.test.js +15 -0
- package/dist/skills/__tests__/mingw-escape.test.js.map +1 -1
- package/dist/team/__tests__/allocation-policy.test.d.ts +2 -0
- package/dist/team/__tests__/allocation-policy.test.d.ts.map +1 -0
- package/dist/team/__tests__/allocation-policy.test.js +125 -0
- package/dist/team/__tests__/allocation-policy.test.js.map +1 -0
- package/dist/team/__tests__/api-interop.cleanup.test.d.ts +2 -0
- package/dist/team/__tests__/api-interop.cleanup.test.d.ts.map +1 -0
- package/dist/team/__tests__/api-interop.cleanup.test.js +129 -0
- package/dist/team/__tests__/api-interop.cleanup.test.js.map +1 -0
- package/dist/team/__tests__/api-interop.cwd-resolution.test.js +22 -0
- package/dist/team/__tests__/api-interop.cwd-resolution.test.js.map +1 -1
- package/dist/team/__tests__/api-interop.dispatch.test.js +59 -0
- package/dist/team/__tests__/api-interop.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/audit-log.test.js +0 -1
- package/dist/team/__tests__/audit-log.test.js.map +1 -1
- package/dist/team/__tests__/bridge-integration.test.js.map +1 -1
- package/dist/team/__tests__/events.swallowed-error.test.d.ts +2 -0
- package/dist/team/__tests__/events.swallowed-error.test.d.ts.map +1 -0
- package/dist/team/__tests__/events.swallowed-error.test.js +33 -0
- package/dist/team/__tests__/events.swallowed-error.test.js.map +1 -0
- package/dist/team/__tests__/followup-planner.test.d.ts +2 -0
- package/dist/team/__tests__/followup-planner.test.d.ts.map +1 -0
- package/dist/team/__tests__/followup-planner.test.js +197 -0
- package/dist/team/__tests__/followup-planner.test.js.map +1 -0
- package/dist/team/__tests__/governance-enforcement.test.d.ts +2 -0
- package/dist/team/__tests__/governance-enforcement.test.d.ts.map +1 -0
- package/dist/team/__tests__/governance-enforcement.test.js +138 -0
- package/dist/team/__tests__/governance-enforcement.test.js.map +1 -0
- package/dist/team/__tests__/governance.test.d.ts +2 -0
- package/dist/team/__tests__/governance.test.d.ts.map +1 -0
- package/dist/team/__tests__/governance.test.js +38 -0
- package/dist/team/__tests__/governance.test.js.map +1 -0
- package/dist/team/__tests__/idle-nudge.test.js +9 -0
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
- package/dist/team/__tests__/leader-nudge-guidance.test.d.ts +2 -0
- package/dist/team/__tests__/leader-nudge-guidance.test.d.ts.map +1 -0
- package/dist/team/__tests__/leader-nudge-guidance.test.js +37 -0
- package/dist/team/__tests__/leader-nudge-guidance.test.js.map +1 -0
- package/dist/team/__tests__/lifecycle-profile.test.d.ts +2 -0
- package/dist/team/__tests__/lifecycle-profile.test.d.ts.map +1 -0
- package/dist/team/__tests__/lifecycle-profile.test.js +46 -0
- package/dist/team/__tests__/lifecycle-profile.test.js.map +1 -0
- package/dist/team/__tests__/model-contract.test.js +84 -3
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/phase1-foundation.test.d.ts +2 -0
- package/dist/team/__tests__/phase1-foundation.test.d.ts.map +1 -0
- package/dist/team/__tests__/phase1-foundation.test.js +151 -0
- package/dist/team/__tests__/phase1-foundation.test.js.map +1 -0
- package/dist/team/__tests__/role-router.test.d.ts +2 -0
- package/dist/team/__tests__/role-router.test.d.ts.map +1 -0
- package/dist/team/__tests__/role-router.test.js +122 -0
- package/dist/team/__tests__/role-router.test.js.map +1 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.js +4 -1
- package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.dispatch.test.js +114 -6
- package/dist/team/__tests__/runtime-v2.dispatch.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.monitor.test.js +45 -0
- package/dist/team/__tests__/runtime-v2.monitor.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js +110 -0
- package/dist/team/__tests__/runtime-v2.shutdown-pane-cleanup.test.js.map +1 -0
- package/dist/team/__tests__/scaling.test.d.ts +2 -0
- package/dist/team/__tests__/scaling.test.d.ts.map +1 -0
- package/dist/team/__tests__/scaling.test.js +44 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -0
- package/dist/team/__tests__/shell-affinity.test.d.ts +2 -0
- package/dist/team/__tests__/shell-affinity.test.d.ts.map +1 -0
- package/dist/team/__tests__/shell-affinity.test.js +98 -0
- package/dist/team/__tests__/shell-affinity.test.js.map +1 -0
- package/dist/team/__tests__/state-paths.test.js +4 -1
- package/dist/team/__tests__/state-paths.test.js.map +1 -1
- package/dist/team/__tests__/task-file-ops.test.js +6 -4
- package/dist/team/__tests__/task-file-ops.test.js.map +1 -1
- package/dist/team/__tests__/team-leader-nudge-hook.logging.test.d.ts +2 -0
- package/dist/team/__tests__/team-leader-nudge-hook.logging.test.d.ts.map +1 -0
- package/dist/team/__tests__/team-leader-nudge-hook.logging.test.js +63 -0
- package/dist/team/__tests__/team-leader-nudge-hook.logging.test.js.map +1 -0
- package/dist/team/__tests__/team-leader-nudge-hook.test.d.ts +2 -0
- package/dist/team/__tests__/team-leader-nudge-hook.test.d.ts.map +1 -0
- package/dist/team/__tests__/team-leader-nudge-hook.test.js +90 -0
- package/dist/team/__tests__/team-leader-nudge-hook.test.js.map +1 -0
- package/dist/team/__tests__/tmux-comm.test.js +5 -4
- package/dist/team/__tests__/tmux-comm.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team.test.js +46 -2
- package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js +45 -13
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +50 -58
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/unified-team.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +50 -5
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/__tests__/worker-canonicalization.test.d.ts +2 -0
- package/dist/team/__tests__/worker-canonicalization.test.d.ts.map +1 -0
- package/dist/team/__tests__/worker-canonicalization.test.js +35 -0
- package/dist/team/__tests__/worker-canonicalization.test.js.map +1 -0
- package/dist/team/__tests__/worker-health.test.js.map +1 -1
- package/dist/team/__tests__/worker-restart.test.js +3 -1
- package/dist/team/__tests__/worker-restart.test.js.map +1 -1
- package/dist/team/allocation-policy.d.ts +34 -0
- package/dist/team/allocation-policy.d.ts.map +1 -0
- package/dist/team/allocation-policy.js +92 -0
- package/dist/team/allocation-policy.js.map +1 -0
- package/dist/team/api-interop.d.ts +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +51 -6
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/audit-log.d.ts.map +1 -1
- package/dist/team/audit-log.js +3 -2
- package/dist/team/audit-log.js.map +1 -1
- package/dist/team/events.d.ts.map +1 -1
- package/dist/team/events.js +6 -4
- package/dist/team/events.js.map +1 -1
- package/dist/team/followup-planner.d.ts +32 -0
- package/dist/team/followup-planner.d.ts.map +1 -0
- package/dist/team/followup-planner.js +82 -0
- package/dist/team/followup-planner.js.map +1 -0
- package/dist/team/git-worktree.d.ts.map +1 -1
- package/dist/team/git-worktree.js +20 -10
- package/dist/team/git-worktree.js.map +1 -1
- package/dist/team/governance.d.ts +18 -0
- package/dist/team/governance.d.ts.map +1 -0
- package/dist/team/governance.js +68 -0
- package/dist/team/governance.js.map +1 -0
- package/dist/team/index.d.ts +2 -1
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +1 -0
- package/dist/team/index.js.map +1 -1
- package/dist/team/leader-nudge-guidance.d.ts +23 -0
- package/dist/team/leader-nudge-guidance.d.ts.map +1 -0
- package/dist/team/leader-nudge-guidance.js +44 -0
- package/dist/team/leader-nudge-guidance.js.map +1 -0
- package/dist/team/mcp-comm.d.ts.map +1 -1
- package/dist/team/mcp-comm.js +17 -3
- package/dist/team/mcp-comm.js.map +1 -1
- package/dist/team/mcp-team-bridge.d.ts.map +1 -1
- package/dist/team/mcp-team-bridge.js +11 -48
- package/dist/team/mcp-team-bridge.js.map +1 -1
- package/dist/team/merge-coordinator.d.ts +3 -1
- package/dist/team/merge-coordinator.d.ts.map +1 -1
- package/dist/team/merge-coordinator.js +27 -5
- package/dist/team/merge-coordinator.js.map +1 -1
- package/dist/team/model-contract.d.ts +17 -0
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +49 -2
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/monitor.d.ts.map +1 -1
- package/dist/team/monitor.js +69 -2
- package/dist/team/monitor.js.map +1 -1
- package/dist/team/outbox-reader.d.ts.map +1 -1
- package/dist/team/outbox-reader.js +13 -10
- package/dist/team/outbox-reader.js.map +1 -1
- package/dist/team/phase-controller.js +2 -2
- package/dist/team/phase-controller.js.map +1 -1
- package/dist/team/role-router.d.ts +36 -0
- package/dist/team/role-router.d.ts.map +1 -0
- package/dist/team/role-router.js +215 -0
- package/dist/team/role-router.js.map +1 -0
- package/dist/team/runtime-cli.d.ts.map +1 -1
- package/dist/team/runtime-cli.js +35 -0
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +1 -0
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +164 -49
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +29 -15
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +12 -3
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/tasks.js +1 -1
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/state-paths.js +2 -2
- package/dist/team/state-paths.js.map +1 -1
- package/dist/team/task-file-ops.d.ts.map +1 -1
- package/dist/team/task-file-ops.js +3 -43
- package/dist/team/task-file-ops.js.map +1 -1
- package/dist/team/task-router.d.ts.map +1 -1
- package/dist/team/task-router.js +31 -1
- package/dist/team/task-router.js.map +1 -1
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +93 -49
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/team-registration.d.ts.map +1 -1
- package/dist/team/team-registration.js +18 -14
- package/dist/team/team-registration.js.map +1 -1
- package/dist/team/team-status.d.ts +1 -1
- package/dist/team/team-status.d.ts.map +1 -1
- package/dist/team/team-status.js +8 -5
- package/dist/team/team-status.js.map +1 -1
- package/dist/team/tmux-comm.d.ts.map +1 -1
- package/dist/team/tmux-comm.js +5 -2
- package/dist/team/tmux-comm.js.map +1 -1
- package/dist/team/tmux-session.d.ts +32 -5
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +179 -50
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +16 -3
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +36 -23
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/team/worker-canonicalization.d.ts +8 -0
- package/dist/team/worker-canonicalization.d.ts.map +1 -0
- package/dist/team/worker-canonicalization.js +98 -0
- package/dist/team/worker-canonicalization.js.map +1 -0
- package/dist/tools/__tests__/cancel-integration.test.js +57 -2
- package/dist/tools/__tests__/cancel-integration.test.js.map +1 -1
- package/dist/tools/__tests__/deepinit-manifest.test.d.ts +7 -0
- package/dist/tools/__tests__/deepinit-manifest.test.d.ts.map +1 -0
- package/dist/tools/__tests__/deepinit-manifest.test.js +559 -0
- package/dist/tools/__tests__/deepinit-manifest.test.js.map +1 -0
- package/dist/tools/__tests__/state-tools.test.js +16 -0
- package/dist/tools/__tests__/state-tools.test.js.map +1 -1
- package/dist/tools/ast-tools.d.ts.map +1 -1
- package/dist/tools/ast-tools.js +11 -2
- package/dist/tools/ast-tools.js.map +1 -1
- package/dist/tools/deepinit-manifest.d.ts +88 -0
- package/dist/tools/deepinit-manifest.d.ts.map +1 -0
- package/dist/tools/deepinit-manifest.js +373 -0
- package/dist/tools/deepinit-manifest.js.map +1 -0
- package/dist/tools/diagnostics/tsc-runner.js +2 -2
- package/dist/tools/diagnostics/tsc-runner.js.map +1 -1
- package/dist/tools/lsp/__tests__/client-devcontainer.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/client-devcontainer.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/client-devcontainer.test.js +185 -0
- package/dist/tools/lsp/__tests__/client-devcontainer.test.js.map +1 -0
- package/dist/tools/lsp/__tests__/client-singleton.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/client-singleton.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/client-singleton.test.js +17 -0
- package/dist/tools/lsp/__tests__/client-singleton.test.js.map +1 -0
- package/dist/tools/lsp/__tests__/client-timeout-env.test.js +18 -2
- package/dist/tools/lsp/__tests__/client-timeout-env.test.js.map +1 -1
- package/dist/tools/lsp/__tests__/devcontainer.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/devcontainer.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/devcontainer.test.js +311 -0
- package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -0
- package/dist/tools/lsp/client.d.ts +17 -3
- package/dist/tools/lsp/client.d.ts.map +1 -1
- package/dist/tools/lsp/client.js +228 -77
- package/dist/tools/lsp/client.js.map +1 -1
- package/dist/tools/lsp/devcontainer.d.ts +12 -0
- package/dist/tools/lsp/devcontainer.d.ts.map +1 -0
- package/dist/tools/lsp/devcontainer.js +276 -0
- package/dist/tools/lsp/devcontainer.js.map +1 -0
- package/dist/tools/lsp/index.d.ts +2 -0
- package/dist/tools/lsp/index.d.ts.map +1 -1
- package/dist/tools/lsp/index.js +1 -0
- package/dist/tools/lsp/index.js.map +1 -1
- package/dist/tools/lsp/servers.d.ts +1 -0
- package/dist/tools/lsp/servers.d.ts.map +1 -1
- package/dist/tools/lsp/servers.js +20 -5
- package/dist/tools/lsp/servers.js.map +1 -1
- package/dist/tools/lsp/utils.d.ts.map +1 -1
- package/dist/tools/lsp/utils.js +7 -1
- package/dist/tools/lsp/utils.js.map +1 -1
- package/dist/tools/python-repl/__tests__/bridge-manager-cleanup.test.js +34 -1
- package/dist/tools/python-repl/__tests__/bridge-manager-cleanup.test.js.map +1 -1
- package/dist/tools/python-repl/bridge-manager.d.ts +2 -0
- package/dist/tools/python-repl/bridge-manager.d.ts.map +1 -1
- package/dist/tools/python-repl/bridge-manager.js +38 -2
- package/dist/tools/python-repl/bridge-manager.js.map +1 -1
- package/dist/tools/python-repl/socket-client.d.ts.map +1 -1
- package/dist/tools/python-repl/socket-client.js +37 -7
- package/dist/tools/python-repl/socket-client.js.map +1 -1
- package/dist/tools/python-repl/tool.d.ts.map +1 -1
- package/dist/tools/python-repl/tool.js +1 -5
- package/dist/tools/python-repl/tool.js.map +1 -1
- package/dist/tools/state-tools.d.ts.map +1 -1
- package/dist/tools/state-tools.js +193 -57
- package/dist/tools/state-tools.js.map +1 -1
- package/dist/tools/trace-tools.d.ts.map +1 -1
- package/dist/tools/trace-tools.js +7 -5
- package/dist/tools/trace-tools.js.map +1 -1
- package/dist/tools/types.d.ts +16 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/__tests__/paths.test.js +86 -1
- package/dist/utils/__tests__/paths.test.js.map +1 -1
- package/dist/utils/jsonc.d.ts.map +1 -1
- package/dist/utils/jsonc.js +6 -2
- package/dist/utils/jsonc.js.map +1 -1
- package/dist/utils/omc-cli-rendering.d.ts +8 -0
- package/dist/utils/omc-cli-rendering.d.ts.map +1 -0
- package/dist/utils/omc-cli-rendering.js +37 -0
- package/dist/utils/omc-cli-rendering.js.map +1 -0
- package/dist/utils/paths.d.ts +32 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +103 -8
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/skill-resources.d.ts +7 -0
- package/dist/utils/skill-resources.d.ts.map +1 -0
- package/dist/utils/skill-resources.js +53 -0
- package/dist/utils/skill-resources.js.map +1 -0
- package/dist/utils/ssrf-guard.d.ts.map +1 -1
- package/dist/utils/ssrf-guard.js +22 -0
- package/dist/utils/ssrf-guard.js.map +1 -1
- package/docs/ARCHITECTURE.md +468 -37
- package/docs/CLAUDE.md +1 -1
- package/docs/COMPATIBILITY.md +18 -1
- package/docs/LOCAL_PLUGIN_INSTALL.md +17 -3
- package/docs/MIGRATION.md +8 -46
- package/docs/PERFORMANCE-MONITORING.md +2 -2
- package/docs/REFERENCE.md +99 -58
- package/docs/design/SKILLS_2_0_ADAPTATION.md +115 -0
- package/docs/ko/ARCHITECTURE.md +1 -1
- package/docs/ko/MIGRATION.md +7 -47
- package/docs/ko/REFERENCE.md +1 -15
- package/docs/partials/features.md +1 -32
- package/docs/partials/mode-hierarchy.md +7 -22
- package/docs/partials/verification-tiers.md +1 -1
- package/docs/plans/2026-02-26-skill-optimization-design.md +3 -3
- package/docs/shared/features.md +1 -32
- package/docs/shared/mode-hierarchy.md +7 -22
- package/docs/shared/verification-tiers.md +1 -1
- package/hooks/hooks.json +21 -31
- package/package.json +1 -1
- package/scripts/cleanup-orphans.mjs +12 -9
- package/scripts/context-guard-stop.mjs +13 -5
- package/scripts/context-safety.mjs +12 -149
- package/scripts/eval-autoresearch-json.mjs +49 -0
- package/scripts/eval-autoresearch-timed-json.mjs +62 -0
- package/scripts/generate-featured-contributors.ts +43 -0
- package/scripts/keyword-detector.mjs +136 -36
- package/scripts/persistent-mode.cjs +87 -25
- package/scripts/persistent-mode.mjs +37 -17
- package/scripts/plugin-setup.mjs +19 -16
- package/scripts/post-tool-verifier.mjs +25 -20
- package/scripts/pre-tool-enforcer.mjs +184 -6
- package/scripts/project-memory-session.mjs +5 -1
- package/scripts/release.ts +511 -0
- package/scripts/run-provider-advisor.js +10 -4
- package/scripts/session-end.mjs +3 -2
- package/scripts/session-start.mjs +118 -4
- package/scripts/session-summary.mjs +241 -0
- package/scripts/setup-claude-md.sh +140 -3
- package/scripts/skill-injector.mjs +2 -1
- package/scripts/sync-metadata.ts +41 -7
- package/scripts/sync-version.sh +42 -0
- package/skills/AGENTS.md +108 -74
- package/skills/ai-slop-cleaner/SKILL.md +120 -117
- package/skills/ask/SKILL.md +4 -2
- package/skills/autopilot/SKILL.md +1 -0
- package/skills/cancel/SKILL.md +62 -0
- package/skills/ccg/SKILL.md +7 -13
- package/skills/configure-notifications/SKILL.md +1 -0
- package/skills/deep-dive/SKILL.md +476 -0
- package/skills/deep-interview/SKILL.md +109 -14
- package/skills/deepinit/SKILL.md +1 -0
- package/skills/external-context/SKILL.md +1 -0
- package/skills/hud/SKILL.md +6 -5
- package/skills/learner/SKILL.md +63 -57
- package/skills/mcp-setup/SKILL.md +1 -0
- package/skills/omc-doctor/SKILL.md +6 -5
- package/skills/omc-reference/SKILL.md +141 -0
- package/skills/omc-setup/SKILL.md +11 -2
- package/skills/omc-setup/phases/01-install-claude-md.md +11 -1
- package/skills/omc-setup/phases/02-configure.md +3 -1
- package/skills/omc-teams/SKILL.md +9 -5
- package/skills/plan/SKILL.md +23 -7
- package/skills/project-session-manager/SKILL.md +3 -2
- package/skills/ralph/SKILL.md +17 -1
- package/skills/ralplan/SKILL.md +4 -1
- package/skills/release/SKILL.md +1 -0
- package/skills/sciomc/SKILL.md +1 -0
- package/skills/setup/SKILL.md +9 -8
- package/skills/skill-creator/SKILL.md +311 -0
- package/skills/skill-creator/references/upstream-anthropic-skill-creator.md +485 -0
- package/skills/skill-debugger/README.md +52 -0
- package/skills/skill-debugger/SKILL.md +146 -270
- package/skills/skill-quality-analyzer/HOW_TO_USE.md +92 -185
- package/skills/skill-quality-analyzer/README.md +39 -35
- package/skills/skill-quality-analyzer/SKILL.md +105 -196
- package/skills/skill-tester/README.md +31 -23
- package/skills/skill-tester/SKILL.md +116 -266
- package/skills/team/SKILL.md +1 -0
- package/skills/trace/SKILL.md +262 -0
- package/skills/ultraqa/SKILL.md +1 -0
- package/skills/ultrawork/SKILL.md +1 -0
- package/skills/visual-verdict/SKILL.md +77 -0
- package/skills/writer-memory/SKILL.md +1 -0
- package/templates/hooks/keyword-detector.mjs +89 -25
- package/templates/hooks/persistent-mode.mjs +33 -9
- package/templates/hooks/post-tool-use-failure.mjs +2 -5
- package/templates/hooks/pre-tool-use.mjs +47 -1
- package/templates/hooks/session-start.mjs +105 -14
- package/templates/hooks/stop-continuation.mjs +7 -1
- package/dist/__tests__/codex-backoff.test.d.ts +0 -2
- package/dist/__tests__/codex-backoff.test.d.ts.map +0 -1
- package/dist/__tests__/codex-backoff.test.js +0 -143
- package/dist/__tests__/codex-backoff.test.js.map +0 -1
- package/dist/__tests__/codex-callsite-normalization.test.js +0 -112
- package/dist/__tests__/compatibility-security.test.d.ts +0 -13
- package/dist/__tests__/compatibility-security.test.d.ts.map +0 -1
- package/dist/__tests__/compatibility-security.test.js +0 -403
- package/dist/__tests__/compatibility-security.test.js.map +0 -1
- package/dist/__tests__/compatibility.test.d.ts +0 -7
- package/dist/__tests__/compatibility.test.d.ts.map +0 -1
- package/dist/__tests__/compatibility.test.js +0 -484
- package/dist/__tests__/compatibility.test.js.map +0 -1
- package/dist/__tests__/example.test.d.ts +0 -2
- package/dist/__tests__/example.test.d.ts.map +0 -1
- package/dist/__tests__/example.test.js +0 -20
- package/dist/__tests__/example.test.js.map +0 -1
- package/dist/__tests__/hud/analytics-display.test.d.ts +0 -2
- package/dist/__tests__/hud/analytics-display.test.d.ts.map +0 -1
- package/dist/__tests__/hud/analytics-display.test.js +0 -236
- package/dist/__tests__/hud/analytics-display.test.js.map +0 -1
- package/dist/__tests__/hud/top-agents.test.d.ts +0 -8
- package/dist/__tests__/hud/top-agents.test.d.ts.map +0 -1
- package/dist/__tests__/hud/top-agents.test.js +0 -158
- package/dist/__tests__/hud/top-agents.test.js.map +0 -1
- package/dist/__tests__/inline-prompt-integration.test.d.ts +0 -2
- package/dist/__tests__/inline-prompt-integration.test.d.ts.map +0 -1
- package/dist/__tests__/inline-prompt-integration.test.js +0 -411
- package/dist/__tests__/inline-prompt-integration.test.js.map +0 -1
- package/dist/__tests__/inline-success-shape.test.d.ts +0 -2
- package/dist/__tests__/inline-success-shape.test.d.ts.map +0 -1
- package/dist/__tests__/inline-success-shape.test.js +0 -130
- package/dist/__tests__/inline-success-shape.test.js.map +0 -1
- package/dist/__tests__/mcp-fallback-429.test.d.ts +0 -2
- package/dist/__tests__/mcp-fallback-429.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-fallback-429.test.js +0 -193
- package/dist/__tests__/mcp-fallback-429.test.js.map +0 -1
- package/dist/__tests__/mcp-server-workflows.test.d.ts +0 -2
- package/dist/__tests__/mcp-server-workflows.test.d.ts.map +0 -1
- package/dist/__tests__/mcp-server-workflows.test.js +0 -301
- package/dist/__tests__/mcp-server-workflows.test.js.map +0 -1
- package/dist/__tests__/multi-model-mcp-integration.test.d.ts +0 -2
- package/dist/__tests__/multi-model-mcp-integration.test.d.ts.map +0 -1
- package/dist/__tests__/multi-model-mcp-integration.test.js +0 -69
- package/dist/__tests__/multi-model-mcp-integration.test.js.map +0 -1
- package/dist/__tests__/multi-model-mcp.test.d.ts +0 -2
- package/dist/__tests__/multi-model-mcp.test.d.ts.map +0 -1
- package/dist/__tests__/multi-model-mcp.test.js +0 -145
- package/dist/__tests__/multi-model-mcp.test.js.map +0 -1
- package/dist/__tests__/omc-shorthand.test.d.ts +0 -2
- package/dist/__tests__/omc-shorthand.test.d.ts.map +0 -1
- package/dist/__tests__/omc-shorthand.test.js +0 -73
- package/dist/__tests__/omc-shorthand.test.js.map +0 -1
- package/dist/__tests__/prompt-file-only.test.d.ts +0 -2
- package/dist/__tests__/prompt-file-only.test.d.ts.map +0 -1
- package/dist/__tests__/prompt-file-only.test.js +0 -263
- package/dist/__tests__/prompt-file-only.test.js.map +0 -1
- package/dist/__tests__/session-catalog.test.d.ts +0 -2
- package/dist/__tests__/session-catalog.test.d.ts.map +0 -1
- package/dist/__tests__/session-catalog.test.js +0 -195
- package/dist/__tests__/session-catalog.test.js.map +0 -1
- package/dist/__tests__/session-migration.test.d.ts +0 -2
- package/dist/__tests__/session-migration.test.d.ts.map +0 -1
- package/dist/__tests__/session-migration.test.js +0 -155
- package/dist/__tests__/session-migration.test.js.map +0 -1
- package/dist/__tests__/shell-path.test.d.ts +0 -5
- package/dist/__tests__/shell-path.test.d.ts.map +0 -1
- package/dist/__tests__/shell-path.test.js +0 -70
- package/dist/__tests__/shell-path.test.js.map +0 -1
- package/dist/__tests__/smoke-functional.test.d.ts +0 -8
- package/dist/__tests__/smoke-functional.test.d.ts.map +0 -1
- package/dist/__tests__/smoke-functional.test.js +0 -450
- package/dist/__tests__/smoke-functional.test.js.map +0 -1
- package/dist/__tests__/smoke-team-worker.test.d.ts +0 -15
- package/dist/__tests__/smoke-team-worker.test.d.ts.map +0 -1
- package/dist/__tests__/smoke-team-worker.test.js +0 -483
- package/dist/__tests__/smoke-team-worker.test.js.map +0 -1
- package/dist/__tests__/validate-and-read-file.test.d.ts +0 -2
- package/dist/__tests__/validate-and-read-file.test.d.ts.map +0 -1
- package/dist/__tests__/validate-and-read-file.test.js +0 -84
- package/dist/__tests__/validate-and-read-file.test.js.map +0 -1
- package/dist/__tests__/worker-adapter.test.d.ts +0 -5
- package/dist/__tests__/worker-adapter.test.d.ts.map +0 -1
- package/dist/__tests__/worker-adapter.test.js +0 -211
- package/dist/__tests__/worker-adapter.test.js.map +0 -1
- package/dist/agents/coordinator-deprecated.d.ts +0 -18
- package/dist/agents/coordinator-deprecated.d.ts.map +0 -1
- package/dist/agents/coordinator-deprecated.js +0 -38
- package/dist/agents/coordinator-deprecated.js.map +0 -1
- package/dist/agents/deep-executor.d.ts +0 -15
- package/dist/agents/deep-executor.d.ts.map +0 -1
- package/dist/agents/deep-executor.js +0 -45
- package/dist/agents/deep-executor.js.map +0 -1
- package/dist/agents/delegation-validator.d.ts +0 -31
- package/dist/agents/delegation-validator.d.ts.map +0 -1
- package/dist/agents/delegation-validator.js +0 -75
- package/dist/agents/delegation-validator.js.map +0 -1
- package/dist/agents/harsh-critic.d.ts +0 -14
- package/dist/agents/harsh-critic.d.ts.map +0 -1
- package/dist/agents/harsh-critic.js +0 -42
- package/dist/agents/harsh-critic.js.map +0 -1
- package/dist/agents/preamble.d.ts +0 -38
- package/dist/agents/preamble.d.ts.map +0 -1
- package/dist/agents/preamble.js +0 -122
- package/dist/agents/preamble.js.map +0 -1
- package/dist/agents/prompt-generator.d.ts +0 -96
- package/dist/agents/prompt-generator.d.ts.map +0 -1
- package/dist/agents/prompt-generator.js +0 -141
- package/dist/agents/prompt-generator.js.map +0 -1
- package/dist/agents/researcher.d.ts +0 -12
- package/dist/agents/researcher.d.ts.map +0 -1
- package/dist/agents/researcher.js +0 -40
- package/dist/agents/researcher.js.map +0 -1
- package/dist/agents/vision.d.ts +0 -11
- package/dist/agents/vision.d.ts.map +0 -1
- package/dist/agents/vision.js +0 -40
- package/dist/agents/vision.js.map +0 -1
- package/dist/cli/commands/__tests__/cleanup.test.d.ts +0 -2
- package/dist/cli/commands/__tests__/cleanup.test.d.ts.map +0 -1
- package/dist/cli/commands/__tests__/cleanup.test.js +0 -37
- package/dist/cli/commands/__tests__/cleanup.test.js.map +0 -1
- package/dist/compatibility/discovery.d.ts +0 -58
- package/dist/compatibility/discovery.d.ts.map +0 -1
- package/dist/compatibility/discovery.js +0 -620
- package/dist/compatibility/discovery.js.map +0 -1
- package/dist/compatibility/index.d.ts +0 -51
- package/dist/compatibility/index.d.ts.map +0 -1
- package/dist/compatibility/index.js +0 -72
- package/dist/compatibility/index.js.map +0 -1
- package/dist/compatibility/mcp-bridge.d.ts +0 -143
- package/dist/compatibility/mcp-bridge.d.ts.map +0 -1
- package/dist/compatibility/mcp-bridge.js +0 -540
- package/dist/compatibility/mcp-bridge.js.map +0 -1
- package/dist/compatibility/permission-adapter.d.ts +0 -79
- package/dist/compatibility/permission-adapter.d.ts.map +0 -1
- package/dist/compatibility/permission-adapter.js +0 -369
- package/dist/compatibility/permission-adapter.js.map +0 -1
- package/dist/compatibility/registry.d.ts +0 -161
- package/dist/compatibility/registry.d.ts.map +0 -1
- package/dist/compatibility/registry.js +0 -389
- package/dist/compatibility/registry.js.map +0 -1
- package/dist/compatibility/types.d.ts +0 -249
- package/dist/compatibility/types.d.ts.map +0 -1
- package/dist/compatibility/types.js +0 -8
- package/dist/compatibility/types.js.map +0 -1
- package/dist/features/model-routing/__tests__/external-model-policy.test.d.ts +0 -2
- package/dist/features/model-routing/__tests__/external-model-policy.test.d.ts.map +0 -1
- package/dist/features/model-routing/__tests__/external-model-policy.test.js +0 -476
- package/dist/features/model-routing/__tests__/external-model-policy.test.js.map +0 -1
- package/dist/features/model-routing/external-model-policy.d.ts +0 -27
- package/dist/features/model-routing/external-model-policy.d.ts.map +0 -1
- package/dist/features/model-routing/external-model-policy.js +0 -145
- package/dist/features/model-routing/external-model-policy.js.map +0 -1
- package/dist/features/verification/example.d.ts +0 -49
- package/dist/features/verification/example.d.ts.map +0 -1
- package/dist/features/verification/example.js +0 -237
- package/dist/features/verification/example.js.map +0 -1
- package/dist/hooks/setup/__tests__/github-star.test.d.ts +0 -8
- package/dist/hooks/setup/__tests__/github-star.test.d.ts.map +0 -1
- package/dist/hooks/setup/__tests__/github-star.test.js +0 -208
- package/dist/hooks/setup/__tests__/github-star.test.js.map +0 -1
- package/dist/hooks/setup/github-star.d.ts +0 -37
- package/dist/hooks/setup/github-star.d.ts.map +0 -1
- package/dist/hooks/setup/github-star.js +0 -123
- package/dist/hooks/setup/github-star.js.map +0 -1
- package/dist/hooks/swarm/__tests__/addMoreTasks.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/addMoreTasks.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/addMoreTasks.test.js +0 -203
- package/dist/hooks/swarm/__tests__/addMoreTasks.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/aggressive-swarm.integration.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/aggressive-swarm.integration.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/aggressive-swarm.integration.test.js +0 -273
- package/dist/hooks/swarm/__tests__/aggressive-swarm.integration.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/claiming.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/claiming.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/claiming.test.js +0 -170
- package/dist/hooks/swarm/__tests__/claiming.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/index.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/index.test.js +0 -157
- package/dist/hooks/swarm/__tests__/index.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/migration.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/migration.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/migration.test.js +0 -140
- package/dist/hooks/swarm/__tests__/migration.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/mode-registry.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/mode-registry.test.js +0 -177
- package/dist/hooks/swarm/__tests__/mode-registry.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/priority-claiming.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/priority-claiming.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/priority-claiming.test.js +0 -122
- package/dist/hooks/swarm/__tests__/priority-claiming.test.js.map +0 -1
- package/dist/hooks/swarm/__tests__/types.test.d.ts +0 -2
- package/dist/hooks/swarm/__tests__/types.test.d.ts.map +0 -1
- package/dist/hooks/swarm/__tests__/types.test.js +0 -73
- package/dist/hooks/swarm/__tests__/types.test.js.map +0 -1
- package/dist/hooks/swarm/claiming.d.ts +0 -123
- package/dist/hooks/swarm/claiming.d.ts.map +0 -1
- package/dist/hooks/swarm/claiming.js +0 -639
- package/dist/hooks/swarm/claiming.js.map +0 -1
- package/dist/hooks/swarm/index.d.ts +0 -261
- package/dist/hooks/swarm/index.d.ts.map +0 -1
- package/dist/hooks/swarm/index.js +0 -485
- package/dist/hooks/swarm/index.js.map +0 -1
- package/dist/hooks/swarm/state.d.ts +0 -131
- package/dist/hooks/swarm/state.d.ts.map +0 -1
- package/dist/hooks/swarm/state.js +0 -690
- package/dist/hooks/swarm/state.js.map +0 -1
- package/dist/hooks/swarm/types.d.ts +0 -138
- package/dist/hooks/swarm/types.d.ts.map +0 -1
- package/dist/hooks/swarm/types.js +0 -22
- package/dist/hooks/swarm/types.js.map +0 -1
- package/dist/hooks/ultrapilot/decomposer.d.ts +0 -141
- package/dist/hooks/ultrapilot/decomposer.d.ts.map +0 -1
- package/dist/hooks/ultrapilot/decomposer.js +0 -379
- package/dist/hooks/ultrapilot/decomposer.js.map +0 -1
- package/dist/hooks/ultrapilot/index.d.ts +0 -121
- package/dist/hooks/ultrapilot/index.d.ts.map +0 -1
- package/dist/hooks/ultrapilot/index.js +0 -353
- package/dist/hooks/ultrapilot/index.js.map +0 -1
- package/dist/hooks/ultrapilot/state.d.ts +0 -72
- package/dist/hooks/ultrapilot/state.d.ts.map +0 -1
- package/dist/hooks/ultrapilot/state.js +0 -275
- package/dist/hooks/ultrapilot/state.js.map +0 -1
- package/dist/hooks/ultrapilot/types.d.ts +0 -115
- package/dist/hooks/ultrapilot/types.d.ts.map +0 -1
- package/dist/hooks/ultrapilot/types.js +0 -36
- package/dist/hooks/ultrapilot/types.js.map +0 -1
- package/dist/interop/__tests__/worker-adapter-integration.test.d.ts +0 -2
- package/dist/interop/__tests__/worker-adapter-integration.test.d.ts.map +0 -1
- package/dist/interop/__tests__/worker-adapter-integration.test.js +0 -219
- package/dist/interop/__tests__/worker-adapter-integration.test.js.map +0 -1
- package/dist/interop/__tests__/worker-adapter.test.d.ts +0 -2
- package/dist/interop/__tests__/worker-adapter.test.d.ts.map +0 -1
- package/dist/interop/__tests__/worker-adapter.test.js +0 -408
- package/dist/interop/__tests__/worker-adapter.test.js.map +0 -1
- package/dist/interop/adapter-types.d.ts +0 -39
- package/dist/interop/adapter-types.d.ts.map +0 -1
- package/dist/interop/adapter-types.js +0 -9
- package/dist/interop/adapter-types.js.map +0 -1
- package/dist/interop/worker-adapter.d.ts +0 -116
- package/dist/interop/worker-adapter.d.ts.map +0 -1
- package/dist/interop/worker-adapter.js +0 -324
- package/dist/interop/worker-adapter.js.map +0 -1
- package/dist/mcp/__tests__/codex-reasoning-effort.test.d.ts +0 -2
- package/dist/mcp/__tests__/codex-reasoning-effort.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/codex-reasoning-effort.test.js +0 -175
- package/dist/mcp/__tests__/codex-reasoning-effort.test.js.map +0 -1
- package/dist/mcp/__tests__/job-state-db-deprecation.test.d.ts +0 -2
- package/dist/mcp/__tests__/job-state-db-deprecation.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/job-state-db-deprecation.test.js +0 -119
- package/dist/mcp/__tests__/job-state-db-deprecation.test.js.map +0 -1
- package/dist/mcp/__tests__/shared-exec.test.d.ts +0 -2
- package/dist/mcp/__tests__/shared-exec.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/shared-exec.test.js +0 -151
- package/dist/mcp/__tests__/shared-exec.test.js.map +0 -1
- package/dist/mcp/__tests__/team-server-deprecation.test.d.ts +0 -2
- package/dist/mcp/__tests__/team-server-deprecation.test.d.ts.map +0 -1
- package/dist/mcp/__tests__/team-server-deprecation.test.js +0 -56
- package/dist/mcp/__tests__/team-server-deprecation.test.js.map +0 -1
- package/dist/mcp/cli-detection.d.ts +0 -22
- package/dist/mcp/cli-detection.d.ts.map +0 -1
- package/dist/mcp/cli-detection.js +0 -77
- package/dist/mcp/cli-detection.js.map +0 -1
- package/dist/mcp/codex-core.d.ts +0 -119
- package/dist/mcp/codex-core.d.ts.map +0 -1
- package/dist/mcp/codex-core.js +0 -942
- package/dist/mcp/codex-core.js.map +0 -1
- package/dist/mcp/codex-request-normalizer.js +0 -59
- package/dist/mcp/codex-server.d.ts +0 -20
- package/dist/mcp/codex-server.d.ts.map +0 -1
- package/dist/mcp/codex-server.js +0 -81
- package/dist/mcp/codex-server.js.map +0 -1
- package/dist/mcp/codex-standalone-server.d.ts +0 -8
- package/dist/mcp/codex-standalone-server.d.ts.map +0 -1
- package/dist/mcp/codex-standalone-server.js +0 -81
- package/dist/mcp/codex-standalone-server.js.map +0 -1
- package/dist/mcp/gemini-core.d.ts +0 -75
- package/dist/mcp/gemini-core.d.ts.map +0 -1
- package/dist/mcp/gemini-core.js +0 -674
- package/dist/mcp/gemini-core.js.map +0 -1
- package/dist/mcp/gemini-server.d.ts +0 -20
- package/dist/mcp/gemini-server.d.ts.map +0 -1
- package/dist/mcp/gemini-server.js +0 -69
- package/dist/mcp/gemini-server.js.map +0 -1
- package/dist/mcp/gemini-standalone-server.d.ts +0 -8
- package/dist/mcp/gemini-standalone-server.d.ts.map +0 -1
- package/dist/mcp/gemini-standalone-server.js +0 -72
- package/dist/mcp/gemini-standalone-server.js.map +0 -1
- package/dist/mcp/job-state-db.d.ts +0 -2
- package/dist/mcp/job-state-db.d.ts.map +0 -1
- package/dist/mcp/job-state-db.js +0 -3
- package/dist/mcp/job-state-db.js.map +0 -1
- package/dist/mcp/shared-exec.d.ts +0 -50
- package/dist/mcp/shared-exec.d.ts.map +0 -1
- package/dist/mcp/shared-exec.js +0 -182
- package/dist/mcp/shared-exec.js.map +0 -1
- package/dist/team/__tests__/cli-path-resolution.test.d.ts +0 -2
- package/dist/team/__tests__/cli-path-resolution.test.d.ts.map +0 -1
- package/dist/team/__tests__/cli-path-resolution.test.js +0 -281
- package/dist/team/__tests__/cli-path-resolution.test.js.map +0 -1
- package/dist/team/__tests__/layout-stabilizer.test.d.ts +0 -2
- package/dist/team/__tests__/layout-stabilizer.test.d.ts.map +0 -1
- package/dist/team/__tests__/layout-stabilizer.test.js +0 -217
- package/dist/team/__tests__/layout-stabilizer.test.js.map +0 -1
- package/dist/team/__tests__/pane-readiness.test.d.ts +0 -2
- package/dist/team/__tests__/pane-readiness.test.d.ts.map +0 -1
- package/dist/team/__tests__/pane-readiness.test.js +0 -185
- package/dist/team/__tests__/pane-readiness.test.js.map +0 -1
- package/dist/team/__tests__/runtime-gemini-prompt.test.d.ts +0 -2
- package/dist/team/__tests__/runtime-gemini-prompt.test.d.ts.map +0 -1
- package/dist/team/__tests__/runtime-gemini-prompt.test.js +0 -153
- package/dist/team/__tests__/runtime-gemini-prompt.test.js.map +0 -1
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.d.ts +0 -2
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.d.ts.map +0 -1
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.js +0 -139
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.js.map +0 -1
- package/dist/team/__tests__/shell-path.test.d.ts +0 -2
- package/dist/team/__tests__/shell-path.test.d.ts.map +0 -1
- package/dist/team/__tests__/shell-path.test.js +0 -193
- package/dist/team/__tests__/shell-path.test.js.map +0 -1
- package/dist/team/__tests__/wait-for-shell-ready.test.d.ts +0 -2
- package/dist/team/__tests__/wait-for-shell-ready.test.d.ts.map +0 -1
- package/dist/team/__tests__/wait-for-shell-ready.test.js +0 -242
- package/dist/team/__tests__/wait-for-shell-ready.test.js.map +0 -1
- package/dist/team/shell-path.d.ts +0 -21
- package/dist/team/shell-path.d.ts.map +0 -1
- package/dist/team/shell-path.js +0 -73
- package/dist/team/shell-path.js.map +0 -1
- package/scripts/ask-codex.sh +0 -24
- package/scripts/ask-gemini.sh +0 -24
- package/scripts/build-gemini-server.mjs +0 -74
- package/scripts/test-codex-gemini-team.mjs +0 -78
- package/skills/skill-development/SKILL.md +0 -218
- package/skills/skill-development/references/description-patterns.md +0 -160
- package/skills/skill-development/references/format-guide.md +0 -203
- /package/dist/{hooks/swarm → features/delegation-categories}/__tests__/index.test.d.ts +0 -0
package/bridge/mcp-server.cjs
CHANGED
|
@@ -2994,7 +2994,7 @@ var require_compile = __commonJS({
|
|
|
2994
2994
|
const schOrFunc = root.refs[ref];
|
|
2995
2995
|
if (schOrFunc)
|
|
2996
2996
|
return schOrFunc;
|
|
2997
|
-
let _sch =
|
|
2997
|
+
let _sch = resolve7.call(this, root, ref);
|
|
2998
2998
|
if (_sch === void 0) {
|
|
2999
2999
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
3000
3000
|
const { schemaId } = this.opts;
|
|
@@ -3021,7 +3021,7 @@ var require_compile = __commonJS({
|
|
|
3021
3021
|
function sameSchemaEnv(s1, s2) {
|
|
3022
3022
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3023
3023
|
}
|
|
3024
|
-
function
|
|
3024
|
+
function resolve7(root, ref) {
|
|
3025
3025
|
let sch;
|
|
3026
3026
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3027
3027
|
ref = sch;
|
|
@@ -3236,8 +3236,8 @@ var require_utils = __commonJS({
|
|
|
3236
3236
|
}
|
|
3237
3237
|
return ind;
|
|
3238
3238
|
}
|
|
3239
|
-
function removeDotSegments(
|
|
3240
|
-
let input =
|
|
3239
|
+
function removeDotSegments(path13) {
|
|
3240
|
+
let input = path13;
|
|
3241
3241
|
const output = [];
|
|
3242
3242
|
let nextSlash = -1;
|
|
3243
3243
|
let len = 0;
|
|
@@ -3436,8 +3436,8 @@ var require_schemes = __commonJS({
|
|
|
3436
3436
|
wsComponent.secure = void 0;
|
|
3437
3437
|
}
|
|
3438
3438
|
if (wsComponent.resourceName) {
|
|
3439
|
-
const [
|
|
3440
|
-
wsComponent.path =
|
|
3439
|
+
const [path13, query] = wsComponent.resourceName.split("?");
|
|
3440
|
+
wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
|
|
3441
3441
|
wsComponent.query = query;
|
|
3442
3442
|
wsComponent.resourceName = void 0;
|
|
3443
3443
|
}
|
|
@@ -3589,62 +3589,62 @@ var require_fast_uri = __commonJS({
|
|
|
3589
3589
|
function normalize3(uri, options) {
|
|
3590
3590
|
if (typeof uri === "string") {
|
|
3591
3591
|
uri = /** @type {T} */
|
|
3592
|
-
serialize(
|
|
3592
|
+
serialize(parse6(uri, options), options);
|
|
3593
3593
|
} else if (typeof uri === "object") {
|
|
3594
3594
|
uri = /** @type {T} */
|
|
3595
|
-
|
|
3595
|
+
parse6(serialize(uri, options), options);
|
|
3596
3596
|
}
|
|
3597
3597
|
return uri;
|
|
3598
3598
|
}
|
|
3599
|
-
function
|
|
3599
|
+
function resolve7(baseURI, relativeURI, options) {
|
|
3600
3600
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3601
|
-
const resolved = resolveComponent(
|
|
3601
|
+
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3602
3602
|
schemelessOptions.skipEscape = true;
|
|
3603
3603
|
return serialize(resolved, schemelessOptions);
|
|
3604
3604
|
}
|
|
3605
|
-
function resolveComponent(base,
|
|
3605
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
3606
3606
|
const target = {};
|
|
3607
3607
|
if (!skipNormalization) {
|
|
3608
|
-
base =
|
|
3609
|
-
|
|
3608
|
+
base = parse6(serialize(base, options), options);
|
|
3609
|
+
relative4 = parse6(serialize(relative4, options), options);
|
|
3610
3610
|
}
|
|
3611
3611
|
options = options || {};
|
|
3612
|
-
if (!options.tolerant &&
|
|
3613
|
-
target.scheme =
|
|
3614
|
-
target.userinfo =
|
|
3615
|
-
target.host =
|
|
3616
|
-
target.port =
|
|
3617
|
-
target.path = removeDotSegments(
|
|
3618
|
-
target.query =
|
|
3612
|
+
if (!options.tolerant && relative4.scheme) {
|
|
3613
|
+
target.scheme = relative4.scheme;
|
|
3614
|
+
target.userinfo = relative4.userinfo;
|
|
3615
|
+
target.host = relative4.host;
|
|
3616
|
+
target.port = relative4.port;
|
|
3617
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
3618
|
+
target.query = relative4.query;
|
|
3619
3619
|
} else {
|
|
3620
|
-
if (
|
|
3621
|
-
target.userinfo =
|
|
3622
|
-
target.host =
|
|
3623
|
-
target.port =
|
|
3624
|
-
target.path = removeDotSegments(
|
|
3625
|
-
target.query =
|
|
3620
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
3621
|
+
target.userinfo = relative4.userinfo;
|
|
3622
|
+
target.host = relative4.host;
|
|
3623
|
+
target.port = relative4.port;
|
|
3624
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
3625
|
+
target.query = relative4.query;
|
|
3626
3626
|
} else {
|
|
3627
|
-
if (!
|
|
3627
|
+
if (!relative4.path) {
|
|
3628
3628
|
target.path = base.path;
|
|
3629
|
-
if (
|
|
3630
|
-
target.query =
|
|
3629
|
+
if (relative4.query !== void 0) {
|
|
3630
|
+
target.query = relative4.query;
|
|
3631
3631
|
} else {
|
|
3632
3632
|
target.query = base.query;
|
|
3633
3633
|
}
|
|
3634
3634
|
} else {
|
|
3635
|
-
if (
|
|
3636
|
-
target.path = removeDotSegments(
|
|
3635
|
+
if (relative4.path[0] === "/") {
|
|
3636
|
+
target.path = removeDotSegments(relative4.path);
|
|
3637
3637
|
} else {
|
|
3638
3638
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
3639
|
-
target.path = "/" +
|
|
3639
|
+
target.path = "/" + relative4.path;
|
|
3640
3640
|
} else if (!base.path) {
|
|
3641
|
-
target.path =
|
|
3641
|
+
target.path = relative4.path;
|
|
3642
3642
|
} else {
|
|
3643
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
3643
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
3644
3644
|
}
|
|
3645
3645
|
target.path = removeDotSegments(target.path);
|
|
3646
3646
|
}
|
|
3647
|
-
target.query =
|
|
3647
|
+
target.query = relative4.query;
|
|
3648
3648
|
}
|
|
3649
3649
|
target.userinfo = base.userinfo;
|
|
3650
3650
|
target.host = base.host;
|
|
@@ -3652,19 +3652,19 @@ var require_fast_uri = __commonJS({
|
|
|
3652
3652
|
}
|
|
3653
3653
|
target.scheme = base.scheme;
|
|
3654
3654
|
}
|
|
3655
|
-
target.fragment =
|
|
3655
|
+
target.fragment = relative4.fragment;
|
|
3656
3656
|
return target;
|
|
3657
3657
|
}
|
|
3658
3658
|
function equal(uriA, uriB, options) {
|
|
3659
3659
|
if (typeof uriA === "string") {
|
|
3660
3660
|
uriA = unescape(uriA);
|
|
3661
|
-
uriA = serialize(normalizeComponentEncoding(
|
|
3661
|
+
uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
|
|
3662
3662
|
} else if (typeof uriA === "object") {
|
|
3663
3663
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
3664
3664
|
}
|
|
3665
3665
|
if (typeof uriB === "string") {
|
|
3666
3666
|
uriB = unescape(uriB);
|
|
3667
|
-
uriB = serialize(normalizeComponentEncoding(
|
|
3667
|
+
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
3668
3668
|
} else if (typeof uriB === "object") {
|
|
3669
3669
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
3670
3670
|
}
|
|
@@ -3733,7 +3733,7 @@ var require_fast_uri = __commonJS({
|
|
|
3733
3733
|
return uriTokens.join("");
|
|
3734
3734
|
}
|
|
3735
3735
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3736
|
-
function
|
|
3736
|
+
function parse6(uri, opts) {
|
|
3737
3737
|
const options = Object.assign({}, opts);
|
|
3738
3738
|
const parsed = {
|
|
3739
3739
|
scheme: void 0,
|
|
@@ -3823,11 +3823,11 @@ var require_fast_uri = __commonJS({
|
|
|
3823
3823
|
var fastUri = {
|
|
3824
3824
|
SCHEMES,
|
|
3825
3825
|
normalize: normalize3,
|
|
3826
|
-
resolve:
|
|
3826
|
+
resolve: resolve7,
|
|
3827
3827
|
resolveComponent,
|
|
3828
3828
|
equal,
|
|
3829
3829
|
serialize,
|
|
3830
|
-
parse:
|
|
3830
|
+
parse: parse6
|
|
3831
3831
|
};
|
|
3832
3832
|
module2.exports = fastUri;
|
|
3833
3833
|
module2.exports.default = fastUri;
|
|
@@ -7281,8 +7281,8 @@ function getErrorMap() {
|
|
|
7281
7281
|
|
|
7282
7282
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
7283
7283
|
var makeIssue = (params) => {
|
|
7284
|
-
const { data, path:
|
|
7285
|
-
const fullPath = [...
|
|
7284
|
+
const { data, path: path13, errorMaps, issueData } = params;
|
|
7285
|
+
const fullPath = [...path13, ...issueData.path || []];
|
|
7286
7286
|
const fullIssue = {
|
|
7287
7287
|
...issueData,
|
|
7288
7288
|
path: fullPath
|
|
@@ -7398,11 +7398,11 @@ var errorUtil;
|
|
|
7398
7398
|
|
|
7399
7399
|
// node_modules/zod/v3/types.js
|
|
7400
7400
|
var ParseInputLazyPath = class {
|
|
7401
|
-
constructor(parent, value,
|
|
7401
|
+
constructor(parent, value, path13, key) {
|
|
7402
7402
|
this._cachedPath = [];
|
|
7403
7403
|
this.parent = parent;
|
|
7404
7404
|
this.data = value;
|
|
7405
|
-
this._path =
|
|
7405
|
+
this._path = path13;
|
|
7406
7406
|
this._key = key;
|
|
7407
7407
|
}
|
|
7408
7408
|
get path() {
|
|
@@ -11039,10 +11039,10 @@ function assignProp(target, prop, value) {
|
|
|
11039
11039
|
configurable: true
|
|
11040
11040
|
});
|
|
11041
11041
|
}
|
|
11042
|
-
function getElementAtPath(obj,
|
|
11043
|
-
if (!
|
|
11042
|
+
function getElementAtPath(obj, path13) {
|
|
11043
|
+
if (!path13)
|
|
11044
11044
|
return obj;
|
|
11045
|
-
return
|
|
11045
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
11046
11046
|
}
|
|
11047
11047
|
function promiseAllObject(promisesObj) {
|
|
11048
11048
|
const keys = Object.keys(promisesObj);
|
|
@@ -11362,11 +11362,11 @@ function aborted(x, startIndex = 0) {
|
|
|
11362
11362
|
}
|
|
11363
11363
|
return false;
|
|
11364
11364
|
}
|
|
11365
|
-
function prefixIssues(
|
|
11365
|
+
function prefixIssues(path13, issues) {
|
|
11366
11366
|
return issues.map((iss) => {
|
|
11367
11367
|
var _a;
|
|
11368
11368
|
(_a = iss).path ?? (_a.path = []);
|
|
11369
|
-
iss.path.unshift(
|
|
11369
|
+
iss.path.unshift(path13);
|
|
11370
11370
|
return iss;
|
|
11371
11371
|
});
|
|
11372
11372
|
}
|
|
@@ -16665,7 +16665,7 @@ var Protocol = class {
|
|
|
16665
16665
|
return;
|
|
16666
16666
|
}
|
|
16667
16667
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
16668
|
-
await new Promise((
|
|
16668
|
+
await new Promise((resolve7) => setTimeout(resolve7, pollInterval));
|
|
16669
16669
|
options?.signal?.throwIfAborted();
|
|
16670
16670
|
}
|
|
16671
16671
|
} catch (error2) {
|
|
@@ -16682,7 +16682,7 @@ var Protocol = class {
|
|
|
16682
16682
|
*/
|
|
16683
16683
|
request(request, resultSchema, options) {
|
|
16684
16684
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
16685
|
-
return new Promise((
|
|
16685
|
+
return new Promise((resolve7, reject) => {
|
|
16686
16686
|
const earlyReject = (error2) => {
|
|
16687
16687
|
reject(error2);
|
|
16688
16688
|
};
|
|
@@ -16760,7 +16760,7 @@ var Protocol = class {
|
|
|
16760
16760
|
if (!parseResult.success) {
|
|
16761
16761
|
reject(parseResult.error);
|
|
16762
16762
|
} else {
|
|
16763
|
-
|
|
16763
|
+
resolve7(parseResult.data);
|
|
16764
16764
|
}
|
|
16765
16765
|
} catch (error2) {
|
|
16766
16766
|
reject(error2);
|
|
@@ -17021,12 +17021,12 @@ var Protocol = class {
|
|
|
17021
17021
|
}
|
|
17022
17022
|
} catch {
|
|
17023
17023
|
}
|
|
17024
|
-
return new Promise((
|
|
17024
|
+
return new Promise((resolve7, reject) => {
|
|
17025
17025
|
if (signal.aborted) {
|
|
17026
17026
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
17027
17027
|
return;
|
|
17028
17028
|
}
|
|
17029
|
-
const timeoutId = setTimeout(
|
|
17029
|
+
const timeoutId = setTimeout(resolve7, interval);
|
|
17030
17030
|
signal.addEventListener("abort", () => {
|
|
17031
17031
|
clearTimeout(timeoutId);
|
|
17032
17032
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -17755,26 +17755,342 @@ var StdioServerTransport = class {
|
|
|
17755
17755
|
this.onclose?.();
|
|
17756
17756
|
}
|
|
17757
17757
|
send(message) {
|
|
17758
|
-
return new Promise((
|
|
17758
|
+
return new Promise((resolve7) => {
|
|
17759
17759
|
const json = serializeMessage(message);
|
|
17760
17760
|
if (this._stdout.write(json)) {
|
|
17761
|
-
|
|
17761
|
+
resolve7();
|
|
17762
17762
|
} else {
|
|
17763
|
-
this._stdout.once("drain",
|
|
17763
|
+
this._stdout.once("drain", resolve7);
|
|
17764
17764
|
}
|
|
17765
17765
|
});
|
|
17766
17766
|
}
|
|
17767
17767
|
};
|
|
17768
17768
|
|
|
17769
17769
|
// src/tools/lsp/client.ts
|
|
17770
|
-
var
|
|
17770
|
+
var import_child_process3 = require("child_process");
|
|
17771
|
+
var import_fs3 = require("fs");
|
|
17772
|
+
var import_path4 = require("path");
|
|
17773
|
+
var import_url2 = require("url");
|
|
17774
|
+
|
|
17775
|
+
// src/tools/lsp/devcontainer.ts
|
|
17776
|
+
var import_child_process = require("child_process");
|
|
17771
17777
|
var import_fs = require("fs");
|
|
17778
|
+
var import_path = require("path");
|
|
17772
17779
|
var import_path2 = require("path");
|
|
17773
17780
|
var import_url = require("url");
|
|
17774
17781
|
|
|
17782
|
+
// src/utils/jsonc.ts
|
|
17783
|
+
function parseJsonc(content) {
|
|
17784
|
+
const cleaned = stripJsoncComments(content);
|
|
17785
|
+
return JSON.parse(cleaned);
|
|
17786
|
+
}
|
|
17787
|
+
function stripJsoncComments(content) {
|
|
17788
|
+
let result = "";
|
|
17789
|
+
let i = 0;
|
|
17790
|
+
while (i < content.length) {
|
|
17791
|
+
if (content[i] === "/" && content[i + 1] === "/") {
|
|
17792
|
+
while (i < content.length && content[i] !== "\n") {
|
|
17793
|
+
i++;
|
|
17794
|
+
}
|
|
17795
|
+
continue;
|
|
17796
|
+
}
|
|
17797
|
+
if (content[i] === "/" && content[i + 1] === "*") {
|
|
17798
|
+
i += 2;
|
|
17799
|
+
while (i < content.length && !(content[i] === "*" && content[i + 1] === "/")) {
|
|
17800
|
+
i++;
|
|
17801
|
+
}
|
|
17802
|
+
i += 2;
|
|
17803
|
+
continue;
|
|
17804
|
+
}
|
|
17805
|
+
if (content[i] === '"') {
|
|
17806
|
+
result += content[i];
|
|
17807
|
+
i++;
|
|
17808
|
+
while (i < content.length && content[i] !== '"') {
|
|
17809
|
+
if (content[i] === "\\") {
|
|
17810
|
+
result += content[i];
|
|
17811
|
+
i++;
|
|
17812
|
+
if (i < content.length) {
|
|
17813
|
+
result += content[i];
|
|
17814
|
+
i++;
|
|
17815
|
+
}
|
|
17816
|
+
continue;
|
|
17817
|
+
}
|
|
17818
|
+
result += content[i];
|
|
17819
|
+
i++;
|
|
17820
|
+
}
|
|
17821
|
+
if (i < content.length) {
|
|
17822
|
+
result += content[i];
|
|
17823
|
+
i++;
|
|
17824
|
+
}
|
|
17825
|
+
continue;
|
|
17826
|
+
}
|
|
17827
|
+
result += content[i];
|
|
17828
|
+
i++;
|
|
17829
|
+
}
|
|
17830
|
+
return result;
|
|
17831
|
+
}
|
|
17832
|
+
|
|
17833
|
+
// src/tools/lsp/devcontainer.ts
|
|
17834
|
+
var DEVCONTAINER_PRIMARY_CONFIG_PATH = [".devcontainer", "devcontainer.json"];
|
|
17835
|
+
var DEVCONTAINER_DOTFILE_NAME = ".devcontainer.json";
|
|
17836
|
+
var DEVCONTAINER_CONFIG_DIR = ".devcontainer";
|
|
17837
|
+
var DEVCONTAINER_LOCAL_FOLDER_LABELS = [
|
|
17838
|
+
"devcontainer.local_folder",
|
|
17839
|
+
"vsch.local.folder"
|
|
17840
|
+
];
|
|
17841
|
+
var DEVCONTAINER_CONFIG_FILE_LABELS = [
|
|
17842
|
+
"devcontainer.config_file",
|
|
17843
|
+
"vsch.config.file"
|
|
17844
|
+
];
|
|
17845
|
+
function resolveDevContainerContext(workspaceRoot) {
|
|
17846
|
+
const hostWorkspaceRoot = (0, import_path.resolve)(workspaceRoot);
|
|
17847
|
+
const configFilePath = resolveDevContainerConfigPath(hostWorkspaceRoot);
|
|
17848
|
+
const config2 = readDevContainerConfig(configFilePath);
|
|
17849
|
+
const overrideContainerId = process.env.OMC_LSP_CONTAINER_ID?.trim();
|
|
17850
|
+
if (overrideContainerId) {
|
|
17851
|
+
return buildContextFromContainer(overrideContainerId, hostWorkspaceRoot, configFilePath, config2);
|
|
17852
|
+
}
|
|
17853
|
+
const containerIds = listRunningContainerIds();
|
|
17854
|
+
if (containerIds.length === 0) {
|
|
17855
|
+
return null;
|
|
17856
|
+
}
|
|
17857
|
+
let bestMatch = null;
|
|
17858
|
+
for (const containerId of containerIds) {
|
|
17859
|
+
const inspect = inspectContainer(containerId);
|
|
17860
|
+
if (!inspect) {
|
|
17861
|
+
continue;
|
|
17862
|
+
}
|
|
17863
|
+
const score = scoreContainerMatch(inspect, hostWorkspaceRoot, configFilePath);
|
|
17864
|
+
if (score <= 0) {
|
|
17865
|
+
continue;
|
|
17866
|
+
}
|
|
17867
|
+
const context = buildContextFromInspect(inspect, hostWorkspaceRoot, configFilePath, config2);
|
|
17868
|
+
if (!context) {
|
|
17869
|
+
continue;
|
|
17870
|
+
}
|
|
17871
|
+
if (!bestMatch || score > bestMatch.score) {
|
|
17872
|
+
bestMatch = { score, context };
|
|
17873
|
+
}
|
|
17874
|
+
}
|
|
17875
|
+
return bestMatch?.context ?? null;
|
|
17876
|
+
}
|
|
17877
|
+
function hostPathToContainerPath(filePath, context) {
|
|
17878
|
+
if (!context) {
|
|
17879
|
+
return (0, import_path.resolve)(filePath);
|
|
17880
|
+
}
|
|
17881
|
+
const resolvedPath = (0, import_path.resolve)(filePath);
|
|
17882
|
+
const relativePath = (0, import_path.relative)(context.hostWorkspaceRoot, resolvedPath);
|
|
17883
|
+
if (relativePath === "") {
|
|
17884
|
+
return context.containerWorkspaceRoot;
|
|
17885
|
+
}
|
|
17886
|
+
if (relativePath.startsWith("..") || relativePath.includes(`..${import_path.sep}`)) {
|
|
17887
|
+
return resolvedPath;
|
|
17888
|
+
}
|
|
17889
|
+
const posixRelativePath = relativePath.split(import_path.sep).join("/");
|
|
17890
|
+
return import_path2.posix.join(context.containerWorkspaceRoot, posixRelativePath);
|
|
17891
|
+
}
|
|
17892
|
+
function containerPathToHostPath(filePath, context) {
|
|
17893
|
+
if (!context) {
|
|
17894
|
+
return (0, import_path.resolve)(filePath);
|
|
17895
|
+
}
|
|
17896
|
+
const normalizedContainerPath = normalizeContainerPath(filePath);
|
|
17897
|
+
const relativePath = import_path2.posix.relative(context.containerWorkspaceRoot, normalizedContainerPath);
|
|
17898
|
+
if (relativePath === "") {
|
|
17899
|
+
return context.hostWorkspaceRoot;
|
|
17900
|
+
}
|
|
17901
|
+
if (relativePath.startsWith("..") || relativePath.includes("../")) {
|
|
17902
|
+
return normalizedContainerPath;
|
|
17903
|
+
}
|
|
17904
|
+
return (0, import_path.resolve)(context.hostWorkspaceRoot, ...relativePath.split("/"));
|
|
17905
|
+
}
|
|
17906
|
+
function hostUriToContainerUri(uri, context) {
|
|
17907
|
+
if (!context || !uri.startsWith("file://")) {
|
|
17908
|
+
return uri;
|
|
17909
|
+
}
|
|
17910
|
+
return containerPathToFileUri(hostPathToContainerPath((0, import_url.fileURLToPath)(uri), context));
|
|
17911
|
+
}
|
|
17912
|
+
function containerUriToHostUri(uri, context) {
|
|
17913
|
+
if (!context || !uri.startsWith("file://")) {
|
|
17914
|
+
return uri;
|
|
17915
|
+
}
|
|
17916
|
+
return (0, import_url.pathToFileURL)(containerPathToHostPath((0, import_url.fileURLToPath)(uri), context)).href;
|
|
17917
|
+
}
|
|
17918
|
+
function resolveDevContainerConfigPath(workspaceRoot) {
|
|
17919
|
+
let dir = workspaceRoot;
|
|
17920
|
+
while (true) {
|
|
17921
|
+
const configFilePath = resolveDevContainerConfigPathAt(dir);
|
|
17922
|
+
if (configFilePath) {
|
|
17923
|
+
return configFilePath;
|
|
17924
|
+
}
|
|
17925
|
+
const parsed = (0, import_path.parse)(dir);
|
|
17926
|
+
if (parsed.root === dir) {
|
|
17927
|
+
return void 0;
|
|
17928
|
+
}
|
|
17929
|
+
dir = (0, import_path.dirname)(dir);
|
|
17930
|
+
}
|
|
17931
|
+
}
|
|
17932
|
+
function resolveDevContainerConfigPathAt(dir) {
|
|
17933
|
+
const primaryConfigPath = (0, import_path.join)(dir, ...DEVCONTAINER_PRIMARY_CONFIG_PATH);
|
|
17934
|
+
if ((0, import_fs.existsSync)(primaryConfigPath)) {
|
|
17935
|
+
return primaryConfigPath;
|
|
17936
|
+
}
|
|
17937
|
+
const dotfileConfigPath = (0, import_path.join)(dir, DEVCONTAINER_DOTFILE_NAME);
|
|
17938
|
+
if ((0, import_fs.existsSync)(dotfileConfigPath)) {
|
|
17939
|
+
return dotfileConfigPath;
|
|
17940
|
+
}
|
|
17941
|
+
const devcontainerDir = (0, import_path.join)(dir, DEVCONTAINER_CONFIG_DIR);
|
|
17942
|
+
if (!(0, import_fs.existsSync)(devcontainerDir)) {
|
|
17943
|
+
return void 0;
|
|
17944
|
+
}
|
|
17945
|
+
const nestedConfigPaths = (0, import_fs.readdirSync)(devcontainerDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => (0, import_path.join)(devcontainerDir, entry.name, "devcontainer.json")).filter(import_fs.existsSync).sort((left, right) => left.localeCompare(right));
|
|
17946
|
+
return nestedConfigPaths[0];
|
|
17947
|
+
}
|
|
17948
|
+
function deriveHostDevContainerRoot(configFilePath) {
|
|
17949
|
+
const resolvedConfigPath = (0, import_path.resolve)(configFilePath);
|
|
17950
|
+
if ((0, import_path.basename)(resolvedConfigPath) === DEVCONTAINER_DOTFILE_NAME) {
|
|
17951
|
+
return (0, import_path.dirname)(resolvedConfigPath);
|
|
17952
|
+
}
|
|
17953
|
+
const configParentDir = (0, import_path.dirname)(resolvedConfigPath);
|
|
17954
|
+
if ((0, import_path.basename)(configParentDir) === DEVCONTAINER_CONFIG_DIR) {
|
|
17955
|
+
return (0, import_path.dirname)(configParentDir);
|
|
17956
|
+
}
|
|
17957
|
+
const configGrandparentDir = (0, import_path.dirname)(configParentDir);
|
|
17958
|
+
if ((0, import_path.basename)(configGrandparentDir) === DEVCONTAINER_CONFIG_DIR) {
|
|
17959
|
+
return (0, import_path.dirname)(configGrandparentDir);
|
|
17960
|
+
}
|
|
17961
|
+
return (0, import_path.dirname)(configParentDir);
|
|
17962
|
+
}
|
|
17963
|
+
function readDevContainerConfig(configFilePath) {
|
|
17964
|
+
if (!configFilePath || !(0, import_fs.existsSync)(configFilePath)) {
|
|
17965
|
+
return null;
|
|
17966
|
+
}
|
|
17967
|
+
try {
|
|
17968
|
+
const parsed = parseJsonc((0, import_fs.readFileSync)(configFilePath, "utf-8"));
|
|
17969
|
+
return typeof parsed === "object" && parsed !== null ? parsed : null;
|
|
17970
|
+
} catch {
|
|
17971
|
+
return null;
|
|
17972
|
+
}
|
|
17973
|
+
}
|
|
17974
|
+
function listRunningContainerIds() {
|
|
17975
|
+
const result = runDocker(["ps", "-q"]);
|
|
17976
|
+
if (!result || result.status !== 0) {
|
|
17977
|
+
return [];
|
|
17978
|
+
}
|
|
17979
|
+
const stdout = typeof result.stdout === "string" ? result.stdout : result.stdout.toString("utf8");
|
|
17980
|
+
return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
17981
|
+
}
|
|
17982
|
+
function inspectContainer(containerId) {
|
|
17983
|
+
const result = runDocker(["inspect", containerId]);
|
|
17984
|
+
if (!result || result.status !== 0) {
|
|
17985
|
+
return null;
|
|
17986
|
+
}
|
|
17987
|
+
try {
|
|
17988
|
+
const stdout = typeof result.stdout === "string" ? result.stdout : result.stdout.toString("utf8");
|
|
17989
|
+
const parsed = JSON.parse(stdout);
|
|
17990
|
+
const inspect = parsed[0];
|
|
17991
|
+
if (!inspect?.Id || inspect.State?.Running === false) {
|
|
17992
|
+
return null;
|
|
17993
|
+
}
|
|
17994
|
+
return inspect;
|
|
17995
|
+
} catch {
|
|
17996
|
+
return null;
|
|
17997
|
+
}
|
|
17998
|
+
}
|
|
17999
|
+
function buildContextFromContainer(containerId, hostWorkspaceRoot, configFilePath, config2) {
|
|
18000
|
+
const inspect = inspectContainer(containerId);
|
|
18001
|
+
if (!inspect) {
|
|
18002
|
+
return null;
|
|
18003
|
+
}
|
|
18004
|
+
return buildContextFromInspect(inspect, hostWorkspaceRoot, configFilePath, config2);
|
|
18005
|
+
}
|
|
18006
|
+
function buildContextFromInspect(inspect, hostWorkspaceRoot, configFilePath, config2) {
|
|
18007
|
+
const containerWorkspaceRoot = deriveContainerWorkspaceRoot(inspect, hostWorkspaceRoot, config2?.workspaceFolder);
|
|
18008
|
+
if (!containerWorkspaceRoot || !inspect.Id) {
|
|
18009
|
+
return null;
|
|
18010
|
+
}
|
|
18011
|
+
return {
|
|
18012
|
+
containerId: inspect.Id,
|
|
18013
|
+
hostWorkspaceRoot,
|
|
18014
|
+
containerWorkspaceRoot,
|
|
18015
|
+
configFilePath
|
|
18016
|
+
};
|
|
18017
|
+
}
|
|
18018
|
+
function deriveContainerWorkspaceRoot(inspect, hostWorkspaceRoot, workspaceFolder) {
|
|
18019
|
+
const mounts = Array.isArray(inspect.Mounts) ? inspect.Mounts : [];
|
|
18020
|
+
let bestMountMatch = null;
|
|
18021
|
+
for (const mount of mounts) {
|
|
18022
|
+
const source = mount.Source ? (0, import_path.resolve)(mount.Source) : "";
|
|
18023
|
+
const destination = mount.Destination ? normalizeContainerPath(mount.Destination) : "";
|
|
18024
|
+
if (!source || !destination) {
|
|
18025
|
+
continue;
|
|
18026
|
+
}
|
|
18027
|
+
if (source === hostWorkspaceRoot) {
|
|
18028
|
+
return destination;
|
|
18029
|
+
}
|
|
18030
|
+
const relativePath = (0, import_path.relative)(source, hostWorkspaceRoot);
|
|
18031
|
+
if (relativePath === "" || relativePath.startsWith("..") || relativePath.includes(`..${import_path.sep}`)) {
|
|
18032
|
+
continue;
|
|
18033
|
+
}
|
|
18034
|
+
if (!bestMountMatch || source.length > bestMountMatch.sourceLength) {
|
|
18035
|
+
bestMountMatch = {
|
|
18036
|
+
sourceLength: source.length,
|
|
18037
|
+
destination: import_path2.posix.join(destination, relativePath.split(import_path.sep).join("/"))
|
|
18038
|
+
};
|
|
18039
|
+
}
|
|
18040
|
+
}
|
|
18041
|
+
if (bestMountMatch) {
|
|
18042
|
+
return bestMountMatch.destination;
|
|
18043
|
+
}
|
|
18044
|
+
return workspaceFolder ? normalizeContainerPath(workspaceFolder) : null;
|
|
18045
|
+
}
|
|
18046
|
+
function scoreContainerMatch(inspect, hostWorkspaceRoot, configFilePath) {
|
|
18047
|
+
const labels = inspect.Config?.Labels ?? {};
|
|
18048
|
+
let score = 0;
|
|
18049
|
+
let hasDevContainerLabelMatch = false;
|
|
18050
|
+
const expectedLocalFolder = configFilePath ? deriveHostDevContainerRoot(configFilePath) : (0, import_path.resolve)(hostWorkspaceRoot);
|
|
18051
|
+
for (const label of DEVCONTAINER_LOCAL_FOLDER_LABELS) {
|
|
18052
|
+
if (labels[label] && (0, import_path.resolve)(labels[label]) === expectedLocalFolder) {
|
|
18053
|
+
score += 4;
|
|
18054
|
+
hasDevContainerLabelMatch = true;
|
|
18055
|
+
}
|
|
18056
|
+
}
|
|
18057
|
+
if (configFilePath) {
|
|
18058
|
+
for (const label of DEVCONTAINER_CONFIG_FILE_LABELS) {
|
|
18059
|
+
if (labels[label] && (0, import_path.resolve)(labels[label]) === configFilePath) {
|
|
18060
|
+
score += 3;
|
|
18061
|
+
hasDevContainerLabelMatch = true;
|
|
18062
|
+
}
|
|
18063
|
+
}
|
|
18064
|
+
}
|
|
18065
|
+
const mappedWorkspaceRoot = deriveContainerWorkspaceRoot(inspect, hostWorkspaceRoot);
|
|
18066
|
+
if (mappedWorkspaceRoot && (Boolean(configFilePath) || hasDevContainerLabelMatch)) {
|
|
18067
|
+
score += 1;
|
|
18068
|
+
}
|
|
18069
|
+
return score;
|
|
18070
|
+
}
|
|
18071
|
+
function normalizeContainerPath(filePath) {
|
|
18072
|
+
return import_path2.posix.normalize(filePath.replace(/\\/g, "/"));
|
|
18073
|
+
}
|
|
18074
|
+
function containerPathToFileUri(filePath) {
|
|
18075
|
+
const normalizedPath = normalizeContainerPath(filePath);
|
|
18076
|
+
const encodedPath = normalizedPath.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
18077
|
+
return `file://${encodedPath.startsWith("/") ? encodedPath : `/${encodedPath}`}`;
|
|
18078
|
+
}
|
|
18079
|
+
function runDocker(args) {
|
|
18080
|
+
const result = (0, import_child_process.spawnSync)("docker", args, {
|
|
18081
|
+
encoding: "utf8",
|
|
18082
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
18083
|
+
});
|
|
18084
|
+
if (result.error) {
|
|
18085
|
+
return null;
|
|
18086
|
+
}
|
|
18087
|
+
return result;
|
|
18088
|
+
}
|
|
18089
|
+
|
|
17775
18090
|
// src/tools/lsp/servers.ts
|
|
17776
|
-
var
|
|
17777
|
-
var
|
|
18091
|
+
var import_child_process2 = require("child_process");
|
|
18092
|
+
var import_fs2 = require("fs");
|
|
18093
|
+
var import_path3 = require("path");
|
|
17778
18094
|
var LSP_SERVERS = {
|
|
17779
18095
|
typescript: {
|
|
17780
18096
|
name: "TypeScript Language Server",
|
|
@@ -17869,10 +18185,11 @@ var LSP_SERVERS = {
|
|
|
17869
18185
|
},
|
|
17870
18186
|
kotlin: {
|
|
17871
18187
|
name: "Kotlin Language Server",
|
|
17872
|
-
command: "kotlin-
|
|
17873
|
-
args: [],
|
|
18188
|
+
command: "kotlin-lsp",
|
|
18189
|
+
args: ["--stdio"],
|
|
17874
18190
|
extensions: [".kt", ".kts"],
|
|
17875
|
-
installHint: "Install from https://github.com/
|
|
18191
|
+
installHint: "Install from https://github.com/Kotlin/kotlin-lsp (brew install JetBrains/utils/kotlin-lsp)",
|
|
18192
|
+
initializeTimeoutMs: 5 * 60 * 1e3
|
|
17876
18193
|
},
|
|
17877
18194
|
elixir: {
|
|
17878
18195
|
name: "ElixirLS",
|
|
@@ -17901,15 +18218,23 @@ var LSP_SERVERS = {
|
|
|
17901
18218
|
args: [],
|
|
17902
18219
|
extensions: [".swift"],
|
|
17903
18220
|
installHint: "Install Swift from https://swift.org/download or via Xcode"
|
|
18221
|
+
},
|
|
18222
|
+
verilog: {
|
|
18223
|
+
name: "Verible Verilog Language Server",
|
|
18224
|
+
command: "verible-verilog-ls",
|
|
18225
|
+
args: ["--rules_config_search"],
|
|
18226
|
+
extensions: [".v", ".vh", ".sv", ".svh"],
|
|
18227
|
+
installHint: "Download from https://github.com/chipsalliance/verible/releases"
|
|
17904
18228
|
}
|
|
17905
18229
|
};
|
|
17906
18230
|
function commandExists(command) {
|
|
18231
|
+
if ((0, import_path3.isAbsolute)(command)) return (0, import_fs2.existsSync)(command);
|
|
17907
18232
|
const checkCommand = process.platform === "win32" ? "where" : "which";
|
|
17908
|
-
const result = (0,
|
|
18233
|
+
const result = (0, import_child_process2.spawnSync)(checkCommand, [command], { stdio: "ignore" });
|
|
17909
18234
|
return result.status === 0;
|
|
17910
18235
|
}
|
|
17911
18236
|
function getServerForFile(filePath) {
|
|
17912
|
-
const ext = (0,
|
|
18237
|
+
const ext = (0, import_path3.extname)(filePath).toLowerCase();
|
|
17913
18238
|
for (const [_, config2] of Object.entries(LSP_SERVERS)) {
|
|
17914
18239
|
if (config2.extensions.includes(ext)) {
|
|
17915
18240
|
return config2;
|
|
@@ -17926,17 +18251,28 @@ function getAllServers() {
|
|
|
17926
18251
|
|
|
17927
18252
|
// src/tools/lsp/client.ts
|
|
17928
18253
|
var DEFAULT_LSP_REQUEST_TIMEOUT_MS = (() => {
|
|
17929
|
-
|
|
17930
|
-
if (env) {
|
|
17931
|
-
const parsed = parseInt(env, 10);
|
|
17932
|
-
if (!isNaN(parsed) && parsed > 0) return parsed;
|
|
17933
|
-
}
|
|
17934
|
-
return 15e3;
|
|
18254
|
+
return readPositiveIntEnv("OMC_LSP_TIMEOUT_MS", 15e3);
|
|
17935
18255
|
})();
|
|
18256
|
+
function getLspRequestTimeout(serverConfig, method, baseTimeout = DEFAULT_LSP_REQUEST_TIMEOUT_MS) {
|
|
18257
|
+
if (method === "initialize" && serverConfig.initializeTimeoutMs) {
|
|
18258
|
+
return Math.max(baseTimeout, serverConfig.initializeTimeoutMs);
|
|
18259
|
+
}
|
|
18260
|
+
return baseTimeout;
|
|
18261
|
+
}
|
|
18262
|
+
function readPositiveIntEnv(name, fallback) {
|
|
18263
|
+
const env = process.env[name];
|
|
18264
|
+
if (!env) {
|
|
18265
|
+
return fallback;
|
|
18266
|
+
}
|
|
18267
|
+
const parsed = parseInt(env, 10);
|
|
18268
|
+
return !isNaN(parsed) && parsed > 0 ? parsed : fallback;
|
|
18269
|
+
}
|
|
17936
18270
|
function fileUri(filePath) {
|
|
17937
|
-
return (0,
|
|
18271
|
+
return (0, import_url2.pathToFileURL)((0, import_path4.resolve)(filePath)).href;
|
|
17938
18272
|
}
|
|
17939
|
-
var LspClient = class {
|
|
18273
|
+
var LspClient = class _LspClient {
|
|
18274
|
+
static MAX_BUFFER_SIZE = 50 * 1024 * 1024;
|
|
18275
|
+
// 50MB
|
|
17940
18276
|
process = null;
|
|
17941
18277
|
requestId = 0;
|
|
17942
18278
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -17946,10 +18282,12 @@ var LspClient = class {
|
|
|
17946
18282
|
diagnosticWaiters = /* @__PURE__ */ new Map();
|
|
17947
18283
|
workspaceRoot;
|
|
17948
18284
|
serverConfig;
|
|
18285
|
+
devContainerContext;
|
|
17949
18286
|
initialized = false;
|
|
17950
|
-
constructor(workspaceRoot, serverConfig) {
|
|
17951
|
-
this.workspaceRoot = (0,
|
|
18287
|
+
constructor(workspaceRoot, serverConfig, devContainerContext = null) {
|
|
18288
|
+
this.workspaceRoot = (0, import_path4.resolve)(workspaceRoot);
|
|
17952
18289
|
this.serverConfig = serverConfig;
|
|
18290
|
+
this.devContainerContext = devContainerContext;
|
|
17953
18291
|
}
|
|
17954
18292
|
/**
|
|
17955
18293
|
* Start the LSP server and initialize the connection
|
|
@@ -17958,19 +18296,20 @@ var LspClient = class {
|
|
|
17958
18296
|
if (this.process) {
|
|
17959
18297
|
return;
|
|
17960
18298
|
}
|
|
17961
|
-
|
|
18299
|
+
const spawnCommand = this.devContainerContext ? "docker" : this.serverConfig.command;
|
|
18300
|
+
if (!commandExists(spawnCommand)) {
|
|
17962
18301
|
throw new Error(
|
|
17963
|
-
`Language server '${this.serverConfig.command}' not found.
|
|
18302
|
+
this.devContainerContext ? `Docker CLI not found. Required to start '${this.serverConfig.command}' inside container ${this.devContainerContext.containerId}.` : `Language server '${this.serverConfig.command}' not found.
|
|
17964
18303
|
Install with: ${this.serverConfig.installHint}`
|
|
17965
18304
|
);
|
|
17966
18305
|
}
|
|
17967
|
-
return new Promise((
|
|
17968
|
-
this.
|
|
18306
|
+
return new Promise((resolve7, reject) => {
|
|
18307
|
+
const command = this.devContainerContext ? "docker" : this.serverConfig.command;
|
|
18308
|
+
const args = this.devContainerContext ? ["exec", "-i", "-w", this.devContainerContext.containerWorkspaceRoot, this.devContainerContext.containerId, this.serverConfig.command, ...this.serverConfig.args] : this.serverConfig.args;
|
|
18309
|
+
this.process = (0, import_child_process3.spawn)(command, args, {
|
|
17969
18310
|
cwd: this.workspaceRoot,
|
|
17970
18311
|
stdio: ["pipe", "pipe", "pipe"],
|
|
17971
|
-
|
|
17972
|
-
// shell execution. Without this, spawn() fails with ENOENT. (#569)
|
|
17973
|
-
shell: process.platform === "win32"
|
|
18312
|
+
shell: !this.devContainerContext && process.platform === "win32"
|
|
17974
18313
|
});
|
|
17975
18314
|
this.process.stdout?.on("data", (data) => {
|
|
17976
18315
|
this.handleData(data);
|
|
@@ -17991,7 +18330,7 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
17991
18330
|
});
|
|
17992
18331
|
this.initialize().then(() => {
|
|
17993
18332
|
this.initialized = true;
|
|
17994
|
-
|
|
18333
|
+
resolve7();
|
|
17995
18334
|
}).catch(reject);
|
|
17996
18335
|
});
|
|
17997
18336
|
}
|
|
@@ -18007,6 +18346,10 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18007
18346
|
}
|
|
18008
18347
|
this.process = null;
|
|
18009
18348
|
this.initialized = false;
|
|
18349
|
+
for (const waiters of this.diagnosticWaiters.values()) {
|
|
18350
|
+
for (const wake of waiters) wake();
|
|
18351
|
+
}
|
|
18352
|
+
this.diagnosticWaiters.clear();
|
|
18010
18353
|
}
|
|
18011
18354
|
}
|
|
18012
18355
|
/**
|
|
@@ -18015,16 +18358,23 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18015
18358
|
async disconnect() {
|
|
18016
18359
|
if (!this.process) return;
|
|
18017
18360
|
try {
|
|
18018
|
-
await this.request("shutdown", null);
|
|
18361
|
+
await this.request("shutdown", null, 3e3);
|
|
18019
18362
|
this.notify("exit", null);
|
|
18020
18363
|
} catch {
|
|
18364
|
+
} finally {
|
|
18365
|
+
if (this.process) {
|
|
18366
|
+
this.process.kill();
|
|
18367
|
+
this.process = null;
|
|
18368
|
+
}
|
|
18369
|
+
this.initialized = false;
|
|
18370
|
+
this.rejectPendingRequests(new Error("Client disconnected"));
|
|
18371
|
+
this.openDocuments.clear();
|
|
18372
|
+
this.diagnostics.clear();
|
|
18373
|
+
for (const waiters of this.diagnosticWaiters.values()) {
|
|
18374
|
+
for (const wake of waiters) wake();
|
|
18375
|
+
}
|
|
18376
|
+
this.diagnosticWaiters.clear();
|
|
18021
18377
|
}
|
|
18022
|
-
this.process.kill();
|
|
18023
|
-
this.process = null;
|
|
18024
|
-
this.initialized = false;
|
|
18025
|
-
this.pendingRequests.clear();
|
|
18026
|
-
this.openDocuments.clear();
|
|
18027
|
-
this.diagnostics.clear();
|
|
18028
18378
|
}
|
|
18029
18379
|
/**
|
|
18030
18380
|
* Reject all pending requests with the given error.
|
|
@@ -18042,6 +18392,12 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18042
18392
|
*/
|
|
18043
18393
|
handleData(data) {
|
|
18044
18394
|
this.buffer = Buffer.concat([this.buffer, data]);
|
|
18395
|
+
if (this.buffer.length > _LspClient.MAX_BUFFER_SIZE) {
|
|
18396
|
+
console.error("[LSP] Response buffer exceeded 50MB limit, resetting");
|
|
18397
|
+
this.buffer = Buffer.alloc(0);
|
|
18398
|
+
this.rejectPendingRequests(new Error("LSP response buffer overflow"));
|
|
18399
|
+
return;
|
|
18400
|
+
}
|
|
18045
18401
|
while (true) {
|
|
18046
18402
|
const headerEnd = this.buffer.indexOf("\r\n\r\n");
|
|
18047
18403
|
if (headerEnd === -1) break;
|
|
@@ -18090,7 +18446,7 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18090
18446
|
*/
|
|
18091
18447
|
handleNotification(notification) {
|
|
18092
18448
|
if (notification.method === "textDocument/publishDiagnostics") {
|
|
18093
|
-
const params = notification.params;
|
|
18449
|
+
const params = this.translateIncomingPayload(notification.params);
|
|
18094
18450
|
this.diagnostics.set(params.uri, params.diagnostics);
|
|
18095
18451
|
const waiters = this.diagnosticWaiters.get(params.uri);
|
|
18096
18452
|
if (waiters && waiters.length > 0) {
|
|
@@ -18102,10 +18458,11 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18102
18458
|
/**
|
|
18103
18459
|
* Send a request to the server
|
|
18104
18460
|
*/
|
|
18105
|
-
async request(method, params, timeout
|
|
18461
|
+
async request(method, params, timeout) {
|
|
18106
18462
|
if (!this.process?.stdin) {
|
|
18107
18463
|
throw new Error("LSP server not connected");
|
|
18108
18464
|
}
|
|
18465
|
+
const effectiveTimeout = timeout ?? getLspRequestTimeout(this.serverConfig, method);
|
|
18109
18466
|
const id = ++this.requestId;
|
|
18110
18467
|
const request = {
|
|
18111
18468
|
jsonrpc: "2.0",
|
|
@@ -18117,13 +18474,13 @@ Install with: ${this.serverConfig.installHint}`
|
|
|
18117
18474
|
const message = `Content-Length: ${Buffer.byteLength(content)}\r
|
|
18118
18475
|
\r
|
|
18119
18476
|
${content}`;
|
|
18120
|
-
return new Promise((
|
|
18477
|
+
return new Promise((resolve7, reject) => {
|
|
18121
18478
|
const timeoutHandle = setTimeout(() => {
|
|
18122
18479
|
this.pendingRequests.delete(id);
|
|
18123
|
-
reject(new Error(`LSP request '${method}' timed out after ${
|
|
18124
|
-
},
|
|
18480
|
+
reject(new Error(`LSP request '${method}' timed out after ${effectiveTimeout}ms`));
|
|
18481
|
+
}, effectiveTimeout);
|
|
18125
18482
|
this.pendingRequests.set(id, {
|
|
18126
|
-
resolve:
|
|
18483
|
+
resolve: resolve7,
|
|
18127
18484
|
reject,
|
|
18128
18485
|
timeout: timeoutHandle
|
|
18129
18486
|
});
|
|
@@ -18152,8 +18509,8 @@ ${content}`;
|
|
|
18152
18509
|
async initialize() {
|
|
18153
18510
|
await this.request("initialize", {
|
|
18154
18511
|
processId: process.pid,
|
|
18155
|
-
rootUri:
|
|
18156
|
-
rootPath: this.
|
|
18512
|
+
rootUri: this.getWorkspaceRootUri(),
|
|
18513
|
+
rootPath: this.getServerWorkspaceRoot(),
|
|
18157
18514
|
capabilities: {
|
|
18158
18515
|
textDocument: {
|
|
18159
18516
|
hover: { contentFormat: ["markdown", "plaintext"] },
|
|
@@ -18169,19 +18526,20 @@ ${content}`;
|
|
|
18169
18526
|
}
|
|
18170
18527
|
},
|
|
18171
18528
|
initializationOptions: this.serverConfig.initializationOptions || {}
|
|
18172
|
-
});
|
|
18529
|
+
}, getLspRequestTimeout(this.serverConfig, "initialize"));
|
|
18173
18530
|
this.notify("initialized", {});
|
|
18174
18531
|
}
|
|
18175
18532
|
/**
|
|
18176
18533
|
* Open a document for editing
|
|
18177
18534
|
*/
|
|
18178
18535
|
async openDocument(filePath) {
|
|
18179
|
-
const
|
|
18180
|
-
|
|
18181
|
-
if (
|
|
18536
|
+
const hostUri = fileUri(filePath);
|
|
18537
|
+
const uri = this.toServerUri(hostUri);
|
|
18538
|
+
if (this.openDocuments.has(hostUri)) return;
|
|
18539
|
+
if (!(0, import_fs3.existsSync)(filePath)) {
|
|
18182
18540
|
throw new Error(`File not found: ${filePath}`);
|
|
18183
18541
|
}
|
|
18184
|
-
const content = (0,
|
|
18542
|
+
const content = (0, import_fs3.readFileSync)(filePath, "utf-8");
|
|
18185
18543
|
const languageId = this.getLanguageId(filePath);
|
|
18186
18544
|
this.notify("textDocument/didOpen", {
|
|
18187
18545
|
textDocument: {
|
|
@@ -18191,25 +18549,26 @@ ${content}`;
|
|
|
18191
18549
|
text: content
|
|
18192
18550
|
}
|
|
18193
18551
|
});
|
|
18194
|
-
this.openDocuments.add(
|
|
18195
|
-
await new Promise((
|
|
18552
|
+
this.openDocuments.add(hostUri);
|
|
18553
|
+
await new Promise((resolve7) => setTimeout(resolve7, 100));
|
|
18196
18554
|
}
|
|
18197
18555
|
/**
|
|
18198
18556
|
* Close a document
|
|
18199
18557
|
*/
|
|
18200
18558
|
closeDocument(filePath) {
|
|
18201
|
-
const
|
|
18202
|
-
|
|
18559
|
+
const hostUri = fileUri(filePath);
|
|
18560
|
+
const uri = this.toServerUri(hostUri);
|
|
18561
|
+
if (!this.openDocuments.has(hostUri)) return;
|
|
18203
18562
|
this.notify("textDocument/didClose", {
|
|
18204
18563
|
textDocument: { uri }
|
|
18205
18564
|
});
|
|
18206
|
-
this.openDocuments.delete(
|
|
18565
|
+
this.openDocuments.delete(hostUri);
|
|
18207
18566
|
}
|
|
18208
18567
|
/**
|
|
18209
18568
|
* Get the language ID for a file
|
|
18210
18569
|
*/
|
|
18211
18570
|
getLanguageId(filePath) {
|
|
18212
|
-
const ext = (0,
|
|
18571
|
+
const ext = (0, import_path4.parse)(filePath).ext.slice(1).toLowerCase();
|
|
18213
18572
|
const langMap = {
|
|
18214
18573
|
"ts": "typescript",
|
|
18215
18574
|
"tsx": "typescriptreact",
|
|
@@ -18256,7 +18615,7 @@ ${content}`;
|
|
|
18256
18615
|
*/
|
|
18257
18616
|
async prepareDocument(filePath) {
|
|
18258
18617
|
await this.openDocument(filePath);
|
|
18259
|
-
return fileUri(filePath);
|
|
18618
|
+
return this.toServerUri(fileUri(filePath));
|
|
18260
18619
|
}
|
|
18261
18620
|
// LSP Request Methods
|
|
18262
18621
|
/**
|
|
@@ -18264,46 +18623,51 @@ ${content}`;
|
|
|
18264
18623
|
*/
|
|
18265
18624
|
async hover(filePath, line, character) {
|
|
18266
18625
|
const uri = await this.prepareDocument(filePath);
|
|
18267
|
-
|
|
18626
|
+
const result = await this.request("textDocument/hover", {
|
|
18268
18627
|
textDocument: { uri },
|
|
18269
18628
|
position: { line, character }
|
|
18270
18629
|
});
|
|
18630
|
+
return this.translateIncomingPayload(result);
|
|
18271
18631
|
}
|
|
18272
18632
|
/**
|
|
18273
18633
|
* Go to definition
|
|
18274
18634
|
*/
|
|
18275
18635
|
async definition(filePath, line, character) {
|
|
18276
18636
|
const uri = await this.prepareDocument(filePath);
|
|
18277
|
-
|
|
18637
|
+
const result = await this.request("textDocument/definition", {
|
|
18278
18638
|
textDocument: { uri },
|
|
18279
18639
|
position: { line, character }
|
|
18280
18640
|
});
|
|
18641
|
+
return this.translateIncomingPayload(result);
|
|
18281
18642
|
}
|
|
18282
18643
|
/**
|
|
18283
18644
|
* Find all references
|
|
18284
18645
|
*/
|
|
18285
18646
|
async references(filePath, line, character, includeDeclaration = true) {
|
|
18286
18647
|
const uri = await this.prepareDocument(filePath);
|
|
18287
|
-
|
|
18648
|
+
const result = await this.request("textDocument/references", {
|
|
18288
18649
|
textDocument: { uri },
|
|
18289
18650
|
position: { line, character },
|
|
18290
18651
|
context: { includeDeclaration }
|
|
18291
18652
|
});
|
|
18653
|
+
return this.translateIncomingPayload(result);
|
|
18292
18654
|
}
|
|
18293
18655
|
/**
|
|
18294
18656
|
* Get document symbols
|
|
18295
18657
|
*/
|
|
18296
18658
|
async documentSymbols(filePath) {
|
|
18297
18659
|
const uri = await this.prepareDocument(filePath);
|
|
18298
|
-
|
|
18660
|
+
const result = await this.request("textDocument/documentSymbol", {
|
|
18299
18661
|
textDocument: { uri }
|
|
18300
18662
|
});
|
|
18663
|
+
return this.translateIncomingPayload(result);
|
|
18301
18664
|
}
|
|
18302
18665
|
/**
|
|
18303
18666
|
* Search workspace symbols
|
|
18304
18667
|
*/
|
|
18305
18668
|
async workspaceSymbols(query) {
|
|
18306
|
-
|
|
18669
|
+
const result = await this.request("workspace/symbol", { query });
|
|
18670
|
+
return this.translateIncomingPayload(result);
|
|
18307
18671
|
}
|
|
18308
18672
|
/**
|
|
18309
18673
|
* Get diagnostics for a file
|
|
@@ -18323,13 +18687,13 @@ ${content}`;
|
|
|
18323
18687
|
if (this.diagnostics.has(uri)) {
|
|
18324
18688
|
return Promise.resolve();
|
|
18325
18689
|
}
|
|
18326
|
-
return new Promise((
|
|
18690
|
+
return new Promise((resolve7) => {
|
|
18327
18691
|
let resolved = false;
|
|
18328
18692
|
const timer = setTimeout(() => {
|
|
18329
18693
|
if (!resolved) {
|
|
18330
18694
|
resolved = true;
|
|
18331
18695
|
this.diagnosticWaiters.delete(uri);
|
|
18332
|
-
|
|
18696
|
+
resolve7();
|
|
18333
18697
|
}
|
|
18334
18698
|
}, timeoutMs);
|
|
18335
18699
|
const existing = this.diagnosticWaiters.get(uri) || [];
|
|
@@ -18337,7 +18701,7 @@ ${content}`;
|
|
|
18337
18701
|
if (!resolved) {
|
|
18338
18702
|
resolved = true;
|
|
18339
18703
|
clearTimeout(timer);
|
|
18340
|
-
|
|
18704
|
+
resolve7();
|
|
18341
18705
|
}
|
|
18342
18706
|
});
|
|
18343
18707
|
this.diagnosticWaiters.set(uri, existing);
|
|
@@ -18364,30 +18728,76 @@ ${content}`;
|
|
|
18364
18728
|
*/
|
|
18365
18729
|
async rename(filePath, line, character, newName) {
|
|
18366
18730
|
const uri = await this.prepareDocument(filePath);
|
|
18367
|
-
|
|
18731
|
+
const result = await this.request("textDocument/rename", {
|
|
18368
18732
|
textDocument: { uri },
|
|
18369
18733
|
position: { line, character },
|
|
18370
18734
|
newName
|
|
18371
18735
|
});
|
|
18736
|
+
return this.translateIncomingPayload(result);
|
|
18372
18737
|
}
|
|
18373
18738
|
/**
|
|
18374
18739
|
* Get code actions
|
|
18375
18740
|
*/
|
|
18376
18741
|
async codeActions(filePath, range, diagnostics = []) {
|
|
18377
18742
|
const uri = await this.prepareDocument(filePath);
|
|
18378
|
-
|
|
18743
|
+
const result = await this.request("textDocument/codeAction", {
|
|
18379
18744
|
textDocument: { uri },
|
|
18380
18745
|
range,
|
|
18381
18746
|
context: { diagnostics }
|
|
18382
18747
|
});
|
|
18748
|
+
return this.translateIncomingPayload(result);
|
|
18749
|
+
}
|
|
18750
|
+
getServerWorkspaceRoot() {
|
|
18751
|
+
return this.devContainerContext?.containerWorkspaceRoot ?? this.workspaceRoot;
|
|
18752
|
+
}
|
|
18753
|
+
getWorkspaceRootUri() {
|
|
18754
|
+
return this.toServerUri((0, import_url2.pathToFileURL)(this.workspaceRoot).href);
|
|
18755
|
+
}
|
|
18756
|
+
toServerUri(uri) {
|
|
18757
|
+
return hostUriToContainerUri(uri, this.devContainerContext);
|
|
18758
|
+
}
|
|
18759
|
+
toHostUri(uri) {
|
|
18760
|
+
return containerUriToHostUri(uri, this.devContainerContext);
|
|
18761
|
+
}
|
|
18762
|
+
translateIncomingPayload(value) {
|
|
18763
|
+
if (!this.devContainerContext || value == null) {
|
|
18764
|
+
return value;
|
|
18765
|
+
}
|
|
18766
|
+
return this.translateIncomingValue(value);
|
|
18767
|
+
}
|
|
18768
|
+
translateIncomingValue(value) {
|
|
18769
|
+
if (Array.isArray(value)) {
|
|
18770
|
+
return value.map((item) => this.translateIncomingValue(item));
|
|
18771
|
+
}
|
|
18772
|
+
if (!value || typeof value !== "object") {
|
|
18773
|
+
return value;
|
|
18774
|
+
}
|
|
18775
|
+
const record2 = value;
|
|
18776
|
+
const translatedEntries = Object.entries(record2).map(([key, entryValue]) => {
|
|
18777
|
+
if ((key === "uri" || key === "targetUri" || key === "newUri" || key === "oldUri") && typeof entryValue === "string") {
|
|
18778
|
+
return [key, this.toHostUri(entryValue)];
|
|
18779
|
+
}
|
|
18780
|
+
if (key === "changes" && entryValue && typeof entryValue === "object" && !Array.isArray(entryValue)) {
|
|
18781
|
+
const translatedChanges = Object.fromEntries(
|
|
18782
|
+
Object.entries(entryValue).map(([uri, changeValue]) => [
|
|
18783
|
+
this.toHostUri(uri),
|
|
18784
|
+
this.translateIncomingValue(changeValue)
|
|
18785
|
+
])
|
|
18786
|
+
);
|
|
18787
|
+
return [key, translatedChanges];
|
|
18788
|
+
}
|
|
18789
|
+
return [key, this.translateIncomingValue(entryValue)];
|
|
18790
|
+
});
|
|
18791
|
+
return Object.fromEntries(translatedEntries);
|
|
18383
18792
|
}
|
|
18384
18793
|
};
|
|
18385
|
-
var IDLE_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
18386
|
-
var IDLE_CHECK_INTERVAL_MS = 60 * 1e3;
|
|
18794
|
+
var IDLE_TIMEOUT_MS = readPositiveIntEnv("OMC_LSP_IDLE_TIMEOUT_MS", 5 * 60 * 1e3);
|
|
18795
|
+
var IDLE_CHECK_INTERVAL_MS = readPositiveIntEnv("OMC_LSP_IDLE_CHECK_INTERVAL_MS", 60 * 1e3);
|
|
18387
18796
|
var LspClientManager = class {
|
|
18388
18797
|
clients = /* @__PURE__ */ new Map();
|
|
18389
18798
|
lastUsed = /* @__PURE__ */ new Map();
|
|
18390
18799
|
inFlightCount = /* @__PURE__ */ new Map();
|
|
18800
|
+
idleDeadlines = /* @__PURE__ */ new Map();
|
|
18391
18801
|
idleTimer = null;
|
|
18392
18802
|
constructor() {
|
|
18393
18803
|
this.startIdleCheck();
|
|
@@ -18400,6 +18810,14 @@ var LspClientManager = class {
|
|
|
18400
18810
|
*/
|
|
18401
18811
|
registerCleanupHandlers() {
|
|
18402
18812
|
const forceKillAll = () => {
|
|
18813
|
+
if (this.idleTimer) {
|
|
18814
|
+
clearInterval(this.idleTimer);
|
|
18815
|
+
this.idleTimer = null;
|
|
18816
|
+
}
|
|
18817
|
+
for (const timer of this.idleDeadlines.values()) {
|
|
18818
|
+
clearTimeout(timer);
|
|
18819
|
+
}
|
|
18820
|
+
this.idleDeadlines.clear();
|
|
18403
18821
|
for (const client of this.clients.values()) {
|
|
18404
18822
|
try {
|
|
18405
18823
|
client.forceKill();
|
|
@@ -18412,10 +18830,7 @@ var LspClientManager = class {
|
|
|
18412
18830
|
};
|
|
18413
18831
|
process.on("exit", forceKillAll);
|
|
18414
18832
|
for (const sig of ["SIGTERM", "SIGINT", "SIGHUP"]) {
|
|
18415
|
-
process.on(sig,
|
|
18416
|
-
forceKillAll();
|
|
18417
|
-
process.exit(0);
|
|
18418
|
-
});
|
|
18833
|
+
process.on(sig, forceKillAll);
|
|
18419
18834
|
}
|
|
18420
18835
|
}
|
|
18421
18836
|
/**
|
|
@@ -18427,10 +18842,11 @@ var LspClientManager = class {
|
|
|
18427
18842
|
return null;
|
|
18428
18843
|
}
|
|
18429
18844
|
const workspaceRoot = this.findWorkspaceRoot(filePath);
|
|
18430
|
-
const
|
|
18845
|
+
const devContainerContext = resolveDevContainerContext(workspaceRoot);
|
|
18846
|
+
const key = `${workspaceRoot}:${serverConfig.command}:${devContainerContext?.containerId ?? "host"}`;
|
|
18431
18847
|
let client = this.clients.get(key);
|
|
18432
18848
|
if (!client) {
|
|
18433
|
-
client = new LspClient(workspaceRoot, serverConfig);
|
|
18849
|
+
client = new LspClient(workspaceRoot, serverConfig, devContainerContext);
|
|
18434
18850
|
try {
|
|
18435
18851
|
await client.connect();
|
|
18436
18852
|
this.clients.set(key, client);
|
|
@@ -18438,7 +18854,7 @@ var LspClientManager = class {
|
|
|
18438
18854
|
throw error2;
|
|
18439
18855
|
}
|
|
18440
18856
|
}
|
|
18441
|
-
this.
|
|
18857
|
+
this.touchClient(key);
|
|
18442
18858
|
return client;
|
|
18443
18859
|
}
|
|
18444
18860
|
/**
|
|
@@ -18452,10 +18868,11 @@ var LspClientManager = class {
|
|
|
18452
18868
|
throw new Error(`No language server available for: ${filePath}`);
|
|
18453
18869
|
}
|
|
18454
18870
|
const workspaceRoot = this.findWorkspaceRoot(filePath);
|
|
18455
|
-
const
|
|
18871
|
+
const devContainerContext = resolveDevContainerContext(workspaceRoot);
|
|
18872
|
+
const key = `${workspaceRoot}:${serverConfig.command}:${devContainerContext?.containerId ?? "host"}`;
|
|
18456
18873
|
let client = this.clients.get(key);
|
|
18457
18874
|
if (!client) {
|
|
18458
|
-
client = new LspClient(workspaceRoot, serverConfig);
|
|
18875
|
+
client = new LspClient(workspaceRoot, serverConfig, devContainerContext);
|
|
18459
18876
|
try {
|
|
18460
18877
|
await client.connect();
|
|
18461
18878
|
this.clients.set(key, client);
|
|
@@ -18463,7 +18880,7 @@ var LspClientManager = class {
|
|
|
18463
18880
|
throw error2;
|
|
18464
18881
|
}
|
|
18465
18882
|
}
|
|
18466
|
-
this.
|
|
18883
|
+
this.touchClient(key);
|
|
18467
18884
|
this.inFlightCount.set(key, (this.inFlightCount.get(key) || 0) + 1);
|
|
18468
18885
|
try {
|
|
18469
18886
|
return await fn(client);
|
|
@@ -18474,29 +18891,52 @@ var LspClientManager = class {
|
|
|
18474
18891
|
} else {
|
|
18475
18892
|
this.inFlightCount.set(key, count);
|
|
18476
18893
|
}
|
|
18477
|
-
this.
|
|
18894
|
+
this.touchClient(key);
|
|
18478
18895
|
}
|
|
18479
18896
|
}
|
|
18897
|
+
touchClient(key) {
|
|
18898
|
+
this.lastUsed.set(key, Date.now());
|
|
18899
|
+
this.scheduleIdleDeadline(key);
|
|
18900
|
+
}
|
|
18901
|
+
scheduleIdleDeadline(key) {
|
|
18902
|
+
this.clearIdleDeadline(key);
|
|
18903
|
+
const timer = setTimeout(() => {
|
|
18904
|
+
this.idleDeadlines.delete(key);
|
|
18905
|
+
this.evictClientIfIdle(key);
|
|
18906
|
+
}, IDLE_TIMEOUT_MS);
|
|
18907
|
+
if (typeof timer === "object" && "unref" in timer) {
|
|
18908
|
+
timer.unref();
|
|
18909
|
+
}
|
|
18910
|
+
this.idleDeadlines.set(key, timer);
|
|
18911
|
+
}
|
|
18912
|
+
clearIdleDeadline(key) {
|
|
18913
|
+
const timer = this.idleDeadlines.get(key);
|
|
18914
|
+
if (!timer) {
|
|
18915
|
+
return;
|
|
18916
|
+
}
|
|
18917
|
+
clearTimeout(timer);
|
|
18918
|
+
this.idleDeadlines.delete(key);
|
|
18919
|
+
}
|
|
18480
18920
|
/**
|
|
18481
18921
|
* Find the workspace root for a file
|
|
18482
18922
|
*/
|
|
18483
18923
|
findWorkspaceRoot(filePath) {
|
|
18484
|
-
let dir = (0,
|
|
18924
|
+
let dir = (0, import_path4.dirname)((0, import_path4.resolve)(filePath));
|
|
18485
18925
|
const markers = ["package.json", "tsconfig.json", "pyproject.toml", "Cargo.toml", "go.mod", ".git"];
|
|
18486
18926
|
while (true) {
|
|
18487
|
-
const parsed = (0,
|
|
18927
|
+
const parsed = (0, import_path4.parse)(dir);
|
|
18488
18928
|
if (parsed.root === dir) {
|
|
18489
18929
|
break;
|
|
18490
18930
|
}
|
|
18491
18931
|
for (const marker of markers) {
|
|
18492
|
-
const markerPath = (0,
|
|
18493
|
-
if ((0,
|
|
18932
|
+
const markerPath = (0, import_path4.join)(dir, marker);
|
|
18933
|
+
if ((0, import_fs3.existsSync)(markerPath)) {
|
|
18494
18934
|
return dir;
|
|
18495
18935
|
}
|
|
18496
18936
|
}
|
|
18497
|
-
dir = (0,
|
|
18937
|
+
dir = (0, import_path4.dirname)(dir);
|
|
18498
18938
|
}
|
|
18499
|
-
return (0,
|
|
18939
|
+
return (0, import_path4.dirname)((0, import_path4.resolve)(filePath));
|
|
18500
18940
|
}
|
|
18501
18941
|
/**
|
|
18502
18942
|
* Start periodic idle check
|
|
@@ -18515,21 +18955,36 @@ var LspClientManager = class {
|
|
|
18515
18955
|
* Clients with in-flight requests are never evicted.
|
|
18516
18956
|
*/
|
|
18517
18957
|
evictIdleClients() {
|
|
18518
|
-
const
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18958
|
+
for (const key of this.lastUsed.keys()) {
|
|
18959
|
+
this.evictClientIfIdle(key);
|
|
18960
|
+
}
|
|
18961
|
+
}
|
|
18962
|
+
evictClientIfIdle(key) {
|
|
18963
|
+
const lastUsedTime = this.lastUsed.get(key);
|
|
18964
|
+
if (lastUsedTime === void 0) {
|
|
18965
|
+
this.clearIdleDeadline(key);
|
|
18966
|
+
return;
|
|
18967
|
+
}
|
|
18968
|
+
const idleFor = Date.now() - lastUsedTime;
|
|
18969
|
+
if (idleFor <= IDLE_TIMEOUT_MS) {
|
|
18970
|
+
const hasDeadline = this.idleDeadlines.has(key);
|
|
18971
|
+
if (!hasDeadline) {
|
|
18972
|
+
this.scheduleIdleDeadline(key);
|
|
18532
18973
|
}
|
|
18974
|
+
return;
|
|
18975
|
+
}
|
|
18976
|
+
if ((this.inFlightCount.get(key) || 0) > 0) {
|
|
18977
|
+
this.scheduleIdleDeadline(key);
|
|
18978
|
+
return;
|
|
18979
|
+
}
|
|
18980
|
+
const client = this.clients.get(key);
|
|
18981
|
+
this.clearIdleDeadline(key);
|
|
18982
|
+
this.clients.delete(key);
|
|
18983
|
+
this.lastUsed.delete(key);
|
|
18984
|
+
this.inFlightCount.delete(key);
|
|
18985
|
+
if (client) {
|
|
18986
|
+
client.disconnect().catch(() => {
|
|
18987
|
+
});
|
|
18533
18988
|
}
|
|
18534
18989
|
}
|
|
18535
18990
|
/**
|
|
@@ -18542,6 +18997,10 @@ var LspClientManager = class {
|
|
|
18542
18997
|
clearInterval(this.idleTimer);
|
|
18543
18998
|
this.idleTimer = null;
|
|
18544
18999
|
}
|
|
19000
|
+
for (const timer of this.idleDeadlines.values()) {
|
|
19001
|
+
clearTimeout(timer);
|
|
19002
|
+
}
|
|
19003
|
+
this.idleDeadlines.clear();
|
|
18545
19004
|
const entries = Array.from(this.clients.entries());
|
|
18546
19005
|
const results = await Promise.allSettled(
|
|
18547
19006
|
entries.map(([, client]) => client.disconnect())
|
|
@@ -18570,7 +19029,9 @@ var LspClientManager = class {
|
|
|
18570
19029
|
this.evictIdleClients();
|
|
18571
19030
|
}
|
|
18572
19031
|
};
|
|
18573
|
-
var
|
|
19032
|
+
var LSP_CLIENT_MANAGER_KEY = "__omcLspClientManager";
|
|
19033
|
+
var globalWithLspClientManager = globalThis;
|
|
19034
|
+
var lspClientManager = globalWithLspClientManager[LSP_CLIENT_MANAGER_KEY] ?? (globalWithLspClientManager[LSP_CLIENT_MANAGER_KEY] = new LspClientManager());
|
|
18574
19035
|
async function disconnectAll() {
|
|
18575
19036
|
return lspClientManager.disconnectAll();
|
|
18576
19037
|
}
|
|
@@ -18612,7 +19073,11 @@ var SEVERITY_NAMES = {
|
|
|
18612
19073
|
};
|
|
18613
19074
|
function uriToPath(uri) {
|
|
18614
19075
|
if (uri.startsWith("file://")) {
|
|
18615
|
-
|
|
19076
|
+
try {
|
|
19077
|
+
return decodeURIComponent(uri.slice(7));
|
|
19078
|
+
} catch {
|
|
19079
|
+
return uri.slice(7);
|
|
19080
|
+
}
|
|
18616
19081
|
}
|
|
18617
19082
|
return uri;
|
|
18618
19083
|
}
|
|
@@ -18627,11 +19092,11 @@ function formatRange(range) {
|
|
|
18627
19092
|
function formatLocation(location) {
|
|
18628
19093
|
const uri = location.uri || location.targetUri;
|
|
18629
19094
|
if (!uri) return "Unknown location";
|
|
18630
|
-
const
|
|
19095
|
+
const path13 = uriToPath(uri);
|
|
18631
19096
|
const locationRange = location.range || location.targetRange || location.targetSelectionRange;
|
|
18632
|
-
if (!locationRange) return
|
|
19097
|
+
if (!locationRange) return path13;
|
|
18633
19098
|
const range = formatRange(locationRange);
|
|
18634
|
-
return `${
|
|
19099
|
+
return `${path13}:${range}`;
|
|
18635
19100
|
}
|
|
18636
19101
|
function formatHover(hover) {
|
|
18637
19102
|
if (!hover) return "No hover information available";
|
|
@@ -18717,8 +19182,8 @@ function formatWorkspaceEdit(edit) {
|
|
|
18717
19182
|
const lines = [];
|
|
18718
19183
|
if (edit.changes) {
|
|
18719
19184
|
for (const [uri, changes] of Object.entries(edit.changes)) {
|
|
18720
|
-
const
|
|
18721
|
-
lines.push(`File: ${
|
|
19185
|
+
const path13 = uriToPath(uri);
|
|
19186
|
+
lines.push(`File: ${path13}`);
|
|
18722
19187
|
for (const change of changes) {
|
|
18723
19188
|
const range = formatRange(change.range);
|
|
18724
19189
|
const preview = change.newText.length > 50 ? change.newText.slice(0, 50) + "..." : change.newText;
|
|
@@ -18728,8 +19193,8 @@ function formatWorkspaceEdit(edit) {
|
|
|
18728
19193
|
}
|
|
18729
19194
|
if (edit.documentChanges) {
|
|
18730
19195
|
for (const docChange of edit.documentChanges) {
|
|
18731
|
-
const
|
|
18732
|
-
lines.push(`File: ${
|
|
19196
|
+
const path13 = uriToPath(docChange.textDocument.uri);
|
|
19197
|
+
lines.push(`File: ${path13}`);
|
|
18733
19198
|
for (const change of docChange.edits) {
|
|
18734
19199
|
const range = formatRange(change.range);
|
|
18735
19200
|
const preview = change.newText.length > 50 ? change.newText.slice(0, 50) + "..." : change.newText;
|
|
@@ -18755,16 +19220,16 @@ function countEdits(edit) {
|
|
|
18755
19220
|
}
|
|
18756
19221
|
|
|
18757
19222
|
// src/tools/diagnostics/index.ts
|
|
18758
|
-
var
|
|
18759
|
-
var
|
|
19223
|
+
var import_fs6 = require("fs");
|
|
19224
|
+
var import_path7 = require("path");
|
|
18760
19225
|
|
|
18761
19226
|
// src/tools/diagnostics/tsc-runner.ts
|
|
18762
|
-
var
|
|
18763
|
-
var
|
|
18764
|
-
var
|
|
19227
|
+
var import_child_process4 = require("child_process");
|
|
19228
|
+
var import_fs4 = require("fs");
|
|
19229
|
+
var import_path5 = require("path");
|
|
18765
19230
|
function runTscDiagnostics(directory) {
|
|
18766
|
-
const tsconfigPath = (0,
|
|
18767
|
-
if (!(0,
|
|
19231
|
+
const tsconfigPath = (0, import_path5.join)(directory, "tsconfig.json");
|
|
19232
|
+
if (!(0, import_fs4.existsSync)(tsconfigPath)) {
|
|
18768
19233
|
return {
|
|
18769
19234
|
success: true,
|
|
18770
19235
|
diagnostics: [],
|
|
@@ -18773,7 +19238,7 @@ function runTscDiagnostics(directory) {
|
|
|
18773
19238
|
};
|
|
18774
19239
|
}
|
|
18775
19240
|
try {
|
|
18776
|
-
(0,
|
|
19241
|
+
(0, import_child_process4.execFileSync)("tsc", ["--noEmit", "--pretty", "false"], {
|
|
18777
19242
|
cwd: directory,
|
|
18778
19243
|
encoding: "utf-8",
|
|
18779
19244
|
stdio: "pipe"
|
|
@@ -18814,24 +19279,24 @@ function parseTscOutput(output) {
|
|
|
18814
19279
|
}
|
|
18815
19280
|
|
|
18816
19281
|
// src/tools/diagnostics/lsp-aggregator.ts
|
|
18817
|
-
var
|
|
18818
|
-
var
|
|
19282
|
+
var import_fs5 = require("fs");
|
|
19283
|
+
var import_path6 = require("path");
|
|
18819
19284
|
function findFiles(directory, extensions, ignoreDirs = []) {
|
|
18820
19285
|
const results = [];
|
|
18821
19286
|
const ignoreDirSet = new Set(ignoreDirs);
|
|
18822
19287
|
function walk(dir) {
|
|
18823
19288
|
try {
|
|
18824
|
-
const entries = (0,
|
|
19289
|
+
const entries = (0, import_fs5.readdirSync)(dir);
|
|
18825
19290
|
for (const entry of entries) {
|
|
18826
|
-
const fullPath = (0,
|
|
19291
|
+
const fullPath = (0, import_path6.join)(dir, entry);
|
|
18827
19292
|
try {
|
|
18828
|
-
const stat = (0,
|
|
19293
|
+
const stat = (0, import_fs5.statSync)(fullPath);
|
|
18829
19294
|
if (stat.isDirectory()) {
|
|
18830
19295
|
if (!ignoreDirSet.has(entry)) {
|
|
18831
19296
|
walk(fullPath);
|
|
18832
19297
|
}
|
|
18833
19298
|
} else if (stat.isFile()) {
|
|
18834
|
-
const ext = (0,
|
|
19299
|
+
const ext = (0, import_path6.extname)(fullPath);
|
|
18835
19300
|
if (extensions.includes(ext)) {
|
|
18836
19301
|
results.push(fullPath);
|
|
18837
19302
|
}
|
|
@@ -18883,8 +19348,8 @@ async function runLspAggregatedDiagnostics(directory, extensions = [".ts", ".tsx
|
|
|
18883
19348
|
// src/tools/diagnostics/index.ts
|
|
18884
19349
|
var LSP_DIAGNOSTICS_WAIT_MS = 300;
|
|
18885
19350
|
async function runDirectoryDiagnostics(directory, strategy = "auto") {
|
|
18886
|
-
const tsconfigPath = (0,
|
|
18887
|
-
const hasTsconfig = (0,
|
|
19351
|
+
const tsconfigPath = (0, import_path7.join)(directory, "tsconfig.json");
|
|
19352
|
+
const hasTsconfig = (0, import_fs6.existsSync)(tsconfigPath);
|
|
18888
19353
|
let useStrategy;
|
|
18889
19354
|
if (strategy === "auto") {
|
|
18890
19355
|
useStrategy = hasTsconfig ? "tsc" : "lsp";
|
|
@@ -19109,7 +19574,7 @@ var lspDiagnosticsTool = {
|
|
|
19109
19574
|
const { file, severity } = args;
|
|
19110
19575
|
return withLspClient(file, "diagnostics", async (client) => {
|
|
19111
19576
|
await client.openDocument(file);
|
|
19112
|
-
await new Promise((
|
|
19577
|
+
await new Promise((resolve7) => setTimeout(resolve7, LSP_DIAGNOSTICS_WAIT_MS));
|
|
19113
19578
|
let diagnostics = client.getDiagnostics(file);
|
|
19114
19579
|
if (severity) {
|
|
19115
19580
|
const severityMap = {
|
|
@@ -19338,8 +19803,8 @@ var lspTools = [
|
|
|
19338
19803
|
];
|
|
19339
19804
|
|
|
19340
19805
|
// src/tools/ast-tools.ts
|
|
19341
|
-
var
|
|
19342
|
-
var
|
|
19806
|
+
var import_fs7 = require("fs");
|
|
19807
|
+
var import_path8 = require("path");
|
|
19343
19808
|
var import_module = require("module");
|
|
19344
19809
|
var import_meta = {};
|
|
19345
19810
|
var sgModule = null;
|
|
@@ -19447,10 +19912,10 @@ function getFilesForLanguage(dirPath, language, maxFiles = 1e3) {
|
|
|
19447
19912
|
function walk(dir) {
|
|
19448
19913
|
if (files.length >= maxFiles) return;
|
|
19449
19914
|
try {
|
|
19450
|
-
const entries = (0,
|
|
19915
|
+
const entries = (0, import_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
19451
19916
|
for (const entry of entries) {
|
|
19452
19917
|
if (files.length >= maxFiles) return;
|
|
19453
|
-
const fullPath = (0,
|
|
19918
|
+
const fullPath = (0, import_path8.join)(dir, entry.name);
|
|
19454
19919
|
if (entry.isDirectory()) {
|
|
19455
19920
|
if (![
|
|
19456
19921
|
"node_modules",
|
|
@@ -19464,7 +19929,7 @@ function getFilesForLanguage(dirPath, language, maxFiles = 1e3) {
|
|
|
19464
19929
|
walk(fullPath);
|
|
19465
19930
|
}
|
|
19466
19931
|
} else if (entry.isFile()) {
|
|
19467
|
-
const ext = (0,
|
|
19932
|
+
const ext = (0, import_path8.extname)(entry.name).toLowerCase();
|
|
19468
19933
|
if (extensions.includes(ext)) {
|
|
19469
19934
|
files.push(fullPath);
|
|
19470
19935
|
}
|
|
@@ -19473,8 +19938,13 @@ function getFilesForLanguage(dirPath, language, maxFiles = 1e3) {
|
|
|
19473
19938
|
} catch {
|
|
19474
19939
|
}
|
|
19475
19940
|
}
|
|
19476
|
-
const resolvedPath = (0,
|
|
19477
|
-
|
|
19941
|
+
const resolvedPath = (0, import_path8.resolve)(dirPath);
|
|
19942
|
+
let stat;
|
|
19943
|
+
try {
|
|
19944
|
+
stat = (0, import_fs7.statSync)(resolvedPath);
|
|
19945
|
+
} catch (err) {
|
|
19946
|
+
throw new Error(`Cannot access path "${resolvedPath}": ${err.message}`);
|
|
19947
|
+
}
|
|
19478
19948
|
if (stat.isFile()) {
|
|
19479
19949
|
return [resolvedPath];
|
|
19480
19950
|
}
|
|
@@ -19522,7 +19992,7 @@ Note: Patterns must be valid AST nodes for the language.`,
|
|
|
19522
19992
|
const {
|
|
19523
19993
|
pattern,
|
|
19524
19994
|
language,
|
|
19525
|
-
path:
|
|
19995
|
+
path: path13 = ".",
|
|
19526
19996
|
context = 2,
|
|
19527
19997
|
maxResults = 20
|
|
19528
19998
|
} = args;
|
|
@@ -19539,13 +20009,13 @@ Error: ${sgLoadError}`
|
|
|
19539
20009
|
]
|
|
19540
20010
|
};
|
|
19541
20011
|
}
|
|
19542
|
-
const files = getFilesForLanguage(
|
|
20012
|
+
const files = getFilesForLanguage(path13, language);
|
|
19543
20013
|
if (files.length === 0) {
|
|
19544
20014
|
return {
|
|
19545
20015
|
content: [
|
|
19546
20016
|
{
|
|
19547
20017
|
type: "text",
|
|
19548
|
-
text: `No ${language} files found in ${
|
|
20018
|
+
text: `No ${language} files found in ${path13}`
|
|
19549
20019
|
}
|
|
19550
20020
|
]
|
|
19551
20021
|
};
|
|
@@ -19555,7 +20025,7 @@ Error: ${sgLoadError}`
|
|
|
19555
20025
|
for (const filePath of files) {
|
|
19556
20026
|
if (totalMatches >= maxResults) break;
|
|
19557
20027
|
try {
|
|
19558
|
-
const content = (0,
|
|
20028
|
+
const content = (0, import_fs7.readFileSync)(filePath, "utf-8");
|
|
19559
20029
|
const root = sg.parse(toLangEnum(sg, language), content).root();
|
|
19560
20030
|
const matches = root.findAll(pattern);
|
|
19561
20031
|
for (const match of matches) {
|
|
@@ -19585,7 +20055,7 @@ Error: ${sgLoadError}`
|
|
|
19585
20055
|
type: "text",
|
|
19586
20056
|
text: `No matches found for pattern: ${pattern}
|
|
19587
20057
|
|
|
19588
|
-
Searched ${files.length} ${language} file(s) in ${
|
|
20058
|
+
Searched ${files.length} ${language} file(s) in ${path13}
|
|
19589
20059
|
|
|
19590
20060
|
Tip: Ensure the pattern is a valid AST node. For example:
|
|
19591
20061
|
- Use "function $NAME" not just "$NAME"
|
|
@@ -19645,7 +20115,7 @@ IMPORTANT: dryRun=true (default) only previews changes. Set dryRun=false to appl
|
|
|
19645
20115
|
dryRun: external_exports.boolean().optional().describe("Preview only, don't apply changes (default: true)")
|
|
19646
20116
|
},
|
|
19647
20117
|
handler: async (args) => {
|
|
19648
|
-
const { pattern, replacement, language, path:
|
|
20118
|
+
const { pattern, replacement, language, path: path13 = ".", dryRun = true } = args;
|
|
19649
20119
|
try {
|
|
19650
20120
|
const sg = await getSgModule();
|
|
19651
20121
|
if (!sg) {
|
|
@@ -19659,13 +20129,13 @@ Error: ${sgLoadError}`
|
|
|
19659
20129
|
]
|
|
19660
20130
|
};
|
|
19661
20131
|
}
|
|
19662
|
-
const files = getFilesForLanguage(
|
|
20132
|
+
const files = getFilesForLanguage(path13, language);
|
|
19663
20133
|
if (files.length === 0) {
|
|
19664
20134
|
return {
|
|
19665
20135
|
content: [
|
|
19666
20136
|
{
|
|
19667
20137
|
type: "text",
|
|
19668
|
-
text: `No ${language} files found in ${
|
|
20138
|
+
text: `No ${language} files found in ${path13}`
|
|
19669
20139
|
}
|
|
19670
20140
|
]
|
|
19671
20141
|
};
|
|
@@ -19674,7 +20144,7 @@ Error: ${sgLoadError}`
|
|
|
19674
20144
|
let totalReplacements = 0;
|
|
19675
20145
|
for (const filePath of files) {
|
|
19676
20146
|
try {
|
|
19677
|
-
const content = (0,
|
|
20147
|
+
const content = (0, import_fs7.readFileSync)(filePath, "utf-8");
|
|
19678
20148
|
const root = sg.parse(toLangEnum(sg, language), content).root();
|
|
19679
20149
|
const matches = root.findAll(pattern);
|
|
19680
20150
|
if (matches.length === 0) continue;
|
|
@@ -19691,9 +20161,10 @@ Error: ${sgLoadError}`
|
|
|
19691
20161
|
const varName = metaVar.replace(/^\$+/, "");
|
|
19692
20162
|
const captured = match.getMatch(varName);
|
|
19693
20163
|
if (captured) {
|
|
20164
|
+
const safeText = captured.text().replace(/\$/g, "$$$$");
|
|
19694
20165
|
finalReplacement = finalReplacement.replaceAll(
|
|
19695
20166
|
metaVar,
|
|
19696
|
-
|
|
20167
|
+
safeText
|
|
19697
20168
|
);
|
|
19698
20169
|
}
|
|
19699
20170
|
}
|
|
@@ -19721,7 +20192,7 @@ Error: ${sgLoadError}`
|
|
|
19721
20192
|
totalReplacements++;
|
|
19722
20193
|
}
|
|
19723
20194
|
if (!dryRun && edits.length > 0) {
|
|
19724
|
-
(0,
|
|
20195
|
+
(0, import_fs7.writeFileSync)(filePath, newContent, "utf-8");
|
|
19725
20196
|
}
|
|
19726
20197
|
} catch {
|
|
19727
20198
|
}
|
|
@@ -19733,7 +20204,7 @@ Error: ${sgLoadError}`
|
|
|
19733
20204
|
type: "text",
|
|
19734
20205
|
text: `No matches found for pattern: ${pattern}
|
|
19735
20206
|
|
|
19736
|
-
Searched ${files.length} ${language} file(s) in ${
|
|
20207
|
+
Searched ${files.length} ${language} file(s) in ${path13}`
|
|
19737
20208
|
}
|
|
19738
20209
|
]
|
|
19739
20210
|
};
|
|
@@ -19885,7 +20356,7 @@ var fsSync2 = __toESM(require("fs"), 1);
|
|
|
19885
20356
|
var path4 = __toESM(require("path"), 1);
|
|
19886
20357
|
var os2 = __toESM(require("os"), 1);
|
|
19887
20358
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
19888
|
-
var
|
|
20359
|
+
var import_child_process6 = require("child_process");
|
|
19889
20360
|
var import_util6 = require("util");
|
|
19890
20361
|
|
|
19891
20362
|
// src/lib/atomic-write.ts
|
|
@@ -19998,19 +20469,22 @@ async function safeReadJson(filePath) {
|
|
|
19998
20469
|
|
|
19999
20470
|
// src/platform/index.ts
|
|
20000
20471
|
var path3 = __toESM(require("path"), 1);
|
|
20001
|
-
var
|
|
20472
|
+
var import_fs8 = require("fs");
|
|
20002
20473
|
|
|
20003
20474
|
// src/platform/process-utils.ts
|
|
20004
|
-
var
|
|
20475
|
+
var import_child_process5 = require("child_process");
|
|
20005
20476
|
var import_util5 = require("util");
|
|
20006
20477
|
var fsPromises = __toESM(require("fs/promises"), 1);
|
|
20007
|
-
var execFileAsync = (0, import_util5.promisify)(
|
|
20478
|
+
var execFileAsync = (0, import_util5.promisify)(import_child_process5.execFile);
|
|
20008
20479
|
function isProcessAlive(pid) {
|
|
20009
20480
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
20010
20481
|
try {
|
|
20011
20482
|
process.kill(pid, 0);
|
|
20012
20483
|
return true;
|
|
20013
|
-
} catch {
|
|
20484
|
+
} catch (e) {
|
|
20485
|
+
if (e && typeof e === "object" && "code" in e && e.code === "EPERM") {
|
|
20486
|
+
return true;
|
|
20487
|
+
}
|
|
20014
20488
|
return false;
|
|
20015
20489
|
}
|
|
20016
20490
|
}
|
|
@@ -20130,7 +20604,7 @@ async function getProcessStartTimeLinux(pid) {
|
|
|
20130
20604
|
var PLATFORM = process.platform;
|
|
20131
20605
|
|
|
20132
20606
|
// src/tools/python-repl/session-lock.ts
|
|
20133
|
-
var execFileAsync2 = (0, import_util6.promisify)(
|
|
20607
|
+
var execFileAsync2 = (0, import_util6.promisify)(import_child_process6.execFile);
|
|
20134
20608
|
var STALE_LOCK_AGE_MS = 6e4;
|
|
20135
20609
|
var DEFAULT_ACQUIRE_TIMEOUT_MS = 3e4;
|
|
20136
20610
|
var LOCK_RETRY_INTERVAL_MS = 100;
|
|
@@ -20436,7 +20910,7 @@ var SessionLock = class {
|
|
|
20436
20910
|
}
|
|
20437
20911
|
};
|
|
20438
20912
|
function sleep(ms) {
|
|
20439
|
-
return new Promise((
|
|
20913
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
20440
20914
|
}
|
|
20441
20915
|
|
|
20442
20916
|
// src/tools/python-repl/socket-client.ts
|
|
@@ -20466,7 +20940,7 @@ var JsonRpcError = class extends Error {
|
|
|
20466
20940
|
}
|
|
20467
20941
|
};
|
|
20468
20942
|
async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
20469
|
-
return new Promise((
|
|
20943
|
+
return new Promise((resolve7, reject) => {
|
|
20470
20944
|
const id = (0, import_crypto.randomUUID)();
|
|
20471
20945
|
const request = {
|
|
20472
20946
|
jsonrpc: "2.0",
|
|
@@ -20477,9 +20951,11 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20477
20951
|
const requestLine = JSON.stringify(request) + "\n";
|
|
20478
20952
|
let responseBuffer = "";
|
|
20479
20953
|
let timedOut = false;
|
|
20954
|
+
let settled = false;
|
|
20480
20955
|
const MAX_RESPONSE_SIZE = 2 * 1024 * 1024;
|
|
20481
20956
|
const timer = setTimeout(() => {
|
|
20482
20957
|
timedOut = true;
|
|
20958
|
+
settled = true;
|
|
20483
20959
|
socket.destroy();
|
|
20484
20960
|
reject(new SocketTimeoutError(
|
|
20485
20961
|
`Request timeout after ${timeout}ms for method "${method}"`,
|
|
@@ -20494,6 +20970,10 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20494
20970
|
let socket;
|
|
20495
20971
|
if (socketPath.startsWith("tcp:")) {
|
|
20496
20972
|
const port = parseInt(socketPath.slice(4), 10);
|
|
20973
|
+
if (isNaN(port) || port <= 0 || port > 65535) {
|
|
20974
|
+
reject(new Error(`Invalid TCP port in socketPath: "${socketPath}"`));
|
|
20975
|
+
return;
|
|
20976
|
+
}
|
|
20497
20977
|
socket = net.createConnection({ host: "127.0.0.1", port });
|
|
20498
20978
|
} else {
|
|
20499
20979
|
socket = net.createConnection({ path: socketPath });
|
|
@@ -20504,10 +20984,13 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20504
20984
|
socket.on("data", (chunk) => {
|
|
20505
20985
|
responseBuffer += chunk.toString();
|
|
20506
20986
|
if (responseBuffer.length > MAX_RESPONSE_SIZE) {
|
|
20507
|
-
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
|
|
20987
|
+
if (!settled) {
|
|
20988
|
+
settled = true;
|
|
20989
|
+
cleanup();
|
|
20990
|
+
reject(new Error(
|
|
20991
|
+
`Response exceeded maximum size of ${MAX_RESPONSE_SIZE} bytes`
|
|
20992
|
+
));
|
|
20993
|
+
}
|
|
20511
20994
|
return;
|
|
20512
20995
|
}
|
|
20513
20996
|
const newlineIndex = responseBuffer.indexOf("\n");
|
|
@@ -20517,30 +21000,45 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20517
21000
|
try {
|
|
20518
21001
|
const response = JSON.parse(jsonLine);
|
|
20519
21002
|
if (response.jsonrpc !== "2.0") {
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
21003
|
+
if (!settled) {
|
|
21004
|
+
settled = true;
|
|
21005
|
+
reject(new Error(
|
|
21006
|
+
`Invalid JSON-RPC version: expected "2.0", got "${response.jsonrpc}"`
|
|
21007
|
+
));
|
|
21008
|
+
}
|
|
20523
21009
|
return;
|
|
20524
21010
|
}
|
|
20525
21011
|
if (response.id !== id) {
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
21012
|
+
if (!settled) {
|
|
21013
|
+
settled = true;
|
|
21014
|
+
reject(new Error(
|
|
21015
|
+
`Response ID mismatch: expected "${id}", got "${response.id}"`
|
|
21016
|
+
));
|
|
21017
|
+
}
|
|
20529
21018
|
return;
|
|
20530
21019
|
}
|
|
20531
21020
|
if (response.error) {
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
21021
|
+
if (!settled) {
|
|
21022
|
+
settled = true;
|
|
21023
|
+
reject(new JsonRpcError(
|
|
21024
|
+
response.error.message,
|
|
21025
|
+
response.error.code,
|
|
21026
|
+
response.error.data
|
|
21027
|
+
));
|
|
21028
|
+
}
|
|
20537
21029
|
return;
|
|
20538
21030
|
}
|
|
20539
|
-
|
|
21031
|
+
if (!settled) {
|
|
21032
|
+
settled = true;
|
|
21033
|
+
resolve7(response.result);
|
|
21034
|
+
}
|
|
20540
21035
|
} catch (e) {
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
21036
|
+
if (!settled) {
|
|
21037
|
+
settled = true;
|
|
21038
|
+
reject(new Error(
|
|
21039
|
+
`Failed to parse JSON-RPC response: ${e.message}`
|
|
21040
|
+
));
|
|
21041
|
+
}
|
|
20544
21042
|
}
|
|
20545
21043
|
}
|
|
20546
21044
|
});
|
|
@@ -20548,6 +21046,8 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20548
21046
|
if (timedOut) {
|
|
20549
21047
|
return;
|
|
20550
21048
|
}
|
|
21049
|
+
if (settled) return;
|
|
21050
|
+
settled = true;
|
|
20551
21051
|
cleanup();
|
|
20552
21052
|
if (err.code === "ENOENT") {
|
|
20553
21053
|
reject(new SocketConnectionError(
|
|
@@ -20573,6 +21073,8 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20573
21073
|
if (timedOut) {
|
|
20574
21074
|
return;
|
|
20575
21075
|
}
|
|
21076
|
+
if (settled) return;
|
|
21077
|
+
settled = true;
|
|
20576
21078
|
if (responseBuffer.indexOf("\n") === -1) {
|
|
20577
21079
|
cleanup();
|
|
20578
21080
|
reject(new Error(
|
|
@@ -20584,26 +21086,40 @@ async function sendSocketRequest(socketPath, method, params, timeout = 6e4) {
|
|
|
20584
21086
|
}
|
|
20585
21087
|
|
|
20586
21088
|
// src/tools/python-repl/bridge-manager.ts
|
|
20587
|
-
var
|
|
21089
|
+
var import_child_process7 = require("child_process");
|
|
20588
21090
|
var fs4 = __toESM(require("fs"), 1);
|
|
20589
21091
|
var fsPromises2 = __toESM(require("fs/promises"), 1);
|
|
20590
21092
|
var path5 = __toESM(require("path"), 1);
|
|
20591
|
-
var
|
|
20592
|
-
var
|
|
21093
|
+
var import_url3 = require("url");
|
|
21094
|
+
var import_child_process8 = require("child_process");
|
|
20593
21095
|
var import_util7 = require("util");
|
|
20594
21096
|
var import_meta2 = {};
|
|
20595
|
-
var execFileAsync3 = (0, import_util7.promisify)(
|
|
21097
|
+
var execFileAsync3 = (0, import_util7.promisify)(import_child_process8.execFile);
|
|
20596
21098
|
var BRIDGE_SPAWN_TIMEOUT_MS = 3e4;
|
|
20597
21099
|
var DEFAULT_GRACE_PERIOD_MS = 5e3;
|
|
20598
21100
|
var SIGTERM_GRACE_MS = 2500;
|
|
21101
|
+
var ownedBridgeSessionIds = /* @__PURE__ */ new Set();
|
|
21102
|
+
function trackOwnedBridgeSession(sessionId) {
|
|
21103
|
+
if (sessionId) {
|
|
21104
|
+
ownedBridgeSessionIds.add(sessionId);
|
|
21105
|
+
}
|
|
21106
|
+
}
|
|
20599
21107
|
function getBridgeScriptPath() {
|
|
20600
21108
|
if (process.env.OMC_BRIDGE_SCRIPT) {
|
|
20601
|
-
|
|
21109
|
+
const override = path5.resolve(process.env.OMC_BRIDGE_SCRIPT);
|
|
21110
|
+
const overrideBasename = path5.basename(override);
|
|
21111
|
+
if (overrideBasename !== "gyoshu_bridge.py") {
|
|
21112
|
+
throw new Error(`OMC_BRIDGE_SCRIPT must point to gyoshu_bridge.py, got: ${overrideBasename}`);
|
|
21113
|
+
}
|
|
21114
|
+
if (!fs4.existsSync(override)) {
|
|
21115
|
+
throw new Error(`OMC_BRIDGE_SCRIPT file not found: ${override}`);
|
|
21116
|
+
}
|
|
21117
|
+
return override;
|
|
20602
21118
|
}
|
|
20603
21119
|
let moduleDir;
|
|
20604
21120
|
try {
|
|
20605
21121
|
if (import_meta2.url) {
|
|
20606
|
-
const __filename2 = (0,
|
|
21122
|
+
const __filename2 = (0, import_url3.fileURLToPath)(import_meta2.url);
|
|
20607
21123
|
moduleDir = path5.dirname(__filename2);
|
|
20608
21124
|
} else {
|
|
20609
21125
|
throw new Error("import.meta.url is empty");
|
|
@@ -20714,7 +21230,7 @@ function killProcessGroup(pid, signal) {
|
|
|
20714
21230
|
try {
|
|
20715
21231
|
const force = signal === "SIGKILL";
|
|
20716
21232
|
const args = force ? "/F /T" : "/T";
|
|
20717
|
-
(0,
|
|
21233
|
+
(0, import_child_process7.execSync)(
|
|
20718
21234
|
`taskkill ${args} /PID ${pid}`,
|
|
20719
21235
|
{ stdio: "ignore", timeout: 5e3, windowsHide: true }
|
|
20720
21236
|
);
|
|
@@ -20751,10 +21267,14 @@ async function spawnBridgeServer(sessionId, projectDir) {
|
|
|
20751
21267
|
const effectiveProjectDir = projectDir || process.cwd();
|
|
20752
21268
|
const pythonEnv = await ensurePythonEnvironment(effectiveProjectDir);
|
|
20753
21269
|
const bridgeArgs = [bridgePath, socketPath];
|
|
20754
|
-
const proc = (0,
|
|
21270
|
+
const proc = (0, import_child_process7.spawn)(pythonEnv.pythonPath, bridgeArgs, {
|
|
20755
21271
|
stdio: ["ignore", "ignore", "pipe"],
|
|
20756
21272
|
cwd: effectiveProjectDir,
|
|
20757
|
-
env: {
|
|
21273
|
+
env: {
|
|
21274
|
+
...process.env,
|
|
21275
|
+
PYTHONUNBUFFERED: "1",
|
|
21276
|
+
OMC_PARENT_PID: String(process.pid)
|
|
21277
|
+
},
|
|
20758
21278
|
detached: true
|
|
20759
21279
|
});
|
|
20760
21280
|
proc.unref();
|
|
@@ -20813,6 +21333,9 @@ async function spawnBridgeServer(sessionId, projectDir) {
|
|
|
20813
21333
|
}
|
|
20814
21334
|
effectiveSocketPath = `tcp:${port}`;
|
|
20815
21335
|
}
|
|
21336
|
+
if (proc.pid === void 0) {
|
|
21337
|
+
throw new Error("Bridge process failed to spawn: pid is undefined");
|
|
21338
|
+
}
|
|
20816
21339
|
const meta = {
|
|
20817
21340
|
pid: proc.pid,
|
|
20818
21341
|
socketPath: effectiveSocketPath,
|
|
@@ -20823,6 +21346,7 @@ async function spawnBridgeServer(sessionId, projectDir) {
|
|
|
20823
21346
|
};
|
|
20824
21347
|
const metaPath = getBridgeMetaPath(sessionId);
|
|
20825
21348
|
await atomicWriteJson(metaPath, meta);
|
|
21349
|
+
trackOwnedBridgeSession(sessionId);
|
|
20826
21350
|
return meta;
|
|
20827
21351
|
}
|
|
20828
21352
|
async function ensureBridge(sessionId, projectDir) {
|
|
@@ -20863,14 +21387,17 @@ async function killBridgeWithEscalation(sessionId, options) {
|
|
|
20863
21387
|
const metaPath = getBridgeMetaPath(sessionId);
|
|
20864
21388
|
const meta = await safeReadJson(metaPath);
|
|
20865
21389
|
if (!meta || !isValidBridgeMeta(meta)) {
|
|
21390
|
+
ownedBridgeSessionIds.delete(sessionId);
|
|
20866
21391
|
return { terminated: true };
|
|
20867
21392
|
}
|
|
20868
21393
|
if (meta.sessionId !== sessionId) {
|
|
20869
21394
|
await deleteBridgeMeta(sessionId);
|
|
21395
|
+
ownedBridgeSessionIds.delete(sessionId);
|
|
20870
21396
|
return { terminated: true };
|
|
20871
21397
|
}
|
|
20872
21398
|
if (!await verifyProcessIdentity(meta)) {
|
|
20873
21399
|
await deleteBridgeMeta(sessionId);
|
|
21400
|
+
ownedBridgeSessionIds.delete(sessionId);
|
|
20874
21401
|
return { terminated: true };
|
|
20875
21402
|
}
|
|
20876
21403
|
const waitForExit = async (timeoutMs) => {
|
|
@@ -20896,6 +21423,7 @@ async function killBridgeWithEscalation(sessionId, options) {
|
|
|
20896
21423
|
}
|
|
20897
21424
|
}
|
|
20898
21425
|
await deleteBridgeMeta(sessionId);
|
|
21426
|
+
ownedBridgeSessionIds.delete(sessionId);
|
|
20899
21427
|
const sessionDir = getSessionDir(sessionId);
|
|
20900
21428
|
const socketPath = meta.socketPath;
|
|
20901
21429
|
if (socketPath.startsWith("tcp:")) {
|
|
@@ -20909,6 +21437,49 @@ async function killBridgeWithEscalation(sessionId, options) {
|
|
|
20909
21437
|
terminationTimeMs: Date.now() - startTime
|
|
20910
21438
|
};
|
|
20911
21439
|
}
|
|
21440
|
+
async function cleanupBridgeSessions(sessionIds) {
|
|
21441
|
+
const uniqueSessionIds = [...new Set(Array.from(sessionIds).filter(Boolean))];
|
|
21442
|
+
const result = {
|
|
21443
|
+
requestedSessions: uniqueSessionIds.length,
|
|
21444
|
+
foundSessions: 0,
|
|
21445
|
+
terminatedSessions: 0,
|
|
21446
|
+
errors: []
|
|
21447
|
+
};
|
|
21448
|
+
for (const sessionId of uniqueSessionIds) {
|
|
21449
|
+
try {
|
|
21450
|
+
ownedBridgeSessionIds.delete(sessionId);
|
|
21451
|
+
const metaPath = getBridgeMetaPath(sessionId);
|
|
21452
|
+
const socketPath = getBridgeSocketPath(sessionId);
|
|
21453
|
+
const portPath = getBridgePortPath(sessionId);
|
|
21454
|
+
const lockPath = getSessionLockPath(sessionId);
|
|
21455
|
+
const hasArtifacts = fs4.existsSync(metaPath) || fs4.existsSync(socketPath) || fs4.existsSync(portPath) || fs4.existsSync(lockPath);
|
|
21456
|
+
if (!hasArtifacts) {
|
|
21457
|
+
continue;
|
|
21458
|
+
}
|
|
21459
|
+
result.foundSessions++;
|
|
21460
|
+
const meta = await safeReadJson(metaPath);
|
|
21461
|
+
if (meta && isValidBridgeMeta(meta)) {
|
|
21462
|
+
const escalation = await killBridgeWithEscalation(sessionId);
|
|
21463
|
+
if (escalation.terminatedBy) {
|
|
21464
|
+
result.terminatedSessions++;
|
|
21465
|
+
}
|
|
21466
|
+
} else {
|
|
21467
|
+
await removeFileIfExists(metaPath);
|
|
21468
|
+
await removeFileIfExists(socketPath);
|
|
21469
|
+
await removeFileIfExists(portPath);
|
|
21470
|
+
}
|
|
21471
|
+
await removeFileIfExists(lockPath);
|
|
21472
|
+
} catch (error2) {
|
|
21473
|
+
result.errors.push(`session=${sessionId}: ${error2.message}`);
|
|
21474
|
+
}
|
|
21475
|
+
}
|
|
21476
|
+
return result;
|
|
21477
|
+
}
|
|
21478
|
+
async function cleanupOwnedBridgeSessions() {
|
|
21479
|
+
const ownedSessions = [...ownedBridgeSessionIds];
|
|
21480
|
+
ownedBridgeSessionIds.clear();
|
|
21481
|
+
return cleanupBridgeSessions(ownedSessions);
|
|
21482
|
+
}
|
|
20912
21483
|
async function deleteBridgeMeta(sessionId) {
|
|
20913
21484
|
const metaPath = getBridgeMetaPath(sessionId);
|
|
20914
21485
|
try {
|
|
@@ -20916,8 +21487,19 @@ async function deleteBridgeMeta(sessionId) {
|
|
|
20916
21487
|
} catch {
|
|
20917
21488
|
}
|
|
20918
21489
|
}
|
|
21490
|
+
async function removeFileIfExists(filePath) {
|
|
21491
|
+
try {
|
|
21492
|
+
await fsPromises2.unlink(filePath);
|
|
21493
|
+
return true;
|
|
21494
|
+
} catch (error2) {
|
|
21495
|
+
if (error2?.code === "ENOENT") {
|
|
21496
|
+
return false;
|
|
21497
|
+
}
|
|
21498
|
+
throw error2;
|
|
21499
|
+
}
|
|
21500
|
+
}
|
|
20919
21501
|
function sleep2(ms) {
|
|
20920
|
-
return new Promise((
|
|
21502
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
20921
21503
|
}
|
|
20922
21504
|
|
|
20923
21505
|
// src/tools/python-repl/tool.ts
|
|
@@ -21097,11 +21679,6 @@ function formatGeneralError(error2, sessionId, action) {
|
|
|
21097
21679
|
lines.push("");
|
|
21098
21680
|
lines.push(`Type: ${error2.name}`);
|
|
21099
21681
|
lines.push(`Message: ${error2.message}`);
|
|
21100
|
-
if (error2.stack) {
|
|
21101
|
-
lines.push("");
|
|
21102
|
-
lines.push("Stack trace:");
|
|
21103
|
-
lines.push(error2.stack);
|
|
21104
|
-
}
|
|
21105
21682
|
return lines.join("\n");
|
|
21106
21683
|
}
|
|
21107
21684
|
async function handleExecute(sessionId, socketPath, code, executionTimeout, executionLabel) {
|
|
@@ -21353,14 +21930,15 @@ var pythonReplTool = {
|
|
|
21353
21930
|
};
|
|
21354
21931
|
|
|
21355
21932
|
// src/tools/state-tools.ts
|
|
21356
|
-
var
|
|
21933
|
+
var import_fs12 = require("fs");
|
|
21934
|
+
var import_path12 = require("path");
|
|
21357
21935
|
|
|
21358
21936
|
// src/lib/worktree-paths.ts
|
|
21359
21937
|
var import_crypto2 = require("crypto");
|
|
21360
|
-
var
|
|
21361
|
-
var
|
|
21938
|
+
var import_child_process9 = require("child_process");
|
|
21939
|
+
var import_fs9 = require("fs");
|
|
21362
21940
|
var import_os = require("os");
|
|
21363
|
-
var
|
|
21941
|
+
var import_path9 = require("path");
|
|
21364
21942
|
var OmcPaths = {
|
|
21365
21943
|
ROOT: ".omc",
|
|
21366
21944
|
STATE: ".omc/state",
|
|
@@ -21375,7 +21953,8 @@ var OmcPaths = {
|
|
|
21375
21953
|
SCIENTIST: ".omc/scientist",
|
|
21376
21954
|
AUTOPILOT: ".omc/autopilot",
|
|
21377
21955
|
SKILLS: ".omc/skills",
|
|
21378
|
-
SHARED_MEMORY: ".omc/state/shared-memory"
|
|
21956
|
+
SHARED_MEMORY: ".omc/state/shared-memory",
|
|
21957
|
+
DEEPINIT_MANIFEST: ".omc/deepinit-manifest.json"
|
|
21379
21958
|
};
|
|
21380
21959
|
var MAX_WORKTREE_CACHE_SIZE = 8;
|
|
21381
21960
|
var worktreeCacheMap = /* @__PURE__ */ new Map();
|
|
@@ -21388,7 +21967,7 @@ function getWorktreeRoot(cwd) {
|
|
|
21388
21967
|
return root || null;
|
|
21389
21968
|
}
|
|
21390
21969
|
try {
|
|
21391
|
-
const root = (0,
|
|
21970
|
+
const root = (0, import_child_process9.execSync)("git rev-parse --show-toplevel", {
|
|
21392
21971
|
cwd: effectiveCwd,
|
|
21393
21972
|
encoding: "utf-8",
|
|
21394
21973
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -21410,7 +21989,7 @@ function validatePath(inputPath) {
|
|
|
21410
21989
|
if (inputPath.includes("..")) {
|
|
21411
21990
|
throw new Error(`Invalid path: path traversal not allowed (${inputPath})`);
|
|
21412
21991
|
}
|
|
21413
|
-
if (inputPath.startsWith("~") || (0,
|
|
21992
|
+
if (inputPath.startsWith("~") || (0, import_path9.isAbsolute)(inputPath)) {
|
|
21414
21993
|
throw new Error(`Invalid path: absolute paths not allowed (${inputPath})`);
|
|
21415
21994
|
}
|
|
21416
21995
|
}
|
|
@@ -21419,7 +21998,7 @@ function getProjectIdentifier(worktreeRoot) {
|
|
|
21419
21998
|
const root = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21420
21999
|
let source;
|
|
21421
22000
|
try {
|
|
21422
|
-
const remoteUrl = (0,
|
|
22001
|
+
const remoteUrl = (0, import_child_process9.execSync)("git remote get-url origin", {
|
|
21423
22002
|
cwd: root,
|
|
21424
22003
|
encoding: "utf-8",
|
|
21425
22004
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -21429,7 +22008,7 @@ function getProjectIdentifier(worktreeRoot) {
|
|
|
21429
22008
|
source = root;
|
|
21430
22009
|
}
|
|
21431
22010
|
const hash = (0, import_crypto2.createHash)("sha256").update(source).digest("hex").slice(0, 16);
|
|
21432
|
-
const dirName = (0,
|
|
22011
|
+
const dirName = (0, import_path9.basename)(root).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
21433
22012
|
return `${dirName}-${hash}`;
|
|
21434
22013
|
}
|
|
21435
22014
|
function getOmcRoot(worktreeRoot) {
|
|
@@ -21437,10 +22016,10 @@ function getOmcRoot(worktreeRoot) {
|
|
|
21437
22016
|
if (customDir) {
|
|
21438
22017
|
const root2 = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21439
22018
|
const projectId = getProjectIdentifier(root2);
|
|
21440
|
-
const centralizedPath = (0,
|
|
21441
|
-
const legacyPath = (0,
|
|
22019
|
+
const centralizedPath = (0, import_path9.join)(customDir, projectId);
|
|
22020
|
+
const legacyPath = (0, import_path9.join)(root2, OmcPaths.ROOT);
|
|
21442
22021
|
const warningKey = `${legacyPath}:${centralizedPath}`;
|
|
21443
|
-
if (!dualDirWarnings.has(warningKey) && (0,
|
|
22022
|
+
if (!dualDirWarnings.has(warningKey) && (0, import_fs9.existsSync)(legacyPath) && (0, import_fs9.existsSync)(centralizedPath)) {
|
|
21444
22023
|
dualDirWarnings.add(warningKey);
|
|
21445
22024
|
console.warn(
|
|
21446
22025
|
`[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.`
|
|
@@ -21449,14 +22028,14 @@ function getOmcRoot(worktreeRoot) {
|
|
|
21449
22028
|
return centralizedPath;
|
|
21450
22029
|
}
|
|
21451
22030
|
const root = worktreeRoot || getWorktreeRoot() || process.cwd();
|
|
21452
|
-
return (0,
|
|
22031
|
+
return (0, import_path9.join)(root, OmcPaths.ROOT);
|
|
21453
22032
|
}
|
|
21454
22033
|
function resolveOmcPath(relativePath, worktreeRoot) {
|
|
21455
22034
|
validatePath(relativePath);
|
|
21456
22035
|
const omcDir = getOmcRoot(worktreeRoot);
|
|
21457
|
-
const fullPath = (0,
|
|
21458
|
-
const relativeToOmc = (0,
|
|
21459
|
-
if (relativeToOmc.startsWith("..") || relativeToOmc.startsWith(
|
|
22036
|
+
const fullPath = (0, import_path9.normalize)((0, import_path9.resolve)(omcDir, relativePath));
|
|
22037
|
+
const relativeToOmc = (0, import_path9.relative)(omcDir, fullPath);
|
|
22038
|
+
if (relativeToOmc.startsWith("..") || relativeToOmc.startsWith(import_path9.sep + "..")) {
|
|
21460
22039
|
throw new Error(`Path escapes omc boundary: ${relativePath}`);
|
|
21461
22040
|
}
|
|
21462
22041
|
return fullPath;
|
|
@@ -21467,16 +22046,16 @@ function resolveStatePath(stateName, worktreeRoot) {
|
|
|
21467
22046
|
}
|
|
21468
22047
|
function ensureOmcDir(relativePath, worktreeRoot) {
|
|
21469
22048
|
const fullPath = resolveOmcPath(relativePath, worktreeRoot);
|
|
21470
|
-
if (!(0,
|
|
21471
|
-
(0,
|
|
22049
|
+
if (!(0, import_fs9.existsSync)(fullPath)) {
|
|
22050
|
+
(0, import_fs9.mkdirSync)(fullPath, { recursive: true });
|
|
21472
22051
|
}
|
|
21473
22052
|
return fullPath;
|
|
21474
22053
|
}
|
|
21475
22054
|
function getWorktreeNotepadPath(worktreeRoot) {
|
|
21476
|
-
return (0,
|
|
22055
|
+
return (0, import_path9.join)(getOmcRoot(worktreeRoot), "notepad.md");
|
|
21477
22056
|
}
|
|
21478
22057
|
function getWorktreeProjectMemoryPath(worktreeRoot) {
|
|
21479
|
-
return (0,
|
|
22058
|
+
return (0, import_path9.join)(getOmcRoot(worktreeRoot), "project-memory.json");
|
|
21480
22059
|
}
|
|
21481
22060
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/;
|
|
21482
22061
|
function validateSessionId(sessionId) {
|
|
@@ -21497,15 +22076,15 @@ function resolveSessionStatePath(stateName, sessionId, worktreeRoot) {
|
|
|
21497
22076
|
}
|
|
21498
22077
|
function getSessionStateDir(sessionId, worktreeRoot) {
|
|
21499
22078
|
validateSessionId(sessionId);
|
|
21500
|
-
return (0,
|
|
22079
|
+
return (0, import_path9.join)(getOmcRoot(worktreeRoot), "state", "sessions", sessionId);
|
|
21501
22080
|
}
|
|
21502
22081
|
function listSessionIds(worktreeRoot) {
|
|
21503
|
-
const sessionsDir = (0,
|
|
21504
|
-
if (!(0,
|
|
22082
|
+
const sessionsDir = (0, import_path9.join)(getOmcRoot(worktreeRoot), "state", "sessions");
|
|
22083
|
+
if (!(0, import_fs9.existsSync)(sessionsDir)) {
|
|
21505
22084
|
return [];
|
|
21506
22085
|
}
|
|
21507
22086
|
try {
|
|
21508
|
-
const entries = (0,
|
|
22087
|
+
const entries = (0, import_fs9.readdirSync)(sessionsDir, { withFileTypes: true });
|
|
21509
22088
|
return entries.filter((entry) => entry.isDirectory() && SESSION_ID_REGEX.test(entry.name)).map((entry) => entry.name);
|
|
21510
22089
|
} catch {
|
|
21511
22090
|
return [];
|
|
@@ -21513,14 +22092,14 @@ function listSessionIds(worktreeRoot) {
|
|
|
21513
22092
|
}
|
|
21514
22093
|
function ensureSessionStateDir(sessionId, worktreeRoot) {
|
|
21515
22094
|
const sessionDir = getSessionStateDir(sessionId, worktreeRoot);
|
|
21516
|
-
if (!(0,
|
|
21517
|
-
(0,
|
|
22095
|
+
if (!(0, import_fs9.existsSync)(sessionDir)) {
|
|
22096
|
+
(0, import_fs9.mkdirSync)(sessionDir, { recursive: true });
|
|
21518
22097
|
}
|
|
21519
22098
|
return sessionDir;
|
|
21520
22099
|
}
|
|
21521
22100
|
function resolveToWorktreeRoot(directory) {
|
|
21522
22101
|
if (directory) {
|
|
21523
|
-
const resolved = (0,
|
|
22102
|
+
const resolved = (0, import_path9.resolve)(directory);
|
|
21524
22103
|
const root = getWorktreeRoot(resolved);
|
|
21525
22104
|
if (root) return root;
|
|
21526
22105
|
console.error("[worktree] non-git directory provided, falling back to process root", {
|
|
@@ -21534,10 +22113,10 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21534
22113
|
if (!workingDirectory) {
|
|
21535
22114
|
return trustedRoot;
|
|
21536
22115
|
}
|
|
21537
|
-
const resolved = (0,
|
|
22116
|
+
const resolved = (0, import_path9.resolve)(workingDirectory);
|
|
21538
22117
|
let trustedRootReal;
|
|
21539
22118
|
try {
|
|
21540
|
-
trustedRootReal = (0,
|
|
22119
|
+
trustedRootReal = (0, import_fs9.realpathSync)(trustedRoot);
|
|
21541
22120
|
} catch {
|
|
21542
22121
|
trustedRootReal = trustedRoot;
|
|
21543
22122
|
}
|
|
@@ -21545,7 +22124,7 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21545
22124
|
if (providedRoot) {
|
|
21546
22125
|
let providedRootReal;
|
|
21547
22126
|
try {
|
|
21548
|
-
providedRootReal = (0,
|
|
22127
|
+
providedRootReal = (0, import_fs9.realpathSync)(providedRoot);
|
|
21549
22128
|
} catch {
|
|
21550
22129
|
throw new Error(`workingDirectory '${workingDirectory}' does not exist or is not accessible.`);
|
|
21551
22130
|
}
|
|
@@ -21561,12 +22140,12 @@ function validateWorkingDirectory(workingDirectory) {
|
|
|
21561
22140
|
}
|
|
21562
22141
|
let resolvedReal;
|
|
21563
22142
|
try {
|
|
21564
|
-
resolvedReal = (0,
|
|
22143
|
+
resolvedReal = (0, import_fs9.realpathSync)(resolved);
|
|
21565
22144
|
} catch {
|
|
21566
22145
|
throw new Error(`workingDirectory '${workingDirectory}' does not exist or is not accessible.`);
|
|
21567
22146
|
}
|
|
21568
|
-
const rel = (0,
|
|
21569
|
-
if (rel.startsWith("..") || (0,
|
|
22147
|
+
const rel = (0, import_path9.relative)(trustedRootReal, resolvedReal);
|
|
22148
|
+
if (rel.startsWith("..") || (0, import_path9.isAbsolute)(rel)) {
|
|
21570
22149
|
throw new Error(`workingDirectory '${workingDirectory}' is outside the trusted worktree root '${trustedRoot}'.`);
|
|
21571
22150
|
}
|
|
21572
22151
|
return trustedRoot;
|
|
@@ -21629,9 +22208,31 @@ function validatePayload(payload, limits = {}) {
|
|
|
21629
22208
|
return { valid: true };
|
|
21630
22209
|
}
|
|
21631
22210
|
|
|
22211
|
+
// src/lib/mode-state-io.ts
|
|
22212
|
+
var import_fs10 = require("fs");
|
|
22213
|
+
var import_path10 = require("path");
|
|
22214
|
+
function getStateSessionOwner(state) {
|
|
22215
|
+
if (!state || typeof state !== "object") {
|
|
22216
|
+
return void 0;
|
|
22217
|
+
}
|
|
22218
|
+
const meta = state._meta;
|
|
22219
|
+
if (meta && typeof meta === "object") {
|
|
22220
|
+
const metaSessionId = meta.sessionId;
|
|
22221
|
+
if (typeof metaSessionId === "string" && metaSessionId) {
|
|
22222
|
+
return metaSessionId;
|
|
22223
|
+
}
|
|
22224
|
+
}
|
|
22225
|
+
const topLevelSessionId = state.session_id;
|
|
22226
|
+
return typeof topLevelSessionId === "string" && topLevelSessionId ? topLevelSessionId : void 0;
|
|
22227
|
+
}
|
|
22228
|
+
function canClearStateForSession(state, sessionId) {
|
|
22229
|
+
const ownerSessionId = getStateSessionOwner(state);
|
|
22230
|
+
return !ownerSessionId || ownerSessionId === sessionId;
|
|
22231
|
+
}
|
|
22232
|
+
|
|
21632
22233
|
// src/hooks/mode-registry/index.ts
|
|
21633
|
-
var
|
|
21634
|
-
var
|
|
22234
|
+
var import_fs11 = require("fs");
|
|
22235
|
+
var import_path11 = require("path");
|
|
21635
22236
|
|
|
21636
22237
|
// src/lib/mode-names.ts
|
|
21637
22238
|
var MODE_NAMES = {
|
|
@@ -21640,7 +22241,8 @@ var MODE_NAMES = {
|
|
|
21640
22241
|
TEAM: "team",
|
|
21641
22242
|
RALPH: "ralph",
|
|
21642
22243
|
ULTRAWORK: "ultrawork",
|
|
21643
|
-
ULTRAQA: "ultraqa"
|
|
22244
|
+
ULTRAQA: "ultraqa",
|
|
22245
|
+
RALPLAN: "ralplan"
|
|
21644
22246
|
};
|
|
21645
22247
|
var ALL_MODE_NAMES = [
|
|
21646
22248
|
MODE_NAMES.AUTOPILOT,
|
|
@@ -21648,7 +22250,8 @@ var ALL_MODE_NAMES = [
|
|
|
21648
22250
|
MODE_NAMES.TEAM,
|
|
21649
22251
|
MODE_NAMES.RALPH,
|
|
21650
22252
|
MODE_NAMES.ULTRAWORK,
|
|
21651
|
-
MODE_NAMES.ULTRAQA
|
|
22253
|
+
MODE_NAMES.ULTRAQA,
|
|
22254
|
+
MODE_NAMES.RALPLAN
|
|
21652
22255
|
];
|
|
21653
22256
|
var MODE_STATE_FILE_MAP = {
|
|
21654
22257
|
[MODE_NAMES.AUTOPILOT]: "autopilot-state.json",
|
|
@@ -21656,7 +22259,8 @@ var MODE_STATE_FILE_MAP = {
|
|
|
21656
22259
|
[MODE_NAMES.TEAM]: "team-state.json",
|
|
21657
22260
|
[MODE_NAMES.RALPH]: "ralph-state.json",
|
|
21658
22261
|
[MODE_NAMES.ULTRAWORK]: "ultrawork-state.json",
|
|
21659
|
-
[MODE_NAMES.ULTRAQA]: "ultraqa-state.json"
|
|
22262
|
+
[MODE_NAMES.ULTRAQA]: "ultraqa-state.json",
|
|
22263
|
+
[MODE_NAMES.RALPLAN]: "ralplan-state.json"
|
|
21660
22264
|
};
|
|
21661
22265
|
var SESSION_END_MODE_STATE_FILES = [
|
|
21662
22266
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.AUTOPILOT], mode: MODE_NAMES.AUTOPILOT },
|
|
@@ -21664,12 +22268,14 @@ var SESSION_END_MODE_STATE_FILES = [
|
|
|
21664
22268
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPH], mode: MODE_NAMES.RALPH },
|
|
21665
22269
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK], mode: MODE_NAMES.ULTRAWORK },
|
|
21666
22270
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAQA], mode: MODE_NAMES.ULTRAQA },
|
|
22271
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPLAN], mode: MODE_NAMES.RALPLAN },
|
|
21667
22272
|
{ file: "skill-active-state.json", mode: "skill-active" }
|
|
21668
22273
|
];
|
|
21669
22274
|
var SESSION_METRICS_MODE_FILES = [
|
|
21670
22275
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.AUTOPILOT], mode: MODE_NAMES.AUTOPILOT },
|
|
21671
22276
|
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPH], mode: MODE_NAMES.RALPH },
|
|
21672
|
-
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK], mode: MODE_NAMES.ULTRAWORK }
|
|
22277
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.ULTRAWORK], mode: MODE_NAMES.ULTRAWORK },
|
|
22278
|
+
{ file: MODE_STATE_FILE_MAP[MODE_NAMES.RALPLAN], mode: MODE_NAMES.RALPLAN }
|
|
21673
22279
|
];
|
|
21674
22280
|
|
|
21675
22281
|
// src/hooks/mode-registry/index.ts
|
|
@@ -21712,26 +22318,26 @@ var MODE_CONFIGS = {
|
|
|
21712
22318
|
};
|
|
21713
22319
|
var EXCLUSIVE_MODES = [MODE_NAMES.AUTOPILOT];
|
|
21714
22320
|
function getStateDir(cwd) {
|
|
21715
|
-
return (0,
|
|
22321
|
+
return (0, import_path11.join)(getOmcRoot(cwd), "state");
|
|
21716
22322
|
}
|
|
21717
22323
|
function getStateFilePath(cwd, mode, sessionId) {
|
|
21718
22324
|
const config2 = MODE_CONFIGS[mode];
|
|
21719
22325
|
if (sessionId) {
|
|
21720
22326
|
return resolveSessionStatePath(mode, sessionId, cwd);
|
|
21721
22327
|
}
|
|
21722
|
-
return (0,
|
|
22328
|
+
return (0, import_path11.join)(getStateDir(cwd), config2.stateFile);
|
|
21723
22329
|
}
|
|
21724
22330
|
function getMarkerFilePath(cwd, mode) {
|
|
21725
22331
|
const config2 = MODE_CONFIGS[mode];
|
|
21726
22332
|
if (!config2.markerFile) return null;
|
|
21727
|
-
return (0,
|
|
22333
|
+
return (0, import_path11.join)(getStateDir(cwd), config2.markerFile);
|
|
21728
22334
|
}
|
|
21729
22335
|
function isJsonModeActive(cwd, mode, sessionId) {
|
|
21730
22336
|
const config2 = MODE_CONFIGS[mode];
|
|
21731
22337
|
if (sessionId) {
|
|
21732
22338
|
const sessionStateFile = resolveSessionStatePath(mode, sessionId, cwd);
|
|
21733
22339
|
try {
|
|
21734
|
-
const content = (0,
|
|
22340
|
+
const content = (0, import_fs11.readFileSync)(sessionStateFile, "utf-8");
|
|
21735
22341
|
const state = JSON.parse(content);
|
|
21736
22342
|
if (state.session_id && state.session_id !== sessionId) {
|
|
21737
22343
|
return false;
|
|
@@ -21749,7 +22355,7 @@ function isJsonModeActive(cwd, mode, sessionId) {
|
|
|
21749
22355
|
}
|
|
21750
22356
|
const stateFile = getStateFilePath(cwd, mode);
|
|
21751
22357
|
try {
|
|
21752
|
-
const content = (0,
|
|
22358
|
+
const content = (0, import_fs11.readFileSync)(stateFile, "utf-8");
|
|
21753
22359
|
const state = JSON.parse(content);
|
|
21754
22360
|
if (config2.activeProperty) {
|
|
21755
22361
|
return state[config2.activeProperty] === true;
|
|
@@ -21789,7 +22395,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21789
22395
|
if (isSessionScopedClear && sessionId) {
|
|
21790
22396
|
const sessionStateFile = resolveSessionStatePath(mode, sessionId, cwd);
|
|
21791
22397
|
try {
|
|
21792
|
-
(0,
|
|
22398
|
+
(0, import_fs11.unlinkSync)(sessionStateFile);
|
|
21793
22399
|
} catch (err) {
|
|
21794
22400
|
if (err.code !== "ENOENT") {
|
|
21795
22401
|
success = false;
|
|
@@ -21803,7 +22409,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21803
22409
|
cwd
|
|
21804
22410
|
);
|
|
21805
22411
|
try {
|
|
21806
|
-
(0,
|
|
22412
|
+
(0, import_fs11.unlinkSync)(sessionMarkerFile);
|
|
21807
22413
|
} catch (err) {
|
|
21808
22414
|
if (err.code !== "ENOENT") {
|
|
21809
22415
|
success = false;
|
|
@@ -21812,11 +22418,11 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21812
22418
|
}
|
|
21813
22419
|
if (markerFile) {
|
|
21814
22420
|
try {
|
|
21815
|
-
const markerRaw = JSON.parse((0,
|
|
22421
|
+
const markerRaw = JSON.parse((0, import_fs11.readFileSync)(markerFile, "utf-8"));
|
|
21816
22422
|
const markerSessionId = markerRaw.session_id ?? markerRaw.sessionId;
|
|
21817
22423
|
if (!markerSessionId || markerSessionId === sessionId) {
|
|
21818
22424
|
try {
|
|
21819
|
-
(0,
|
|
22425
|
+
(0, import_fs11.unlinkSync)(markerFile);
|
|
21820
22426
|
} catch (err) {
|
|
21821
22427
|
if (err.code !== "ENOENT") {
|
|
21822
22428
|
success = false;
|
|
@@ -21825,7 +22431,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21825
22431
|
}
|
|
21826
22432
|
} catch {
|
|
21827
22433
|
try {
|
|
21828
|
-
(0,
|
|
22434
|
+
(0, import_fs11.unlinkSync)(markerFile);
|
|
21829
22435
|
} catch (err) {
|
|
21830
22436
|
if (err.code !== "ENOENT") {
|
|
21831
22437
|
success = false;
|
|
@@ -21837,7 +22443,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21837
22443
|
const stateFile = getStateFilePath(cwd, mode);
|
|
21838
22444
|
if (!isSessionScopedClear) {
|
|
21839
22445
|
try {
|
|
21840
|
-
(0,
|
|
22446
|
+
(0, import_fs11.unlinkSync)(stateFile);
|
|
21841
22447
|
} catch (err) {
|
|
21842
22448
|
if (err.code !== "ENOENT") {
|
|
21843
22449
|
success = false;
|
|
@@ -21847,11 +22453,11 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21847
22453
|
if (markerFile) {
|
|
21848
22454
|
if (isSessionScopedClear) {
|
|
21849
22455
|
try {
|
|
21850
|
-
const markerRaw = JSON.parse((0,
|
|
22456
|
+
const markerRaw = JSON.parse((0, import_fs11.readFileSync)(markerFile, "utf-8"));
|
|
21851
22457
|
const markerSessionId = markerRaw.session_id ?? markerRaw.sessionId;
|
|
21852
22458
|
if (!markerSessionId || markerSessionId === sessionId) {
|
|
21853
22459
|
try {
|
|
21854
|
-
(0,
|
|
22460
|
+
(0, import_fs11.unlinkSync)(markerFile);
|
|
21855
22461
|
} catch (err) {
|
|
21856
22462
|
if (err.code !== "ENOENT") {
|
|
21857
22463
|
success = false;
|
|
@@ -21860,7 +22466,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21860
22466
|
}
|
|
21861
22467
|
} catch {
|
|
21862
22468
|
try {
|
|
21863
|
-
(0,
|
|
22469
|
+
(0, import_fs11.unlinkSync)(markerFile);
|
|
21864
22470
|
} catch (err) {
|
|
21865
22471
|
if (err.code !== "ENOENT") {
|
|
21866
22472
|
success = false;
|
|
@@ -21869,7 +22475,7 @@ function clearModeState(mode, cwd, sessionId) {
|
|
|
21869
22475
|
}
|
|
21870
22476
|
} else {
|
|
21871
22477
|
try {
|
|
21872
|
-
(0,
|
|
22478
|
+
(0, import_fs11.unlinkSync)(markerFile);
|
|
21873
22479
|
} catch (err) {
|
|
21874
22480
|
if (err.code !== "ENOENT") {
|
|
21875
22481
|
success = false;
|
|
@@ -21900,15 +22506,106 @@ var STATE_TOOL_MODES = [
|
|
|
21900
22506
|
];
|
|
21901
22507
|
var EXTRA_STATE_ONLY_MODES = ["ralplan", "omc-teams", "deep-interview"];
|
|
21902
22508
|
var CANCEL_SIGNAL_TTL_MS = 3e4;
|
|
22509
|
+
function readTeamNamesFromStateFile(statePath) {
|
|
22510
|
+
if (!(0, import_fs12.existsSync)(statePath)) return [];
|
|
22511
|
+
try {
|
|
22512
|
+
const raw = JSON.parse((0, import_fs12.readFileSync)(statePath, "utf-8"));
|
|
22513
|
+
const teamName = typeof raw.team_name === "string" ? raw.team_name.trim() : typeof raw.teamName === "string" ? raw.teamName.trim() : "";
|
|
22514
|
+
return teamName ? [teamName] : [];
|
|
22515
|
+
} catch {
|
|
22516
|
+
return [];
|
|
22517
|
+
}
|
|
22518
|
+
}
|
|
22519
|
+
function pruneMissionBoardTeams(root, teamNames) {
|
|
22520
|
+
const missionStatePath = (0, import_path12.join)(getOmcRoot(root), "state", "mission-state.json");
|
|
22521
|
+
if (!(0, import_fs12.existsSync)(missionStatePath)) return 0;
|
|
22522
|
+
try {
|
|
22523
|
+
const parsed = JSON.parse((0, import_fs12.readFileSync)(missionStatePath, "utf-8"));
|
|
22524
|
+
if (!Array.isArray(parsed.missions)) return 0;
|
|
22525
|
+
const shouldRemoveAll = teamNames == null;
|
|
22526
|
+
const teamNameSet = new Set(teamNames ?? []);
|
|
22527
|
+
const remainingMissions = parsed.missions.filter((mission) => {
|
|
22528
|
+
if (mission.source !== "team") return true;
|
|
22529
|
+
if (shouldRemoveAll) return false;
|
|
22530
|
+
const missionTeamName = typeof mission.teamName === "string" ? mission.teamName.trim() : typeof mission.name === "string" ? mission.name.trim() : "";
|
|
22531
|
+
return !missionTeamName || !teamNameSet.has(missionTeamName);
|
|
22532
|
+
});
|
|
22533
|
+
const removed = parsed.missions.length - remainingMissions.length;
|
|
22534
|
+
if (removed > 0) {
|
|
22535
|
+
(0, import_fs12.writeFileSync)(missionStatePath, JSON.stringify({
|
|
22536
|
+
...parsed,
|
|
22537
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22538
|
+
missions: remainingMissions
|
|
22539
|
+
}, null, 2));
|
|
22540
|
+
}
|
|
22541
|
+
return removed;
|
|
22542
|
+
} catch {
|
|
22543
|
+
return 0;
|
|
22544
|
+
}
|
|
22545
|
+
}
|
|
22546
|
+
function cleanupTeamRuntimeState(root, teamNames) {
|
|
22547
|
+
const teamStateRoot = (0, import_path12.join)(getOmcRoot(root), "state", "team");
|
|
22548
|
+
if (!(0, import_fs12.existsSync)(teamStateRoot)) return 0;
|
|
22549
|
+
const shouldRemoveAll = teamNames == null;
|
|
22550
|
+
let removed = 0;
|
|
22551
|
+
if (shouldRemoveAll) {
|
|
22552
|
+
try {
|
|
22553
|
+
(0, import_fs12.rmSync)(teamStateRoot, { recursive: true, force: true });
|
|
22554
|
+
return 1;
|
|
22555
|
+
} catch {
|
|
22556
|
+
return 0;
|
|
22557
|
+
}
|
|
22558
|
+
}
|
|
22559
|
+
for (const teamName of teamNames ?? []) {
|
|
22560
|
+
if (!teamName) continue;
|
|
22561
|
+
try {
|
|
22562
|
+
(0, import_fs12.rmSync)((0, import_path12.join)(teamStateRoot, teamName), { recursive: true, force: true });
|
|
22563
|
+
removed += 1;
|
|
22564
|
+
} catch {
|
|
22565
|
+
}
|
|
22566
|
+
}
|
|
22567
|
+
return removed;
|
|
22568
|
+
}
|
|
21903
22569
|
function getStatePath(mode, root) {
|
|
21904
22570
|
if (MODE_CONFIGS[mode]) {
|
|
21905
22571
|
return getStateFilePath(root, mode);
|
|
21906
22572
|
}
|
|
21907
22573
|
return resolveStatePath(mode, root);
|
|
21908
22574
|
}
|
|
22575
|
+
function getLegacyStateFileCandidates(mode, root) {
|
|
22576
|
+
const normalizedName = mode.endsWith("-state") ? mode : `${mode}-state`;
|
|
22577
|
+
const candidates = [
|
|
22578
|
+
getStatePath(mode, root),
|
|
22579
|
+
(0, import_path12.join)(getOmcRoot(root), `${normalizedName}.json`)
|
|
22580
|
+
];
|
|
22581
|
+
return [...new Set(candidates)];
|
|
22582
|
+
}
|
|
22583
|
+
function clearLegacyStateCandidates(mode, root, sessionId) {
|
|
22584
|
+
let cleared = 0;
|
|
22585
|
+
let hadFailure = false;
|
|
22586
|
+
for (const legacyPath of getLegacyStateFileCandidates(mode, root)) {
|
|
22587
|
+
if (!(0, import_fs12.existsSync)(legacyPath)) {
|
|
22588
|
+
continue;
|
|
22589
|
+
}
|
|
22590
|
+
try {
|
|
22591
|
+
if (sessionId) {
|
|
22592
|
+
const raw = JSON.parse((0, import_fs12.readFileSync)(legacyPath, "utf-8"));
|
|
22593
|
+
if (!canClearStateForSession(raw, sessionId)) {
|
|
22594
|
+
continue;
|
|
22595
|
+
}
|
|
22596
|
+
}
|
|
22597
|
+
(0, import_fs12.unlinkSync)(legacyPath);
|
|
22598
|
+
cleared++;
|
|
22599
|
+
} catch {
|
|
22600
|
+
hadFailure = true;
|
|
22601
|
+
}
|
|
22602
|
+
}
|
|
22603
|
+
return { cleared, hadFailure };
|
|
22604
|
+
}
|
|
21909
22605
|
var stateReadTool = {
|
|
21910
22606
|
name: "state_read",
|
|
21911
22607
|
description: "Read the current state for a specific mode (ralph, ultrawork, autopilot, etc.). Returns the JSON state data or indicates if no state exists.",
|
|
22608
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
21912
22609
|
schema: {
|
|
21913
22610
|
mode: external_exports.enum(STATE_TOOL_MODES).describe("The mode to read state for"),
|
|
21914
22611
|
workingDirectory: external_exports.string().optional().describe("Working directory (defaults to cwd)"),
|
|
@@ -21922,7 +22619,7 @@ var stateReadTool = {
|
|
|
21922
22619
|
if (sessionId) {
|
|
21923
22620
|
validateSessionId(sessionId);
|
|
21924
22621
|
const statePath2 = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sessionId) : resolveSessionStatePath(mode, sessionId, root);
|
|
21925
|
-
if (!(0,
|
|
22622
|
+
if (!(0, import_fs12.existsSync)(statePath2)) {
|
|
21926
22623
|
return {
|
|
21927
22624
|
content: [{
|
|
21928
22625
|
type: "text",
|
|
@@ -21931,7 +22628,7 @@ Expected path: ${statePath2}`
|
|
|
21931
22628
|
}]
|
|
21932
22629
|
};
|
|
21933
22630
|
}
|
|
21934
|
-
const content = (0,
|
|
22631
|
+
const content = (0, import_fs12.readFileSync)(statePath2, "utf-8");
|
|
21935
22632
|
const state = JSON.parse(content);
|
|
21936
22633
|
return {
|
|
21937
22634
|
content: [{
|
|
@@ -21947,12 +22644,12 @@ ${JSON.stringify(state, null, 2)}
|
|
|
21947
22644
|
};
|
|
21948
22645
|
}
|
|
21949
22646
|
const statePath = getStatePath(mode, root);
|
|
21950
|
-
const legacyExists = (0,
|
|
22647
|
+
const legacyExists = (0, import_fs12.existsSync)(statePath);
|
|
21951
22648
|
const sessionIds = listSessionIds(root);
|
|
21952
22649
|
const activeSessions = [];
|
|
21953
22650
|
for (const sid of sessionIds) {
|
|
21954
22651
|
const sessionStatePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sid) : resolveSessionStatePath(mode, sid, root);
|
|
21955
|
-
if ((0,
|
|
22652
|
+
if ((0, import_fs12.existsSync)(sessionStatePath)) {
|
|
21956
22653
|
activeSessions.push(sid);
|
|
21957
22654
|
}
|
|
21958
22655
|
}
|
|
@@ -21975,7 +22672,7 @@ Note: Reading from legacy/aggregate path (no session_id). This may include state
|
|
|
21975
22672
|
`;
|
|
21976
22673
|
if (legacyExists) {
|
|
21977
22674
|
try {
|
|
21978
|
-
const content = (0,
|
|
22675
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
21979
22676
|
const state = JSON.parse(content);
|
|
21980
22677
|
output += `### Legacy Path (shared)
|
|
21981
22678
|
Path: ${statePath}
|
|
@@ -22000,7 +22697,7 @@ Path: ${statePath}
|
|
|
22000
22697
|
for (const sid of activeSessions) {
|
|
22001
22698
|
const sessionStatePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sid) : resolveSessionStatePath(mode, sid, root);
|
|
22002
22699
|
try {
|
|
22003
|
-
const content = (0,
|
|
22700
|
+
const content = (0, import_fs12.readFileSync)(sessionStatePath, "utf-8");
|
|
22004
22701
|
const state = JSON.parse(content);
|
|
22005
22702
|
output += `**Session: ${sid}**
|
|
22006
22703
|
Path: ${sessionStatePath}
|
|
@@ -22039,6 +22736,7 @@ Path: ${sessionStatePath}
|
|
|
22039
22736
|
var stateWriteTool = {
|
|
22040
22737
|
name: "state_write",
|
|
22041
22738
|
description: "Write/update state for a specific mode. Creates the state file and directories if they do not exist. Common fields (active, iteration, phase, etc.) can be set directly as parameters. Additional custom fields can be passed via the optional `state` parameter. Note: swarm uses SQLite and cannot be written via this tool.",
|
|
22739
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
22042
22740
|
schema: {
|
|
22043
22741
|
mode: external_exports.enum(STATE_TOOL_MODES).describe("The mode to write state for"),
|
|
22044
22742
|
active: external_exports.boolean().optional().describe("Whether the mode is currently active"),
|
|
@@ -22148,6 +22846,7 @@ ${JSON.stringify(stateWithMeta, null, 2)}
|
|
|
22148
22846
|
var stateClearTool = {
|
|
22149
22847
|
name: "state_clear",
|
|
22150
22848
|
description: "Clear/delete state for a specific mode. Removes the state file and any associated marker files.",
|
|
22849
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
22151
22850
|
schema: {
|
|
22152
22851
|
mode: external_exports.enum(STATE_TOOL_MODES).describe("The mode to clear state for"),
|
|
22153
22852
|
workingDirectory: external_exports.string().optional().describe("Working directory (defaults to cwd)"),
|
|
@@ -22158,8 +22857,17 @@ var stateClearTool = {
|
|
|
22158
22857
|
try {
|
|
22159
22858
|
const root = validateWorkingDirectory(workingDirectory);
|
|
22160
22859
|
const sessionId = session_id;
|
|
22860
|
+
const cleanedTeamNames = /* @__PURE__ */ new Set();
|
|
22861
|
+
const collectTeamNamesForCleanup = (statePath) => {
|
|
22862
|
+
if (mode !== "team") return;
|
|
22863
|
+
for (const teamName of readTeamNamesFromStateFile(statePath)) {
|
|
22864
|
+
cleanedTeamNames.add(teamName);
|
|
22865
|
+
}
|
|
22866
|
+
};
|
|
22161
22867
|
if (sessionId) {
|
|
22162
22868
|
validateSessionId(sessionId);
|
|
22869
|
+
collectTeamNamesForCleanup(resolveSessionStatePath("team", sessionId, root));
|
|
22870
|
+
collectTeamNamesForCleanup(getStateFilePath(root, "team", sessionId));
|
|
22163
22871
|
const now = Date.now();
|
|
22164
22872
|
const cancelSignalPath = resolveSessionStatePath("cancel-signal", sessionId, root);
|
|
22165
22873
|
atomicWriteJsonSync(cancelSignalPath, {
|
|
@@ -22171,88 +22879,85 @@ var stateClearTool = {
|
|
|
22171
22879
|
});
|
|
22172
22880
|
if (MODE_CONFIGS[mode]) {
|
|
22173
22881
|
const success = clearModeState(mode, root, sessionId);
|
|
22174
|
-
|
|
22175
|
-
|
|
22176
|
-
|
|
22177
|
-
if (
|
|
22178
|
-
|
|
22179
|
-
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
}
|
|
22185
|
-
}
|
|
22186
|
-
|
|
22187
|
-
const ghostNote2 = ghostCleaned2 ? " (ghost legacy file also removed)" : "";
|
|
22188
|
-
if (success) {
|
|
22882
|
+
const legacyCleanup2 = clearLegacyStateCandidates(mode, root, sessionId);
|
|
22883
|
+
const ghostNote2 = legacyCleanup2.cleared > 0 ? " (ghost legacy file also removed)" : "";
|
|
22884
|
+
const runtimeCleanupNote2 = (() => {
|
|
22885
|
+
if (mode !== "team") return "";
|
|
22886
|
+
const teamNames = [...cleanedTeamNames];
|
|
22887
|
+
const removedRoots = cleanupTeamRuntimeState(root, teamNames);
|
|
22888
|
+
const prunedMissions = pruneMissionBoardTeams(root, teamNames);
|
|
22889
|
+
const details = [];
|
|
22890
|
+
if (removedRoots > 0) details.push(`removed ${removedRoots} team runtime root(s)`);
|
|
22891
|
+
if (prunedMissions > 0) details.push(`pruned ${prunedMissions} HUD mission entry(ies)`);
|
|
22892
|
+
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
22893
|
+
})();
|
|
22894
|
+
if (success && !legacyCleanup2.hadFailure) {
|
|
22189
22895
|
return {
|
|
22190
22896
|
content: [{
|
|
22191
22897
|
type: "text",
|
|
22192
|
-
text: `Successfully cleared state for mode: ${mode} in session: ${sessionId}${ghostNote2}`
|
|
22898
|
+
text: `Successfully cleared state for mode: ${mode} in session: ${sessionId}${ghostNote2}${runtimeCleanupNote2}`
|
|
22193
22899
|
}]
|
|
22194
22900
|
};
|
|
22195
22901
|
} else {
|
|
22196
22902
|
return {
|
|
22197
22903
|
content: [{
|
|
22198
22904
|
type: "text",
|
|
22199
|
-
text: `Warning: Some files could not be removed for mode: ${mode} in session: ${sessionId}${ghostNote2}`
|
|
22905
|
+
text: `Warning: Some files could not be removed for mode: ${mode} in session: ${sessionId}${ghostNote2}${runtimeCleanupNote2}`
|
|
22200
22906
|
}]
|
|
22201
22907
|
};
|
|
22202
22908
|
}
|
|
22203
22909
|
}
|
|
22204
22910
|
const statePath = resolveSessionStatePath(mode, sessionId, root);
|
|
22205
|
-
if ((0,
|
|
22206
|
-
(0,
|
|
22207
|
-
}
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
if (
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
}
|
|
22219
|
-
}
|
|
22220
|
-
}
|
|
22221
|
-
const ghostNote = ghostCleaned ? " (ghost legacy file also removed)" : "";
|
|
22911
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
22912
|
+
(0, import_fs12.unlinkSync)(statePath);
|
|
22913
|
+
}
|
|
22914
|
+
const legacyCleanup = clearLegacyStateCandidates(mode, root, sessionId);
|
|
22915
|
+
const ghostNote = legacyCleanup.cleared > 0 ? " (ghost legacy file also removed)" : "";
|
|
22916
|
+
const runtimeCleanupNote = (() => {
|
|
22917
|
+
if (mode !== "team") return "";
|
|
22918
|
+
const teamNames = [...cleanedTeamNames];
|
|
22919
|
+
const removedRoots = cleanupTeamRuntimeState(root, teamNames);
|
|
22920
|
+
const prunedMissions = pruneMissionBoardTeams(root, teamNames);
|
|
22921
|
+
const details = [];
|
|
22922
|
+
if (removedRoots > 0) details.push(`removed ${removedRoots} team runtime root(s)`);
|
|
22923
|
+
if (prunedMissions > 0) details.push(`pruned ${prunedMissions} HUD mission entry(ies)`);
|
|
22924
|
+
return details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
22925
|
+
})();
|
|
22222
22926
|
return {
|
|
22223
22927
|
content: [{
|
|
22224
22928
|
type: "text",
|
|
22225
|
-
text:
|
|
22929
|
+
text: `${legacyCleanup.hadFailure ? "Warning: Some files could not be removed" : "Successfully cleared state"} for mode: ${mode} in session: ${sessionId}${ghostNote}${runtimeCleanupNote}`
|
|
22226
22930
|
}]
|
|
22227
22931
|
};
|
|
22228
22932
|
}
|
|
22229
22933
|
let clearedCount = 0;
|
|
22230
22934
|
const errors = [];
|
|
22935
|
+
if (mode === "team") {
|
|
22936
|
+
collectTeamNamesForCleanup(getStateFilePath(root, "team"));
|
|
22937
|
+
}
|
|
22231
22938
|
if (MODE_CONFIGS[mode]) {
|
|
22232
|
-
const
|
|
22233
|
-
if ((0,
|
|
22939
|
+
const primaryLegacyStatePath = getStateFilePath(root, mode);
|
|
22940
|
+
if ((0, import_fs12.existsSync)(primaryLegacyStatePath)) {
|
|
22234
22941
|
if (clearModeState(mode, root)) {
|
|
22235
22942
|
clearedCount++;
|
|
22236
22943
|
} else {
|
|
22237
22944
|
errors.push("legacy path");
|
|
22238
22945
|
}
|
|
22239
22946
|
}
|
|
22240
|
-
}
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
clearedCount++;
|
|
22246
|
-
} catch {
|
|
22247
|
-
errors.push("legacy path");
|
|
22248
|
-
}
|
|
22249
|
-
}
|
|
22947
|
+
}
|
|
22948
|
+
const extraLegacyCleanup = clearLegacyStateCandidates(mode, root);
|
|
22949
|
+
clearedCount += extraLegacyCleanup.cleared;
|
|
22950
|
+
if (extraLegacyCleanup.hadFailure) {
|
|
22951
|
+
errors.push("legacy path");
|
|
22250
22952
|
}
|
|
22251
22953
|
const sessionIds = listSessionIds(root);
|
|
22252
22954
|
for (const sid of sessionIds) {
|
|
22955
|
+
if (mode === "team") {
|
|
22956
|
+
collectTeamNamesForCleanup(resolveSessionStatePath("team", sid, root));
|
|
22957
|
+
}
|
|
22253
22958
|
if (MODE_CONFIGS[mode]) {
|
|
22254
22959
|
const sessionStatePath = getStateFilePath(root, mode, sid);
|
|
22255
|
-
if ((0,
|
|
22960
|
+
if ((0, import_fs12.existsSync)(sessionStatePath)) {
|
|
22256
22961
|
if (clearModeState(mode, root, sid)) {
|
|
22257
22962
|
clearedCount++;
|
|
22258
22963
|
} else {
|
|
@@ -22261,9 +22966,9 @@ var stateClearTool = {
|
|
|
22261
22966
|
}
|
|
22262
22967
|
} else {
|
|
22263
22968
|
const statePath = resolveSessionStatePath(mode, sid, root);
|
|
22264
|
-
if ((0,
|
|
22969
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
22265
22970
|
try {
|
|
22266
|
-
(0,
|
|
22971
|
+
(0, import_fs12.unlinkSync)(statePath);
|
|
22267
22972
|
clearedCount++;
|
|
22268
22973
|
} catch {
|
|
22269
22974
|
errors.push(`session: ${sid}`);
|
|
@@ -22271,7 +22976,15 @@ var stateClearTool = {
|
|
|
22271
22976
|
}
|
|
22272
22977
|
}
|
|
22273
22978
|
}
|
|
22274
|
-
|
|
22979
|
+
let removedTeamRoots = 0;
|
|
22980
|
+
let prunedMissionEntries = 0;
|
|
22981
|
+
if (mode === "team") {
|
|
22982
|
+
const teamNames = [...cleanedTeamNames];
|
|
22983
|
+
const removeSelector = teamNames.length > 0 ? teamNames : void 0;
|
|
22984
|
+
removedTeamRoots = cleanupTeamRuntimeState(root, removeSelector);
|
|
22985
|
+
prunedMissionEntries = pruneMissionBoardTeams(root, removeSelector);
|
|
22986
|
+
}
|
|
22987
|
+
if (clearedCount === 0 && errors.length === 0 && removedTeamRoots === 0 && prunedMissionEntries === 0) {
|
|
22275
22988
|
return {
|
|
22276
22989
|
content: [{
|
|
22277
22990
|
type: "text",
|
|
@@ -22285,6 +22998,16 @@ var stateClearTool = {
|
|
|
22285
22998
|
message += `
|
|
22286
22999
|
- Errors: ${errors.join(", ")}`;
|
|
22287
23000
|
}
|
|
23001
|
+
if (mode === "team") {
|
|
23002
|
+
if (removedTeamRoots > 0) {
|
|
23003
|
+
message += `
|
|
23004
|
+
- Team runtime roots removed: ${removedTeamRoots}`;
|
|
23005
|
+
}
|
|
23006
|
+
if (prunedMissionEntries > 0) {
|
|
23007
|
+
message += `
|
|
23008
|
+
- HUD mission entries pruned: ${prunedMissionEntries}`;
|
|
23009
|
+
}
|
|
23010
|
+
}
|
|
22288
23011
|
message += "\nWARNING: No session_id provided. Cleared legacy plus all session-scoped state; this is a broad operation that may affect other sessions.";
|
|
22289
23012
|
return {
|
|
22290
23013
|
content: [{
|
|
@@ -22306,6 +23029,7 @@ var stateClearTool = {
|
|
|
22306
23029
|
var stateListActiveTool = {
|
|
22307
23030
|
name: "state_list_active",
|
|
22308
23031
|
description: "List all currently active modes. Returns which modes have active state files.",
|
|
23032
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
22309
23033
|
schema: {
|
|
22310
23034
|
workingDirectory: external_exports.string().optional().describe("Working directory (defaults to cwd)"),
|
|
22311
23035
|
session_id: external_exports.string().optional().describe("Session ID for session-scoped state isolation. When provided, the tool operates only within that session. When omitted, the tool aggregates legacy state plus all session-scoped state (may include other sessions).")
|
|
@@ -22321,8 +23045,8 @@ var stateListActiveTool = {
|
|
|
22321
23045
|
for (const mode of EXTRA_STATE_ONLY_MODES) {
|
|
22322
23046
|
try {
|
|
22323
23047
|
const statePath = resolveSessionStatePath(mode, sessionId, root);
|
|
22324
|
-
if ((0,
|
|
22325
|
-
const content = (0,
|
|
23048
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
23049
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22326
23050
|
const state = JSON.parse(content);
|
|
22327
23051
|
if (state.active) {
|
|
22328
23052
|
activeModes.push(mode);
|
|
@@ -22355,9 +23079,9 @@ ${modeList}`
|
|
|
22355
23079
|
const legacyActiveModes = [...getActiveModes(root)];
|
|
22356
23080
|
for (const mode of EXTRA_STATE_ONLY_MODES) {
|
|
22357
23081
|
const statePath = getStatePath(mode, root);
|
|
22358
|
-
if ((0,
|
|
23082
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
22359
23083
|
try {
|
|
22360
|
-
const content = (0,
|
|
23084
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22361
23085
|
const state = JSON.parse(content);
|
|
22362
23086
|
if (state.active) {
|
|
22363
23087
|
legacyActiveModes.push(mode);
|
|
@@ -22378,8 +23102,8 @@ ${modeList}`
|
|
|
22378
23102
|
for (const mode of EXTRA_STATE_ONLY_MODES) {
|
|
22379
23103
|
try {
|
|
22380
23104
|
const statePath = resolveSessionStatePath(mode, sid, root);
|
|
22381
|
-
if ((0,
|
|
22382
|
-
const content = (0,
|
|
23105
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
23106
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22383
23107
|
const state = JSON.parse(content);
|
|
22384
23108
|
if (state.active) {
|
|
22385
23109
|
sessionActiveModes.push(mode);
|
|
@@ -22428,6 +23152,7 @@ ${modeList}`
|
|
|
22428
23152
|
var stateGetStatusTool = {
|
|
22429
23153
|
name: "state_get_status",
|
|
22430
23154
|
description: "Get detailed status for a specific mode or all modes. Shows active status, file paths, and state contents.",
|
|
23155
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
22431
23156
|
schema: {
|
|
22432
23157
|
mode: external_exports.enum(STATE_TOOL_MODES).optional().describe("Specific mode to check (omit for all modes)"),
|
|
22433
23158
|
workingDirectory: external_exports.string().optional().describe("Working directory (defaults to cwd)"),
|
|
@@ -22444,9 +23169,9 @@ var stateGetStatusTool = {
|
|
|
22444
23169
|
if (sessionId) {
|
|
22445
23170
|
validateSessionId(sessionId);
|
|
22446
23171
|
const statePath = MODE_CONFIGS[mode] ? getStateFilePath(root, mode, sessionId) : resolveSessionStatePath(mode, sessionId, root);
|
|
22447
|
-
const active = MODE_CONFIGS[mode] ? isModeActive(mode, root, sessionId) : (0,
|
|
23172
|
+
const active = MODE_CONFIGS[mode] ? isModeActive(mode, root, sessionId) : (0, import_fs12.existsSync)(statePath) && (() => {
|
|
22448
23173
|
try {
|
|
22449
|
-
const content = (0,
|
|
23174
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22450
23175
|
const state = JSON.parse(content);
|
|
22451
23176
|
return state.active === true;
|
|
22452
23177
|
} catch {
|
|
@@ -22454,9 +23179,9 @@ var stateGetStatusTool = {
|
|
|
22454
23179
|
}
|
|
22455
23180
|
})();
|
|
22456
23181
|
let statePreview = "No state file";
|
|
22457
|
-
if ((0,
|
|
23182
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
22458
23183
|
try {
|
|
22459
|
-
const content = (0,
|
|
23184
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22460
23185
|
const state = JSON.parse(content);
|
|
22461
23186
|
statePreview = JSON.stringify(state, null, 2).slice(0, 500);
|
|
22462
23187
|
if (statePreview.length >= 500) statePreview += "\n...(truncated)";
|
|
@@ -22467,7 +23192,7 @@ var stateGetStatusTool = {
|
|
|
22467
23192
|
lines2.push(`### Session: ${sessionId}`);
|
|
22468
23193
|
lines2.push(`- **Active:** ${active ? "Yes" : "No"}`);
|
|
22469
23194
|
lines2.push(`- **State Path:** ${statePath}`);
|
|
22470
|
-
lines2.push(`- **Exists:** ${(0,
|
|
23195
|
+
lines2.push(`- **Exists:** ${(0, import_fs12.existsSync)(statePath) ? "Yes" : "No"}`);
|
|
22471
23196
|
lines2.push(`
|
|
22472
23197
|
### State Preview
|
|
22473
23198
|
\`\`\`json
|
|
@@ -22481,9 +23206,9 @@ ${statePreview}
|
|
|
22481
23206
|
};
|
|
22482
23207
|
}
|
|
22483
23208
|
const legacyPath = getStatePath(mode, root);
|
|
22484
|
-
const legacyActive = MODE_CONFIGS[mode] ? isModeActive(mode, root) : (0,
|
|
23209
|
+
const legacyActive = MODE_CONFIGS[mode] ? isModeActive(mode, root) : (0, import_fs12.existsSync)(legacyPath) && (() => {
|
|
22485
23210
|
try {
|
|
22486
|
-
const content = (0,
|
|
23211
|
+
const content = (0, import_fs12.readFileSync)(legacyPath, "utf-8");
|
|
22487
23212
|
const state = JSON.parse(content);
|
|
22488
23213
|
return state.active === true;
|
|
22489
23214
|
} catch {
|
|
@@ -22493,13 +23218,13 @@ ${statePreview}
|
|
|
22493
23218
|
lines2.push(`### Legacy Path`);
|
|
22494
23219
|
lines2.push(`- **Active:** ${legacyActive ? "Yes" : "No"}`);
|
|
22495
23220
|
lines2.push(`- **State Path:** ${legacyPath}`);
|
|
22496
|
-
lines2.push(`- **Exists:** ${(0,
|
|
23221
|
+
lines2.push(`- **Exists:** ${(0, import_fs12.existsSync)(legacyPath) ? "Yes" : "No"}
|
|
22497
23222
|
`);
|
|
22498
23223
|
const activeSessions = MODE_CONFIGS[mode] ? getActiveSessionsForMode(mode, root) : listSessionIds(root).filter((sid) => {
|
|
22499
23224
|
try {
|
|
22500
23225
|
const sessionPath = resolveSessionStatePath(mode, sid, root);
|
|
22501
|
-
if ((0,
|
|
22502
|
-
const content = (0,
|
|
23226
|
+
if ((0, import_fs12.existsSync)(sessionPath)) {
|
|
23227
|
+
const content = (0, import_fs12.readFileSync)(sessionPath, "utf-8");
|
|
22503
23228
|
const state = JSON.parse(content);
|
|
22504
23229
|
return state.active === true;
|
|
22505
23230
|
}
|
|
@@ -22541,9 +23266,9 @@ No active sessions for this mode.`);
|
|
|
22541
23266
|
for (const mode2 of EXTRA_STATE_ONLY_MODES) {
|
|
22542
23267
|
const statePath = sessionId ? resolveSessionStatePath(mode2, sessionId, root) : getStatePath(mode2, root);
|
|
22543
23268
|
let active = false;
|
|
22544
|
-
if ((0,
|
|
23269
|
+
if ((0, import_fs12.existsSync)(statePath)) {
|
|
22545
23270
|
try {
|
|
22546
|
-
const content = (0,
|
|
23271
|
+
const content = (0, import_fs12.readFileSync)(statePath, "utf-8");
|
|
22547
23272
|
const state = JSON.parse(content);
|
|
22548
23273
|
active = state.active === true;
|
|
22549
23274
|
} catch {
|
|
@@ -22579,34 +23304,23 @@ var stateTools = [
|
|
|
22579
23304
|
];
|
|
22580
23305
|
|
|
22581
23306
|
// src/hooks/notepad/index.ts
|
|
22582
|
-
var
|
|
22583
|
-
var
|
|
23307
|
+
var import_fs14 = require("fs");
|
|
23308
|
+
var import_path13 = require("path");
|
|
22584
23309
|
|
|
22585
23310
|
// src/lib/file-lock.ts
|
|
22586
|
-
var
|
|
23311
|
+
var import_fs13 = require("fs");
|
|
22587
23312
|
var path6 = __toESM(require("path"), 1);
|
|
22588
23313
|
var DEFAULT_STALE_LOCK_MS = 3e4;
|
|
22589
23314
|
var DEFAULT_RETRY_DELAY_MS = 50;
|
|
22590
|
-
function isPidAlive(pid) {
|
|
22591
|
-
if (pid <= 0 || !Number.isFinite(pid)) return false;
|
|
22592
|
-
try {
|
|
22593
|
-
process.kill(pid, 0);
|
|
22594
|
-
return true;
|
|
22595
|
-
} catch (e) {
|
|
22596
|
-
if (e && typeof e === "object" && "code" in e && e.code === "EPERM")
|
|
22597
|
-
return true;
|
|
22598
|
-
return false;
|
|
22599
|
-
}
|
|
22600
|
-
}
|
|
22601
23315
|
function isLockStale(lockPath, staleLockMs) {
|
|
22602
23316
|
try {
|
|
22603
|
-
const stat = (0,
|
|
23317
|
+
const stat = (0, import_fs13.statSync)(lockPath);
|
|
22604
23318
|
const ageMs = Date.now() - stat.mtimeMs;
|
|
22605
23319
|
if (ageMs < staleLockMs) return false;
|
|
22606
23320
|
try {
|
|
22607
|
-
const raw = (0,
|
|
23321
|
+
const raw = (0, import_fs13.readFileSync)(lockPath, "utf-8");
|
|
22608
23322
|
const payload = JSON.parse(raw);
|
|
22609
|
-
if (payload.pid &&
|
|
23323
|
+
if (payload.pid && isProcessAlive(payload.pid)) return false;
|
|
22610
23324
|
} catch {
|
|
22611
23325
|
}
|
|
22612
23326
|
return true;
|
|
@@ -22619,34 +23333,45 @@ function lockPathFor(filePath) {
|
|
|
22619
23333
|
}
|
|
22620
23334
|
function tryAcquireSync(lockPath, staleLockMs) {
|
|
22621
23335
|
ensureDirSync(path6.dirname(lockPath));
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
if (
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
23336
|
+
try {
|
|
23337
|
+
const fd = (0, import_fs13.openSync)(
|
|
23338
|
+
lockPath,
|
|
23339
|
+
import_fs13.constants.O_CREAT | import_fs13.constants.O_EXCL | import_fs13.constants.O_WRONLY,
|
|
23340
|
+
384
|
|
23341
|
+
);
|
|
23342
|
+
const payload = JSON.stringify({
|
|
23343
|
+
pid: process.pid,
|
|
23344
|
+
timestamp: Date.now()
|
|
23345
|
+
});
|
|
23346
|
+
(0, import_fs13.writeSync)(fd, payload, null, "utf-8");
|
|
23347
|
+
return { fd, path: lockPath };
|
|
23348
|
+
} catch (err) {
|
|
23349
|
+
if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
|
|
23350
|
+
if (isLockStale(lockPath, staleLockMs)) {
|
|
23351
|
+
try {
|
|
23352
|
+
(0, import_fs13.unlinkSync)(lockPath);
|
|
23353
|
+
} catch {
|
|
23354
|
+
}
|
|
23355
|
+
try {
|
|
23356
|
+
const fd = (0, import_fs13.openSync)(
|
|
23357
|
+
lockPath,
|
|
23358
|
+
import_fs13.constants.O_CREAT | import_fs13.constants.O_EXCL | import_fs13.constants.O_WRONLY,
|
|
23359
|
+
384
|
|
23360
|
+
);
|
|
23361
|
+
const payload = JSON.stringify({
|
|
23362
|
+
pid: process.pid,
|
|
23363
|
+
timestamp: Date.now()
|
|
23364
|
+
});
|
|
23365
|
+
(0, import_fs13.writeSync)(fd, payload, null, "utf-8");
|
|
23366
|
+
return { fd, path: lockPath };
|
|
23367
|
+
} catch {
|
|
23368
|
+
return null;
|
|
22643
23369
|
}
|
|
22644
|
-
return null;
|
|
22645
23370
|
}
|
|
22646
|
-
|
|
23371
|
+
return null;
|
|
22647
23372
|
}
|
|
23373
|
+
throw err;
|
|
22648
23374
|
}
|
|
22649
|
-
return null;
|
|
22650
23375
|
}
|
|
22651
23376
|
function acquireFileLockSync(lockPath, opts) {
|
|
22652
23377
|
const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
|
|
@@ -22658,7 +23383,14 @@ function acquireFileLockSync(lockPath, opts) {
|
|
|
22658
23383
|
const sharedBuf = new SharedArrayBuffer(4);
|
|
22659
23384
|
const sharedArr = new Int32Array(sharedBuf);
|
|
22660
23385
|
while (Date.now() < deadline) {
|
|
22661
|
-
|
|
23386
|
+
const waitMs = Math.min(retryDelayMs, deadline - Date.now());
|
|
23387
|
+
try {
|
|
23388
|
+
Atomics.wait(sharedArr, 0, 0, waitMs);
|
|
23389
|
+
} catch {
|
|
23390
|
+
const waitUntil = Date.now() + waitMs;
|
|
23391
|
+
while (Date.now() < waitUntil) {
|
|
23392
|
+
}
|
|
23393
|
+
}
|
|
22662
23394
|
const retryHandle = tryAcquireSync(lockPath, staleLockMs);
|
|
22663
23395
|
if (retryHandle) return retryHandle;
|
|
22664
23396
|
}
|
|
@@ -22666,11 +23398,11 @@ function acquireFileLockSync(lockPath, opts) {
|
|
|
22666
23398
|
}
|
|
22667
23399
|
function releaseFileLockSync(handle) {
|
|
22668
23400
|
try {
|
|
22669
|
-
(0,
|
|
23401
|
+
(0, import_fs13.closeSync)(handle.fd);
|
|
22670
23402
|
} catch {
|
|
22671
23403
|
}
|
|
22672
23404
|
try {
|
|
22673
|
-
(0,
|
|
23405
|
+
(0, import_fs13.unlinkSync)(handle.path);
|
|
22674
23406
|
} catch {
|
|
22675
23407
|
}
|
|
22676
23408
|
}
|
|
@@ -22686,7 +23418,7 @@ function withFileLockSync(lockPath, fn, opts) {
|
|
|
22686
23418
|
}
|
|
22687
23419
|
}
|
|
22688
23420
|
function sleep3(ms) {
|
|
22689
|
-
return new Promise((
|
|
23421
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
22690
23422
|
}
|
|
22691
23423
|
async function acquireFileLock(lockPath, opts) {
|
|
22692
23424
|
const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
|
|
@@ -22728,20 +23460,35 @@ var DEFAULT_CONFIG = {
|
|
|
22728
23460
|
var PRIORITY_HEADER = "## Priority Context";
|
|
22729
23461
|
var WORKING_MEMORY_HEADER = "## Working Memory";
|
|
22730
23462
|
var MANUAL_HEADER = "## MANUAL";
|
|
23463
|
+
var SECTION_REGEXES = {
|
|
23464
|
+
[PRIORITY_HEADER]: createSectionRegexSet(PRIORITY_HEADER),
|
|
23465
|
+
[WORKING_MEMORY_HEADER]: createSectionRegexSet(WORKING_MEMORY_HEADER),
|
|
23466
|
+
[MANUAL_HEADER]: createSectionRegexSet(MANUAL_HEADER)
|
|
23467
|
+
};
|
|
23468
|
+
function createSectionRegexSet(header) {
|
|
23469
|
+
return {
|
|
23470
|
+
extract: new RegExp(`${header}\\n([\\s\\S]*?)(?=\\n## [^#]|$)`),
|
|
23471
|
+
replace: new RegExp(`(${header}\\n)([\\s\\S]*?)(?=## |$)`),
|
|
23472
|
+
comment: new RegExp(`${header}\\n(<!--[\\s\\S]*?-->)`)
|
|
23473
|
+
};
|
|
23474
|
+
}
|
|
23475
|
+
function getSectionRegexSet(header) {
|
|
23476
|
+
return SECTION_REGEXES[header] ?? createSectionRegexSet(header);
|
|
23477
|
+
}
|
|
22731
23478
|
function getNotepadPath(directory) {
|
|
22732
|
-
return (0,
|
|
23479
|
+
return (0, import_path13.join)(getOmcRoot(directory), NOTEPAD_FILENAME);
|
|
22733
23480
|
}
|
|
22734
23481
|
function initNotepad(directory) {
|
|
22735
23482
|
const omcDir = getOmcRoot(directory);
|
|
22736
|
-
if (!(0,
|
|
23483
|
+
if (!(0, import_fs14.existsSync)(omcDir)) {
|
|
22737
23484
|
try {
|
|
22738
|
-
(0,
|
|
23485
|
+
(0, import_fs14.mkdirSync)(omcDir, { recursive: true });
|
|
22739
23486
|
} catch {
|
|
22740
23487
|
return false;
|
|
22741
23488
|
}
|
|
22742
23489
|
}
|
|
22743
23490
|
const notepadPath = getNotepadPath(directory);
|
|
22744
|
-
if ((0,
|
|
23491
|
+
if ((0, import_fs14.existsSync)(notepadPath)) {
|
|
22745
23492
|
return true;
|
|
22746
23493
|
}
|
|
22747
23494
|
const content = `# Notepad
|
|
@@ -22766,18 +23513,17 @@ ${MANUAL_HEADER}
|
|
|
22766
23513
|
}
|
|
22767
23514
|
function readNotepad(directory) {
|
|
22768
23515
|
const notepadPath = getNotepadPath(directory);
|
|
22769
|
-
if (!(0,
|
|
23516
|
+
if (!(0, import_fs14.existsSync)(notepadPath)) {
|
|
22770
23517
|
return null;
|
|
22771
23518
|
}
|
|
22772
23519
|
try {
|
|
22773
|
-
return (0,
|
|
23520
|
+
return (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22774
23521
|
} catch {
|
|
22775
23522
|
return null;
|
|
22776
23523
|
}
|
|
22777
23524
|
}
|
|
22778
23525
|
function extractSection(content, header) {
|
|
22779
|
-
const
|
|
22780
|
-
const match = content.match(regex);
|
|
23526
|
+
const match = content.match(getSectionRegexSet(header).extract);
|
|
22781
23527
|
if (!match) {
|
|
22782
23528
|
return null;
|
|
22783
23529
|
}
|
|
@@ -22786,12 +23532,10 @@ function extractSection(content, header) {
|
|
|
22786
23532
|
return section || null;
|
|
22787
23533
|
}
|
|
22788
23534
|
function replaceSection(content, header, newContent) {
|
|
22789
|
-
const
|
|
22790
|
-
const commentMatch = content.match(
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
const comment = commentMatch ? commentMatch[1] + "\n" : "";
|
|
22794
|
-
return content.replace(regex, `$1${comment}${newContent}
|
|
23535
|
+
const { replace, comment: commentPattern } = getSectionRegexSet(header);
|
|
23536
|
+
const commentMatch = content.match(commentPattern);
|
|
23537
|
+
const preservedComment = commentMatch ? commentMatch[1] + "\n" : "";
|
|
23538
|
+
return content.replace(replace, `$1${preservedComment}${newContent}
|
|
22795
23539
|
|
|
22796
23540
|
`);
|
|
22797
23541
|
}
|
|
@@ -22817,7 +23561,7 @@ function getManualSection(directory) {
|
|
|
22817
23561
|
return extractSection(content, MANUAL_HEADER);
|
|
22818
23562
|
}
|
|
22819
23563
|
function setPriorityContext(directory, content, config2 = DEFAULT_CONFIG) {
|
|
22820
|
-
if (!(0,
|
|
23564
|
+
if (!(0, import_fs14.existsSync)(getNotepadPath(directory))) {
|
|
22821
23565
|
if (!initNotepad(directory)) {
|
|
22822
23566
|
return { success: false };
|
|
22823
23567
|
}
|
|
@@ -22825,7 +23569,7 @@ function setPriorityContext(directory, content, config2 = DEFAULT_CONFIG) {
|
|
|
22825
23569
|
const notepadPath = getNotepadPath(directory);
|
|
22826
23570
|
try {
|
|
22827
23571
|
return withFileLockSync(lockPathFor(notepadPath), () => {
|
|
22828
|
-
let notepadContent = (0,
|
|
23572
|
+
let notepadContent = (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22829
23573
|
const warning = content.length > config2.priorityMaxChars ? `Priority Context exceeds ${config2.priorityMaxChars} chars (${content.length} chars). Consider condensing.` : void 0;
|
|
22830
23574
|
notepadContent = replaceSection(notepadContent, PRIORITY_HEADER, content);
|
|
22831
23575
|
atomicWriteFileSync(notepadPath, notepadContent);
|
|
@@ -22836,7 +23580,7 @@ function setPriorityContext(directory, content, config2 = DEFAULT_CONFIG) {
|
|
|
22836
23580
|
}
|
|
22837
23581
|
}
|
|
22838
23582
|
function addWorkingMemoryEntry(directory, content) {
|
|
22839
|
-
if (!(0,
|
|
23583
|
+
if (!(0, import_fs14.existsSync)(getNotepadPath(directory))) {
|
|
22840
23584
|
if (!initNotepad(directory)) {
|
|
22841
23585
|
return false;
|
|
22842
23586
|
}
|
|
@@ -22844,7 +23588,7 @@ function addWorkingMemoryEntry(directory, content) {
|
|
|
22844
23588
|
const notepadPath = getNotepadPath(directory);
|
|
22845
23589
|
try {
|
|
22846
23590
|
return withFileLockSync(lockPathFor(notepadPath), () => {
|
|
22847
|
-
let notepadContent = (0,
|
|
23591
|
+
let notepadContent = (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22848
23592
|
const currentMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER) || "";
|
|
22849
23593
|
const now = /* @__PURE__ */ new Date();
|
|
22850
23594
|
const timestamp = now.toISOString().slice(0, 16).replace("T", " ");
|
|
@@ -22865,7 +23609,7 @@ ${content}
|
|
|
22865
23609
|
}
|
|
22866
23610
|
}
|
|
22867
23611
|
function addManualEntry(directory, content) {
|
|
22868
|
-
if (!(0,
|
|
23612
|
+
if (!(0, import_fs14.existsSync)(getNotepadPath(directory))) {
|
|
22869
23613
|
if (!initNotepad(directory)) {
|
|
22870
23614
|
return false;
|
|
22871
23615
|
}
|
|
@@ -22873,7 +23617,7 @@ function addManualEntry(directory, content) {
|
|
|
22873
23617
|
const notepadPath = getNotepadPath(directory);
|
|
22874
23618
|
try {
|
|
22875
23619
|
return withFileLockSync(lockPathFor(notepadPath), () => {
|
|
22876
|
-
let notepadContent = (0,
|
|
23620
|
+
let notepadContent = (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22877
23621
|
const currentManual = extractSection(notepadContent, MANUAL_HEADER) || "";
|
|
22878
23622
|
const now = /* @__PURE__ */ new Date();
|
|
22879
23623
|
const timestamp = now.toISOString().slice(0, 16).replace("T", " ");
|
|
@@ -22891,12 +23635,12 @@ ${content}
|
|
|
22891
23635
|
}
|
|
22892
23636
|
function pruneOldEntries(directory, daysOld = DEFAULT_CONFIG.workingMemoryDays) {
|
|
22893
23637
|
const notepadPath = getNotepadPath(directory);
|
|
22894
|
-
if (!(0,
|
|
23638
|
+
if (!(0, import_fs14.existsSync)(notepadPath)) {
|
|
22895
23639
|
return { pruned: 0, remaining: 0 };
|
|
22896
23640
|
}
|
|
22897
23641
|
try {
|
|
22898
23642
|
return withFileLockSync(lockPathFor(notepadPath), () => {
|
|
22899
|
-
let notepadContent = (0,
|
|
23643
|
+
let notepadContent = (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22900
23644
|
const workingMemory = extractSection(notepadContent, WORKING_MEMORY_HEADER);
|
|
22901
23645
|
if (!workingMemory) {
|
|
22902
23646
|
return { pruned: 0, remaining: 0 };
|
|
@@ -22934,7 +23678,7 @@ ${entry.content}`).join("\n\n");
|
|
|
22934
23678
|
}
|
|
22935
23679
|
function getNotepadStats(directory) {
|
|
22936
23680
|
const notepadPath = getNotepadPath(directory);
|
|
22937
|
-
if (!(0,
|
|
23681
|
+
if (!(0, import_fs14.existsSync)(notepadPath)) {
|
|
22938
23682
|
return {
|
|
22939
23683
|
exists: false,
|
|
22940
23684
|
totalSize: 0,
|
|
@@ -22943,7 +23687,7 @@ function getNotepadStats(directory) {
|
|
|
22943
23687
|
oldestEntry: null
|
|
22944
23688
|
};
|
|
22945
23689
|
}
|
|
22946
|
-
const content = (0,
|
|
23690
|
+
const content = (0, import_fs14.readFileSync)(notepadPath, "utf-8");
|
|
22947
23691
|
const priorityContext = extractSection(content, PRIORITY_HEADER) || "";
|
|
22948
23692
|
const workingMemory = extractSection(content, WORKING_MEMORY_HEADER) || "";
|
|
22949
23693
|
const wmMatches = workingMemory.match(
|
|
@@ -23255,6 +23999,9 @@ var notepadTools = [
|
|
|
23255
23999
|
notepadStatsTool
|
|
23256
24000
|
];
|
|
23257
24001
|
|
|
24002
|
+
// src/hooks/project-memory/index.ts
|
|
24003
|
+
var import_path21 = __toESM(require("path"), 1);
|
|
24004
|
+
|
|
23258
24005
|
// src/features/context-injector/collector.ts
|
|
23259
24006
|
var PRIORITY_ORDER = {
|
|
23260
24007
|
critical: 0,
|
|
@@ -23363,18 +24110,18 @@ var ContextCollector = class {
|
|
|
23363
24110
|
var contextCollector = new ContextCollector();
|
|
23364
24111
|
|
|
23365
24112
|
// src/hooks/rules-injector/finder.ts
|
|
23366
|
-
var
|
|
23367
|
-
var
|
|
24113
|
+
var import_fs15 = require("fs");
|
|
24114
|
+
var import_path15 = require("path");
|
|
23368
24115
|
|
|
23369
24116
|
// src/hooks/rules-injector/constants.ts
|
|
23370
|
-
var
|
|
24117
|
+
var import_path14 = require("path");
|
|
23371
24118
|
var import_os2 = require("os");
|
|
23372
|
-
var OMC_STORAGE_DIR = (0,
|
|
23373
|
-
var RULES_INJECTOR_STORAGE = (0,
|
|
24119
|
+
var OMC_STORAGE_DIR = (0, import_path14.join)((0, import_os2.homedir)(), ".omc");
|
|
24120
|
+
var RULES_INJECTOR_STORAGE = (0, import_path14.join)(OMC_STORAGE_DIR, "rules-injector");
|
|
23374
24121
|
|
|
23375
24122
|
// src/hooks/project-memory/storage.ts
|
|
23376
24123
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
23377
|
-
var
|
|
24124
|
+
var import_path16 = __toESM(require("path"), 1);
|
|
23378
24125
|
|
|
23379
24126
|
// src/hooks/project-memory/constants.ts
|
|
23380
24127
|
var CACHE_EXPIRY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -23398,7 +24145,7 @@ async function loadProjectMemory(projectRoot) {
|
|
|
23398
24145
|
}
|
|
23399
24146
|
async function saveProjectMemory(projectRoot, memory) {
|
|
23400
24147
|
const memoryPath = getMemoryPath(projectRoot);
|
|
23401
|
-
const omcDir =
|
|
24148
|
+
const omcDir = import_path16.default.dirname(memoryPath);
|
|
23402
24149
|
try {
|
|
23403
24150
|
await import_promises.default.mkdir(omcDir, { recursive: true });
|
|
23404
24151
|
await atomicWriteJson(memoryPath, memory);
|
|
@@ -23414,11 +24161,17 @@ async function withProjectMemoryLock(projectRoot, fn) {
|
|
|
23414
24161
|
|
|
23415
24162
|
// src/hooks/project-memory/detector.ts
|
|
23416
24163
|
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
23417
|
-
var
|
|
24164
|
+
var import_path18 = __toESM(require("path"), 1);
|
|
23418
24165
|
|
|
23419
24166
|
// src/hooks/project-memory/directory-mapper.ts
|
|
23420
24167
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
23421
|
-
var
|
|
24168
|
+
var import_path17 = __toESM(require("path"), 1);
|
|
24169
|
+
|
|
24170
|
+
// src/hooks/project-memory/formatter.ts
|
|
24171
|
+
var import_path20 = __toESM(require("path"), 1);
|
|
24172
|
+
|
|
24173
|
+
// src/hooks/project-memory/hot-path-tracker.ts
|
|
24174
|
+
var import_path19 = __toESM(require("path"), 1);
|
|
23422
24175
|
|
|
23423
24176
|
// src/hooks/project-memory/directive-detector.ts
|
|
23424
24177
|
function addDirective(directives, newDirective) {
|
|
@@ -23440,9 +24193,6 @@ function addDirective(directives, newDirective) {
|
|
|
23440
24193
|
return directives;
|
|
23441
24194
|
}
|
|
23442
24195
|
|
|
23443
|
-
// src/hooks/project-memory/hot-path-tracker.ts
|
|
23444
|
-
var import_path15 = __toESM(require("path"), 1);
|
|
23445
|
-
|
|
23446
24196
|
// src/hooks/project-memory/learner.ts
|
|
23447
24197
|
var writeMutexes = /* @__PURE__ */ new Map();
|
|
23448
24198
|
function withMutex(projectRoot, fn) {
|
|
@@ -23489,6 +24239,7 @@ function isPlainObject3(value) {
|
|
|
23489
24239
|
function deepMerge(base, incoming) {
|
|
23490
24240
|
const result = { ...base };
|
|
23491
24241
|
for (const key of Object.keys(incoming)) {
|
|
24242
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
23492
24243
|
const baseVal = base[key];
|
|
23493
24244
|
const incomingVal = incoming[key];
|
|
23494
24245
|
if (incomingVal === null || incomingVal === void 0) {
|
|
@@ -23551,7 +24302,7 @@ function mergeArrays(fieldName, base, incoming) {
|
|
|
23551
24302
|
return mergeScalarArray(base, incoming);
|
|
23552
24303
|
}
|
|
23553
24304
|
}
|
|
23554
|
-
function mergeByKey(base, incoming, keyFn,
|
|
24305
|
+
function mergeByKey(base, incoming, keyFn, resolve7) {
|
|
23555
24306
|
const seen = /* @__PURE__ */ new Map();
|
|
23556
24307
|
for (const item of base) {
|
|
23557
24308
|
seen.set(keyFn(item), item);
|
|
@@ -23560,7 +24311,7 @@ function mergeByKey(base, incoming, keyFn, resolve6) {
|
|
|
23560
24311
|
const key = keyFn(item);
|
|
23561
24312
|
const existing = seen.get(key);
|
|
23562
24313
|
if (existing) {
|
|
23563
|
-
seen.set(key,
|
|
24314
|
+
seen.set(key, resolve7(existing, item));
|
|
23564
24315
|
} else {
|
|
23565
24316
|
seen.set(key, item);
|
|
23566
24317
|
}
|
|
@@ -23801,27 +24552,27 @@ var memoryTools = [
|
|
|
23801
24552
|
];
|
|
23802
24553
|
|
|
23803
24554
|
// src/tools/trace-tools.ts
|
|
23804
|
-
var
|
|
23805
|
-
var
|
|
24555
|
+
var import_fs18 = require("fs");
|
|
24556
|
+
var import_path24 = require("path");
|
|
23806
24557
|
|
|
23807
24558
|
// src/hooks/subagent-tracker/session-replay.ts
|
|
23808
|
-
var
|
|
23809
|
-
var
|
|
24559
|
+
var import_fs16 = require("fs");
|
|
24560
|
+
var import_path22 = require("path");
|
|
23810
24561
|
var REPLAY_PREFIX = "agent-replay-";
|
|
23811
24562
|
var MAX_REPLAY_SIZE_BYTES = 5 * 1024 * 1024;
|
|
23812
24563
|
function getReplayFilePath(directory, sessionId) {
|
|
23813
|
-
const stateDir = (0,
|
|
23814
|
-
if (!(0,
|
|
23815
|
-
(0,
|
|
24564
|
+
const stateDir = (0, import_path22.join)(getOmcRoot(directory), "state");
|
|
24565
|
+
if (!(0, import_fs16.existsSync)(stateDir)) {
|
|
24566
|
+
(0, import_fs16.mkdirSync)(stateDir, { recursive: true });
|
|
23816
24567
|
}
|
|
23817
24568
|
const safeId = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
23818
|
-
return (0,
|
|
24569
|
+
return (0, import_path22.join)(stateDir, `${REPLAY_PREFIX}${safeId}.jsonl`);
|
|
23819
24570
|
}
|
|
23820
24571
|
function readReplayEvents(directory, sessionId) {
|
|
23821
24572
|
const filePath = getReplayFilePath(directory, sessionId);
|
|
23822
|
-
if (!(0,
|
|
24573
|
+
if (!(0, import_fs16.existsSync)(filePath)) return [];
|
|
23823
24574
|
try {
|
|
23824
|
-
const content = (0,
|
|
24575
|
+
const content = (0, import_fs16.readFileSync)(filePath, "utf-8");
|
|
23825
24576
|
return content.split("\n").filter((line) => line.trim()).map((line) => {
|
|
23826
24577
|
try {
|
|
23827
24578
|
return JSON.parse(line);
|
|
@@ -23992,15 +24743,15 @@ function getReplaySummary(directory, sessionId) {
|
|
|
23992
24743
|
}
|
|
23993
24744
|
|
|
23994
24745
|
// src/features/session-history-search/index.ts
|
|
23995
|
-
var
|
|
23996
|
-
var
|
|
24746
|
+
var import_child_process10 = require("child_process");
|
|
24747
|
+
var import_fs17 = require("fs");
|
|
23997
24748
|
var import_os3 = require("os");
|
|
23998
|
-
var
|
|
24749
|
+
var import_path23 = require("path");
|
|
23999
24750
|
var import_readline = require("readline");
|
|
24000
24751
|
var DEFAULT_LIMIT = 10;
|
|
24001
24752
|
var DEFAULT_CONTEXT_CHARS = 120;
|
|
24002
24753
|
function getClaudeConfigDir() {
|
|
24003
|
-
return process.env.CLAUDE_CONFIG_DIR || (0,
|
|
24754
|
+
return process.env.CLAUDE_CONFIG_DIR || (0, import_path23.join)((0, import_os3.homedir)(), ".claude");
|
|
24004
24755
|
}
|
|
24005
24756
|
function compactWhitespace(text) {
|
|
24006
24757
|
return text.replace(/\s+/g, " ").trim();
|
|
@@ -24034,27 +24785,27 @@ function encodeProjectPath(projectPath) {
|
|
|
24034
24785
|
}
|
|
24035
24786
|
function getMainRepoRoot(projectRoot) {
|
|
24036
24787
|
try {
|
|
24037
|
-
const gitCommonDir = (0,
|
|
24788
|
+
const gitCommonDir = (0, import_child_process10.execSync)("git rev-parse --git-common-dir", {
|
|
24038
24789
|
cwd: projectRoot,
|
|
24039
24790
|
encoding: "utf-8",
|
|
24040
24791
|
stdio: ["pipe", "pipe", "pipe"]
|
|
24041
24792
|
}).trim();
|
|
24042
|
-
const absoluteCommonDir = (0,
|
|
24043
|
-
const mainRepoRoot = (0,
|
|
24793
|
+
const absoluteCommonDir = (0, import_path23.resolve)(projectRoot, gitCommonDir);
|
|
24794
|
+
const mainRepoRoot = (0, import_path23.dirname)(absoluteCommonDir);
|
|
24044
24795
|
return mainRepoRoot === projectRoot ? null : mainRepoRoot;
|
|
24045
24796
|
} catch {
|
|
24046
24797
|
return null;
|
|
24047
24798
|
}
|
|
24048
24799
|
}
|
|
24049
24800
|
function getClaudeWorktreeParent(projectRoot) {
|
|
24050
|
-
const marker = `${(0,
|
|
24051
|
-
const normalizedRoot = (0,
|
|
24801
|
+
const marker = `${(0, import_path23.normalize)("/.claude/worktrees/")}`;
|
|
24802
|
+
const normalizedRoot = (0, import_path23.normalize)(projectRoot);
|
|
24052
24803
|
const idx = normalizedRoot.indexOf(marker);
|
|
24053
24804
|
if (idx === -1) return null;
|
|
24054
24805
|
return normalizedRoot.slice(0, idx) || null;
|
|
24055
24806
|
}
|
|
24056
24807
|
function listJsonlFiles(rootDir) {
|
|
24057
|
-
if (!(0,
|
|
24808
|
+
if (!(0, import_fs17.existsSync)(rootDir)) {
|
|
24058
24809
|
return [];
|
|
24059
24810
|
}
|
|
24060
24811
|
const files = [];
|
|
@@ -24063,12 +24814,12 @@ function listJsonlFiles(rootDir) {
|
|
|
24063
24814
|
const current = stack.pop();
|
|
24064
24815
|
let entries;
|
|
24065
24816
|
try {
|
|
24066
|
-
entries = (0,
|
|
24817
|
+
entries = (0, import_fs17.readdirSync)(current, { withFileTypes: true });
|
|
24067
24818
|
} catch {
|
|
24068
24819
|
continue;
|
|
24069
24820
|
}
|
|
24070
24821
|
for (const entry of entries) {
|
|
24071
|
-
const fullPath = (0,
|
|
24822
|
+
const fullPath = (0, import_path23.join)(current, entry.name);
|
|
24072
24823
|
if (entry.isDirectory()) {
|
|
24073
24824
|
stack.push(fullPath);
|
|
24074
24825
|
continue;
|
|
@@ -24088,8 +24839,8 @@ function uniqueSortedTargets(targets) {
|
|
|
24088
24839
|
seen.add(key);
|
|
24089
24840
|
return true;
|
|
24090
24841
|
}).sort((a, b) => {
|
|
24091
|
-
const aTime = (0,
|
|
24092
|
-
const bTime = (0,
|
|
24842
|
+
const aTime = (0, import_fs17.existsSync)(a.filePath) ? (0, import_fs17.statSync)(a.filePath).mtimeMs : 0;
|
|
24843
|
+
const bTime = (0, import_fs17.existsSync)(b.filePath) ? (0, import_fs17.statSync)(b.filePath).mtimeMs : 0;
|
|
24093
24844
|
return bTime - aTime;
|
|
24094
24845
|
});
|
|
24095
24846
|
}
|
|
@@ -24102,22 +24853,22 @@ function buildCurrentProjectTargets(projectRoot) {
|
|
|
24102
24853
|
if (claudeWorktreeParent) projectRoots.add(claudeWorktreeParent);
|
|
24103
24854
|
const targets = [];
|
|
24104
24855
|
for (const root of projectRoots) {
|
|
24105
|
-
const encodedDir = (0,
|
|
24856
|
+
const encodedDir = (0, import_path23.join)(claudeDir, "projects", encodeProjectPath(root));
|
|
24106
24857
|
for (const filePath of listJsonlFiles(encodedDir)) {
|
|
24107
24858
|
targets.push({ filePath, sourceType: "project-transcript" });
|
|
24108
24859
|
}
|
|
24109
24860
|
}
|
|
24110
|
-
const legacyTranscriptsDir = (0,
|
|
24861
|
+
const legacyTranscriptsDir = (0, import_path23.join)(claudeDir, "transcripts");
|
|
24111
24862
|
for (const filePath of listJsonlFiles(legacyTranscriptsDir)) {
|
|
24112
24863
|
targets.push({ filePath, sourceType: "legacy-transcript" });
|
|
24113
24864
|
}
|
|
24114
24865
|
const omcRoot = getOmcRoot(projectRoot);
|
|
24115
|
-
const sessionSummariesDir = (0,
|
|
24866
|
+
const sessionSummariesDir = (0, import_path23.join)(omcRoot, "sessions");
|
|
24116
24867
|
for (const filePath of listJsonlFiles(sessionSummariesDir)) {
|
|
24117
24868
|
targets.push({ filePath, sourceType: "omc-session-summary" });
|
|
24118
24869
|
}
|
|
24119
|
-
const replayDir = (0,
|
|
24120
|
-
if ((0,
|
|
24870
|
+
const replayDir = (0, import_path23.join)(omcRoot, "state");
|
|
24871
|
+
if ((0, import_fs17.existsSync)(replayDir)) {
|
|
24121
24872
|
for (const filePath of listJsonlFiles(replayDir)) {
|
|
24122
24873
|
if (filePath.includes("agent-replay-") && filePath.endsWith(".jsonl")) {
|
|
24123
24874
|
targets.push({ filePath, sourceType: "omc-session-replay" });
|
|
@@ -24129,10 +24880,10 @@ function buildCurrentProjectTargets(projectRoot) {
|
|
|
24129
24880
|
function buildAllProjectTargets() {
|
|
24130
24881
|
const claudeDir = getClaudeConfigDir();
|
|
24131
24882
|
const targets = [];
|
|
24132
|
-
for (const filePath of listJsonlFiles((0,
|
|
24883
|
+
for (const filePath of listJsonlFiles((0, import_path23.join)(claudeDir, "projects"))) {
|
|
24133
24884
|
targets.push({ filePath, sourceType: "project-transcript" });
|
|
24134
24885
|
}
|
|
24135
|
-
for (const filePath of listJsonlFiles((0,
|
|
24886
|
+
for (const filePath of listJsonlFiles((0, import_path23.join)(claudeDir, "transcripts"))) {
|
|
24136
24887
|
targets.push({ filePath, sourceType: "legacy-transcript" });
|
|
24137
24888
|
}
|
|
24138
24889
|
return uniqueSortedTargets(targets);
|
|
@@ -24141,9 +24892,9 @@ function isWithinProject(projectPath, projectRoots) {
|
|
|
24141
24892
|
if (!projectPath) {
|
|
24142
24893
|
return false;
|
|
24143
24894
|
}
|
|
24144
|
-
const normalizedProjectPath = (0,
|
|
24895
|
+
const normalizedProjectPath = (0, import_path23.normalize)((0, import_path23.resolve)(projectPath));
|
|
24145
24896
|
return projectRoots.some((root) => {
|
|
24146
|
-
const normalizedRoot = (0,
|
|
24897
|
+
const normalizedRoot = (0, import_path23.normalize)((0, import_path23.resolve)(root));
|
|
24147
24898
|
return normalizedProjectPath === normalizedRoot || normalizedProjectPath.startsWith(`${normalizedRoot}/`);
|
|
24148
24899
|
});
|
|
24149
24900
|
}
|
|
@@ -24289,7 +25040,7 @@ function buildScopeMode(project) {
|
|
|
24289
25040
|
}
|
|
24290
25041
|
async function collectMatchesFromFile(target, options) {
|
|
24291
25042
|
const matches = [];
|
|
24292
|
-
const fileMtime = (0,
|
|
25043
|
+
const fileMtime = (0, import_fs17.existsSync)(target.filePath) ? (0, import_fs17.statSync)(target.filePath).mtimeMs : 0;
|
|
24293
25044
|
if (target.sourceType === "omc-session-summary" && target.filePath.endsWith(".json")) {
|
|
24294
25045
|
try {
|
|
24295
25046
|
const payload = JSON.parse(await import("fs/promises").then((fs8) => fs8.readFile(target.filePath, "utf-8")));
|
|
@@ -24321,7 +25072,7 @@ async function collectMatchesFromFile(target, options) {
|
|
|
24321
25072
|
}
|
|
24322
25073
|
return matches;
|
|
24323
25074
|
}
|
|
24324
|
-
const stream = (0,
|
|
25075
|
+
const stream = (0, import_fs17.createReadStream)(target.filePath, { encoding: "utf-8" });
|
|
24325
25076
|
const reader = (0, import_readline.createInterface)({ input: stream, crlfDelay: Infinity });
|
|
24326
25077
|
let line = 0;
|
|
24327
25078
|
try {
|
|
@@ -24458,12 +25209,12 @@ var sessionSearchTool = {
|
|
|
24458
25209
|
// src/tools/trace-tools.ts
|
|
24459
25210
|
var REPLAY_PREFIX2 = "agent-replay-";
|
|
24460
25211
|
function findLatestSessionId(directory) {
|
|
24461
|
-
const stateDir = (0,
|
|
25212
|
+
const stateDir = (0, import_path24.join)(directory, ".omc", "state");
|
|
24462
25213
|
try {
|
|
24463
|
-
const files = (0,
|
|
25214
|
+
const files = (0, import_fs18.readdirSync)(stateDir).filter((f) => f.startsWith(REPLAY_PREFIX2) && f.endsWith(".jsonl")).map((f) => ({
|
|
24464
25215
|
name: f,
|
|
24465
25216
|
sessionId: f.slice(REPLAY_PREFIX2.length, -".jsonl".length),
|
|
24466
|
-
mtime: (0,
|
|
25217
|
+
mtime: (0, import_fs18.statSync)((0, import_path24.join)(stateDir, f)).mtimeMs
|
|
24467
25218
|
})).sort((a, b) => b.mtime - a.mtime);
|
|
24468
25219
|
return files.length > 0 ? files[0].sessionId : null;
|
|
24469
25220
|
} catch {
|
|
@@ -24522,12 +25273,14 @@ function formatTimelineEvent(event) {
|
|
|
24522
25273
|
case "hook_fire":
|
|
24523
25274
|
detail = `${event.hook} fired (${event.hook_event})`;
|
|
24524
25275
|
break;
|
|
24525
|
-
case "hook_result":
|
|
25276
|
+
case "hook_result": {
|
|
24526
25277
|
detail = `${event.hook} result`;
|
|
24527
|
-
|
|
24528
|
-
if (event.
|
|
24529
|
-
if (event.
|
|
25278
|
+
const hookParts = [];
|
|
25279
|
+
if (event.duration_ms) hookParts.push(`${event.duration_ms}ms`);
|
|
25280
|
+
if (event.context_injected) hookParts.push(`context: ${event.context_length || "?"}B`);
|
|
25281
|
+
if (hookParts.length) detail += ` (${hookParts.join(", ")})`;
|
|
24530
25282
|
break;
|
|
25283
|
+
}
|
|
24531
25284
|
case "keyword_detected":
|
|
24532
25285
|
detail = `"${event.keyword}" detected`;
|
|
24533
25286
|
break;
|
|
@@ -24804,6 +25557,70 @@ No events recorded.`
|
|
|
24804
25557
|
};
|
|
24805
25558
|
var traceTools = [traceTimelineTool, traceSummaryTool, sessionSearchTool];
|
|
24806
25559
|
|
|
25560
|
+
// src/mcp/standalone-shutdown.ts
|
|
25561
|
+
function resolveParentPid(processRef, overrideParentPid) {
|
|
25562
|
+
if (typeof overrideParentPid === "number") {
|
|
25563
|
+
return overrideParentPid;
|
|
25564
|
+
}
|
|
25565
|
+
if (typeof processRef.ppid === "number") {
|
|
25566
|
+
return processRef.ppid;
|
|
25567
|
+
}
|
|
25568
|
+
if (typeof process.ppid === "number") {
|
|
25569
|
+
return process.ppid;
|
|
25570
|
+
}
|
|
25571
|
+
return void 0;
|
|
25572
|
+
}
|
|
25573
|
+
function registerStandaloneShutdownHandlers(options) {
|
|
25574
|
+
const processRef = options.processRef ?? process;
|
|
25575
|
+
const pollIntervalMs = Math.max(100, options.pollIntervalMs ?? 1e3);
|
|
25576
|
+
const setIntervalFn = options.setIntervalFn ?? setInterval;
|
|
25577
|
+
const clearIntervalFn = options.clearIntervalFn ?? clearInterval;
|
|
25578
|
+
let shutdownPromise = null;
|
|
25579
|
+
let parentWatch = null;
|
|
25580
|
+
const stopParentWatch = () => {
|
|
25581
|
+
if (parentWatch !== null) {
|
|
25582
|
+
clearIntervalFn(parentWatch);
|
|
25583
|
+
parentWatch = null;
|
|
25584
|
+
}
|
|
25585
|
+
};
|
|
25586
|
+
const shutdown = async (reason) => {
|
|
25587
|
+
stopParentWatch();
|
|
25588
|
+
if (!shutdownPromise) {
|
|
25589
|
+
shutdownPromise = Promise.resolve(options.onShutdown(reason));
|
|
25590
|
+
}
|
|
25591
|
+
return shutdownPromise;
|
|
25592
|
+
};
|
|
25593
|
+
const register = (event, reason) => {
|
|
25594
|
+
processRef.once(event, () => {
|
|
25595
|
+
void shutdown(reason);
|
|
25596
|
+
});
|
|
25597
|
+
};
|
|
25598
|
+
register("SIGTERM", "SIGTERM");
|
|
25599
|
+
register("SIGINT", "SIGINT");
|
|
25600
|
+
register("disconnect", "parent disconnect");
|
|
25601
|
+
processRef.stdin?.once("end", () => {
|
|
25602
|
+
void shutdown("stdin end");
|
|
25603
|
+
});
|
|
25604
|
+
processRef.stdin?.once("close", () => {
|
|
25605
|
+
void shutdown("stdin close");
|
|
25606
|
+
});
|
|
25607
|
+
const expectedParentPid = resolveParentPid(processRef, options.parentPid);
|
|
25608
|
+
if (typeof expectedParentPid === "number" && expectedParentPid > 1) {
|
|
25609
|
+
const getParentPid = options.getParentPid ?? (() => resolveParentPid(processRef));
|
|
25610
|
+
parentWatch = setIntervalFn(() => {
|
|
25611
|
+
const currentParentPid = getParentPid();
|
|
25612
|
+
if (typeof currentParentPid !== "number") {
|
|
25613
|
+
return;
|
|
25614
|
+
}
|
|
25615
|
+
if (currentParentPid <= 1 || currentParentPid !== expectedParentPid) {
|
|
25616
|
+
void shutdown(`parent pid changed (${expectedParentPid} -> ${currentParentPid})`);
|
|
25617
|
+
}
|
|
25618
|
+
}, pollIntervalMs);
|
|
25619
|
+
parentWatch.unref?.();
|
|
25620
|
+
}
|
|
25621
|
+
return { shutdown };
|
|
25622
|
+
}
|
|
25623
|
+
|
|
24807
25624
|
// src/mcp/standalone-server.ts
|
|
24808
25625
|
var allTools = [
|
|
24809
25626
|
...lspTools,
|
|
@@ -24889,11 +25706,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
24889
25706
|
tools: allTools.map((tool) => ({
|
|
24890
25707
|
name: tool.name,
|
|
24891
25708
|
description: tool.description,
|
|
24892
|
-
inputSchema: zodToJsonSchema2(tool.schema)
|
|
25709
|
+
inputSchema: zodToJsonSchema2(tool.schema),
|
|
25710
|
+
...tool.annotations ? { annotations: tool.annotations } : {}
|
|
24893
25711
|
}))
|
|
24894
25712
|
};
|
|
24895
25713
|
});
|
|
24896
|
-
server.setRequestHandler(
|
|
25714
|
+
var setStandaloneCallToolRequestHandler = server.setRequestHandler.bind(server);
|
|
25715
|
+
setStandaloneCallToolRequestHandler(CallToolRequestSchema, async (request) => {
|
|
24897
25716
|
const { name, arguments: args } = request.params;
|
|
24898
25717
|
const tool = allTools.find((t) => t.name === name);
|
|
24899
25718
|
if (!tool) {
|
|
@@ -24906,7 +25725,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
24906
25725
|
const result = await tool.handler(args ?? {});
|
|
24907
25726
|
return {
|
|
24908
25727
|
content: result.content,
|
|
24909
|
-
isError: false
|
|
25728
|
+
isError: result.isError ?? false
|
|
24910
25729
|
};
|
|
24911
25730
|
} catch (error2) {
|
|
24912
25731
|
const errorMessage = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -24920,6 +25739,10 @@ async function gracefulShutdown(signal) {
|
|
|
24920
25739
|
const forceExitTimer = setTimeout(() => process.exit(1), 5e3);
|
|
24921
25740
|
forceExitTimer.unref();
|
|
24922
25741
|
console.error(`OMC MCP Server: received ${signal}, disconnecting LSP servers...`);
|
|
25742
|
+
try {
|
|
25743
|
+
await cleanupOwnedBridgeSessions();
|
|
25744
|
+
} catch {
|
|
25745
|
+
}
|
|
24923
25746
|
try {
|
|
24924
25747
|
await disconnectAll();
|
|
24925
25748
|
} catch {
|
|
@@ -24930,11 +25753,8 @@ async function gracefulShutdown(signal) {
|
|
|
24930
25753
|
}
|
|
24931
25754
|
process.exit(0);
|
|
24932
25755
|
}
|
|
24933
|
-
|
|
24934
|
-
gracefulShutdown
|
|
24935
|
-
});
|
|
24936
|
-
process.on("SIGINT", () => {
|
|
24937
|
-
gracefulShutdown("SIGINT");
|
|
25756
|
+
registerStandaloneShutdownHandlers({
|
|
25757
|
+
onShutdown: gracefulShutdown
|
|
24938
25758
|
});
|
|
24939
25759
|
async function main() {
|
|
24940
25760
|
const transport = new StdioServerTransport();
|