oh-my-opencode 4.9.2 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/codex-qa/SKILL.md +96 -0
- package/.agents/skills/codex-qa/references/app-server.md +63 -0
- package/.agents/skills/codex-qa/references/components-hooks.md +38 -0
- package/.agents/skills/codex-qa/references/docker-qa.md +62 -0
- package/.agents/skills/codex-qa/references/install-verify.md +57 -0
- package/.agents/skills/codex-qa/references/isolation.md +57 -0
- package/.agents/skills/codex-qa/references/logging-debug.md +60 -0
- package/.agents/skills/codex-qa/scripts/app-server-drive.sh +76 -0
- package/.agents/skills/codex-qa/scripts/hook-unit-probe.sh +69 -0
- package/.agents/skills/codex-qa/scripts/install-verify.sh +60 -0
- package/.agents/skills/codex-qa/scripts/lib/app-server-client.mjs +117 -0
- package/.agents/skills/codex-qa/scripts/lib/common.sh +180 -0
- package/.agents/skills/codex-qa/scripts/lib/mock-model.mjs +56 -0
- package/.agents/skills/codex-qa/scripts/tui-smoke.sh +71 -0
- package/.agents/skills/opencode-qa/SKILL.md +8 -1
- package/.agents/skills/opencode-qa/references/docker-qa.md +72 -0
- package/.agents/skills/opencode-qa/scripts/lib/common.sh +39 -1
- package/.agents/skills/tech-debt-audit/SKILL.md +277 -0
- package/.agents/skills/work-with-pr/SKILL.md +77 -53
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +1 -1
- package/.opencode/skills/work-with-pr/SKILL.md +79 -55
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +1 -1
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +2 -2
- package/README.ru.md +3 -3
- package/README.zh-cn.md +3 -3
- package/THIRD-PARTY-NOTICES.md +205 -0
- package/bin/platform.js +5 -0
- package/bin/platform.test.ts +56 -0
- package/dist/agents/atlas/agent.d.ts +4 -3
- package/dist/agents/dynamic-agent-prompt-types.d.ts +1 -1
- package/dist/agents/gpt-apply-patch-guard.d.ts +2 -2
- package/dist/agents/hephaestus/agent.d.ts +5 -0
- package/dist/agents/hephaestus/index.d.ts +1 -1
- package/dist/agents/index.d.ts +0 -1
- package/dist/agents/metis.d.ts +1 -0
- package/dist/agents/prometheus/index.d.ts +0 -1
- package/dist/agents/prometheus/system-prompt.d.ts +0 -2
- package/dist/agents/sisyphus/kimi-k2-7.d.ts +17 -0
- package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
- package/dist/agents/sisyphus-junior/kimi-k2-7.d.ts +11 -0
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/config-manager/add-tui-plugin-to-tui-config.d.ts +7 -0
- package/dist/cli/doctor/checks/codex-components.d.ts +13 -0
- package/dist/cli/doctor/checks/codex-runtime-wrapper.d.ts +7 -0
- package/dist/cli/doctor/checks/codex.d.ts +1 -1
- package/dist/cli/doctor/checks/config.d.ts +1 -1
- package/dist/cli/doctor/checks/dependencies.d.ts +1 -2
- package/dist/cli/doctor/checks/index.d.ts +1 -1
- package/dist/cli/doctor/checks/model-resolution.d.ts +1 -1
- package/dist/cli/doctor/checks/system.d.ts +1 -1
- package/dist/cli/doctor/checks/team-mode.d.ts +1 -1
- package/dist/cli/doctor/checks/tools-gh.d.ts +1 -1
- package/dist/cli/doctor/checks/tools-mcp.d.ts +1 -1
- package/dist/cli/doctor/checks/tools.d.ts +2 -1
- package/dist/cli/doctor/checks/tui-plugin-config.d.ts +8 -1
- package/dist/cli/doctor/framework/constants.d.ts +32 -0
- package/dist/cli/doctor/framework/spawn-with-timeout.d.ts +8 -0
- package/dist/cli/doctor/framework/types.d.ts +147 -0
- package/dist/cli/doctor/index.d.ts +4 -4
- package/dist/cli/doctor/runner.d.ts +1 -1
- package/dist/cli/index.js +10353 -7521
- package/dist/cli/install-ast-grep-sg.d.ts +10 -0
- package/dist/cli/install-codex/codex-cache-bins.d.ts +1 -21
- package/dist/cli/install-codex/codex-cache-bundled-mcps.d.ts +1 -5
- package/dist/cli/install-codex/codex-cache-command-shim.d.ts +1 -1
- package/dist/cli/install-codex/codex-cache-fs.d.ts +1 -3
- package/dist/cli/install-codex/codex-cache-install.d.ts +1 -13
- package/dist/cli/install-codex/codex-cache-legacy-bins.d.ts +1 -3
- package/dist/cli/install-codex/codex-cache-local-dependencies.d.ts +1 -1
- package/dist/cli/install-codex/codex-cache-mcp-manifest.d.ts +1 -2
- package/dist/cli/install-codex/codex-cache-paths.d.ts +1 -2
- package/dist/cli/install-codex/codex-cache-prune.d.ts +1 -10
- package/dist/cli/install-codex/codex-cache.d.ts +1 -4
- package/dist/cli/install-codex/codex-cached-marketplace-manifest.d.ts +1 -6
- package/dist/cli/install-codex/codex-cleanup-config.d.ts +1 -6
- package/dist/cli/install-codex/codex-cleanup.d.ts +1 -21
- package/dist/cli/install-codex/codex-config-agents.d.ts +1 -3
- package/dist/cli/install-codex/codex-config-features.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-marketplaces.d.ts +1 -6
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -9
- package/dist/cli/install-codex/codex-config-reasoning.d.ts +1 -2
- package/dist/cli/install-codex/codex-config-toml-sections.d.ts +1 -9
- package/dist/cli/install-codex/codex-config-toml.d.ts +1 -13
- package/dist/cli/install-codex/codex-hook-trust.d.ts +1 -6
- package/dist/cli/install-codex/codex-installation-detection.d.ts +1 -36
- package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +1 -8
- package/dist/cli/install-codex/codex-marketplace-snapshot.d.ts +1 -15
- package/dist/cli/install-codex/codex-marketplace.d.ts +1 -9
- package/dist/cli/install-codex/codex-model-catalog.d.ts +1 -13
- package/dist/cli/install-codex/codex-multi-agent-v2-config.d.ts +1 -12
- package/dist/cli/install-codex/codex-package-layout.d.ts +1 -1
- package/dist/cli/install-codex/codex-process.d.ts +1 -7
- package/dist/cli/install-codex/codex-project-local-cleanup-best-effort.d.ts +1 -7
- package/dist/cli/install-codex/codex-project-local-cleanup.d.ts +1 -35
- package/dist/cli/install-codex/git-bash.d.ts +1 -35
- package/dist/cli/install-codex/index.d.ts +1 -11
- package/dist/cli/install-codex/install-codex-test-fixtures.d.ts +34 -0
- package/dist/cli/install-codex/install-codex.d.ts +1 -10
- package/dist/cli/install-codex/lazycodex-version-stamp.d.ts +1 -19
- package/dist/cli/install-codex/link-cached-plugin-agents.d.ts +1 -16
- package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +1 -5
- package/dist/cli/install-codex/toml-section-editor.d.ts +1 -11
- package/dist/cli/install-codex/types.d.ts +1 -76
- package/dist/cli/mcp-oauth/login.d.ts +1 -1
- package/dist/cli/model-fallback.d.ts +1 -0
- package/dist/cli/provider-availability.d.ts +2 -0
- package/dist/cli-node/index.js +10433 -7546
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema/agent-names.d.ts +1 -1
- package/dist/config/schema/agent-overrides.d.ts +80 -16
- package/dist/config/schema/codegraph.d.ts +9 -0
- package/dist/config/schema/experimental.d.ts +0 -1
- package/dist/config/schema/git-env-prefix.d.ts +1 -5
- package/dist/config/schema/hooks.d.ts +3 -1
- package/dist/config/schema/internal/permission.d.ts +5 -1
- package/dist/config/schema/monitor.d.ts +15 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +102 -32
- package/dist/config/schema/openclaw.d.ts +5 -4
- package/dist/config/schema/team-mode.d.ts +1 -16
- package/dist/config/schema/tmux.d.ts +4 -5
- package/dist/config/schema/tui.d.ts +10 -0
- package/dist/config/schema.d.ts +2 -0
- package/dist/config/validate.d.ts +8 -0
- package/dist/create-hooks.d.ts +5 -1
- package/dist/create-managers.d.ts +7 -0
- package/dist/create-runtime-tmux-config.d.ts +1 -1
- package/dist/create-tools.d.ts +1 -1
- package/dist/features/background-agent/error-classifier.d.ts +2 -2
- package/dist/features/background-agent/index.d.ts +1 -1
- package/dist/features/background-agent/manager.d.ts +35 -2
- package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +8 -0
- package/dist/features/background-agent/parent-wake-notifier.d.ts +4 -0
- package/dist/features/background-agent/spawner/fallback-agent.d.ts +3 -2
- package/dist/features/background-agent/spawner/task-prompt-body.d.ts +5 -6
- package/dist/features/background-agent/task-snapshot.d.ts +2 -0
- package/dist/features/background-agent/types.d.ts +9 -0
- package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/plan-and-execution.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/verification-and-tooling.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -2
- package/dist/features/builtin-skills/skill-file-loader.d.ts +1 -4
- package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +1 -2
- package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +1 -2
- package/dist/features/builtin-skills/skills/debugging.d.ts +1 -2
- package/dist/features/builtin-skills/skills/dev-browser.d.ts +1 -2
- package/dist/features/builtin-skills/skills/frontend.d.ts +1 -0
- package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +1 -1
- package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +1 -2
- package/dist/features/builtin-skills/skills/git-master.d.ts +1 -2
- package/dist/features/builtin-skills/skills/index.d.ts +1 -13
- package/dist/features/builtin-skills/skills/init-deep.d.ts +1 -2
- package/dist/features/builtin-skills/skills/playwright-cli.d.ts +1 -10
- package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +1 -2
- package/dist/features/builtin-skills/skills/playwright.d.ts +1 -2
- package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +1 -2
- package/dist/features/builtin-skills/skills/review-work.d.ts +1 -2
- package/dist/features/builtin-skills/skills/security-research.d.ts +1 -2
- package/dist/features/builtin-skills/skills/security-review.d.ts +1 -2
- package/dist/features/builtin-skills/skills/team-mode.d.ts +1 -2
- package/dist/features/builtin-skills/skills/visual-qa.d.ts +1 -2
- package/dist/features/builtin-skills/skills.d.ts +1 -12
- package/dist/features/builtin-skills/types.d.ts +1 -15
- package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +1 -3
- package/dist/features/claude-code-agent-loader/claude-model-mapper.d.ts +1 -4
- package/dist/features/claude-code-agent-loader/index.d.ts +1 -5
- package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +1 -2
- package/dist/features/claude-code-agent-loader/loader.d.ts +1 -5
- package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +1 -2
- package/dist/features/claude-code-agent-loader/types.d.ts +1 -29
- package/dist/features/claude-code-command-loader/index.d.ts +1 -2
- package/dist/features/claude-code-command-loader/loader-cache.d.ts +1 -6
- package/dist/features/claude-code-command-loader/loader.d.ts +1 -8
- package/dist/features/claude-code-command-loader/types.d.ts +1 -42
- package/dist/features/claude-code-mcp-loader/configure-allowed-env-vars.d.ts +1 -5
- package/dist/features/claude-code-mcp-loader/index.d.ts +1 -11
- package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -4
- package/dist/features/claude-code-mcp-loader/scope-filter.d.ts +1 -2
- package/dist/features/claude-code-mcp-loader/transformer.d.ts +1 -2
- package/dist/features/claude-code-mcp-loader/types.d.ts +1 -43
- package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/command-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/discovery.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/index.d.ts +1 -10
- package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +1 -1
- package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/loader.d.ts +1 -36
- package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +1 -1
- package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +1 -4
- package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +1 -2
- package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +1 -3
- package/dist/features/claude-code-plugin-loader/types.d.ts +1 -237
- package/dist/features/claude-code-session-state/state.d.ts +1 -0
- package/dist/features/claude-tasks/types.d.ts +4 -4
- package/dist/features/hook-message-injector/sdk-message-lookup.d.ts +9 -2
- package/dist/features/mcp-oauth/callback-server.d.ts +1 -19
- package/dist/features/mcp-oauth/dcr.d.ts +1 -34
- package/dist/features/mcp-oauth/discovery.d.ts +1 -8
- package/dist/features/mcp-oauth/oauth-authorization-flow.d.ts +1 -26
- package/dist/features/mcp-oauth/provider.d.ts +1 -30
- package/dist/features/mcp-oauth/refresh-mutex.d.ts +1 -26
- package/dist/features/mcp-oauth/resource-indicator.d.ts +1 -0
- package/dist/features/mcp-oauth/schema.d.ts +1 -0
- package/dist/features/mcp-oauth/step-up.d.ts +1 -8
- package/dist/features/mcp-oauth/storage.d.ts +1 -17
- package/dist/features/monitor/batcher.d.ts +36 -0
- package/dist/features/monitor/envelope.d.ts +9 -0
- package/dist/features/monitor/filter.d.ts +10 -0
- package/dist/features/monitor/index.d.ts +2 -0
- package/dist/features/monitor/line-stream.d.ts +29 -0
- package/dist/features/monitor/manager-internals.d.ts +65 -0
- package/dist/features/monitor/manager.d.ts +35 -0
- package/dist/features/monitor/monitor-state-factory.d.ts +24 -0
- package/dist/features/monitor/output-injector-session-inspect.d.ts +9 -0
- package/dist/features/monitor/output-injector-types.d.ts +48 -0
- package/dist/features/monitor/output-injector.d.ts +21 -0
- package/dist/features/monitor/permission.d.ts +33 -0
- package/dist/features/monitor/pipeline.d.ts +26 -0
- package/dist/features/monitor/process.d.ts +21 -0
- package/dist/features/monitor/ring-buffer.d.ts +25 -0
- package/dist/features/monitor/types.d.ts +83 -0
- package/dist/features/opencode-runtime-skills/index.d.ts +1 -2
- package/dist/features/opencode-runtime-skills/runtime-skill-config.d.ts +1 -17
- package/dist/features/opencode-runtime-skills/skill-markdown.d.ts +1 -7
- package/dist/features/opencode-runtime-skills/source-server.d.ts +1 -24
- package/dist/features/opencode-skill-loader/allowed-tools-parser.d.ts +1 -1
- package/dist/features/opencode-skill-loader/config-source-discovery.d.ts +1 -7
- package/dist/features/opencode-skill-loader/git-master-template-injection.d.ts +1 -20
- package/dist/features/opencode-skill-loader/index.d.ts +1 -16
- package/dist/features/opencode-skill-loader/loaded-skill-from-path.d.ts +1 -9
- package/dist/features/opencode-skill-loader/loaded-skill-template-extractor.d.ts +1 -2
- package/dist/features/opencode-skill-loader/loader.d.ts +1 -21
- package/dist/features/opencode-skill-loader/merger/builtin-skill-converter.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/config-skill-entry-loader.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/scope-priority.d.ts +1 -2
- package/dist/features/opencode-skill-loader/merger/skill-definition-merger.d.ts +1 -3
- package/dist/features/opencode-skill-loader/merger/skills-config-normalizer.d.ts +1 -11
- package/dist/features/opencode-skill-loader/merger.d.ts +1 -7
- package/dist/features/opencode-skill-loader/opencode-config-skills-reader.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-content.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-deduplication.d.ts +1 -2
- package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +1 -5
- package/dist/features/opencode-skill-loader/skill-directory-loader.d.ts +1 -8
- package/dist/features/opencode-skill-loader/skill-discovery.d.ts +1 -4
- package/dist/features/opencode-skill-loader/skill-mcp-config.d.ts +1 -3
- package/dist/features/opencode-skill-loader/skill-resolution-options.d.ts +1 -9
- package/dist/features/opencode-skill-loader/skill-template-resolver.d.ts +1 -11
- package/dist/features/opencode-skill-loader/types.d.ts +1 -34
- package/dist/features/skill-mcp-manager/cleanup.d.ts +1 -8
- package/dist/features/skill-mcp-manager/connection-type.d.ts +1 -7
- package/dist/features/skill-mcp-manager/connection.d.ts +1 -14
- package/dist/features/skill-mcp-manager/env-cleaner.d.ts +1 -2
- package/dist/features/skill-mcp-manager/error-redaction.d.ts +1 -10
- package/dist/features/skill-mcp-manager/http-client.d.ts +1 -19
- package/dist/features/skill-mcp-manager/index.d.ts +1 -2
- package/dist/features/skill-mcp-manager/manager.d.ts +1 -23
- package/dist/features/skill-mcp-manager/oauth-handler.d.ts +1 -17
- package/dist/features/skill-mcp-manager/stdio-client.d.ts +1 -16
- package/dist/features/skill-mcp-manager/types.d.ts +1 -79
- package/dist/features/team-mode/member-parser.d.ts +1 -16
- package/dist/features/team-mode/team-layout-tmux/close-team-member-pane.d.ts +1 -4
- package/dist/features/team-mode/team-layout-tmux/index.d.ts +1 -1
- package/dist/features/team-mode/team-layout-tmux/layout.d.ts +1 -37
- package/dist/features/team-mode/team-layout-tmux/rebalance-team-window.d.ts +1 -9
- package/dist/features/team-mode/team-layout-tmux/resolve-caller-tmux-session.d.ts +1 -9
- package/dist/features/team-mode/team-layout-tmux/sweep-stale-team-sessions.d.ts +1 -8
- package/dist/features/team-mode/team-mailbox/ack.d.ts +1 -2
- package/dist/features/team-mode/team-mailbox/inbox.d.ts +1 -3
- package/dist/features/team-mode/team-mailbox/index.d.ts +1 -7
- package/dist/features/team-mode/team-mailbox/pending-delivery-recovery.d.ts +1 -0
- package/dist/features/team-mode/team-mailbox/poll.d.ts +1 -10
- package/dist/features/team-mode/team-mailbox/reservation.d.ts +1 -11
- package/dist/features/team-mode/team-mailbox/send.d.ts +1 -30
- package/dist/features/team-mode/team-registry/index.d.ts +1 -3
- package/dist/features/team-mode/team-registry/loader.d.ts +1 -12
- package/dist/features/team-mode/team-registry/paths.d.ts +1 -28
- package/dist/features/team-mode/team-registry/team-spec-input-normalizer.d.ts +1 -6
- package/dist/features/team-mode/team-registry/validator.d.ts +1 -10
- package/dist/features/team-mode/team-runtime/delete-team.d.ts +2 -1
- package/dist/features/team-mode/team-runtime/shutdown-helpers.d.ts +1 -1
- package/dist/features/team-mode/team-state-store/active-resume.d.ts +1 -5
- package/dist/features/team-mode/team-state-store/creating-resume.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/deleting-resume.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/error-normalization.d.ts +1 -2
- package/dist/features/team-mode/team-state-store/index.d.ts +1 -1
- package/dist/features/team-mode/team-state-store/locks.d.ts +1 -15
- package/dist/features/team-mode/team-state-store/reservation-reconciliation.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/resume-report.d.ts +1 -7
- package/dist/features/team-mode/team-state-store/resume.d.ts +1 -5
- package/dist/features/team-mode/team-state-store/runtime-cleanup.d.ts +1 -4
- package/dist/features/team-mode/team-state-store/session-liveness.d.ts +1 -9
- package/dist/features/team-mode/team-state-store/store.d.ts +1 -21
- package/dist/features/team-mode/team-state-store/worker-resume-status.d.ts +1 -9
- package/dist/features/team-mode/team-tasklist/claim.d.ts +1 -10
- package/dist/features/team-mode/team-tasklist/dependencies.d.ts +1 -2
- package/dist/features/team-mode/team-tasklist/get.d.ts +1 -3
- package/dist/features/team-mode/team-tasklist/index.d.ts +1 -6
- package/dist/features/team-mode/team-tasklist/list.d.ts +1 -8
- package/dist/features/team-mode/team-tasklist/store.d.ts +1 -3
- package/dist/features/team-mode/team-tasklist/test-support.d.ts +1 -9
- package/dist/features/team-mode/team-tasklist/update.d.ts +1 -9
- package/dist/features/team-mode/team-worktree/cleanup.d.ts +1 -3
- package/dist/features/team-mode/team-worktree/index.d.ts +1 -2
- package/dist/features/team-mode/team-worktree/manager.d.ts +1 -15
- package/dist/features/team-mode/tools/lifecycle-create-tool.d.ts +2 -2
- package/dist/features/team-mode/tools/lifecycle-inline-spec.d.ts +4 -4
- package/dist/features/team-mode/tools/lifecycle-participant.d.ts +2 -2
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +8 -8
- package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +2 -2
- package/dist/features/team-mode/tools/messaging-live-delivery-reservation.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-live-delivery-state.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-live-delivery.d.ts +1 -1
- package/dist/features/team-mode/tools/messaging-runtime.d.ts +2 -2
- package/dist/features/team-mode/tools/query.d.ts +3 -3
- package/dist/features/team-mode/tools/tasks.d.ts +2 -2
- package/dist/features/team-mode/types.d.ts +1 -343
- package/dist/features/tmux-subagent/stale-tmux-resource-sweeper.d.ts +12 -0
- package/dist/features/tool-metadata-store/store.d.ts +5 -0
- package/dist/features/tui-sidebar/compute-view.d.ts +10 -0
- package/dist/features/tui-sidebar/config-validator.d.ts +2 -0
- package/dist/features/tui-sidebar/constants.d.ts +10 -0
- package/dist/features/tui-sidebar/derivers.d.ts +10 -0
- package/dist/features/tui-sidebar/element-helpers.d.ts +9 -0
- package/dist/features/tui-sidebar/loop-reader.d.ts +2 -0
- package/dist/features/tui-sidebar/mirror-io.d.ts +3 -0
- package/dist/features/tui-sidebar/mirror-manager.d.ts +28 -0
- package/dist/features/tui-sidebar/mirror-path.d.ts +3 -0
- package/dist/features/tui-sidebar/render-view.d.ts +15 -0
- package/dist/features/tui-sidebar/roster-resolver.d.ts +2 -0
- package/dist/features/tui-sidebar/snapshot-builder.d.ts +28 -0
- package/dist/features/tui-sidebar/snapshot-schema.d.ts +41 -0
- package/dist/features/tui-sidebar/state-types.d.ts +72 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/storage/constants.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/storage/messages-reader.d.ts +6 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/storage/part-content.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/storage/parts-reader.d.ts +6 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/storage/types.d.ts +92 -0
- package/dist/hooks/ast-grep-sg-provision/hook.d.ts +19 -0
- package/dist/hooks/ast-grep-sg-provision/index.d.ts +1 -0
- package/dist/hooks/auto-slash-command/constants.d.ts +1 -5
- package/dist/hooks/auto-slash-command/detector.d.ts +1 -15
- package/dist/hooks/auto-slash-command/processed-command-store.d.ts +1 -7
- package/dist/hooks/auto-slash-command/types.d.ts +1 -48
- package/dist/hooks/auto-update-checker/checker/bundled-version.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +1 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +3 -3
- package/dist/hooks/auto-update-checker/hook.d.ts +2 -1
- package/dist/hooks/claude-code-hooks/types.d.ts +4 -0
- package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +16 -0
- package/dist/hooks/codegraph-bootstrap/hook.d.ts +34 -0
- package/dist/hooks/codegraph-bootstrap/index.d.ts +1 -0
- package/dist/hooks/codegraph-bootstrap/project-root.d.ts +1 -0
- package/dist/hooks/codegraph-bootstrap/status.d.ts +11 -0
- package/dist/hooks/delegate-task-retry/guidance.d.ts +1 -2
- package/dist/hooks/delegate-task-retry/patterns.d.ts +2 -11
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/monitor-status-injector/hook.d.ts +30 -0
- package/dist/hooks/monitor-status-injector/index.d.ts +2 -0
- package/dist/hooks/runtime-fallback/auto-retry-signal.d.ts +1 -4
- package/dist/hooks/runtime-fallback/error-classifier.d.ts +7 -6
- package/dist/hooks/runtime-fallback/fallback-state.d.ts +3 -2
- package/dist/hooks/runtime-fallback/test-timeout-clock.test-support.d.ts +6 -0
- package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +5 -0
- package/dist/hooks/tool-pair-validator/tool-part-ids.d.ts +2 -1
- package/dist/index.js +89683 -94718
- package/dist/interactive-bash-availability.d.ts +1 -0
- package/dist/mcp/codegraph.d.ts +16 -0
- package/dist/mcp/index.d.ts +10 -2
- package/dist/mcp/shared/ancestor-cli-resolver.d.ts +25 -0
- package/dist/mcp/types.d.ts +1 -1
- package/dist/oh-my-opencode.schema.json +259 -34
- package/dist/openclaw/config.d.ts +1 -8
- package/dist/openclaw/daemon.d.ts +1 -1
- package/dist/openclaw/dispatcher.d.ts +1 -12
- package/dist/openclaw/gateway-url-validation.d.ts +1 -1
- package/dist/openclaw/index.d.ts +1 -5
- package/dist/openclaw/reply-listener-discord.d.ts +1 -4
- package/dist/openclaw/reply-listener-injection.d.ts +1 -10
- package/dist/openclaw/reply-listener-log.d.ts +1 -2
- package/dist/openclaw/reply-listener-paths.d.ts +1 -7
- package/dist/openclaw/reply-listener-poll-loop.d.ts +1 -3
- package/dist/openclaw/reply-listener-process.d.ts +1 -4
- package/dist/openclaw/reply-listener-signature.d.ts +1 -2
- package/dist/openclaw/reply-listener-sleep.d.ts +1 -1
- package/dist/openclaw/reply-listener-spawn.d.ts +1 -5
- package/dist/openclaw/reply-listener-start.d.ts +1 -9
- package/dist/openclaw/reply-listener-startup.d.ts +1 -12
- package/dist/openclaw/reply-listener-state.d.ts +1 -29
- package/dist/openclaw/reply-listener-status.d.ts +1 -4
- package/dist/openclaw/reply-listener-stop.d.ts +1 -7
- package/dist/openclaw/reply-listener-telegram.d.ts +1 -4
- package/dist/openclaw/reply-listener.d.ts +1 -5
- package/dist/openclaw/runtime-dispatch.d.ts +1 -17
- package/dist/openclaw/session-registry-lock.d.ts +1 -2
- package/dist/openclaw/session-registry-paths.d.ts +1 -9
- package/dist/openclaw/session-registry-storage.d.ts +1 -4
- package/dist/openclaw/session-registry-types.d.ts +1 -11
- package/dist/openclaw/session-registry.d.ts +1 -8
- package/dist/openclaw/tmux.d.ts +1 -8
- package/dist/openclaw/types.d.ts +1 -42
- package/dist/plugin/build-team-idle-wake-hint-client.d.ts +2 -0
- package/dist/plugin/event-error-utils.d.ts +2 -1
- package/dist/plugin/event-session-lifecycle.d.ts +0 -3
- package/dist/plugin/hooks/create-continuation-hooks.d.ts +0 -6
- package/dist/plugin/hooks/create-core-hooks.d.ts +5 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +3 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +4 -1
- package/dist/plugin/messages-transform.d.ts +1 -0
- package/dist/plugin/skill-context.d.ts +2 -0
- package/dist/plugin/tool-registry-factories.d.ts +2 -1
- package/dist/plugin/tool-registry-gated-tools.d.ts +7 -0
- package/dist/plugin/tool-registry.d.ts +1 -1
- package/dist/plugin/types.d.ts +2 -9
- package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +1 -0
- package/dist/shared/archive-entry-validator.d.ts +1 -6
- package/dist/shared/bun-file-shim.d.ts +1 -8
- package/dist/shared/bun-spawn-shim.d.ts +1 -43
- package/dist/shared/bun-which-shim.d.ts +1 -1
- package/dist/shared/classify-path-environment.d.ts +1 -3
- package/dist/shared/command-executor/embedded-commands.d.ts +1 -7
- package/dist/shared/command-executor/execute-command.d.ts +1 -1
- package/dist/shared/command-executor/execute-hook-command.d.ts +1 -16
- package/dist/shared/command-executor/home-directory.d.ts +1 -1
- package/dist/shared/command-executor/resolve-commands-in-text.d.ts +1 -1
- package/dist/shared/command-executor/shell-path.d.ts +1 -2
- package/dist/shared/command-executor.d.ts +1 -4
- package/dist/shared/git-worktree/collect-git-diff-stats.d.ts +1 -2
- package/dist/shared/git-worktree/format-file-changes.d.ts +1 -2
- package/dist/shared/git-worktree/index.d.ts +1 -7
- package/dist/shared/git-worktree/parse-diff-numstat.d.ts +1 -2
- package/dist/shared/git-worktree/parse-status-porcelain-line.d.ts +1 -6
- package/dist/shared/git-worktree/parse-status-porcelain.d.ts +1 -2
- package/dist/shared/git-worktree/types.d.ts +1 -7
- package/dist/shared/internal-initiator-marker.d.ts +1 -46
- package/dist/shared/logger.d.ts +3 -11
- package/dist/shared/migration/agent-category.d.ts +1 -19
- package/dist/shared/migration/agent-names.d.ts +1 -6
- package/dist/shared/migration/config-migration.d.ts +1 -1
- package/dist/shared/migration/hook-names.d.ts +1 -6
- package/dist/shared/migration/migrations-sidecar.d.ts +1 -41
- package/dist/shared/migration/model-versions.d.ts +1 -22
- package/dist/shared/migration.d.ts +1 -5
- package/dist/shared/model-suggestion-retry.d.ts +39 -17
- package/dist/shared/plugin-identity.d.ts +8 -8
- package/dist/shared/posthog.d.ts +3 -0
- package/dist/shared/process-stream-reader.d.ts +1 -3
- package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +1 -1
- package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +1 -11
- package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +1 -9
- package/dist/shared/prompt-async-gate/queue.d.ts +1 -8
- package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +1 -14
- package/dist/shared/prompt-async-gate/reservations.d.ts +1 -9
- package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +1 -7
- package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +1 -16
- package/dist/shared/prompt-async-gate/timing.d.ts +1 -9
- package/dist/shared/prompt-async-gate/types.d.ts +1 -123
- package/dist/shared/prompt-async-gate.d.ts +3 -7
- package/dist/shared/prompt-failure-classifier.d.ts +1 -9
- package/dist/shared/session-idle-settle.d.ts +1 -12
- package/dist/shared/shell-env.d.ts +1 -1
- package/dist/shared/skill-path-resolver.d.ts +1 -1
- package/dist/shared/tmux/cmux-detect.d.ts +1 -8
- package/dist/shared/tmux/constants.d.ts +1 -5
- package/dist/shared/tmux/runner.d.ts +2 -13
- package/dist/shared/tmux/tmux-utils/adapter-deps.d.ts +9 -0
- package/dist/shared/tmux/tmux-utils/environment.d.ts +2 -4
- package/dist/shared/tmux/tmux-utils/layout.d.ts +4 -17
- package/dist/shared/tmux/tmux-utils/pane-close.d.ts +3 -10
- package/dist/shared/tmux/tmux-utils/pane-command.d.ts +1 -2
- package/dist/shared/tmux/tmux-utils/pane-dimensions.d.ts +2 -4
- package/dist/shared/tmux/tmux-utils/pane-replace.d.ts +1 -11
- package/dist/shared/tmux/tmux-utils/pane-spawn.d.ts +1 -13
- package/dist/shared/tmux/tmux-utils/server-health.d.ts +2 -14
- package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +3 -14
- package/dist/shared/tmux/tmux-utils/spawn-process.d.ts +1 -1
- package/dist/shared/tmux/tmux-utils/stale-attach-pane-sweep.d.ts +16 -0
- package/dist/shared/tmux/tmux-utils/stale-session-sweep.d.ts +4 -17
- package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +1 -13
- package/dist/shared/tmux/tmux-utils.d.ts +1 -0
- package/dist/shared/tmux/types.d.ts +1 -4
- package/dist/shared/write-file-atomically.d.ts +2 -0
- package/dist/shared/zip-entry-listing/powershell-zip-entry-listing.d.ts +1 -4
- package/dist/shared/zip-entry-listing/python-zip-entry-listing.d.ts +1 -3
- package/dist/shared/zip-entry-listing/read-zip-symlink-target.d.ts +1 -1
- package/dist/shared/zip-entry-listing/tar-zip-entry-listing.d.ts +1 -3
- package/dist/shared/zip-entry-listing/zipinfo-zip-entry-listing.d.ts +1 -4
- package/dist/shared/zip-entry-listing.d.ts +1 -4
- package/dist/skills/ast-grep/LICENSE +21 -0
- package/dist/skills/ast-grep/README.md +136 -0
- package/dist/skills/ast-grep/SKILL.md +272 -0
- package/dist/skills/ast-grep/SOURCE +1 -0
- package/dist/skills/ast-grep/install.ps1 +235 -0
- package/dist/skills/ast-grep/install.sh +286 -0
- package/dist/skills/ast-grep/references/cli.md +231 -0
- package/dist/skills/ast-grep/references/install.md +166 -0
- package/dist/skills/ast-grep/references/patterns.md +147 -0
- package/dist/skills/ast-grep/references/pitfalls.md +303 -0
- package/dist/skills/ast-grep/references/recipes.md +402 -0
- package/dist/skills/ast-grep/references/sgconfig.md +248 -0
- package/dist/skills/ast-grep/references/yaml-rules.md +509 -0
- package/dist/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/dist/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/dist/skills/ast-grep/tests/smoke.sh +212 -0
- package/dist/skills/debugging/SKILL.md +116 -0
- package/dist/skills/debugging/references/methodology/00-setup.md +108 -0
- package/dist/skills/debugging/references/methodology/02-investigate.md +130 -0
- package/dist/skills/debugging/references/methodology/04-oracle-triple.md +136 -0
- package/dist/skills/debugging/references/methodology/05-escalate.md +69 -0
- package/dist/skills/debugging/references/methodology/06-fix.md +116 -0
- package/dist/skills/debugging/references/methodology/08-qa.md +94 -0
- package/dist/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/dist/skills/debugging/references/methodology/partial-runtime-evidence.md +229 -0
- package/dist/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/dist/skills/debugging/references/runtimes/go.md +252 -0
- package/dist/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/dist/skills/debugging/references/runtimes/node.md +260 -0
- package/dist/skills/debugging/references/runtimes/python.md +248 -0
- package/dist/skills/debugging/references/runtimes/rust.md +234 -0
- package/dist/skills/debugging/references/tools/ghidra.md +212 -0
- package/dist/skills/debugging/references/tools/playwright-cli.md +194 -0
- package/dist/skills/debugging/references/tools/pwndbg.md +263 -0
- package/dist/skills/debugging/references/tools/pwntools.md +265 -0
- package/dist/skills/frontend/ATTRIBUTION.md +127 -0
- package/dist/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/dist/skills/frontend/SKILL.md +113 -0
- package/dist/skills/frontend/references/design/README.md +240 -0
- package/dist/skills/frontend/references/design/_INDEX.md +189 -0
- package/dist/skills/frontend/references/design/airbnb.md +390 -0
- package/dist/skills/frontend/references/design/airtable.md +89 -0
- package/dist/skills/frontend/references/design/apple.md +247 -0
- package/dist/skills/frontend/references/design/binance.md +345 -0
- package/dist/skills/frontend/references/design/bmw.md +180 -0
- package/dist/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/dist/skills/frontend/references/design/bugatti.md +268 -0
- package/dist/skills/frontend/references/design/cal.md +259 -0
- package/dist/skills/frontend/references/design/claude.md +312 -0
- package/dist/skills/frontend/references/design/clay.md +304 -0
- package/dist/skills/frontend/references/design/clickhouse.md +281 -0
- package/dist/skills/frontend/references/design/cohere.md +266 -0
- package/dist/skills/frontend/references/design/coinbase.md +129 -0
- package/dist/skills/frontend/references/design/composio.md +307 -0
- package/dist/skills/frontend/references/design/cursor.md +309 -0
- package/dist/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/dist/skills/frontend/references/design/elevenlabs.md +265 -0
- package/dist/skills/frontend/references/design/expo.md +281 -0
- package/dist/skills/frontend/references/design/ferrari.md +314 -0
- package/dist/skills/frontend/references/design/figma.md +220 -0
- package/dist/skills/frontend/references/design/framer.md +246 -0
- package/dist/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/dist/skills/frontend/references/design/hashicorp.md +278 -0
- package/dist/skills/frontend/references/design/ibm.md +332 -0
- package/dist/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/dist/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/dist/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/dist/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/dist/skills/frontend/references/design/intercom.md +146 -0
- package/dist/skills/frontend/references/design/kraken.md +125 -0
- package/dist/skills/frontend/references/design/lamborghini.md +288 -0
- package/dist/skills/frontend/references/design/linear.app.md +367 -0
- package/dist/skills/frontend/references/design/lovable.md +298 -0
- package/dist/skills/frontend/references/design/mastercard.md +365 -0
- package/dist/skills/frontend/references/design/meta.md +366 -0
- package/dist/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/dist/skills/frontend/references/design/minimax.md +257 -0
- package/dist/skills/frontend/references/design/mintlify.md +326 -0
- package/dist/skills/frontend/references/design/miro.md +108 -0
- package/dist/skills/frontend/references/design/mistral.ai.md +261 -0
- package/dist/skills/frontend/references/design/mongodb.md +266 -0
- package/dist/skills/frontend/references/design/nike.md +363 -0
- package/dist/skills/frontend/references/design/notion.md +309 -0
- package/dist/skills/frontend/references/design/nvidia.md +293 -0
- package/dist/skills/frontend/references/design/ollama.md +267 -0
- package/dist/skills/frontend/references/design/opencode.ai.md +281 -0
- package/dist/skills/frontend/references/design/output-skill.md +49 -0
- package/dist/skills/frontend/references/design/pinterest.md +230 -0
- package/dist/skills/frontend/references/design/playstation.md +364 -0
- package/dist/skills/frontend/references/design/posthog.md +256 -0
- package/dist/skills/frontend/references/design/raycast.md +268 -0
- package/dist/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/dist/skills/frontend/references/design/redesign-skill.md +178 -0
- package/dist/skills/frontend/references/design/renault.md +311 -0
- package/dist/skills/frontend/references/design/replicate.md +261 -0
- package/dist/skills/frontend/references/design/resend.md +303 -0
- package/dist/skills/frontend/references/design/revolut.md +185 -0
- package/dist/skills/frontend/references/design/runwayml.md +244 -0
- package/dist/skills/frontend/references/design/sanity.md +357 -0
- package/dist/skills/frontend/references/design/sentry.md +262 -0
- package/dist/skills/frontend/references/design/shopify.md +350 -0
- package/dist/skills/frontend/references/design/soft-skill.md +98 -0
- package/dist/skills/frontend/references/design/spacex.md +194 -0
- package/dist/skills/frontend/references/design/spotify.md +246 -0
- package/dist/skills/frontend/references/design/starbucks.md +580 -0
- package/dist/skills/frontend/references/design/stitch-skill.md +184 -0
- package/dist/skills/frontend/references/design/stripe.md +322 -0
- package/dist/skills/frontend/references/design/supabase.md +255 -0
- package/dist/skills/frontend/references/design/superhuman.md +252 -0
- package/dist/skills/frontend/references/design/taste-skill.md +226 -0
- package/dist/skills/frontend/references/design/tesla.md +286 -0
- package/dist/skills/frontend/references/design/theverge.md +339 -0
- package/dist/skills/frontend/references/design/together.ai.md +263 -0
- package/dist/skills/frontend/references/design/uber.md +295 -0
- package/dist/skills/frontend/references/design/vercel.md +310 -0
- package/dist/skills/frontend/references/design/vodafone.md +423 -0
- package/dist/skills/frontend/references/design/voltagent.md +323 -0
- package/dist/skills/frontend/references/design/warp.md +253 -0
- package/dist/skills/frontend/references/design/webflow.md +92 -0
- package/dist/skills/frontend/references/design/wired.md +278 -0
- package/dist/skills/frontend/references/design/wise.md +173 -0
- package/dist/skills/frontend/references/design/x.ai.md +257 -0
- package/dist/skills/frontend/references/design/zapier.md +328 -0
- package/dist/skills/frontend/references/perfection/README.md +160 -0
- package/dist/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/dist/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/dist/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/dist/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/dist/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/dist/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/dist/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/dist/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/dist/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/dist/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/dist/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/dist/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/dist/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/dist/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/dist/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/dist/skills/git-master/SKILL.md +100 -0
- package/dist/skills/git-master/agents/openai.yaml +13 -0
- package/dist/skills/init-deep/SKILL.md +309 -0
- package/dist/skills/lcx-contribute-bug-fix/SKILL.md +242 -0
- package/dist/skills/lcx-contribute-bug-fix/agents/openai.yaml +12 -0
- package/dist/skills/lcx-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
- package/dist/skills/lcx-doctor/SKILL.md +93 -0
- package/dist/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/dist/skills/lcx-report-bug/SKILL.md +237 -0
- package/dist/skills/lcx-report-bug/agents/openai.yaml +11 -0
- package/dist/skills/lsp-setup/SKILL.md +139 -0
- package/dist/skills/lsp-setup/references/bash/README.md +60 -0
- package/dist/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/dist/skills/lsp-setup/references/csharp/README.md +71 -0
- package/dist/skills/lsp-setup/references/dart/README.md +48 -0
- package/dist/skills/lsp-setup/references/elixir/README.md +51 -0
- package/dist/skills/lsp-setup/references/go/README.md +57 -0
- package/dist/skills/lsp-setup/references/haskell/README.md +57 -0
- package/dist/skills/lsp-setup/references/java/README.md +57 -0
- package/dist/skills/lsp-setup/references/julia/README.md +60 -0
- package/dist/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/dist/skills/lsp-setup/references/lua/README.md +66 -0
- package/dist/skills/lsp-setup/references/php/README.md +62 -0
- package/dist/skills/lsp-setup/references/python/README.md +71 -0
- package/dist/skills/lsp-setup/references/ruby/README.md +53 -0
- package/dist/skills/lsp-setup/references/rust/README.md +59 -0
- package/dist/skills/lsp-setup/references/swift/README.md +51 -0
- package/dist/skills/lsp-setup/references/terraform/README.md +62 -0
- package/dist/skills/lsp-setup/references/typescript/README.md +77 -0
- package/dist/skills/lsp-setup/references/yaml/README.md +70 -0
- package/dist/skills/lsp-setup/references/zig/README.md +49 -0
- package/dist/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/dist/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/dist/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/dist/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/dist/skills/programming/SKILL.md +463 -0
- package/dist/skills/programming/references/go/README.md +90 -0
- package/dist/skills/programming/references/go/backend-stack.md +641 -0
- package/dist/skills/programming/references/go/bootstrap.md +328 -0
- package/dist/skills/programming/references/go/bubbletea-v2.md +360 -0
- package/dist/skills/programming/references/go/cobra-stack.md +468 -0
- package/dist/skills/programming/references/go/concurrency.md +362 -0
- package/dist/skills/programming/references/go/data-modeling.md +329 -0
- package/dist/skills/programming/references/go/error-handling.md +359 -0
- package/dist/skills/programming/references/go/golangci-strict.md +236 -0
- package/dist/skills/programming/references/go/grpc-connect.md +375 -0
- package/dist/skills/programming/references/go/libraries.md +337 -0
- package/dist/skills/programming/references/go/one-liners.md +202 -0
- package/dist/skills/programming/references/go/sqlc-pgx.md +471 -0
- package/dist/skills/programming/references/go/testing.md +467 -0
- package/dist/skills/programming/references/go/type-patterns.md +298 -0
- package/dist/skills/programming/references/python/README.md +314 -0
- package/dist/skills/programming/references/python/async-anyio.md +442 -0
- package/dist/skills/programming/references/python/data-modeling.md +233 -0
- package/dist/skills/programming/references/python/data-processing.md +133 -0
- package/dist/skills/programming/references/python/error-handling.md +218 -0
- package/dist/skills/programming/references/python/fastapi-stack.md +316 -0
- package/dist/skills/programming/references/python/httpx2-optimization.md +360 -0
- package/dist/skills/programming/references/python/libraries.md +307 -0
- package/dist/skills/programming/references/python/one-liners.md +268 -0
- package/dist/skills/programming/references/python/orjson-stack.md +378 -0
- package/dist/skills/programming/references/python/pydantic-ai.md +285 -0
- package/dist/skills/programming/references/python/pyproject-strict.md +232 -0
- package/dist/skills/programming/references/python/textual-tui.md +201 -0
- package/dist/skills/programming/references/python/type-patterns.md +176 -0
- package/dist/skills/programming/references/rust/README.md +317 -0
- package/dist/skills/programming/references/rust/async-tokio.md +299 -0
- package/dist/skills/programming/references/rust/axum-stack.md +467 -0
- package/dist/skills/programming/references/rust/cargo-strict.md +317 -0
- package/dist/skills/programming/references/rust/clap-stack.md +409 -0
- package/dist/skills/programming/references/rust/concurrency.md +375 -0
- package/dist/skills/programming/references/rust/libraries.md +439 -0
- package/dist/skills/programming/references/rust/one-liners.md +291 -0
- package/dist/skills/programming/references/rust/proptest-insta.md +429 -0
- package/dist/skills/programming/references/rust/type-state.md +354 -0
- package/dist/skills/programming/references/rust/unsafe-discipline.md +250 -0
- package/dist/skills/programming/references/rust/zero-cost-safety.md +527 -0
- package/dist/skills/programming/references/rust-ub/README.md +289 -0
- package/dist/skills/programming/references/rust-ub/miri-sanitizers-loom.md +411 -0
- package/dist/skills/programming/references/rust-ub/ub-taxonomy.md +269 -0
- package/dist/skills/programming/references/typescript/README.md +195 -0
- package/dist/skills/programming/references/typescript/backend-hono.md +672 -0
- package/dist/skills/programming/references/typescript/bootstrap.md +199 -0
- package/dist/skills/programming/references/typescript/data-modeling.md +202 -0
- package/dist/skills/programming/references/typescript/error-handling.md +169 -0
- package/dist/skills/programming/references/typescript/tsconfig-strict.md +152 -0
- package/dist/skills/programming/references/typescript/type-patterns.md +196 -0
- package/dist/skills/programming/scripts/go/check-no-excuse-rules.sh +173 -0
- package/dist/skills/programming/scripts/go/new-project.py +138 -0
- package/dist/skills/programming/scripts/go/templates/.editorconfig +13 -0
- package/dist/skills/programming/scripts/go/templates/.golangci.yml +95 -0
- package/dist/skills/programming/scripts/go/templates/AGENTS.md.tmpl +24 -0
- package/dist/skills/programming/scripts/go/templates/README.md.tmpl +12 -0
- package/dist/skills/programming/scripts/go/templates/Taskfile.yml +40 -0
- package/dist/skills/programming/scripts/go/templates/ci.yml +37 -0
- package/dist/skills/programming/scripts/go/templates/config.go +24 -0
- package/dist/skills/programming/scripts/go/templates/gitignore +15 -0
- package/dist/skills/programming/scripts/go/templates/main.go.tmpl +22 -0
- package/dist/skills/programming/scripts/go/templates/run.go +15 -0
- package/dist/skills/programming/scripts/python/check-no-excuse-rules.py +687 -0
- package/dist/skills/programming/scripts/python/new-project.py +172 -0
- package/dist/skills/programming/scripts/python/new-script.py +116 -0
- package/dist/skills/programming/scripts/rust/check-no-excuse-rules.py +296 -0
- package/dist/skills/programming/scripts/rust/check-no-excuse-rules.sh +158 -0
- package/dist/skills/programming/scripts/rust/new-project.py +175 -0
- package/dist/skills/programming/scripts/typescript/check-no-excuse-rules.ts +282 -0
- package/dist/skills/programming/scripts/typescript/new-project.ts +177 -0
- package/dist/skills/refactor/SKILL.md +754 -0
- package/dist/skills/remove-ai-slops/SKILL.md +317 -0
- package/dist/skills/review-work/SKILL.md +594 -0
- package/dist/skills/start-work/SKILL.md +178 -0
- package/dist/skills/ultraresearch/SKILL.md +230 -0
- package/dist/skills/ulw-plan/SKILL.md +69 -0
- package/dist/skills/ulw-plan/agents/openai.yaml +7 -0
- package/dist/skills/ulw-plan/references/full-workflow.md +99 -0
- package/dist/skills/ulw-plan/references/intent-clear.md +44 -0
- package/dist/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/dist/skills/visual-qa/SKILL.md +235 -0
- package/dist/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/dist/skills/visual-qa/scripts/ansi.test.ts +45 -0
- package/dist/skills/visual-qa/scripts/ansi.ts +17 -0
- package/dist/skills/visual-qa/scripts/cli.test.ts +73 -0
- package/dist/skills/visual-qa/scripts/cli.ts +82 -0
- package/dist/skills/visual-qa/scripts/east-asian-width.test.ts +60 -0
- package/dist/skills/visual-qa/scripts/east-asian-width.ts +72 -0
- package/dist/skills/visual-qa/scripts/image-diff.test.ts +70 -0
- package/dist/skills/visual-qa/scripts/image-diff.ts +109 -0
- package/dist/skills/visual-qa/scripts/png-crc.ts +27 -0
- package/dist/skills/visual-qa/scripts/png-decode.test.ts +44 -0
- package/dist/skills/visual-qa/scripts/png-decode.ts +206 -0
- package/dist/skills/visual-qa/scripts/png-synth.ts +57 -0
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +127 -0
- package/dist/skills/visual-qa/scripts/tui-grid.test.ts +57 -0
- package/dist/skills/visual-qa/scripts/tui-grid.ts +88 -0
- package/dist/skills/visual-qa/scripts/types.ts +54 -0
- package/dist/tools/background-task/clients.d.ts +2 -0
- package/dist/tools/background-task/full-session-format.d.ts +1 -0
- package/dist/tools/background-task/types.d.ts +1 -0
- package/dist/tools/delegate-task/background-task-description.d.ts +2 -0
- package/dist/tools/delegate-task/constants.d.ts +13 -1
- package/dist/tools/delegate-task/model-selection.d.ts +3 -17
- package/dist/tools/delegate-task/model-string-parser.d.ts +1 -9
- package/dist/tools/delegate-task/sync-prompt-sender.d.ts +1 -1
- package/dist/tools/delegate-task/sync-result-fetcher.d.ts +1 -0
- package/dist/tools/delegate-task/sync-session-lifecycle.d.ts +2 -1
- package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
- package/dist/tools/delegate-task/types.d.ts +59 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/look-at/look-at-input-preparer.d.ts +6 -2
- package/dist/tools/look-at/look-at-prompt.d.ts +2 -1
- package/dist/tools/look-at/look-at-session-runner.d.ts +3 -4
- package/dist/tools/look-at/types.d.ts +2 -0
- package/dist/tools/monitor/create-monitor-tools.d.ts +4 -0
- package/dist/tools/monitor/index.d.ts +1 -0
- package/dist/tools/monitor/monitor-list.d.ts +7 -0
- package/dist/tools/monitor/monitor-output.d.ts +3 -0
- package/dist/tools/monitor/monitor-start.d.ts +9 -0
- package/dist/tools/monitor/monitor-stop.d.ts +16 -0
- package/dist/tools/session-manager/types.d.ts +1 -0
- package/dist/tools/skill/native-skills.d.ts +2 -2
- package/dist/tools/skill/scope-priority.d.ts +1 -4
- package/dist/tools/skill/skill-matcher.d.ts +1 -5
- package/dist/tools/skill-mcp/types.d.ts +1 -0
- package/dist/tools/task/types.d.ts +10 -10
- package/dist/tui.d.ts +4 -0
- package/dist/tui.js +69330 -0
- package/package.json +58 -36
- package/packages/git-bash-mcp/dist/cli.js +225 -55
- package/packages/lsp-core/package.json +41 -0
- package/packages/lsp-core/src/index.ts +28 -0
- package/packages/lsp-core/src/lsp/cleanup-errors.ts +5 -0
- package/packages/lsp-core/src/lsp/client-wrapper.ts +173 -0
- package/packages/lsp-core/src/lsp/client.ts +172 -0
- package/packages/lsp-core/src/lsp/config-loader.ts +266 -0
- package/packages/lsp-core/src/lsp/connection.ts +73 -0
- package/packages/lsp-core/src/lsp/constants.ts +11 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics.ts +154 -0
- package/packages/lsp-core/src/lsp/effective-extension.ts +10 -0
- package/packages/lsp-core/src/lsp/errors.ts +63 -0
- package/packages/lsp-core/src/lsp/formatters.ts +141 -0
- package/packages/lsp-core/src/lsp/infer-extension.ts +66 -0
- package/packages/lsp-core/src/lsp/json-rpc-connection.ts +296 -0
- package/packages/lsp-core/src/lsp/language-mappings.ts +173 -0
- package/packages/lsp-core/src/lsp/manager.ts +369 -0
- package/packages/lsp-core/src/lsp/process-signal-cleanup.ts +21 -0
- package/packages/lsp-core/src/lsp/process.ts +202 -0
- package/packages/lsp-core/src/lsp/server-definitions.ts +176 -0
- package/packages/lsp-core/src/lsp/server-install-state.ts +70 -0
- package/packages/lsp-core/src/lsp/server-installation.ts +45 -0
- package/packages/lsp-core/src/lsp/server-resolution.ts +104 -0
- package/packages/lsp-core/src/lsp/startup-failure.ts +1 -0
- package/packages/lsp-core/src/lsp/transport.ts +299 -0
- package/packages/lsp-core/src/lsp/types.ts +126 -0
- package/packages/lsp-core/src/lsp/utils.test.ts +72 -0
- package/packages/lsp-core/src/lsp/utils.ts +40 -0
- package/packages/lsp-core/src/lsp/workspace-edit.ts +206 -0
- package/packages/lsp-core/src/mcp-protocol-pin.test.ts +68 -0
- package/packages/lsp-core/src/mcp.ts +95 -0
- package/packages/lsp-core/src/missing-dependency-result.ts +19 -0
- package/packages/lsp-core/src/request-context.ts +22 -0
- package/packages/lsp-core/src/tool-surface.test.ts +157 -0
- package/packages/lsp-core/src/tools/definitions.ts +141 -0
- package/packages/lsp-core/src/tools/diagnostics.ts +97 -0
- package/packages/lsp-core/src/tools/index.ts +10 -0
- package/packages/lsp-core/src/tools/install-decision.ts +39 -0
- package/packages/lsp-core/src/tools/navigation.ts +86 -0
- package/packages/lsp-core/src/tools/parameters.ts +49 -0
- package/packages/lsp-core/src/tools/rename.ts +72 -0
- package/packages/lsp-core/src/tools/result.ts +5 -0
- package/packages/lsp-core/src/tools/runtime.ts +21 -0
- package/packages/lsp-core/src/tools/schema.ts +9 -0
- package/packages/lsp-core/src/tools/status.ts +28 -0
- package/packages/lsp-core/src/tools/symbols.ts +99 -0
- package/packages/lsp-core/src/tools/types.ts +104 -0
- package/packages/lsp-core/src/tools.ts +1 -0
- package/packages/lsp-daemon/dist/cli.js +800 -612
- package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -1
- package/packages/lsp-daemon/dist/daemon-server.js +1 -1
- package/packages/lsp-daemon/dist/index.d.ts +1 -1
- package/packages/lsp-daemon/dist/index.js +695 -505
- package/packages/lsp-daemon/dist/proxy.d.ts +3 -2
- package/packages/lsp-daemon/dist/proxy.js +16 -40
- package/packages/lsp-daemon/dist/request-routing.d.ts +2 -2
- package/packages/lsp-daemon/dist/request-routing.js +2 -2
- package/packages/lsp-daemon/package.json +2 -1
- package/packages/lsp-tools-mcp/dist/cli.js +3348 -15
- package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.d.ts +1 -13
- package/packages/lsp-tools-mcp/dist/lsp/client.d.ts +1 -20
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.d.ts +1 -16
- package/packages/lsp-tools-mcp/dist/lsp/connection.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +1 -10
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.d.ts +1 -3
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/errors.d.ts +1 -35
- package/packages/lsp-tools-mcp/dist/lsp/formatters.d.ts +1 -12
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.d.ts +1 -36
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/manager.d.ts +1 -46
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +1390 -265
- package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/process.d.ts +1 -25
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.d.ts +1 -4
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +1 -12
- package/packages/lsp-tools-mcp/dist/lsp/server-installation.d.ts +1 -1
- package/packages/lsp-tools-mcp/dist/lsp/server-resolution.d.ts +1 -11
- package/packages/lsp-tools-mcp/dist/lsp/startup-failure.d.ts +1 -3
- package/packages/lsp-tools-mcp/dist/lsp/transport.d.ts +1 -26
- package/packages/lsp-tools-mcp/dist/lsp/types.d.ts +1 -124
- package/packages/lsp-tools-mcp/dist/lsp/utils.d.ts +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.d.ts +1 -11
- package/packages/lsp-tools-mcp/dist/mcp.d.ts +1 -30
- package/packages/lsp-tools-mcp/dist/mcp.js +3312 -70
- package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +1 -2
- package/packages/lsp-tools-mcp/dist/request-context.d.ts +1 -7
- package/packages/lsp-tools-mcp/dist/request-context.js +16 -10
- package/packages/lsp-tools-mcp/dist/tools.d.ts +1 -90
- package/packages/lsp-tools-mcp/dist/tools.js +3028 -439
- package/packages/lsp-tools-mcp/package.json +3 -1
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +155 -0
- package/packages/omo-codex/lazycodex-repository/.github/workflows/pr-source-guidance.yml +11 -12
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/.mcp.json +6 -5
- package/packages/omo-codex/plugin/README.md +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2975 -0
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/bootstrap/manifests/node.json +10 -0
- package/packages/omo-codex/plugin/components/bootstrap/package.json +20 -0
- package/packages/omo-codex/plugin/components/bootstrap/scripts/bootstrap.ps1 +310 -0
- package/packages/omo-codex/plugin/components/bootstrap/scripts/build.mjs +35 -0
- package/packages/omo-codex/plugin/components/bootstrap/scripts/generate-manifests.mjs +71 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/cli.ts +153 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/download.ts +212 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/environment.ts +286 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/hook.ts +108 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/provision.ts +135 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +294 -0
- package/packages/omo-codex/plugin/components/bootstrap/src/worker.ts +279 -0
- package/packages/omo-codex/plugin/components/bootstrap/test/download.test.ts +295 -0
- package/packages/omo-codex/plugin/components/bootstrap/test/environment.test.ts +376 -0
- package/packages/omo-codex/plugin/components/bootstrap/test/provision.test.ts +464 -0
- package/packages/omo-codex/plugin/components/bootstrap/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +2205 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.d.ts +32 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +1603 -0
- package/packages/omo-codex/plugin/components/codegraph/package.json +27 -0
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +55 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +83 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +108 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +191 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +213 -0
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +563 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +401 -0
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +13 -0
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +610 -7
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +7 -6
- package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +28 -156
- package/packages/omo-codex/plugin/components/comment-checker/src/core-values.ts +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +2 -2
- package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +6 -2
- package/packages/omo-codex/plugin/components/comment-checker/test/core.test.ts +38 -35
- package/packages/omo-codex/plugin/components/comment-checker/test/fixtures/apply-patch-mixed-requests.ts +60 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +155 -26
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +3 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +48 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +11 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +223 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +123 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.js +5 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.d.ts +4 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.js +3 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.d.ts +9 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.js +45 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +39 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +44 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/cli.ts +56 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +129 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/directive.ts +13 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/index.ts +4 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/state.ts +62 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +38 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +124 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +346 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.build.json +12 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.json +27 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/vitest.config.ts +10 -0
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +3738 -28
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +6 -10
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +4 -4
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.test.mjs +8 -3
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +5 -8
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-cli.test.ts +24 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +1 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/windows-git-bash.md +3 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +4565 -89
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +7 -6
- package/packages/omo-codex/plugin/components/rules/src/cli.ts +16 -3
- package/packages/omo-codex/plugin/components/rules/src/config.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +6 -6
- package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +9 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +4 -4
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +92 -0
- package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +4 -4
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +36 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +394 -37
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +7 -6
- package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +20 -147
- package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/src/index.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +151 -27
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +87 -49
- package/packages/omo-codex/plugin/components/telemetry/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/telemetry/NOTICE +6 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +5869 -42
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +5783 -108
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +7 -8
- package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +3 -3
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +92 -142
- package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +59 -3
- package/packages/omo-codex/plugin/components/telemetry/test/codex-hook-diagnostics.test.ts +3 -3
- package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +13 -7
- package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +31 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +29 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-executor.toml +24 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +23 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +22 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/biome.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +5 -1
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +162 -37
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +7 -6
- package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +11 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +42 -47
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +64 -102
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-test-helpers.ts +101 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +111 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +39 -124
- package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +16 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +4 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +79 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +56 -82
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +45 -143
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +18 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +173 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +2419 -32
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +13 -9
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +60 -12
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +67 -10
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +14 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +2 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +50 -42
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.js +109 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.js +41 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +39 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +13 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +176 -105
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +17 -17
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +162 -85
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +64 -134
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +19 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +250 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +18 -9
- package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +67 -4
- package/packages/omo-codex/plugin/components/ulw-loop/src/evidence.ts +124 -18
- package/packages/omo-codex/plugin/components/ulw-loop/src/goal-status.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +132 -55
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-goal-factory.ts +124 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-blockers.ts +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +44 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +230 -138
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +186 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-status.test.ts +85 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +120 -192
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-checkpoint.test.ts +215 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +7 -195
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-complete-goals.test.ts +41 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +172 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-helpers.test.ts +0 -6
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-json-errors.test.ts +89 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +39 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/evidence-criteria-gate.test.ts +29 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/browser-screenshot.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/cli-pass.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/code-review.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/data-diff.txt +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/gate-review.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/http-dump.txt +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/rejection.txt +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/checkpoint-builders.ts +98 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +91 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +110 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/goal-status.test.ts +35 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/plan-crud.test.ts +11 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-blockers.test.ts +102 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-doc.test.ts +38 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +131 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +150 -176
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +48 -16
- package/packages/omo-codex/plugin/package-lock.json +327 -232
- package/packages/omo-codex/plugin/package.json +4 -2
- package/packages/omo-codex/plugin/scripts/auto-update-state.d.mts +20 -0
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +30 -8
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +0 -5
- package/packages/omo-codex/plugin/scripts/build-components.mjs +60 -5
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +2 -0
- package/packages/omo-codex/plugin/scripts/install-flow.mjs +43 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +125 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +43 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +29 -0
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +121 -0
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +5 -5
- package/packages/omo-codex/plugin/shared/package.json +24 -0
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +28 -0
- package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +105 -0
- package/packages/omo-codex/plugin/shared/tsconfig.build.json +9 -0
- package/packages/omo-codex/plugin/shared/tsconfig.json +16 -0
- package/packages/omo-codex/plugin/skills/ast-grep/LICENSE +21 -0
- package/packages/omo-codex/plugin/skills/ast-grep/README.md +136 -0
- package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +272 -0
- package/packages/omo-codex/plugin/skills/ast-grep/SOURCE +1 -0
- package/packages/omo-codex/plugin/skills/ast-grep/install.ps1 +235 -0
- package/packages/omo-codex/plugin/skills/ast-grep/install.sh +286 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/cli.md +231 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/install.md +166 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/patterns.md +147 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/pitfalls.md +303 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/recipes.md +402 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/sgconfig.md +248 -0
- package/packages/omo-codex/plugin/skills/ast-grep/references/yaml-rules.md +509 -0
- package/packages/omo-codex/plugin/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.sh +212 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +127 -0
- package/packages/omo-codex/plugin/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +113 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +240 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +189 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/airbnb.md +390 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/airtable.md +89 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/apple.md +247 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/binance.md +345 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bmw.md +180 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bugatti.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cal.md +259 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/claude.md +312 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clay.md +304 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clickhouse.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cohere.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/coinbase.md +129 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/composio.md +307 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cursor.md +309 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/elevenlabs.md +265 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/expo.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ferrari.md +314 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/figma.md +220 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/framer.md +246 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/hashicorp.md +278 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ibm.md +332 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/intercom.md +146 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/kraken.md +125 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lamborghini.md +288 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/linear.app.md +367 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lovable.md +298 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mastercard.md +365 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/meta.md +366 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/minimax.md +257 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mintlify.md +326 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/miro.md +108 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mistral.ai.md +261 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mongodb.md +266 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nike.md +363 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/notion.md +309 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nvidia.md +293 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ollama.md +267 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/opencode.ai.md +281 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/output-skill.md +49 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/pinterest.md +230 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/playstation.md +364 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/posthog.md +256 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/raycast.md +268 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/redesign-skill.md +178 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/renault.md +311 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/replicate.md +261 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/resend.md +303 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/revolut.md +185 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/runwayml.md +244 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sanity.md +357 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sentry.md +262 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/shopify.md +350 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/soft-skill.md +98 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spacex.md +194 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spotify.md +246 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/starbucks.md +580 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stitch-skill.md +184 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stripe.md +322 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/supabase.md +255 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/superhuman.md +252 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/taste-skill.md +226 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/tesla.md +286 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/theverge.md +339 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/together.ai.md +263 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/uber.md +295 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vercel.md +310 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vodafone.md +423 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/voltagent.md +323 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/warp.md +253 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/webflow.md +92 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wired.md +278 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wise.md +173 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/x.ai.md +257 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/zapier.md +328 -0
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +160 -0
- package/packages/omo-codex/plugin/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +79 -28
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +2 -2
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +7 -6
- package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +14 -23
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +17 -17
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +42 -47
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +64 -102
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +19 -3
- package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +119 -11
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -4
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +29 -2
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +3 -0
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +12 -12
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +171 -0
- package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +250 -0
- package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +166 -0
- package/packages/omo-codex/plugin/test/bootstrap-orchestration.test.mjs +371 -0
- package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +134 -0
- package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +249 -0
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +287 -0
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +199 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +38 -2
- package/packages/omo-codex/plugin/test/index.js +13 -0
- package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +4 -5
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +10 -1
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +5 -3
- package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +179 -0
- package/packages/omo-codex/plugin/test/payload-equivalence.test.mjs +109 -0
- package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +165 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -3
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +37 -1
- package/packages/omo-codex/scripts/install-agent-links.test.mjs +41 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +3 -3
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-cli-args.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-preservation.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +1 -2
- package/packages/omo-codex/scripts/install-config.test.mjs +8 -6
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +13377 -0
- package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +55 -0
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +3 -4
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-local.mjs +54 -236
- package/packages/omo-codex/scripts/install-local.test.mjs +8 -1
- package/packages/omo-codex/scripts/install-marketplace-cache.test.mjs +3 -3
- package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +34 -77
- package/packages/omo-codex/scripts/install-packaged-local.test.mjs +8 -4
- package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +1 -1
- package/packages/shared-skills/package.json +6 -1
- package/packages/shared-skills/skills/ast-grep/LICENSE +21 -0
- package/packages/shared-skills/skills/ast-grep/README.md +136 -0
- package/packages/shared-skills/skills/ast-grep/SKILL.md +272 -0
- package/packages/shared-skills/skills/ast-grep/SOURCE +1 -0
- package/packages/shared-skills/skills/ast-grep/install.ps1 +235 -0
- package/packages/shared-skills/skills/ast-grep/install.sh +286 -0
- package/packages/shared-skills/skills/ast-grep/references/cli.md +231 -0
- package/packages/shared-skills/skills/ast-grep/references/install.md +166 -0
- package/packages/shared-skills/skills/ast-grep/references/patterns.md +147 -0
- package/packages/shared-skills/skills/ast-grep/references/pitfalls.md +303 -0
- package/packages/shared-skills/skills/ast-grep/references/recipes.md +402 -0
- package/packages/shared-skills/skills/ast-grep/references/sgconfig.md +248 -0
- package/packages/shared-skills/skills/ast-grep/references/yaml-rules.md +509 -0
- package/packages/shared-skills/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
- package/packages/shared-skills/skills/ast-grep/tests/smoke.ps1 +123 -0
- package/packages/shared-skills/skills/ast-grep/tests/smoke.sh +212 -0
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +127 -0
- package/packages/shared-skills/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/packages/shared-skills/skills/frontend/SKILL.md +113 -0
- package/packages/shared-skills/skills/frontend/references/design/README.md +240 -0
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +189 -0
- package/packages/shared-skills/skills/frontend/references/design/airbnb.md +390 -0
- package/packages/shared-skills/skills/frontend/references/design/airtable.md +89 -0
- package/packages/shared-skills/skills/frontend/references/design/apple.md +247 -0
- package/packages/shared-skills/skills/frontend/references/design/binance.md +345 -0
- package/packages/shared-skills/skills/frontend/references/design/bmw.md +180 -0
- package/packages/shared-skills/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/packages/shared-skills/skills/frontend/references/design/bugatti.md +268 -0
- package/packages/shared-skills/skills/frontend/references/design/cal.md +259 -0
- package/packages/shared-skills/skills/frontend/references/design/claude.md +312 -0
- package/packages/shared-skills/skills/frontend/references/design/clay.md +304 -0
- package/packages/shared-skills/skills/frontend/references/design/clickhouse.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/cohere.md +266 -0
- package/packages/shared-skills/skills/frontend/references/design/coinbase.md +129 -0
- package/packages/shared-skills/skills/frontend/references/design/composio.md +307 -0
- package/packages/shared-skills/skills/frontend/references/design/cursor.md +309 -0
- package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +217 -0
- package/packages/shared-skills/skills/frontend/references/design/elevenlabs.md +265 -0
- package/packages/shared-skills/skills/frontend/references/design/expo.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/ferrari.md +314 -0
- package/packages/shared-skills/skills/frontend/references/design/figma.md +220 -0
- package/packages/shared-skills/skills/frontend/references/design/framer.md +246 -0
- package/packages/shared-skills/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/packages/shared-skills/skills/frontend/references/design/hashicorp.md +278 -0
- package/packages/shared-skills/skills/frontend/references/design/ibm.md +332 -0
- package/packages/shared-skills/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
- package/packages/shared-skills/skills/frontend/references/design/intercom.md +146 -0
- package/packages/shared-skills/skills/frontend/references/design/kraken.md +125 -0
- package/packages/shared-skills/skills/frontend/references/design/lamborghini.md +288 -0
- package/packages/shared-skills/skills/frontend/references/design/linear.app.md +367 -0
- package/packages/shared-skills/skills/frontend/references/design/lovable.md +298 -0
- package/packages/shared-skills/skills/frontend/references/design/mastercard.md +365 -0
- package/packages/shared-skills/skills/frontend/references/design/meta.md +366 -0
- package/packages/shared-skills/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/packages/shared-skills/skills/frontend/references/design/minimax.md +257 -0
- package/packages/shared-skills/skills/frontend/references/design/mintlify.md +326 -0
- package/packages/shared-skills/skills/frontend/references/design/miro.md +108 -0
- package/packages/shared-skills/skills/frontend/references/design/mistral.ai.md +261 -0
- package/packages/shared-skills/skills/frontend/references/design/mongodb.md +266 -0
- package/packages/shared-skills/skills/frontend/references/design/nike.md +363 -0
- package/packages/shared-skills/skills/frontend/references/design/notion.md +309 -0
- package/packages/shared-skills/skills/frontend/references/design/nvidia.md +293 -0
- package/packages/shared-skills/skills/frontend/references/design/ollama.md +267 -0
- package/packages/shared-skills/skills/frontend/references/design/opencode.ai.md +281 -0
- package/packages/shared-skills/skills/frontend/references/design/output-skill.md +49 -0
- package/packages/shared-skills/skills/frontend/references/design/pinterest.md +230 -0
- package/packages/shared-skills/skills/frontend/references/design/playstation.md +364 -0
- package/packages/shared-skills/skills/frontend/references/design/posthog.md +256 -0
- package/packages/shared-skills/skills/frontend/references/design/raycast.md +268 -0
- package/packages/shared-skills/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
- package/packages/shared-skills/skills/frontend/references/design/redesign-skill.md +178 -0
- package/packages/shared-skills/skills/frontend/references/design/renault.md +311 -0
- package/packages/shared-skills/skills/frontend/references/design/replicate.md +261 -0
- package/packages/shared-skills/skills/frontend/references/design/resend.md +303 -0
- package/packages/shared-skills/skills/frontend/references/design/revolut.md +185 -0
- package/packages/shared-skills/skills/frontend/references/design/runwayml.md +244 -0
- package/packages/shared-skills/skills/frontend/references/design/sanity.md +357 -0
- package/packages/shared-skills/skills/frontend/references/design/sentry.md +262 -0
- package/packages/shared-skills/skills/frontend/references/design/shopify.md +350 -0
- package/packages/shared-skills/skills/frontend/references/design/soft-skill.md +98 -0
- package/packages/shared-skills/skills/frontend/references/design/spacex.md +194 -0
- package/packages/shared-skills/skills/frontend/references/design/spotify.md +246 -0
- package/packages/shared-skills/skills/frontend/references/design/starbucks.md +580 -0
- package/packages/shared-skills/skills/frontend/references/design/stitch-skill.md +184 -0
- package/packages/shared-skills/skills/frontend/references/design/stripe.md +322 -0
- package/packages/shared-skills/skills/frontend/references/design/supabase.md +255 -0
- package/packages/shared-skills/skills/frontend/references/design/superhuman.md +252 -0
- package/packages/shared-skills/skills/frontend/references/design/taste-skill.md +226 -0
- package/packages/shared-skills/skills/frontend/references/design/tesla.md +286 -0
- package/packages/shared-skills/skills/frontend/references/design/theverge.md +339 -0
- package/packages/shared-skills/skills/frontend/references/design/together.ai.md +263 -0
- package/packages/shared-skills/skills/frontend/references/design/uber.md +295 -0
- package/packages/shared-skills/skills/frontend/references/design/vercel.md +310 -0
- package/packages/shared-skills/skills/frontend/references/design/vodafone.md +423 -0
- package/packages/shared-skills/skills/frontend/references/design/voltagent.md +323 -0
- package/packages/shared-skills/skills/frontend/references/design/warp.md +253 -0
- package/packages/shared-skills/skills/frontend/references/design/webflow.md +92 -0
- package/packages/shared-skills/skills/frontend/references/design/wired.md +278 -0
- package/packages/shared-skills/skills/frontend/references/design/wise.md +173 -0
- package/packages/shared-skills/skills/frontend/references/design/x.ai.md +257 -0
- package/packages/shared-skills/skills/frontend/references/design/zapier.md +328 -0
- package/packages/shared-skills/skills/frontend/references/perfection/README.md +160 -0
- package/packages/shared-skills/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/README.md +273 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/packages/shared-skills/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/packages/shared-skills/skills/init-deep/SKILL.md +1 -1
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +79 -28
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/agents/openai.yaml +2 -2
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +7 -6
- package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/refactor/SKILL.md +12 -21
- package/packages/shared-skills/skills/review-work/SKILL.md +11 -9
- package/packages/shared-skills/skills/start-work/SKILL.md +5 -4
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +9 -8
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +69 -0
- package/packages/shared-skills/skills/ulw-plan/agents/openai.yaml +7 -0
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +99 -0
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +44 -0
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +44 -0
- package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
- package/packages/shared-skills/skills/visual-qa/SKILL.md +17 -1
- package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +44 -0
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +48 -4
- package/dist/cli/doctor/constants.d.ts +0 -32
- package/dist/cli/doctor/spawn-with-timeout.d.ts +0 -8
- package/dist/cli/doctor/types.d.ts +0 -148
- package/dist/features/builtin-skills/skills/frontend-ui-ux.d.ts +0 -2
- package/dist/hooks/session-recovery/constants.d.ts +0 -4
- package/dist/hooks/session-recovery/detect-error-type.d.ts +0 -4
- package/dist/hooks/session-recovery/error-recovery.d.ts +0 -4
- package/dist/hooks/session-recovery/hook-types.d.ts +0 -22
- package/dist/hooks/session-recovery/hook.d.ts +0 -4
- package/dist/hooks/session-recovery/index.d.ts +0 -5
- package/dist/hooks/session-recovery/interrupted-idle-message-fetch-timeout.d.ts +0 -7
- package/dist/hooks/session-recovery/interrupted-tool-results.d.ts +0 -3
- package/dist/hooks/session-recovery/message-state.d.ts +0 -4
- package/dist/hooks/session-recovery/recover-thinking-block-order.d.ts +0 -5
- package/dist/hooks/session-recovery/recover-thinking-disabled-violation.d.ts +0 -5
- package/dist/hooks/session-recovery/recover-tool-result-missing.d.ts +0 -10
- package/dist/hooks/session-recovery/recover-unavailable-tool.d.ts +0 -5
- package/dist/hooks/session-recovery/resume.d.ts +0 -7
- package/dist/hooks/session-recovery/storage/latest-assistant-message.d.ts +0 -5
- package/dist/hooks/session-recovery/storage/messages-reader.d.ts +0 -6
- package/dist/hooks/session-recovery/storage/orphan-thinking-search.d.ts +0 -2
- package/dist/hooks/session-recovery/storage/part-content.d.ts +0 -3
- package/dist/hooks/session-recovery/storage/parts-reader.d.ts +0 -6
- package/dist/hooks/session-recovery/storage/thinking-block-search.d.ts +0 -2
- package/dist/hooks/session-recovery/storage/thinking-prepend.d.ts +0 -33
- package/dist/hooks/session-recovery/storage/thinking-strip.d.ts +0 -11
- package/dist/hooks/session-recovery/storage.d.ts +0 -20
- package/dist/hooks/session-recovery/types.d.ts +0 -105
- package/dist/mcp/ast-grep.d.ts +0 -11
- package/dist/plugin/event-session-recovery.d.ts +0 -9
- package/dist/plugin/user-abort-interrupted-recovery-guard.d.ts +0 -6
- package/packages/ast-grep-mcp/dist/cli.js +0 -1126
- package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.js +0 -6
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +0 -132
- package/packages/lsp-tools-mcp/dist/lsp/client.js +0 -131
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +0 -220
- package/packages/lsp-tools-mcp/dist/lsp/connection.js +0 -66
- package/packages/lsp-tools-mcp/dist/lsp/constants.js +0 -10
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +0 -125
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +0 -8
- package/packages/lsp-tools-mcp/dist/lsp/errors.js +0 -56
- package/packages/lsp-tools-mcp/dist/lsp/formatters.js +0 -106
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +0 -59
- package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.js +0 -247
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +0 -170
- package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.js +0 -17
- package/packages/lsp-tools-mcp/dist/lsp/process.js +0 -153
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +0 -170
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +0 -51
- package/packages/lsp-tools-mcp/dist/lsp/server-installation.js +0 -40
- package/packages/lsp-tools-mcp/dist/lsp/server-resolution.js +0 -86
- package/packages/lsp-tools-mcp/dist/lsp/startup-failure.js +0 -35
- package/packages/lsp-tools-mcp/dist/lsp/transport.js +0 -238
- package/packages/lsp-tools-mcp/dist/lsp/types.js +0 -1
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +0 -175
- package/packages/lsp-tools-mcp/dist/missing-dependency-result.js +0 -14
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +0 -7
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +0 -173
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +0 -22
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +0 -165
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +0 -5
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +0 -4
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +0 -6
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +0 -10
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +0 -2
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +0 -11
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +0 -3
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +0 -104
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +0 -26
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +0 -144
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +0 -43
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +0 -1
- package/packages/omo-codex/plugin/components/comment-checker/src/record.ts +0 -11
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +0 -47
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +0 -127
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/config.js +0 -100
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +0 -26
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +0 -36
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +0 -65
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +0 -24
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +0 -24
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +0 -172
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +0 -74
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +0 -32
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +0 -29
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +0 -9
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +0 -70
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +0 -101
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +0 -60
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +0 -61
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +0 -60
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +0 -11
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +0 -75
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +0 -29
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +0 -44
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +0 -85
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +0 -12
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +0 -33
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +0 -40
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +0 -28
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +0 -146
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +0 -112
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +0 -18
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +0 -93
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +0 -27
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +0 -30
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +0 -237
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +0 -31
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +0 -48
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +0 -23
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +0 -111
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +0 -9
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +0 -18
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +0 -59
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +0 -126
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +0 -20
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +0 -41
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +0 -10
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +0 -90
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +0 -128
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +0 -168
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +0 -49
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +0 -91
- package/packages/omo-codex/plugin/components/rules/src/rules/cache.ts +0 -64
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +0 -122
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-cache.ts +0 -87
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-loader.ts +0 -94
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-loader.ts +0 -84
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-paths.ts +0 -103
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-static-loader.ts +0 -43
- package/packages/omo-codex/plugin/components/rules/src/rules/engine-types.ts +0 -45
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +0 -123
- package/packages/omo-codex/plugin/components/rules/src/rules/errors.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-cache.ts +0 -73
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-paths.ts +0 -47
- package/packages/omo-codex/plugin/components/rules/src/rules/finder-sources.ts +0 -45
- package/packages/omo-codex/plugin/components/rules/src/rules/finder.ts +0 -220
- package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +0 -149
- package/packages/omo-codex/plugin/components/rules/src/rules/matcher.ts +0 -142
- package/packages/omo-codex/plugin/components/rules/src/rules/ordering.ts +0 -33
- package/packages/omo-codex/plugin/components/rules/src/rules/parser-frontmatter.ts +0 -39
- package/packages/omo-codex/plugin/components/rules/src/rules/parser-yaml.ts +0 -271
- package/packages/omo-codex/plugin/components/rules/src/rules/parser.ts +0 -35
- package/packages/omo-codex/plugin/components/rules/src/rules/plugin-root.ts +0 -55
- package/packages/omo-codex/plugin/components/rules/src/rules/project-root.ts +0 -30
- package/packages/omo-codex/plugin/components/rules/src/rules/scanner.ts +0 -162
- package/packages/omo-codex/plugin/components/rules/src/rules/sources.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/src/rules/truncator.ts +0 -84
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +0 -141
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +0 -16
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +0 -146
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +0 -80
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +0 -5
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +0 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +0 -20
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +0 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +0 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +0 -18
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +0 -15
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +0 -42
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +0 -10
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +0 -35
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +0 -12
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +0 -108
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +0 -4
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +0 -31
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +0 -68
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +0 -21
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +0 -29
- package/packages/omo-codex/plugin/components/telemetry/src/atomic-write.ts +0 -22
- package/packages/omo-codex/plugin/components/telemetry/src/data-path.ts +0 -45
- package/packages/omo-codex/plugin/components/telemetry/src/diagnostics.ts +0 -154
- package/packages/omo-codex/plugin/components/telemetry/src/env-flags.ts +0 -43
- package/packages/omo-codex/plugin/components/telemetry/src/posthog-activity-state.ts +0 -97
- package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +0 -21
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +0 -7
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +0 -122
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/skills/frontend-ui-ux/SKILL.md +0 -77
- package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +0 -85
- package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +0 -43
- package/packages/omo-codex/scripts/install/agent-source-roots.mjs +0 -13
- package/packages/omo-codex/scripts/install/agents.mjs +0 -154
- package/packages/omo-codex/scripts/install/bin-dir.mjs +0 -20
- package/packages/omo-codex/scripts/install/bin-links.mjs +0 -276
- package/packages/omo-codex/scripts/install/cache.mjs +0 -295
- package/packages/omo-codex/scripts/install/cached-marketplace-manifest.mjs +0 -21
- package/packages/omo-codex/scripts/install/cli-args.mjs +0 -149
- package/packages/omo-codex/scripts/install/command-shim.mjs +0 -1
- package/packages/omo-codex/scripts/install/config.mjs +0 -257
- package/packages/omo-codex/scripts/install/delegated-command.mjs +0 -29
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +0 -28
- package/packages/omo-codex/scripts/install/git-bash.mjs +0 -107
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +0 -209
- package/packages/omo-codex/scripts/install/hook-targets.mjs +0 -46
- package/packages/omo-codex/scripts/install/hook-trust.mjs +0 -84
- package/packages/omo-codex/scripts/install/lazycodex-version-stamp.mjs +0 -102
- package/packages/omo-codex/scripts/install/legacy-bins.mjs +0 -66
- package/packages/omo-codex/scripts/install/marketplace.mjs +0 -104
- package/packages/omo-codex/scripts/install/mcp-runtime-cache.mjs +0 -81
- package/packages/omo-codex/scripts/install/model-catalog.mjs +0 -74
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +0 -50
- package/packages/omo-codex/scripts/install/permissions.d.mts +0 -1
- package/packages/omo-codex/scripts/install/permissions.mjs +0 -37
- package/packages/omo-codex/scripts/install/process.mjs +0 -22
- package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +0 -228
- package/packages/omo-codex/scripts/install/reasoning-config.mjs +0 -72
- package/packages/omo-codex/scripts/install/snapshot.mjs +0 -53
- package/packages/omo-codex/scripts/install/source-package-build.mjs +0 -20
- package/packages/omo-codex/scripts/install/toml-editor.mjs +0 -64
- package/packages/omo-codex/scripts/install/utils.mjs +0 -15
- package/packages/omo-codex/scripts/sync-telemetry-component.mjs +0 -116
- package/packages/omo-codex/scripts/sync-telemetry-component.test.mjs +0 -94
- package/packages/shared-skills/skills/frontend-ui-ux/SKILL.md +0 -77
- /package/dist/cli/doctor/{doctor-target.d.ts → framework/doctor-target.d.ts} +0 -0
- /package/dist/cli/doctor/{format-default.d.ts → framework/format-default.d.ts} +0 -0
- /package/dist/cli/doctor/{format-shared.d.ts → framework/format-shared.d.ts} +0 -0
- /package/dist/cli/doctor/{format-status.d.ts → framework/format-status.d.ts} +0 -0
- /package/dist/cli/doctor/{format-verbose.d.ts → framework/format-verbose.d.ts} +0 -0
- /package/dist/cli/doctor/{formatter.d.ts → framework/formatter.d.ts} +0 -0
- /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/empty-messages.d.ts +0 -0
- /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/empty-text.d.ts +0 -0
- /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/message-dir.d.ts +0 -0
- /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/part-id.d.ts +0 -0
- /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/text-part-injector.d.ts +0 -0
- /package/packages/omo-codex/plugin/components/{comment-checker → codegraph}/dist/cli.d.ts +0 -0
- /package/packages/omo-codex/plugin/components/{rules → lazycodex-executor-verify}/dist/cli.d.ts +0 -0
|
@@ -1,42 +1,3752 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// components/lsp/src/cli.ts
|
|
4
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
5
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
6
|
+
import { argv, execPath as execPath2, stderr } from "node:process";
|
|
7
|
+
|
|
8
|
+
// components/lsp/src/codex-hook-cli.ts
|
|
9
|
+
import { stdin as processStdin } from "node:process";
|
|
10
|
+
|
|
11
|
+
// ../../lsp-daemon/dist/index.js
|
|
12
|
+
import { readFileSync } from "node:fs";
|
|
13
|
+
import { resolve } from "node:path";
|
|
14
|
+
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
15
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
16
|
+
import { pathToFileURL } from "node:url";
|
|
17
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
18
|
+
import { existsSync, statSync } from "node:fs";
|
|
19
|
+
import { delimiter, join } from "node:path";
|
|
20
|
+
import { basename, extname } from "node:path";
|
|
21
|
+
import { connect as connect2 } from "node:net";
|
|
22
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
23
|
+
import { closeSync as closeSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, openSync as openSync2 } from "node:fs";
|
|
24
|
+
import { connect } from "node:net";
|
|
25
|
+
import { dirname as dirname2 } from "node:path";
|
|
26
|
+
import { execPath } from "node:process";
|
|
27
|
+
import { fileURLToPath } from "node:url";
|
|
28
|
+
import { closeSync, mkdirSync, openSync, readFileSync as readFileSync2, unlinkSync, writeSync } from "node:fs";
|
|
29
|
+
import { dirname } from "node:path";
|
|
30
|
+
import { createHash } from "node:crypto";
|
|
3
31
|
import { createRequire } from "node:module";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
32
|
+
import { homedir, tmpdir } from "node:os";
|
|
33
|
+
import { join as join2 } from "node:path";
|
|
34
|
+
import { resolve as resolve4 } from "node:path";
|
|
35
|
+
import { existsSync as existsSync6, statSync as statSync2 } from "node:fs";
|
|
36
|
+
import { dirname as dirname4, join as join6, resolve as resolve2 } from "node:path";
|
|
37
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, writeFileSync } from "node:fs";
|
|
38
|
+
import { homedir as homedir2 } from "node:os";
|
|
39
|
+
import { dirname as dirname3, isAbsolute, join as join3 } from "node:path";
|
|
40
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
41
|
+
import { homedir as homedir3 } from "node:os";
|
|
42
|
+
import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as join4 } from "node:path";
|
|
43
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
44
|
+
import { delimiter as delimiter3, join as join5 } from "node:path";
|
|
45
|
+
import { existsSync as existsSync7, lstatSync, readdirSync } from "node:fs";
|
|
46
|
+
import { join as join7, resolve as resolve3 } from "node:path";
|
|
47
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
48
|
+
import { lstatSync as lstatSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
49
|
+
import { join as join8 } from "node:path";
|
|
50
|
+
import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
51
|
+
import { dirname as dirname5, isAbsolute as isAbsolute3, relative, resolve as resolve5 } from "node:path";
|
|
52
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
53
|
+
function reportBestEffortCleanupError(operation, error) {
|
|
54
|
+
if (process.env["CODEX_LSP_DEBUG_CLEANUP"] !== "1")
|
|
55
|
+
return;
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
console.error(`[codex-lsp] ignored ${operation} failure during cleanup: ${message}`);
|
|
58
|
+
}
|
|
59
|
+
var storage = new AsyncLocalStorage;
|
|
60
|
+
function contextCwd() {
|
|
61
|
+
return storage.getStore()?.cwd ?? process.cwd();
|
|
62
|
+
}
|
|
63
|
+
function contextEnv(key) {
|
|
64
|
+
const store = storage.getStore();
|
|
65
|
+
if (store?.env)
|
|
66
|
+
return store.env[key];
|
|
67
|
+
return process.env[key];
|
|
68
|
+
}
|
|
69
|
+
var DEFAULT_MAX_REFERENCES = 200;
|
|
70
|
+
var DEFAULT_MAX_SYMBOLS = 200;
|
|
71
|
+
var DEFAULT_MAX_DIAGNOSTICS = 200;
|
|
72
|
+
var DEFAULT_MAX_DIRECTORY_FILES = 50;
|
|
73
|
+
var REQUEST_TIMEOUT_MS = 15000;
|
|
74
|
+
var INIT_TIMEOUT_MS = 60000;
|
|
75
|
+
var IDLE_TIMEOUT_MS = 5 * 60000;
|
|
76
|
+
var REAPER_INTERVAL_MS = 60000;
|
|
77
|
+
var STOP_HARD_KILL_TIMEOUT_MS = 5000;
|
|
78
|
+
var STOP_SIGKILL_GRACE_MS = 1000;
|
|
79
|
+
|
|
80
|
+
class LspConnectionClosedError extends Error {
|
|
81
|
+
serverId;
|
|
82
|
+
root;
|
|
83
|
+
name = "LspConnectionClosedError";
|
|
84
|
+
constructor(serverId, root, message) {
|
|
85
|
+
super(message ?? `LSP connection closed for ${serverId} at ${root}`);
|
|
86
|
+
this.serverId = serverId;
|
|
87
|
+
this.root = root;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class LspProcessExitedError extends Error {
|
|
92
|
+
serverId;
|
|
93
|
+
root;
|
|
94
|
+
exitCode;
|
|
95
|
+
stderrTail;
|
|
96
|
+
name = "LspProcessExitedError";
|
|
97
|
+
constructor(serverId, root, exitCode, stderrTail) {
|
|
98
|
+
const stderrSuffix = stderrTail ? `
|
|
99
|
+
stderr tail: ${stderrTail}` : "";
|
|
100
|
+
super(`LSP server ${serverId} at ${root} exited with code ${exitCode ?? "null"}${stderrSuffix}`);
|
|
101
|
+
this.serverId = serverId;
|
|
102
|
+
this.root = root;
|
|
103
|
+
this.exitCode = exitCode;
|
|
104
|
+
this.stderrTail = stderrTail;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
class LspRequestTimeoutError extends Error {
|
|
109
|
+
method;
|
|
110
|
+
stderrTail;
|
|
111
|
+
name = "LspRequestTimeoutError";
|
|
112
|
+
constructor(method, stderrTail) {
|
|
113
|
+
const stderrSuffix = stderrTail ? `
|
|
114
|
+
recent stderr: ${stderrTail}` : "";
|
|
115
|
+
super(`LSP request timeout (method: ${method})${stderrSuffix}`);
|
|
116
|
+
this.method = method;
|
|
117
|
+
this.stderrTail = stderrTail;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
class LspInvalidPathError extends Error {
|
|
122
|
+
name = "LspInvalidPathError";
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
class LspServerLookupError extends Error {
|
|
126
|
+
name = "LspServerLookupError";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
class LspServerInitializingError extends Error {
|
|
130
|
+
originalError;
|
|
131
|
+
name = "LspServerInitializingError";
|
|
132
|
+
constructor(originalError) {
|
|
133
|
+
super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
|
|
134
|
+
this.originalError = originalError;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
class LspProcessSpawnError extends Error {
|
|
139
|
+
name = "LspProcessSpawnError";
|
|
140
|
+
}
|
|
141
|
+
function isLspDeadConnectionError(err) {
|
|
142
|
+
return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
|
|
143
|
+
}
|
|
144
|
+
var HEADER_SEPARATOR = `\r
|
|
145
|
+
\r
|
|
146
|
+
`;
|
|
147
|
+
var PARSE_ERROR = -32700;
|
|
148
|
+
var INVALID_REQUEST = -32600;
|
|
149
|
+
var METHOD_NOT_FOUND = -32601;
|
|
150
|
+
var INTERNAL_ERROR = -32603;
|
|
151
|
+
|
|
152
|
+
class JsonRpcConnection {
|
|
153
|
+
reader;
|
|
154
|
+
writer;
|
|
155
|
+
pendingRequests = new Map;
|
|
156
|
+
notificationHandlers = new Map;
|
|
157
|
+
requestHandlers = new Map;
|
|
158
|
+
closeHandlers = [];
|
|
159
|
+
errorHandlers = [];
|
|
160
|
+
inputBuffer = Buffer.alloc(0);
|
|
161
|
+
nextRequestId = 1;
|
|
162
|
+
listening = false;
|
|
163
|
+
disposed = false;
|
|
164
|
+
constructor(reader, writer) {
|
|
165
|
+
this.reader = reader;
|
|
166
|
+
this.writer = writer;
|
|
167
|
+
}
|
|
168
|
+
listen() {
|
|
169
|
+
if (this.listening)
|
|
170
|
+
return;
|
|
171
|
+
this.listening = true;
|
|
172
|
+
this.reader.on("data", this.handleData);
|
|
173
|
+
this.reader.on("close", this.handleClose);
|
|
174
|
+
this.reader.on("end", this.handleClose);
|
|
175
|
+
this.reader.on("error", this.handleStreamError);
|
|
176
|
+
this.writer.on("error", this.handleStreamError);
|
|
177
|
+
}
|
|
178
|
+
onNotification(method, handler) {
|
|
179
|
+
this.notificationHandlers.set(method, handler);
|
|
180
|
+
}
|
|
181
|
+
onRequest(method, handler) {
|
|
182
|
+
this.requestHandlers.set(method, handler);
|
|
183
|
+
}
|
|
184
|
+
onClose(handler) {
|
|
185
|
+
this.closeHandlers.push(handler);
|
|
186
|
+
}
|
|
187
|
+
onError(handler) {
|
|
188
|
+
this.errorHandlers.push(handler);
|
|
189
|
+
}
|
|
190
|
+
async sendRequest(method, params) {
|
|
191
|
+
if (this.disposed)
|
|
192
|
+
throw new Error("JSON-RPC connection is disposed");
|
|
193
|
+
const id = this.nextRequestId;
|
|
194
|
+
this.nextRequestId += 1;
|
|
195
|
+
const message = params === undefined ? { jsonrpc: "2.0", id, method } : { jsonrpc: "2.0", id, method, params };
|
|
196
|
+
const responsePromise = new Promise((resolve6, reject) => {
|
|
197
|
+
this.pendingRequests.set(String(id), {
|
|
198
|
+
resolve(result) {
|
|
199
|
+
resolve6(result);
|
|
200
|
+
},
|
|
201
|
+
reject
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
try {
|
|
205
|
+
await this.writeMessage(message);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
this.pendingRequests.delete(String(id));
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
return responsePromise;
|
|
211
|
+
}
|
|
212
|
+
async sendNotification(method, params) {
|
|
213
|
+
if (this.disposed)
|
|
214
|
+
return;
|
|
215
|
+
const message = params === undefined ? { jsonrpc: "2.0", method } : { jsonrpc: "2.0", method, params };
|
|
216
|
+
await this.writeMessage(message);
|
|
217
|
+
}
|
|
218
|
+
dispose() {
|
|
219
|
+
if (this.disposed)
|
|
220
|
+
return;
|
|
221
|
+
this.disposed = true;
|
|
222
|
+
this.reader.off("data", this.handleData);
|
|
223
|
+
this.reader.off("close", this.handleClose);
|
|
224
|
+
this.reader.off("end", this.handleClose);
|
|
225
|
+
this.reader.off("error", this.handleStreamError);
|
|
226
|
+
this.writer.off("error", this.handleStreamError);
|
|
227
|
+
for (const pending of this.pendingRequests.values()) {
|
|
228
|
+
pending.reject(new Error("JSON-RPC connection disposed"));
|
|
229
|
+
}
|
|
230
|
+
this.pendingRequests.clear();
|
|
231
|
+
this.notificationHandlers.clear();
|
|
232
|
+
this.requestHandlers.clear();
|
|
233
|
+
}
|
|
234
|
+
handleData = (chunk) => {
|
|
235
|
+
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
236
|
+
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
237
|
+
this.drainInputBuffer();
|
|
238
|
+
};
|
|
239
|
+
handleClose = () => {
|
|
240
|
+
for (const handler of this.closeHandlers) {
|
|
241
|
+
handler();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
handleStreamError = (error) => {
|
|
245
|
+
this.emitError(error);
|
|
246
|
+
};
|
|
247
|
+
drainInputBuffer() {
|
|
248
|
+
while (true) {
|
|
249
|
+
const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR);
|
|
250
|
+
if (headerEnd === -1)
|
|
251
|
+
return;
|
|
252
|
+
const headers = this.inputBuffer.subarray(0, headerEnd).toString("ascii");
|
|
253
|
+
const contentLength = parseContentLength(headers);
|
|
254
|
+
if (contentLength === null) {
|
|
255
|
+
this.inputBuffer = Buffer.alloc(0);
|
|
256
|
+
this.emitError(new Error("JSON-RPC message is missing Content-Length header"));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const bodyStart = headerEnd + Buffer.byteLength(HEADER_SEPARATOR);
|
|
260
|
+
const bodyEnd = bodyStart + contentLength;
|
|
261
|
+
if (this.inputBuffer.length < bodyEnd)
|
|
262
|
+
return;
|
|
263
|
+
const body = this.inputBuffer.subarray(bodyStart, bodyEnd).toString("utf8");
|
|
264
|
+
this.inputBuffer = this.inputBuffer.subarray(bodyEnd);
|
|
265
|
+
this.dispatchBody(body);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
dispatchBody(body) {
|
|
269
|
+
let parsed;
|
|
270
|
+
try {
|
|
271
|
+
parsed = JSON.parse(body);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
this.writeError(null, PARSE_ERROR, error instanceof Error ? error.message : "Parse error").catch((writeError) => this.emitError(toError(writeError)));
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (!isJsonRpcObject(parsed)) {
|
|
277
|
+
this.writeError(null, INVALID_REQUEST, "Invalid JSON-RPC message").catch((error) => this.emitError(toError(error)));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if ("id" in parsed && (("result" in parsed) || ("error" in parsed))) {
|
|
281
|
+
this.handleResponse(parsed);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (typeof parsed["method"] !== "string") {
|
|
285
|
+
const id = getMessageId(parsed) ?? null;
|
|
286
|
+
this.writeError(id, INVALID_REQUEST, "Invalid JSON-RPC method").catch((error) => this.emitError(toError(error)));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if ("id" in parsed) {
|
|
290
|
+
this.handleRequest(parsed);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
this.handleNotification(parsed["method"], parsed["params"]);
|
|
294
|
+
}
|
|
295
|
+
handleResponse(message) {
|
|
296
|
+
const id = getMessageId(message);
|
|
297
|
+
if (id === undefined)
|
|
298
|
+
return;
|
|
299
|
+
const pending = this.pendingRequests.get(String(id));
|
|
300
|
+
if (!pending)
|
|
301
|
+
return;
|
|
302
|
+
this.pendingRequests.delete(String(id));
|
|
303
|
+
if ("error" in message) {
|
|
304
|
+
pending.reject(jsonRpcErrorToError(message["error"]));
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
pending.resolve(message["result"]);
|
|
308
|
+
}
|
|
309
|
+
handleNotification(method, params) {
|
|
310
|
+
const handler = this.notificationHandlers.get(method);
|
|
311
|
+
if (!handler)
|
|
312
|
+
return;
|
|
313
|
+
try {
|
|
314
|
+
handler(params);
|
|
315
|
+
} catch (error) {
|
|
316
|
+
this.emitError(toError(error));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
handleRequest(message) {
|
|
320
|
+
const id = getMessageId(message);
|
|
321
|
+
if (id === undefined) {
|
|
322
|
+
this.writeError(null, INVALID_REQUEST, "Invalid JSON-RPC id").catch((error) => this.emitError(toError(error)));
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const method = typeof message["method"] === "string" ? message["method"] : "";
|
|
326
|
+
const handler = this.requestHandlers.get(method);
|
|
327
|
+
if (!handler) {
|
|
328
|
+
this.writeError(id, METHOD_NOT_FOUND, `Method not found: ${method}`).catch((error) => this.emitError(toError(error)));
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
Promise.resolve().then(() => handler(message["params"])).then((result) => this.writeMessage({ jsonrpc: "2.0", id, result }), (error) => this.writeError(id, INTERNAL_ERROR, toError(error).message)).catch((error) => this.emitError(toError(error)));
|
|
332
|
+
}
|
|
333
|
+
async writeError(id, code, message) {
|
|
334
|
+
await this.writeMessage({ jsonrpc: "2.0", id, error: { code, message } });
|
|
335
|
+
}
|
|
336
|
+
writeMessage(message) {
|
|
337
|
+
const body = JSON.stringify(message);
|
|
338
|
+
const payload = `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
|
|
339
|
+
\r
|
|
340
|
+
${body}`;
|
|
341
|
+
return new Promise((resolve6, reject) => {
|
|
342
|
+
this.writer.write(payload, (error) => {
|
|
343
|
+
if (error) {
|
|
344
|
+
reject(error);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
resolve6();
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
emitError(error) {
|
|
352
|
+
for (const handler of this.errorHandlers) {
|
|
353
|
+
handler(error);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function parseContentLength(headers) {
|
|
358
|
+
for (const line of headers.split(`\r
|
|
359
|
+
`)) {
|
|
360
|
+
const separatorIndex = line.indexOf(":");
|
|
361
|
+
if (separatorIndex === -1)
|
|
362
|
+
continue;
|
|
363
|
+
const name = line.slice(0, separatorIndex).trim().toLowerCase();
|
|
364
|
+
if (name !== "content-length")
|
|
365
|
+
continue;
|
|
366
|
+
const value = Number.parseInt(line.slice(separatorIndex + 1).trim(), 10);
|
|
367
|
+
return Number.isFinite(value) && value >= 0 ? value : null;
|
|
368
|
+
}
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
function isJsonRpcObject(value) {
|
|
372
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
373
|
+
}
|
|
374
|
+
function getMessageId(message) {
|
|
375
|
+
const id = message["id"];
|
|
376
|
+
if (typeof id === "number" || typeof id === "string" || id === null)
|
|
377
|
+
return id;
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
function jsonRpcErrorToError(value) {
|
|
381
|
+
if (!isJsonRpcObject(value))
|
|
382
|
+
return new Error("JSON-RPC request failed");
|
|
383
|
+
const message = typeof value["message"] === "string" ? value["message"] : "JSON-RPC request failed";
|
|
384
|
+
const error = new Error(message);
|
|
385
|
+
if (typeof value["code"] === "number") {
|
|
386
|
+
error.name = `JsonRpcError(${value["code"]})`;
|
|
387
|
+
}
|
|
388
|
+
return error;
|
|
389
|
+
}
|
|
390
|
+
function toError(error) {
|
|
391
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
392
|
+
}
|
|
393
|
+
function isMissingProcessError(error) {
|
|
394
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
395
|
+
return false;
|
|
396
|
+
return error.code === "ESRCH";
|
|
397
|
+
}
|
|
398
|
+
function reportKillError(context, error) {
|
|
399
|
+
if (!isMissingProcessError(error)) {
|
|
400
|
+
reportBestEffortCleanupError(context, error);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function validateCwd(cwd) {
|
|
404
|
+
try {
|
|
405
|
+
if (!existsSync(cwd)) {
|
|
406
|
+
return { valid: false, error: `Working directory does not exist: ${cwd}` };
|
|
407
|
+
}
|
|
408
|
+
const stats = statSync(cwd);
|
|
409
|
+
if (!stats.isDirectory()) {
|
|
410
|
+
return { valid: false, error: `Path is not a directory: ${cwd}` };
|
|
411
|
+
}
|
|
412
|
+
return { valid: true };
|
|
413
|
+
} catch (err) {
|
|
414
|
+
return {
|
|
415
|
+
valid: false,
|
|
416
|
+
error: `Cannot access working directory: ${cwd} (${err instanceof Error ? err.message : String(err)})`
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function wrap(proc) {
|
|
421
|
+
const exitedPromise = new Promise((resolve6) => {
|
|
422
|
+
proc.once("close", (code) => resolve6(code ?? 0));
|
|
423
|
+
proc.once("error", () => resolve6(1));
|
|
424
|
+
});
|
|
425
|
+
if (!proc.stdin || !proc.stdout || !proc.stderr) {
|
|
426
|
+
throw new LspProcessSpawnError("Spawned process is missing one of stdin/stdout/stderr pipes");
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
stdin: proc.stdin,
|
|
430
|
+
stdout: proc.stdout,
|
|
431
|
+
stderr: proc.stderr,
|
|
432
|
+
get pid() {
|
|
433
|
+
return proc.pid ?? undefined;
|
|
434
|
+
},
|
|
435
|
+
get exitCode() {
|
|
436
|
+
return proc.exitCode;
|
|
437
|
+
},
|
|
438
|
+
get killed() {
|
|
439
|
+
return proc.killed;
|
|
440
|
+
},
|
|
441
|
+
exited: exitedPromise,
|
|
442
|
+
kill(signal) {
|
|
443
|
+
killProcessTree(proc, signal ?? "SIGTERM");
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function killProcessTree(proc, signal) {
|
|
448
|
+
if (process.platform === "win32" && proc.pid) {
|
|
449
|
+
const result = spawnSync("taskkill", ["/pid", String(proc.pid), "/f", "/t"], { stdio: "ignore" });
|
|
450
|
+
if (!result.error && result.status === 0)
|
|
451
|
+
return;
|
|
452
|
+
if (result.error)
|
|
453
|
+
reportKillError("windows process tree kill", result.error);
|
|
454
|
+
}
|
|
455
|
+
if (process.platform !== "win32" && proc.pid) {
|
|
456
|
+
try {
|
|
457
|
+
process.kill(-proc.pid, signal);
|
|
458
|
+
return;
|
|
459
|
+
} catch (error) {
|
|
460
|
+
reportKillError("process group kill", error);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
try {
|
|
464
|
+
proc.kill(signal);
|
|
465
|
+
} catch (error) {
|
|
466
|
+
reportKillError("process kill", error);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function isWindowsShellShim(command) {
|
|
470
|
+
const lowerCommand = command.toLowerCase();
|
|
471
|
+
return lowerCommand.endsWith(".cmd") || lowerCommand.endsWith(".bat");
|
|
472
|
+
}
|
|
473
|
+
function splitPath(pathValue, platform) {
|
|
474
|
+
const separator = platform === "win32" ? ";" : delimiter;
|
|
475
|
+
return pathValue.split(separator).filter(Boolean);
|
|
476
|
+
}
|
|
477
|
+
function getWindowsPathExtensions(env) {
|
|
478
|
+
const rawExtensions = env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
|
|
479
|
+
const extensions = rawExtensions.split(";").map((extension) => extension.trim()).filter(Boolean).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
|
|
480
|
+
return [...new Set([...extensions, ".exe", ".cmd", ".bat", ""])];
|
|
481
|
+
}
|
|
482
|
+
function resolveWindowsCommand(command, env) {
|
|
483
|
+
const hasPathSeparator = command.includes("/") || command.includes("\\");
|
|
484
|
+
const pathValue = env["PATH"] ?? env["Path"] ?? "";
|
|
485
|
+
const baseDirectories = hasPathSeparator ? [""] : splitPath(pathValue, "win32");
|
|
486
|
+
const extensions = getWindowsPathExtensions(env);
|
|
487
|
+
for (const baseDirectory of baseDirectories) {
|
|
488
|
+
for (const extension of extensions) {
|
|
489
|
+
const candidate = baseDirectory ? join(baseDirectory, `${command}${extension}`) : `${command}${extension}`;
|
|
490
|
+
if (existsSync(candidate))
|
|
491
|
+
return candidate;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return command;
|
|
495
|
+
}
|
|
496
|
+
function createSpawnCommand(command, platform = process.platform, commandProcessor = process.env["ComSpec"] ?? "cmd.exe", env = process.env) {
|
|
497
|
+
const [cmd, ...args] = command;
|
|
498
|
+
if (!cmd) {
|
|
499
|
+
throw new LspProcessSpawnError("[lsp] empty command");
|
|
500
|
+
}
|
|
501
|
+
if (platform !== "win32") {
|
|
502
|
+
return { command: cmd, args, shell: false };
|
|
503
|
+
}
|
|
504
|
+
const resolvedCommand = resolveWindowsCommand(cmd, env);
|
|
505
|
+
if (!isWindowsShellShim(resolvedCommand)) {
|
|
506
|
+
return { command: resolvedCommand, args, shell: false };
|
|
507
|
+
}
|
|
508
|
+
return {
|
|
509
|
+
command: commandProcessor,
|
|
510
|
+
args: ["/d", "/s", "/c", resolvedCommand, ...args],
|
|
511
|
+
shell: false
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function spawnProcess(command, options) {
|
|
515
|
+
const cwdValidation = validateCwd(options.cwd);
|
|
516
|
+
if (!cwdValidation.valid) {
|
|
517
|
+
throw new LspInvalidPathError(`[lsp] ${cwdValidation.error}`);
|
|
518
|
+
}
|
|
519
|
+
const [cmd] = command;
|
|
520
|
+
if (!cmd) {
|
|
521
|
+
throw new LspProcessSpawnError("[lsp] empty command");
|
|
522
|
+
}
|
|
523
|
+
const preparedCommand = createSpawnCommand(command, process.platform, process.env["ComSpec"] ?? "cmd.exe", options.env);
|
|
524
|
+
const proc = spawn(preparedCommand.command, preparedCommand.args, {
|
|
525
|
+
cwd: options.cwd,
|
|
526
|
+
env: options.env,
|
|
527
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
528
|
+
windowsHide: true,
|
|
529
|
+
shell: preparedCommand.shell,
|
|
530
|
+
detached: process.platform !== "win32"
|
|
531
|
+
});
|
|
532
|
+
return wrap(proc);
|
|
533
|
+
}
|
|
534
|
+
function isRecord(value) {
|
|
535
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
536
|
+
}
|
|
537
|
+
function parseConfigurationItems(params) {
|
|
538
|
+
if (!isRecord(params) || !Array.isArray(params["items"]))
|
|
539
|
+
return [];
|
|
540
|
+
const items = [];
|
|
541
|
+
for (const item of params["items"]) {
|
|
542
|
+
if (!isRecord(item))
|
|
543
|
+
continue;
|
|
544
|
+
const section = item["section"];
|
|
545
|
+
items.push(section === undefined || typeof section !== "string" ? {} : { section });
|
|
546
|
+
}
|
|
547
|
+
return items;
|
|
548
|
+
}
|
|
549
|
+
function parseDiagnosticsParams(params) {
|
|
550
|
+
if (!isRecord(params) || typeof params["uri"] !== "string")
|
|
551
|
+
return null;
|
|
552
|
+
const diagnostics = Array.isArray(params["diagnostics"]) ? params["diagnostics"].filter(isDiagnostic) : [];
|
|
553
|
+
return { uri: params["uri"], diagnostics };
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
class LspClientTransport {
|
|
557
|
+
root;
|
|
558
|
+
server;
|
|
559
|
+
proc = null;
|
|
560
|
+
connection = null;
|
|
561
|
+
stderrBuffer = [];
|
|
562
|
+
processExited = false;
|
|
563
|
+
diagnosticsStore = new Map;
|
|
564
|
+
requestTimeoutMs;
|
|
565
|
+
initializeTimeoutMs;
|
|
566
|
+
constructor(root, server, timeouts = {}) {
|
|
567
|
+
this.root = root;
|
|
568
|
+
this.server = server;
|
|
569
|
+
this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
|
|
570
|
+
this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
571
|
+
}
|
|
572
|
+
pid() {
|
|
573
|
+
return this.proc?.pid;
|
|
574
|
+
}
|
|
575
|
+
command() {
|
|
576
|
+
return [...this.server.command];
|
|
577
|
+
}
|
|
578
|
+
async start() {
|
|
579
|
+
const env = createLspSpawnEnv(this.root, {
|
|
580
|
+
...process.env,
|
|
581
|
+
...this.server.env
|
|
582
|
+
});
|
|
583
|
+
this.proc = spawnProcess(this.server.command, {
|
|
584
|
+
cwd: this.root,
|
|
585
|
+
env
|
|
586
|
+
});
|
|
587
|
+
this.startStderrReading();
|
|
588
|
+
await new Promise((resolve6) => setTimeout(resolve6, 100));
|
|
589
|
+
if (this.proc.exitCode !== null) {
|
|
590
|
+
const stderr = this.stderrBuffer.join(`
|
|
591
|
+
`);
|
|
592
|
+
throw new LspProcessExitedError(this.server.id, this.root, this.proc.exitCode, stderr.slice(-2000));
|
|
593
|
+
}
|
|
594
|
+
this.connection = new JsonRpcConnection(this.proc.stdout, this.proc.stdin);
|
|
595
|
+
this.connection.onNotification("textDocument/publishDiagnostics", (params) => {
|
|
596
|
+
const diagnosticsParams = parseDiagnosticsParams(params);
|
|
597
|
+
if (diagnosticsParams?.uri) {
|
|
598
|
+
this.diagnosticsStore.set(diagnosticsParams.uri, diagnosticsParams.diagnostics);
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
this.connection.onRequest("workspace/configuration", (params) => {
|
|
602
|
+
const items = parseConfigurationItems(params);
|
|
603
|
+
return items.map((item) => {
|
|
604
|
+
if (item.section === "json")
|
|
605
|
+
return { validate: { enable: true } };
|
|
606
|
+
return {};
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
this.connection.onRequest("client/registerCapability", () => null);
|
|
610
|
+
this.connection.onRequest("window/workDoneProgress/create", () => null);
|
|
611
|
+
this.connection.onClose(() => {
|
|
612
|
+
this.processExited = true;
|
|
613
|
+
});
|
|
614
|
+
this.connection.onError((error) => {
|
|
615
|
+
reportBestEffortCleanupError("connection error notification", error);
|
|
616
|
+
});
|
|
617
|
+
this.connection.listen();
|
|
618
|
+
}
|
|
619
|
+
startStderrReading() {
|
|
620
|
+
if (!this.proc)
|
|
621
|
+
return;
|
|
622
|
+
this.proc.stderr.setEncoding("utf-8");
|
|
623
|
+
this.proc.stderr.on("data", (chunk) => {
|
|
624
|
+
this.stderrBuffer.push(chunk);
|
|
625
|
+
if (this.stderrBuffer.length > 100) {
|
|
626
|
+
this.stderrBuffer.shift();
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
isConnectionClosedError(error) {
|
|
631
|
+
if (!(error instanceof Error)) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
const code = "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
635
|
+
return code === "ERR_STREAM_DESTROYED" || /connection closed|connection is disposed|stream was destroyed/i.test(error.message);
|
|
636
|
+
}
|
|
637
|
+
async sendRequest(method, ...args) {
|
|
638
|
+
if (!this.connection)
|
|
639
|
+
throw new Error("LSP client not started");
|
|
640
|
+
if (this.processExited || this.proc && this.proc.exitCode !== null) {
|
|
641
|
+
const stderrTail = this.stderrBuffer.slice(-10).join(`
|
|
642
|
+
`);
|
|
643
|
+
throw new LspProcessExitedError(this.server.id, this.root, this.proc?.exitCode ?? null, stderrTail || undefined);
|
|
644
|
+
}
|
|
645
|
+
const timeoutMs = args[1]?.timeoutMs ?? this.requestTimeoutMs;
|
|
646
|
+
let timeoutHandle = null;
|
|
647
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
648
|
+
timeoutHandle = setTimeout(() => {
|
|
649
|
+
const stderrTail = this.stderrBuffer.slice(-5).join(`
|
|
650
|
+
`);
|
|
651
|
+
reject(new LspRequestTimeoutError(method, stderrTail || undefined));
|
|
652
|
+
}, timeoutMs);
|
|
653
|
+
});
|
|
654
|
+
try {
|
|
655
|
+
const requestPromise = args.length === 0 ? this.connection.sendRequest(method) : this.connection.sendRequest(method, args[0]);
|
|
656
|
+
const result = await Promise.race([requestPromise, timeoutPromise]);
|
|
657
|
+
if (timeoutHandle !== null)
|
|
658
|
+
clearTimeout(timeoutHandle);
|
|
659
|
+
return result;
|
|
660
|
+
} catch (error) {
|
|
661
|
+
if (timeoutHandle !== null)
|
|
662
|
+
clearTimeout(timeoutHandle);
|
|
663
|
+
if (this.processExited || this.proc && this.proc.exitCode !== null) {
|
|
664
|
+
throw new LspProcessExitedError(this.server.id, this.root, this.proc?.exitCode ?? null, this.stderrBuffer.slice(-10).join(`
|
|
665
|
+
`) || undefined);
|
|
666
|
+
}
|
|
667
|
+
if (this.isConnectionClosedError(error)) {
|
|
668
|
+
throw new LspConnectionClosedError(this.server.id, this.root, error.message);
|
|
669
|
+
}
|
|
670
|
+
throw error;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
async sendNotification(method, ...args) {
|
|
674
|
+
if (!this.connection)
|
|
675
|
+
return;
|
|
676
|
+
if (this.processExited || this.proc && this.proc.exitCode !== null)
|
|
677
|
+
return;
|
|
678
|
+
try {
|
|
679
|
+
if (args.length === 0) {
|
|
680
|
+
await this.connection.sendNotification(method);
|
|
681
|
+
} else {
|
|
682
|
+
await this.connection.sendNotification(method, args[0]);
|
|
683
|
+
}
|
|
684
|
+
} catch (error) {
|
|
685
|
+
if (this.isConnectionClosedError(error)) {
|
|
686
|
+
throw new LspConnectionClosedError(this.server.id, this.root, error.message);
|
|
687
|
+
}
|
|
688
|
+
throw error;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
isAlive() {
|
|
692
|
+
return this.proc !== null && !this.processExited && this.proc.exitCode === null;
|
|
693
|
+
}
|
|
694
|
+
async stop() {
|
|
695
|
+
if (this.connection) {
|
|
696
|
+
try {
|
|
697
|
+
await this.sendRequest("shutdown");
|
|
698
|
+
} catch (error) {
|
|
699
|
+
reportBestEffortCleanupError("shutdown request", error);
|
|
700
|
+
}
|
|
701
|
+
try {
|
|
702
|
+
await this.sendNotification("exit");
|
|
703
|
+
} catch (error) {
|
|
704
|
+
reportBestEffortCleanupError("exit notification", error);
|
|
705
|
+
}
|
|
706
|
+
try {
|
|
707
|
+
this.connection.dispose();
|
|
708
|
+
} catch (error) {
|
|
709
|
+
reportBestEffortCleanupError("connection dispose", error);
|
|
710
|
+
}
|
|
711
|
+
this.connection = null;
|
|
712
|
+
}
|
|
713
|
+
const proc = this.proc;
|
|
714
|
+
if (proc) {
|
|
715
|
+
this.proc = null;
|
|
716
|
+
let exitedBeforeTimeout = false;
|
|
717
|
+
try {
|
|
718
|
+
proc.kill();
|
|
719
|
+
let timeoutId;
|
|
720
|
+
const timeoutPromise = new Promise((resolve6) => {
|
|
721
|
+
timeoutId = setTimeout(resolve6, STOP_HARD_KILL_TIMEOUT_MS);
|
|
722
|
+
});
|
|
723
|
+
await Promise.race([
|
|
724
|
+
proc.exited.then(() => {
|
|
725
|
+
exitedBeforeTimeout = true;
|
|
726
|
+
}).finally(() => {
|
|
727
|
+
if (timeoutId)
|
|
728
|
+
clearTimeout(timeoutId);
|
|
729
|
+
}),
|
|
730
|
+
timeoutPromise
|
|
731
|
+
]);
|
|
732
|
+
if (!exitedBeforeTimeout) {
|
|
733
|
+
try {
|
|
734
|
+
proc.kill("SIGKILL");
|
|
735
|
+
await Promise.race([
|
|
736
|
+
proc.exited,
|
|
737
|
+
new Promise((resolve6) => setTimeout(resolve6, STOP_SIGKILL_GRACE_MS))
|
|
738
|
+
]);
|
|
739
|
+
} catch (error) {
|
|
740
|
+
reportBestEffortCleanupError("hard process kill", error);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
} catch (error) {
|
|
744
|
+
reportBestEffortCleanupError("process stop", error);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
this.processExited = true;
|
|
748
|
+
this.diagnosticsStore.clear();
|
|
749
|
+
}
|
|
750
|
+
getStoredDiagnostics(uri) {
|
|
751
|
+
return this.diagnosticsStore.get(uri) ?? [];
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
function createLspSpawnEnv(_root, input) {
|
|
755
|
+
return { ...input };
|
|
756
|
+
}
|
|
757
|
+
function isDiagnostic(value) {
|
|
758
|
+
return isRecord(value) && isRange(value["range"]) && typeof value["message"] === "string";
|
|
759
|
+
}
|
|
760
|
+
function isRange(value) {
|
|
761
|
+
return isRecord(value) && isPosition(value["start"]) && isPosition(value["end"]);
|
|
762
|
+
}
|
|
763
|
+
function isPosition(value) {
|
|
764
|
+
return isRecord(value) && typeof value["line"] === "number" && typeof value["character"] === "number";
|
|
765
|
+
}
|
|
766
|
+
var INITIALIZE_SETTLE_MS = 300;
|
|
767
|
+
|
|
768
|
+
class LspClientConnection extends LspClientTransport {
|
|
769
|
+
async initialize() {
|
|
770
|
+
const rootUri = pathToFileURL(this.root).href;
|
|
771
|
+
await this.sendRequest("initialize", {
|
|
772
|
+
processId: process.pid,
|
|
773
|
+
rootUri,
|
|
774
|
+
rootPath: this.root,
|
|
775
|
+
workspaceFolders: [{ uri: rootUri, name: "workspace" }],
|
|
776
|
+
capabilities: {
|
|
777
|
+
textDocument: {
|
|
778
|
+
hover: { contentFormat: ["markdown", "plaintext"] },
|
|
779
|
+
definition: { linkSupport: true },
|
|
780
|
+
references: {},
|
|
781
|
+
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
782
|
+
publishDiagnostics: {},
|
|
783
|
+
rename: {
|
|
784
|
+
prepareSupport: true,
|
|
785
|
+
prepareSupportDefaultBehavior: 1,
|
|
786
|
+
honorsChangeAnnotations: true
|
|
787
|
+
},
|
|
788
|
+
codeAction: {
|
|
789
|
+
codeActionLiteralSupport: {
|
|
790
|
+
codeActionKind: {
|
|
791
|
+
valueSet: [
|
|
792
|
+
"quickfix",
|
|
793
|
+
"refactor",
|
|
794
|
+
"refactor.extract",
|
|
795
|
+
"refactor.inline",
|
|
796
|
+
"refactor.rewrite",
|
|
797
|
+
"source",
|
|
798
|
+
"source.organizeImports",
|
|
799
|
+
"source.fixAll"
|
|
800
|
+
]
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
isPreferredSupport: true,
|
|
804
|
+
disabledSupport: true,
|
|
805
|
+
dataSupport: true,
|
|
806
|
+
resolveSupport: {
|
|
807
|
+
properties: ["edit", "command"]
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
workspace: {
|
|
812
|
+
symbol: {},
|
|
813
|
+
workspaceFolders: true,
|
|
814
|
+
configuration: true,
|
|
815
|
+
applyEdit: true,
|
|
816
|
+
workspaceEdit: {
|
|
817
|
+
documentChanges: true
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
initializationOptions: this.server.initialization
|
|
822
|
+
}, { timeoutMs: this.initializeTimeoutMs });
|
|
823
|
+
await this.sendNotification("initialized");
|
|
824
|
+
await this.sendNotification("workspace/didChangeConfiguration", {
|
|
825
|
+
settings: { json: { validate: { enable: true } } }
|
|
826
|
+
});
|
|
827
|
+
await new Promise((r) => setTimeout(r, INITIALIZE_SETTLE_MS));
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
var BASENAME_EXTENSIONS = {
|
|
831
|
+
Dockerfile: ".dockerfile",
|
|
832
|
+
Containerfile: ".dockerfile"
|
|
833
|
+
};
|
|
834
|
+
function effectiveExtension(filePath) {
|
|
835
|
+
return BASENAME_EXTENSIONS[basename(filePath)] ?? extname(filePath);
|
|
836
|
+
}
|
|
837
|
+
var SYMBOL_KIND_MAP = {
|
|
838
|
+
1: "File",
|
|
839
|
+
2: "Module",
|
|
840
|
+
3: "Namespace",
|
|
841
|
+
4: "Package",
|
|
842
|
+
5: "Class",
|
|
843
|
+
6: "Method",
|
|
844
|
+
7: "Property",
|
|
845
|
+
8: "Field",
|
|
846
|
+
9: "Constructor",
|
|
847
|
+
10: "Enum",
|
|
848
|
+
11: "Interface",
|
|
849
|
+
12: "Function",
|
|
850
|
+
13: "Variable",
|
|
851
|
+
14: "Constant",
|
|
852
|
+
15: "String",
|
|
853
|
+
16: "Number",
|
|
854
|
+
17: "Boolean",
|
|
855
|
+
18: "Array",
|
|
856
|
+
19: "Object",
|
|
857
|
+
20: "Key",
|
|
858
|
+
21: "Null",
|
|
859
|
+
22: "EnumMember",
|
|
860
|
+
23: "Struct",
|
|
861
|
+
24: "Event",
|
|
862
|
+
25: "Operator",
|
|
863
|
+
26: "TypeParameter"
|
|
864
|
+
};
|
|
865
|
+
var SEVERITY_MAP = {
|
|
866
|
+
1: "error",
|
|
867
|
+
2: "warning",
|
|
868
|
+
3: "information",
|
|
869
|
+
4: "hint"
|
|
870
|
+
};
|
|
871
|
+
var EXT_TO_LANG = {
|
|
872
|
+
".abap": "abap",
|
|
873
|
+
".bat": "bat",
|
|
874
|
+
".bib": "bibtex",
|
|
875
|
+
".bibtex": "bibtex",
|
|
876
|
+
".clj": "clojure",
|
|
877
|
+
".cljs": "clojure",
|
|
878
|
+
".cljc": "clojure",
|
|
879
|
+
".edn": "clojure",
|
|
880
|
+
".coffee": "coffeescript",
|
|
881
|
+
".c": "c",
|
|
882
|
+
".cpp": "cpp",
|
|
883
|
+
".cxx": "cpp",
|
|
884
|
+
".cc": "cpp",
|
|
885
|
+
".c++": "cpp",
|
|
886
|
+
".cs": "csharp",
|
|
887
|
+
".css": "css",
|
|
888
|
+
".d": "d",
|
|
889
|
+
".pas": "pascal",
|
|
890
|
+
".pascal": "pascal",
|
|
891
|
+
".diff": "diff",
|
|
892
|
+
".patch": "diff",
|
|
893
|
+
".dart": "dart",
|
|
894
|
+
".dockerfile": "dockerfile",
|
|
895
|
+
".ex": "elixir",
|
|
896
|
+
".exs": "elixir",
|
|
897
|
+
".erl": "erlang",
|
|
898
|
+
".hrl": "erlang",
|
|
899
|
+
".fs": "fsharp",
|
|
900
|
+
".fsi": "fsharp",
|
|
901
|
+
".fsx": "fsharp",
|
|
902
|
+
".fsscript": "fsharp",
|
|
903
|
+
".gitcommit": "git-commit",
|
|
904
|
+
".gitrebase": "git-rebase",
|
|
905
|
+
".go": "go",
|
|
906
|
+
".groovy": "groovy",
|
|
907
|
+
".gleam": "gleam",
|
|
908
|
+
".hbs": "handlebars",
|
|
909
|
+
".handlebars": "handlebars",
|
|
910
|
+
".hs": "haskell",
|
|
911
|
+
".html": "html",
|
|
912
|
+
".htm": "html",
|
|
913
|
+
".ini": "ini",
|
|
914
|
+
".java": "java",
|
|
915
|
+
".jl": "julia",
|
|
916
|
+
".js": "javascript",
|
|
917
|
+
".jsx": "javascriptreact",
|
|
918
|
+
".json": "json",
|
|
919
|
+
".jsonc": "jsonc",
|
|
920
|
+
".tex": "latex",
|
|
921
|
+
".latex": "latex",
|
|
922
|
+
".less": "less",
|
|
923
|
+
".lua": "lua",
|
|
924
|
+
".makefile": "makefile",
|
|
925
|
+
makefile: "makefile",
|
|
926
|
+
".md": "markdown",
|
|
927
|
+
".markdown": "markdown",
|
|
928
|
+
".m": "objective-c",
|
|
929
|
+
".mm": "objective-cpp",
|
|
930
|
+
".pl": "perl",
|
|
931
|
+
".pm": "perl",
|
|
932
|
+
".pm6": "perl6",
|
|
933
|
+
".php": "php",
|
|
934
|
+
".ps1": "powershell",
|
|
935
|
+
".psm1": "powershell",
|
|
936
|
+
".pug": "jade",
|
|
937
|
+
".jade": "jade",
|
|
938
|
+
".py": "python",
|
|
939
|
+
".pyi": "python",
|
|
940
|
+
".r": "r",
|
|
941
|
+
".cshtml": "razor",
|
|
942
|
+
".razor": "razor",
|
|
943
|
+
".rb": "ruby",
|
|
944
|
+
".rake": "ruby",
|
|
945
|
+
".gemspec": "ruby",
|
|
946
|
+
".ru": "ruby",
|
|
947
|
+
".erb": "erb",
|
|
948
|
+
".html.erb": "erb",
|
|
949
|
+
".js.erb": "erb",
|
|
950
|
+
".css.erb": "erb",
|
|
951
|
+
".json.erb": "erb",
|
|
952
|
+
".rs": "rust",
|
|
953
|
+
".scss": "scss",
|
|
954
|
+
".sass": "sass",
|
|
955
|
+
".scala": "scala",
|
|
956
|
+
".shader": "shaderlab",
|
|
957
|
+
".sh": "shellscript",
|
|
958
|
+
".bash": "shellscript",
|
|
959
|
+
".zsh": "shellscript",
|
|
960
|
+
".ksh": "shellscript",
|
|
961
|
+
".sql": "sql",
|
|
962
|
+
".svelte": "svelte",
|
|
963
|
+
".swift": "swift",
|
|
964
|
+
".ts": "typescript",
|
|
965
|
+
".tsx": "typescriptreact",
|
|
966
|
+
".mts": "typescript",
|
|
967
|
+
".cts": "typescript",
|
|
968
|
+
".mtsx": "typescriptreact",
|
|
969
|
+
".ctsx": "typescriptreact",
|
|
970
|
+
".xml": "xml",
|
|
971
|
+
".xsl": "xsl",
|
|
972
|
+
".yaml": "yaml",
|
|
973
|
+
".yml": "yaml",
|
|
974
|
+
".mjs": "javascript",
|
|
975
|
+
".cjs": "javascript",
|
|
976
|
+
".vue": "vue",
|
|
977
|
+
".zig": "zig",
|
|
978
|
+
".zon": "zig",
|
|
979
|
+
".astro": "astro",
|
|
980
|
+
".ml": "ocaml",
|
|
981
|
+
".mli": "ocaml",
|
|
982
|
+
".tf": "terraform",
|
|
983
|
+
".tfvars": "terraform-vars",
|
|
984
|
+
".hcl": "hcl",
|
|
985
|
+
".nix": "nix",
|
|
986
|
+
".typ": "typst",
|
|
987
|
+
".typc": "typst",
|
|
988
|
+
".ets": "typescript",
|
|
989
|
+
".lhs": "haskell",
|
|
990
|
+
".kt": "kotlin",
|
|
991
|
+
".kts": "kotlin",
|
|
992
|
+
".prisma": "prisma",
|
|
993
|
+
".h": "c",
|
|
994
|
+
".hpp": "cpp",
|
|
995
|
+
".hh": "cpp",
|
|
996
|
+
".hxx": "cpp",
|
|
997
|
+
".h++": "cpp",
|
|
998
|
+
".objc": "objective-c",
|
|
999
|
+
".objcpp": "objective-cpp",
|
|
1000
|
+
".fish": "fish",
|
|
1001
|
+
".graphql": "graphql",
|
|
1002
|
+
".gql": "graphql"
|
|
1003
|
+
};
|
|
1004
|
+
function getLanguageId(ext) {
|
|
1005
|
+
return EXT_TO_LANG[ext] ?? "plaintext";
|
|
1006
|
+
}
|
|
1007
|
+
var POST_OPEN_DELAY_MS = 1000;
|
|
1008
|
+
var POST_DIAGNOSTICS_WAIT_MS = 500;
|
|
1009
|
+
|
|
1010
|
+
class LspClient extends LspClientConnection {
|
|
1011
|
+
openedFiles = new Set;
|
|
1012
|
+
documentVersions = new Map;
|
|
1013
|
+
lastSyncedText = new Map;
|
|
1014
|
+
diagnosticPullErrors = [];
|
|
1015
|
+
getDiagnosticPullErrors() {
|
|
1016
|
+
return this.diagnosticPullErrors;
|
|
1017
|
+
}
|
|
1018
|
+
async openFile(filePath) {
|
|
1019
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1020
|
+
const uri = pathToFileURL2(absPath).href;
|
|
1021
|
+
const text = readFileSync(absPath, "utf-8");
|
|
1022
|
+
if (!this.openedFiles.has(absPath)) {
|
|
1023
|
+
const ext = effectiveExtension(absPath);
|
|
1024
|
+
const languageId = getLanguageId(ext);
|
|
1025
|
+
const version = 1;
|
|
1026
|
+
await this.sendNotification("textDocument/didOpen", {
|
|
1027
|
+
textDocument: {
|
|
1028
|
+
uri,
|
|
1029
|
+
languageId,
|
|
1030
|
+
version,
|
|
1031
|
+
text
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
this.openedFiles.add(absPath);
|
|
1035
|
+
this.documentVersions.set(uri, version);
|
|
1036
|
+
this.lastSyncedText.set(uri, text);
|
|
1037
|
+
await new Promise((r) => setTimeout(r, POST_OPEN_DELAY_MS));
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
const prevText = this.lastSyncedText.get(uri);
|
|
1041
|
+
if (prevText === text) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
const nextVersion = (this.documentVersions.get(uri) ?? 1) + 1;
|
|
1045
|
+
this.documentVersions.set(uri, nextVersion);
|
|
1046
|
+
this.lastSyncedText.set(uri, text);
|
|
1047
|
+
await this.sendNotification("textDocument/didChange", {
|
|
1048
|
+
textDocument: { uri, version: nextVersion },
|
|
1049
|
+
contentChanges: [{ text }]
|
|
1050
|
+
});
|
|
1051
|
+
await this.sendNotification("textDocument/didSave", {
|
|
1052
|
+
textDocument: { uri },
|
|
1053
|
+
text
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
async definition(filePath, line, character) {
|
|
1057
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1058
|
+
await this.openFile(absPath);
|
|
1059
|
+
return this.sendRequest("textDocument/definition", {
|
|
1060
|
+
textDocument: { uri: pathToFileURL2(absPath).href },
|
|
1061
|
+
position: { line: line - 1, character }
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
async references(filePath, line, character, includeDeclaration = true) {
|
|
1065
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1066
|
+
await this.openFile(absPath);
|
|
1067
|
+
return this.sendRequest("textDocument/references", {
|
|
1068
|
+
textDocument: { uri: pathToFileURL2(absPath).href },
|
|
1069
|
+
position: { line: line - 1, character },
|
|
1070
|
+
context: { includeDeclaration }
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
async documentSymbols(filePath) {
|
|
1074
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1075
|
+
await this.openFile(absPath);
|
|
1076
|
+
return this.sendRequest("textDocument/documentSymbol", {
|
|
1077
|
+
textDocument: { uri: pathToFileURL2(absPath).href }
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
async workspaceSymbols(query) {
|
|
1081
|
+
return this.sendRequest("workspace/symbol", { query });
|
|
1082
|
+
}
|
|
1083
|
+
isUnsupportedDiagnosticPullError(error) {
|
|
1084
|
+
if (!(error instanceof Error))
|
|
1085
|
+
return false;
|
|
1086
|
+
const code = "code" in error && typeof error.code === "number" ? error.code : undefined;
|
|
1087
|
+
if (code === -32601)
|
|
1088
|
+
return true;
|
|
1089
|
+
return /unsupported|not supported|method not found|unknown request/i.test(error.message);
|
|
1090
|
+
}
|
|
1091
|
+
async diagnostics(filePath) {
|
|
1092
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1093
|
+
const uri = pathToFileURL2(absPath).href;
|
|
1094
|
+
await this.openFile(absPath);
|
|
1095
|
+
await new Promise((r) => setTimeout(r, POST_DIAGNOSTICS_WAIT_MS));
|
|
1096
|
+
try {
|
|
1097
|
+
const result = await this.sendRequest("textDocument/diagnostic", {
|
|
1098
|
+
textDocument: { uri }
|
|
1099
|
+
});
|
|
1100
|
+
if (result.items) {
|
|
1101
|
+
return { items: result.items };
|
|
1102
|
+
}
|
|
1103
|
+
} catch (error) {
|
|
1104
|
+
if (!this.isUnsupportedDiagnosticPullError(error)) {
|
|
1105
|
+
this.diagnosticPullErrors.push(error instanceof Error ? error : new Error(String(error)));
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return { items: this.getStoredDiagnostics(uri) };
|
|
1109
|
+
}
|
|
1110
|
+
async prepareRename(filePath, line, character) {
|
|
1111
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1112
|
+
await this.openFile(absPath);
|
|
1113
|
+
return this.sendRequest("textDocument/prepareRename", {
|
|
1114
|
+
textDocument: { uri: pathToFileURL2(absPath).href },
|
|
1115
|
+
position: { line: line - 1, character }
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
async rename(filePath, line, character, newName) {
|
|
1119
|
+
const absPath = resolve(contextCwd(), filePath);
|
|
1120
|
+
await this.openFile(absPath);
|
|
1121
|
+
return this.sendRequest("textDocument/rename", {
|
|
1122
|
+
textDocument: { uri: pathToFileURL2(absPath).href },
|
|
1123
|
+
position: { line: line - 1, character },
|
|
1124
|
+
newName
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
function installProcessSignalCleanup(cleanup) {
|
|
1129
|
+
const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
|
|
1130
|
+
const handler = () => {
|
|
1131
|
+
cleanup().catch((error) => {
|
|
1132
|
+
reportBestEffortCleanupError("signal cleanup", error);
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
for (const signal of signals) {
|
|
1136
|
+
process.on(signal, handler);
|
|
1137
|
+
}
|
|
1138
|
+
return () => {
|
|
1139
|
+
for (const signal of signals) {
|
|
1140
|
+
process.removeListener(signal, handler);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
async function stopClientBestEffort(client) {
|
|
1145
|
+
try {
|
|
1146
|
+
await client.stop();
|
|
1147
|
+
} catch (error) {
|
|
1148
|
+
reportBestEffortCleanupError("client stop", error);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function awaitWithSignal(promise, signal) {
|
|
1152
|
+
if (!signal)
|
|
1153
|
+
return promise;
|
|
1154
|
+
return new Promise((resolve22, reject) => {
|
|
1155
|
+
let settled = false;
|
|
1156
|
+
const onAbort = () => {
|
|
1157
|
+
if (settled)
|
|
1158
|
+
return;
|
|
1159
|
+
settled = true;
|
|
1160
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
1161
|
+
};
|
|
1162
|
+
if (signal.aborted) {
|
|
1163
|
+
onAbort();
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1167
|
+
promise.then((value) => {
|
|
1168
|
+
if (settled)
|
|
1169
|
+
return;
|
|
1170
|
+
settled = true;
|
|
1171
|
+
signal.removeEventListener("abort", onAbort);
|
|
1172
|
+
resolve22(value);
|
|
1173
|
+
}, (err) => {
|
|
1174
|
+
if (settled)
|
|
1175
|
+
return;
|
|
1176
|
+
settled = true;
|
|
1177
|
+
signal.removeEventListener("abort", onAbort);
|
|
1178
|
+
reject(err);
|
|
1179
|
+
});
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
class LspManager {
|
|
1184
|
+
clients = new Map;
|
|
1185
|
+
reaperHandle = null;
|
|
1186
|
+
signalDisposer = null;
|
|
1187
|
+
disposed = false;
|
|
1188
|
+
idleTimeoutMs;
|
|
1189
|
+
initTimeoutMs;
|
|
1190
|
+
reaperIntervalMs;
|
|
1191
|
+
clientFactory;
|
|
1192
|
+
now;
|
|
1193
|
+
constructor(options = {}) {
|
|
1194
|
+
this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
1195
|
+
this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
1196
|
+
this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
|
|
1197
|
+
this.clientFactory = options.clientFactory ?? ((root, server) => new LspClient(root, server));
|
|
1198
|
+
this.now = options.now ?? (() => Date.now());
|
|
1199
|
+
this.startReaper();
|
|
1200
|
+
this.signalDisposer = installProcessSignalCleanup(() => this.stopAll());
|
|
1201
|
+
}
|
|
1202
|
+
startReaper() {
|
|
1203
|
+
if (this.reaperHandle)
|
|
1204
|
+
return;
|
|
1205
|
+
this.reaperHandle = setInterval(() => {
|
|
1206
|
+
this.reapStale();
|
|
1207
|
+
}, this.reaperIntervalMs);
|
|
1208
|
+
if (typeof this.reaperHandle.unref === "function") {
|
|
1209
|
+
this.reaperHandle.unref();
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
getKey(root, serverId) {
|
|
1213
|
+
return `${root}::${serverId}`;
|
|
1214
|
+
}
|
|
1215
|
+
reapStale() {
|
|
1216
|
+
const t = this.now();
|
|
1217
|
+
for (const [key, managed] of this.clients) {
|
|
1218
|
+
if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
|
|
1219
|
+
stopClientBestEffort(managed.client);
|
|
1220
|
+
this.clients.delete(key);
|
|
1221
|
+
continue;
|
|
1222
|
+
}
|
|
1223
|
+
if (!managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs) {
|
|
1224
|
+
stopClientBestEffort(managed.client);
|
|
1225
|
+
this.clients.delete(key);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
async tryDeleteIfOrphaned(key, managed) {
|
|
1230
|
+
if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
|
|
1231
|
+
this.clients.delete(key);
|
|
1232
|
+
await stopClientBestEffort(managed.client);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
async getClient(root, server, signal) {
|
|
1236
|
+
if (this.disposed) {
|
|
1237
|
+
throw new Error("LspManager has been disposed");
|
|
1238
|
+
}
|
|
1239
|
+
signal?.throwIfAborted();
|
|
1240
|
+
const key = this.getKey(root, server.id);
|
|
1241
|
+
let managed = this.clients.get(key);
|
|
1242
|
+
if (managed) {
|
|
1243
|
+
const t = this.now();
|
|
1244
|
+
if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
|
|
1245
|
+
await stopClientBestEffort(managed.client);
|
|
1246
|
+
this.clients.delete(key);
|
|
1247
|
+
managed = undefined;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
if (managed) {
|
|
1251
|
+
if (managed.initPromise) {
|
|
1252
|
+
managed.pendingWaiters++;
|
|
1253
|
+
try {
|
|
1254
|
+
await awaitWithSignal(managed.initPromise, signal);
|
|
1255
|
+
} catch (err) {
|
|
1256
|
+
managed.pendingWaiters--;
|
|
1257
|
+
await this.tryDeleteIfOrphaned(key, managed);
|
|
1258
|
+
throw err;
|
|
1259
|
+
}
|
|
1260
|
+
managed.pendingWaiters--;
|
|
1261
|
+
}
|
|
1262
|
+
if (signal?.aborted) {
|
|
1263
|
+
await this.tryDeleteIfOrphaned(key, managed);
|
|
1264
|
+
signal.throwIfAborted();
|
|
1265
|
+
}
|
|
1266
|
+
if (!managed.client.isAlive()) {
|
|
1267
|
+
await stopClientBestEffort(managed.client);
|
|
1268
|
+
this.clients.delete(key);
|
|
1269
|
+
return this.getClient(root, server, signal);
|
|
1270
|
+
}
|
|
1271
|
+
managed.refCount++;
|
|
1272
|
+
managed.lastUsedAt = this.now();
|
|
1273
|
+
return managed.client;
|
|
1274
|
+
}
|
|
1275
|
+
const client = this.clientFactory(root, server);
|
|
1276
|
+
const initStartedAt = this.now();
|
|
1277
|
+
const initPromise = (async () => {
|
|
1278
|
+
await client.start();
|
|
1279
|
+
await client.initialize();
|
|
1280
|
+
})();
|
|
1281
|
+
const newManaged = {
|
|
1282
|
+
client,
|
|
1283
|
+
refCount: 0,
|
|
1284
|
+
pendingWaiters: 1,
|
|
1285
|
+
lastUsedAt: initStartedAt,
|
|
1286
|
+
initPromise,
|
|
1287
|
+
isInitializing: true,
|
|
1288
|
+
initializingSince: initStartedAt
|
|
1289
|
+
};
|
|
1290
|
+
this.clients.set(key, newManaged);
|
|
1291
|
+
try {
|
|
1292
|
+
await awaitWithSignal(initPromise, signal);
|
|
1293
|
+
} catch (err) {
|
|
1294
|
+
newManaged.pendingWaiters--;
|
|
1295
|
+
if (this.clients.get(key) === newManaged) {
|
|
1296
|
+
this.clients.delete(key);
|
|
1297
|
+
}
|
|
1298
|
+
await stopClientBestEffort(client);
|
|
1299
|
+
throw err;
|
|
1300
|
+
}
|
|
1301
|
+
newManaged.pendingWaiters--;
|
|
1302
|
+
newManaged.isInitializing = false;
|
|
1303
|
+
newManaged.initializingSince = null;
|
|
1304
|
+
newManaged.initPromise = null;
|
|
1305
|
+
if (signal?.aborted) {
|
|
1306
|
+
await this.tryDeleteIfOrphaned(key, newManaged);
|
|
1307
|
+
signal.throwIfAborted();
|
|
1308
|
+
}
|
|
1309
|
+
newManaged.refCount++;
|
|
1310
|
+
newManaged.lastUsedAt = this.now();
|
|
1311
|
+
return client;
|
|
1312
|
+
}
|
|
1313
|
+
releaseClient(root, serverId) {
|
|
1314
|
+
const key = this.getKey(root, serverId);
|
|
1315
|
+
const managed = this.clients.get(key);
|
|
1316
|
+
if (managed && managed.refCount > 0) {
|
|
1317
|
+
managed.refCount--;
|
|
1318
|
+
managed.lastUsedAt = this.now();
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
invalidateClient(root, serverId, client) {
|
|
1322
|
+
const key = this.getKey(root, serverId);
|
|
1323
|
+
const managed = this.clients.get(key);
|
|
1324
|
+
if (!managed)
|
|
1325
|
+
return;
|
|
1326
|
+
if (client && managed.client !== client)
|
|
1327
|
+
return;
|
|
1328
|
+
this.clients.delete(key);
|
|
1329
|
+
stopClientBestEffort(managed.client);
|
|
1330
|
+
}
|
|
1331
|
+
warmupClient(root, server) {
|
|
1332
|
+
if (this.disposed)
|
|
1333
|
+
return;
|
|
1334
|
+
const key = this.getKey(root, server.id);
|
|
1335
|
+
if (this.clients.has(key))
|
|
1336
|
+
return;
|
|
1337
|
+
const client = this.clientFactory(root, server);
|
|
1338
|
+
const initStartedAt = this.now();
|
|
1339
|
+
const initPromise = (async () => {
|
|
1340
|
+
await client.start();
|
|
1341
|
+
await client.initialize();
|
|
1342
|
+
})();
|
|
1343
|
+
const managed = {
|
|
1344
|
+
client,
|
|
1345
|
+
refCount: 0,
|
|
1346
|
+
pendingWaiters: 0,
|
|
1347
|
+
lastUsedAt: initStartedAt,
|
|
1348
|
+
initPromise,
|
|
1349
|
+
isInitializing: true,
|
|
1350
|
+
initializingSince: initStartedAt
|
|
1351
|
+
};
|
|
1352
|
+
this.clients.set(key, managed);
|
|
1353
|
+
initPromise.then(() => {
|
|
1354
|
+
managed.isInitializing = false;
|
|
1355
|
+
managed.initializingSince = null;
|
|
1356
|
+
managed.initPromise = null;
|
|
1357
|
+
managed.lastUsedAt = this.now();
|
|
1358
|
+
}, () => {
|
|
1359
|
+
if (this.clients.get(key) === managed) {
|
|
1360
|
+
this.clients.delete(key);
|
|
1361
|
+
}
|
|
1362
|
+
stopClientBestEffort(client);
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
isServerInitializing(root, serverId) {
|
|
1366
|
+
const managed = this.clients.get(this.getKey(root, serverId));
|
|
1367
|
+
return managed?.isInitializing ?? false;
|
|
1368
|
+
}
|
|
1369
|
+
getSnapshot() {
|
|
1370
|
+
const snapshots = [];
|
|
1371
|
+
for (const [key, managed] of this.clients) {
|
|
1372
|
+
const [root, serverId] = key.split("::");
|
|
1373
|
+
snapshots.push({
|
|
1374
|
+
root,
|
|
1375
|
+
serverId,
|
|
1376
|
+
refCount: managed.refCount,
|
|
1377
|
+
pendingWaiters: managed.pendingWaiters,
|
|
1378
|
+
lastUsedAt: managed.lastUsedAt,
|
|
1379
|
+
isInitializing: managed.isInitializing,
|
|
1380
|
+
alive: managed.client.isAlive(),
|
|
1381
|
+
command: managed.client.command()
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
return snapshots;
|
|
1385
|
+
}
|
|
1386
|
+
hasClient(root, serverId) {
|
|
1387
|
+
return this.clients.has(this.getKey(root, serverId));
|
|
1388
|
+
}
|
|
1389
|
+
clientCount() {
|
|
1390
|
+
return this.clients.size;
|
|
1391
|
+
}
|
|
1392
|
+
async stopAll() {
|
|
1393
|
+
this.disposed = true;
|
|
1394
|
+
if (this.reaperHandle) {
|
|
1395
|
+
clearInterval(this.reaperHandle);
|
|
1396
|
+
this.reaperHandle = null;
|
|
1397
|
+
}
|
|
1398
|
+
if (this.signalDisposer) {
|
|
1399
|
+
this.signalDisposer();
|
|
1400
|
+
this.signalDisposer = null;
|
|
1401
|
+
}
|
|
1402
|
+
const stopPromises = [];
|
|
1403
|
+
for (const managed of this.clients.values()) {
|
|
1404
|
+
stopPromises.push(stopClientBestEffort(managed.client));
|
|
1405
|
+
}
|
|
1406
|
+
this.clients.clear();
|
|
1407
|
+
await Promise.allSettled(stopPromises);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
var _defaultInstance = null;
|
|
1411
|
+
function getLspManager() {
|
|
1412
|
+
if (!_defaultInstance) {
|
|
1413
|
+
_defaultInstance = new LspManager;
|
|
1414
|
+
}
|
|
1415
|
+
return _defaultInstance;
|
|
1416
|
+
}
|
|
1417
|
+
async function disposeDefaultLspManager() {
|
|
1418
|
+
if (_defaultInstance) {
|
|
1419
|
+
const m = _defaultInstance;
|
|
1420
|
+
_defaultInstance = null;
|
|
1421
|
+
await m.stopAll();
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function isProcessAlive(pid) {
|
|
1425
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
1426
|
+
return false;
|
|
1427
|
+
try {
|
|
1428
|
+
process.kill(pid, 0);
|
|
1429
|
+
return true;
|
|
1430
|
+
} catch (error) {
|
|
1431
|
+
return error.code === "EPERM";
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
function readLockPid(lockPath) {
|
|
1435
|
+
try {
|
|
1436
|
+
const pid = Number.parseInt(readFileSync2(lockPath, "utf8").trim(), 10);
|
|
1437
|
+
return Number.isInteger(pid) ? pid : null;
|
|
1438
|
+
} catch {
|
|
1439
|
+
return null;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
function tryAcquireLock(lockPath, ownerPid = process.pid) {
|
|
1443
|
+
mkdirSync(dirname(lockPath), { recursive: true });
|
|
1444
|
+
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
1445
|
+
const handle = writeLockFile(lockPath, ownerPid);
|
|
1446
|
+
if (handle)
|
|
1447
|
+
return handle;
|
|
1448
|
+
if (!reapStaleLock(lockPath))
|
|
1449
|
+
return null;
|
|
1450
|
+
}
|
|
1451
|
+
return null;
|
|
1452
|
+
}
|
|
1453
|
+
function writeLockFile(lockPath, ownerPid) {
|
|
1454
|
+
try {
|
|
1455
|
+
const fd = openSync(lockPath, "wx");
|
|
1456
|
+
writeSync(fd, `${ownerPid}
|
|
1457
|
+
`);
|
|
1458
|
+
closeSync(fd);
|
|
1459
|
+
return { release: () => unlinkQuietly(lockPath) };
|
|
1460
|
+
} catch (error) {
|
|
1461
|
+
if (error.code === "EEXIST")
|
|
1462
|
+
return null;
|
|
1463
|
+
throw error;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
function reapStaleLock(lockPath) {
|
|
1467
|
+
const pid = readLockPid(lockPath);
|
|
1468
|
+
if (pid !== null && isProcessAlive(pid))
|
|
1469
|
+
return false;
|
|
1470
|
+
unlinkQuietly(lockPath);
|
|
1471
|
+
return true;
|
|
1472
|
+
}
|
|
1473
|
+
function unlinkQuietly(path) {
|
|
1474
|
+
try {
|
|
1475
|
+
unlinkSync(path);
|
|
1476
|
+
} catch (error) {}
|
|
1477
|
+
}
|
|
1478
|
+
var PROBE_TIMEOUT_MS = 500;
|
|
1479
|
+
var DEFAULT_READY_TIMEOUT_MS = 5000;
|
|
1480
|
+
var DEFAULT_POLL_INTERVAL_MS = 100;
|
|
1481
|
+
|
|
1482
|
+
class DaemonUnreachableError extends Error {
|
|
1483
|
+
constructor(socketPath) {
|
|
1484
|
+
super(`LSP daemon did not become reachable at ${socketPath}`);
|
|
1485
|
+
this.name = "DaemonUnreachableError";
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
|
|
1489
|
+
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
|
|
1490
|
+
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
1491
|
+
if (await deps.probe(paths.socket))
|
|
1492
|
+
return;
|
|
1493
|
+
const lock = deps.acquireLock(paths.lock);
|
|
1494
|
+
if (!lock) {
|
|
1495
|
+
await waitUntilReachable(paths.socket, deps, readyTimeoutMs, pollIntervalMs);
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
try {
|
|
1499
|
+
if (await deps.probe(paths.socket))
|
|
1500
|
+
return;
|
|
1501
|
+
deps.cleanupStaleSocket(paths.socket);
|
|
1502
|
+
deps.spawnDaemon(paths);
|
|
1503
|
+
await waitUntilReachable(paths.socket, deps, readyTimeoutMs, pollIntervalMs);
|
|
1504
|
+
} finally {
|
|
1505
|
+
lock.release();
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
async function waitUntilReachable(socketPath, deps, readyTimeoutMs, pollIntervalMs) {
|
|
1509
|
+
const deadline = deps.now() + readyTimeoutMs;
|
|
1510
|
+
for (;; ) {
|
|
1511
|
+
if (await deps.probe(socketPath))
|
|
1512
|
+
return;
|
|
1513
|
+
if (deps.now() >= deadline)
|
|
1514
|
+
throw new DaemonUnreachableError(socketPath);
|
|
1515
|
+
await deps.sleep(pollIntervalMs);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
function probeSocket(socketPath, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
1519
|
+
return new Promise((resolve22) => {
|
|
1520
|
+
const socket = connect(socketPath);
|
|
1521
|
+
const finish = (ok) => {
|
|
1522
|
+
socket.destroy();
|
|
1523
|
+
resolve22(ok);
|
|
1524
|
+
};
|
|
1525
|
+
const timer = setTimeout(() => finish(false), timeoutMs);
|
|
1526
|
+
timer.unref?.();
|
|
1527
|
+
socket.once("connect", () => {
|
|
1528
|
+
clearTimeout(timer);
|
|
1529
|
+
finish(true);
|
|
1530
|
+
});
|
|
1531
|
+
socket.once("error", () => {
|
|
1532
|
+
clearTimeout(timer);
|
|
1533
|
+
finish(false);
|
|
1534
|
+
});
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
function spawnDaemonProcess(paths) {
|
|
1538
|
+
mkdirSync2(dirname2(paths.log), { recursive: true });
|
|
1539
|
+
const logFd = openSync2(paths.log, "a");
|
|
1540
|
+
try {
|
|
1541
|
+
const cliPath = fileURLToPath(new URL("./cli.js", import.meta.url));
|
|
1542
|
+
const child = spawn2(execPath, [cliPath, "daemon"], {
|
|
1543
|
+
detached: true,
|
|
1544
|
+
stdio: ["ignore", logFd, logFd]
|
|
1545
|
+
});
|
|
1546
|
+
child.unref();
|
|
1547
|
+
} finally {
|
|
1548
|
+
closeSync2(logFd);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
function defaultEnsureDaemonDeps() {
|
|
1552
|
+
return {
|
|
1553
|
+
probe: (socketPath) => probeSocket(socketPath),
|
|
1554
|
+
acquireLock: (lockPath) => tryAcquireLock(lockPath),
|
|
1555
|
+
cleanupStaleSocket: (socketPath) => {
|
|
1556
|
+
if (existsSync2(socketPath))
|
|
1557
|
+
unlinkQuietly(socketPath);
|
|
1558
|
+
},
|
|
1559
|
+
spawnDaemon: (paths) => spawnDaemonProcess(paths),
|
|
1560
|
+
sleep: (ms) => new Promise((resolve22) => {
|
|
1561
|
+
const timer = setTimeout(resolve22, ms);
|
|
1562
|
+
timer.unref?.();
|
|
1563
|
+
}),
|
|
1564
|
+
now: () => Date.now()
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
var requireFromHere = createRequire(import.meta.url);
|
|
1568
|
+
var MAX_SOCKET_PATH_LENGTH = 100;
|
|
1569
|
+
function resolveDaemonVersion(requireFn = requireFromHere) {
|
|
1570
|
+
for (const candidate of ["./package.json", "../package.json"]) {
|
|
1571
|
+
try {
|
|
1572
|
+
const pkg = requireFn(candidate);
|
|
1573
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0)
|
|
1574
|
+
return pkg.version;
|
|
1575
|
+
} catch {}
|
|
1576
|
+
}
|
|
1577
|
+
return "0";
|
|
1578
|
+
}
|
|
1579
|
+
function daemonBaseDir(env = process.env) {
|
|
1580
|
+
const explicit = env["CODEX_LSP_DAEMON_DIR"]?.trim();
|
|
1581
|
+
if (explicit)
|
|
1582
|
+
return explicit;
|
|
1583
|
+
const pluginData = env["PLUGIN_DATA"]?.trim();
|
|
1584
|
+
if (pluginData)
|
|
1585
|
+
return join2(pluginData, "daemon");
|
|
1586
|
+
const codexHome = env["CODEX_HOME"]?.trim();
|
|
1587
|
+
const home = codexHome && codexHome.length > 0 ? codexHome : join2(homedir(), ".codex");
|
|
1588
|
+
return join2(home, "codex-lsp", "daemon");
|
|
1589
|
+
}
|
|
1590
|
+
function daemonPaths(env = process.env, version = resolveDaemonVersion()) {
|
|
1591
|
+
const dir = join2(daemonBaseDir(env), `v${version}`);
|
|
1592
|
+
return {
|
|
1593
|
+
version,
|
|
1594
|
+
dir,
|
|
1595
|
+
socket: resolveSocketPath(dir, version),
|
|
1596
|
+
lock: join2(dir, "daemon.lock"),
|
|
1597
|
+
pid: join2(dir, "daemon.pid"),
|
|
1598
|
+
log: join2(dir, "daemon.log")
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
function resolveSocketPath(dir, version) {
|
|
1602
|
+
const digest = createHash("sha256").update(dir).digest("hex").slice(0, 16);
|
|
1603
|
+
if (process.platform === "win32") {
|
|
1604
|
+
return `\\\\.\\pipe\\omo-lsp-${version}-${digest}`;
|
|
1605
|
+
}
|
|
1606
|
+
const natural = join2(dir, "daemon.sock");
|
|
1607
|
+
if (natural.length < MAX_SOCKET_PATH_LENGTH)
|
|
1608
|
+
return natural;
|
|
1609
|
+
return join2(tmpdir(), `omo-lsp-${version}-${digest}.sock`);
|
|
1610
|
+
}
|
|
1611
|
+
var HEADER_SEPARATOR2 = Buffer.from(`\r
|
|
1612
|
+
\r
|
|
1613
|
+
`);
|
|
1614
|
+
var DEFAULT_IDLE_TIMEOUT_MS = 10 * 60000;
|
|
1615
|
+
function getInstallDecisionsPath() {
|
|
1616
|
+
const override = contextEnv("LSP_TOOLS_MCP_INSTALL_DECISIONS");
|
|
1617
|
+
if (!override)
|
|
1618
|
+
return join3(homedir2(), ".codex", "lsp-install-decisions.json");
|
|
1619
|
+
return isAbsolute(override) ? override : join3(homedir2(), override);
|
|
1620
|
+
}
|
|
1621
|
+
function loadInstallDecisions() {
|
|
1622
|
+
const path = getInstallDecisionsPath();
|
|
1623
|
+
if (!existsSync3(path))
|
|
1624
|
+
return {};
|
|
1625
|
+
try {
|
|
1626
|
+
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
1627
|
+
return isInstallDecisions(parsed) ? parsed : {};
|
|
1628
|
+
} catch {
|
|
1629
|
+
return {};
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
function loadInstallDecision(serverId) {
|
|
1633
|
+
return loadInstallDecisions()[serverId];
|
|
1634
|
+
}
|
|
1635
|
+
function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
|
|
1636
|
+
const decisions = loadInstallDecisions();
|
|
1637
|
+
decisions[serverId] = { decision, decidedAt };
|
|
1638
|
+
writeInstallDecisions(decisions);
|
|
1639
|
+
}
|
|
1640
|
+
function isInstallDecision(value) {
|
|
1641
|
+
return value === "declined" || value === "allowed";
|
|
1642
|
+
}
|
|
1643
|
+
function writeInstallDecisions(decisions) {
|
|
1644
|
+
const path = getInstallDecisionsPath();
|
|
1645
|
+
mkdirSync3(dirname3(path), { recursive: true });
|
|
1646
|
+
const tmpPath = `${path}.tmp`;
|
|
1647
|
+
writeFileSync(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
1648
|
+
`, "utf8");
|
|
1649
|
+
renameSync(tmpPath, path);
|
|
1650
|
+
}
|
|
1651
|
+
function isInstallDecisions(value) {
|
|
1652
|
+
return isRecord2(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
1653
|
+
}
|
|
1654
|
+
function isInstallDecisionRecord(value) {
|
|
1655
|
+
if (!isRecord2(value))
|
|
1656
|
+
return false;
|
|
1657
|
+
return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
|
|
1658
|
+
}
|
|
1659
|
+
function isRecord2(value) {
|
|
1660
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1661
|
+
}
|
|
1662
|
+
var LSP_INSTALL_HINTS = {
|
|
1663
|
+
typescript: "npm install -g typescript-language-server typescript",
|
|
1664
|
+
deno: "Install Deno from https://deno.land",
|
|
1665
|
+
vue: "npm install -g @vue/language-server",
|
|
1666
|
+
eslint: "npm install -g vscode-langservers-extracted",
|
|
1667
|
+
oxlint: "npm install -g oxlint",
|
|
1668
|
+
biome: "npm install -g @biomejs/biome",
|
|
1669
|
+
gopls: "go install golang.org/x/tools/gopls@latest",
|
|
1670
|
+
"ruby-lsp": "gem install ruby-lsp",
|
|
1671
|
+
basedpyright: "pip install basedpyright",
|
|
1672
|
+
pyright: "pip install pyright",
|
|
1673
|
+
ty: "pip install ty",
|
|
1674
|
+
ruff: "pip install ruff",
|
|
1675
|
+
"elixir-ls": "See https://github.com/elixir-lsp/elixir-ls",
|
|
1676
|
+
zls: "See https://github.com/zigtools/zls",
|
|
1677
|
+
csharp: "dotnet tool install -g csharp-ls",
|
|
1678
|
+
fsharp: "dotnet tool install -g fsautocomplete",
|
|
1679
|
+
"sourcekit-lsp": "Included with Xcode or Swift toolchain",
|
|
1680
|
+
rust: "Install rust-analyzer and ensure it is in PATH. If using rustup: rustup component add rust-analyzer. " + "If rust-analyzer exits while loading rust-src: rustup component remove rust-src && rustup component add rust-src.",
|
|
1681
|
+
clangd: "See https://clangd.llvm.org/installation",
|
|
1682
|
+
svelte: "npm install -g svelte-language-server",
|
|
1683
|
+
astro: "npm install -g @astrojs/language-server",
|
|
1684
|
+
"bash-ls": "npm install -g bash-language-server",
|
|
1685
|
+
jdtls: "See https://github.com/eclipse-jdtls/eclipse.jdt.ls",
|
|
1686
|
+
"yaml-ls": "npm install -g yaml-language-server",
|
|
1687
|
+
"lua-ls": "See https://github.com/LuaLS/lua-language-server",
|
|
1688
|
+
php: "npm install -g intelephense",
|
|
1689
|
+
dart: "Included with Dart SDK",
|
|
1690
|
+
"terraform-ls": "See https://github.com/hashicorp/terraform-ls",
|
|
1691
|
+
terraform: "See https://github.com/hashicorp/terraform-ls",
|
|
1692
|
+
prisma: "npm install -g prisma",
|
|
1693
|
+
"ocaml-lsp": "opam install ocaml-lsp-server",
|
|
1694
|
+
texlab: "See https://github.com/latex-lsp/texlab",
|
|
1695
|
+
dockerfile: "npm install -g dockerfile-language-server-nodejs",
|
|
1696
|
+
gleam: "See https://gleam.run/getting-started/installing/",
|
|
1697
|
+
"clojure-lsp": "See https://clojure-lsp.io/installation/",
|
|
1698
|
+
nixd: "nix profile install nixpkgs#nixd",
|
|
1699
|
+
tinymist: "See https://github.com/Myriad-Dreamin/tinymist",
|
|
1700
|
+
"haskell-language-server": "ghcup install hls",
|
|
1701
|
+
bash: "npm install -g bash-language-server",
|
|
1702
|
+
"kotlin-ls": "See https://github.com/Kotlin/kotlin-lsp",
|
|
1703
|
+
julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
|
|
1704
|
+
razor: "Razor runs through the Roslyn language server (cohosting). " + "Install: dotnet tool install -g roslyn-language-server --prerelease (requires v5.8.0+). See https://github.com/dotnet/razor"
|
|
1705
|
+
};
|
|
1706
|
+
var BUILTIN_SERVERS = {
|
|
1707
|
+
typescript: {
|
|
1708
|
+
command: ["typescript-language-server", "--stdio"],
|
|
1709
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"]
|
|
1710
|
+
},
|
|
1711
|
+
deno: { command: ["deno", "lsp"], extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"] },
|
|
1712
|
+
vue: { command: ["vue-language-server", "--stdio"], extensions: [".vue"] },
|
|
1713
|
+
eslint: {
|
|
1714
|
+
command: ["vscode-eslint-language-server", "--stdio"],
|
|
1715
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue"]
|
|
1716
|
+
},
|
|
1717
|
+
oxlint: {
|
|
1718
|
+
command: ["oxlint", "--lsp"],
|
|
1719
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue", ".astro", ".svelte"]
|
|
1720
|
+
},
|
|
1721
|
+
biome: {
|
|
1722
|
+
command: ["biome", "lsp-proxy", "--stdio"],
|
|
1723
|
+
extensions: [
|
|
1724
|
+
".ts",
|
|
1725
|
+
".tsx",
|
|
1726
|
+
".js",
|
|
1727
|
+
".jsx",
|
|
1728
|
+
".mjs",
|
|
1729
|
+
".cjs",
|
|
1730
|
+
".mts",
|
|
1731
|
+
".cts",
|
|
1732
|
+
".json",
|
|
1733
|
+
".jsonc",
|
|
1734
|
+
".vue",
|
|
1735
|
+
".astro",
|
|
1736
|
+
".svelte",
|
|
1737
|
+
".css",
|
|
1738
|
+
".graphql",
|
|
1739
|
+
".gql",
|
|
1740
|
+
".html"
|
|
1741
|
+
]
|
|
1742
|
+
},
|
|
1743
|
+
gopls: { command: ["gopls"], extensions: [".go"] },
|
|
1744
|
+
"ruby-lsp": {
|
|
1745
|
+
command: ["rubocop", "--lsp"],
|
|
1746
|
+
extensions: [".rb", ".rake", ".gemspec", ".ru"]
|
|
1747
|
+
},
|
|
1748
|
+
basedpyright: {
|
|
1749
|
+
command: ["basedpyright-langserver", "--stdio"],
|
|
1750
|
+
extensions: [".py", ".pyi"]
|
|
1751
|
+
},
|
|
1752
|
+
pyright: { command: ["pyright-langserver", "--stdio"], extensions: [".py", ".pyi"] },
|
|
1753
|
+
ty: { command: ["ty", "server"], extensions: [".py", ".pyi"] },
|
|
1754
|
+
ruff: { command: ["ruff", "server"], extensions: [".py", ".pyi"] },
|
|
1755
|
+
"elixir-ls": { command: ["elixir-ls"], extensions: [".ex", ".exs"] },
|
|
1756
|
+
zls: { command: ["zls"], extensions: [".zig", ".zon"] },
|
|
1757
|
+
csharp: { command: ["csharp-ls"], extensions: [".cs"] },
|
|
1758
|
+
fsharp: { command: ["fsautocomplete"], extensions: [".fs", ".fsi", ".fsx", ".fsscript"] },
|
|
1759
|
+
"sourcekit-lsp": { command: ["sourcekit-lsp"], extensions: [".swift", ".m", ".mm"] },
|
|
1760
|
+
rust: { command: ["rust-analyzer"], extensions: [".rs"] },
|
|
1761
|
+
clangd: {
|
|
1762
|
+
command: ["clangd", "--background-index", "--clang-tidy"],
|
|
1763
|
+
extensions: [".c", ".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".hxx", ".h++"]
|
|
1764
|
+
},
|
|
1765
|
+
svelte: { command: ["svelteserver", "--stdio"], extensions: [".svelte"] },
|
|
1766
|
+
astro: { command: ["astro-ls", "--stdio"], extensions: [".astro"] },
|
|
1767
|
+
bash: {
|
|
1768
|
+
command: ["bash-language-server", "start"],
|
|
1769
|
+
extensions: [".sh", ".bash", ".zsh", ".ksh"]
|
|
1770
|
+
},
|
|
1771
|
+
"bash-ls": {
|
|
1772
|
+
command: ["bash-language-server", "start"],
|
|
1773
|
+
extensions: [".sh", ".bash", ".zsh", ".ksh"]
|
|
1774
|
+
},
|
|
1775
|
+
jdtls: { command: ["jdtls"], extensions: [".java"] },
|
|
1776
|
+
"yaml-ls": { command: ["yaml-language-server", "--stdio"], extensions: [".yaml", ".yml"] },
|
|
1777
|
+
"lua-ls": { command: ["lua-language-server"], extensions: [".lua"] },
|
|
1778
|
+
php: { command: ["intelephense", "--stdio"], extensions: [".php"] },
|
|
1779
|
+
dart: { command: ["dart", "language-server", "--lsp"], extensions: [".dart"] },
|
|
1780
|
+
terraform: { command: ["terraform-ls", "serve"], extensions: [".tf", ".tfvars"] },
|
|
1781
|
+
"terraform-ls": { command: ["terraform-ls", "serve"], extensions: [".tf", ".tfvars"] },
|
|
1782
|
+
prisma: { command: ["prisma", "language-server"], extensions: [".prisma"] },
|
|
1783
|
+
"ocaml-lsp": { command: ["ocamllsp"], extensions: [".ml", ".mli"] },
|
|
1784
|
+
texlab: { command: ["texlab"], extensions: [".tex", ".bib"] },
|
|
1785
|
+
dockerfile: { command: ["docker-langserver", "--stdio"], extensions: [".dockerfile"] },
|
|
1786
|
+
gleam: { command: ["gleam", "lsp"], extensions: [".gleam"] },
|
|
1787
|
+
"clojure-lsp": {
|
|
1788
|
+
command: ["clojure-lsp", "listen"],
|
|
1789
|
+
extensions: [".clj", ".cljs", ".cljc", ".edn"]
|
|
1790
|
+
},
|
|
1791
|
+
nixd: { command: ["nixd"], extensions: [".nix"] },
|
|
1792
|
+
tinymist: { command: ["tinymist"], extensions: [".typ", ".typc"] },
|
|
1793
|
+
"haskell-language-server": {
|
|
1794
|
+
command: ["haskell-language-server-wrapper", "--lsp"],
|
|
1795
|
+
extensions: [".hs", ".lhs"]
|
|
1796
|
+
},
|
|
1797
|
+
"kotlin-ls": { command: ["kotlin-lsp", "--stdio"], extensions: [".kt", ".kts"] },
|
|
1798
|
+
julials: {
|
|
1799
|
+
command: ["julia", "--startup-file=no", "--history-file=no", "-e", "using LanguageServer; runserver()"],
|
|
1800
|
+
extensions: [".jl"]
|
|
1801
|
+
},
|
|
1802
|
+
razor: {
|
|
1803
|
+
command: ["roslyn-language-server", "--stdio"],
|
|
1804
|
+
extensions: [".razor", ".cshtml"]
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1807
|
+
function resolveProjectConfigPath(path) {
|
|
1808
|
+
return isAbsolute2(path) ? path : join4(contextCwd(), path);
|
|
1809
|
+
}
|
|
1810
|
+
function getProjectConfigPaths() {
|
|
1811
|
+
const projectOverride = contextEnv("LSP_TOOLS_MCP_PROJECT_CONFIG");
|
|
1812
|
+
if (projectOverride) {
|
|
1813
|
+
return projectOverride.split(delimiter2).filter(Boolean).map(resolveProjectConfigPath);
|
|
1814
|
+
}
|
|
1815
|
+
return [join4(contextCwd(), ".codex", "lsp-client.json")];
|
|
1816
|
+
}
|
|
1817
|
+
function getUserConfigPath() {
|
|
1818
|
+
const userOverride = contextEnv("LSP_TOOLS_MCP_USER_CONFIG");
|
|
1819
|
+
if (!userOverride)
|
|
1820
|
+
return join4(homedir3(), ".codex", "lsp-client.json");
|
|
1821
|
+
return isAbsolute2(userOverride) ? userOverride : join4(homedir3(), userOverride);
|
|
1822
|
+
}
|
|
1823
|
+
function loadJsonFile(path) {
|
|
1824
|
+
if (!existsSync4(path))
|
|
1825
|
+
return null;
|
|
1826
|
+
try {
|
|
1827
|
+
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
1828
|
+
return isConfigJson(parsed) ? parsed : null;
|
|
1829
|
+
} catch {
|
|
1830
|
+
return null;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
function loadAllConfigs() {
|
|
1834
|
+
const configs = new Map;
|
|
1835
|
+
const project = loadFirstJsonFile(getProjectConfigPaths());
|
|
1836
|
+
if (project)
|
|
1837
|
+
configs.set("project", project);
|
|
1838
|
+
const user = loadJsonFile(getUserConfigPath());
|
|
1839
|
+
if (user)
|
|
1840
|
+
configs.set("user", user);
|
|
1841
|
+
return configs;
|
|
1842
|
+
}
|
|
1843
|
+
function loadFirstJsonFile(paths) {
|
|
1844
|
+
for (const path of paths) {
|
|
1845
|
+
const config = loadJsonFile(path);
|
|
1846
|
+
if (config)
|
|
1847
|
+
return config;
|
|
1848
|
+
}
|
|
1849
|
+
return null;
|
|
1850
|
+
}
|
|
1851
|
+
function getMergedServers() {
|
|
1852
|
+
const configs = loadAllConfigs();
|
|
1853
|
+
const servers = [];
|
|
1854
|
+
const disabled = new Set;
|
|
1855
|
+
const seen = new Set;
|
|
1856
|
+
const sources = ["project", "user"];
|
|
1857
|
+
for (const source of sources) {
|
|
1858
|
+
const config = configs.get(source);
|
|
1859
|
+
if (!config?.lsp)
|
|
1860
|
+
continue;
|
|
1861
|
+
for (const [id, rawEntry] of Object.entries(config.lsp)) {
|
|
1862
|
+
const entry = parseLspEntry(rawEntry);
|
|
1863
|
+
if (!entry)
|
|
1864
|
+
continue;
|
|
1865
|
+
if (entry.disabled) {
|
|
1866
|
+
disabled.add(id);
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
if (seen.has(id))
|
|
1870
|
+
continue;
|
|
1871
|
+
const server2 = createServerFromEntry(id, entry, source);
|
|
1872
|
+
if (!server2)
|
|
1873
|
+
continue;
|
|
1874
|
+
servers.push(server2);
|
|
1875
|
+
seen.add(id);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
for (const [id, config] of Object.entries(BUILTIN_SERVERS)) {
|
|
1879
|
+
if (disabled.has(id) || seen.has(id))
|
|
1880
|
+
continue;
|
|
1881
|
+
servers.push({
|
|
1882
|
+
id,
|
|
1883
|
+
command: config.command,
|
|
1884
|
+
extensions: config.extensions,
|
|
1885
|
+
priority: -100,
|
|
1886
|
+
source: "builtin"
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
return servers.sort((a, b) => {
|
|
1890
|
+
if (a.source !== b.source) {
|
|
1891
|
+
const order = {
|
|
1892
|
+
project: 0,
|
|
1893
|
+
user: 1,
|
|
1894
|
+
builtin: 2
|
|
1895
|
+
};
|
|
1896
|
+
return order[a.source] - order[b.source];
|
|
1897
|
+
}
|
|
1898
|
+
return b.priority - a.priority;
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
function createServerFromEntry(id, entry, source) {
|
|
1902
|
+
const builtin = BUILTIN_SERVERS[id];
|
|
1903
|
+
if (source === "project") {
|
|
1904
|
+
if (!builtin)
|
|
1905
|
+
return null;
|
|
1906
|
+
const server3 = createServer({
|
|
1907
|
+
id,
|
|
1908
|
+
command: builtin.command,
|
|
1909
|
+
extensions: entry.extensions ?? builtin.extensions,
|
|
1910
|
+
priority: entry.priority ?? 0,
|
|
1911
|
+
source
|
|
1912
|
+
});
|
|
1913
|
+
if (entry.initialization !== undefined) {
|
|
1914
|
+
server3.initialization = entry.initialization;
|
|
1915
|
+
}
|
|
1916
|
+
return server3;
|
|
1917
|
+
}
|
|
1918
|
+
if (entry.command && entry.extensions) {
|
|
1919
|
+
const server3 = createServer({
|
|
1920
|
+
id,
|
|
1921
|
+
command: entry.command,
|
|
1922
|
+
extensions: entry.extensions,
|
|
1923
|
+
priority: entry.priority ?? 0,
|
|
1924
|
+
source
|
|
1925
|
+
});
|
|
1926
|
+
applyOptionalServerFields(server3, entry);
|
|
1927
|
+
return server3;
|
|
1928
|
+
}
|
|
1929
|
+
if (!builtin)
|
|
1930
|
+
return null;
|
|
1931
|
+
const server2 = createServer({
|
|
1932
|
+
id,
|
|
1933
|
+
command: entry.command ?? builtin.command,
|
|
1934
|
+
extensions: entry.extensions ?? builtin.extensions,
|
|
1935
|
+
priority: entry.priority ?? 0,
|
|
1936
|
+
source
|
|
1937
|
+
});
|
|
1938
|
+
applyOptionalServerFields(server2, entry);
|
|
1939
|
+
return server2;
|
|
1940
|
+
}
|
|
1941
|
+
function createServer(input) {
|
|
1942
|
+
const server2 = {
|
|
1943
|
+
id: input.id,
|
|
1944
|
+
command: input.command,
|
|
1945
|
+
extensions: input.extensions,
|
|
1946
|
+
priority: input.priority,
|
|
1947
|
+
source: input.source
|
|
1948
|
+
};
|
|
1949
|
+
if (input.env !== undefined) {
|
|
1950
|
+
server2.env = input.env;
|
|
1951
|
+
}
|
|
1952
|
+
if (input.initialization !== undefined) {
|
|
1953
|
+
server2.initialization = input.initialization;
|
|
1954
|
+
}
|
|
1955
|
+
return server2;
|
|
1956
|
+
}
|
|
1957
|
+
function applyOptionalServerFields(server2, entry) {
|
|
1958
|
+
if (entry.env !== undefined) {
|
|
1959
|
+
server2.env = entry.env;
|
|
1960
|
+
}
|
|
1961
|
+
if (entry.initialization !== undefined) {
|
|
1962
|
+
server2.initialization = entry.initialization;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
function isConfigJson(value) {
|
|
1966
|
+
if (!isRecord3(value))
|
|
1967
|
+
return false;
|
|
1968
|
+
const lsp = value["lsp"];
|
|
1969
|
+
return lsp === undefined || isRecord3(lsp);
|
|
1970
|
+
}
|
|
1971
|
+
function parseLspEntry(value) {
|
|
1972
|
+
return isLspEntry(value) ? value : null;
|
|
1973
|
+
}
|
|
1974
|
+
function isLspEntry(value) {
|
|
1975
|
+
if (!isRecord3(value))
|
|
1976
|
+
return false;
|
|
1977
|
+
const disabled = value["disabled"];
|
|
1978
|
+
const command = value["command"];
|
|
1979
|
+
const extensions = value["extensions"];
|
|
1980
|
+
const priority = value["priority"];
|
|
1981
|
+
const env = value["env"];
|
|
1982
|
+
const initialization = value["initialization"];
|
|
1983
|
+
return (disabled === undefined || typeof disabled === "boolean") && (command === undefined || isStringArray(command)) && (extensions === undefined || isStringArray(extensions)) && (priority === undefined || typeof priority === "number") && (env === undefined || isStringRecord(env)) && (initialization === undefined || isRecord3(initialization));
|
|
1984
|
+
}
|
|
1985
|
+
function isStringArray(value) {
|
|
1986
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
1987
|
+
}
|
|
1988
|
+
function isStringRecord(value) {
|
|
1989
|
+
return isRecord3(value) && Object.values(value).every((item) => typeof item === "string");
|
|
1990
|
+
}
|
|
1991
|
+
function isRecord3(value) {
|
|
1992
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1993
|
+
}
|
|
1994
|
+
function getDisabledServerIds() {
|
|
1995
|
+
const configs = loadAllConfigs();
|
|
1996
|
+
const disabled = new Set;
|
|
1997
|
+
for (const config of configs.values()) {
|
|
1998
|
+
if (!config.lsp)
|
|
1999
|
+
continue;
|
|
2000
|
+
for (const [id, rawEntry] of Object.entries(config.lsp)) {
|
|
2001
|
+
const entry = parseLspEntry(rawEntry);
|
|
2002
|
+
if (!entry)
|
|
2003
|
+
continue;
|
|
2004
|
+
if (entry.disabled)
|
|
2005
|
+
disabled.add(id);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
return disabled;
|
|
2009
|
+
}
|
|
2010
|
+
function isServerInstalled(command, _workingDirectory) {
|
|
2011
|
+
if (command.length === 0)
|
|
2012
|
+
return false;
|
|
2013
|
+
const [cmd] = command;
|
|
2014
|
+
if (!cmd)
|
|
2015
|
+
return false;
|
|
2016
|
+
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
2017
|
+
if (existsSync5(cmd))
|
|
2018
|
+
return true;
|
|
2019
|
+
}
|
|
2020
|
+
const isWindows = process.platform === "win32";
|
|
2021
|
+
let exts = [""];
|
|
2022
|
+
if (isWindows) {
|
|
2023
|
+
const pathExt = process.env["PATHEXT"] ?? "";
|
|
2024
|
+
if (pathExt) {
|
|
2025
|
+
const systemExts = pathExt.split(";").filter(Boolean);
|
|
2026
|
+
exts = [...new Set([...exts, ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
|
|
2027
|
+
} else {
|
|
2028
|
+
exts = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
let pathEnv = process.env["PATH"] ?? "";
|
|
2032
|
+
if (isWindows && !pathEnv) {
|
|
2033
|
+
pathEnv = process.env["Path"] ?? "";
|
|
2034
|
+
}
|
|
2035
|
+
const paths = pathEnv.split(delimiter3);
|
|
2036
|
+
for (const p of paths) {
|
|
2037
|
+
for (const suffix of exts) {
|
|
2038
|
+
if (existsSync5(join5(p, cmd + suffix))) {
|
|
2039
|
+
return true;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
if (cmd === "node")
|
|
2044
|
+
return true;
|
|
2045
|
+
return false;
|
|
2046
|
+
}
|
|
2047
|
+
function findServerForExtension(ext) {
|
|
2048
|
+
const servers = getMergedServers();
|
|
2049
|
+
for (const server2 of servers) {
|
|
2050
|
+
if (server2.extensions.includes(ext) && isServerInstalled(server2.command)) {
|
|
2051
|
+
const resolvedServer = {
|
|
2052
|
+
id: server2.id,
|
|
2053
|
+
command: server2.command,
|
|
2054
|
+
extensions: server2.extensions,
|
|
2055
|
+
priority: server2.priority
|
|
2056
|
+
};
|
|
2057
|
+
if (server2.env !== undefined) {
|
|
2058
|
+
return {
|
|
2059
|
+
status: "found",
|
|
2060
|
+
server: {
|
|
2061
|
+
...resolvedServer,
|
|
2062
|
+
env: server2.env,
|
|
2063
|
+
...server2.initialization === undefined ? {} : { initialization: server2.initialization }
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
return {
|
|
2068
|
+
status: "found",
|
|
2069
|
+
server: {
|
|
2070
|
+
...resolvedServer,
|
|
2071
|
+
...server2.initialization === undefined ? {} : { initialization: server2.initialization }
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
for (const server2 of servers) {
|
|
2077
|
+
if (server2.extensions.includes(ext)) {
|
|
2078
|
+
const installHint = LSP_INSTALL_HINTS[server2.id] ?? `Install '${server2.command[0]}' and ensure it's in your PATH`;
|
|
2079
|
+
return {
|
|
2080
|
+
status: "not_installed",
|
|
2081
|
+
server: {
|
|
2082
|
+
id: server2.id,
|
|
2083
|
+
command: server2.command,
|
|
2084
|
+
extensions: server2.extensions
|
|
2085
|
+
},
|
|
2086
|
+
installHint
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
const availableServers = [...new Set(servers.map((s) => s.id))];
|
|
2091
|
+
return {
|
|
2092
|
+
status: "not_configured",
|
|
2093
|
+
extension: ext,
|
|
2094
|
+
availableServers
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
function getAllServers() {
|
|
2098
|
+
const servers = getMergedServers();
|
|
2099
|
+
const disabled = getDisabledServerIds();
|
|
2100
|
+
const result = [];
|
|
2101
|
+
const seen = new Set;
|
|
2102
|
+
for (const server2 of servers) {
|
|
2103
|
+
if (seen.has(server2.id))
|
|
2104
|
+
continue;
|
|
2105
|
+
result.push({
|
|
2106
|
+
id: server2.id,
|
|
2107
|
+
installed: isServerInstalled(server2.command),
|
|
2108
|
+
extensions: server2.extensions,
|
|
2109
|
+
disabled: false,
|
|
2110
|
+
source: server2.source,
|
|
2111
|
+
priority: server2.priority
|
|
2112
|
+
});
|
|
2113
|
+
seen.add(server2.id);
|
|
2114
|
+
}
|
|
2115
|
+
for (const id of disabled) {
|
|
2116
|
+
if (seen.has(id))
|
|
2117
|
+
continue;
|
|
2118
|
+
const builtin = BUILTIN_SERVERS[id];
|
|
2119
|
+
result.push({
|
|
2120
|
+
id,
|
|
2121
|
+
installed: builtin ? isServerInstalled(builtin.command) : false,
|
|
2122
|
+
extensions: builtin?.extensions ?? [],
|
|
2123
|
+
disabled: true,
|
|
2124
|
+
source: "disabled",
|
|
2125
|
+
priority: 0
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
return result;
|
|
2129
|
+
}
|
|
2130
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
2131
|
+
function isDirectoryPath(filePath) {
|
|
2132
|
+
try {
|
|
2133
|
+
return statSync2(filePath).isDirectory();
|
|
2134
|
+
} catch {
|
|
2135
|
+
return false;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
function findWorkspaceRoot(filePath) {
|
|
2139
|
+
const abs = resolve2(contextCwd(), filePath);
|
|
2140
|
+
let dir = abs;
|
|
2141
|
+
if (!isDirectoryPath(dir)) {
|
|
2142
|
+
dir = dirname4(dir);
|
|
2143
|
+
}
|
|
2144
|
+
let prevDir = "";
|
|
2145
|
+
while (dir !== prevDir) {
|
|
2146
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
2147
|
+
if (existsSync6(join6(dir, marker))) {
|
|
2148
|
+
return dir;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
prevDir = dir;
|
|
2152
|
+
dir = dirname4(dir);
|
|
2153
|
+
}
|
|
2154
|
+
return dirname4(abs);
|
|
2155
|
+
}
|
|
2156
|
+
function formatServerLookupError(result) {
|
|
2157
|
+
if (result.status === "not_installed") {
|
|
2158
|
+
return formatNotInstalled(result);
|
|
2159
|
+
}
|
|
2160
|
+
return [
|
|
2161
|
+
`No LSP server configured for extension: ${result.extension}`,
|
|
2162
|
+
"",
|
|
2163
|
+
`Available servers: ${result.availableServers.slice(0, 10).join(", ")}${result.availableServers.length > 10 ? "..." : ""}`,
|
|
2164
|
+
"",
|
|
2165
|
+
"Configure a custom server in '.codex/lsp-client.json':",
|
|
2166
|
+
" {",
|
|
2167
|
+
' "lsp": {',
|
|
2168
|
+
' "my-server": {',
|
|
2169
|
+
' "command": ["my-lsp", "--stdio"],',
|
|
2170
|
+
` "extensions": ["${result.extension}"]`,
|
|
2171
|
+
" }",
|
|
2172
|
+
" }",
|
|
2173
|
+
" }"
|
|
2174
|
+
].join(`
|
|
2175
|
+
`);
|
|
2176
|
+
}
|
|
2177
|
+
function formatNotInstalled(result) {
|
|
2178
|
+
const { server: server2, installHint } = result;
|
|
2179
|
+
const extensions = server2.extensions.join(", ");
|
|
2180
|
+
const decision = loadInstallDecision(server2.id)?.decision;
|
|
2181
|
+
if (decision === "declined") {
|
|
2182
|
+
return `LSP server '${server2.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
|
|
2183
|
+
}
|
|
2184
|
+
const header = [
|
|
2185
|
+
`LSP server '${server2.id}' for ${extensions} is NOT INSTALLED.`,
|
|
2186
|
+
"",
|
|
2187
|
+
`Command not found: ${server2.command[0]}`,
|
|
2188
|
+
""
|
|
2189
|
+
];
|
|
2190
|
+
if (decision === "allowed") {
|
|
2191
|
+
return [
|
|
2192
|
+
...header,
|
|
2193
|
+
"The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
|
|
2194
|
+
` ${installHint}`
|
|
2195
|
+
].join(`
|
|
2196
|
+
`);
|
|
2197
|
+
}
|
|
2198
|
+
return [
|
|
2199
|
+
...header,
|
|
2200
|
+
"To install, run:",
|
|
2201
|
+
` ${installHint}`,
|
|
2202
|
+
"",
|
|
2203
|
+
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
2204
|
+
"- If the user agrees: run the install command above, then retry this tool.",
|
|
2205
|
+
"- If the user declines, OR has NOT explicitly asked for LSP installation:",
|
|
2206
|
+
` call lsp_install_decision { server_id: "${server2.id}", decision: "declined" },`,
|
|
2207
|
+
" then ignore this message and proceed WITHOUT LSP."
|
|
2208
|
+
].join(`
|
|
2209
|
+
`);
|
|
2210
|
+
}
|
|
2211
|
+
var READ_ONLY_RETRY_TOOLS = new Set([
|
|
2212
|
+
"diagnostics",
|
|
2213
|
+
"definition",
|
|
2214
|
+
"references",
|
|
2215
|
+
"documentSymbols",
|
|
2216
|
+
"workspaceSymbols",
|
|
2217
|
+
"prepareRename"
|
|
2218
|
+
]);
|
|
2219
|
+
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
2220
|
+
const absPath = resolve2(contextCwd(), filePath);
|
|
2221
|
+
if (isDirectoryPath(absPath)) {
|
|
2222
|
+
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
2223
|
+
}
|
|
2224
|
+
const ext = effectiveExtension(absPath);
|
|
2225
|
+
const result = findServerForExtension(ext);
|
|
2226
|
+
if (result.status !== "found") {
|
|
2227
|
+
throw new LspServerLookupError(formatServerLookupError(result));
|
|
2228
|
+
}
|
|
2229
|
+
const server2 = result.server;
|
|
2230
|
+
const root = findWorkspaceRoot(absPath);
|
|
2231
|
+
const manager = options.manager ?? getLspManager();
|
|
2232
|
+
const acquireAndCall = async (allowRetry) => {
|
|
2233
|
+
const client = await manager.getClient(root, server2, options.signal);
|
|
2234
|
+
try {
|
|
2235
|
+
return await fn(client, root);
|
|
2236
|
+
} catch (err) {
|
|
2237
|
+
if (allowRetry && READ_ONLY_RETRY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
2238
|
+
manager.invalidateClient(root, server2.id, client);
|
|
2239
|
+
return acquireAndCall(false);
|
|
2240
|
+
}
|
|
2241
|
+
if (err instanceof LspRequestTimeoutError) {
|
|
2242
|
+
if (manager.isServerInitializing(root, server2.id)) {
|
|
2243
|
+
throw new LspServerInitializingError(err);
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
throw err;
|
|
2247
|
+
} finally {
|
|
2248
|
+
manager.releaseClient(root, server2.id);
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
return acquireAndCall(true);
|
|
2252
|
+
}
|
|
2253
|
+
var DIAGNOSTIC_SEVERITY_FILTERS = {
|
|
2254
|
+
error: 1,
|
|
2255
|
+
warning: 2,
|
|
2256
|
+
information: 3,
|
|
2257
|
+
hint: 4
|
|
2258
|
+
};
|
|
2259
|
+
function uriToPath(uri) {
|
|
2260
|
+
return fileURLToPath2(uri);
|
|
2261
|
+
}
|
|
2262
|
+
function formatLocation(loc) {
|
|
2263
|
+
if ("targetUri" in loc) {
|
|
2264
|
+
const uri2 = uriToPath(loc.targetUri);
|
|
2265
|
+
const line2 = loc.targetRange.start.line + 1;
|
|
2266
|
+
const char2 = loc.targetRange.start.character;
|
|
2267
|
+
return `${uri2}:${line2}:${char2}`;
|
|
2268
|
+
}
|
|
2269
|
+
const uri = uriToPath(loc.uri);
|
|
2270
|
+
const line = loc.range.start.line + 1;
|
|
2271
|
+
const char = loc.range.start.character;
|
|
2272
|
+
return `${uri}:${line}:${char}`;
|
|
2273
|
+
}
|
|
2274
|
+
function formatSymbolKind(kind) {
|
|
2275
|
+
return SYMBOL_KIND_MAP[kind] ?? `Unknown(${kind})`;
|
|
2276
|
+
}
|
|
2277
|
+
function formatSeverity(severity) {
|
|
2278
|
+
if (!severity)
|
|
2279
|
+
return "unknown";
|
|
2280
|
+
return SEVERITY_MAP[severity] ?? `unknown(${severity})`;
|
|
2281
|
+
}
|
|
2282
|
+
function formatDocumentSymbol(symbol, indent = 0) {
|
|
2283
|
+
const prefix = " ".repeat(indent);
|
|
2284
|
+
const kind = formatSymbolKind(symbol.kind);
|
|
2285
|
+
const line = symbol.range.start.line + 1;
|
|
2286
|
+
let result = `${prefix}${symbol.name} (${kind}) - line ${line}`;
|
|
2287
|
+
if (symbol.children && symbol.children.length > 0) {
|
|
2288
|
+
for (const child of symbol.children) {
|
|
2289
|
+
result += `
|
|
2290
|
+
${formatDocumentSymbol(child, indent + 1)}`;
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
return result;
|
|
2294
|
+
}
|
|
2295
|
+
function formatSymbolInfo(symbol) {
|
|
2296
|
+
const kind = formatSymbolKind(symbol.kind);
|
|
2297
|
+
const loc = formatLocation(symbol.location);
|
|
2298
|
+
const container = symbol.containerName ? ` (in ${symbol.containerName})` : "";
|
|
2299
|
+
return `${symbol.name} (${kind})${container} - ${loc}`;
|
|
2300
|
+
}
|
|
2301
|
+
function formatDiagnostic(diag) {
|
|
2302
|
+
const severity = formatSeverity(diag.severity);
|
|
2303
|
+
const line = diag.range.start.line + 1;
|
|
2304
|
+
const char = diag.range.start.character;
|
|
2305
|
+
const source = diag.source ? `[${diag.source}]` : "";
|
|
2306
|
+
const code = diag.code ? ` (${diag.code})` : "";
|
|
2307
|
+
return `${severity}${source}${code} at ${line}:${char}: ${diag.message}`;
|
|
2308
|
+
}
|
|
2309
|
+
function filterDiagnosticsBySeverity(diagnostics, severityFilter) {
|
|
2310
|
+
if (!severityFilter || severityFilter === "all") {
|
|
2311
|
+
return diagnostics;
|
|
2312
|
+
}
|
|
2313
|
+
const targetSeverity = DIAGNOSTIC_SEVERITY_FILTERS[severityFilter];
|
|
2314
|
+
return diagnostics.filter((d) => d.severity === targetSeverity);
|
|
2315
|
+
}
|
|
2316
|
+
function formatPrepareRenameResult(result) {
|
|
2317
|
+
if (!result)
|
|
2318
|
+
return "Cannot rename at this position";
|
|
2319
|
+
if ("defaultBehavior" in result) {
|
|
2320
|
+
return result.defaultBehavior ? "Rename supported (using default behavior)" : "Cannot rename at this position";
|
|
2321
|
+
}
|
|
2322
|
+
if ("range" in result && result.range) {
|
|
2323
|
+
const startLine = result.range.start.line + 1;
|
|
2324
|
+
const startChar = result.range.start.character;
|
|
2325
|
+
const endLine = result.range.end.line + 1;
|
|
2326
|
+
const endChar = result.range.end.character;
|
|
2327
|
+
const placeholder = result.placeholder ? ` (current: "${result.placeholder}")` : "";
|
|
2328
|
+
return `Rename available at ${startLine}:${startChar}-${endLine}:${endChar}${placeholder}`;
|
|
2329
|
+
}
|
|
2330
|
+
if ("start" in result && "end" in result) {
|
|
2331
|
+
const startLine = result.start.line + 1;
|
|
2332
|
+
const startChar = result.start.character;
|
|
2333
|
+
const endLine = result.end.line + 1;
|
|
2334
|
+
const endChar = result.end.character;
|
|
2335
|
+
return `Rename available at ${startLine}:${startChar}-${endLine}:${endChar}`;
|
|
2336
|
+
}
|
|
2337
|
+
return "Cannot rename at this position";
|
|
2338
|
+
}
|
|
2339
|
+
function formatApplyResult(result) {
|
|
2340
|
+
const lines = [];
|
|
2341
|
+
if (result.success) {
|
|
2342
|
+
lines.push(`Applied ${result.totalEdits} edit(s) to ${result.filesModified.length} file(s):`);
|
|
2343
|
+
for (const file of result.filesModified) {
|
|
2344
|
+
lines.push(` - ${file}`);
|
|
2345
|
+
}
|
|
2346
|
+
} else {
|
|
2347
|
+
lines.push("Failed to apply some changes:");
|
|
2348
|
+
for (const err of result.errors) {
|
|
2349
|
+
lines.push(` Error: ${err}`);
|
|
2350
|
+
}
|
|
2351
|
+
if (result.filesModified.length > 0) {
|
|
2352
|
+
lines.push(`Successfully modified: ${result.filesModified.join(", ")}`);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return lines.join(`
|
|
2356
|
+
`);
|
|
2357
|
+
}
|
|
2358
|
+
var SKIP_DIRECTORIES = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
2359
|
+
function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
2360
|
+
const files = [];
|
|
2361
|
+
function walk(currentDir) {
|
|
2362
|
+
if (files.length >= maxFiles)
|
|
2363
|
+
return;
|
|
2364
|
+
let entries = [];
|
|
2365
|
+
try {
|
|
2366
|
+
entries = readdirSync(currentDir);
|
|
2367
|
+
} catch {
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
for (const entry of entries) {
|
|
2371
|
+
if (files.length >= maxFiles)
|
|
12
2372
|
return;
|
|
2373
|
+
const fullPath = join7(currentDir, entry);
|
|
2374
|
+
let stat;
|
|
2375
|
+
try {
|
|
2376
|
+
stat = lstatSync(fullPath);
|
|
2377
|
+
} catch {
|
|
2378
|
+
continue;
|
|
2379
|
+
}
|
|
2380
|
+
if (!stat || stat.isSymbolicLink())
|
|
2381
|
+
continue;
|
|
2382
|
+
if (stat.isDirectory()) {
|
|
2383
|
+
if (!SKIP_DIRECTORIES.has(entry)) {
|
|
2384
|
+
walk(fullPath);
|
|
2385
|
+
}
|
|
2386
|
+
} else if (stat.isFile() && effectiveExtension(fullPath) === extension) {
|
|
2387
|
+
files.push(fullPath);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
walk(dir);
|
|
2392
|
+
return files;
|
|
2393
|
+
}
|
|
2394
|
+
async function aggregateDiagnosticsForDirectory(directory, extension, severity, maxFiles = DEFAULT_MAX_DIRECTORY_FILES) {
|
|
2395
|
+
if (!extension.startsWith(".")) {
|
|
2396
|
+
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
2397
|
+
}
|
|
2398
|
+
const absDir = resolve3(contextCwd(), directory);
|
|
2399
|
+
if (!existsSync7(absDir)) {
|
|
2400
|
+
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
2401
|
+
}
|
|
2402
|
+
const serverResult = findServerForExtension(extension);
|
|
2403
|
+
if (serverResult.status !== "found") {
|
|
2404
|
+
throw new LspServerLookupError(formatServerLookupError(serverResult));
|
|
2405
|
+
}
|
|
2406
|
+
const server2 = serverResult.server;
|
|
2407
|
+
const allFiles = collectFilesWithExtension(absDir, extension, maxFiles + 1);
|
|
2408
|
+
const wasCapped = allFiles.length > maxFiles;
|
|
2409
|
+
const filesToProcess = allFiles.slice(0, maxFiles);
|
|
2410
|
+
if (filesToProcess.length === 0) {
|
|
2411
|
+
return [
|
|
2412
|
+
`Directory: ${absDir}`,
|
|
2413
|
+
`Extension: ${extension}`,
|
|
2414
|
+
"Files scanned: 0",
|
|
2415
|
+
`No files found with extension "${extension}".`
|
|
2416
|
+
].join(`
|
|
2417
|
+
`);
|
|
2418
|
+
}
|
|
2419
|
+
const root = findWorkspaceRoot(absDir);
|
|
2420
|
+
const manager = getLspManager();
|
|
2421
|
+
const allDiagnostics = [];
|
|
2422
|
+
const fileErrors = [];
|
|
2423
|
+
const client = await manager.getClient(root, server2);
|
|
2424
|
+
try {
|
|
2425
|
+
for (const file of filesToProcess) {
|
|
2426
|
+
try {
|
|
2427
|
+
const result = await client.diagnostics(file);
|
|
2428
|
+
const filtered = filterDiagnosticsBySeverity(result.items, severity);
|
|
2429
|
+
allDiagnostics.push(...filtered.map((diagnostic) => ({
|
|
2430
|
+
filePath: file,
|
|
2431
|
+
diagnostic
|
|
2432
|
+
})));
|
|
2433
|
+
} catch (e) {
|
|
2434
|
+
fileErrors.push({
|
|
2435
|
+
file,
|
|
2436
|
+
error: e instanceof Error ? e.message : String(e)
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
} finally {
|
|
2441
|
+
manager.releaseClient(root, server2.id);
|
|
2442
|
+
}
|
|
2443
|
+
const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
|
|
2444
|
+
const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
|
|
2445
|
+
const lines = [
|
|
2446
|
+
`Directory: ${absDir}`,
|
|
2447
|
+
`Extension: ${extension}`,
|
|
2448
|
+
`Files scanned: ${filesToProcess.length}${wasCapped ? ` (capped at ${maxFiles})` : ""}`,
|
|
2449
|
+
`Files with errors: ${fileErrors.length}`,
|
|
2450
|
+
`Total diagnostics: ${allDiagnostics.length}`
|
|
2451
|
+
];
|
|
2452
|
+
if (fileErrors.length > 0) {
|
|
2453
|
+
lines.push("", "File processing errors:");
|
|
2454
|
+
for (const { file, error } of fileErrors) {
|
|
2455
|
+
lines.push(` ${file}: ${error}`);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
if (displayDiagnostics.length > 0) {
|
|
2459
|
+
lines.push("");
|
|
2460
|
+
for (const { filePath, diagnostic } of displayDiagnostics) {
|
|
2461
|
+
lines.push(`${filePath}: ${formatDiagnostic(diagnostic)}`);
|
|
2462
|
+
}
|
|
2463
|
+
if (wasDiagCapped) {
|
|
2464
|
+
lines.push("", `... (${allDiagnostics.length - DEFAULT_MAX_DIAGNOSTICS} more diagnostics not shown)`);
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
return lines.join(`
|
|
2468
|
+
`);
|
|
2469
|
+
}
|
|
2470
|
+
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
2471
|
+
var MAX_SCAN_ENTRIES = 500;
|
|
2472
|
+
function inferExtensionFromDirectory(directory) {
|
|
2473
|
+
const extensionCounts = new Map;
|
|
2474
|
+
let scanned = 0;
|
|
2475
|
+
function walk(dir) {
|
|
2476
|
+
if (scanned >= MAX_SCAN_ENTRIES)
|
|
2477
|
+
return;
|
|
2478
|
+
let entries;
|
|
2479
|
+
try {
|
|
2480
|
+
entries = readdirSync2(dir);
|
|
2481
|
+
} catch {
|
|
2482
|
+
return;
|
|
2483
|
+
}
|
|
2484
|
+
for (const entry of entries) {
|
|
2485
|
+
if (scanned >= MAX_SCAN_ENTRIES)
|
|
2486
|
+
return;
|
|
2487
|
+
const fullPath = join8(dir, entry);
|
|
2488
|
+
let stat;
|
|
2489
|
+
try {
|
|
2490
|
+
stat = lstatSync2(fullPath);
|
|
2491
|
+
} catch {
|
|
2492
|
+
continue;
|
|
2493
|
+
}
|
|
2494
|
+
if (stat.isSymbolicLink())
|
|
2495
|
+
continue;
|
|
2496
|
+
scanned++;
|
|
2497
|
+
if (stat.isDirectory()) {
|
|
2498
|
+
if (!SKIP_DIRECTORIES2.has(entry)) {
|
|
2499
|
+
walk(fullPath);
|
|
2500
|
+
}
|
|
2501
|
+
} else if (stat.isFile()) {
|
|
2502
|
+
const ext = effectiveExtension(fullPath);
|
|
2503
|
+
if (ext && ext in EXT_TO_LANG) {
|
|
2504
|
+
extensionCounts.set(ext, (extensionCounts.get(ext) ?? 0) + 1);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
walk(directory);
|
|
2510
|
+
if (extensionCounts.size === 0)
|
|
2511
|
+
return null;
|
|
2512
|
+
let maxExt = "";
|
|
2513
|
+
let maxCount = 0;
|
|
2514
|
+
for (const [ext, count] of extensionCounts) {
|
|
2515
|
+
if (count > maxCount) {
|
|
2516
|
+
maxCount = count;
|
|
2517
|
+
maxExt = ext;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return maxExt || null;
|
|
2521
|
+
}
|
|
2522
|
+
var RUST_SRC_REPAIR_MESSAGE = [
|
|
2523
|
+
"rust-analyzer exited while loading Rust standard library sources.",
|
|
2524
|
+
"",
|
|
2525
|
+
"Repair rust-src for the active toolchain:",
|
|
2526
|
+
" rustup component remove rust-src",
|
|
2527
|
+
" rustup component add rust-src"
|
|
2528
|
+
];
|
|
2529
|
+
function errorMessage(error) {
|
|
2530
|
+
return error instanceof Error ? error.message : String(error);
|
|
2531
|
+
}
|
|
2532
|
+
function formatKnownLspStartupFailure(error) {
|
|
2533
|
+
if (!(error instanceof LspProcessExitedError))
|
|
2534
|
+
return null;
|
|
2535
|
+
if (error.serverId !== "rust")
|
|
2536
|
+
return null;
|
|
2537
|
+
const details = error.stderrTail ?? error.message;
|
|
2538
|
+
const lowerDetails = details.toLowerCase();
|
|
2539
|
+
const isRustSrcFailure = lowerDetails.includes("rust-src") && (lowerDetails.includes("failed to install component") || lowerDetails.includes("detected conflict") || lowerDetails.includes("can't load standard library") || lowerDetails.includes("try installing") || lowerDetails.includes("sysroot"));
|
|
2540
|
+
if (!isRustSrcFailure)
|
|
2541
|
+
return null;
|
|
2542
|
+
return [...RUST_SRC_REPAIR_MESSAGE, "", "Original stderr tail:", details].join(`
|
|
2543
|
+
`);
|
|
2544
|
+
}
|
|
2545
|
+
function handleMissingDependencyError(error) {
|
|
2546
|
+
const knownStartupFailure = formatKnownLspStartupFailure(error);
|
|
2547
|
+
if (knownStartupFailure)
|
|
2548
|
+
return knownStartupFailure;
|
|
2549
|
+
const message = errorMessage(error);
|
|
2550
|
+
return message.includes("NOT INSTALLED") || message.includes("No LSP server configured") ? message : null;
|
|
2551
|
+
}
|
|
2552
|
+
function missingDependencyResult(error, details) {
|
|
2553
|
+
const message = handleMissingDependencyError(error);
|
|
2554
|
+
if (!message)
|
|
2555
|
+
return null;
|
|
2556
|
+
return {
|
|
2557
|
+
content: [{ type: "text", text: message }],
|
|
2558
|
+
details: {
|
|
2559
|
+
...details,
|
|
2560
|
+
error: message,
|
|
2561
|
+
errorKind: "missing_dependency"
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
function requireString(params, key) {
|
|
2566
|
+
const value = params[key];
|
|
2567
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
2568
|
+
throw new Error(`Missing required string parameter '${key}'`);
|
|
2569
|
+
}
|
|
2570
|
+
return value;
|
|
2571
|
+
}
|
|
2572
|
+
function optionalString(params, key) {
|
|
2573
|
+
const value = params[key];
|
|
2574
|
+
return typeof value === "string" ? value : undefined;
|
|
2575
|
+
}
|
|
2576
|
+
function requireNumber(params, key) {
|
|
2577
|
+
const value = params[key];
|
|
2578
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2579
|
+
throw new Error(`Missing required number parameter '${key}'`);
|
|
2580
|
+
}
|
|
2581
|
+
return value;
|
|
2582
|
+
}
|
|
2583
|
+
function optionalNumber(params, key) {
|
|
2584
|
+
const value = params[key];
|
|
2585
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
2586
|
+
}
|
|
2587
|
+
function optionalBoolean(params, key) {
|
|
2588
|
+
const value = params[key];
|
|
2589
|
+
return typeof value === "boolean" ? value : undefined;
|
|
2590
|
+
}
|
|
2591
|
+
function severityFilter(params) {
|
|
2592
|
+
const value = params["severity"];
|
|
2593
|
+
if (value === "error" || value === "warning" || value === "information" || value === "hint" || value === "all") {
|
|
2594
|
+
return value;
|
|
2595
|
+
}
|
|
2596
|
+
return "all";
|
|
2597
|
+
}
|
|
2598
|
+
function clientOptions(signal) {
|
|
2599
|
+
return signal === undefined ? {} : { signal };
|
|
2600
|
+
}
|
|
2601
|
+
function text(text2, details, isError = false) {
|
|
2602
|
+
return { content: [{ type: "text", text: text2 }], details, isError };
|
|
2603
|
+
}
|
|
2604
|
+
function asDiagnosticArray(result) {
|
|
2605
|
+
if (!result)
|
|
2606
|
+
return [];
|
|
2607
|
+
if (Array.isArray(result))
|
|
2608
|
+
return result;
|
|
2609
|
+
return result.items ?? [];
|
|
2610
|
+
}
|
|
2611
|
+
async function executeLspDiagnostics(params, signal) {
|
|
2612
|
+
const filePath = requireString(params, "filePath");
|
|
2613
|
+
const severity = severityFilter(params);
|
|
2614
|
+
try {
|
|
2615
|
+
const absPath = resolve4(contextCwd(), filePath);
|
|
2616
|
+
if (isDirectoryPath(absPath)) {
|
|
2617
|
+
const extension = inferExtensionFromDirectory(absPath);
|
|
2618
|
+
if (!extension) {
|
|
2619
|
+
const message = `No supported source files found in directory: ${absPath}`;
|
|
2620
|
+
const details3 = {
|
|
2621
|
+
filePath,
|
|
2622
|
+
severity,
|
|
2623
|
+
mode: "directory",
|
|
2624
|
+
diagnostics: [],
|
|
2625
|
+
totalDiagnostics: 0,
|
|
2626
|
+
truncated: false,
|
|
2627
|
+
error: message,
|
|
2628
|
+
errorKind: "no_files"
|
|
2629
|
+
};
|
|
2630
|
+
return text(message, details3);
|
|
2631
|
+
}
|
|
2632
|
+
const output2 = await aggregateDiagnosticsForDirectory(absPath, extension, severity);
|
|
2633
|
+
const details2 = {
|
|
2634
|
+
filePath,
|
|
2635
|
+
severity,
|
|
2636
|
+
mode: "directory",
|
|
2637
|
+
diagnostics: [],
|
|
2638
|
+
totalDiagnostics: 0,
|
|
2639
|
+
truncated: false
|
|
2640
|
+
};
|
|
2641
|
+
return text(output2, details2);
|
|
2642
|
+
}
|
|
2643
|
+
const result = await withLspClient(filePath, async (client) => client.diagnostics(filePath), "diagnostics", clientOptions(signal));
|
|
2644
|
+
const diagnostics = filterDiagnosticsBySeverity(asDiagnosticArray(result), severity);
|
|
2645
|
+
const total = diagnostics.length;
|
|
2646
|
+
const truncated = total > DEFAULT_MAX_DIAGNOSTICS;
|
|
2647
|
+
const limited = truncated ? diagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS) : diagnostics;
|
|
2648
|
+
const output = total === 0 ? "No diagnostics found" : [
|
|
2649
|
+
...truncated ? [`Found ${total} diagnostics (showing first ${DEFAULT_MAX_DIAGNOSTICS}):`] : [],
|
|
2650
|
+
...limited.map(formatDiagnostic)
|
|
2651
|
+
].join(`
|
|
2652
|
+
`);
|
|
2653
|
+
const details = {
|
|
2654
|
+
filePath,
|
|
2655
|
+
severity,
|
|
2656
|
+
mode: "file",
|
|
2657
|
+
diagnostics: diagnostics.map((diagnostic) => ({ file: absPath, diagnostic })),
|
|
2658
|
+
totalDiagnostics: total,
|
|
2659
|
+
truncated
|
|
2660
|
+
};
|
|
2661
|
+
return text(output, details);
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
const missingDependency = missingDependencyResult(error, {
|
|
2664
|
+
filePath,
|
|
2665
|
+
severity,
|
|
2666
|
+
mode: "file",
|
|
2667
|
+
diagnostics: [],
|
|
2668
|
+
totalDiagnostics: 0,
|
|
2669
|
+
truncated: false
|
|
2670
|
+
});
|
|
2671
|
+
if (missingDependency)
|
|
2672
|
+
return missingDependency;
|
|
2673
|
+
throw error;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
async function executeLspInstallDecision(params) {
|
|
2677
|
+
const serverId = requireString(params, "server_id");
|
|
2678
|
+
const decision = params["decision"];
|
|
2679
|
+
if (!isInstallDecision(decision)) {
|
|
2680
|
+
return text(`Invalid decision '${String(decision)}'. Expected "declined" or "allowed".`, { serverId, errorKind: "invalid_decision" }, true);
|
|
2681
|
+
}
|
|
2682
|
+
const serverIds = [...new Set(getMergedServers().map((server2) => server2.id))];
|
|
2683
|
+
if (!serverIds.includes(serverId)) {
|
|
2684
|
+
const preview = serverIds.slice(0, 20).join(", ");
|
|
2685
|
+
return text(`Unknown LSP server '${serverId}'. Known servers: ${preview}${serverIds.length > 20 ? "..." : ""}`, { serverId, errorKind: "unknown_server" }, true);
|
|
2686
|
+
}
|
|
2687
|
+
recordInstallDecision(serverId, decision);
|
|
2688
|
+
return text(`Recorded install decision for '${serverId}': ${decision}. ${decisionFollowUp(decision)}`, {
|
|
2689
|
+
serverId,
|
|
2690
|
+
decision
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2693
|
+
function decisionFollowUp(decision) {
|
|
2694
|
+
return decision === "declined" ? "Future LSP lookups for this server stay quiet; proceed without LSP." : "Future LSP lookups keep install instructions without asking the user.";
|
|
2695
|
+
}
|
|
2696
|
+
async function executeLspGotoDefinition(params, signal) {
|
|
2697
|
+
const filePath = requireString(params, "filePath");
|
|
2698
|
+
const line = requireNumber(params, "line");
|
|
2699
|
+
const character = requireNumber(params, "character");
|
|
2700
|
+
try {
|
|
2701
|
+
const result = await withLspClient(filePath, async (client) => client.definition(filePath, line, character), "definition", clientOptions(signal));
|
|
2702
|
+
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
2703
|
+
const details = { filePath, line, character, locations };
|
|
2704
|
+
if (locations.length === 0)
|
|
2705
|
+
return text("No definition found", details);
|
|
2706
|
+
return text(locations.map(formatLocation).join(`
|
|
2707
|
+
`), details);
|
|
2708
|
+
} catch (error) {
|
|
2709
|
+
const missingDependency = missingDependencyResult(error, {
|
|
2710
|
+
filePath,
|
|
2711
|
+
line,
|
|
2712
|
+
character,
|
|
2713
|
+
locations: []
|
|
2714
|
+
});
|
|
2715
|
+
if (missingDependency)
|
|
2716
|
+
return missingDependency;
|
|
2717
|
+
throw error;
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
async function executeLspFindReferences(params, signal) {
|
|
2721
|
+
const filePath = requireString(params, "filePath");
|
|
2722
|
+
const line = requireNumber(params, "line");
|
|
2723
|
+
const character = requireNumber(params, "character");
|
|
2724
|
+
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
2725
|
+
try {
|
|
2726
|
+
const result = await withLspClient(filePath, async (client) => client.references(filePath, line, character, includeDeclaration), "references", clientOptions(signal));
|
|
2727
|
+
const references = Array.isArray(result) ? result : [];
|
|
2728
|
+
const total = references.length;
|
|
2729
|
+
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
2730
|
+
const limited = truncated ? references.slice(0, DEFAULT_MAX_REFERENCES) : references;
|
|
2731
|
+
const details = {
|
|
2732
|
+
filePath,
|
|
2733
|
+
line,
|
|
2734
|
+
character,
|
|
2735
|
+
references,
|
|
2736
|
+
totalReferences: total,
|
|
2737
|
+
truncated
|
|
2738
|
+
};
|
|
2739
|
+
if (total === 0)
|
|
2740
|
+
return text("No references found", details);
|
|
2741
|
+
const output = [
|
|
2742
|
+
...truncated ? [`Found ${total} references (showing first ${DEFAULT_MAX_REFERENCES}):`] : [],
|
|
2743
|
+
...limited.map(formatLocation)
|
|
2744
|
+
].join(`
|
|
2745
|
+
`);
|
|
2746
|
+
return text(output, details);
|
|
2747
|
+
} catch (error) {
|
|
2748
|
+
const missingDependency = missingDependencyResult(error, {
|
|
2749
|
+
filePath,
|
|
2750
|
+
line,
|
|
2751
|
+
character,
|
|
2752
|
+
references: [],
|
|
2753
|
+
totalReferences: 0,
|
|
2754
|
+
truncated: false
|
|
2755
|
+
});
|
|
2756
|
+
if (missingDependency)
|
|
2757
|
+
return missingDependency;
|
|
2758
|
+
throw error;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
function errorMessage2(error) {
|
|
2762
|
+
return error instanceof Error ? error.message : String(error);
|
|
2763
|
+
}
|
|
2764
|
+
function isPathInsideWorkspace(filePath, workspaceRoot) {
|
|
2765
|
+
const relativePath = relative(workspaceRoot, filePath);
|
|
2766
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute3(relativePath);
|
|
2767
|
+
}
|
|
2768
|
+
function realpathForValidation(filePath) {
|
|
2769
|
+
if (existsSync8(filePath))
|
|
2770
|
+
return realpathSync(filePath);
|
|
2771
|
+
const parent = dirname5(filePath);
|
|
2772
|
+
return resolve5(realpathSync(parent), relative(parent, filePath));
|
|
2773
|
+
}
|
|
2774
|
+
function uriToWorkspacePath(uri, workspaceRoot) {
|
|
2775
|
+
let filePath;
|
|
2776
|
+
try {
|
|
2777
|
+
filePath = fileURLToPath3(uri);
|
|
2778
|
+
} catch (error) {
|
|
2779
|
+
return { success: false, error: `non-file URI ${uri}: ${errorMessage2(error)}` };
|
|
2780
|
+
}
|
|
2781
|
+
let validatedPath;
|
|
2782
|
+
try {
|
|
2783
|
+
validatedPath = realpathForValidation(filePath);
|
|
2784
|
+
} catch (error) {
|
|
2785
|
+
return { success: false, error: `${filePath}: ${errorMessage2(error)}` };
|
|
2786
|
+
}
|
|
2787
|
+
if (!isPathInsideWorkspace(validatedPath, workspaceRoot)) {
|
|
2788
|
+
return { success: false, error: `${filePath}: outside workspace ${workspaceRoot}` };
|
|
2789
|
+
}
|
|
2790
|
+
return { success: true, path: filePath };
|
|
2791
|
+
}
|
|
2792
|
+
function applyTextEditsToFile(filePath, edits) {
|
|
2793
|
+
try {
|
|
2794
|
+
const content = readFileSync5(filePath, "utf-8");
|
|
2795
|
+
const lines = content.split(`
|
|
2796
|
+
`);
|
|
2797
|
+
const sortedEdits = [...edits].sort((a, b) => {
|
|
2798
|
+
if (b.range.start.line !== a.range.start.line) {
|
|
2799
|
+
return b.range.start.line - a.range.start.line;
|
|
2800
|
+
}
|
|
2801
|
+
return b.range.start.character - a.range.start.character;
|
|
2802
|
+
});
|
|
2803
|
+
for (const edit of sortedEdits) {
|
|
2804
|
+
const startLine = edit.range.start.line;
|
|
2805
|
+
const startChar = edit.range.start.character;
|
|
2806
|
+
const endLine = edit.range.end.line;
|
|
2807
|
+
const endChar = edit.range.end.character;
|
|
2808
|
+
if (startLine === endLine) {
|
|
2809
|
+
const line = lines[startLine] ?? "";
|
|
2810
|
+
lines[startLine] = line.substring(0, startChar) + edit.newText + line.substring(endChar);
|
|
2811
|
+
} else {
|
|
2812
|
+
const firstLine = lines[startLine] ?? "";
|
|
2813
|
+
const lastLine = lines[endLine] ?? "";
|
|
2814
|
+
const newContent = firstLine.substring(0, startChar) + edit.newText + lastLine.substring(endChar);
|
|
2815
|
+
lines.splice(startLine, endLine - startLine + 1, ...newContent.split(`
|
|
2816
|
+
`));
|
|
2817
|
+
}
|
|
13
2818
|
}
|
|
14
|
-
|
|
15
|
-
|
|
2819
|
+
writeFileSync2(filePath, lines.join(`
|
|
2820
|
+
`), "utf-8");
|
|
2821
|
+
return { success: true, editCount: edits.length };
|
|
2822
|
+
} catch (err) {
|
|
2823
|
+
return {
|
|
2824
|
+
success: false,
|
|
2825
|
+
editCount: 0,
|
|
2826
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
function applyWorkspaceEdit(edit, options = {}) {
|
|
2831
|
+
if (!edit) {
|
|
2832
|
+
return { success: false, filesModified: [], totalEdits: 0, errors: ["No edit provided"] };
|
|
2833
|
+
}
|
|
2834
|
+
const result = { success: true, filesModified: [], totalEdits: 0, errors: [] };
|
|
2835
|
+
const workspaceRoot = realpathSync(options.workspaceRoot ?? contextCwd());
|
|
2836
|
+
if (edit.changes) {
|
|
2837
|
+
for (const [uri, edits] of Object.entries(edit.changes)) {
|
|
2838
|
+
const validatedPath = uriToWorkspacePath(uri, workspaceRoot);
|
|
2839
|
+
if (!validatedPath.success) {
|
|
2840
|
+
result.success = false;
|
|
2841
|
+
result.errors.push(validatedPath.error);
|
|
2842
|
+
continue;
|
|
2843
|
+
}
|
|
2844
|
+
const applyResult = applyTextEditsToFile(validatedPath.path, edits);
|
|
2845
|
+
if (applyResult.success) {
|
|
2846
|
+
result.filesModified.push(validatedPath.path);
|
|
2847
|
+
result.totalEdits += applyResult.editCount;
|
|
2848
|
+
} else {
|
|
2849
|
+
result.success = false;
|
|
2850
|
+
result.errors.push(`${validatedPath.path}: ${applyResult.error}`);
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
if (edit.documentChanges) {
|
|
2855
|
+
for (const change of edit.documentChanges) {
|
|
2856
|
+
if (!("kind" in change)) {
|
|
2857
|
+
const validatedPath = uriToWorkspacePath(change.textDocument.uri, workspaceRoot);
|
|
2858
|
+
if (!validatedPath.success) {
|
|
2859
|
+
result.success = false;
|
|
2860
|
+
result.errors.push(validatedPath.error);
|
|
2861
|
+
continue;
|
|
2862
|
+
}
|
|
2863
|
+
const applyResult = applyTextEditsToFile(validatedPath.path, change.edits);
|
|
2864
|
+
if (applyResult.success) {
|
|
2865
|
+
result.filesModified.push(validatedPath.path);
|
|
2866
|
+
result.totalEdits += applyResult.editCount;
|
|
2867
|
+
} else {
|
|
2868
|
+
result.success = false;
|
|
2869
|
+
result.errors.push(`${validatedPath.path}: ${applyResult.error}`);
|
|
2870
|
+
}
|
|
2871
|
+
continue;
|
|
2872
|
+
}
|
|
2873
|
+
if (change.kind === "create") {
|
|
2874
|
+
try {
|
|
2875
|
+
const validatedPath = uriToWorkspacePath(change.uri, workspaceRoot);
|
|
2876
|
+
if (!validatedPath.success) {
|
|
2877
|
+
result.success = false;
|
|
2878
|
+
result.errors.push(`Create ${change.uri}: ${validatedPath.error}`);
|
|
2879
|
+
continue;
|
|
2880
|
+
}
|
|
2881
|
+
writeFileSync2(validatedPath.path, "", "utf-8");
|
|
2882
|
+
result.filesModified.push(validatedPath.path);
|
|
2883
|
+
} catch (err) {
|
|
2884
|
+
result.success = false;
|
|
2885
|
+
result.errors.push(`Create ${change.uri}: ${String(err)}`);
|
|
2886
|
+
}
|
|
2887
|
+
} else if (change.kind === "rename") {
|
|
2888
|
+
try {
|
|
2889
|
+
const oldPath = uriToWorkspacePath(change.oldUri, workspaceRoot);
|
|
2890
|
+
const newPath = uriToWorkspacePath(change.newUri, workspaceRoot);
|
|
2891
|
+
if (!oldPath.success || !newPath.success) {
|
|
2892
|
+
const error = oldPath.success ? newPath.success ? "invalid URI" : newPath.error : oldPath.error;
|
|
2893
|
+
result.success = false;
|
|
2894
|
+
result.errors.push(`Rename ${change.oldUri}: ${error}`);
|
|
2895
|
+
continue;
|
|
2896
|
+
}
|
|
2897
|
+
const content = readFileSync5(oldPath.path, "utf-8");
|
|
2898
|
+
writeFileSync2(newPath.path, content, "utf-8");
|
|
2899
|
+
unlinkSync2(oldPath.path);
|
|
2900
|
+
result.filesModified.push(newPath.path);
|
|
2901
|
+
} catch (err) {
|
|
2902
|
+
result.success = false;
|
|
2903
|
+
result.errors.push(`Rename ${change.oldUri}: ${String(err)}`);
|
|
2904
|
+
}
|
|
2905
|
+
} else if (change.kind === "delete") {
|
|
2906
|
+
try {
|
|
2907
|
+
const validatedPath = uriToWorkspacePath(change.uri, workspaceRoot);
|
|
2908
|
+
if (!validatedPath.success) {
|
|
2909
|
+
result.success = false;
|
|
2910
|
+
result.errors.push(`Delete ${change.uri}: ${validatedPath.error}`);
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
unlinkSync2(validatedPath.path);
|
|
2914
|
+
result.filesModified.push(validatedPath.path);
|
|
2915
|
+
} catch (err) {
|
|
2916
|
+
result.success = false;
|
|
2917
|
+
result.errors.push(`Delete ${change.uri}: ${String(err)}`);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
return result;
|
|
2923
|
+
}
|
|
2924
|
+
async function executeLspPrepareRename(params, signal) {
|
|
2925
|
+
const filePath = requireString(params, "filePath");
|
|
2926
|
+
const line = requireNumber(params, "line");
|
|
2927
|
+
const character = requireNumber(params, "character");
|
|
2928
|
+
try {
|
|
2929
|
+
const result = await withLspClient(filePath, async (client) => client.prepareRename(filePath, line, character), "prepareRename", clientOptions(signal));
|
|
2930
|
+
const details = { filePath, line, character, result };
|
|
2931
|
+
return text(formatPrepareRenameResult(result), details);
|
|
2932
|
+
} catch (error) {
|
|
2933
|
+
const missingDependency = missingDependencyResult(error, {
|
|
2934
|
+
filePath,
|
|
2935
|
+
line,
|
|
2936
|
+
character,
|
|
2937
|
+
result: null
|
|
2938
|
+
});
|
|
2939
|
+
if (missingDependency)
|
|
2940
|
+
return missingDependency;
|
|
2941
|
+
throw error;
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
async function executeLspRename(params, signal) {
|
|
2945
|
+
const filePath = requireString(params, "filePath");
|
|
2946
|
+
const line = requireNumber(params, "line");
|
|
2947
|
+
const character = requireNumber(params, "character");
|
|
2948
|
+
const newName = requireString(params, "newName");
|
|
2949
|
+
try {
|
|
2950
|
+
const edit = await withLspClient(filePath, async (client, workspaceRoot) => ({
|
|
2951
|
+
edit: await client.rename(filePath, line, character, newName),
|
|
2952
|
+
workspaceRoot
|
|
2953
|
+
}), "rename", clientOptions(signal));
|
|
2954
|
+
const apply = applyWorkspaceEdit(edit.edit, { workspaceRoot: edit.workspaceRoot });
|
|
2955
|
+
const details = { filePath, line, character, newName, apply, edit: edit.edit };
|
|
2956
|
+
return text(formatApplyResult(apply), details, !apply.success);
|
|
2957
|
+
} catch (error) {
|
|
2958
|
+
const missingDependency = missingDependencyResult(error, {
|
|
2959
|
+
filePath,
|
|
2960
|
+
line,
|
|
2961
|
+
character,
|
|
2962
|
+
newName,
|
|
2963
|
+
apply: null,
|
|
2964
|
+
edit: null
|
|
2965
|
+
});
|
|
2966
|
+
if (missingDependency)
|
|
2967
|
+
return missingDependency;
|
|
2968
|
+
throw error;
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
function objectSchema(properties, required = []) {
|
|
2972
|
+
return {
|
|
2973
|
+
type: "object",
|
|
2974
|
+
properties,
|
|
2975
|
+
required
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
async function executeLspStatus() {
|
|
2979
|
+
const servers = getAllServers();
|
|
2980
|
+
const snapshots = getLspManager().getSnapshot();
|
|
2981
|
+
const installed = servers.filter((server2) => server2.installed && !server2.disabled);
|
|
2982
|
+
const configuredLines = servers.map((server2) => {
|
|
2983
|
+
const state = server2.disabled ? "disabled" : server2.installed ? "installed" : "missing";
|
|
2984
|
+
return `- ${server2.id}: ${state}; source=${server2.source}; extensions=${server2.extensions.join(", ")}`;
|
|
2985
|
+
});
|
|
2986
|
+
const activeLines = snapshots.map((snapshot) => {
|
|
2987
|
+
const state = snapshot.alive ? snapshot.isInitializing ? "initializing" : "alive" : "dead";
|
|
2988
|
+
return `- ${snapshot.serverId}: ${state}; root=${snapshot.root}; refs=${snapshot.refCount}`;
|
|
2989
|
+
});
|
|
2990
|
+
const lines = [
|
|
2991
|
+
`Configured LSP servers: ${servers.length}`,
|
|
2992
|
+
`Installed LSP servers: ${installed.length}`,
|
|
2993
|
+
"",
|
|
2994
|
+
...configuredLines,
|
|
2995
|
+
"",
|
|
2996
|
+
`Active LSP clients: ${snapshots.length}`,
|
|
2997
|
+
...activeLines
|
|
2998
|
+
];
|
|
2999
|
+
return text(lines.join(`
|
|
3000
|
+
`), { servers, snapshots });
|
|
3001
|
+
}
|
|
3002
|
+
function isDocumentSymbol(symbol) {
|
|
3003
|
+
return "range" in symbol;
|
|
3004
|
+
}
|
|
3005
|
+
async function executeLspSymbols(params, signal) {
|
|
3006
|
+
const filePath = requireString(params, "filePath");
|
|
3007
|
+
const rawScope = optionalString(params, "scope") ?? "document";
|
|
3008
|
+
const scope = rawScope === "workspace" ? "workspace" : "document";
|
|
3009
|
+
const limit = Math.min(optionalNumber(params, "limit") ?? DEFAULT_MAX_SYMBOLS, DEFAULT_MAX_SYMBOLS);
|
|
3010
|
+
try {
|
|
3011
|
+
if (scope === "workspace") {
|
|
3012
|
+
const query = optionalString(params, "query");
|
|
3013
|
+
if (!query) {
|
|
3014
|
+
const message = "Error: 'query' is required for workspace scope";
|
|
3015
|
+
return text(message, {
|
|
3016
|
+
filePath,
|
|
3017
|
+
scope,
|
|
3018
|
+
symbols: [],
|
|
3019
|
+
totalSymbols: 0,
|
|
3020
|
+
truncated: false,
|
|
3021
|
+
error: message,
|
|
3022
|
+
errorKind: "missing_query"
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query), "workspaceSymbols", clientOptions(signal));
|
|
3026
|
+
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
3027
|
+
}
|
|
3028
|
+
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(filePath), "documentSymbols", clientOptions(signal));
|
|
3029
|
+
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
3030
|
+
} catch (error) {
|
|
3031
|
+
const query = optionalString(params, "query");
|
|
3032
|
+
const missingDependency = missingDependencyResult(error, {
|
|
3033
|
+
filePath,
|
|
3034
|
+
scope,
|
|
3035
|
+
symbols: [],
|
|
3036
|
+
totalSymbols: 0,
|
|
3037
|
+
truncated: false,
|
|
3038
|
+
...query === undefined ? {} : { query }
|
|
3039
|
+
});
|
|
3040
|
+
if (missingDependency)
|
|
3041
|
+
return missingDependency;
|
|
3042
|
+
throw error;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
function formatSymbolsResult(filePath, scope, symbols, limit, query) {
|
|
3046
|
+
const total = symbols.length;
|
|
3047
|
+
const truncated = total > limit;
|
|
3048
|
+
const limited = truncated ? symbols.slice(0, limit) : symbols;
|
|
3049
|
+
const details = {
|
|
3050
|
+
filePath,
|
|
3051
|
+
scope,
|
|
3052
|
+
symbols,
|
|
3053
|
+
totalSymbols: total,
|
|
3054
|
+
truncated,
|
|
3055
|
+
...query === undefined ? {} : { query }
|
|
3056
|
+
};
|
|
3057
|
+
if (total === 0)
|
|
3058
|
+
return text("No symbols found", details);
|
|
3059
|
+
const lines = [];
|
|
3060
|
+
if (truncated)
|
|
3061
|
+
lines.push(`Found ${total} symbols (showing first ${limit}):`);
|
|
3062
|
+
const documentSymbols = limited.filter(isDocumentSymbol);
|
|
3063
|
+
if (documentSymbols.length === limited.length) {
|
|
3064
|
+
lines.push(...documentSymbols.map((symbol) => formatDocumentSymbol(symbol)));
|
|
3065
|
+
} else {
|
|
3066
|
+
lines.push(...limited.filter((symbol) => !isDocumentSymbol(symbol)).map(formatSymbolInfo));
|
|
3067
|
+
}
|
|
3068
|
+
return text(lines.join(`
|
|
3069
|
+
`), details);
|
|
3070
|
+
}
|
|
3071
|
+
var LSP_MCP_TOOLS = [
|
|
3072
|
+
{
|
|
3073
|
+
name: "status",
|
|
3074
|
+
aliases: ["lsp_status"],
|
|
3075
|
+
title: "LSP Status",
|
|
3076
|
+
description: "List configured and active LSP servers without starting a new language server.",
|
|
3077
|
+
inputSchema: objectSchema({}),
|
|
3078
|
+
execute: executeLspStatus
|
|
3079
|
+
},
|
|
3080
|
+
{
|
|
3081
|
+
name: "diagnostics",
|
|
3082
|
+
aliases: ["lsp_diagnostics"],
|
|
3083
|
+
title: "LSP Diagnostics",
|
|
3084
|
+
description: "Get errors, warnings, and hints for a source file or directory.",
|
|
3085
|
+
inputSchema: objectSchema({
|
|
3086
|
+
filePath: { type: "string", description: "File or directory path to check." },
|
|
3087
|
+
severity: {
|
|
3088
|
+
type: "string",
|
|
3089
|
+
enum: ["error", "warning", "information", "hint", "all"],
|
|
3090
|
+
description: "Severity filter. Defaults to all."
|
|
3091
|
+
}
|
|
3092
|
+
}, ["filePath"]),
|
|
3093
|
+
execute: executeLspDiagnostics
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
name: "goto_definition",
|
|
3097
|
+
aliases: ["lsp_goto_definition"],
|
|
3098
|
+
title: "LSP Goto Definition",
|
|
3099
|
+
description: "Find where a symbol is defined.",
|
|
3100
|
+
inputSchema: objectSchema({
|
|
3101
|
+
filePath: { type: "string", description: "Source file containing the symbol." },
|
|
3102
|
+
line: { type: "number", description: "1-based line number." },
|
|
3103
|
+
character: { type: "number", description: "0-based column." }
|
|
3104
|
+
}, ["filePath", "line", "character"]),
|
|
3105
|
+
execute: executeLspGotoDefinition
|
|
3106
|
+
},
|
|
3107
|
+
{
|
|
3108
|
+
name: "find_references",
|
|
3109
|
+
aliases: ["lsp_find_references"],
|
|
3110
|
+
title: "LSP Find References",
|
|
3111
|
+
description: "Find references of a symbol across the workspace.",
|
|
3112
|
+
inputSchema: objectSchema({
|
|
3113
|
+
filePath: { type: "string", description: "Source file containing the symbol." },
|
|
3114
|
+
line: { type: "number", description: "1-based line number." },
|
|
3115
|
+
character: { type: "number", description: "0-based column." },
|
|
3116
|
+
includeDeclaration: { type: "boolean", description: "Include the declaration. Defaults to true." }
|
|
3117
|
+
}, ["filePath", "line", "character"]),
|
|
3118
|
+
execute: executeLspFindReferences
|
|
3119
|
+
},
|
|
3120
|
+
{
|
|
3121
|
+
name: "symbols",
|
|
3122
|
+
aliases: ["lsp_symbols"],
|
|
3123
|
+
title: "LSP Symbols",
|
|
3124
|
+
description: "List document symbols or search workspace symbols.",
|
|
3125
|
+
inputSchema: objectSchema({
|
|
3126
|
+
filePath: { type: "string", description: "File path used as LSP context." },
|
|
3127
|
+
scope: {
|
|
3128
|
+
type: "string",
|
|
3129
|
+
enum: ["document", "workspace"],
|
|
3130
|
+
description: "Use document for file outline or workspace for project-wide search."
|
|
3131
|
+
},
|
|
3132
|
+
query: { type: "string", description: "Workspace symbol query." },
|
|
3133
|
+
limit: { type: "number", description: "Maximum number of symbols to return." }
|
|
3134
|
+
}, ["filePath", "scope"]),
|
|
3135
|
+
execute: executeLspSymbols
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
name: "prepare_rename",
|
|
3139
|
+
aliases: ["lsp_prepare_rename"],
|
|
3140
|
+
title: "LSP Prepare Rename",
|
|
3141
|
+
description: "Check whether a symbol can be renamed at a position.",
|
|
3142
|
+
inputSchema: objectSchema({
|
|
3143
|
+
filePath: { type: "string", description: "Source file path." },
|
|
3144
|
+
line: { type: "number", description: "1-based line number." },
|
|
3145
|
+
character: { type: "number", description: "0-based column." }
|
|
3146
|
+
}, ["filePath", "line", "character"]),
|
|
3147
|
+
execute: executeLspPrepareRename
|
|
3148
|
+
},
|
|
3149
|
+
{
|
|
3150
|
+
name: "rename",
|
|
3151
|
+
aliases: ["lsp_rename"],
|
|
3152
|
+
title: "LSP Rename",
|
|
3153
|
+
description: "Rename a symbol across the workspace and apply the returned workspace edit.",
|
|
3154
|
+
inputSchema: objectSchema({
|
|
3155
|
+
filePath: { type: "string", description: "Source file path." },
|
|
3156
|
+
line: { type: "number", description: "1-based line number." },
|
|
3157
|
+
character: { type: "number", description: "0-based column." },
|
|
3158
|
+
newName: { type: "string", description: "New symbol name." }
|
|
3159
|
+
}, ["filePath", "line", "character", "newName"]),
|
|
3160
|
+
execute: executeLspRename
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
name: "install_decision",
|
|
3164
|
+
aliases: ["lsp_install_decision"],
|
|
3165
|
+
title: "LSP Install Decision",
|
|
3166
|
+
description: "Record whether the user allowed or declined installing a missing LSP server. Record 'declined' when the user declines, or has not explicitly asked for LSP installation, to silence future prompts.",
|
|
3167
|
+
inputSchema: objectSchema({
|
|
3168
|
+
server_id: {
|
|
3169
|
+
type: "string",
|
|
3170
|
+
description: "The LSP server id from the not-installed message (e.g. 'rust')."
|
|
3171
|
+
},
|
|
3172
|
+
decision: {
|
|
3173
|
+
type: "string",
|
|
3174
|
+
enum: ["declined", "allowed"],
|
|
3175
|
+
description: "'declined' silences future prompts; 'allowed' pre-authorizes installation."
|
|
3176
|
+
}
|
|
3177
|
+
}, ["server_id", "decision"]),
|
|
3178
|
+
execute: executeLspInstallDecision
|
|
3179
|
+
}
|
|
3180
|
+
];
|
|
3181
|
+
var CONTEXT_KEY = "_context";
|
|
3182
|
+
function encodeJsonLine(message) {
|
|
3183
|
+
return `${JSON.stringify(message)}
|
|
3184
|
+
`;
|
|
3185
|
+
}
|
|
3186
|
+
function createLineDecoder(onMessage, onParseError) {
|
|
3187
|
+
let buffer = "";
|
|
3188
|
+
return {
|
|
3189
|
+
push(chunk) {
|
|
3190
|
+
buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
3191
|
+
let index = buffer.indexOf(`
|
|
3192
|
+
`);
|
|
3193
|
+
while (index !== -1) {
|
|
3194
|
+
const raw = buffer.slice(0, index).trim();
|
|
3195
|
+
buffer = buffer.slice(index + 1);
|
|
3196
|
+
if (raw.length > 0) {
|
|
3197
|
+
try {
|
|
3198
|
+
onMessage(JSON.parse(raw));
|
|
3199
|
+
} catch (error) {
|
|
3200
|
+
onParseError?.(raw, error);
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
index = buffer.indexOf(`
|
|
3204
|
+
`);
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
3210
|
+
var REQUEST_ID = 1;
|
|
3211
|
+
|
|
3212
|
+
class DaemonRequestError extends Error {
|
|
3213
|
+
requestWritten;
|
|
3214
|
+
constructor(message, requestWritten) {
|
|
3215
|
+
super(message);
|
|
3216
|
+
this.name = "DaemonRequestError";
|
|
3217
|
+
this.requestWritten = requestWritten;
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
async function callToolViaDaemon(name, args, options = {}) {
|
|
3221
|
+
const paths = options.paths ?? daemonPaths();
|
|
3222
|
+
const ensure = options.ensure ?? ensureDaemonRunning;
|
|
3223
|
+
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
3224
|
+
const requestArgs = withContext(args, options.context);
|
|
3225
|
+
let lastError;
|
|
3226
|
+
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
3227
|
+
try {
|
|
3228
|
+
await ensure(paths);
|
|
3229
|
+
return await sendToolCall(paths.socket, name, requestArgs, timeoutMs);
|
|
3230
|
+
} catch (error) {
|
|
3231
|
+
lastError = error;
|
|
3232
|
+
if (error instanceof DaemonRequestError && error.requestWritten)
|
|
3233
|
+
break;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
return daemonUnreachableResult(paths, lastError);
|
|
3237
|
+
}
|
|
3238
|
+
function callDiagnosticsViaDaemon(filePath, options = {}) {
|
|
3239
|
+
return callToolViaDaemon("diagnostics", { filePath, severity: "error" }, options);
|
|
3240
|
+
}
|
|
3241
|
+
var FORWARDED_ENV_KEYS = [
|
|
3242
|
+
"LSP_TOOLS_MCP_PROJECT_CONFIG",
|
|
3243
|
+
"LSP_TOOLS_MCP_USER_CONFIG",
|
|
3244
|
+
"LSP_TOOLS_MCP_INSTALL_DECISIONS"
|
|
3245
|
+
];
|
|
3246
|
+
function currentRequestContext(env = process.env) {
|
|
3247
|
+
const forwarded = {};
|
|
3248
|
+
for (const key of FORWARDED_ENV_KEYS) {
|
|
3249
|
+
const value = env[key];
|
|
3250
|
+
if (value !== undefined)
|
|
3251
|
+
forwarded[key] = value;
|
|
3252
|
+
}
|
|
3253
|
+
return { cwd: process.cwd(), env: forwarded };
|
|
3254
|
+
}
|
|
3255
|
+
function withContext(args, context) {
|
|
3256
|
+
if (!context || context.cwd === undefined && context.env === undefined)
|
|
3257
|
+
return args;
|
|
3258
|
+
return { ...args, [CONTEXT_KEY]: context };
|
|
3259
|
+
}
|
|
3260
|
+
function daemonUnreachableResult(paths, error) {
|
|
3261
|
+
const text2 = [
|
|
3262
|
+
`LSP daemon unreachable: ${errorText(error)}.`,
|
|
3263
|
+
"The MCP server is a thin proxy and never runs language servers in-process.",
|
|
3264
|
+
`Socket: ${paths.socket}`,
|
|
3265
|
+
`Logs: ${paths.log}`,
|
|
3266
|
+
"The daemon is auto-started on demand and will be retried on the next request."
|
|
3267
|
+
].join(`
|
|
3268
|
+
`);
|
|
3269
|
+
return { content: [{ type: "text", text: text2 }], isError: true };
|
|
3270
|
+
}
|
|
3271
|
+
function sendToolCall(socketPath, name, args, timeoutMs) {
|
|
3272
|
+
return new Promise((resolve6, reject) => {
|
|
3273
|
+
const socket = connect2(socketPath);
|
|
3274
|
+
let settled = false;
|
|
3275
|
+
let requestWritten = false;
|
|
3276
|
+
const finish = (run) => {
|
|
3277
|
+
if (settled)
|
|
16
3278
|
return;
|
|
3279
|
+
settled = true;
|
|
3280
|
+
clearTimeout(timer);
|
|
3281
|
+
socket.destroy();
|
|
3282
|
+
run();
|
|
3283
|
+
};
|
|
3284
|
+
const timer = setTimeout(() => finish(() => reject(new DaemonRequestError("daemon request timed out", requestWritten))), timeoutMs);
|
|
3285
|
+
timer.unref();
|
|
3286
|
+
const decoder = createLineDecoder((message) => {
|
|
3287
|
+
const result = toToolResult(message);
|
|
3288
|
+
if (result)
|
|
3289
|
+
finish(() => resolve6(result));
|
|
3290
|
+
else
|
|
3291
|
+
finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
|
|
3292
|
+
});
|
|
3293
|
+
socket.once("connect", () => {
|
|
3294
|
+
requestWritten = true;
|
|
3295
|
+
socket.write(encodeJsonLine({ jsonrpc: "2.0", id: REQUEST_ID, method: "tools/call", params: { name, arguments: args } }));
|
|
3296
|
+
});
|
|
3297
|
+
socket.on("data", (chunk) => decoder.push(chunk));
|
|
3298
|
+
socket.once("error", (error) => finish(() => reject(new DaemonRequestError(error.message, requestWritten))));
|
|
3299
|
+
socket.once("close", () => finish(() => reject(new DaemonRequestError("daemon connection closed", requestWritten))));
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
function toToolResult(message) {
|
|
3303
|
+
if (!isRecord6(message) || message["id"] !== REQUEST_ID)
|
|
3304
|
+
return null;
|
|
3305
|
+
const result = message["result"];
|
|
3306
|
+
if (!isRecord6(result) || !Array.isArray(result["content"]))
|
|
3307
|
+
return null;
|
|
3308
|
+
return {
|
|
3309
|
+
content: result["content"],
|
|
3310
|
+
isError: result["isError"] === true,
|
|
3311
|
+
details: result["details"]
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
function isRecord6(value) {
|
|
3315
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3316
|
+
}
|
|
3317
|
+
function errorText(error) {
|
|
3318
|
+
return error instanceof Error ? error.message : String(error);
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
// components/lsp/src/codex-hook.ts
|
|
3322
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
3323
|
+
|
|
3324
|
+
// components/lsp/src/lsp-session-state.ts
|
|
3325
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
3326
|
+
import { homedir as homedir4 } from "node:os";
|
|
3327
|
+
import { dirname as dirname6, extname as extname2, join as join9 } from "node:path";
|
|
3328
|
+
function sessionIdFrom(input) {
|
|
3329
|
+
return typeof input.session_id === "string" && input.session_id.length > 0 ? input.session_id : undefined;
|
|
3330
|
+
}
|
|
3331
|
+
function shouldSkipUnavailableLspDiagnostics(filePath, sessionId) {
|
|
3332
|
+
if (sessionId === undefined)
|
|
3333
|
+
return false;
|
|
3334
|
+
const state = readSessionState(sessionStatePath(sessionId));
|
|
3335
|
+
const extension = extensionKey(filePath);
|
|
3336
|
+
return extension !== undefined && state.postCompactProbePending !== true && state.unavailableExtensions.includes(extension);
|
|
3337
|
+
}
|
|
3338
|
+
function recordLspDiagnosticsObservations(sessionId, observations) {
|
|
3339
|
+
if (sessionId === undefined || observations.length === 0)
|
|
3340
|
+
return;
|
|
3341
|
+
const state = readSessionState(sessionStatePath(sessionId));
|
|
3342
|
+
const unavailableExtensions = new Set(state.unavailableExtensions);
|
|
3343
|
+
for (const observation of observations) {
|
|
3344
|
+
const extension = extensionKey(observation.filePath);
|
|
3345
|
+
if (extension === undefined)
|
|
3346
|
+
continue;
|
|
3347
|
+
if (observation.unavailable) {
|
|
3348
|
+
unavailableExtensions.add(extension);
|
|
3349
|
+
} else {
|
|
3350
|
+
unavailableExtensions.delete(extension);
|
|
17
3351
|
}
|
|
18
|
-
|
|
19
|
-
|
|
3352
|
+
}
|
|
3353
|
+
writeSessionState(sessionStatePath(sessionId), { unavailableExtensions: [...unavailableExtensions].sort() });
|
|
3354
|
+
}
|
|
3355
|
+
function markLspSessionCompacted(sessionId) {
|
|
3356
|
+
if (sessionId === undefined)
|
|
3357
|
+
return;
|
|
3358
|
+
const state = readSessionState(sessionStatePath(sessionId));
|
|
3359
|
+
if (state.unavailableExtensions.length === 0)
|
|
3360
|
+
return;
|
|
3361
|
+
writeSessionState(sessionStatePath(sessionId), {
|
|
3362
|
+
unavailableExtensions: state.unavailableExtensions,
|
|
3363
|
+
postCompactProbePending: true
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
function isUnavailableLspDiagnostics(diagnostics) {
|
|
3367
|
+
const normalized = diagnostics.trim();
|
|
3368
|
+
return normalized.includes("LSP request timeout (method: initialize)") || normalized.includes("LSP server is still initializing") || normalized.includes("NOT INSTALLED") || normalized.includes("Command not found:");
|
|
3369
|
+
}
|
|
3370
|
+
function isLspDaemonUnreachableDiagnostics(diagnostics) {
|
|
3371
|
+
return diagnostics.includes("LSP daemon unreachable");
|
|
3372
|
+
}
|
|
3373
|
+
function sessionStatePath(sessionId) {
|
|
3374
|
+
const root = process.env["PLUGIN_DATA"] ?? join9(homedir4(), ".codex", "codex-lsp");
|
|
3375
|
+
return join9(root, "sessions", `${safePathSegment(sessionId)}.json`);
|
|
3376
|
+
}
|
|
3377
|
+
function readSessionState(path) {
|
|
3378
|
+
try {
|
|
3379
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
3380
|
+
if (isLspSessionState(parsed))
|
|
3381
|
+
return parsed;
|
|
3382
|
+
return emptyState();
|
|
3383
|
+
} catch (error) {
|
|
3384
|
+
if (error instanceof SyntaxError || isRecord4(error) && error["code"] === "ENOENT")
|
|
3385
|
+
return emptyState();
|
|
3386
|
+
throw error;
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
function writeSessionState(path, state) {
|
|
3390
|
+
mkdirSync4(dirname6(path), { recursive: true });
|
|
3391
|
+
writeFileSync3(path, `${JSON.stringify(state)}
|
|
3392
|
+
`);
|
|
3393
|
+
}
|
|
3394
|
+
function emptyState() {
|
|
3395
|
+
return { unavailableExtensions: [] };
|
|
3396
|
+
}
|
|
3397
|
+
function extensionKey(filePath) {
|
|
3398
|
+
const extension = extname2(filePath).toLowerCase();
|
|
3399
|
+
return extension.length === 0 ? undefined : extension;
|
|
3400
|
+
}
|
|
3401
|
+
function safePathSegment(value) {
|
|
3402
|
+
return value.replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 120) || "unknown-session";
|
|
3403
|
+
}
|
|
3404
|
+
function isLspSessionState(value) {
|
|
3405
|
+
if (!isRecord4(value) || !Array.isArray(value["unavailableExtensions"]))
|
|
3406
|
+
return false;
|
|
3407
|
+
const postCompactProbePending = value["postCompactProbePending"];
|
|
3408
|
+
return value["unavailableExtensions"].every((item) => typeof item === "string") && (postCompactProbePending === undefined || typeof postCompactProbePending === "boolean");
|
|
3409
|
+
}
|
|
3410
|
+
function isRecord4(value) {
|
|
3411
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
// components/lsp/src/mutated-file-paths.ts
|
|
3415
|
+
var MUTATION_TOOL_NAMES = new Set(["apply_patch", "write", "edit", "multiedit", "multi_edit"]);
|
|
3416
|
+
function extractMutatedFilePaths(input) {
|
|
3417
|
+
if (!isMutationTool(input.tool_name))
|
|
3418
|
+
return [];
|
|
3419
|
+
if (isFailedToolResponse(input.tool_response))
|
|
3420
|
+
return [];
|
|
3421
|
+
const toolInput = isRecord7(input.tool_input) ? input.tool_input : {};
|
|
3422
|
+
const paths = new Set;
|
|
3423
|
+
addStringValue(paths, toolInput["path"]);
|
|
3424
|
+
addStringValue(paths, toolInput["filePath"]);
|
|
3425
|
+
addStringValue(paths, toolInput["file_path"]);
|
|
3426
|
+
addStringArray(paths, toolInput["paths"]);
|
|
3427
|
+
addStringArray(paths, toolInput["filePaths"]);
|
|
3428
|
+
addStringArray(paths, toolInput["file_paths"]);
|
|
3429
|
+
addPatchPayloads(paths, toolInput);
|
|
3430
|
+
addPatchFiles(paths, toolInput["files"]);
|
|
3431
|
+
addPatchFiles(paths, toolInput["changes"]);
|
|
3432
|
+
return [...paths];
|
|
3433
|
+
}
|
|
3434
|
+
function isMutationTool(value) {
|
|
3435
|
+
if (typeof value !== "string")
|
|
3436
|
+
return false;
|
|
3437
|
+
return MUTATION_TOOL_NAMES.has(value.toLowerCase());
|
|
3438
|
+
}
|
|
3439
|
+
function isFailedToolResponse(value) {
|
|
3440
|
+
if (!isRecord7(value))
|
|
3441
|
+
return false;
|
|
3442
|
+
return value["isError"] === true || value["is_error"] === true || value["error"] === true || value["status"] === "error";
|
|
3443
|
+
}
|
|
3444
|
+
function addStringValue(paths, value) {
|
|
3445
|
+
if (typeof value === "string" && value.length > 0) {
|
|
3446
|
+
paths.add(value);
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
function addStringArray(paths, value) {
|
|
3450
|
+
if (!Array.isArray(value))
|
|
3451
|
+
return;
|
|
3452
|
+
for (const item of value) {
|
|
3453
|
+
addStringValue(paths, item);
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
function addPatchPayloads(paths, input) {
|
|
3457
|
+
addPatchInput(paths, input["input"]);
|
|
3458
|
+
addPatchInput(paths, input["patch"]);
|
|
3459
|
+
addPatchInput(paths, input["command"]);
|
|
3460
|
+
}
|
|
3461
|
+
function addPatchInput(paths, value) {
|
|
3462
|
+
if (typeof value !== "string")
|
|
3463
|
+
return;
|
|
3464
|
+
for (const line of value.split(`
|
|
3465
|
+
`)) {
|
|
3466
|
+
const path = extractPatchHeaderPath(line);
|
|
3467
|
+
if (path !== undefined)
|
|
3468
|
+
paths.add(path);
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
function extractPatchHeaderPath(line) {
|
|
3472
|
+
const prefixes = ["*** Add File: ", "*** Update File: ", "*** Move to: "];
|
|
3473
|
+
for (const prefix of prefixes) {
|
|
3474
|
+
if (line.startsWith(prefix))
|
|
3475
|
+
return line.slice(prefix.length).trim();
|
|
3476
|
+
}
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
function addPatchFiles(paths, value) {
|
|
3480
|
+
if (!Array.isArray(value))
|
|
3481
|
+
return;
|
|
3482
|
+
for (const item of value) {
|
|
3483
|
+
if (!isRecord7(item))
|
|
3484
|
+
continue;
|
|
3485
|
+
addStringValue(paths, item["path"]);
|
|
3486
|
+
addStringValue(paths, item["filePath"]);
|
|
3487
|
+
addStringValue(paths, item["file_path"]);
|
|
3488
|
+
addStringValue(paths, item["movePath"]);
|
|
3489
|
+
addStringValue(paths, item["move_path"]);
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
function isRecord7(value) {
|
|
3493
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
// components/lsp/src/codex-hook.ts
|
|
3497
|
+
var CLEAN_DIAGNOSTICS_TEXT = "No diagnostics found";
|
|
3498
|
+
var UNSUPPORTED_EXTENSION_TEXT = "No LSP server configured for extension:";
|
|
3499
|
+
var DIAGNOSTIC_START_PATTERN = /(?:error|warning|information|hint)\[[^\]\r\n]+\] \(\d+\) at \d+:\d+:/g;
|
|
3500
|
+
var DIAGNOSTIC_CHUNK_PATTERN = /^(?:error|warning|information|hint)\[[^\]\r\n]+\] \(\d+\) at \d+:\d+:/;
|
|
3501
|
+
var DEFAULT_MAX_HOOK_FEEDBACK_CHARS = 8000;
|
|
3502
|
+
var CONTEXT_PRESSURE_MAX_HOOK_FEEDBACK_CHARS = 1200;
|
|
3503
|
+
var MAX_CONCURRENT_DIAGNOSTICS = 4;
|
|
3504
|
+
var CONTEXT_PRESSURE_MARKERS = [
|
|
3505
|
+
"context compacted",
|
|
3506
|
+
"context_length_exceeded",
|
|
3507
|
+
"skill descriptions were shortened",
|
|
3508
|
+
"context_too_large",
|
|
3509
|
+
"codex ran out of room in the model's context window",
|
|
3510
|
+
"your input exceeds the context window",
|
|
3511
|
+
"long threads and multiple compactions"
|
|
3512
|
+
];
|
|
3513
|
+
async function runLspDiagnosticsText(filePath) {
|
|
3514
|
+
const result = await callDiagnosticsViaDaemon(filePath, { context: currentRequestContext() });
|
|
3515
|
+
return result.content.map((block) => block.text).join(`
|
|
3516
|
+
`);
|
|
3517
|
+
}
|
|
3518
|
+
async function runLspPostToolUseHook(input, runDiagnostics = runLspDiagnosticsText) {
|
|
3519
|
+
const sessionId = sessionIdFrom(input);
|
|
3520
|
+
const filePaths = extractMutatedFilePaths(input).filter((filePath) => !shouldSkipUnavailableLspDiagnostics(filePath, sessionId));
|
|
3521
|
+
if (filePaths.length === 0)
|
|
3522
|
+
return "";
|
|
3523
|
+
const blocks = [];
|
|
3524
|
+
const observations = [];
|
|
3525
|
+
for (const { filePath, diagnostics } of await collectDiagnostics(filePaths, runDiagnostics)) {
|
|
3526
|
+
if (isLspDaemonUnreachableDiagnostics(diagnostics))
|
|
3527
|
+
continue;
|
|
3528
|
+
const unavailable = isUnavailableLspDiagnostics(diagnostics);
|
|
3529
|
+
observations.push({ filePath, unavailable });
|
|
3530
|
+
if (isCleanDiagnostics(diagnostics))
|
|
3531
|
+
continue;
|
|
3532
|
+
if (unavailable)
|
|
3533
|
+
continue;
|
|
3534
|
+
blocks.push({ filePath, diagnostics });
|
|
3535
|
+
}
|
|
3536
|
+
recordLspDiagnosticsObservations(sessionId, observations);
|
|
3537
|
+
if (blocks.length === 0)
|
|
3538
|
+
return "";
|
|
3539
|
+
const rawReason = blocks.map(formatDiagnosticBlock).join(`
|
|
3540
|
+
|
|
3541
|
+
`);
|
|
3542
|
+
const reason = limitHookText(rawReason, hookFeedbackLimit(input.transcript_path));
|
|
3543
|
+
const output = {
|
|
3544
|
+
decision: "block",
|
|
3545
|
+
reason,
|
|
3546
|
+
hookSpecificOutput: {
|
|
3547
|
+
hookEventName: "PostToolUse",
|
|
3548
|
+
additionalContext: reason
|
|
3549
|
+
}
|
|
3550
|
+
};
|
|
3551
|
+
return `${JSON.stringify(output)}
|
|
3552
|
+
`;
|
|
3553
|
+
}
|
|
3554
|
+
async function runLspPostCompactHook(input) {
|
|
3555
|
+
markLspSessionCompacted(sessionIdFrom(input));
|
|
3556
|
+
return "";
|
|
3557
|
+
}
|
|
3558
|
+
async function collectDiagnostics(filePaths, runDiagnostics) {
|
|
3559
|
+
const results = [];
|
|
3560
|
+
let nextIndex = 0;
|
|
3561
|
+
const workerCount = Math.min(MAX_CONCURRENT_DIAGNOSTICS, filePaths.length);
|
|
3562
|
+
async function worker() {
|
|
3563
|
+
for (;; ) {
|
|
3564
|
+
const index = nextIndex;
|
|
3565
|
+
nextIndex += 1;
|
|
3566
|
+
const filePath = filePaths[index];
|
|
3567
|
+
if (filePath === undefined)
|
|
20
3568
|
return;
|
|
3569
|
+
results[index] = { filePath, diagnostics: await collectFileDiagnostics(filePath, runDiagnostics) };
|
|
21
3570
|
}
|
|
22
|
-
|
|
23
|
-
|
|
3571
|
+
}
|
|
3572
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
3573
|
+
return results;
|
|
3574
|
+
}
|
|
3575
|
+
async function collectFileDiagnostics(filePath, runDiagnostics) {
|
|
3576
|
+
try {
|
|
3577
|
+
return (await runDiagnostics(filePath)).trim();
|
|
3578
|
+
} catch (error) {
|
|
3579
|
+
return formatDiagnosticsError(error);
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
function formatDiagnosticsError(error) {
|
|
3583
|
+
if (error instanceof Error) {
|
|
3584
|
+
const message = error.message.trim();
|
|
3585
|
+
if (message.length > 0)
|
|
3586
|
+
return message;
|
|
3587
|
+
}
|
|
3588
|
+
return String(error).trim();
|
|
3589
|
+
}
|
|
3590
|
+
function formatDiagnosticBlock({ filePath, diagnostics }) {
|
|
3591
|
+
return `LSP diagnostics after editing ${filePath}:
|
|
3592
|
+
|
|
3593
|
+
${formatDiagnosticsForDisplay(diagnostics)}`;
|
|
3594
|
+
}
|
|
3595
|
+
function formatDiagnosticsForDisplay(diagnostics) {
|
|
3596
|
+
const chunks = splitDiagnosticChunks(diagnostics);
|
|
3597
|
+
if (!chunks.some(isDiagnosticChunk))
|
|
3598
|
+
return chunks.join(`
|
|
3599
|
+
`).trim();
|
|
3600
|
+
return chunks.map(formatDiagnosticChunk).join(`
|
|
3601
|
+
`);
|
|
3602
|
+
}
|
|
3603
|
+
function splitDiagnosticChunks(diagnostics) {
|
|
3604
|
+
const normalized = diagnostics.replace(/\r\n/g, `
|
|
3605
|
+
`).replace(/\r/g, `
|
|
3606
|
+
`).trim();
|
|
3607
|
+
if (normalized.length === 0)
|
|
3608
|
+
return [];
|
|
3609
|
+
const matches = Array.from(normalized.matchAll(DIAGNOSTIC_START_PATTERN));
|
|
3610
|
+
const firstMatch = matches[0];
|
|
3611
|
+
if (firstMatch?.index === undefined)
|
|
3612
|
+
return [normalized];
|
|
3613
|
+
const chunks = [];
|
|
3614
|
+
const leadingText = normalized.slice(0, firstMatch.index).trim();
|
|
3615
|
+
if (leadingText.length > 0)
|
|
3616
|
+
chunks.push(leadingText);
|
|
3617
|
+
for (const [index, match] of matches.entries()) {
|
|
3618
|
+
if (match.index === undefined)
|
|
3619
|
+
continue;
|
|
3620
|
+
const nextMatch = matches[index + 1];
|
|
3621
|
+
const end = nextMatch?.index ?? normalized.length;
|
|
3622
|
+
const chunk = normalized.slice(match.index, end).trim();
|
|
3623
|
+
if (chunk.length > 0)
|
|
3624
|
+
chunks.push(chunk);
|
|
3625
|
+
}
|
|
3626
|
+
return chunks;
|
|
3627
|
+
}
|
|
3628
|
+
function formatDiagnosticChunk(chunk) {
|
|
3629
|
+
const lines = chunk.split(`
|
|
3630
|
+
`);
|
|
3631
|
+
const firstLine = lines[0];
|
|
3632
|
+
if (firstLine === undefined)
|
|
3633
|
+
return "";
|
|
3634
|
+
if (!isDiagnosticChunk(firstLine))
|
|
3635
|
+
return chunk;
|
|
3636
|
+
const followingLines = lines.slice(1).map((line) => ` ${line}`);
|
|
3637
|
+
return [`- ${firstLine}`, ...followingLines].join(`
|
|
3638
|
+
`);
|
|
3639
|
+
}
|
|
3640
|
+
function isDiagnosticChunk(chunk) {
|
|
3641
|
+
return DIAGNOSTIC_CHUNK_PATTERN.test(chunk);
|
|
3642
|
+
}
|
|
3643
|
+
function hookFeedbackLimit(transcriptPath) {
|
|
3644
|
+
return isContextPressureTranscript(transcriptPath) ? CONTEXT_PRESSURE_MAX_HOOK_FEEDBACK_CHARS : DEFAULT_MAX_HOOK_FEEDBACK_CHARS;
|
|
3645
|
+
}
|
|
3646
|
+
function isContextPressureTranscript(transcriptPath) {
|
|
3647
|
+
if (typeof transcriptPath !== "string")
|
|
3648
|
+
return false;
|
|
3649
|
+
try {
|
|
3650
|
+
return hasContextPressureMarker(readFileSync8(transcriptPath, "utf8"));
|
|
3651
|
+
} catch (error) {
|
|
3652
|
+
if (error instanceof Error)
|
|
3653
|
+
return false;
|
|
3654
|
+
throw error;
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
function hasContextPressureMarker(text2) {
|
|
3658
|
+
const normalizedText = text2.toLowerCase();
|
|
3659
|
+
return CONTEXT_PRESSURE_MARKERS.some((marker) => normalizedText.includes(marker));
|
|
3660
|
+
}
|
|
3661
|
+
function limitHookText(text2, maxChars) {
|
|
3662
|
+
if (text2.length <= maxChars)
|
|
3663
|
+
return text2;
|
|
3664
|
+
const marker = `
|
|
3665
|
+
|
|
3666
|
+
[Truncated hook output to ${maxChars} chars to avoid Codex context overflow.]`;
|
|
3667
|
+
if (marker.length >= maxChars)
|
|
3668
|
+
return marker.slice(0, maxChars);
|
|
3669
|
+
const head = text2.slice(0, maxChars - marker.length).replace(/[ \t\r\n]+$/, "");
|
|
3670
|
+
return `${head}${marker}`;
|
|
3671
|
+
}
|
|
3672
|
+
function isCleanDiagnostics(diagnostics) {
|
|
3673
|
+
return diagnostics.length === 0 || diagnostics === CLEAN_DIAGNOSTICS_TEXT || diagnostics.startsWith(UNSUPPORTED_EXTENSION_TEXT);
|
|
3674
|
+
}
|
|
3675
|
+
function isRecord9(value) {
|
|
3676
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
// components/lsp/src/codex-hook-cli.ts
|
|
3680
|
+
async function runPostToolUseHookCli(stdin = processStdin) {
|
|
3681
|
+
await runHookCli((input) => runLspPostToolUseHook(input), stdin);
|
|
3682
|
+
}
|
|
3683
|
+
async function runPostCompactHookCli(stdin = processStdin) {
|
|
3684
|
+
await runHookCli((input) => runLspPostCompactHook(input), stdin);
|
|
3685
|
+
}
|
|
3686
|
+
async function runHookCli(runHook, stdin) {
|
|
3687
|
+
try {
|
|
3688
|
+
const raw = await readStdin(stdin);
|
|
3689
|
+
if (!raw.trim())
|
|
3690
|
+
return;
|
|
3691
|
+
const parsed = JSON.parse(raw);
|
|
3692
|
+
const input = isRecord9(parsed) ? parsed : {};
|
|
3693
|
+
const output = await runHook(input);
|
|
3694
|
+
if (output)
|
|
3695
|
+
process.stdout.write(output);
|
|
3696
|
+
} catch {
|
|
3697
|
+
return;
|
|
3698
|
+
} finally {
|
|
3699
|
+
await disposeDefaultLspManager().catch(() => {
|
|
3700
|
+
return;
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
async function readStdin(stdin) {
|
|
3705
|
+
stdin.setEncoding("utf8");
|
|
3706
|
+
let raw = "";
|
|
3707
|
+
for await (const chunk of stdin) {
|
|
3708
|
+
raw += chunk;
|
|
3709
|
+
}
|
|
3710
|
+
return raw;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
// components/lsp/src/cli.ts
|
|
3714
|
+
var require2 = createRequire2(import.meta.url);
|
|
3715
|
+
var PACKAGE_LSP_MCP_CLI = "@code-yeongyu/lsp-daemon/dist/cli.js";
|
|
3716
|
+
async function main() {
|
|
3717
|
+
const [command = "mcp", subcommand = ""] = argv.slice(2);
|
|
3718
|
+
if (command === "hook" && subcommand === "post-tool-use") {
|
|
3719
|
+
await runPostToolUseHookCli();
|
|
3720
|
+
return;
|
|
3721
|
+
}
|
|
3722
|
+
if (command === "hook" && subcommand === "post-compact") {
|
|
3723
|
+
await runPostCompactHookCli();
|
|
3724
|
+
return;
|
|
3725
|
+
}
|
|
3726
|
+
if (command === "mcp") {
|
|
3727
|
+
await runPackageLspMcpCli();
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3730
|
+
stderr.write(`Usage: omo-lsp [mcp | hook post-tool-use | hook post-compact]
|
|
3731
|
+
`);
|
|
3732
|
+
process.exitCode = 2;
|
|
24
3733
|
}
|
|
25
3734
|
main().catch((error) => {
|
|
26
|
-
|
|
27
|
-
|
|
3735
|
+
stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}
|
|
3736
|
+
`);
|
|
3737
|
+
process.exitCode = 1;
|
|
28
3738
|
});
|
|
29
3739
|
async function runPackageLspMcpCli() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
3740
|
+
const cliPath = require2.resolve(PACKAGE_LSP_MCP_CLI);
|
|
3741
|
+
const child = spawn3(execPath2, [cliPath, "mcp"], { stdio: "inherit" });
|
|
3742
|
+
await new Promise((resolve6, reject) => {
|
|
3743
|
+
child.once("error", reject);
|
|
3744
|
+
child.once("exit", (code, signal) => {
|
|
3745
|
+
if (code !== null && code !== 0)
|
|
3746
|
+
process.exitCode = code;
|
|
3747
|
+
if (code === null && signal !== null)
|
|
3748
|
+
process.exitCode = 1;
|
|
3749
|
+
resolve6();
|
|
41
3750
|
});
|
|
3751
|
+
});
|
|
42
3752
|
}
|