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
|
@@ -23,28 +23,22 @@ var DEFAULT_MAX_DIRECTORY_FILES = 50;
|
|
|
23
23
|
var REQUEST_TIMEOUT_MS = 15000;
|
|
24
24
|
var INIT_TIMEOUT_MS = 60000;
|
|
25
25
|
var IDLE_TIMEOUT_MS = 5 * 60000;
|
|
26
|
+
var MAX_RESIDENT_CLIENTS = 6;
|
|
26
27
|
var REAPER_INTERVAL_MS = 60000;
|
|
27
28
|
var STOP_HARD_KILL_TIMEOUT_MS = 5000;
|
|
28
29
|
var STOP_SIGKILL_GRACE_MS = 1000;
|
|
29
30
|
|
|
30
31
|
// ../lsp-core/src/lsp/errors.ts
|
|
31
32
|
class LspConnectionClosedError extends Error {
|
|
32
|
-
serverId;
|
|
33
|
-
root;
|
|
34
|
-
name = "LspConnectionClosedError";
|
|
35
33
|
constructor(serverId, root, message) {
|
|
36
34
|
super(message ?? `LSP connection closed for ${serverId} at ${root}`);
|
|
37
35
|
this.serverId = serverId;
|
|
38
36
|
this.root = root;
|
|
37
|
+
this.name = "LspConnectionClosedError";
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
class LspProcessExitedError extends Error {
|
|
43
|
-
serverId;
|
|
44
|
-
root;
|
|
45
|
-
exitCode;
|
|
46
|
-
stderrTail;
|
|
47
|
-
name = "LspProcessExitedError";
|
|
48
42
|
constructor(serverId, root, exitCode, stderrTail) {
|
|
49
43
|
const stderrSuffix = stderrTail ? `
|
|
50
44
|
stderr tail: ${stderrTail}` : "";
|
|
@@ -53,46 +47,49 @@ stderr tail: ${stderrTail}` : "";
|
|
|
53
47
|
this.root = root;
|
|
54
48
|
this.exitCode = exitCode;
|
|
55
49
|
this.stderrTail = stderrTail;
|
|
50
|
+
this.name = "LspProcessExitedError";
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
class LspRequestTimeoutError extends Error {
|
|
60
|
-
method;
|
|
61
|
-
stderrTail;
|
|
62
|
-
name = "LspRequestTimeoutError";
|
|
63
55
|
constructor(method, stderrTail) {
|
|
64
56
|
const stderrSuffix = stderrTail ? `
|
|
65
57
|
recent stderr: ${stderrTail}` : "";
|
|
66
58
|
super(`LSP request timeout (method: ${method})${stderrSuffix}`);
|
|
67
59
|
this.method = method;
|
|
68
60
|
this.stderrTail = stderrTail;
|
|
61
|
+
this.name = "LspRequestTimeoutError";
|
|
69
62
|
}
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
class LspInvalidPathError extends Error {
|
|
73
|
-
|
|
66
|
+
constructor() {
|
|
67
|
+
super(...arguments);
|
|
68
|
+
this.name = "LspInvalidPathError";
|
|
69
|
+
}
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
class LspServerLookupError extends Error {
|
|
77
|
-
lookup;
|
|
78
|
-
name = "LspServerLookupError";
|
|
79
73
|
constructor(message, lookup) {
|
|
80
74
|
super(message);
|
|
81
75
|
this.lookup = lookup;
|
|
76
|
+
this.name = "LspServerLookupError";
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
79
|
|
|
85
80
|
class LspServerInitializingError extends Error {
|
|
86
|
-
originalError;
|
|
87
|
-
name = "LspServerInitializingError";
|
|
88
81
|
constructor(originalError) {
|
|
89
82
|
super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
|
|
90
83
|
this.originalError = originalError;
|
|
84
|
+
this.name = "LspServerInitializingError";
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
class LspProcessSpawnError extends Error {
|
|
95
|
-
|
|
89
|
+
constructor() {
|
|
90
|
+
super(...arguments);
|
|
91
|
+
this.name = "LspProcessSpawnError";
|
|
92
|
+
}
|
|
96
93
|
}
|
|
97
94
|
function isLspDeadConnectionError(err) {
|
|
98
95
|
return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
|
|
@@ -108,20 +105,31 @@ var METHOD_NOT_FOUND = -32601;
|
|
|
108
105
|
var INTERNAL_ERROR = -32603;
|
|
109
106
|
|
|
110
107
|
class JsonRpcConnection {
|
|
111
|
-
reader;
|
|
112
|
-
writer;
|
|
113
|
-
pendingRequests = new Map;
|
|
114
|
-
notificationHandlers = new Map;
|
|
115
|
-
requestHandlers = new Map;
|
|
116
|
-
closeHandlers = [];
|
|
117
|
-
errorHandlers = [];
|
|
118
|
-
inputBuffer = Buffer.alloc(0);
|
|
119
|
-
nextRequestId = 1;
|
|
120
|
-
listening = false;
|
|
121
|
-
disposed = false;
|
|
122
108
|
constructor(reader, writer) {
|
|
123
109
|
this.reader = reader;
|
|
124
110
|
this.writer = writer;
|
|
111
|
+
this.pendingRequests = new Map;
|
|
112
|
+
this.notificationHandlers = new Map;
|
|
113
|
+
this.requestHandlers = new Map;
|
|
114
|
+
this.closeHandlers = [];
|
|
115
|
+
this.errorHandlers = [];
|
|
116
|
+
this.inputBuffer = Buffer.alloc(0);
|
|
117
|
+
this.nextRequestId = 1;
|
|
118
|
+
this.listening = false;
|
|
119
|
+
this.disposed = false;
|
|
120
|
+
this.handleData = (chunk) => {
|
|
121
|
+
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
122
|
+
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
123
|
+
this.drainInputBuffer();
|
|
124
|
+
};
|
|
125
|
+
this.handleClose = () => {
|
|
126
|
+
for (const handler of this.closeHandlers) {
|
|
127
|
+
handler();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
this.handleStreamError = (error) => {
|
|
131
|
+
this.emitError(error);
|
|
132
|
+
};
|
|
125
133
|
}
|
|
126
134
|
listen() {
|
|
127
135
|
if (this.listening)
|
|
@@ -242,19 +250,6 @@ class JsonRpcConnection {
|
|
|
242
250
|
this.notificationHandlers.clear();
|
|
243
251
|
this.requestHandlers.clear();
|
|
244
252
|
}
|
|
245
|
-
handleData = (chunk) => {
|
|
246
|
-
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
247
|
-
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
248
|
-
this.drainInputBuffer();
|
|
249
|
-
};
|
|
250
|
-
handleClose = () => {
|
|
251
|
-
for (const handler of this.closeHandlers) {
|
|
252
|
-
handler();
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
handleStreamError = (error) => {
|
|
256
|
-
this.emitError(error);
|
|
257
|
-
};
|
|
258
253
|
drainInputBuffer() {
|
|
259
254
|
while (true) {
|
|
260
255
|
const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR);
|
|
@@ -602,31 +597,26 @@ function isPosition(value) {
|
|
|
602
597
|
|
|
603
598
|
// ../lsp-core/src/lsp/transport.ts
|
|
604
599
|
class LspClientNotStartedError extends Error {
|
|
605
|
-
serverId;
|
|
606
|
-
root;
|
|
607
|
-
name = "LspClientNotStartedError";
|
|
608
600
|
constructor(serverId, root) {
|
|
609
601
|
super("LSP client not started");
|
|
610
602
|
this.serverId = serverId;
|
|
611
603
|
this.root = root;
|
|
604
|
+
this.name = "LspClientNotStartedError";
|
|
612
605
|
}
|
|
613
606
|
}
|
|
614
607
|
|
|
615
608
|
class LspClientTransport {
|
|
616
|
-
root;
|
|
617
|
-
server;
|
|
618
|
-
proc = null;
|
|
619
|
-
connection = null;
|
|
620
|
-
stderrBuffer = [];
|
|
621
|
-
processExited = false;
|
|
622
|
-
diagnosticsStore = new Map;
|
|
623
|
-
requestTimeoutMs;
|
|
624
|
-
initializeTimeoutMs;
|
|
625
|
-
workspaceApplyEditHandler = null;
|
|
626
|
-
diagnosticPullSupported = false;
|
|
627
609
|
constructor(root, server, timeouts = {}) {
|
|
628
610
|
this.root = root;
|
|
629
611
|
this.server = server;
|
|
612
|
+
this.proc = null;
|
|
613
|
+
this.connection = null;
|
|
614
|
+
this.stderrBuffer = [];
|
|
615
|
+
this.processExited = false;
|
|
616
|
+
this.diagnosticsStore = new Map;
|
|
617
|
+
this.workspaceApplyEditHandler = null;
|
|
618
|
+
this.diagnosticPullSupported = false;
|
|
619
|
+
this.documentFormattingSupported = false;
|
|
630
620
|
this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
|
|
631
621
|
this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
632
622
|
}
|
|
@@ -648,6 +638,12 @@ class LspClientTransport {
|
|
|
648
638
|
isDiagnosticPullSupported() {
|
|
649
639
|
return this.diagnosticPullSupported;
|
|
650
640
|
}
|
|
641
|
+
setDocumentFormattingSupported(supported) {
|
|
642
|
+
this.documentFormattingSupported = supported;
|
|
643
|
+
}
|
|
644
|
+
isDocumentFormattingSupported() {
|
|
645
|
+
return this.documentFormattingSupported;
|
|
646
|
+
}
|
|
651
647
|
handlePublishDiagnostics(params) {
|
|
652
648
|
this.diagnosticsStore.set(params.uri, [...params.diagnostics]);
|
|
653
649
|
}
|
|
@@ -861,6 +857,14 @@ function supportsDiagnosticPull(capabilities) {
|
|
|
861
857
|
return false;
|
|
862
858
|
return Object.hasOwn(capabilities, "diagnosticProvider");
|
|
863
859
|
}
|
|
860
|
+
function supportsDocumentFormatting(capabilities) {
|
|
861
|
+
if (capabilities === undefined)
|
|
862
|
+
return false;
|
|
863
|
+
const provider = capabilities.documentFormattingProvider;
|
|
864
|
+
if (provider === undefined || provider === null || provider === false)
|
|
865
|
+
return false;
|
|
866
|
+
return provider === true || typeof provider === "object";
|
|
867
|
+
}
|
|
864
868
|
|
|
865
869
|
class LspClientConnection extends LspClientTransport {
|
|
866
870
|
async initialize() {
|
|
@@ -877,6 +881,7 @@ class LspClientConnection extends LspClientTransport {
|
|
|
877
881
|
references: {},
|
|
878
882
|
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
879
883
|
publishDiagnostics: {},
|
|
884
|
+
formatting: { dynamicRegistration: false },
|
|
880
885
|
rename: {
|
|
881
886
|
prepareSupport: true,
|
|
882
887
|
prepareSupportDefaultBehavior: 1
|
|
@@ -918,6 +923,7 @@ class LspClientConnection extends LspClientTransport {
|
|
|
918
923
|
initializationOptions: this.server.initialization
|
|
919
924
|
}, { timeoutMs: this.initializeTimeoutMs });
|
|
920
925
|
this.setDiagnosticPullSupported(supportsDiagnosticPull(result?.capabilities));
|
|
926
|
+
this.setDocumentFormattingSupported(supportsDocumentFormatting(result?.capabilities));
|
|
921
927
|
await this.sendNotification("initialized", {});
|
|
922
928
|
await this.sendNotification("workspace/didChangeConfiguration", {
|
|
923
929
|
settings: { json: { validate: { enable: true } } }
|
|
@@ -1133,16 +1139,12 @@ function movedPath(candidate, oldPath, newPath) {
|
|
|
1133
1139
|
}
|
|
1134
1140
|
|
|
1135
1141
|
class WorkspaceDocumentState {
|
|
1136
|
-
sendNotification;
|
|
1137
|
-
clearDiagnostics;
|
|
1138
|
-
openDocuments = new Map;
|
|
1139
|
-
openByUri = new Map;
|
|
1140
|
-
openPromises = new Map;
|
|
1141
|
-
now;
|
|
1142
|
-
versionlessPublishQuiescenceMs;
|
|
1143
1142
|
constructor(sendNotification, clearDiagnostics, options = {}) {
|
|
1144
1143
|
this.sendNotification = sendNotification;
|
|
1145
1144
|
this.clearDiagnostics = clearDiagnostics;
|
|
1145
|
+
this.openDocuments = new Map;
|
|
1146
|
+
this.openByUri = new Map;
|
|
1147
|
+
this.openPromises = new Map;
|
|
1146
1148
|
this.now = options.now ?? (() => Date.now());
|
|
1147
1149
|
this.versionlessPublishQuiescenceMs = options.versionlessPublishQuiescenceMs ?? DEFAULT_VERSIONLESS_PUBLISH_QUIESCENCE_MS;
|
|
1148
1150
|
}
|
|
@@ -1406,13 +1408,11 @@ import { dirname, isAbsolute, relative as relative2, resolve as resolve2 } from
|
|
|
1406
1408
|
import { fileURLToPath } from "node:url";
|
|
1407
1409
|
|
|
1408
1410
|
class WorkspaceEditPathError extends Error {
|
|
1409
|
-
path;
|
|
1410
|
-
detail;
|
|
1411
|
-
name = "WorkspaceEditPathError";
|
|
1412
1411
|
constructor(path, detail) {
|
|
1413
1412
|
super(`${detail}: ${path}`);
|
|
1414
1413
|
this.path = path;
|
|
1415
1414
|
this.detail = detail;
|
|
1415
|
+
this.name = "WorkspaceEditPathError";
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
function isPathInsideWorkspace(filePath, workspaceRoot) {
|
|
@@ -1704,13 +1704,11 @@ function canonicalFingerprint(operations) {
|
|
|
1704
1704
|
|
|
1705
1705
|
// ../lsp-core/src/lsp/workspace-edit-types.ts
|
|
1706
1706
|
class WorkspaceEditValidationError extends Error {
|
|
1707
|
-
changeIndex;
|
|
1708
|
-
detail;
|
|
1709
|
-
name = "WorkspaceEditValidationError";
|
|
1710
1707
|
constructor(changeIndex, detail) {
|
|
1711
1708
|
super(`change ${changeIndex}: ${detail}`);
|
|
1712
1709
|
this.changeIndex = changeIndex;
|
|
1713
1710
|
this.detail = detail;
|
|
1711
|
+
this.name = "WorkspaceEditValidationError";
|
|
1714
1712
|
}
|
|
1715
1713
|
}
|
|
1716
1714
|
|
|
@@ -2208,10 +2206,9 @@ function simulateDelete(operation, virtual) {
|
|
|
2208
2206
|
import { existsSync as existsSync4, lstatSync as lstatSync3, readdirSync as readdirSync2 } from "node:fs";
|
|
2209
2207
|
import { dirname as dirname3, resolve as resolve4 } from "node:path";
|
|
2210
2208
|
class WorkspaceSnapshotBuilder {
|
|
2211
|
-
workspaceRoot;
|
|
2212
|
-
snapshots = new Map;
|
|
2213
2209
|
constructor(workspaceRoot) {
|
|
2214
2210
|
this.workspaceRoot = workspaceRoot;
|
|
2211
|
+
this.snapshots = new Map;
|
|
2215
2212
|
}
|
|
2216
2213
|
build(operations) {
|
|
2217
2214
|
this.add(this.workspaceRoot, false);
|
|
@@ -2255,8 +2252,10 @@ function snapshotOperations(operations, workspaceRoot) {
|
|
|
2255
2252
|
|
|
2256
2253
|
// ../lsp-core/src/lsp/workspace-edit-plan.ts
|
|
2257
2254
|
class PlanPathIndex {
|
|
2258
|
-
|
|
2259
|
-
|
|
2255
|
+
constructor() {
|
|
2256
|
+
this.firstChangeByPath = new Map;
|
|
2257
|
+
this.reportedPathByCanonical = new Map;
|
|
2258
|
+
}
|
|
2260
2259
|
build(operations) {
|
|
2261
2260
|
for (const operation of operations) {
|
|
2262
2261
|
switch (operation.kind) {
|
|
@@ -2345,14 +2344,11 @@ function isRecord3(value) {
|
|
|
2345
2344
|
}
|
|
2346
2345
|
|
|
2347
2346
|
class WorkspaceMutationController {
|
|
2348
|
-
workspaceRoot;
|
|
2349
|
-
documents;
|
|
2350
|
-
activeLease = null;
|
|
2351
|
-
nextLeaseId = 1;
|
|
2352
|
-
io;
|
|
2353
2347
|
constructor(workspaceRoot, documents) {
|
|
2354
2348
|
this.workspaceRoot = workspaceRoot;
|
|
2355
2349
|
this.documents = documents;
|
|
2350
|
+
this.activeLease = null;
|
|
2351
|
+
this.nextLeaseId = 1;
|
|
2356
2352
|
}
|
|
2357
2353
|
setIo(io) {
|
|
2358
2354
|
this.io = io;
|
|
@@ -2465,12 +2461,9 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
|
|
|
2465
2461
|
var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
|
|
2466
2462
|
|
|
2467
2463
|
class LspClient extends LspClientConnection {
|
|
2468
|
-
diagnosticPullErrors = [];
|
|
2469
|
-
documents;
|
|
2470
|
-
workspaceMutations;
|
|
2471
|
-
diagnosticsFreshnessTimeoutMs;
|
|
2472
2464
|
constructor(root, server, options = {}) {
|
|
2473
2465
|
super(root, server, options);
|
|
2466
|
+
this.diagnosticPullErrors = [];
|
|
2474
2467
|
this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
|
|
2475
2468
|
this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
|
|
2476
2469
|
versionlessPublishQuiescenceMs: options.versionlessPublishQuiescenceMs ?? VERSIONLESS_PUBLISH_QUIESCENCE_MS
|
|
@@ -2525,6 +2518,18 @@ class LspClient extends LspClientConnection {
|
|
|
2525
2518
|
textDocument: { uri: pathToFileURL3(absPath).href }
|
|
2526
2519
|
}, options);
|
|
2527
2520
|
}
|
|
2521
|
+
async formatDocument(filePath, options, signal) {
|
|
2522
|
+
if (!this.isDocumentFormattingSupported())
|
|
2523
|
+
return null;
|
|
2524
|
+
const absPath = this.resolveWorkspacePath(filePath);
|
|
2525
|
+
await this.openFile(absPath);
|
|
2526
|
+
const requestOptions = signal === undefined ? {} : { signal };
|
|
2527
|
+
const edits = await this.sendRequest("textDocument/formatting", {
|
|
2528
|
+
textDocument: { uri: pathToFileURL3(absPath).href },
|
|
2529
|
+
options
|
|
2530
|
+
}, requestOptions);
|
|
2531
|
+
return edits ?? [];
|
|
2532
|
+
}
|
|
2528
2533
|
async workspaceSymbols(query, signal) {
|
|
2529
2534
|
const options = signal === undefined ? {} : { signal };
|
|
2530
2535
|
return this.sendRequest("workspace/symbol", { query }, options);
|
|
@@ -2770,18 +2775,14 @@ function awaitWithSignal(promise, signal) {
|
|
|
2770
2775
|
}
|
|
2771
2776
|
|
|
2772
2777
|
class LspManager {
|
|
2773
|
-
clients = new Map;
|
|
2774
|
-
reaperHandle = null;
|
|
2775
|
-
signalDisposer = null;
|
|
2776
|
-
disposed = false;
|
|
2777
|
-
idleTimeoutMs;
|
|
2778
|
-
initTimeoutMs;
|
|
2779
|
-
reaperIntervalMs;
|
|
2780
|
-
clientFactory;
|
|
2781
|
-
now;
|
|
2782
2778
|
constructor(options = {}) {
|
|
2779
|
+
this.clients = new Map;
|
|
2780
|
+
this.reaperHandle = null;
|
|
2781
|
+
this.signalDisposer = null;
|
|
2782
|
+
this.disposed = false;
|
|
2783
2783
|
this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
2784
2784
|
this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
2785
|
+
this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
|
|
2785
2786
|
this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
|
|
2786
2787
|
this.clientFactory = options.clientFactory ?? ((root, server) => new LspClient(root, server));
|
|
2787
2788
|
this.now = options.now ?? (() => Date.now());
|
|
@@ -2815,6 +2816,26 @@ class LspManager {
|
|
|
2815
2816
|
}
|
|
2816
2817
|
}
|
|
2817
2818
|
}
|
|
2819
|
+
evictForAdmission() {
|
|
2820
|
+
while (this.clients.size >= this.maxResidentClients) {
|
|
2821
|
+
const victim = this.leastRecentlyUsedIdleClient();
|
|
2822
|
+
if (!victim)
|
|
2823
|
+
return;
|
|
2824
|
+
this.clients.delete(victim.key);
|
|
2825
|
+
stopClientBestEffort(victim.managed.client);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
leastRecentlyUsedIdleClient() {
|
|
2829
|
+
let candidate = null;
|
|
2830
|
+
for (const [key, managed] of this.clients) {
|
|
2831
|
+
if (managed.refCount > 0 || managed.pendingWaiters > 0 || managed.isInitializing)
|
|
2832
|
+
continue;
|
|
2833
|
+
if (candidate === null || managed.lastUsedAt < candidate.managed.lastUsedAt) {
|
|
2834
|
+
candidate = { key, managed };
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
return candidate;
|
|
2838
|
+
}
|
|
2818
2839
|
async tryDeleteIfOrphaned(key, managed) {
|
|
2819
2840
|
if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
|
|
2820
2841
|
this.clients.delete(key);
|
|
@@ -2861,6 +2882,7 @@ class LspManager {
|
|
|
2861
2882
|
managed.lastUsedAt = this.now();
|
|
2862
2883
|
return managed.client;
|
|
2863
2884
|
}
|
|
2885
|
+
this.evictForAdmission();
|
|
2864
2886
|
const client = this.clientFactory(root, server);
|
|
2865
2887
|
const initStartedAt = this.now();
|
|
2866
2888
|
const initPromise = (async () => {
|
|
@@ -2923,6 +2945,7 @@ class LspManager {
|
|
|
2923
2945
|
const key = this.getKey(root, server.id);
|
|
2924
2946
|
if (this.clients.has(key))
|
|
2925
2947
|
return;
|
|
2948
|
+
this.evictForAdmission();
|
|
2926
2949
|
const client = this.clientFactory(root, server);
|
|
2927
2950
|
const initStartedAt = this.now();
|
|
2928
2951
|
const initPromise = (async () => {
|
|
@@ -3013,7 +3036,7 @@ async function disposeDefaultLspManager() {
|
|
|
3013
3036
|
// src/daemon-client.ts
|
|
3014
3037
|
import { connect } from "node:net";
|
|
3015
3038
|
import { homedir as homedir3 } from "node:os";
|
|
3016
|
-
import { join as
|
|
3039
|
+
import { join as join8 } from "node:path";
|
|
3017
3040
|
|
|
3018
3041
|
// ../lsp-core/src/request-context.ts
|
|
3019
3042
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -3022,18 +3045,17 @@ import { homedir } from "node:os";
|
|
|
3022
3045
|
import { basename as basename2, delimiter as delimiter2, dirname as dirname4, isAbsolute as isAbsolute2, join as join2, relative as relative4, resolve as resolve6 } from "node:path";
|
|
3023
3046
|
|
|
3024
3047
|
class LspRequestContextParseError extends Error {
|
|
3025
|
-
code;
|
|
3026
|
-
name = "LspRequestContextParseError";
|
|
3027
3048
|
constructor(code, message) {
|
|
3028
3049
|
super(message);
|
|
3029
3050
|
this.code = code;
|
|
3051
|
+
this.name = "LspRequestContextParseError";
|
|
3030
3052
|
}
|
|
3031
3053
|
}
|
|
3032
3054
|
|
|
3033
3055
|
class LspRequestContextUnavailableError extends Error {
|
|
3034
|
-
name = "LspRequestContextUnavailableError";
|
|
3035
3056
|
constructor() {
|
|
3036
3057
|
super("LSP request context is required. Standalone MCP startup must install one with runWithRequestContext(createStandaloneMcpRequestContext()).");
|
|
3058
|
+
this.name = "LspRequestContextUnavailableError";
|
|
3037
3059
|
}
|
|
3038
3060
|
}
|
|
3039
3061
|
var storage = new AsyncLocalStorage;
|
|
@@ -3053,7 +3075,7 @@ function contextCwd() {
|
|
|
3053
3075
|
}
|
|
3054
3076
|
function createStandaloneMcpRequestContext(input = {}) {
|
|
3055
3077
|
const env = input.env ?? process.env;
|
|
3056
|
-
const cwd = canonicalCwd(input.cwd ?? process.cwd());
|
|
3078
|
+
const cwd = canonicalCwd(input.cwd ?? env["LSP_TOOLS_MCP_CWD"] ?? process.cwd());
|
|
3057
3079
|
const home = input.homeDir ?? homedir();
|
|
3058
3080
|
const projectConfigPaths = translateProjectConfigEnv(env["LSP_TOOLS_MCP_PROJECT_CONFIG"], cwd);
|
|
3059
3081
|
const userConfigPath = translateHomeConfigEnv(env["LSP_TOOLS_MCP_USER_CONFIG"], home, ".codex/lsp-client.json");
|
|
@@ -3191,7 +3213,6 @@ function isPlainRecord(value) {
|
|
|
3191
3213
|
|
|
3192
3214
|
// src/daemon-request-error.ts
|
|
3193
3215
|
class DaemonRequestError extends Error {
|
|
3194
|
-
requestWritten;
|
|
3195
3216
|
constructor(message, requestWritten) {
|
|
3196
3217
|
super(message);
|
|
3197
3218
|
this.name = "DaemonRequestError";
|
|
@@ -3214,7 +3235,6 @@ class DaemonRequestCancelledError extends DaemonRequestError {
|
|
|
3214
3235
|
}
|
|
3215
3236
|
|
|
3216
3237
|
class DaemonRequestTimedOutError extends DaemonRequestError {
|
|
3217
|
-
timeoutMs;
|
|
3218
3238
|
constructor(requestWritten, timeoutMs) {
|
|
3219
3239
|
super("daemon request timed out", requestWritten);
|
|
3220
3240
|
this.name = "DaemonRequestTimedOutError";
|
|
@@ -3293,14 +3313,12 @@ var PROTOCOL_ERROR_CODE = -32002;
|
|
|
3293
3313
|
var AUTH_TOKEN_BYTES = 32;
|
|
3294
3314
|
|
|
3295
3315
|
class UnsafePrivateDirectoryError extends Error {
|
|
3296
|
-
path;
|
|
3297
|
-
reason;
|
|
3298
|
-
name = "UnsafePrivateDirectoryError";
|
|
3299
|
-
code = "unsafe_private_directory";
|
|
3300
3316
|
constructor(path, reason) {
|
|
3301
3317
|
super(`unsafe private directory ${path}: ${reason}`);
|
|
3302
3318
|
this.path = path;
|
|
3303
3319
|
this.reason = reason;
|
|
3320
|
+
this.name = "UnsafePrivateDirectoryError";
|
|
3321
|
+
this.code = "unsafe_private_directory";
|
|
3304
3322
|
}
|
|
3305
3323
|
}
|
|
3306
3324
|
function authEnvelope(token) {
|
|
@@ -3484,20 +3502,18 @@ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
|
|
|
3484
3502
|
var DAEMON_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
3485
3503
|
|
|
3486
3504
|
class InvalidRuntimeOverrideError extends Error {
|
|
3487
|
-
code = "invalid_runtime_override";
|
|
3488
|
-
reason;
|
|
3489
3505
|
constructor(reason, message) {
|
|
3490
3506
|
super(message);
|
|
3507
|
+
this.code = "invalid_runtime_override";
|
|
3491
3508
|
this.name = "InvalidRuntimeOverrideError";
|
|
3492
3509
|
this.reason = reason;
|
|
3493
3510
|
}
|
|
3494
3511
|
}
|
|
3495
3512
|
|
|
3496
3513
|
class InvalidDaemonVersionError extends Error {
|
|
3497
|
-
code = "invalid_daemon_version";
|
|
3498
|
-
version;
|
|
3499
3514
|
constructor(version) {
|
|
3500
3515
|
super("LSP daemon version must match [A-Za-z0-9][A-Za-z0-9._+-]{0,127}");
|
|
3516
|
+
this.code = "invalid_daemon_version";
|
|
3501
3517
|
this.name = "InvalidDaemonVersionError";
|
|
3502
3518
|
this.version = version;
|
|
3503
3519
|
}
|
|
@@ -3543,10 +3559,9 @@ var requireFromHere = createRequire(import.meta.url);
|
|
|
3543
3559
|
var MAX_SOCKET_PATH_LENGTH = 100;
|
|
3544
3560
|
|
|
3545
3561
|
class InvalidDaemonDirectoryError extends Error {
|
|
3546
|
-
code = "invalid_daemon_directory";
|
|
3547
|
-
directory;
|
|
3548
3562
|
constructor(directory) {
|
|
3549
3563
|
super(`${OMO_LSP_DAEMON_DIR} must be an absolute path`);
|
|
3564
|
+
this.code = "invalid_daemon_directory";
|
|
3550
3565
|
this.name = "InvalidDaemonDirectoryError";
|
|
3551
3566
|
this.directory = directory;
|
|
3552
3567
|
}
|
|
@@ -3741,7 +3756,8 @@ function spawnDaemonProcess(paths) {
|
|
|
3741
3756
|
try {
|
|
3742
3757
|
const child = spawn2(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
|
|
3743
3758
|
detached: true,
|
|
3744
|
-
stdio: ["ignore", logFd, logFd]
|
|
3759
|
+
stdio: ["ignore", logFd, logFd],
|
|
3760
|
+
windowsHide: true
|
|
3745
3761
|
});
|
|
3746
3762
|
child.once("spawn", () => closeSync2(logFd));
|
|
3747
3763
|
child.once("error", (error) => {
|
|
@@ -4118,7 +4134,11 @@ function createParentWatchdog(config, onDeadParent) {
|
|
|
4118
4134
|
const probeAlive = config.probeAlive ?? isProcessAlive;
|
|
4119
4135
|
let fired = false;
|
|
4120
4136
|
const timer = setInterval(() => {
|
|
4121
|
-
if (fired
|
|
4137
|
+
if (fired)
|
|
4138
|
+
return;
|
|
4139
|
+
const alive = probeAlive(parentPid);
|
|
4140
|
+
config.onPoll?.(alive);
|
|
4141
|
+
if (alive)
|
|
4122
4142
|
return;
|
|
4123
4143
|
fired = true;
|
|
4124
4144
|
onDeadParent(parentPid, pollIntervalMs);
|
|
@@ -4153,60 +4173,46 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
|
|
|
4153
4173
|
};
|
|
4154
4174
|
}
|
|
4155
4175
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4156
|
-
import { existsSync as
|
|
4157
|
-
import { dirname as
|
|
4176
|
+
import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
|
|
4177
|
+
import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
|
|
4158
4178
|
|
|
4159
|
-
// ../lsp-core/src/lsp/
|
|
4160
|
-
import { existsSync as existsSync7,
|
|
4161
|
-
import { dirname as dirname7 } from "node:path";
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4179
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
4180
|
+
import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
|
|
4181
|
+
import { dirname as dirname7, join as join3 } from "node:path";
|
|
4182
|
+
|
|
4183
|
+
// ../lsp-core/src/lsp/workspace-markers.ts
|
|
4184
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4185
|
+
|
|
4186
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
4187
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
4188
|
+
const marked = nearestMarkedAncestor(directory);
|
|
4189
|
+
if (marked !== undefined)
|
|
4190
|
+
return marked;
|
|
4191
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
4192
|
+
}
|
|
4193
|
+
function nearestMarkedAncestor(directory) {
|
|
4194
|
+
let current = directory;
|
|
4195
|
+
for (;; ) {
|
|
4196
|
+
if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
|
|
4197
|
+
return realpathSync4(current);
|
|
4198
|
+
}
|
|
4199
|
+
const parent = dirname7(current);
|
|
4200
|
+
if (parent === current)
|
|
4201
|
+
return;
|
|
4202
|
+
current = parent;
|
|
4174
4203
|
}
|
|
4175
4204
|
}
|
|
4176
|
-
function
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
}
|
|
4184
|
-
|
|
4185
|
-
return value === "declined" || value === "allowed";
|
|
4186
|
-
}
|
|
4187
|
-
function writeInstallDecisions(decisions) {
|
|
4188
|
-
const path2 = getInstallDecisionsPath();
|
|
4189
|
-
mkdirSync3(dirname7(path2), { recursive: true });
|
|
4190
|
-
const tmpPath = `${path2}.tmp`;
|
|
4191
|
-
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
4192
|
-
`, "utf8");
|
|
4193
|
-
renameSync2(tmpPath, path2);
|
|
4194
|
-
}
|
|
4195
|
-
function isInstallDecisions(value) {
|
|
4196
|
-
return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
4197
|
-
}
|
|
4198
|
-
function isInstallDecisionRecord(value) {
|
|
4199
|
-
if (!isRecord5(value))
|
|
4200
|
-
return false;
|
|
4201
|
-
return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
|
|
4202
|
-
}
|
|
4203
|
-
function isRecord5(value) {
|
|
4204
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4205
|
+
function nearestExistingAncestor(directory) {
|
|
4206
|
+
let current = directory;
|
|
4207
|
+
while (!existsSync7(current)) {
|
|
4208
|
+
const parent = dirname7(current);
|
|
4209
|
+
if (parent === current)
|
|
4210
|
+
return current;
|
|
4211
|
+
current = parent;
|
|
4212
|
+
}
|
|
4213
|
+
return current;
|
|
4205
4214
|
}
|
|
4206
4215
|
|
|
4207
|
-
// ../lsp-core/src/lsp/config-loader.ts
|
|
4208
|
-
import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
|
|
4209
|
-
|
|
4210
4216
|
// ../lsp-core/src/lsp/server-definitions.ts
|
|
4211
4217
|
var LSP_INSTALL_HINTS = {
|
|
4212
4218
|
typescript: "npm install -g typescript-language-server typescript",
|
|
@@ -4252,6 +4258,26 @@ var LSP_INSTALL_HINTS = {
|
|
|
4252
4258
|
julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
|
|
4253
4259
|
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"
|
|
4254
4260
|
};
|
|
4261
|
+
var LSP_LOCAL_INSTALL_HINTS = {
|
|
4262
|
+
typescript: "bun add -d typescript-language-server typescript",
|
|
4263
|
+
vue: "bun add -d @vue/language-server",
|
|
4264
|
+
eslint: "bun add -d vscode-langservers-extracted",
|
|
4265
|
+
oxlint: "bun add -d oxlint",
|
|
4266
|
+
biome: "bun add -d @biomejs/biome",
|
|
4267
|
+
svelte: "bun add -d svelte-language-server",
|
|
4268
|
+
astro: "bun add -d @astrojs/language-server",
|
|
4269
|
+
bash: "bun add -d bash-language-server",
|
|
4270
|
+
"bash-ls": "bun add -d bash-language-server",
|
|
4271
|
+
"yaml-ls": "bun add -d yaml-language-server",
|
|
4272
|
+
php: "bun add -d intelephense",
|
|
4273
|
+
prisma: "bun add -d prisma",
|
|
4274
|
+
dockerfile: "bun add -d dockerfile-language-server-nodejs",
|
|
4275
|
+
pyright: "uv add --dev pyright",
|
|
4276
|
+
basedpyright: "uv add --dev basedpyright",
|
|
4277
|
+
ruff: "uv add --dev ruff",
|
|
4278
|
+
ty: "uv add --dev ty",
|
|
4279
|
+
"ruby-lsp": "bundle add ruby-lsp --group development"
|
|
4280
|
+
};
|
|
4255
4281
|
var BUILTIN_SERVERS = {
|
|
4256
4282
|
typescript: {
|
|
4257
4283
|
command: ["typescript-language-server", "--stdio"],
|
|
@@ -4354,7 +4380,56 @@ var BUILTIN_SERVERS = {
|
|
|
4354
4380
|
}
|
|
4355
4381
|
};
|
|
4356
4382
|
|
|
4383
|
+
// ../lsp-core/src/lsp/server-install-state.ts
|
|
4384
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4385
|
+
import { dirname as dirname8 } from "node:path";
|
|
4386
|
+
function getInstallDecisionsPath() {
|
|
4387
|
+
return lspRequestContext().installDecisionsPath;
|
|
4388
|
+
}
|
|
4389
|
+
function loadInstallDecisions() {
|
|
4390
|
+
const path2 = getInstallDecisionsPath();
|
|
4391
|
+
if (!existsSync8(path2))
|
|
4392
|
+
return {};
|
|
4393
|
+
try {
|
|
4394
|
+
const parsed = JSON.parse(readFileSync4(path2, "utf8"));
|
|
4395
|
+
return isInstallDecisions(parsed) ? parsed : {};
|
|
4396
|
+
} catch {
|
|
4397
|
+
return {};
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
function loadInstallDecision(serverId) {
|
|
4401
|
+
return loadInstallDecisions()[serverId];
|
|
4402
|
+
}
|
|
4403
|
+
function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
|
|
4404
|
+
const decisions = loadInstallDecisions();
|
|
4405
|
+
decisions[serverId] = { decision, decidedAt };
|
|
4406
|
+
writeInstallDecisions(decisions);
|
|
4407
|
+
}
|
|
4408
|
+
function isInstallDecision(value) {
|
|
4409
|
+
return value === "declined" || value === "allowed";
|
|
4410
|
+
}
|
|
4411
|
+
function writeInstallDecisions(decisions) {
|
|
4412
|
+
const path2 = getInstallDecisionsPath();
|
|
4413
|
+
mkdirSync3(dirname8(path2), { recursive: true });
|
|
4414
|
+
const tmpPath = `${path2}.tmp`;
|
|
4415
|
+
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
4416
|
+
`, "utf8");
|
|
4417
|
+
renameSync2(tmpPath, path2);
|
|
4418
|
+
}
|
|
4419
|
+
function isInstallDecisions(value) {
|
|
4420
|
+
return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
4421
|
+
}
|
|
4422
|
+
function isInstallDecisionRecord(value) {
|
|
4423
|
+
if (!isRecord5(value))
|
|
4424
|
+
return false;
|
|
4425
|
+
return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
|
|
4426
|
+
}
|
|
4427
|
+
function isRecord5(value) {
|
|
4428
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4357
4431
|
// ../lsp-core/src/lsp/config-loader.ts
|
|
4432
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
|
|
4358
4433
|
function getProjectConfigPaths() {
|
|
4359
4434
|
return lspRequestContext().projectConfigPaths;
|
|
4360
4435
|
}
|
|
@@ -4362,7 +4437,7 @@ function getUserConfigPath() {
|
|
|
4362
4437
|
return lspRequestContext().userConfigPath;
|
|
4363
4438
|
}
|
|
4364
4439
|
function loadJsonFile(path2) {
|
|
4365
|
-
if (!
|
|
4440
|
+
if (!existsSync9(path2))
|
|
4366
4441
|
return null;
|
|
4367
4442
|
try {
|
|
4368
4443
|
const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
|
|
@@ -4550,54 +4625,155 @@ function getDisabledServerIds() {
|
|
|
4550
4625
|
}
|
|
4551
4626
|
|
|
4552
4627
|
// ../lsp-core/src/lsp/server-installation.ts
|
|
4553
|
-
import { existsSync as
|
|
4554
|
-
import { delimiter as delimiter3, join as
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4628
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
4629
|
+
import { delimiter as delimiter3, dirname as dirname9, isAbsolute as isAbsolute5, join as join4, resolve as resolve7 } from "node:path";
|
|
4630
|
+
var LOCAL_BIN_RULES = [
|
|
4631
|
+
{
|
|
4632
|
+
markers: ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"],
|
|
4633
|
+
binDirs: [join4("node_modules", ".bin")]
|
|
4634
|
+
},
|
|
4635
|
+
{
|
|
4636
|
+
markers: [
|
|
4637
|
+
"pyproject.toml",
|
|
4638
|
+
"ty.toml",
|
|
4639
|
+
"requirements.txt",
|
|
4640
|
+
"setup.py",
|
|
4641
|
+
"setup.cfg",
|
|
4642
|
+
"Pipfile",
|
|
4643
|
+
"pyrightconfig.json",
|
|
4644
|
+
"ruff.toml",
|
|
4645
|
+
".ruff.toml"
|
|
4646
|
+
],
|
|
4647
|
+
binDirs: [
|
|
4648
|
+
join4(".venv", "bin"),
|
|
4649
|
+
join4(".venv", "Scripts"),
|
|
4650
|
+
join4("venv", "bin"),
|
|
4651
|
+
join4("venv", "Scripts"),
|
|
4652
|
+
join4(".env", "bin"),
|
|
4653
|
+
join4(".env", "Scripts")
|
|
4654
|
+
]
|
|
4655
|
+
},
|
|
4656
|
+
{
|
|
4657
|
+
markers: ["Gemfile", "Gemfile.lock"],
|
|
4658
|
+
binDirs: [join4("vendor", "bundle", "bin"), "bin"]
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
markers: ["go.mod", "go.sum", "go.work"],
|
|
4662
|
+
binDirs: ["bin"]
|
|
4663
|
+
}
|
|
4664
|
+
];
|
|
4665
|
+
var resolutionCache = new Map;
|
|
4666
|
+
var probeCount = 0;
|
|
4667
|
+
function probe(path2) {
|
|
4668
|
+
probeCount += 1;
|
|
4669
|
+
return existsSync10(path2);
|
|
4670
|
+
}
|
|
4671
|
+
function executableSuffixes(platform, pathExt) {
|
|
4672
|
+
if (platform !== "win32")
|
|
4673
|
+
return [""];
|
|
4674
|
+
const configured = pathExt ?? process.env["PATHEXT"] ?? "";
|
|
4675
|
+
const systemExts = configured.split(";").filter((entry) => entry.length > 0).map((entry) => entry.toLowerCase());
|
|
4676
|
+
return [...new Set(["", ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
|
|
4677
|
+
}
|
|
4678
|
+
function probeWithSuffixes(directory, command, suffixes) {
|
|
4679
|
+
for (const suffix of suffixes) {
|
|
4680
|
+
const candidate = join4(directory, command + suffix);
|
|
4681
|
+
if (probe(candidate))
|
|
4682
|
+
return candidate;
|
|
4564
4683
|
}
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4684
|
+
return null;
|
|
4685
|
+
}
|
|
4686
|
+
function resolveLocal(command, workingDirectory, suffixes, stopAt) {
|
|
4687
|
+
const boundary = stopAt === undefined ? undefined : resolve7(stopAt);
|
|
4688
|
+
let current = resolve7(workingDirectory);
|
|
4689
|
+
while (true) {
|
|
4690
|
+
for (const rule of LOCAL_BIN_RULES) {
|
|
4691
|
+
if (!rule.markers.some((marker) => probe(join4(current, marker))))
|
|
4692
|
+
continue;
|
|
4693
|
+
for (const binDir of rule.binDirs) {
|
|
4694
|
+
const found = probeWithSuffixes(join4(current, binDir), command, suffixes);
|
|
4695
|
+
if (found !== null)
|
|
4696
|
+
return found;
|
|
4697
|
+
}
|
|
4574
4698
|
}
|
|
4699
|
+
if (probe(join4(current, ".git")))
|
|
4700
|
+
return null;
|
|
4701
|
+
if (boundary !== undefined && current === boundary)
|
|
4702
|
+
return null;
|
|
4703
|
+
const parent = dirname9(current);
|
|
4704
|
+
if (parent === current)
|
|
4705
|
+
return null;
|
|
4706
|
+
current = parent;
|
|
4575
4707
|
}
|
|
4576
|
-
|
|
4577
|
-
|
|
4708
|
+
}
|
|
4709
|
+
function resolveFromPath(command, suffixes, platform, pathEnvOverride) {
|
|
4710
|
+
let pathEnv = pathEnvOverride ?? process.env["PATH"] ?? "";
|
|
4711
|
+
if (platform === "win32" && !pathEnv) {
|
|
4578
4712
|
pathEnv = process.env["Path"] ?? "";
|
|
4579
4713
|
}
|
|
4580
|
-
const
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
}
|
|
4714
|
+
for (const entry of pathEnv.split(delimiter3)) {
|
|
4715
|
+
if (entry.length === 0)
|
|
4716
|
+
continue;
|
|
4717
|
+
const found = probeWithSuffixes(entry, command, suffixes);
|
|
4718
|
+
if (found !== null)
|
|
4719
|
+
return found;
|
|
4587
4720
|
}
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4721
|
+
return null;
|
|
4722
|
+
}
|
|
4723
|
+
function resolveServerBinary(command, workingDirectory, options = {}) {
|
|
4724
|
+
if (command.length === 0)
|
|
4725
|
+
return null;
|
|
4726
|
+
const [cmd] = command;
|
|
4727
|
+
if (cmd === undefined || cmd.length === 0)
|
|
4728
|
+
return null;
|
|
4729
|
+
const platform = options.platform ?? process.platform;
|
|
4730
|
+
const suffixes = executableSuffixes(platform, options.pathExt);
|
|
4731
|
+
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
4732
|
+
const explicit = isAbsolute5(cmd) ? cmd : resolve7(workingDirectory ?? process.cwd(), cmd);
|
|
4733
|
+
return probe(explicit) ? explicit : null;
|
|
4734
|
+
}
|
|
4735
|
+
const cacheKey = JSON.stringify([
|
|
4736
|
+
workingDirectory ?? "",
|
|
4737
|
+
cmd,
|
|
4738
|
+
platform,
|
|
4739
|
+
options.stopAt ?? "",
|
|
4740
|
+
options.pathExt ?? "",
|
|
4741
|
+
options.pathEnv ?? process.env["PATH"] ?? ""
|
|
4742
|
+
]);
|
|
4743
|
+
const cached = resolutionCache.get(cacheKey);
|
|
4744
|
+
if (cached !== undefined)
|
|
4745
|
+
return cached;
|
|
4746
|
+
let resolved = null;
|
|
4747
|
+
if (workingDirectory !== undefined && workingDirectory.length > 0) {
|
|
4748
|
+
resolved = resolveLocal(cmd, workingDirectory, suffixes, options.stopAt);
|
|
4749
|
+
}
|
|
4750
|
+
resolved ??= resolveFromPath(cmd, suffixes, platform, options.pathEnv);
|
|
4751
|
+
if (resolved === null && cmd === "node")
|
|
4752
|
+
resolved = cmd;
|
|
4753
|
+
resolutionCache.set(cacheKey, resolved);
|
|
4754
|
+
return resolved;
|
|
4755
|
+
}
|
|
4756
|
+
function isServerInstalled(command, workingDirectory, options = {}) {
|
|
4757
|
+
if (command.length === 0)
|
|
4758
|
+
return false;
|
|
4759
|
+
return resolveServerBinary(command, workingDirectory, options) !== null;
|
|
4591
4760
|
}
|
|
4592
4761
|
|
|
4593
4762
|
// ../lsp-core/src/lsp/server-resolution.ts
|
|
4763
|
+
function withResolvedCommand(command, binaryPath) {
|
|
4764
|
+
return [binaryPath, ...command.slice(1)];
|
|
4765
|
+
}
|
|
4594
4766
|
function findServerForExtension(ext) {
|
|
4595
4767
|
const servers = getMergedServers();
|
|
4768
|
+
const workingDirectory = contextCwd();
|
|
4596
4769
|
for (const server2 of servers) {
|
|
4597
|
-
if (server2.extensions.includes(ext)
|
|
4770
|
+
if (!server2.extensions.includes(ext))
|
|
4771
|
+
continue;
|
|
4772
|
+
const binaryPath = resolveServerBinary(server2.command, workingDirectory);
|
|
4773
|
+
if (binaryPath !== null) {
|
|
4598
4774
|
const resolvedServer = {
|
|
4599
4775
|
id: server2.id,
|
|
4600
|
-
command: server2.command,
|
|
4776
|
+
command: withResolvedCommand(server2.command, binaryPath),
|
|
4601
4777
|
extensions: server2.extensions,
|
|
4602
4778
|
priority: server2.priority
|
|
4603
4779
|
};
|
|
@@ -4644,6 +4820,7 @@ function findServerForExtension(ext) {
|
|
|
4644
4820
|
function getAllServers() {
|
|
4645
4821
|
const servers = getMergedServers();
|
|
4646
4822
|
const disabled = getDisabledServerIds();
|
|
4823
|
+
const workingDirectory = contextCwd();
|
|
4647
4824
|
const result = [];
|
|
4648
4825
|
const seen = new Set;
|
|
4649
4826
|
for (const server2 of servers) {
|
|
@@ -4651,7 +4828,7 @@ function getAllServers() {
|
|
|
4651
4828
|
continue;
|
|
4652
4829
|
result.push({
|
|
4653
4830
|
id: server2.id,
|
|
4654
|
-
installed: isServerInstalled(server2.command),
|
|
4831
|
+
installed: isServerInstalled(server2.command, workingDirectory),
|
|
4655
4832
|
extensions: server2.extensions,
|
|
4656
4833
|
disabled: false,
|
|
4657
4834
|
source: server2.source,
|
|
@@ -4665,7 +4842,7 @@ function getAllServers() {
|
|
|
4665
4842
|
const builtin = BUILTIN_SERVERS[id];
|
|
4666
4843
|
result.push({
|
|
4667
4844
|
id,
|
|
4668
|
-
installed: builtin ? isServerInstalled(builtin.command) : false,
|
|
4845
|
+
installed: builtin ? isServerInstalled(builtin.command, workingDirectory) : false,
|
|
4669
4846
|
extensions: builtin?.extensions ?? [],
|
|
4670
4847
|
disabled: true,
|
|
4671
4848
|
source: "disabled",
|
|
@@ -4676,7 +4853,6 @@ function getAllServers() {
|
|
|
4676
4853
|
}
|
|
4677
4854
|
|
|
4678
4855
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4679
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4680
4856
|
function isDirectoryPath(filePath) {
|
|
4681
4857
|
try {
|
|
4682
4858
|
return statSync4(filePath).isDirectory();
|
|
@@ -4685,32 +4861,85 @@ function isDirectoryPath(filePath) {
|
|
|
4685
4861
|
}
|
|
4686
4862
|
}
|
|
4687
4863
|
function findWorkspaceRoot(filePath) {
|
|
4688
|
-
const
|
|
4864
|
+
const cwd = contextCwd();
|
|
4865
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4689
4866
|
let dir = abs;
|
|
4690
4867
|
if (!isDirectoryPath(dir)) {
|
|
4691
|
-
dir =
|
|
4692
|
-
}
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4868
|
+
dir = dirname10(dir);
|
|
4869
|
+
}
|
|
4870
|
+
if (!isPathInside(cwd, abs))
|
|
4871
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4872
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4873
|
+
while (isPathInside(cwd, dir)) {
|
|
4874
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4875
|
+
if (canonicalDir !== undefined) {
|
|
4876
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4877
|
+
if (existsSync11(join5(dir, marker))) {
|
|
4878
|
+
return canonicalDir;
|
|
4879
|
+
}
|
|
4698
4880
|
}
|
|
4699
4881
|
}
|
|
4700
|
-
|
|
4701
|
-
|
|
4882
|
+
if (dir === cwd)
|
|
4883
|
+
break;
|
|
4884
|
+
dir = dirname10(dir);
|
|
4702
4885
|
}
|
|
4703
|
-
return
|
|
4886
|
+
return fallbackRoot;
|
|
4887
|
+
}
|
|
4888
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4889
|
+
const cwd = contextCwd();
|
|
4890
|
+
const abs = resolve8(cwd, filePath);
|
|
4891
|
+
if (isPathInside(cwd, abs))
|
|
4892
|
+
return abs;
|
|
4893
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4894
|
+
if (rebased !== undefined)
|
|
4895
|
+
return rebased;
|
|
4896
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4704
4897
|
}
|
|
4705
4898
|
function resolvePathInsideContext(filePath) {
|
|
4706
4899
|
const cwd = contextCwd();
|
|
4707
|
-
const abs =
|
|
4900
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4708
4901
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4709
4902
|
if (!isPathInside(cwd, canonical)) {
|
|
4710
4903
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4711
4904
|
}
|
|
4712
4905
|
return canonical;
|
|
4713
4906
|
}
|
|
4907
|
+
function rebaseThroughCanonicalAncestor(path2, cwd) {
|
|
4908
|
+
let current = path2;
|
|
4909
|
+
const suffix = [];
|
|
4910
|
+
while (true) {
|
|
4911
|
+
if (existsSync11(current)) {
|
|
4912
|
+
const canonical = realpathSync5(current);
|
|
4913
|
+
if (isPathInside(cwd, canonical))
|
|
4914
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4915
|
+
}
|
|
4916
|
+
const parent = dirname10(current);
|
|
4917
|
+
if (parent === current)
|
|
4918
|
+
return;
|
|
4919
|
+
suffix.unshift(basename3(current));
|
|
4920
|
+
current = parent;
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4924
|
+
if (!existsSync11(directory))
|
|
4925
|
+
return;
|
|
4926
|
+
const canonical = realpathSync5(directory);
|
|
4927
|
+
if (!statSync4(canonical).isDirectory())
|
|
4928
|
+
return;
|
|
4929
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4930
|
+
}
|
|
4931
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4932
|
+
let current = directory;
|
|
4933
|
+
while (isPathInside(cwd, current)) {
|
|
4934
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4935
|
+
if (canonical !== undefined)
|
|
4936
|
+
return canonical;
|
|
4937
|
+
if (current === cwd)
|
|
4938
|
+
return;
|
|
4939
|
+
current = dirname10(current);
|
|
4940
|
+
}
|
|
4941
|
+
return;
|
|
4942
|
+
}
|
|
4714
4943
|
function formatServerLookupError(result) {
|
|
4715
4944
|
if (result.status === "not_installed") {
|
|
4716
4945
|
return formatNotInstalled(result);
|
|
@@ -4734,6 +4963,19 @@ function formatServerLookupError(result) {
|
|
|
4734
4963
|
].join(`
|
|
4735
4964
|
`);
|
|
4736
4965
|
}
|
|
4966
|
+
function formatInstallOptions(serverId, installHint) {
|
|
4967
|
+
const localHint = LSP_LOCAL_INSTALL_HINTS[serverId];
|
|
4968
|
+
if (localHint === undefined) {
|
|
4969
|
+
return ["To install, run:", ` ${installHint}`];
|
|
4970
|
+
}
|
|
4971
|
+
return [
|
|
4972
|
+
"To install in THIS repository (preferred — no global install needed):",
|
|
4973
|
+
` ${localHint}`,
|
|
4974
|
+
"",
|
|
4975
|
+
"Or install it globally:",
|
|
4976
|
+
` ${installHint}`
|
|
4977
|
+
];
|
|
4978
|
+
}
|
|
4737
4979
|
function formatNotInstalled(result) {
|
|
4738
4980
|
const { server: server2, installHint } = result;
|
|
4739
4981
|
const extensions = server2.extensions.join(", ");
|
|
@@ -4748,19 +4990,19 @@ function formatNotInstalled(result) {
|
|
|
4748
4990
|
`Command not found: ${server2.command[0]}`,
|
|
4749
4991
|
""
|
|
4750
4992
|
];
|
|
4993
|
+
const installOptions = formatInstallOptions(server2.id, installHint);
|
|
4751
4994
|
if (decision === "allowed") {
|
|
4752
4995
|
return [
|
|
4753
4996
|
...header,
|
|
4754
4997
|
"The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
|
|
4755
|
-
|
|
4998
|
+
...installOptions.slice(1)
|
|
4756
4999
|
].join(`
|
|
4757
5000
|
`);
|
|
4758
5001
|
}
|
|
4759
5002
|
if (!context.capabilities.installDecisionTool) {
|
|
4760
5003
|
return [
|
|
4761
5004
|
...header,
|
|
4762
|
-
|
|
4763
|
-
` ${installHint}`,
|
|
5005
|
+
...installOptions,
|
|
4764
5006
|
"",
|
|
4765
5007
|
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
4766
5008
|
"Install-decision recording is unavailable in this harness; proceed without LSP if the user declines."
|
|
@@ -4769,8 +5011,7 @@ function formatNotInstalled(result) {
|
|
|
4769
5011
|
}
|
|
4770
5012
|
return [
|
|
4771
5013
|
...header,
|
|
4772
|
-
|
|
4773
|
-
` ${installHint}`,
|
|
5014
|
+
...installOptions,
|
|
4774
5015
|
"",
|
|
4775
5016
|
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
4776
5017
|
"- If the user agrees: run the install command above, then retry this tool.",
|
|
@@ -4781,7 +5022,7 @@ function formatNotInstalled(result) {
|
|
|
4781
5022
|
].join(`
|
|
4782
5023
|
`);
|
|
4783
5024
|
}
|
|
4784
|
-
var
|
|
5025
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4785
5026
|
"diagnostics",
|
|
4786
5027
|
"definition",
|
|
4787
5028
|
"references",
|
|
@@ -4790,7 +5031,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4790
5031
|
"prepareRename"
|
|
4791
5032
|
]);
|
|
4792
5033
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4793
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
5034
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4794
5035
|
if (isDirectoryPath(absPath)) {
|
|
4795
5036
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4796
5037
|
}
|
|
@@ -4805,9 +5046,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4805
5046
|
const acquireAndCall = async (allowRetry) => {
|
|
4806
5047
|
const client = await manager.getClient(root, server2, options.signal);
|
|
4807
5048
|
try {
|
|
4808
|
-
return await fn(client, root);
|
|
5049
|
+
return await fn(client, root, absPath);
|
|
4809
5050
|
} catch (err) {
|
|
4810
|
-
if (allowRetry &&
|
|
5051
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4811
5052
|
manager.invalidateClient(root, server2.id, client);
|
|
4812
5053
|
return acquireAndCall(false);
|
|
4813
5054
|
}
|
|
@@ -4825,8 +5066,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4825
5066
|
}
|
|
4826
5067
|
|
|
4827
5068
|
// ../lsp-core/src/lsp/directory-diagnostics.ts
|
|
4828
|
-
import { existsSync as
|
|
4829
|
-
import { join as
|
|
5069
|
+
import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
|
|
5070
|
+
import { join as join6, resolve as resolve9 } from "node:path";
|
|
4830
5071
|
|
|
4831
5072
|
// ../lsp-core/src/lsp/formatters.ts
|
|
4832
5073
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -4956,7 +5197,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4956
5197
|
for (const entry of entries) {
|
|
4957
5198
|
if (files.length >= maxFiles)
|
|
4958
5199
|
return;
|
|
4959
|
-
const fullPath =
|
|
5200
|
+
const fullPath = join6(currentDir, entry);
|
|
4960
5201
|
let stat;
|
|
4961
5202
|
try {
|
|
4962
5203
|
stat = lstatSync5(fullPath);
|
|
@@ -4981,8 +5222,8 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4981
5222
|
if (!extension.startsWith(".")) {
|
|
4982
5223
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4983
5224
|
}
|
|
4984
|
-
const absDir =
|
|
4985
|
-
if (!
|
|
5225
|
+
const absDir = resolve9(options.workspaceRoot ?? contextCwd(), directory);
|
|
5226
|
+
if (!existsSync12(absDir)) {
|
|
4986
5227
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4987
5228
|
}
|
|
4988
5229
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -5069,7 +5310,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
5069
5310
|
|
|
5070
5311
|
// ../lsp-core/src/lsp/infer-extension.ts
|
|
5071
5312
|
import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
|
|
5072
|
-
import { join as
|
|
5313
|
+
import { join as join7 } from "node:path";
|
|
5073
5314
|
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
5074
5315
|
var MAX_SCAN_ENTRIES = 500;
|
|
5075
5316
|
function inferExtensionFromDirectory(directory) {
|
|
@@ -5087,7 +5328,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
5087
5328
|
for (const entry of entries) {
|
|
5088
5329
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
5089
5330
|
return;
|
|
5090
|
-
const fullPath =
|
|
5331
|
+
const fullPath = join7(dir, entry);
|
|
5091
5332
|
let stat;
|
|
5092
5333
|
try {
|
|
5093
5334
|
stat = lstatSync6(fullPath);
|
|
@@ -5262,7 +5503,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5262
5503
|
const filePath = requireString(params, "filePath");
|
|
5263
5504
|
const severity = severityFilter(params);
|
|
5264
5505
|
try {
|
|
5265
|
-
const absPath =
|
|
5506
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
5266
5507
|
if (isDirectoryPath(absPath)) {
|
|
5267
5508
|
const extension = inferExtensionFromDirectory(absPath);
|
|
5268
5509
|
if (!extension) {
|
|
@@ -5291,7 +5532,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5291
5532
|
};
|
|
5292
5533
|
return text(output2.output, details2);
|
|
5293
5534
|
}
|
|
5294
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
5535
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
5295
5536
|
if (result.transientError) {
|
|
5296
5537
|
const message = result.transientError.message;
|
|
5297
5538
|
const details2 = {
|
|
@@ -5338,6 +5579,96 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5338
5579
|
throw error;
|
|
5339
5580
|
}
|
|
5340
5581
|
}
|
|
5582
|
+
// ../lsp-core/src/lsp/format-document.ts
|
|
5583
|
+
import { readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5584
|
+
var DEFAULT_FORMATTING_OPTIONS = {
|
|
5585
|
+
tabSize: 4,
|
|
5586
|
+
insertSpaces: false,
|
|
5587
|
+
trimTrailingWhitespace: true,
|
|
5588
|
+
insertFinalNewline: true,
|
|
5589
|
+
trimFinalNewlines: true
|
|
5590
|
+
};
|
|
5591
|
+
var UNCHANGED = { status: "unchanged", linesAdded: 0, linesRemoved: 0 };
|
|
5592
|
+
async function formatDocumentWithClient(client, filePath, options = {}) {
|
|
5593
|
+
const edits = await client.formatDocument(filePath, options.formattingOptions ?? DEFAULT_FORMATTING_OPTIONS, options.signal);
|
|
5594
|
+
if (edits === null)
|
|
5595
|
+
return { status: "unavailable", reason: "capability_not_advertised" };
|
|
5596
|
+
if (edits.length === 0)
|
|
5597
|
+
return UNCHANGED;
|
|
5598
|
+
const before = readFileSync6(filePath, "utf-8");
|
|
5599
|
+
const normalized = normalizeTextEdits(before, edits, 0);
|
|
5600
|
+
if (normalized.text === before)
|
|
5601
|
+
return UNCHANGED;
|
|
5602
|
+
writeAtomically(filePath, normalized.text);
|
|
5603
|
+
await client.openFile(filePath);
|
|
5604
|
+
return {
|
|
5605
|
+
status: "formatted",
|
|
5606
|
+
...lineDelta(normalized.edits)
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5609
|
+
function lineDelta(edits) {
|
|
5610
|
+
let linesAdded = 0;
|
|
5611
|
+
let linesRemoved = 0;
|
|
5612
|
+
for (const edit of edits) {
|
|
5613
|
+
linesRemoved += edit.range.end.line - edit.range.start.line + 1;
|
|
5614
|
+
linesAdded += edit.newText.split(`
|
|
5615
|
+
`).length;
|
|
5616
|
+
}
|
|
5617
|
+
return { linesAdded, linesRemoved };
|
|
5618
|
+
}
|
|
5619
|
+
function writeAtomically(filePath, content) {
|
|
5620
|
+
const tempPath = `${filePath}.omo-format.tmp`;
|
|
5621
|
+
writeFileSync3(tempPath, content, "utf-8");
|
|
5622
|
+
try {
|
|
5623
|
+
renameSync3(tempPath, filePath);
|
|
5624
|
+
} catch (error) {
|
|
5625
|
+
try {
|
|
5626
|
+
unlinkSync2(tempPath);
|
|
5627
|
+
} catch {}
|
|
5628
|
+
throw error;
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
|
|
5632
|
+
// ../lsp-core/src/tools/format.ts
|
|
5633
|
+
async function executeLspFormat(params, signal) {
|
|
5634
|
+
const filePath = requireString(params, "filePath");
|
|
5635
|
+
try {
|
|
5636
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => formatDocumentWithClient(client, resolvedFilePath, signal === undefined ? {} : { signal }), "format", clientOptions(signal));
|
|
5637
|
+
return text(describeResult(filePath, result), formatDetails(filePath, result));
|
|
5638
|
+
} catch (error) {
|
|
5639
|
+
const missingDependency = missingDependencyResult(error, {
|
|
5640
|
+
filePath,
|
|
5641
|
+
status: "unavailable",
|
|
5642
|
+
reason: "server_unavailable",
|
|
5643
|
+
linesAdded: 0,
|
|
5644
|
+
linesRemoved: 0
|
|
5645
|
+
});
|
|
5646
|
+
if (missingDependency)
|
|
5647
|
+
return missingDependency;
|
|
5648
|
+
throw error;
|
|
5649
|
+
}
|
|
5650
|
+
}
|
|
5651
|
+
function formatDetails(filePath, result) {
|
|
5652
|
+
if (result.status === "unavailable") {
|
|
5653
|
+
return { filePath, status: "unavailable", reason: result.reason, linesAdded: 0, linesRemoved: 0 };
|
|
5654
|
+
}
|
|
5655
|
+
return {
|
|
5656
|
+
filePath,
|
|
5657
|
+
status: result.status,
|
|
5658
|
+
linesAdded: result.linesAdded,
|
|
5659
|
+
linesRemoved: result.linesRemoved
|
|
5660
|
+
};
|
|
5661
|
+
}
|
|
5662
|
+
function describeResult(filePath, result) {
|
|
5663
|
+
if (result.status === "unavailable") {
|
|
5664
|
+
return `Formatting unavailable for ${filePath}: the language server does not advertise documentFormattingProvider.`;
|
|
5665
|
+
}
|
|
5666
|
+
if (result.status === "unchanged") {
|
|
5667
|
+
return `Already formatted: ${filePath}`;
|
|
5668
|
+
}
|
|
5669
|
+
return `Formatted ${filePath} (+${result.linesAdded}/-${result.linesRemoved} lines)`;
|
|
5670
|
+
}
|
|
5671
|
+
|
|
5341
5672
|
// ../lsp-core/src/tools/install-decision.ts
|
|
5342
5673
|
async function executeLspInstallDecision(params) {
|
|
5343
5674
|
const serverId = requireString(params, "server_id");
|
|
@@ -5366,7 +5697,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
5366
5697
|
const line = requireNumber(params, "line");
|
|
5367
5698
|
const character = requireNumber(params, "character");
|
|
5368
5699
|
try {
|
|
5369
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
5700
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
5370
5701
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
5371
5702
|
const details = { filePath, line, character, locations };
|
|
5372
5703
|
if (locations.length === 0)
|
|
@@ -5391,7 +5722,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
5391
5722
|
const character = requireNumber(params, "character");
|
|
5392
5723
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
5393
5724
|
try {
|
|
5394
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
5725
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
5395
5726
|
const references = Array.isArray(result) ? result : [];
|
|
5396
5727
|
const total = references.length;
|
|
5397
5728
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -5433,7 +5764,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
5433
5764
|
const line = requireNumber(params, "line");
|
|
5434
5765
|
const character = requireNumber(params, "character");
|
|
5435
5766
|
try {
|
|
5436
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
5767
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
5437
5768
|
const details = { filePath, line, character, result };
|
|
5438
5769
|
return text(formatPrepareRenameResult(result), details);
|
|
5439
5770
|
} catch (error) {
|
|
@@ -5454,7 +5785,7 @@ async function executeLspRename(params, signal) {
|
|
|
5454
5785
|
const character = requireNumber(params, "character");
|
|
5455
5786
|
const newName = requireString(params, "newName");
|
|
5456
5787
|
try {
|
|
5457
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
5788
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
5458
5789
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
5459
5790
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
5460
5791
|
} catch (error) {
|
|
@@ -5534,7 +5865,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
5534
5865
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
5535
5866
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
5536
5867
|
}
|
|
5537
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
5868
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
5538
5869
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
5539
5870
|
} catch (error) {
|
|
5540
5871
|
const query = optionalString(params, "query");
|
|
@@ -5670,6 +6001,16 @@ var LSP_MCP_TOOLS = [
|
|
|
5670
6001
|
}, ["filePath", "line", "character", "newName"]),
|
|
5671
6002
|
execute: executeLspRename
|
|
5672
6003
|
},
|
|
6004
|
+
{
|
|
6005
|
+
name: "format",
|
|
6006
|
+
aliases: ["lsp_format"],
|
|
6007
|
+
title: "LSP Format",
|
|
6008
|
+
description: "Format a source file with its language server and write the returned edits to disk.",
|
|
6009
|
+
inputSchema: objectSchema({
|
|
6010
|
+
filePath: { type: "string", description: "Source file path to format." }
|
|
6011
|
+
}, ["filePath"]),
|
|
6012
|
+
execute: executeLspFormat
|
|
6013
|
+
},
|
|
5673
6014
|
{
|
|
5674
6015
|
name: "install_decision",
|
|
5675
6016
|
aliases: ["lsp_install_decision"],
|
|
@@ -5770,7 +6111,10 @@ function requestedProtocolVersion(params) {
|
|
|
5770
6111
|
var CONTEXT_KEY = "_context";
|
|
5771
6112
|
|
|
5772
6113
|
class InvalidDaemonRequestError extends Error {
|
|
5773
|
-
|
|
6114
|
+
constructor() {
|
|
6115
|
+
super(...arguments);
|
|
6116
|
+
this.name = "InvalidDaemonRequestError";
|
|
6117
|
+
}
|
|
5774
6118
|
}
|
|
5775
6119
|
function extractRequestContext(raw) {
|
|
5776
6120
|
if (!isPlainRecord(raw) || raw["method"] !== "tools/call")
|
|
@@ -5886,14 +6230,17 @@ async function callToolViaDaemon(name, args, options) {
|
|
|
5886
6230
|
function callDiagnosticsViaDaemon(filePath, options) {
|
|
5887
6231
|
return callToolViaDaemon("diagnostics", { filePath, severity: "error" }, options);
|
|
5888
6232
|
}
|
|
6233
|
+
function callFormatViaDaemon(filePath, options) {
|
|
6234
|
+
return callToolViaDaemon("format", { filePath }, options);
|
|
6235
|
+
}
|
|
5889
6236
|
function currentRequestContext(env = process.env) {
|
|
5890
6237
|
const cwd = process.cwd();
|
|
5891
6238
|
const home = env["HOME"] ?? homedir3();
|
|
5892
6239
|
return parseLspRequestContext({
|
|
5893
6240
|
cwd,
|
|
5894
|
-
projectConfigPaths: [
|
|
5895
|
-
userConfigPath:
|
|
5896
|
-
installDecisionsPath:
|
|
6241
|
+
projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
|
|
6242
|
+
userConfigPath: join8(home, ".codex", "lsp-client.json"),
|
|
6243
|
+
installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
|
|
5897
6244
|
capabilities: { installDecisionTool: true }
|
|
5898
6245
|
});
|
|
5899
6246
|
}
|
|
@@ -5908,7 +6255,7 @@ function withContext(args, context) {
|
|
|
5908
6255
|
function ensureDaemonAvailable(paths, ensure, signal) {
|
|
5909
6256
|
if (!signal)
|
|
5910
6257
|
return ensure(paths);
|
|
5911
|
-
return new Promise((
|
|
6258
|
+
return new Promise((resolve10, reject) => {
|
|
5912
6259
|
let settled = false;
|
|
5913
6260
|
const finish = (run) => {
|
|
5914
6261
|
if (settled)
|
|
@@ -5923,11 +6270,11 @@ function ensureDaemonAvailable(paths, ensure, signal) {
|
|
|
5923
6270
|
return;
|
|
5924
6271
|
}
|
|
5925
6272
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
5926
|
-
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() =>
|
|
6273
|
+
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve10()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
|
|
5927
6274
|
});
|
|
5928
6275
|
}
|
|
5929
6276
|
function sendToolCall(paths, token, name, args, options) {
|
|
5930
|
-
return new Promise((
|
|
6277
|
+
return new Promise((resolve10, reject) => {
|
|
5931
6278
|
const socket = connect(paths.socket);
|
|
5932
6279
|
const requestId = allocateProxyRequestId();
|
|
5933
6280
|
let settled = false;
|
|
@@ -5980,7 +6327,7 @@ function sendToolCall(paths, token, name, args, options) {
|
|
|
5980
6327
|
}
|
|
5981
6328
|
const result = toToolResult(message, requestId);
|
|
5982
6329
|
if (result)
|
|
5983
|
-
finish(() =>
|
|
6330
|
+
finish(() => resolve10(result));
|
|
5984
6331
|
else
|
|
5985
6332
|
finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
|
|
5986
6333
|
});
|
|
@@ -6025,8 +6372,8 @@ function isRetryableTool(name) {
|
|
|
6025
6372
|
return name !== "rename" && name !== "lsp_rename";
|
|
6026
6373
|
}
|
|
6027
6374
|
// src/proxy.ts
|
|
6028
|
-
import { existsSync as
|
|
6029
|
-
import { basename as
|
|
6375
|
+
import { existsSync as existsSync13, realpathSync as realpathSync6 } from "node:fs";
|
|
6376
|
+
import { basename as basename4, delimiter as delimiter4, dirname as dirname11, isAbsolute as isAbsolute6 } from "node:path";
|
|
6030
6377
|
var DEFAULT_STARTUP_TIMEOUT_MS = 1e4;
|
|
6031
6378
|
async function runMcpStdioProxy(options = {}) {
|
|
6032
6379
|
const input = options.input ?? process.stdin;
|
|
@@ -6149,34 +6496,34 @@ function canonicalizePathList(value) {
|
|
|
6149
6496
|
return value.split(delimiter4).map((entry) => canonicalizePath(entry) ?? entry).join(delimiter4);
|
|
6150
6497
|
}
|
|
6151
6498
|
function canonicalizePath(value) {
|
|
6152
|
-
if (value === undefined || !
|
|
6499
|
+
if (value === undefined || !isAbsolute6(value) || !existsSync13(value))
|
|
6153
6500
|
return value;
|
|
6154
|
-
return
|
|
6501
|
+
return realpathSync6(value);
|
|
6155
6502
|
}
|
|
6156
6503
|
function projectRootFromOpenCodeConfigPath(path2) {
|
|
6157
|
-
if (
|
|
6504
|
+
if (basename4(path2) !== "lsp.json" && basename4(path2) !== "lsp-client.json")
|
|
6158
6505
|
return;
|
|
6159
|
-
const configDir =
|
|
6160
|
-
const configDirName =
|
|
6506
|
+
const configDir = dirname11(path2);
|
|
6507
|
+
const configDirName = basename4(configDir);
|
|
6161
6508
|
if (configDirName !== ".opencode" && configDirName !== ".omo")
|
|
6162
6509
|
return;
|
|
6163
|
-
return
|
|
6510
|
+
return dirname11(configDir);
|
|
6164
6511
|
}
|
|
6165
6512
|
export {
|
|
6166
|
-
|
|
6167
|
-
runMcpStdioProxy,
|
|
6168
|
-
resolveDaemonRuntime,
|
|
6169
|
-
probeDaemon,
|
|
6170
|
-
ensureDaemonRunning,
|
|
6171
|
-
disposeDefaultLspManager,
|
|
6172
|
-
daemonPaths,
|
|
6173
|
-
currentRequestContext,
|
|
6174
|
-
callToolViaDaemon,
|
|
6175
|
-
callDiagnosticsViaDaemon,
|
|
6176
|
-
OMO_LSP_DAEMON_VERSION,
|
|
6177
|
-
OMO_LSP_DAEMON_DIR,
|
|
6178
|
-
OMO_LSP_DAEMON_CLI,
|
|
6179
|
-
InvalidRuntimeOverrideError,
|
|
6513
|
+
InvalidDaemonDirectoryError,
|
|
6180
6514
|
InvalidDaemonVersionError,
|
|
6181
|
-
|
|
6515
|
+
InvalidRuntimeOverrideError,
|
|
6516
|
+
OMO_LSP_DAEMON_CLI,
|
|
6517
|
+
OMO_LSP_DAEMON_DIR,
|
|
6518
|
+
OMO_LSP_DAEMON_VERSION,
|
|
6519
|
+
callDiagnosticsViaDaemon,
|
|
6520
|
+
callToolViaDaemon,
|
|
6521
|
+
currentRequestContext,
|
|
6522
|
+
daemonPaths,
|
|
6523
|
+
disposeDefaultLspManager,
|
|
6524
|
+
ensureDaemonRunning,
|
|
6525
|
+
probeDaemon,
|
|
6526
|
+
resolveDaemonRuntime,
|
|
6527
|
+
runMcpStdioProxy,
|
|
6528
|
+
validateDaemonVersion
|
|
6182
6529
|
};
|