oh-my-opencode 5.0.0-beta.3 → 5.0.0-beta.30
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/command/publish.md +44 -16
- package/.agents/skills/publish/SKILL.md +44 -16
- package/.agents/skills/senpi-qa/SKILL.md +80 -0
- package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.mjs +65 -0
- package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.test.mjs +171 -0
- package/.agents/skills/work-with-pr/SKILL.md +37 -23
- package/.opencode/command/publish.md +44 -16
- package/.opencode/skills/work-with-pr/SKILL.md +37 -23
- package/README.ja.md +25 -21
- package/README.ko.md +25 -21
- package/README.md +38 -23
- package/README.ru.md +24 -20
- package/README.zh-cn.md +25 -21
- package/dist/agents/atlas/agent.d.ts +0 -1
- package/dist/agents/sisyphus/grok-4.d.ts +20 -0
- package/dist/agents/sisyphus/index.d.ts +2 -0
- package/dist/agents/sisyphus-agent-config.d.ts +6 -0
- package/dist/agents/sisyphus-agent-factory.d.ts +1 -1
- package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/config-manager/parse-opencode-config-file.d.ts +2 -1
- package/dist/cli/doctor/checks/system-plugin.d.ts +4 -3
- package/dist/cli/fallback-lane-policy.d.ts +1 -0
- package/dist/cli/index.js +22572 -20322
- package/dist/cli/install-codex/install-codex-test-fixtures.d.ts +1 -1
- package/dist/cli/run/on-complete-hook.d.ts +2 -0
- package/dist/cli/runtime-commands.d.ts +1 -1
- package/dist/cli/worktree-sweep/classify.d.ts +16 -0
- package/dist/cli/worktree-sweep/format.d.ts +8 -0
- package/dist/cli/worktree-sweep/git.d.ts +19 -0
- package/dist/cli/worktree-sweep/index.d.ts +7 -0
- package/dist/cli/worktree-sweep/options.d.ts +2 -0
- package/dist/cli/worktree-sweep/parse-worktree-list.d.ts +8 -0
- package/dist/cli/worktree-sweep/sweep.d.ts +2 -0
- package/dist/cli/worktree-sweep/types.d.ts +65 -0
- package/dist/cli/worktree-sweep/worktree-sweep.d.ts +2 -0
- package/dist/cli-node/index.js +22190 -19917
- package/dist/config/schema/commands.d.ts +1 -1
- package/dist/config/schema/hooks.d.ts +1 -1
- package/dist/config/schema/oh-my-opencode-config.d.ts +4 -1
- package/dist/config/schema/ulw-execute.d.ts +5 -0
- package/dist/config/validate.d.ts +2 -0
- package/dist/create-hooks.d.ts +3 -1
- package/dist/features/btw-side/btw-command-draft.d.ts +7 -0
- package/dist/features/btw-side/context-injector.d.ts +15 -0
- package/dist/features/btw-side/index.d.ts +8 -0
- package/dist/features/btw-side/metadata.d.ts +15 -0
- package/dist/features/btw-side/parent-context-budget.d.ts +9 -0
- package/dist/features/btw-side/server-session-registry.d.ts +8 -0
- package/dist/features/btw-side/tui-adoption-cache.d.ts +13 -0
- package/dist/features/btw-side/tui-adoption-guard.d.ts +5 -0
- package/dist/features/btw-side/tui-controller-types.d.ts +68 -0
- package/dist/features/btw-side/tui-controller.d.ts +19 -0
- package/dist/features/btw-side/tui-escape-return.d.ts +12 -0
- package/dist/features/btw-side/tui-keymap.d.ts +17 -0
- package/dist/features/btw-side/tui-parent-validator.d.ts +6 -0
- package/dist/features/btw-side/tui-picker-options.d.ts +20 -0
- package/dist/features/btw-side/tui-picker.d.ts +9 -0
- package/dist/features/btw-side/tui-prompt-queue.d.ts +8 -0
- package/dist/features/btw-side/tui-session-bridge.d.ts +11 -0
- package/dist/features/btw-side/tui-session-catalog.d.ts +35 -0
- package/dist/features/btw-side/tui-side-removal.d.ts +11 -0
- package/dist/features/btw-side/tui-side-start.d.ts +9 -0
- package/dist/features/btw-side/tui-wiring.d.ts +8 -0
- package/dist/features/builtin-commands/templates/ulw-execute.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/features/opengateway-provider/index.d.ts +13 -0
- package/dist/features/team-mode/tools/messaging-fallback-wake.d.ts +15 -0
- package/dist/hooks/atlas/atlas-hook.d.ts +1 -0
- package/dist/hooks/atlas/atlas-lifecycle-store.d.ts +50 -0
- package/dist/hooks/atlas/event-handler.d.ts +1 -0
- package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
- package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
- package/dist/hooks/atlas/tool-execute-before.d.ts +3 -0
- package/dist/hooks/atlas/types.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/prometheus-md-only/agent-resolution.d.ts +2 -2
- package/dist/hooks/runtime-fallback/chat-message-handler.d.ts +2 -0
- package/dist/hooks/runtime-fallback/retry-model-payload.d.ts +1 -0
- package/dist/hooks/runtime-fallback/runtime-model-settings.d.ts +6 -0
- package/dist/hooks/runtime-fallback/session-status-handler.d.ts +1 -1
- package/dist/hooks/runtime-fallback/types.d.ts +3 -1
- package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +1 -1
- package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -0
- package/dist/hooks/{start-work → ulw-execute}/context-info-builder.d.ts +1 -1
- package/dist/hooks/{start-work → ulw-execute}/index.d.ts +1 -1
- package/dist/hooks/ulw-execute/ulw-execute-hook.d.ts +23 -0
- package/dist/index.js +12573 -6957
- package/dist/oh-my-opencode.schema.json +15 -2
- package/dist/plugin/chat-message/types.d.ts +3 -3
- package/dist/plugin/chat-message/ulw-execute-message.d.ts +5 -0
- package/dist/plugin/event-session-lifecycle.d.ts +1 -0
- package/dist/plugin/hooks/create-core-hooks.d.ts +2 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -0
- package/dist/plugin/messages-transform.d.ts +1 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/legacy-plugin-warning.d.ts +2 -1
- package/dist/shared/normalize-sdk-response.d.ts +1 -0
- package/dist/shared/plugin-entry-migrator.d.ts +4 -3
- package/dist/shared/plugin-entry-shape.d.ts +6 -0
- package/dist/shared/runtime-fallback-retry-marker.d.ts +16 -0
- package/dist/shared/shell-env.d.ts +1 -1
- package/dist/skills/ast-grep/AGENTS.md +51 -0
- package/dist/skills/coding-agent-sessions/AGENTS.md +62 -0
- package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/dist/skills/data-scientist/SKILL.md +99 -239
- package/dist/skills/data-scientist/references/execution-surfaces.md +91 -0
- package/dist/skills/data-scientist/references/placement.md +74 -0
- package/dist/skills/data-scientist/references/polars-lane.md +95 -0
- package/dist/skills/data-scientist/references/uv-setup.md +1 -1
- package/dist/skills/data-scientist/references/visualization.md +64 -0
- package/dist/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
- package/dist/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
- package/dist/skills/debugging/SKILL.md +2 -0
- package/dist/skills/debugging/references/methodology/00-setup.md +12 -0
- package/dist/skills/debugging/references/methodology/02-investigate.md +21 -0
- package/dist/skills/debugging/references/runtimes/go.md +15 -1
- package/dist/skills/debugging/references/runtimes/native-binary.md +38 -0
- package/dist/skills/debugging/references/runtimes/node.md +25 -0
- package/dist/skills/debugging/references/runtimes/python.md +13 -0
- package/dist/skills/debugging/references/runtimes/rust.md +41 -0
- package/dist/skills/debugging/references/scripts/dap.mjs +267 -0
- package/dist/skills/debugging/references/scripts/dap.test.ts +86 -0
- package/dist/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
- package/dist/skills/debugging/references/tools/dap.md +103 -0
- package/dist/skills/debugging/references/tools/frida.md +193 -0
- package/dist/skills/frontend/SKILL.md +11 -7
- package/dist/skills/frontend/references/design/_INDEX.md +1 -0
- package/dist/skills/frontend/references/design/print-paged-media.md +76 -0
- package/dist/skills/frontend/references/design/stylegallery.md +80 -0
- package/dist/skills/frontend/references/designpowers/README.md +1 -1
- package/dist/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
- package/dist/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
- package/dist/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
- package/dist/skills/frontend/references/designpowers/orchestration.md +1 -1
- package/dist/skills/frontend/references/designpowers/routing.md +5 -5
- package/dist/skills/review-work/SKILL.md +3 -3
- package/dist/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/dist/skills/ultimate-browsing/SKILL.md +2 -0
- package/dist/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/dist/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/dist/skills/ultimate-browsing/references/chrome-stealth.md +13 -11
- package/dist/skills/{start-work → ulw-execute}/SKILL.md +9 -8
- package/dist/skills/ulw-plan/SKILL.md +6 -6
- package/dist/skills/ulw-plan/references/full-workflow.md +31 -7
- package/dist/skills/ulw-plan/references/intent-clear.md +2 -1
- package/dist/skills/ulw-plan/references/intent-unclear.md +5 -5
- package/dist/skills/ulw-research/SKILL.md +4 -2
- package/dist/skills/visual-qa/AGENTS.md +58 -0
- package/dist/skills/visual-qa/SKILL.md +3 -2
- package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
- package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
- package/dist/tools/delegate-task/tool-description.d.ts +3 -1
- package/dist/tools/delegate-task/types.d.ts +3 -0
- package/dist/tui.d.ts +12 -0
- package/dist/tui.js +11480 -11512
- package/package.json +42 -36
- package/packages/git-bash-mcp/dist/cli.js +5 -1
- package/packages/git-bash-mcp/package.json +1 -1
- package/packages/lsp-core/src/index.ts +1 -0
- package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +44 -0
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +0 -28
- package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
- package/packages/lsp-core/src/lsp/client-wrapper.test.ts +66 -13
- package/packages/lsp-core/src/lsp/client-wrapper.ts +95 -23
- package/packages/lsp-core/src/lsp/client.ts +26 -0
- package/packages/lsp-core/src/lsp/connection.ts +16 -0
- package/packages/lsp-core/src/lsp/constants.ts +1 -0
- package/packages/lsp-core/src/lsp/format-document.test.ts +143 -0
- package/packages/lsp-core/src/lsp/format-document.ts +90 -0
- package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +151 -0
- package/packages/lsp-core/src/lsp/manager.ts +34 -1
- package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
- package/packages/lsp-core/src/lsp/server-definitions.ts +29 -0
- package/packages/lsp-core/src/lsp/server-installation.test.ts +376 -0
- package/packages/lsp-core/src/lsp/server-installation.ts +200 -27
- package/packages/lsp-core/src/lsp/server-resolution-local-binary.test.ts +170 -0
- package/packages/lsp-core/src/lsp/server-resolution.ts +18 -5
- package/packages/lsp-core/src/lsp/transport.ts +9 -0
- package/packages/lsp-core/src/lsp/types.ts +8 -0
- package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
- package/packages/lsp-core/src/lsp/workspace-markers.ts +1 -0
- package/packages/lsp-core/src/request-context.test.ts +29 -0
- package/packages/lsp-core/src/request-context.ts +1 -1
- package/packages/lsp-core/src/tool-surface.test.ts +13 -1
- package/packages/lsp-core/src/tools/definitions.ts +14 -0
- package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
- package/packages/lsp-core/src/tools/format.test.ts +56 -0
- package/packages/lsp-core/src/tools/format.ts +56 -0
- package/packages/lsp-core/src/tools/index.ts +1 -0
- package/packages/lsp-core/src/tools/navigation.ts +4 -2
- package/packages/lsp-core/src/tools/rename.ts +4 -2
- package/packages/lsp-core/src/tools/symbols.ts +1 -1
- package/packages/lsp-core/src/tools/types.ts +10 -0
- package/packages/lsp-daemon/dist/cli.js +645 -296
- package/packages/lsp-daemon/dist/client.d.ts +10 -0
- package/packages/lsp-daemon/dist/client.js +605 -253
- package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -0
- package/packages/lsp-daemon/dist/daemon-client.js +3 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +1 -0
- package/packages/lsp-daemon/dist/index.js +609 -262
- package/packages/lsp-daemon/dist/version-reap.js +1 -1
- package/packages/lsp-daemon/package.json +1 -1
- package/packages/lsp-tools-mcp/dist/cli.js +564 -217
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +115 -92
- package/packages/lsp-tools-mcp/dist/mcp.js +566 -219
- package/packages/lsp-tools-mcp/dist/request-context.js +12 -13
- package/packages/lsp-tools-mcp/dist/tools.js +571 -227
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +4 -4
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +4 -4
- package/packages/omo-codex/plugin/AGENTS.md +47 -0
- package/packages/omo-codex/plugin/README.md +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +34 -33
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/src/hook.ts +1 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +293 -116
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +245 -84
- package/packages/omo-codex/plugin/components/codegraph/package.json +4 -4
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +1 -0
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/AGENTS.md +9 -0
- package/packages/omo-codex/plugin/components/comment-checker/biome.json +2 -2
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +2 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +5 -5
- package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +2 -8
- package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +1 -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 +1 -0
- package/packages/omo-codex/plugin/components/git-bash/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +3 -4
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +1 -5
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +1 -5
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +5 -5
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +1 -5
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +4 -21
- package/packages/omo-codex/plugin/components/lsp/AGENTS.md +30 -15
- package/packages/omo-codex/plugin/components/lsp/biome.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +4 -4
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +596 -267
- package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +1 -1
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +5 -5
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +1 -5
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +6 -7
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook.test.ts +1 -2
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +11 -1
- package/packages/omo-codex/plugin/components/rules/AGENTS.md +12 -0
- package/packages/omo-codex/plugin/components/rules/biome.json +2 -2
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +60 -45
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +7 -7
- package/packages/omo-codex/plugin/components/rules/src/config.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +9 -5
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +1 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +4 -9
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +11 -16
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +17 -25
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
- package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +7 -4
- package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -3
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +39 -72
- package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
- package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -3
- package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +1 -1
- package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +5 -6
- package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +3 -6
- package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -2
- package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +2 -5
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +2 -17
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +5 -5
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +3 -9
- package/packages/omo-codex/plugin/components/telemetry/AGENTS.md +8 -0
- package/packages/omo-codex/plugin/components/telemetry/biome.json +2 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +2463 -437
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2467 -441
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +5 -5
- package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +1 -4
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +4 -14
- package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +1 -1
- package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +2 -5
- package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +5 -0
- package/packages/omo-codex/plugin/components/ultrawork/biome.json +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +13 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +5 -5
- package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +13 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +6 -6
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +31 -7
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +5 -5
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +9 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
- package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/AGENTS.md +5 -4
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/NOTICE +1 -1
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/README.md +5 -5
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/biome.json +2 -2
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/directive.md +6 -6
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/dist/cli.js +12 -12
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +28 -0
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/package.json +12 -12
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/boulder-reader.ts +1 -1
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/codex-hook.ts +3 -3
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/directive.ts +1 -1
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/index.ts +1 -1
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/boulder-reader.test.ts +3 -3
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/cli.test.ts +1 -4
- package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/codex-hook.test.ts +8 -22
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/biome.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +13 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +5 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +11 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +24 -14
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +3 -3
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +5 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +13 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +3 -5
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-snapshot.ts +3 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +3 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +3 -3
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +25 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +26 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-snapshot.test.ts +18 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +5 -37
- package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +9 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/steering.test.ts +8 -5
- package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +4 -5
- package/packages/omo-codex/plugin/components/ulw-loop/vitest.config.ts +1 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +17 -0
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +17 -0
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/model-catalog.json +3 -3
- package/packages/omo-codex/plugin/package-lock.json +681 -395
- package/packages/omo-codex/plugin/package.json +2 -2
- package/packages/omo-codex/plugin/scripts/AGENTS.md +40 -0
- package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +1 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +3 -3
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +11 -11
- package/packages/omo-codex/plugin/shared/package.json +3 -4
- package/packages/omo-codex/plugin/skills/ast-grep/AGENTS.md +51 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/AGENTS.md +62 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/omo-codex/plugin/skills/data-scientist/SKILL.md +99 -239
- package/packages/omo-codex/plugin/skills/data-scientist/references/execution-surfaces.md +91 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/placement.md +74 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/polars-lane.md +95 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/uv-setup.md +1 -1
- package/packages/omo-codex/plugin/skills/data-scientist/references/visualization.md +64 -0
- package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
- package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +2 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/00-setup.md +12 -0
- package/packages/omo-codex/plugin/skills/debugging/references/methodology/02-investigate.md +21 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/go.md +15 -1
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/native-binary.md +38 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/node.md +25 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/python.md +13 -0
- package/packages/omo-codex/plugin/skills/debugging/references/runtimes/rust.md +41 -0
- package/packages/omo-codex/plugin/skills/debugging/references/scripts/dap.mjs +267 -0
- package/packages/omo-codex/plugin/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/dap.md +103 -0
- package/packages/omo-codex/plugin/skills/debugging/references/tools/frida.md +193 -0
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +11 -7
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/print-paged-media.md +76 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +5 -5
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +4 -4
- package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +2 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +13 -11
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +13 -1
- package/packages/omo-codex/plugin/skills/{start-work → ulw-execute}/SKILL.md +12 -11
- package/packages/omo-codex/plugin/skills/ulw-execute/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +31 -7
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +5 -5
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +4 -2
- package/packages/omo-codex/plugin/skills/visual-qa/AGENTS.md +58 -0
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +3 -2
- package/packages/omo-codex/plugin/test/AGENTS.md +47 -0
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +8 -28
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
- package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +2 -2
- package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +2 -2
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +2 -2
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +4 -4
- package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +8 -8
- package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +101 -0
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +12 -12
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +1 -119
- package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
- package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
- package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +0 -3
- package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
- package/packages/omo-codex/scripts/AGENTS.md +36 -0
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +2 -2
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +2637 -549
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
- package/packages/shared-skills/skills/ast-grep/AGENTS.md +51 -0
- package/packages/shared-skills/skills/coding-agent-sessions/AGENTS.md +62 -0
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/shared-skills/skills/data-scientist/SKILL.md +99 -239
- package/packages/shared-skills/skills/data-scientist/references/execution-surfaces.md +91 -0
- package/packages/shared-skills/skills/data-scientist/references/placement.md +74 -0
- package/packages/shared-skills/skills/data-scientist/references/polars-lane.md +95 -0
- package/packages/shared-skills/skills/data-scientist/references/uv-setup.md +1 -1
- package/packages/shared-skills/skills/data-scientist/references/visualization.md +64 -0
- package/packages/shared-skills/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
- package/packages/shared-skills/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
- package/packages/shared-skills/skills/debugging/SKILL.md +2 -0
- package/packages/shared-skills/skills/debugging/references/methodology/00-setup.md +12 -0
- package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +21 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/go.md +15 -1
- package/packages/shared-skills/skills/debugging/references/runtimes/native-binary.md +38 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/node.md +25 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/python.md +13 -0
- package/packages/shared-skills/skills/debugging/references/runtimes/rust.md +41 -0
- package/packages/shared-skills/skills/debugging/references/scripts/dap.mjs +267 -0
- package/packages/shared-skills/skills/debugging/references/scripts/dap.test.ts +86 -0
- package/packages/shared-skills/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
- package/packages/shared-skills/skills/debugging/references/tools/dap.md +103 -0
- package/packages/shared-skills/skills/debugging/references/tools/frida.md +193 -0
- package/packages/shared-skills/skills/frontend/SKILL.md +11 -7
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/shared-skills/skills/frontend/references/design/print-paged-media.md +76 -0
- package/packages/shared-skills/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/README.md +1 -1
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
- package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
- package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +1 -1
- package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +5 -5
- package/packages/shared-skills/skills/review-work/SKILL.md +3 -3
- package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +2 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +13 -11
- package/packages/shared-skills/skills/{start-work → ulw-execute}/SKILL.md +9 -8
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +6 -6
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +31 -7
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +5 -5
- package/packages/shared-skills/skills/ulw-research/SKILL.md +4 -2
- package/packages/shared-skills/skills/visual-qa/AGENTS.md +58 -0
- package/packages/shared-skills/skills/visual-qa/SKILL.md +3 -2
- package/script/qa/web-terminal-visual-qa.mjs +2 -0
- package/script/qa/xterm-live-terminal.mjs +18 -2
- package/dist/config/schema/start-work.d.ts +0 -5
- package/dist/features/builtin-commands/templates/start-work.d.ts +0 -1
- package/dist/hooks/start-work/start-work-hook.d.ts +0 -23
- package/dist/plugin/chat-message/start-work-message.d.ts +0 -5
- package/dist/skills/data-scientist/references/common-scenarios.md +0 -176
- package/dist/skills/data-scientist/references/execution-templates.md +0 -197
- package/dist/skills/data-scientist/references/integration-patterns.md +0 -153
- package/dist/skills/data-scientist/references/performance-benchmarks.md +0 -37
- package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +0 -28
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +0 -17
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +0 -17
- package/packages/omo-codex/plugin/skills/data-scientist/references/common-scenarios.md +0 -176
- package/packages/omo-codex/plugin/skills/data-scientist/references/execution-templates.md +0 -197
- package/packages/omo-codex/plugin/skills/data-scientist/references/integration-patterns.md +0 -153
- package/packages/omo-codex/plugin/skills/data-scientist/references/performance-benchmarks.md +0 -37
- package/packages/omo-codex/plugin/skills/start-work/agents/openai.yaml +0 -2
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
- package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
- package/packages/shared-skills/skills/data-scientist/references/common-scenarios.md +0 -176
- package/packages/shared-skills/skills/data-scientist/references/execution-templates.md +0 -197
- package/packages/shared-skills/skills/data-scientist/references/integration-patterns.md +0 -153
- package/packages/shared-skills/skills/data-scientist/references/performance-benchmarks.md +0 -37
- /package/dist/hooks/{start-work → ulw-execute}/context-info-formatters.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/explicit-plan-context.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/notepad-scaffold.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/parse-user-request.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/plan-discovery-context.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/plan-selection.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/session-plan-affinity.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/work-initializer.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/worktree-block.d.ts +0 -0
- /package/dist/hooks/{start-work → ulw-execute}/worktree-detector.d.ts +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/.gitattributes +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/CHANGELOG.md +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/LICENSE +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/plan-checklist.ts +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/types.ts +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-completed.json +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-mixed-platforms.json +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-single-codex-work.json +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-all-done.md +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-scaffold.md +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-nested-checkboxes.md +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-unchecked.md +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.build.json +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.json +0 -0
- /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/vitest.config.ts +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import { statSync as statSync5 } from "node:fs";
|
|
3
|
+
import { isAbsolute as isAbsolute6 } from "node:path";
|
|
4
|
+
|
|
1
5
|
// src/daemon-client.ts
|
|
2
6
|
import { connect } from "node:net";
|
|
3
7
|
import { homedir as homedir3 } from "node:os";
|
|
4
|
-
import { join as
|
|
8
|
+
import { join as join8 } from "node:path";
|
|
5
9
|
|
|
6
10
|
// ../lsp-core/src/request-context.ts
|
|
7
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -10,18 +14,17 @@ import { homedir } from "node:os";
|
|
|
10
14
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
11
15
|
|
|
12
16
|
class LspRequestContextParseError extends Error {
|
|
13
|
-
code;
|
|
14
|
-
name = "LspRequestContextParseError";
|
|
15
17
|
constructor(code, message) {
|
|
16
18
|
super(message);
|
|
17
19
|
this.code = code;
|
|
20
|
+
this.name = "LspRequestContextParseError";
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
class LspRequestContextUnavailableError extends Error {
|
|
22
|
-
name = "LspRequestContextUnavailableError";
|
|
23
25
|
constructor() {
|
|
24
26
|
super("LSP request context is required. Standalone MCP startup must install one with runWithRequestContext(createStandaloneMcpRequestContext()).");
|
|
27
|
+
this.name = "LspRequestContextUnavailableError";
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
var storage = new AsyncLocalStorage;
|
|
@@ -41,7 +44,7 @@ function contextCwd() {
|
|
|
41
44
|
}
|
|
42
45
|
function createStandaloneMcpRequestContext(input = {}) {
|
|
43
46
|
const env = input.env ?? process.env;
|
|
44
|
-
const cwd = canonicalCwd(input.cwd ?? process.cwd());
|
|
47
|
+
const cwd = canonicalCwd(input.cwd ?? env["LSP_TOOLS_MCP_CWD"] ?? process.cwd());
|
|
45
48
|
const home = input.homeDir ?? homedir();
|
|
46
49
|
const projectConfigPaths = translateProjectConfigEnv(env["LSP_TOOLS_MCP_PROJECT_CONFIG"], cwd);
|
|
47
50
|
const userConfigPath = translateHomeConfigEnv(env["LSP_TOOLS_MCP_USER_CONFIG"], home, ".codex/lsp-client.json");
|
|
@@ -179,7 +182,6 @@ function isPlainRecord(value) {
|
|
|
179
182
|
|
|
180
183
|
// src/daemon-request-error.ts
|
|
181
184
|
class DaemonRequestError extends Error {
|
|
182
|
-
requestWritten;
|
|
183
185
|
constructor(message, requestWritten) {
|
|
184
186
|
super(message);
|
|
185
187
|
this.name = "DaemonRequestError";
|
|
@@ -202,7 +204,6 @@ class DaemonRequestCancelledError extends DaemonRequestError {
|
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
class DaemonRequestTimedOutError extends DaemonRequestError {
|
|
205
|
-
timeoutMs;
|
|
206
207
|
constructor(requestWritten, timeoutMs) {
|
|
207
208
|
super("daemon request timed out", requestWritten);
|
|
208
209
|
this.name = "DaemonRequestTimedOutError";
|
|
@@ -281,14 +282,12 @@ var PROTOCOL_ERROR_CODE = -32002;
|
|
|
281
282
|
var AUTH_TOKEN_BYTES = 32;
|
|
282
283
|
|
|
283
284
|
class UnsafePrivateDirectoryError extends Error {
|
|
284
|
-
path;
|
|
285
|
-
reason;
|
|
286
|
-
name = "UnsafePrivateDirectoryError";
|
|
287
|
-
code = "unsafe_private_directory";
|
|
288
285
|
constructor(path, reason) {
|
|
289
286
|
super(`unsafe private directory ${path}: ${reason}`);
|
|
290
287
|
this.path = path;
|
|
291
288
|
this.reason = reason;
|
|
289
|
+
this.name = "UnsafePrivateDirectoryError";
|
|
290
|
+
this.code = "unsafe_private_directory";
|
|
292
291
|
}
|
|
293
292
|
}
|
|
294
293
|
function authEnvelope(token) {
|
|
@@ -472,20 +471,18 @@ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
|
|
|
472
471
|
var DAEMON_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
473
472
|
|
|
474
473
|
class InvalidRuntimeOverrideError extends Error {
|
|
475
|
-
code = "invalid_runtime_override";
|
|
476
|
-
reason;
|
|
477
474
|
constructor(reason, message) {
|
|
478
475
|
super(message);
|
|
476
|
+
this.code = "invalid_runtime_override";
|
|
479
477
|
this.name = "InvalidRuntimeOverrideError";
|
|
480
478
|
this.reason = reason;
|
|
481
479
|
}
|
|
482
480
|
}
|
|
483
481
|
|
|
484
482
|
class InvalidDaemonVersionError extends Error {
|
|
485
|
-
code = "invalid_daemon_version";
|
|
486
|
-
version;
|
|
487
483
|
constructor(version) {
|
|
488
484
|
super("LSP daemon version must match [A-Za-z0-9][A-Za-z0-9._+-]{0,127}");
|
|
485
|
+
this.code = "invalid_daemon_version";
|
|
489
486
|
this.name = "InvalidDaemonVersionError";
|
|
490
487
|
this.version = version;
|
|
491
488
|
}
|
|
@@ -531,10 +528,9 @@ var requireFromHere = createRequire(import.meta.url);
|
|
|
531
528
|
var MAX_SOCKET_PATH_LENGTH = 100;
|
|
532
529
|
|
|
533
530
|
class InvalidDaemonDirectoryError extends Error {
|
|
534
|
-
code = "invalid_daemon_directory";
|
|
535
|
-
directory;
|
|
536
531
|
constructor(directory) {
|
|
537
532
|
super(`${OMO_LSP_DAEMON_DIR} must be an absolute path`);
|
|
533
|
+
this.code = "invalid_daemon_directory";
|
|
538
534
|
this.name = "InvalidDaemonDirectoryError";
|
|
539
535
|
this.directory = directory;
|
|
540
536
|
}
|
|
@@ -729,7 +725,8 @@ function spawnDaemonProcess(paths) {
|
|
|
729
725
|
try {
|
|
730
726
|
const child = spawn(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
|
|
731
727
|
detached: true,
|
|
732
|
-
stdio: ["ignore", logFd, logFd]
|
|
728
|
+
stdio: ["ignore", logFd, logFd],
|
|
729
|
+
windowsHide: true
|
|
733
730
|
});
|
|
734
731
|
child.once("spawn", () => closeSync2(logFd));
|
|
735
732
|
child.once("error", (error) => {
|
|
@@ -1106,7 +1103,11 @@ function createParentWatchdog(config, onDeadParent) {
|
|
|
1106
1103
|
const probeAlive = config.probeAlive ?? isProcessAlive;
|
|
1107
1104
|
let fired = false;
|
|
1108
1105
|
const timer = setInterval(() => {
|
|
1109
|
-
if (fired
|
|
1106
|
+
if (fired)
|
|
1107
|
+
return;
|
|
1108
|
+
const alive = probeAlive(parentPid);
|
|
1109
|
+
config.onPoll?.(alive);
|
|
1110
|
+
if (alive)
|
|
1110
1111
|
return;
|
|
1111
1112
|
fired = true;
|
|
1112
1113
|
onDeadParent(parentPid, pollIntervalMs);
|
|
@@ -1141,8 +1142,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
|
|
|
1141
1142
|
};
|
|
1142
1143
|
}
|
|
1143
1144
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
1144
|
-
import { existsSync as
|
|
1145
|
-
import { dirname as
|
|
1145
|
+
import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
|
|
1146
|
+
import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
|
|
1146
1147
|
|
|
1147
1148
|
// ../lsp-core/src/lsp/effective-extension.ts
|
|
1148
1149
|
import { basename as basename2, extname } from "node:path";
|
|
@@ -1156,22 +1157,15 @@ function effectiveExtension(filePath) {
|
|
|
1156
1157
|
|
|
1157
1158
|
// ../lsp-core/src/lsp/errors.ts
|
|
1158
1159
|
class LspConnectionClosedError extends Error {
|
|
1159
|
-
serverId;
|
|
1160
|
-
root;
|
|
1161
|
-
name = "LspConnectionClosedError";
|
|
1162
1160
|
constructor(serverId, root, message) {
|
|
1163
1161
|
super(message ?? `LSP connection closed for ${serverId} at ${root}`);
|
|
1164
1162
|
this.serverId = serverId;
|
|
1165
1163
|
this.root = root;
|
|
1164
|
+
this.name = "LspConnectionClosedError";
|
|
1166
1165
|
}
|
|
1167
1166
|
}
|
|
1168
1167
|
|
|
1169
1168
|
class LspProcessExitedError extends Error {
|
|
1170
|
-
serverId;
|
|
1171
|
-
root;
|
|
1172
|
-
exitCode;
|
|
1173
|
-
stderrTail;
|
|
1174
|
-
name = "LspProcessExitedError";
|
|
1175
1169
|
constructor(serverId, root, exitCode, stderrTail) {
|
|
1176
1170
|
const stderrSuffix = stderrTail ? `
|
|
1177
1171
|
stderr tail: ${stderrTail}` : "";
|
|
@@ -1180,46 +1174,49 @@ stderr tail: ${stderrTail}` : "";
|
|
|
1180
1174
|
this.root = root;
|
|
1181
1175
|
this.exitCode = exitCode;
|
|
1182
1176
|
this.stderrTail = stderrTail;
|
|
1177
|
+
this.name = "LspProcessExitedError";
|
|
1183
1178
|
}
|
|
1184
1179
|
}
|
|
1185
1180
|
|
|
1186
1181
|
class LspRequestTimeoutError extends Error {
|
|
1187
|
-
method;
|
|
1188
|
-
stderrTail;
|
|
1189
|
-
name = "LspRequestTimeoutError";
|
|
1190
1182
|
constructor(method, stderrTail) {
|
|
1191
1183
|
const stderrSuffix = stderrTail ? `
|
|
1192
1184
|
recent stderr: ${stderrTail}` : "";
|
|
1193
1185
|
super(`LSP request timeout (method: ${method})${stderrSuffix}`);
|
|
1194
1186
|
this.method = method;
|
|
1195
1187
|
this.stderrTail = stderrTail;
|
|
1188
|
+
this.name = "LspRequestTimeoutError";
|
|
1196
1189
|
}
|
|
1197
1190
|
}
|
|
1198
1191
|
|
|
1199
1192
|
class LspInvalidPathError extends Error {
|
|
1200
|
-
|
|
1193
|
+
constructor() {
|
|
1194
|
+
super(...arguments);
|
|
1195
|
+
this.name = "LspInvalidPathError";
|
|
1196
|
+
}
|
|
1201
1197
|
}
|
|
1202
1198
|
|
|
1203
1199
|
class LspServerLookupError extends Error {
|
|
1204
|
-
lookup;
|
|
1205
|
-
name = "LspServerLookupError";
|
|
1206
1200
|
constructor(message, lookup) {
|
|
1207
1201
|
super(message);
|
|
1208
1202
|
this.lookup = lookup;
|
|
1203
|
+
this.name = "LspServerLookupError";
|
|
1209
1204
|
}
|
|
1210
1205
|
}
|
|
1211
1206
|
|
|
1212
1207
|
class LspServerInitializingError extends Error {
|
|
1213
|
-
originalError;
|
|
1214
|
-
name = "LspServerInitializingError";
|
|
1215
1208
|
constructor(originalError) {
|
|
1216
1209
|
super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
|
|
1217
1210
|
this.originalError = originalError;
|
|
1211
|
+
this.name = "LspServerInitializingError";
|
|
1218
1212
|
}
|
|
1219
1213
|
}
|
|
1220
1214
|
|
|
1221
1215
|
class LspProcessSpawnError extends Error {
|
|
1222
|
-
|
|
1216
|
+
constructor() {
|
|
1217
|
+
super(...arguments);
|
|
1218
|
+
this.name = "LspProcessSpawnError";
|
|
1219
|
+
}
|
|
1223
1220
|
}
|
|
1224
1221
|
function isLspDeadConnectionError(err) {
|
|
1225
1222
|
return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
|
|
@@ -1250,6 +1247,7 @@ var DEFAULT_MAX_DIRECTORY_FILES = 50;
|
|
|
1250
1247
|
var REQUEST_TIMEOUT_MS = 15000;
|
|
1251
1248
|
var INIT_TIMEOUT_MS = 60000;
|
|
1252
1249
|
var IDLE_TIMEOUT_MS = 5 * 60000;
|
|
1250
|
+
var MAX_RESIDENT_CLIENTS = 6;
|
|
1253
1251
|
var REAPER_INTERVAL_MS = 60000;
|
|
1254
1252
|
var STOP_HARD_KILL_TIMEOUT_MS = 5000;
|
|
1255
1253
|
var STOP_SIGKILL_GRACE_MS = 1000;
|
|
@@ -1264,20 +1262,31 @@ var METHOD_NOT_FOUND = -32601;
|
|
|
1264
1262
|
var INTERNAL_ERROR = -32603;
|
|
1265
1263
|
|
|
1266
1264
|
class JsonRpcConnection {
|
|
1267
|
-
reader;
|
|
1268
|
-
writer;
|
|
1269
|
-
pendingRequests = new Map;
|
|
1270
|
-
notificationHandlers = new Map;
|
|
1271
|
-
requestHandlers = new Map;
|
|
1272
|
-
closeHandlers = [];
|
|
1273
|
-
errorHandlers = [];
|
|
1274
|
-
inputBuffer = Buffer.alloc(0);
|
|
1275
|
-
nextRequestId = 1;
|
|
1276
|
-
listening = false;
|
|
1277
|
-
disposed = false;
|
|
1278
1265
|
constructor(reader, writer) {
|
|
1279
1266
|
this.reader = reader;
|
|
1280
1267
|
this.writer = writer;
|
|
1268
|
+
this.pendingRequests = new Map;
|
|
1269
|
+
this.notificationHandlers = new Map;
|
|
1270
|
+
this.requestHandlers = new Map;
|
|
1271
|
+
this.closeHandlers = [];
|
|
1272
|
+
this.errorHandlers = [];
|
|
1273
|
+
this.inputBuffer = Buffer.alloc(0);
|
|
1274
|
+
this.nextRequestId = 1;
|
|
1275
|
+
this.listening = false;
|
|
1276
|
+
this.disposed = false;
|
|
1277
|
+
this.handleData = (chunk) => {
|
|
1278
|
+
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
1279
|
+
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
1280
|
+
this.drainInputBuffer();
|
|
1281
|
+
};
|
|
1282
|
+
this.handleClose = () => {
|
|
1283
|
+
for (const handler of this.closeHandlers) {
|
|
1284
|
+
handler();
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
this.handleStreamError = (error) => {
|
|
1288
|
+
this.emitError(error);
|
|
1289
|
+
};
|
|
1281
1290
|
}
|
|
1282
1291
|
listen() {
|
|
1283
1292
|
if (this.listening)
|
|
@@ -1398,19 +1407,6 @@ class JsonRpcConnection {
|
|
|
1398
1407
|
this.notificationHandlers.clear();
|
|
1399
1408
|
this.requestHandlers.clear();
|
|
1400
1409
|
}
|
|
1401
|
-
handleData = (chunk) => {
|
|
1402
|
-
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
1403
|
-
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
1404
|
-
this.drainInputBuffer();
|
|
1405
|
-
};
|
|
1406
|
-
handleClose = () => {
|
|
1407
|
-
for (const handler of this.closeHandlers) {
|
|
1408
|
-
handler();
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
handleStreamError = (error) => {
|
|
1412
|
-
this.emitError(error);
|
|
1413
|
-
};
|
|
1414
1410
|
drainInputBuffer() {
|
|
1415
1411
|
while (true) {
|
|
1416
1412
|
const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR2);
|
|
@@ -1758,31 +1754,26 @@ function isPosition(value) {
|
|
|
1758
1754
|
|
|
1759
1755
|
// ../lsp-core/src/lsp/transport.ts
|
|
1760
1756
|
class LspClientNotStartedError extends Error {
|
|
1761
|
-
serverId;
|
|
1762
|
-
root;
|
|
1763
|
-
name = "LspClientNotStartedError";
|
|
1764
1757
|
constructor(serverId, root) {
|
|
1765
1758
|
super("LSP client not started");
|
|
1766
1759
|
this.serverId = serverId;
|
|
1767
1760
|
this.root = root;
|
|
1761
|
+
this.name = "LspClientNotStartedError";
|
|
1768
1762
|
}
|
|
1769
1763
|
}
|
|
1770
1764
|
|
|
1771
1765
|
class LspClientTransport {
|
|
1772
|
-
root;
|
|
1773
|
-
server;
|
|
1774
|
-
proc = null;
|
|
1775
|
-
connection = null;
|
|
1776
|
-
stderrBuffer = [];
|
|
1777
|
-
processExited = false;
|
|
1778
|
-
diagnosticsStore = new Map;
|
|
1779
|
-
requestTimeoutMs;
|
|
1780
|
-
initializeTimeoutMs;
|
|
1781
|
-
workspaceApplyEditHandler = null;
|
|
1782
|
-
diagnosticPullSupported = false;
|
|
1783
1766
|
constructor(root, server2, timeouts = {}) {
|
|
1784
1767
|
this.root = root;
|
|
1785
1768
|
this.server = server2;
|
|
1769
|
+
this.proc = null;
|
|
1770
|
+
this.connection = null;
|
|
1771
|
+
this.stderrBuffer = [];
|
|
1772
|
+
this.processExited = false;
|
|
1773
|
+
this.diagnosticsStore = new Map;
|
|
1774
|
+
this.workspaceApplyEditHandler = null;
|
|
1775
|
+
this.diagnosticPullSupported = false;
|
|
1776
|
+
this.documentFormattingSupported = false;
|
|
1786
1777
|
this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
|
|
1787
1778
|
this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
1788
1779
|
}
|
|
@@ -1804,6 +1795,12 @@ class LspClientTransport {
|
|
|
1804
1795
|
isDiagnosticPullSupported() {
|
|
1805
1796
|
return this.diagnosticPullSupported;
|
|
1806
1797
|
}
|
|
1798
|
+
setDocumentFormattingSupported(supported) {
|
|
1799
|
+
this.documentFormattingSupported = supported;
|
|
1800
|
+
}
|
|
1801
|
+
isDocumentFormattingSupported() {
|
|
1802
|
+
return this.documentFormattingSupported;
|
|
1803
|
+
}
|
|
1807
1804
|
handlePublishDiagnostics(params) {
|
|
1808
1805
|
this.diagnosticsStore.set(params.uri, [...params.diagnostics]);
|
|
1809
1806
|
}
|
|
@@ -2017,6 +2014,14 @@ function supportsDiagnosticPull(capabilities) {
|
|
|
2017
2014
|
return false;
|
|
2018
2015
|
return Object.hasOwn(capabilities, "diagnosticProvider");
|
|
2019
2016
|
}
|
|
2017
|
+
function supportsDocumentFormatting(capabilities) {
|
|
2018
|
+
if (capabilities === undefined)
|
|
2019
|
+
return false;
|
|
2020
|
+
const provider = capabilities.documentFormattingProvider;
|
|
2021
|
+
if (provider === undefined || provider === null || provider === false)
|
|
2022
|
+
return false;
|
|
2023
|
+
return provider === true || typeof provider === "object";
|
|
2024
|
+
}
|
|
2020
2025
|
|
|
2021
2026
|
class LspClientConnection extends LspClientTransport {
|
|
2022
2027
|
async initialize() {
|
|
@@ -2033,6 +2038,7 @@ class LspClientConnection extends LspClientTransport {
|
|
|
2033
2038
|
references: {},
|
|
2034
2039
|
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
2035
2040
|
publishDiagnostics: {},
|
|
2041
|
+
formatting: { dynamicRegistration: false },
|
|
2036
2042
|
rename: {
|
|
2037
2043
|
prepareSupport: true,
|
|
2038
2044
|
prepareSupportDefaultBehavior: 1
|
|
@@ -2074,6 +2080,7 @@ class LspClientConnection extends LspClientTransport {
|
|
|
2074
2080
|
initializationOptions: this.server.initialization
|
|
2075
2081
|
}, { timeoutMs: this.initializeTimeoutMs });
|
|
2076
2082
|
this.setDiagnosticPullSupported(supportsDiagnosticPull(result?.capabilities));
|
|
2083
|
+
this.setDocumentFormattingSupported(supportsDocumentFormatting(result?.capabilities));
|
|
2077
2084
|
await this.sendNotification("initialized", {});
|
|
2078
2085
|
await this.sendNotification("workspace/didChangeConfiguration", {
|
|
2079
2086
|
settings: { json: { validate: { enable: true } } }
|
|
@@ -2279,16 +2286,12 @@ function movedPath(candidate, oldPath, newPath) {
|
|
|
2279
2286
|
}
|
|
2280
2287
|
|
|
2281
2288
|
class WorkspaceDocumentState {
|
|
2282
|
-
sendNotification;
|
|
2283
|
-
clearDiagnostics;
|
|
2284
|
-
openDocuments = new Map;
|
|
2285
|
-
openByUri = new Map;
|
|
2286
|
-
openPromises = new Map;
|
|
2287
|
-
now;
|
|
2288
|
-
versionlessPublishQuiescenceMs;
|
|
2289
2289
|
constructor(sendNotification, clearDiagnostics, options = {}) {
|
|
2290
2290
|
this.sendNotification = sendNotification;
|
|
2291
2291
|
this.clearDiagnostics = clearDiagnostics;
|
|
2292
|
+
this.openDocuments = new Map;
|
|
2293
|
+
this.openByUri = new Map;
|
|
2294
|
+
this.openPromises = new Map;
|
|
2292
2295
|
this.now = options.now ?? (() => Date.now());
|
|
2293
2296
|
this.versionlessPublishQuiescenceMs = options.versionlessPublishQuiescenceMs ?? DEFAULT_VERSIONLESS_PUBLISH_QUIESCENCE_MS;
|
|
2294
2297
|
}
|
|
@@ -2552,13 +2555,11 @@ import { dirname as dirname4, isAbsolute as isAbsolute4, relative as relative3,
|
|
|
2552
2555
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2553
2556
|
|
|
2554
2557
|
class WorkspaceEditPathError extends Error {
|
|
2555
|
-
path;
|
|
2556
|
-
detail;
|
|
2557
|
-
name = "WorkspaceEditPathError";
|
|
2558
2558
|
constructor(path2, detail) {
|
|
2559
2559
|
super(`${detail}: ${path2}`);
|
|
2560
2560
|
this.path = path2;
|
|
2561
2561
|
this.detail = detail;
|
|
2562
|
+
this.name = "WorkspaceEditPathError";
|
|
2562
2563
|
}
|
|
2563
2564
|
}
|
|
2564
2565
|
function isPathInsideWorkspace(filePath, workspaceRoot) {
|
|
@@ -2850,13 +2851,11 @@ function canonicalFingerprint(operations) {
|
|
|
2850
2851
|
|
|
2851
2852
|
// ../lsp-core/src/lsp/workspace-edit-types.ts
|
|
2852
2853
|
class WorkspaceEditValidationError extends Error {
|
|
2853
|
-
changeIndex;
|
|
2854
|
-
detail;
|
|
2855
|
-
name = "WorkspaceEditValidationError";
|
|
2856
2854
|
constructor(changeIndex, detail) {
|
|
2857
2855
|
super(`change ${changeIndex}: ${detail}`);
|
|
2858
2856
|
this.changeIndex = changeIndex;
|
|
2859
2857
|
this.detail = detail;
|
|
2858
|
+
this.name = "WorkspaceEditValidationError";
|
|
2860
2859
|
}
|
|
2861
2860
|
}
|
|
2862
2861
|
|
|
@@ -3354,10 +3353,9 @@ function simulateDelete(operation, virtual) {
|
|
|
3354
3353
|
import { existsSync as existsSync6, lstatSync as lstatSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
3355
3354
|
import { dirname as dirname6, resolve as resolve5 } from "node:path";
|
|
3356
3355
|
class WorkspaceSnapshotBuilder {
|
|
3357
|
-
workspaceRoot;
|
|
3358
|
-
snapshots = new Map;
|
|
3359
3356
|
constructor(workspaceRoot) {
|
|
3360
3357
|
this.workspaceRoot = workspaceRoot;
|
|
3358
|
+
this.snapshots = new Map;
|
|
3361
3359
|
}
|
|
3362
3360
|
build(operations) {
|
|
3363
3361
|
this.add(this.workspaceRoot, false);
|
|
@@ -3401,8 +3399,10 @@ function snapshotOperations(operations, workspaceRoot) {
|
|
|
3401
3399
|
|
|
3402
3400
|
// ../lsp-core/src/lsp/workspace-edit-plan.ts
|
|
3403
3401
|
class PlanPathIndex {
|
|
3404
|
-
|
|
3405
|
-
|
|
3402
|
+
constructor() {
|
|
3403
|
+
this.firstChangeByPath = new Map;
|
|
3404
|
+
this.reportedPathByCanonical = new Map;
|
|
3405
|
+
}
|
|
3406
3406
|
build(operations) {
|
|
3407
3407
|
for (const operation of operations) {
|
|
3408
3408
|
switch (operation.kind) {
|
|
@@ -3491,14 +3491,11 @@ function isRecord4(value) {
|
|
|
3491
3491
|
}
|
|
3492
3492
|
|
|
3493
3493
|
class WorkspaceMutationController {
|
|
3494
|
-
workspaceRoot;
|
|
3495
|
-
documents;
|
|
3496
|
-
activeLease = null;
|
|
3497
|
-
nextLeaseId = 1;
|
|
3498
|
-
io;
|
|
3499
3494
|
constructor(workspaceRoot, documents) {
|
|
3500
3495
|
this.workspaceRoot = workspaceRoot;
|
|
3501
3496
|
this.documents = documents;
|
|
3497
|
+
this.activeLease = null;
|
|
3498
|
+
this.nextLeaseId = 1;
|
|
3502
3499
|
}
|
|
3503
3500
|
setIo(io) {
|
|
3504
3501
|
this.io = io;
|
|
@@ -3611,12 +3608,9 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
|
|
|
3611
3608
|
var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
|
|
3612
3609
|
|
|
3613
3610
|
class LspClient extends LspClientConnection {
|
|
3614
|
-
diagnosticPullErrors = [];
|
|
3615
|
-
documents;
|
|
3616
|
-
workspaceMutations;
|
|
3617
|
-
diagnosticsFreshnessTimeoutMs;
|
|
3618
3611
|
constructor(root, server2, options = {}) {
|
|
3619
3612
|
super(root, server2, options);
|
|
3613
|
+
this.diagnosticPullErrors = [];
|
|
3620
3614
|
this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
|
|
3621
3615
|
this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
|
|
3622
3616
|
versionlessPublishQuiescenceMs: options.versionlessPublishQuiescenceMs ?? VERSIONLESS_PUBLISH_QUIESCENCE_MS
|
|
@@ -3671,6 +3665,18 @@ class LspClient extends LspClientConnection {
|
|
|
3671
3665
|
textDocument: { uri: pathToFileURL3(absPath).href }
|
|
3672
3666
|
}, options);
|
|
3673
3667
|
}
|
|
3668
|
+
async formatDocument(filePath, options, signal) {
|
|
3669
|
+
if (!this.isDocumentFormattingSupported())
|
|
3670
|
+
return null;
|
|
3671
|
+
const absPath = this.resolveWorkspacePath(filePath);
|
|
3672
|
+
await this.openFile(absPath);
|
|
3673
|
+
const requestOptions = signal === undefined ? {} : { signal };
|
|
3674
|
+
const edits = await this.sendRequest("textDocument/formatting", {
|
|
3675
|
+
textDocument: { uri: pathToFileURL3(absPath).href },
|
|
3676
|
+
options
|
|
3677
|
+
}, requestOptions);
|
|
3678
|
+
return edits ?? [];
|
|
3679
|
+
}
|
|
3674
3680
|
async workspaceSymbols(query, signal) {
|
|
3675
3681
|
const options = signal === undefined ? {} : { signal };
|
|
3676
3682
|
return this.sendRequest("workspace/symbol", { query }, options);
|
|
@@ -3916,18 +3922,14 @@ function awaitWithSignal2(promise, signal) {
|
|
|
3916
3922
|
}
|
|
3917
3923
|
|
|
3918
3924
|
class LspManager {
|
|
3919
|
-
clients = new Map;
|
|
3920
|
-
reaperHandle = null;
|
|
3921
|
-
signalDisposer = null;
|
|
3922
|
-
disposed = false;
|
|
3923
|
-
idleTimeoutMs;
|
|
3924
|
-
initTimeoutMs;
|
|
3925
|
-
reaperIntervalMs;
|
|
3926
|
-
clientFactory;
|
|
3927
|
-
now;
|
|
3928
3925
|
constructor(options = {}) {
|
|
3926
|
+
this.clients = new Map;
|
|
3927
|
+
this.reaperHandle = null;
|
|
3928
|
+
this.signalDisposer = null;
|
|
3929
|
+
this.disposed = false;
|
|
3929
3930
|
this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
3930
3931
|
this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
3932
|
+
this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
|
|
3931
3933
|
this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
|
|
3932
3934
|
this.clientFactory = options.clientFactory ?? ((root, server2) => new LspClient(root, server2));
|
|
3933
3935
|
this.now = options.now ?? (() => Date.now());
|
|
@@ -3961,6 +3963,26 @@ class LspManager {
|
|
|
3961
3963
|
}
|
|
3962
3964
|
}
|
|
3963
3965
|
}
|
|
3966
|
+
evictForAdmission() {
|
|
3967
|
+
while (this.clients.size >= this.maxResidentClients) {
|
|
3968
|
+
const victim = this.leastRecentlyUsedIdleClient();
|
|
3969
|
+
if (!victim)
|
|
3970
|
+
return;
|
|
3971
|
+
this.clients.delete(victim.key);
|
|
3972
|
+
stopClientBestEffort(victim.managed.client);
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
leastRecentlyUsedIdleClient() {
|
|
3976
|
+
let candidate = null;
|
|
3977
|
+
for (const [key, managed] of this.clients) {
|
|
3978
|
+
if (managed.refCount > 0 || managed.pendingWaiters > 0 || managed.isInitializing)
|
|
3979
|
+
continue;
|
|
3980
|
+
if (candidate === null || managed.lastUsedAt < candidate.managed.lastUsedAt) {
|
|
3981
|
+
candidate = { key, managed };
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
return candidate;
|
|
3985
|
+
}
|
|
3964
3986
|
async tryDeleteIfOrphaned(key, managed) {
|
|
3965
3987
|
if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
|
|
3966
3988
|
this.clients.delete(key);
|
|
@@ -4007,6 +4029,7 @@ class LspManager {
|
|
|
4007
4029
|
managed.lastUsedAt = this.now();
|
|
4008
4030
|
return managed.client;
|
|
4009
4031
|
}
|
|
4032
|
+
this.evictForAdmission();
|
|
4010
4033
|
const client = this.clientFactory(root, server2);
|
|
4011
4034
|
const initStartedAt = this.now();
|
|
4012
4035
|
const initPromise = (async () => {
|
|
@@ -4069,6 +4092,7 @@ class LspManager {
|
|
|
4069
4092
|
const key = this.getKey(root, server2.id);
|
|
4070
4093
|
if (this.clients.has(key))
|
|
4071
4094
|
return;
|
|
4095
|
+
this.evictForAdmission();
|
|
4072
4096
|
const client = this.clientFactory(root, server2);
|
|
4073
4097
|
const initStartedAt = this.now();
|
|
4074
4098
|
const initPromise = (async () => {
|
|
@@ -4157,57 +4181,43 @@ async function disposeDefaultLspManager() {
|
|
|
4157
4181
|
}
|
|
4158
4182
|
}
|
|
4159
4183
|
|
|
4160
|
-
// ../lsp-core/src/lsp/
|
|
4161
|
-
import { existsSync as existsSync7,
|
|
4162
|
-
import { dirname as dirname7 } from "node:path";
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4184
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
4185
|
+
import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
|
|
4186
|
+
import { dirname as dirname7, join as join3 } from "node:path";
|
|
4187
|
+
|
|
4188
|
+
// ../lsp-core/src/lsp/workspace-markers.ts
|
|
4189
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4190
|
+
|
|
4191
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
4192
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
4193
|
+
const marked = nearestMarkedAncestor(directory);
|
|
4194
|
+
if (marked !== undefined)
|
|
4195
|
+
return marked;
|
|
4196
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
4197
|
+
}
|
|
4198
|
+
function nearestMarkedAncestor(directory) {
|
|
4199
|
+
let current = directory;
|
|
4200
|
+
for (;; ) {
|
|
4201
|
+
if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
|
|
4202
|
+
return realpathSync4(current);
|
|
4203
|
+
}
|
|
4204
|
+
const parent = dirname7(current);
|
|
4205
|
+
if (parent === current)
|
|
4206
|
+
return;
|
|
4207
|
+
current = parent;
|
|
4175
4208
|
}
|
|
4176
4209
|
}
|
|
4177
|
-
function
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
}
|
|
4185
|
-
|
|
4186
|
-
return value === "declined" || value === "allowed";
|
|
4187
|
-
}
|
|
4188
|
-
function writeInstallDecisions(decisions) {
|
|
4189
|
-
const path2 = getInstallDecisionsPath();
|
|
4190
|
-
mkdirSync3(dirname7(path2), { recursive: true });
|
|
4191
|
-
const tmpPath = `${path2}.tmp`;
|
|
4192
|
-
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
4193
|
-
`, "utf8");
|
|
4194
|
-
renameSync2(tmpPath, path2);
|
|
4195
|
-
}
|
|
4196
|
-
function isInstallDecisions(value) {
|
|
4197
|
-
return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
4198
|
-
}
|
|
4199
|
-
function isInstallDecisionRecord(value) {
|
|
4200
|
-
if (!isRecord5(value))
|
|
4201
|
-
return false;
|
|
4202
|
-
return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
|
|
4203
|
-
}
|
|
4204
|
-
function isRecord5(value) {
|
|
4205
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4210
|
+
function nearestExistingAncestor(directory) {
|
|
4211
|
+
let current = directory;
|
|
4212
|
+
while (!existsSync7(current)) {
|
|
4213
|
+
const parent = dirname7(current);
|
|
4214
|
+
if (parent === current)
|
|
4215
|
+
return current;
|
|
4216
|
+
current = parent;
|
|
4217
|
+
}
|
|
4218
|
+
return current;
|
|
4206
4219
|
}
|
|
4207
4220
|
|
|
4208
|
-
// ../lsp-core/src/lsp/config-loader.ts
|
|
4209
|
-
import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
|
|
4210
|
-
|
|
4211
4221
|
// ../lsp-core/src/lsp/server-definitions.ts
|
|
4212
4222
|
var LSP_INSTALL_HINTS = {
|
|
4213
4223
|
typescript: "npm install -g typescript-language-server typescript",
|
|
@@ -4253,6 +4263,26 @@ var LSP_INSTALL_HINTS = {
|
|
|
4253
4263
|
julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
|
|
4254
4264
|
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"
|
|
4255
4265
|
};
|
|
4266
|
+
var LSP_LOCAL_INSTALL_HINTS = {
|
|
4267
|
+
typescript: "bun add -d typescript-language-server typescript",
|
|
4268
|
+
vue: "bun add -d @vue/language-server",
|
|
4269
|
+
eslint: "bun add -d vscode-langservers-extracted",
|
|
4270
|
+
oxlint: "bun add -d oxlint",
|
|
4271
|
+
biome: "bun add -d @biomejs/biome",
|
|
4272
|
+
svelte: "bun add -d svelte-language-server",
|
|
4273
|
+
astro: "bun add -d @astrojs/language-server",
|
|
4274
|
+
bash: "bun add -d bash-language-server",
|
|
4275
|
+
"bash-ls": "bun add -d bash-language-server",
|
|
4276
|
+
"yaml-ls": "bun add -d yaml-language-server",
|
|
4277
|
+
php: "bun add -d intelephense",
|
|
4278
|
+
prisma: "bun add -d prisma",
|
|
4279
|
+
dockerfile: "bun add -d dockerfile-language-server-nodejs",
|
|
4280
|
+
pyright: "uv add --dev pyright",
|
|
4281
|
+
basedpyright: "uv add --dev basedpyright",
|
|
4282
|
+
ruff: "uv add --dev ruff",
|
|
4283
|
+
ty: "uv add --dev ty",
|
|
4284
|
+
"ruby-lsp": "bundle add ruby-lsp --group development"
|
|
4285
|
+
};
|
|
4256
4286
|
var BUILTIN_SERVERS = {
|
|
4257
4287
|
typescript: {
|
|
4258
4288
|
command: ["typescript-language-server", "--stdio"],
|
|
@@ -4355,7 +4385,56 @@ var BUILTIN_SERVERS = {
|
|
|
4355
4385
|
}
|
|
4356
4386
|
};
|
|
4357
4387
|
|
|
4388
|
+
// ../lsp-core/src/lsp/server-install-state.ts
|
|
4389
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4390
|
+
import { dirname as dirname8 } from "node:path";
|
|
4391
|
+
function getInstallDecisionsPath() {
|
|
4392
|
+
return lspRequestContext().installDecisionsPath;
|
|
4393
|
+
}
|
|
4394
|
+
function loadInstallDecisions() {
|
|
4395
|
+
const path2 = getInstallDecisionsPath();
|
|
4396
|
+
if (!existsSync8(path2))
|
|
4397
|
+
return {};
|
|
4398
|
+
try {
|
|
4399
|
+
const parsed = JSON.parse(readFileSync4(path2, "utf8"));
|
|
4400
|
+
return isInstallDecisions(parsed) ? parsed : {};
|
|
4401
|
+
} catch {
|
|
4402
|
+
return {};
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
function loadInstallDecision(serverId) {
|
|
4406
|
+
return loadInstallDecisions()[serverId];
|
|
4407
|
+
}
|
|
4408
|
+
function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
|
|
4409
|
+
const decisions = loadInstallDecisions();
|
|
4410
|
+
decisions[serverId] = { decision, decidedAt };
|
|
4411
|
+
writeInstallDecisions(decisions);
|
|
4412
|
+
}
|
|
4413
|
+
function isInstallDecision(value) {
|
|
4414
|
+
return value === "declined" || value === "allowed";
|
|
4415
|
+
}
|
|
4416
|
+
function writeInstallDecisions(decisions) {
|
|
4417
|
+
const path2 = getInstallDecisionsPath();
|
|
4418
|
+
mkdirSync3(dirname8(path2), { recursive: true });
|
|
4419
|
+
const tmpPath = `${path2}.tmp`;
|
|
4420
|
+
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
4421
|
+
`, "utf8");
|
|
4422
|
+
renameSync2(tmpPath, path2);
|
|
4423
|
+
}
|
|
4424
|
+
function isInstallDecisions(value) {
|
|
4425
|
+
return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
4426
|
+
}
|
|
4427
|
+
function isInstallDecisionRecord(value) {
|
|
4428
|
+
if (!isRecord5(value))
|
|
4429
|
+
return false;
|
|
4430
|
+
return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
|
|
4431
|
+
}
|
|
4432
|
+
function isRecord5(value) {
|
|
4433
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4434
|
+
}
|
|
4435
|
+
|
|
4358
4436
|
// ../lsp-core/src/lsp/config-loader.ts
|
|
4437
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
|
|
4359
4438
|
function getProjectConfigPaths() {
|
|
4360
4439
|
return lspRequestContext().projectConfigPaths;
|
|
4361
4440
|
}
|
|
@@ -4363,7 +4442,7 @@ function getUserConfigPath() {
|
|
|
4363
4442
|
return lspRequestContext().userConfigPath;
|
|
4364
4443
|
}
|
|
4365
4444
|
function loadJsonFile(path2) {
|
|
4366
|
-
if (!
|
|
4445
|
+
if (!existsSync9(path2))
|
|
4367
4446
|
return null;
|
|
4368
4447
|
try {
|
|
4369
4448
|
const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
|
|
@@ -4551,54 +4630,155 @@ function getDisabledServerIds() {
|
|
|
4551
4630
|
}
|
|
4552
4631
|
|
|
4553
4632
|
// ../lsp-core/src/lsp/server-installation.ts
|
|
4554
|
-
import { existsSync as
|
|
4555
|
-
import { delimiter as delimiter3, join as
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4633
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
4634
|
+
import { delimiter as delimiter3, dirname as dirname9, isAbsolute as isAbsolute5, join as join4, resolve as resolve7 } from "node:path";
|
|
4635
|
+
var LOCAL_BIN_RULES = [
|
|
4636
|
+
{
|
|
4637
|
+
markers: ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"],
|
|
4638
|
+
binDirs: [join4("node_modules", ".bin")]
|
|
4639
|
+
},
|
|
4640
|
+
{
|
|
4641
|
+
markers: [
|
|
4642
|
+
"pyproject.toml",
|
|
4643
|
+
"ty.toml",
|
|
4644
|
+
"requirements.txt",
|
|
4645
|
+
"setup.py",
|
|
4646
|
+
"setup.cfg",
|
|
4647
|
+
"Pipfile",
|
|
4648
|
+
"pyrightconfig.json",
|
|
4649
|
+
"ruff.toml",
|
|
4650
|
+
".ruff.toml"
|
|
4651
|
+
],
|
|
4652
|
+
binDirs: [
|
|
4653
|
+
join4(".venv", "bin"),
|
|
4654
|
+
join4(".venv", "Scripts"),
|
|
4655
|
+
join4("venv", "bin"),
|
|
4656
|
+
join4("venv", "Scripts"),
|
|
4657
|
+
join4(".env", "bin"),
|
|
4658
|
+
join4(".env", "Scripts")
|
|
4659
|
+
]
|
|
4660
|
+
},
|
|
4661
|
+
{
|
|
4662
|
+
markers: ["Gemfile", "Gemfile.lock"],
|
|
4663
|
+
binDirs: [join4("vendor", "bundle", "bin"), "bin"]
|
|
4664
|
+
},
|
|
4665
|
+
{
|
|
4666
|
+
markers: ["go.mod", "go.sum", "go.work"],
|
|
4667
|
+
binDirs: ["bin"]
|
|
4668
|
+
}
|
|
4669
|
+
];
|
|
4670
|
+
var resolutionCache = new Map;
|
|
4671
|
+
var probeCount = 0;
|
|
4672
|
+
function probe(path2) {
|
|
4673
|
+
probeCount += 1;
|
|
4674
|
+
return existsSync10(path2);
|
|
4675
|
+
}
|
|
4676
|
+
function executableSuffixes(platform, pathExt) {
|
|
4677
|
+
if (platform !== "win32")
|
|
4678
|
+
return [""];
|
|
4679
|
+
const configured = pathExt ?? process.env["PATHEXT"] ?? "";
|
|
4680
|
+
const systemExts = configured.split(";").filter((entry) => entry.length > 0).map((entry) => entry.toLowerCase());
|
|
4681
|
+
return [...new Set(["", ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
|
|
4682
|
+
}
|
|
4683
|
+
function probeWithSuffixes(directory, command, suffixes) {
|
|
4684
|
+
for (const suffix of suffixes) {
|
|
4685
|
+
const candidate = join4(directory, command + suffix);
|
|
4686
|
+
if (probe(candidate))
|
|
4687
|
+
return candidate;
|
|
4565
4688
|
}
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4689
|
+
return null;
|
|
4690
|
+
}
|
|
4691
|
+
function resolveLocal(command, workingDirectory, suffixes, stopAt) {
|
|
4692
|
+
const boundary = stopAt === undefined ? undefined : resolve7(stopAt);
|
|
4693
|
+
let current = resolve7(workingDirectory);
|
|
4694
|
+
while (true) {
|
|
4695
|
+
for (const rule of LOCAL_BIN_RULES) {
|
|
4696
|
+
if (!rule.markers.some((marker) => probe(join4(current, marker))))
|
|
4697
|
+
continue;
|
|
4698
|
+
for (const binDir of rule.binDirs) {
|
|
4699
|
+
const found = probeWithSuffixes(join4(current, binDir), command, suffixes);
|
|
4700
|
+
if (found !== null)
|
|
4701
|
+
return found;
|
|
4702
|
+
}
|
|
4575
4703
|
}
|
|
4704
|
+
if (probe(join4(current, ".git")))
|
|
4705
|
+
return null;
|
|
4706
|
+
if (boundary !== undefined && current === boundary)
|
|
4707
|
+
return null;
|
|
4708
|
+
const parent = dirname9(current);
|
|
4709
|
+
if (parent === current)
|
|
4710
|
+
return null;
|
|
4711
|
+
current = parent;
|
|
4576
4712
|
}
|
|
4577
|
-
|
|
4578
|
-
|
|
4713
|
+
}
|
|
4714
|
+
function resolveFromPath(command, suffixes, platform, pathEnvOverride) {
|
|
4715
|
+
let pathEnv = pathEnvOverride ?? process.env["PATH"] ?? "";
|
|
4716
|
+
if (platform === "win32" && !pathEnv) {
|
|
4579
4717
|
pathEnv = process.env["Path"] ?? "";
|
|
4580
4718
|
}
|
|
4581
|
-
const
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
}
|
|
4719
|
+
for (const entry of pathEnv.split(delimiter3)) {
|
|
4720
|
+
if (entry.length === 0)
|
|
4721
|
+
continue;
|
|
4722
|
+
const found = probeWithSuffixes(entry, command, suffixes);
|
|
4723
|
+
if (found !== null)
|
|
4724
|
+
return found;
|
|
4588
4725
|
}
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4726
|
+
return null;
|
|
4727
|
+
}
|
|
4728
|
+
function resolveServerBinary(command, workingDirectory, options = {}) {
|
|
4729
|
+
if (command.length === 0)
|
|
4730
|
+
return null;
|
|
4731
|
+
const [cmd] = command;
|
|
4732
|
+
if (cmd === undefined || cmd.length === 0)
|
|
4733
|
+
return null;
|
|
4734
|
+
const platform = options.platform ?? process.platform;
|
|
4735
|
+
const suffixes = executableSuffixes(platform, options.pathExt);
|
|
4736
|
+
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
4737
|
+
const explicit = isAbsolute5(cmd) ? cmd : resolve7(workingDirectory ?? process.cwd(), cmd);
|
|
4738
|
+
return probe(explicit) ? explicit : null;
|
|
4739
|
+
}
|
|
4740
|
+
const cacheKey = JSON.stringify([
|
|
4741
|
+
workingDirectory ?? "",
|
|
4742
|
+
cmd,
|
|
4743
|
+
platform,
|
|
4744
|
+
options.stopAt ?? "",
|
|
4745
|
+
options.pathExt ?? "",
|
|
4746
|
+
options.pathEnv ?? process.env["PATH"] ?? ""
|
|
4747
|
+
]);
|
|
4748
|
+
const cached = resolutionCache.get(cacheKey);
|
|
4749
|
+
if (cached !== undefined)
|
|
4750
|
+
return cached;
|
|
4751
|
+
let resolved = null;
|
|
4752
|
+
if (workingDirectory !== undefined && workingDirectory.length > 0) {
|
|
4753
|
+
resolved = resolveLocal(cmd, workingDirectory, suffixes, options.stopAt);
|
|
4754
|
+
}
|
|
4755
|
+
resolved ??= resolveFromPath(cmd, suffixes, platform, options.pathEnv);
|
|
4756
|
+
if (resolved === null && cmd === "node")
|
|
4757
|
+
resolved = cmd;
|
|
4758
|
+
resolutionCache.set(cacheKey, resolved);
|
|
4759
|
+
return resolved;
|
|
4760
|
+
}
|
|
4761
|
+
function isServerInstalled(command, workingDirectory, options = {}) {
|
|
4762
|
+
if (command.length === 0)
|
|
4763
|
+
return false;
|
|
4764
|
+
return resolveServerBinary(command, workingDirectory, options) !== null;
|
|
4592
4765
|
}
|
|
4593
4766
|
|
|
4594
4767
|
// ../lsp-core/src/lsp/server-resolution.ts
|
|
4768
|
+
function withResolvedCommand(command, binaryPath) {
|
|
4769
|
+
return [binaryPath, ...command.slice(1)];
|
|
4770
|
+
}
|
|
4595
4771
|
function findServerForExtension(ext) {
|
|
4596
4772
|
const servers = getMergedServers();
|
|
4773
|
+
const workingDirectory = contextCwd();
|
|
4597
4774
|
for (const server2 of servers) {
|
|
4598
|
-
if (server2.extensions.includes(ext)
|
|
4775
|
+
if (!server2.extensions.includes(ext))
|
|
4776
|
+
continue;
|
|
4777
|
+
const binaryPath = resolveServerBinary(server2.command, workingDirectory);
|
|
4778
|
+
if (binaryPath !== null) {
|
|
4599
4779
|
const resolvedServer = {
|
|
4600
4780
|
id: server2.id,
|
|
4601
|
-
command: server2.command,
|
|
4781
|
+
command: withResolvedCommand(server2.command, binaryPath),
|
|
4602
4782
|
extensions: server2.extensions,
|
|
4603
4783
|
priority: server2.priority
|
|
4604
4784
|
};
|
|
@@ -4645,6 +4825,7 @@ function findServerForExtension(ext) {
|
|
|
4645
4825
|
function getAllServers() {
|
|
4646
4826
|
const servers = getMergedServers();
|
|
4647
4827
|
const disabled = getDisabledServerIds();
|
|
4828
|
+
const workingDirectory = contextCwd();
|
|
4648
4829
|
const result = [];
|
|
4649
4830
|
const seen = new Set;
|
|
4650
4831
|
for (const server2 of servers) {
|
|
@@ -4652,7 +4833,7 @@ function getAllServers() {
|
|
|
4652
4833
|
continue;
|
|
4653
4834
|
result.push({
|
|
4654
4835
|
id: server2.id,
|
|
4655
|
-
installed: isServerInstalled(server2.command),
|
|
4836
|
+
installed: isServerInstalled(server2.command, workingDirectory),
|
|
4656
4837
|
extensions: server2.extensions,
|
|
4657
4838
|
disabled: false,
|
|
4658
4839
|
source: server2.source,
|
|
@@ -4666,7 +4847,7 @@ function getAllServers() {
|
|
|
4666
4847
|
const builtin = BUILTIN_SERVERS[id];
|
|
4667
4848
|
result.push({
|
|
4668
4849
|
id,
|
|
4669
|
-
installed: builtin ? isServerInstalled(builtin.command) : false,
|
|
4850
|
+
installed: builtin ? isServerInstalled(builtin.command, workingDirectory) : false,
|
|
4670
4851
|
extensions: builtin?.extensions ?? [],
|
|
4671
4852
|
disabled: true,
|
|
4672
4853
|
source: "disabled",
|
|
@@ -4677,7 +4858,6 @@ function getAllServers() {
|
|
|
4677
4858
|
}
|
|
4678
4859
|
|
|
4679
4860
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4680
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4681
4861
|
function isDirectoryPath(filePath) {
|
|
4682
4862
|
try {
|
|
4683
4863
|
return statSync4(filePath).isDirectory();
|
|
@@ -4686,32 +4866,85 @@ function isDirectoryPath(filePath) {
|
|
|
4686
4866
|
}
|
|
4687
4867
|
}
|
|
4688
4868
|
function findWorkspaceRoot(filePath) {
|
|
4689
|
-
const
|
|
4869
|
+
const cwd = contextCwd();
|
|
4870
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4690
4871
|
let dir = abs;
|
|
4691
4872
|
if (!isDirectoryPath(dir)) {
|
|
4692
|
-
dir =
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4873
|
+
dir = dirname10(dir);
|
|
4874
|
+
}
|
|
4875
|
+
if (!isPathInside(cwd, abs))
|
|
4876
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4877
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4878
|
+
while (isPathInside(cwd, dir)) {
|
|
4879
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4880
|
+
if (canonicalDir !== undefined) {
|
|
4881
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4882
|
+
if (existsSync11(join5(dir, marker))) {
|
|
4883
|
+
return canonicalDir;
|
|
4884
|
+
}
|
|
4699
4885
|
}
|
|
4700
4886
|
}
|
|
4701
|
-
|
|
4702
|
-
|
|
4887
|
+
if (dir === cwd)
|
|
4888
|
+
break;
|
|
4889
|
+
dir = dirname10(dir);
|
|
4703
4890
|
}
|
|
4704
|
-
return
|
|
4891
|
+
return fallbackRoot;
|
|
4892
|
+
}
|
|
4893
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4894
|
+
const cwd = contextCwd();
|
|
4895
|
+
const abs = resolve8(cwd, filePath);
|
|
4896
|
+
if (isPathInside(cwd, abs))
|
|
4897
|
+
return abs;
|
|
4898
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4899
|
+
if (rebased !== undefined)
|
|
4900
|
+
return rebased;
|
|
4901
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4705
4902
|
}
|
|
4706
4903
|
function resolvePathInsideContext(filePath) {
|
|
4707
4904
|
const cwd = contextCwd();
|
|
4708
|
-
const abs =
|
|
4905
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4709
4906
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4710
4907
|
if (!isPathInside(cwd, canonical)) {
|
|
4711
4908
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4712
4909
|
}
|
|
4713
4910
|
return canonical;
|
|
4714
4911
|
}
|
|
4912
|
+
function rebaseThroughCanonicalAncestor(path2, cwd) {
|
|
4913
|
+
let current = path2;
|
|
4914
|
+
const suffix = [];
|
|
4915
|
+
while (true) {
|
|
4916
|
+
if (existsSync11(current)) {
|
|
4917
|
+
const canonical = realpathSync5(current);
|
|
4918
|
+
if (isPathInside(cwd, canonical))
|
|
4919
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4920
|
+
}
|
|
4921
|
+
const parent = dirname10(current);
|
|
4922
|
+
if (parent === current)
|
|
4923
|
+
return;
|
|
4924
|
+
suffix.unshift(basename3(current));
|
|
4925
|
+
current = parent;
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4929
|
+
if (!existsSync11(directory))
|
|
4930
|
+
return;
|
|
4931
|
+
const canonical = realpathSync5(directory);
|
|
4932
|
+
if (!statSync4(canonical).isDirectory())
|
|
4933
|
+
return;
|
|
4934
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4935
|
+
}
|
|
4936
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4937
|
+
let current = directory;
|
|
4938
|
+
while (isPathInside(cwd, current)) {
|
|
4939
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4940
|
+
if (canonical !== undefined)
|
|
4941
|
+
return canonical;
|
|
4942
|
+
if (current === cwd)
|
|
4943
|
+
return;
|
|
4944
|
+
current = dirname10(current);
|
|
4945
|
+
}
|
|
4946
|
+
return;
|
|
4947
|
+
}
|
|
4715
4948
|
function formatServerLookupError(result) {
|
|
4716
4949
|
if (result.status === "not_installed") {
|
|
4717
4950
|
return formatNotInstalled(result);
|
|
@@ -4735,6 +4968,19 @@ function formatServerLookupError(result) {
|
|
|
4735
4968
|
].join(`
|
|
4736
4969
|
`);
|
|
4737
4970
|
}
|
|
4971
|
+
function formatInstallOptions(serverId, installHint) {
|
|
4972
|
+
const localHint = LSP_LOCAL_INSTALL_HINTS[serverId];
|
|
4973
|
+
if (localHint === undefined) {
|
|
4974
|
+
return ["To install, run:", ` ${installHint}`];
|
|
4975
|
+
}
|
|
4976
|
+
return [
|
|
4977
|
+
"To install in THIS repository (preferred — no global install needed):",
|
|
4978
|
+
` ${localHint}`,
|
|
4979
|
+
"",
|
|
4980
|
+
"Or install it globally:",
|
|
4981
|
+
` ${installHint}`
|
|
4982
|
+
];
|
|
4983
|
+
}
|
|
4738
4984
|
function formatNotInstalled(result) {
|
|
4739
4985
|
const { server: server2, installHint } = result;
|
|
4740
4986
|
const extensions = server2.extensions.join(", ");
|
|
@@ -4749,19 +4995,19 @@ function formatNotInstalled(result) {
|
|
|
4749
4995
|
`Command not found: ${server2.command[0]}`,
|
|
4750
4996
|
""
|
|
4751
4997
|
];
|
|
4998
|
+
const installOptions = formatInstallOptions(server2.id, installHint);
|
|
4752
4999
|
if (decision === "allowed") {
|
|
4753
5000
|
return [
|
|
4754
5001
|
...header,
|
|
4755
5002
|
"The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
|
|
4756
|
-
|
|
5003
|
+
...installOptions.slice(1)
|
|
4757
5004
|
].join(`
|
|
4758
5005
|
`);
|
|
4759
5006
|
}
|
|
4760
5007
|
if (!context.capabilities.installDecisionTool) {
|
|
4761
5008
|
return [
|
|
4762
5009
|
...header,
|
|
4763
|
-
|
|
4764
|
-
` ${installHint}`,
|
|
5010
|
+
...installOptions,
|
|
4765
5011
|
"",
|
|
4766
5012
|
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
4767
5013
|
"Install-decision recording is unavailable in this harness; proceed without LSP if the user declines."
|
|
@@ -4770,8 +5016,7 @@ function formatNotInstalled(result) {
|
|
|
4770
5016
|
}
|
|
4771
5017
|
return [
|
|
4772
5018
|
...header,
|
|
4773
|
-
|
|
4774
|
-
` ${installHint}`,
|
|
5019
|
+
...installOptions,
|
|
4775
5020
|
"",
|
|
4776
5021
|
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
4777
5022
|
"- If the user agrees: run the install command above, then retry this tool.",
|
|
@@ -4782,7 +5027,7 @@ function formatNotInstalled(result) {
|
|
|
4782
5027
|
].join(`
|
|
4783
5028
|
`);
|
|
4784
5029
|
}
|
|
4785
|
-
var
|
|
5030
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4786
5031
|
"diagnostics",
|
|
4787
5032
|
"definition",
|
|
4788
5033
|
"references",
|
|
@@ -4791,7 +5036,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4791
5036
|
"prepareRename"
|
|
4792
5037
|
]);
|
|
4793
5038
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4794
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
5039
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4795
5040
|
if (isDirectoryPath(absPath)) {
|
|
4796
5041
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4797
5042
|
}
|
|
@@ -4806,9 +5051,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4806
5051
|
const acquireAndCall = async (allowRetry) => {
|
|
4807
5052
|
const client = await manager.getClient(root, server2, options.signal);
|
|
4808
5053
|
try {
|
|
4809
|
-
return await fn(client, root);
|
|
5054
|
+
return await fn(client, root, absPath);
|
|
4810
5055
|
} catch (err) {
|
|
4811
|
-
if (allowRetry &&
|
|
5056
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4812
5057
|
manager.invalidateClient(root, server2.id, client);
|
|
4813
5058
|
return acquireAndCall(false);
|
|
4814
5059
|
}
|
|
@@ -4826,8 +5071,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4826
5071
|
}
|
|
4827
5072
|
|
|
4828
5073
|
// ../lsp-core/src/lsp/directory-diagnostics.ts
|
|
4829
|
-
import { existsSync as
|
|
4830
|
-
import { join as
|
|
5074
|
+
import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
|
|
5075
|
+
import { join as join6, resolve as resolve9 } from "node:path";
|
|
4831
5076
|
|
|
4832
5077
|
// ../lsp-core/src/lsp/formatters.ts
|
|
4833
5078
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -4957,7 +5202,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4957
5202
|
for (const entry of entries) {
|
|
4958
5203
|
if (files.length >= maxFiles)
|
|
4959
5204
|
return;
|
|
4960
|
-
const fullPath =
|
|
5205
|
+
const fullPath = join6(currentDir, entry);
|
|
4961
5206
|
let stat;
|
|
4962
5207
|
try {
|
|
4963
5208
|
stat = lstatSync5(fullPath);
|
|
@@ -4982,8 +5227,8 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4982
5227
|
if (!extension.startsWith(".")) {
|
|
4983
5228
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4984
5229
|
}
|
|
4985
|
-
const absDir =
|
|
4986
|
-
if (!
|
|
5230
|
+
const absDir = resolve9(options.workspaceRoot ?? contextCwd(), directory);
|
|
5231
|
+
if (!existsSync12(absDir)) {
|
|
4987
5232
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4988
5233
|
}
|
|
4989
5234
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -5070,7 +5315,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
5070
5315
|
|
|
5071
5316
|
// ../lsp-core/src/lsp/infer-extension.ts
|
|
5072
5317
|
import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
|
|
5073
|
-
import { join as
|
|
5318
|
+
import { join as join7 } from "node:path";
|
|
5074
5319
|
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
5075
5320
|
var MAX_SCAN_ENTRIES = 500;
|
|
5076
5321
|
function inferExtensionFromDirectory(directory) {
|
|
@@ -5088,7 +5333,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
5088
5333
|
for (const entry of entries) {
|
|
5089
5334
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
5090
5335
|
return;
|
|
5091
|
-
const fullPath =
|
|
5336
|
+
const fullPath = join7(dir, entry);
|
|
5092
5337
|
let stat;
|
|
5093
5338
|
try {
|
|
5094
5339
|
stat = lstatSync6(fullPath);
|
|
@@ -5263,7 +5508,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5263
5508
|
const filePath = requireString(params, "filePath");
|
|
5264
5509
|
const severity = severityFilter(params);
|
|
5265
5510
|
try {
|
|
5266
|
-
const absPath =
|
|
5511
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
5267
5512
|
if (isDirectoryPath(absPath)) {
|
|
5268
5513
|
const extension = inferExtensionFromDirectory(absPath);
|
|
5269
5514
|
if (!extension) {
|
|
@@ -5292,7 +5537,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5292
5537
|
};
|
|
5293
5538
|
return text(output2.output, details2);
|
|
5294
5539
|
}
|
|
5295
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
5540
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
5296
5541
|
if (result.transientError) {
|
|
5297
5542
|
const message = result.transientError.message;
|
|
5298
5543
|
const details2 = {
|
|
@@ -5339,6 +5584,96 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5339
5584
|
throw error;
|
|
5340
5585
|
}
|
|
5341
5586
|
}
|
|
5587
|
+
// ../lsp-core/src/lsp/format-document.ts
|
|
5588
|
+
import { readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5589
|
+
var DEFAULT_FORMATTING_OPTIONS = {
|
|
5590
|
+
tabSize: 4,
|
|
5591
|
+
insertSpaces: false,
|
|
5592
|
+
trimTrailingWhitespace: true,
|
|
5593
|
+
insertFinalNewline: true,
|
|
5594
|
+
trimFinalNewlines: true
|
|
5595
|
+
};
|
|
5596
|
+
var UNCHANGED = { status: "unchanged", linesAdded: 0, linesRemoved: 0 };
|
|
5597
|
+
async function formatDocumentWithClient(client, filePath, options = {}) {
|
|
5598
|
+
const edits = await client.formatDocument(filePath, options.formattingOptions ?? DEFAULT_FORMATTING_OPTIONS, options.signal);
|
|
5599
|
+
if (edits === null)
|
|
5600
|
+
return { status: "unavailable", reason: "capability_not_advertised" };
|
|
5601
|
+
if (edits.length === 0)
|
|
5602
|
+
return UNCHANGED;
|
|
5603
|
+
const before = readFileSync6(filePath, "utf-8");
|
|
5604
|
+
const normalized = normalizeTextEdits(before, edits, 0);
|
|
5605
|
+
if (normalized.text === before)
|
|
5606
|
+
return UNCHANGED;
|
|
5607
|
+
writeAtomically(filePath, normalized.text);
|
|
5608
|
+
await client.openFile(filePath);
|
|
5609
|
+
return {
|
|
5610
|
+
status: "formatted",
|
|
5611
|
+
...lineDelta(normalized.edits)
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
function lineDelta(edits) {
|
|
5615
|
+
let linesAdded = 0;
|
|
5616
|
+
let linesRemoved = 0;
|
|
5617
|
+
for (const edit of edits) {
|
|
5618
|
+
linesRemoved += edit.range.end.line - edit.range.start.line + 1;
|
|
5619
|
+
linesAdded += edit.newText.split(`
|
|
5620
|
+
`).length;
|
|
5621
|
+
}
|
|
5622
|
+
return { linesAdded, linesRemoved };
|
|
5623
|
+
}
|
|
5624
|
+
function writeAtomically(filePath, content) {
|
|
5625
|
+
const tempPath = `${filePath}.omo-format.tmp`;
|
|
5626
|
+
writeFileSync3(tempPath, content, "utf-8");
|
|
5627
|
+
try {
|
|
5628
|
+
renameSync3(tempPath, filePath);
|
|
5629
|
+
} catch (error) {
|
|
5630
|
+
try {
|
|
5631
|
+
unlinkSync2(tempPath);
|
|
5632
|
+
} catch {}
|
|
5633
|
+
throw error;
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5636
|
+
|
|
5637
|
+
// ../lsp-core/src/tools/format.ts
|
|
5638
|
+
async function executeLspFormat(params, signal) {
|
|
5639
|
+
const filePath = requireString(params, "filePath");
|
|
5640
|
+
try {
|
|
5641
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => formatDocumentWithClient(client, resolvedFilePath, signal === undefined ? {} : { signal }), "format", clientOptions(signal));
|
|
5642
|
+
return text(describeResult(filePath, result), formatDetails(filePath, result));
|
|
5643
|
+
} catch (error) {
|
|
5644
|
+
const missingDependency = missingDependencyResult(error, {
|
|
5645
|
+
filePath,
|
|
5646
|
+
status: "unavailable",
|
|
5647
|
+
reason: "server_unavailable",
|
|
5648
|
+
linesAdded: 0,
|
|
5649
|
+
linesRemoved: 0
|
|
5650
|
+
});
|
|
5651
|
+
if (missingDependency)
|
|
5652
|
+
return missingDependency;
|
|
5653
|
+
throw error;
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
function formatDetails(filePath, result) {
|
|
5657
|
+
if (result.status === "unavailable") {
|
|
5658
|
+
return { filePath, status: "unavailable", reason: result.reason, linesAdded: 0, linesRemoved: 0 };
|
|
5659
|
+
}
|
|
5660
|
+
return {
|
|
5661
|
+
filePath,
|
|
5662
|
+
status: result.status,
|
|
5663
|
+
linesAdded: result.linesAdded,
|
|
5664
|
+
linesRemoved: result.linesRemoved
|
|
5665
|
+
};
|
|
5666
|
+
}
|
|
5667
|
+
function describeResult(filePath, result) {
|
|
5668
|
+
if (result.status === "unavailable") {
|
|
5669
|
+
return `Formatting unavailable for ${filePath}: the language server does not advertise documentFormattingProvider.`;
|
|
5670
|
+
}
|
|
5671
|
+
if (result.status === "unchanged") {
|
|
5672
|
+
return `Already formatted: ${filePath}`;
|
|
5673
|
+
}
|
|
5674
|
+
return `Formatted ${filePath} (+${result.linesAdded}/-${result.linesRemoved} lines)`;
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5342
5677
|
// ../lsp-core/src/tools/install-decision.ts
|
|
5343
5678
|
async function executeLspInstallDecision(params) {
|
|
5344
5679
|
const serverId = requireString(params, "server_id");
|
|
@@ -5367,7 +5702,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
5367
5702
|
const line = requireNumber(params, "line");
|
|
5368
5703
|
const character = requireNumber(params, "character");
|
|
5369
5704
|
try {
|
|
5370
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
5705
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
5371
5706
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
5372
5707
|
const details = { filePath, line, character, locations };
|
|
5373
5708
|
if (locations.length === 0)
|
|
@@ -5392,7 +5727,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
5392
5727
|
const character = requireNumber(params, "character");
|
|
5393
5728
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
5394
5729
|
try {
|
|
5395
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
5730
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
5396
5731
|
const references = Array.isArray(result) ? result : [];
|
|
5397
5732
|
const total = references.length;
|
|
5398
5733
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -5434,7 +5769,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
5434
5769
|
const line = requireNumber(params, "line");
|
|
5435
5770
|
const character = requireNumber(params, "character");
|
|
5436
5771
|
try {
|
|
5437
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
5772
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
5438
5773
|
const details = { filePath, line, character, result };
|
|
5439
5774
|
return text(formatPrepareRenameResult(result), details);
|
|
5440
5775
|
} catch (error) {
|
|
@@ -5455,7 +5790,7 @@ async function executeLspRename(params, signal) {
|
|
|
5455
5790
|
const character = requireNumber(params, "character");
|
|
5456
5791
|
const newName = requireString(params, "newName");
|
|
5457
5792
|
try {
|
|
5458
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
5793
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
5459
5794
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
5460
5795
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
5461
5796
|
} catch (error) {
|
|
@@ -5535,7 +5870,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
5535
5870
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
5536
5871
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
5537
5872
|
}
|
|
5538
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
5873
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
5539
5874
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
5540
5875
|
} catch (error) {
|
|
5541
5876
|
const query = optionalString(params, "query");
|
|
@@ -5671,6 +6006,16 @@ var LSP_MCP_TOOLS = [
|
|
|
5671
6006
|
}, ["filePath", "line", "character", "newName"]),
|
|
5672
6007
|
execute: executeLspRename
|
|
5673
6008
|
},
|
|
6009
|
+
{
|
|
6010
|
+
name: "format",
|
|
6011
|
+
aliases: ["lsp_format"],
|
|
6012
|
+
title: "LSP Format",
|
|
6013
|
+
description: "Format a source file with its language server and write the returned edits to disk.",
|
|
6014
|
+
inputSchema: objectSchema({
|
|
6015
|
+
filePath: { type: "string", description: "Source file path to format." }
|
|
6016
|
+
}, ["filePath"]),
|
|
6017
|
+
execute: executeLspFormat
|
|
6018
|
+
},
|
|
5674
6019
|
{
|
|
5675
6020
|
name: "install_decision",
|
|
5676
6021
|
aliases: ["lsp_install_decision"],
|
|
@@ -5771,7 +6116,10 @@ function requestedProtocolVersion(params) {
|
|
|
5771
6116
|
var CONTEXT_KEY = "_context";
|
|
5772
6117
|
|
|
5773
6118
|
class InvalidDaemonRequestError extends Error {
|
|
5774
|
-
|
|
6119
|
+
constructor() {
|
|
6120
|
+
super(...arguments);
|
|
6121
|
+
this.name = "InvalidDaemonRequestError";
|
|
6122
|
+
}
|
|
5775
6123
|
}
|
|
5776
6124
|
function extractRequestContext(raw) {
|
|
5777
6125
|
if (!isPlainRecord(raw) || raw["method"] !== "tools/call")
|
|
@@ -5887,14 +6235,17 @@ async function callToolViaDaemon(name, args, options) {
|
|
|
5887
6235
|
function callDiagnosticsViaDaemon(filePath, options) {
|
|
5888
6236
|
return callToolViaDaemon("diagnostics", { filePath, severity: "error" }, options);
|
|
5889
6237
|
}
|
|
6238
|
+
function callFormatViaDaemon(filePath, options) {
|
|
6239
|
+
return callToolViaDaemon("format", { filePath }, options);
|
|
6240
|
+
}
|
|
5890
6241
|
function currentRequestContext(env = process.env) {
|
|
5891
6242
|
const cwd = process.cwd();
|
|
5892
6243
|
const home = env["HOME"] ?? homedir3();
|
|
5893
6244
|
return parseLspRequestContext({
|
|
5894
6245
|
cwd,
|
|
5895
|
-
projectConfigPaths: [
|
|
5896
|
-
userConfigPath:
|
|
5897
|
-
installDecisionsPath:
|
|
6246
|
+
projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
|
|
6247
|
+
userConfigPath: join8(home, ".codex", "lsp-client.json"),
|
|
6248
|
+
installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
|
|
5898
6249
|
capabilities: { installDecisionTool: true }
|
|
5899
6250
|
});
|
|
5900
6251
|
}
|
|
@@ -5909,7 +6260,7 @@ function withContext(args, context) {
|
|
|
5909
6260
|
function ensureDaemonAvailable(paths, ensure, signal) {
|
|
5910
6261
|
if (!signal)
|
|
5911
6262
|
return ensure(paths);
|
|
5912
|
-
return new Promise((
|
|
6263
|
+
return new Promise((resolve10, reject) => {
|
|
5913
6264
|
let settled = false;
|
|
5914
6265
|
const finish = (run) => {
|
|
5915
6266
|
if (settled)
|
|
@@ -5924,11 +6275,11 @@ function ensureDaemonAvailable(paths, ensure, signal) {
|
|
|
5924
6275
|
return;
|
|
5925
6276
|
}
|
|
5926
6277
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
5927
|
-
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() =>
|
|
6278
|
+
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve10()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
|
|
5928
6279
|
});
|
|
5929
6280
|
}
|
|
5930
6281
|
function sendToolCall(paths, token, name, args, options) {
|
|
5931
|
-
return new Promise((
|
|
6282
|
+
return new Promise((resolve10, reject) => {
|
|
5932
6283
|
const socket = connect(paths.socket);
|
|
5933
6284
|
const requestId = allocateProxyRequestId();
|
|
5934
6285
|
let settled = false;
|
|
@@ -5981,7 +6332,7 @@ function sendToolCall(paths, token, name, args, options) {
|
|
|
5981
6332
|
}
|
|
5982
6333
|
const result = toToolResult(message, requestId);
|
|
5983
6334
|
if (result)
|
|
5984
|
-
finish(() =>
|
|
6335
|
+
finish(() => resolve10(result));
|
|
5985
6336
|
else
|
|
5986
6337
|
finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
|
|
5987
6338
|
});
|
|
@@ -6027,18 +6378,15 @@ function isRetryableTool(name) {
|
|
|
6027
6378
|
}
|
|
6028
6379
|
|
|
6029
6380
|
// src/client.ts
|
|
6030
|
-
import { statSync as statSync5 } from "node:fs";
|
|
6031
|
-
import { isAbsolute as isAbsolute5 } from "node:path";
|
|
6032
6381
|
var OMO_LSP_DAEMON_DIR2 = "OMO_LSP_DAEMON_DIR";
|
|
6033
6382
|
var OMO_LSP_DAEMON_CLI2 = "OMO_LSP_DAEMON_CLI";
|
|
6034
6383
|
var OMO_LSP_DAEMON_VERSION2 = "OMO_LSP_DAEMON_VERSION";
|
|
6035
6384
|
var DAEMON_VERSION_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
6036
6385
|
|
|
6037
6386
|
class InvalidRuntimeOverrideError2 extends Error {
|
|
6038
|
-
code = "invalid_runtime_override";
|
|
6039
|
-
reason;
|
|
6040
6387
|
constructor(reason, message) {
|
|
6041
6388
|
super(message);
|
|
6389
|
+
this.code = "invalid_runtime_override";
|
|
6042
6390
|
this.name = "InvalidRuntimeOverrideError";
|
|
6043
6391
|
this.reason = reason;
|
|
6044
6392
|
}
|
|
@@ -6058,12 +6406,12 @@ function resolveDaemonRuntime2(env, defaults) {
|
|
|
6058
6406
|
throw new InvalidRuntimeOverrideError2("paired_values_required", `${OMO_LSP_DAEMON_CLI2} and ${OMO_LSP_DAEMON_VERSION2} must be set together`);
|
|
6059
6407
|
}
|
|
6060
6408
|
if (!hasCliOverride || !hasVersionOverride) {
|
|
6061
|
-
if (!
|
|
6409
|
+
if (!isAbsolute6(defaults.cliPath)) {
|
|
6062
6410
|
throw new InvalidRuntimeOverrideError2("packaged_cli_must_be_absolute", "Packaged LSP daemon CLI path must be absolute");
|
|
6063
6411
|
}
|
|
6064
6412
|
return { cliPath: defaults.cliPath, version: validateDaemonVersion2(defaults.version) };
|
|
6065
6413
|
}
|
|
6066
|
-
if (!
|
|
6414
|
+
if (!isAbsolute6(cliOverride)) {
|
|
6067
6415
|
throw new InvalidRuntimeOverrideError2("cli_must_be_absolute", `${OMO_LSP_DAEMON_CLI2} must be an absolute path to an existing regular file`);
|
|
6068
6416
|
}
|
|
6069
6417
|
const stat = statSync5(cliOverride, { throwIfNoEntry: false });
|
|
@@ -6081,17 +6429,21 @@ function callToolViaDaemon2(name, args, options) {
|
|
|
6081
6429
|
function callDiagnosticsViaDaemon2(filePath, options) {
|
|
6082
6430
|
return callDiagnosticsViaDaemon(filePath, options);
|
|
6083
6431
|
}
|
|
6432
|
+
function callFormatViaDaemon2(filePath, options) {
|
|
6433
|
+
return callFormatViaDaemon(filePath, options);
|
|
6434
|
+
}
|
|
6084
6435
|
function currentRequestContext2(env = process.env) {
|
|
6085
6436
|
return currentRequestContext(env);
|
|
6086
6437
|
}
|
|
6087
6438
|
export {
|
|
6088
|
-
|
|
6089
|
-
resolveDaemonRuntime2 as resolveDaemonRuntime,
|
|
6090
|
-
currentRequestContext2 as currentRequestContext,
|
|
6091
|
-
callToolViaDaemon2 as callToolViaDaemon,
|
|
6092
|
-
callDiagnosticsViaDaemon2 as callDiagnosticsViaDaemon,
|
|
6093
|
-
OMO_LSP_DAEMON_VERSION2 as OMO_LSP_DAEMON_VERSION,
|
|
6094
|
-
OMO_LSP_DAEMON_DIR2 as OMO_LSP_DAEMON_DIR,
|
|
6439
|
+
InvalidRuntimeOverrideError2 as InvalidRuntimeOverrideError,
|
|
6095
6440
|
OMO_LSP_DAEMON_CLI2 as OMO_LSP_DAEMON_CLI,
|
|
6096
|
-
|
|
6441
|
+
OMO_LSP_DAEMON_DIR2 as OMO_LSP_DAEMON_DIR,
|
|
6442
|
+
OMO_LSP_DAEMON_VERSION2 as OMO_LSP_DAEMON_VERSION,
|
|
6443
|
+
callDiagnosticsViaDaemon2 as callDiagnosticsViaDaemon,
|
|
6444
|
+
callFormatViaDaemon2 as callFormatViaDaemon,
|
|
6445
|
+
callToolViaDaemon2 as callToolViaDaemon,
|
|
6446
|
+
currentRequestContext2 as currentRequestContext,
|
|
6447
|
+
resolveDaemonRuntime2 as resolveDaemonRuntime,
|
|
6448
|
+
validateDaemonVersion2 as validateDaemonVersion
|
|
6097
6449
|
};
|