oh-my-opencode 5.0.0-beta.2 → 5.0.0-beta.21
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/fallback-lane-policy.d.ts +1 -0
- package/dist/cli/index.js +23057 -20893
- 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 +23093 -20929
- 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/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/{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 +11724 -6355
- 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 +1 -0
- package/dist/shared/normalize-sdk-response.d.ts +1 -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/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 +1 -1
- 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/tui.js +8824 -8906
- package/package.json +38 -35
- package/packages/git-bash-mcp/dist/cli.js +5 -1
- package/packages/git-bash-mcp/package.json +1 -1
- 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 +70 -18
- package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -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/tools/diagnostics.ts +3 -3
- 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-daemon/dist/cli.js +246 -185
- package/packages/lsp-daemon/dist/client.js +222 -164
- package/packages/lsp-daemon/dist/ensure-daemon.js +1 -0
- package/packages/lsp-daemon/dist/index.js +236 -177
- package/packages/lsp-daemon/dist/version-reap.js +1 -1
- package/packages/lsp-tools-mcp/dist/cli.js +198 -136
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +62 -92
- package/packages/lsp-tools-mcp/dist/mcp.js +200 -138
- package/packages/lsp-tools-mcp/dist/request-context.js +11 -12
- package/packages/lsp-tools-mcp/dist/tools.js +204 -146
- 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 +32 -31
- 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 +224 -81
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +224 -82
- 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 +217 -171
- 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 +57 -42
- 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 +6 -2
- 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 +1 -2
- 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 +2433 -422
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2437 -426
- 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.js +2 -4
- 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/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/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/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/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/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 +1 -1
- 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-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/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/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-dist/install-local.mjs +2601 -528
- 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/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 +1 -1
- 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/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/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/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
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { argv, stderr } from "node:process";
|
|
5
5
|
|
|
6
6
|
// src/proxy.ts
|
|
7
|
-
import { existsSync as
|
|
8
|
-
import { basename as
|
|
7
|
+
import { existsSync as existsSync13, realpathSync as realpathSync6 } from "node:fs";
|
|
8
|
+
import { basename as basename4, delimiter as delimiter4, dirname as dirname10, isAbsolute as isAbsolute5 } from "node:path";
|
|
9
9
|
|
|
10
10
|
// ../mcp-stdio-core/src/record.ts
|
|
11
11
|
function isPlainRecord(value) {
|
|
@@ -280,7 +280,11 @@ function createParentWatchdog(config, onDeadParent) {
|
|
|
280
280
|
const probeAlive = config.probeAlive ?? isProcessAlive;
|
|
281
281
|
let fired = false;
|
|
282
282
|
const timer = setInterval(() => {
|
|
283
|
-
if (fired
|
|
283
|
+
if (fired)
|
|
284
|
+
return;
|
|
285
|
+
const alive = probeAlive(parentPid);
|
|
286
|
+
config.onPoll?.(alive);
|
|
287
|
+
if (alive)
|
|
284
288
|
return;
|
|
285
289
|
fired = true;
|
|
286
290
|
onDeadParent(parentPid, pollIntervalMs);
|
|
@@ -315,8 +319,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
|
|
|
315
319
|
};
|
|
316
320
|
}
|
|
317
321
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
318
|
-
import { existsSync as
|
|
319
|
-
import { dirname as
|
|
322
|
+
import { existsSync as existsSync10, realpathSync as realpathSync5, statSync as statSync3 } from "node:fs";
|
|
323
|
+
import { basename as basename3, dirname as dirname7, join as join5, resolve as resolve7 } from "node:path";
|
|
320
324
|
|
|
321
325
|
// ../lsp-core/src/request-context.ts
|
|
322
326
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -325,18 +329,17 @@ import { homedir } from "node:os";
|
|
|
325
329
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
326
330
|
|
|
327
331
|
class LspRequestContextParseError extends Error {
|
|
328
|
-
code;
|
|
329
|
-
name = "LspRequestContextParseError";
|
|
330
332
|
constructor(code, message) {
|
|
331
333
|
super(message);
|
|
332
334
|
this.code = code;
|
|
335
|
+
this.name = "LspRequestContextParseError";
|
|
333
336
|
}
|
|
334
337
|
}
|
|
335
338
|
|
|
336
339
|
class LspRequestContextUnavailableError extends Error {
|
|
337
|
-
name = "LspRequestContextUnavailableError";
|
|
338
340
|
constructor() {
|
|
339
341
|
super("LSP request context is required. Standalone MCP startup must install one with runWithRequestContext(createStandaloneMcpRequestContext()).");
|
|
342
|
+
this.name = "LspRequestContextUnavailableError";
|
|
340
343
|
}
|
|
341
344
|
}
|
|
342
345
|
var storage = new AsyncLocalStorage;
|
|
@@ -499,22 +502,15 @@ function effectiveExtension(filePath) {
|
|
|
499
502
|
|
|
500
503
|
// ../lsp-core/src/lsp/errors.ts
|
|
501
504
|
class LspConnectionClosedError extends Error {
|
|
502
|
-
serverId;
|
|
503
|
-
root;
|
|
504
|
-
name = "LspConnectionClosedError";
|
|
505
505
|
constructor(serverId, root, message) {
|
|
506
506
|
super(message ?? `LSP connection closed for ${serverId} at ${root}`);
|
|
507
507
|
this.serverId = serverId;
|
|
508
508
|
this.root = root;
|
|
509
|
+
this.name = "LspConnectionClosedError";
|
|
509
510
|
}
|
|
510
511
|
}
|
|
511
512
|
|
|
512
513
|
class LspProcessExitedError extends Error {
|
|
513
|
-
serverId;
|
|
514
|
-
root;
|
|
515
|
-
exitCode;
|
|
516
|
-
stderrTail;
|
|
517
|
-
name = "LspProcessExitedError";
|
|
518
514
|
constructor(serverId, root, exitCode, stderrTail) {
|
|
519
515
|
const stderrSuffix = stderrTail ? `
|
|
520
516
|
stderr tail: ${stderrTail}` : "";
|
|
@@ -523,46 +519,49 @@ stderr tail: ${stderrTail}` : "";
|
|
|
523
519
|
this.root = root;
|
|
524
520
|
this.exitCode = exitCode;
|
|
525
521
|
this.stderrTail = stderrTail;
|
|
522
|
+
this.name = "LspProcessExitedError";
|
|
526
523
|
}
|
|
527
524
|
}
|
|
528
525
|
|
|
529
526
|
class LspRequestTimeoutError extends Error {
|
|
530
|
-
method;
|
|
531
|
-
stderrTail;
|
|
532
|
-
name = "LspRequestTimeoutError";
|
|
533
527
|
constructor(method, stderrTail) {
|
|
534
528
|
const stderrSuffix = stderrTail ? `
|
|
535
529
|
recent stderr: ${stderrTail}` : "";
|
|
536
530
|
super(`LSP request timeout (method: ${method})${stderrSuffix}`);
|
|
537
531
|
this.method = method;
|
|
538
532
|
this.stderrTail = stderrTail;
|
|
533
|
+
this.name = "LspRequestTimeoutError";
|
|
539
534
|
}
|
|
540
535
|
}
|
|
541
536
|
|
|
542
537
|
class LspInvalidPathError extends Error {
|
|
543
|
-
|
|
538
|
+
constructor() {
|
|
539
|
+
super(...arguments);
|
|
540
|
+
this.name = "LspInvalidPathError";
|
|
541
|
+
}
|
|
544
542
|
}
|
|
545
543
|
|
|
546
544
|
class LspServerLookupError extends Error {
|
|
547
|
-
lookup;
|
|
548
|
-
name = "LspServerLookupError";
|
|
549
545
|
constructor(message, lookup) {
|
|
550
546
|
super(message);
|
|
551
547
|
this.lookup = lookup;
|
|
548
|
+
this.name = "LspServerLookupError";
|
|
552
549
|
}
|
|
553
550
|
}
|
|
554
551
|
|
|
555
552
|
class LspServerInitializingError extends Error {
|
|
556
|
-
originalError;
|
|
557
|
-
name = "LspServerInitializingError";
|
|
558
553
|
constructor(originalError) {
|
|
559
554
|
super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
|
|
560
555
|
this.originalError = originalError;
|
|
556
|
+
this.name = "LspServerInitializingError";
|
|
561
557
|
}
|
|
562
558
|
}
|
|
563
559
|
|
|
564
560
|
class LspProcessSpawnError extends Error {
|
|
565
|
-
|
|
561
|
+
constructor() {
|
|
562
|
+
super(...arguments);
|
|
563
|
+
this.name = "LspProcessSpawnError";
|
|
564
|
+
}
|
|
566
565
|
}
|
|
567
566
|
function isLspDeadConnectionError(err) {
|
|
568
567
|
return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
|
|
@@ -607,20 +606,31 @@ var METHOD_NOT_FOUND = -32601;
|
|
|
607
606
|
var INTERNAL_ERROR = -32603;
|
|
608
607
|
|
|
609
608
|
class JsonRpcConnection {
|
|
610
|
-
reader;
|
|
611
|
-
writer;
|
|
612
|
-
pendingRequests = new Map;
|
|
613
|
-
notificationHandlers = new Map;
|
|
614
|
-
requestHandlers = new Map;
|
|
615
|
-
closeHandlers = [];
|
|
616
|
-
errorHandlers = [];
|
|
617
|
-
inputBuffer = Buffer.alloc(0);
|
|
618
|
-
nextRequestId = 1;
|
|
619
|
-
listening = false;
|
|
620
|
-
disposed = false;
|
|
621
609
|
constructor(reader, writer) {
|
|
622
610
|
this.reader = reader;
|
|
623
611
|
this.writer = writer;
|
|
612
|
+
this.pendingRequests = new Map;
|
|
613
|
+
this.notificationHandlers = new Map;
|
|
614
|
+
this.requestHandlers = new Map;
|
|
615
|
+
this.closeHandlers = [];
|
|
616
|
+
this.errorHandlers = [];
|
|
617
|
+
this.inputBuffer = Buffer.alloc(0);
|
|
618
|
+
this.nextRequestId = 1;
|
|
619
|
+
this.listening = false;
|
|
620
|
+
this.disposed = false;
|
|
621
|
+
this.handleData = (chunk) => {
|
|
622
|
+
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
623
|
+
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
624
|
+
this.drainInputBuffer();
|
|
625
|
+
};
|
|
626
|
+
this.handleClose = () => {
|
|
627
|
+
for (const handler of this.closeHandlers) {
|
|
628
|
+
handler();
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
this.handleStreamError = (error) => {
|
|
632
|
+
this.emitError(error);
|
|
633
|
+
};
|
|
624
634
|
}
|
|
625
635
|
listen() {
|
|
626
636
|
if (this.listening)
|
|
@@ -741,19 +751,6 @@ class JsonRpcConnection {
|
|
|
741
751
|
this.notificationHandlers.clear();
|
|
742
752
|
this.requestHandlers.clear();
|
|
743
753
|
}
|
|
744
|
-
handleData = (chunk) => {
|
|
745
|
-
const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
746
|
-
this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
|
|
747
|
-
this.drainInputBuffer();
|
|
748
|
-
};
|
|
749
|
-
handleClose = () => {
|
|
750
|
-
for (const handler of this.closeHandlers) {
|
|
751
|
-
handler();
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
handleStreamError = (error) => {
|
|
755
|
-
this.emitError(error);
|
|
756
|
-
};
|
|
757
754
|
drainInputBuffer() {
|
|
758
755
|
while (true) {
|
|
759
756
|
const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR2);
|
|
@@ -1101,31 +1098,25 @@ function isPosition(value) {
|
|
|
1101
1098
|
|
|
1102
1099
|
// ../lsp-core/src/lsp/transport.ts
|
|
1103
1100
|
class LspClientNotStartedError extends Error {
|
|
1104
|
-
serverId;
|
|
1105
|
-
root;
|
|
1106
|
-
name = "LspClientNotStartedError";
|
|
1107
1101
|
constructor(serverId, root) {
|
|
1108
1102
|
super("LSP client not started");
|
|
1109
1103
|
this.serverId = serverId;
|
|
1110
1104
|
this.root = root;
|
|
1105
|
+
this.name = "LspClientNotStartedError";
|
|
1111
1106
|
}
|
|
1112
1107
|
}
|
|
1113
1108
|
|
|
1114
1109
|
class LspClientTransport {
|
|
1115
|
-
root;
|
|
1116
|
-
server;
|
|
1117
|
-
proc = null;
|
|
1118
|
-
connection = null;
|
|
1119
|
-
stderrBuffer = [];
|
|
1120
|
-
processExited = false;
|
|
1121
|
-
diagnosticsStore = new Map;
|
|
1122
|
-
requestTimeoutMs;
|
|
1123
|
-
initializeTimeoutMs;
|
|
1124
|
-
workspaceApplyEditHandler = null;
|
|
1125
|
-
diagnosticPullSupported = false;
|
|
1126
1110
|
constructor(root, server2, timeouts = {}) {
|
|
1127
1111
|
this.root = root;
|
|
1128
1112
|
this.server = server2;
|
|
1113
|
+
this.proc = null;
|
|
1114
|
+
this.connection = null;
|
|
1115
|
+
this.stderrBuffer = [];
|
|
1116
|
+
this.processExited = false;
|
|
1117
|
+
this.diagnosticsStore = new Map;
|
|
1118
|
+
this.workspaceApplyEditHandler = null;
|
|
1119
|
+
this.diagnosticPullSupported = false;
|
|
1129
1120
|
this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
|
|
1130
1121
|
this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
1131
1122
|
}
|
|
@@ -1622,16 +1613,12 @@ function movedPath(candidate, oldPath, newPath) {
|
|
|
1622
1613
|
}
|
|
1623
1614
|
|
|
1624
1615
|
class WorkspaceDocumentState {
|
|
1625
|
-
sendNotification;
|
|
1626
|
-
clearDiagnostics;
|
|
1627
|
-
openDocuments = new Map;
|
|
1628
|
-
openByUri = new Map;
|
|
1629
|
-
openPromises = new Map;
|
|
1630
|
-
now;
|
|
1631
|
-
versionlessPublishQuiescenceMs;
|
|
1632
1616
|
constructor(sendNotification, clearDiagnostics, options = {}) {
|
|
1633
1617
|
this.sendNotification = sendNotification;
|
|
1634
1618
|
this.clearDiagnostics = clearDiagnostics;
|
|
1619
|
+
this.openDocuments = new Map;
|
|
1620
|
+
this.openByUri = new Map;
|
|
1621
|
+
this.openPromises = new Map;
|
|
1635
1622
|
this.now = options.now ?? (() => Date.now());
|
|
1636
1623
|
this.versionlessPublishQuiescenceMs = options.versionlessPublishQuiescenceMs ?? DEFAULT_VERSIONLESS_PUBLISH_QUIESCENCE_MS;
|
|
1637
1624
|
}
|
|
@@ -1895,13 +1882,11 @@ import { dirname as dirname2, isAbsolute as isAbsolute2, relative as relative3,
|
|
|
1895
1882
|
import { fileURLToPath } from "node:url";
|
|
1896
1883
|
|
|
1897
1884
|
class WorkspaceEditPathError extends Error {
|
|
1898
|
-
path;
|
|
1899
|
-
detail;
|
|
1900
|
-
name = "WorkspaceEditPathError";
|
|
1901
1885
|
constructor(path, detail) {
|
|
1902
1886
|
super(`${detail}: ${path}`);
|
|
1903
1887
|
this.path = path;
|
|
1904
1888
|
this.detail = detail;
|
|
1889
|
+
this.name = "WorkspaceEditPathError";
|
|
1905
1890
|
}
|
|
1906
1891
|
}
|
|
1907
1892
|
function isPathInsideWorkspace(filePath, workspaceRoot) {
|
|
@@ -2193,13 +2178,11 @@ function canonicalFingerprint(operations) {
|
|
|
2193
2178
|
|
|
2194
2179
|
// ../lsp-core/src/lsp/workspace-edit-types.ts
|
|
2195
2180
|
class WorkspaceEditValidationError extends Error {
|
|
2196
|
-
changeIndex;
|
|
2197
|
-
detail;
|
|
2198
|
-
name = "WorkspaceEditValidationError";
|
|
2199
2181
|
constructor(changeIndex, detail) {
|
|
2200
2182
|
super(`change ${changeIndex}: ${detail}`);
|
|
2201
2183
|
this.changeIndex = changeIndex;
|
|
2202
2184
|
this.detail = detail;
|
|
2185
|
+
this.name = "WorkspaceEditValidationError";
|
|
2203
2186
|
}
|
|
2204
2187
|
}
|
|
2205
2188
|
|
|
@@ -2697,10 +2680,9 @@ function simulateDelete(operation, virtual) {
|
|
|
2697
2680
|
import { existsSync as existsSync5, lstatSync as lstatSync3, readdirSync as readdirSync2 } from "node:fs";
|
|
2698
2681
|
import { dirname as dirname4, resolve as resolve5 } from "node:path";
|
|
2699
2682
|
class WorkspaceSnapshotBuilder {
|
|
2700
|
-
workspaceRoot;
|
|
2701
|
-
snapshots = new Map;
|
|
2702
2683
|
constructor(workspaceRoot) {
|
|
2703
2684
|
this.workspaceRoot = workspaceRoot;
|
|
2685
|
+
this.snapshots = new Map;
|
|
2704
2686
|
}
|
|
2705
2687
|
build(operations) {
|
|
2706
2688
|
this.add(this.workspaceRoot, false);
|
|
@@ -2744,8 +2726,10 @@ function snapshotOperations(operations, workspaceRoot) {
|
|
|
2744
2726
|
|
|
2745
2727
|
// ../lsp-core/src/lsp/workspace-edit-plan.ts
|
|
2746
2728
|
class PlanPathIndex {
|
|
2747
|
-
|
|
2748
|
-
|
|
2729
|
+
constructor() {
|
|
2730
|
+
this.firstChangeByPath = new Map;
|
|
2731
|
+
this.reportedPathByCanonical = new Map;
|
|
2732
|
+
}
|
|
2749
2733
|
build(operations) {
|
|
2750
2734
|
for (const operation of operations) {
|
|
2751
2735
|
switch (operation.kind) {
|
|
@@ -2834,14 +2818,11 @@ function isRecord4(value) {
|
|
|
2834
2818
|
}
|
|
2835
2819
|
|
|
2836
2820
|
class WorkspaceMutationController {
|
|
2837
|
-
workspaceRoot;
|
|
2838
|
-
documents;
|
|
2839
|
-
activeLease = null;
|
|
2840
|
-
nextLeaseId = 1;
|
|
2841
|
-
io;
|
|
2842
2821
|
constructor(workspaceRoot, documents) {
|
|
2843
2822
|
this.workspaceRoot = workspaceRoot;
|
|
2844
2823
|
this.documents = documents;
|
|
2824
|
+
this.activeLease = null;
|
|
2825
|
+
this.nextLeaseId = 1;
|
|
2845
2826
|
}
|
|
2846
2827
|
setIo(io) {
|
|
2847
2828
|
this.io = io;
|
|
@@ -2954,12 +2935,9 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
|
|
|
2954
2935
|
var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
|
|
2955
2936
|
|
|
2956
2937
|
class LspClient extends LspClientConnection {
|
|
2957
|
-
diagnosticPullErrors = [];
|
|
2958
|
-
documents;
|
|
2959
|
-
workspaceMutations;
|
|
2960
|
-
diagnosticsFreshnessTimeoutMs;
|
|
2961
2938
|
constructor(root, server2, options = {}) {
|
|
2962
2939
|
super(root, server2, options);
|
|
2940
|
+
this.diagnosticPullErrors = [];
|
|
2963
2941
|
this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
|
|
2964
2942
|
this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
|
|
2965
2943
|
versionlessPublishQuiescenceMs: options.versionlessPublishQuiescenceMs ?? VERSIONLESS_PUBLISH_QUIESCENCE_MS
|
|
@@ -3259,16 +3237,11 @@ function awaitWithSignal(promise, signal) {
|
|
|
3259
3237
|
}
|
|
3260
3238
|
|
|
3261
3239
|
class LspManager {
|
|
3262
|
-
clients = new Map;
|
|
3263
|
-
reaperHandle = null;
|
|
3264
|
-
signalDisposer = null;
|
|
3265
|
-
disposed = false;
|
|
3266
|
-
idleTimeoutMs;
|
|
3267
|
-
initTimeoutMs;
|
|
3268
|
-
reaperIntervalMs;
|
|
3269
|
-
clientFactory;
|
|
3270
|
-
now;
|
|
3271
3240
|
constructor(options = {}) {
|
|
3241
|
+
this.clients = new Map;
|
|
3242
|
+
this.reaperHandle = null;
|
|
3243
|
+
this.signalDisposer = null;
|
|
3244
|
+
this.disposed = false;
|
|
3272
3245
|
this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
3273
3246
|
this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
|
|
3274
3247
|
this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
|
|
@@ -3500,15 +3473,52 @@ async function disposeDefaultLspManager() {
|
|
|
3500
3473
|
}
|
|
3501
3474
|
}
|
|
3502
3475
|
|
|
3476
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3477
|
+
import { existsSync as existsSync6, realpathSync as realpathSync4 } from "node:fs";
|
|
3478
|
+
import { dirname as dirname5, join as join3 } from "node:path";
|
|
3479
|
+
|
|
3480
|
+
// ../lsp-core/src/lsp/workspace-markers.ts
|
|
3481
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
3482
|
+
|
|
3483
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3484
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
3485
|
+
const marked = nearestMarkedAncestor(directory);
|
|
3486
|
+
if (marked !== undefined)
|
|
3487
|
+
return marked;
|
|
3488
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
3489
|
+
}
|
|
3490
|
+
function nearestMarkedAncestor(directory) {
|
|
3491
|
+
let current = directory;
|
|
3492
|
+
for (;; ) {
|
|
3493
|
+
if (existsSync6(current) && WORKSPACE_MARKERS.some((marker) => existsSync6(join3(current, marker)))) {
|
|
3494
|
+
return realpathSync4(current);
|
|
3495
|
+
}
|
|
3496
|
+
const parent = dirname5(current);
|
|
3497
|
+
if (parent === current)
|
|
3498
|
+
return;
|
|
3499
|
+
current = parent;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
function nearestExistingAncestor(directory) {
|
|
3503
|
+
let current = directory;
|
|
3504
|
+
while (!existsSync6(current)) {
|
|
3505
|
+
const parent = dirname5(current);
|
|
3506
|
+
if (parent === current)
|
|
3507
|
+
return current;
|
|
3508
|
+
current = parent;
|
|
3509
|
+
}
|
|
3510
|
+
return current;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3503
3513
|
// ../lsp-core/src/lsp/server-install-state.ts
|
|
3504
|
-
import { existsSync as
|
|
3505
|
-
import { dirname as
|
|
3514
|
+
import { existsSync as existsSync7, mkdirSync, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3515
|
+
import { dirname as dirname6 } from "node:path";
|
|
3506
3516
|
function getInstallDecisionsPath() {
|
|
3507
3517
|
return lspRequestContext().installDecisionsPath;
|
|
3508
3518
|
}
|
|
3509
3519
|
function loadInstallDecisions() {
|
|
3510
3520
|
const path = getInstallDecisionsPath();
|
|
3511
|
-
if (!
|
|
3521
|
+
if (!existsSync7(path))
|
|
3512
3522
|
return {};
|
|
3513
3523
|
try {
|
|
3514
3524
|
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
@@ -3530,7 +3540,7 @@ function isInstallDecision(value) {
|
|
|
3530
3540
|
}
|
|
3531
3541
|
function writeInstallDecisions(decisions) {
|
|
3532
3542
|
const path = getInstallDecisionsPath();
|
|
3533
|
-
mkdirSync(
|
|
3543
|
+
mkdirSync(dirname6(path), { recursive: true });
|
|
3534
3544
|
const tmpPath = `${path}.tmp`;
|
|
3535
3545
|
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
3536
3546
|
`, "utf8");
|
|
@@ -3549,7 +3559,7 @@ function isRecord5(value) {
|
|
|
3549
3559
|
}
|
|
3550
3560
|
|
|
3551
3561
|
// ../lsp-core/src/lsp/config-loader.ts
|
|
3552
|
-
import { existsSync as
|
|
3562
|
+
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
3553
3563
|
|
|
3554
3564
|
// ../lsp-core/src/lsp/server-definitions.ts
|
|
3555
3565
|
var LSP_INSTALL_HINTS = {
|
|
@@ -3706,7 +3716,7 @@ function getUserConfigPath() {
|
|
|
3706
3716
|
return lspRequestContext().userConfigPath;
|
|
3707
3717
|
}
|
|
3708
3718
|
function loadJsonFile(path) {
|
|
3709
|
-
if (!
|
|
3719
|
+
if (!existsSync8(path))
|
|
3710
3720
|
return null;
|
|
3711
3721
|
try {
|
|
3712
3722
|
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
@@ -3894,8 +3904,8 @@ function getDisabledServerIds() {
|
|
|
3894
3904
|
}
|
|
3895
3905
|
|
|
3896
3906
|
// ../lsp-core/src/lsp/server-installation.ts
|
|
3897
|
-
import { existsSync as
|
|
3898
|
-
import { delimiter as delimiter3, join as
|
|
3907
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
3908
|
+
import { delimiter as delimiter3, join as join4 } from "node:path";
|
|
3899
3909
|
function isServerInstalled(command, _workingDirectory) {
|
|
3900
3910
|
if (command.length === 0)
|
|
3901
3911
|
return false;
|
|
@@ -3903,7 +3913,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3903
3913
|
if (!cmd)
|
|
3904
3914
|
return false;
|
|
3905
3915
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
3906
|
-
if (
|
|
3916
|
+
if (existsSync9(cmd))
|
|
3907
3917
|
return true;
|
|
3908
3918
|
}
|
|
3909
3919
|
const isWindows = process.platform === "win32";
|
|
@@ -3924,7 +3934,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3924
3934
|
const paths = pathEnv.split(delimiter3);
|
|
3925
3935
|
for (const p of paths) {
|
|
3926
3936
|
for (const suffix of exts) {
|
|
3927
|
-
if (
|
|
3937
|
+
if (existsSync9(join4(p, cmd + suffix))) {
|
|
3928
3938
|
return true;
|
|
3929
3939
|
}
|
|
3930
3940
|
}
|
|
@@ -4020,7 +4030,6 @@ function getAllServers() {
|
|
|
4020
4030
|
}
|
|
4021
4031
|
|
|
4022
4032
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4023
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4024
4033
|
function isDirectoryPath(filePath) {
|
|
4025
4034
|
try {
|
|
4026
4035
|
return statSync3(filePath).isDirectory();
|
|
@@ -4029,32 +4038,85 @@ function isDirectoryPath(filePath) {
|
|
|
4029
4038
|
}
|
|
4030
4039
|
}
|
|
4031
4040
|
function findWorkspaceRoot(filePath) {
|
|
4032
|
-
const
|
|
4041
|
+
const cwd = contextCwd();
|
|
4042
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4033
4043
|
let dir = abs;
|
|
4034
4044
|
if (!isDirectoryPath(dir)) {
|
|
4035
|
-
dir =
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4045
|
+
dir = dirname7(dir);
|
|
4046
|
+
}
|
|
4047
|
+
if (!isPathInside(cwd, abs))
|
|
4048
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4049
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4050
|
+
while (isPathInside(cwd, dir)) {
|
|
4051
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4052
|
+
if (canonicalDir !== undefined) {
|
|
4053
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4054
|
+
if (existsSync10(join5(dir, marker))) {
|
|
4055
|
+
return canonicalDir;
|
|
4056
|
+
}
|
|
4042
4057
|
}
|
|
4043
4058
|
}
|
|
4044
|
-
|
|
4045
|
-
|
|
4059
|
+
if (dir === cwd)
|
|
4060
|
+
break;
|
|
4061
|
+
dir = dirname7(dir);
|
|
4046
4062
|
}
|
|
4047
|
-
return
|
|
4063
|
+
return fallbackRoot;
|
|
4048
4064
|
}
|
|
4049
|
-
function
|
|
4065
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4050
4066
|
const cwd = contextCwd();
|
|
4051
4067
|
const abs = resolve7(cwd, filePath);
|
|
4068
|
+
if (isPathInside(cwd, abs))
|
|
4069
|
+
return abs;
|
|
4070
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4071
|
+
if (rebased !== undefined)
|
|
4072
|
+
return rebased;
|
|
4073
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4074
|
+
}
|
|
4075
|
+
function resolvePathInsideContext(filePath) {
|
|
4076
|
+
const cwd = contextCwd();
|
|
4077
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4052
4078
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4053
4079
|
if (!isPathInside(cwd, canonical)) {
|
|
4054
4080
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4055
4081
|
}
|
|
4056
4082
|
return canonical;
|
|
4057
4083
|
}
|
|
4084
|
+
function rebaseThroughCanonicalAncestor(path, cwd) {
|
|
4085
|
+
let current = path;
|
|
4086
|
+
const suffix = [];
|
|
4087
|
+
while (true) {
|
|
4088
|
+
if (existsSync10(current)) {
|
|
4089
|
+
const canonical = realpathSync5(current);
|
|
4090
|
+
if (isPathInside(cwd, canonical))
|
|
4091
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4092
|
+
}
|
|
4093
|
+
const parent = dirname7(current);
|
|
4094
|
+
if (parent === current)
|
|
4095
|
+
return;
|
|
4096
|
+
suffix.unshift(basename3(current));
|
|
4097
|
+
current = parent;
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4101
|
+
if (!existsSync10(directory))
|
|
4102
|
+
return;
|
|
4103
|
+
const canonical = realpathSync5(directory);
|
|
4104
|
+
if (!statSync3(canonical).isDirectory())
|
|
4105
|
+
return;
|
|
4106
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4107
|
+
}
|
|
4108
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4109
|
+
let current = directory;
|
|
4110
|
+
while (isPathInside(cwd, current)) {
|
|
4111
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4112
|
+
if (canonical !== undefined)
|
|
4113
|
+
return canonical;
|
|
4114
|
+
if (current === cwd)
|
|
4115
|
+
return;
|
|
4116
|
+
current = dirname7(current);
|
|
4117
|
+
}
|
|
4118
|
+
return;
|
|
4119
|
+
}
|
|
4058
4120
|
function formatServerLookupError(result) {
|
|
4059
4121
|
if (result.status === "not_installed") {
|
|
4060
4122
|
return formatNotInstalled(result);
|
|
@@ -4125,7 +4187,7 @@ function formatNotInstalled(result) {
|
|
|
4125
4187
|
].join(`
|
|
4126
4188
|
`);
|
|
4127
4189
|
}
|
|
4128
|
-
var
|
|
4190
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4129
4191
|
"diagnostics",
|
|
4130
4192
|
"definition",
|
|
4131
4193
|
"references",
|
|
@@ -4134,7 +4196,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4134
4196
|
"prepareRename"
|
|
4135
4197
|
]);
|
|
4136
4198
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4137
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
4199
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4138
4200
|
if (isDirectoryPath(absPath)) {
|
|
4139
4201
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4140
4202
|
}
|
|
@@ -4149,9 +4211,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4149
4211
|
const acquireAndCall = async (allowRetry) => {
|
|
4150
4212
|
const client = await manager.getClient(root, server2, options.signal);
|
|
4151
4213
|
try {
|
|
4152
|
-
return await fn(client, root);
|
|
4214
|
+
return await fn(client, root, absPath);
|
|
4153
4215
|
} catch (err) {
|
|
4154
|
-
if (allowRetry &&
|
|
4216
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4155
4217
|
manager.invalidateClient(root, server2.id, client);
|
|
4156
4218
|
return acquireAndCall(false);
|
|
4157
4219
|
}
|
|
@@ -4169,8 +4231,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4169
4231
|
}
|
|
4170
4232
|
|
|
4171
4233
|
// ../lsp-core/src/lsp/directory-diagnostics.ts
|
|
4172
|
-
import { existsSync as
|
|
4173
|
-
import { join as
|
|
4234
|
+
import { existsSync as existsSync11, lstatSync as lstatSync4, readdirSync as readdirSync3 } from "node:fs";
|
|
4235
|
+
import { join as join6, resolve as resolve8 } from "node:path";
|
|
4174
4236
|
|
|
4175
4237
|
// ../lsp-core/src/lsp/formatters.ts
|
|
4176
4238
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -4300,7 +4362,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4300
4362
|
for (const entry of entries) {
|
|
4301
4363
|
if (files.length >= maxFiles)
|
|
4302
4364
|
return;
|
|
4303
|
-
const fullPath =
|
|
4365
|
+
const fullPath = join6(currentDir, entry);
|
|
4304
4366
|
let stat;
|
|
4305
4367
|
try {
|
|
4306
4368
|
stat = lstatSync4(fullPath);
|
|
@@ -4326,7 +4388,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4326
4388
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4327
4389
|
}
|
|
4328
4390
|
const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
|
|
4329
|
-
if (!
|
|
4391
|
+
if (!existsSync11(absDir)) {
|
|
4330
4392
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4331
4393
|
}
|
|
4332
4394
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -4413,7 +4475,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4413
4475
|
|
|
4414
4476
|
// ../lsp-core/src/lsp/infer-extension.ts
|
|
4415
4477
|
import { lstatSync as lstatSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
4416
|
-
import { join as
|
|
4478
|
+
import { join as join7 } from "node:path";
|
|
4417
4479
|
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
4418
4480
|
var MAX_SCAN_ENTRIES = 500;
|
|
4419
4481
|
function inferExtensionFromDirectory(directory) {
|
|
@@ -4431,7 +4493,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
4431
4493
|
for (const entry of entries) {
|
|
4432
4494
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
4433
4495
|
return;
|
|
4434
|
-
const fullPath =
|
|
4496
|
+
const fullPath = join7(dir, entry);
|
|
4435
4497
|
let stat;
|
|
4436
4498
|
try {
|
|
4437
4499
|
stat = lstatSync5(fullPath);
|
|
@@ -4606,7 +4668,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4606
4668
|
const filePath = requireString(params, "filePath");
|
|
4607
4669
|
const severity = severityFilter(params);
|
|
4608
4670
|
try {
|
|
4609
|
-
const absPath =
|
|
4671
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
4610
4672
|
if (isDirectoryPath(absPath)) {
|
|
4611
4673
|
const extension = inferExtensionFromDirectory(absPath);
|
|
4612
4674
|
if (!extension) {
|
|
@@ -4635,7 +4697,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4635
4697
|
};
|
|
4636
4698
|
return text(output2.output, details2);
|
|
4637
4699
|
}
|
|
4638
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
4700
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
4639
4701
|
if (result.transientError) {
|
|
4640
4702
|
const message = result.transientError.message;
|
|
4641
4703
|
const details2 = {
|
|
@@ -4710,7 +4772,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
4710
4772
|
const line = requireNumber(params, "line");
|
|
4711
4773
|
const character = requireNumber(params, "character");
|
|
4712
4774
|
try {
|
|
4713
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
4775
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
4714
4776
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
4715
4777
|
const details = { filePath, line, character, locations };
|
|
4716
4778
|
if (locations.length === 0)
|
|
@@ -4735,7 +4797,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
4735
4797
|
const character = requireNumber(params, "character");
|
|
4736
4798
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
4737
4799
|
try {
|
|
4738
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
4800
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
4739
4801
|
const references = Array.isArray(result) ? result : [];
|
|
4740
4802
|
const total = references.length;
|
|
4741
4803
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -4777,7 +4839,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
4777
4839
|
const line = requireNumber(params, "line");
|
|
4778
4840
|
const character = requireNumber(params, "character");
|
|
4779
4841
|
try {
|
|
4780
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
4842
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
4781
4843
|
const details = { filePath, line, character, result };
|
|
4782
4844
|
return text(formatPrepareRenameResult(result), details);
|
|
4783
4845
|
} catch (error) {
|
|
@@ -4798,7 +4860,7 @@ async function executeLspRename(params, signal) {
|
|
|
4798
4860
|
const character = requireNumber(params, "character");
|
|
4799
4861
|
const newName = requireString(params, "newName");
|
|
4800
4862
|
try {
|
|
4801
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
4863
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
4802
4864
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
4803
4865
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
4804
4866
|
} catch (error) {
|
|
@@ -4878,7 +4940,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
4878
4940
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
4879
4941
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
4880
4942
|
}
|
|
4881
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
4943
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
4882
4944
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
4883
4945
|
} catch (error) {
|
|
4884
4946
|
const query = optionalString(params, "query");
|
|
@@ -5113,11 +5175,10 @@ function requestedProtocolVersion(params) {
|
|
|
5113
5175
|
// src/daemon-client.ts
|
|
5114
5176
|
import { connect } from "node:net";
|
|
5115
5177
|
import { homedir as homedir3 } from "node:os";
|
|
5116
|
-
import { join as
|
|
5178
|
+
import { join as join8 } from "node:path";
|
|
5117
5179
|
|
|
5118
5180
|
// src/daemon-request-error.ts
|
|
5119
5181
|
class DaemonRequestError extends Error {
|
|
5120
|
-
requestWritten;
|
|
5121
5182
|
constructor(message, requestWritten) {
|
|
5122
5183
|
super(message);
|
|
5123
5184
|
this.name = "DaemonRequestError";
|
|
@@ -5140,7 +5201,6 @@ class DaemonRequestCancelledError extends DaemonRequestError {
|
|
|
5140
5201
|
}
|
|
5141
5202
|
|
|
5142
5203
|
class DaemonRequestTimedOutError extends DaemonRequestError {
|
|
5143
|
-
timeoutMs;
|
|
5144
5204
|
constructor(requestWritten, timeoutMs) {
|
|
5145
5205
|
super("daemon request timed out", requestWritten);
|
|
5146
5206
|
this.name = "DaemonRequestTimedOutError";
|
|
@@ -5192,9 +5252,9 @@ function errorText(error) {
|
|
|
5192
5252
|
|
|
5193
5253
|
// src/ensure-daemon.ts
|
|
5194
5254
|
import { spawn as spawn2 } from "node:child_process";
|
|
5195
|
-
import { closeSync as closeSync2, existsSync as
|
|
5255
|
+
import { closeSync as closeSync2, existsSync as existsSync12, mkdirSync as mkdirSync3, openSync as openSync2, writeSync as writeSync2 } from "node:fs";
|
|
5196
5256
|
import { Socket } from "node:net";
|
|
5197
|
-
import { dirname as
|
|
5257
|
+
import { dirname as dirname9, isAbsolute as isAbsolute4 } from "node:path";
|
|
5198
5258
|
import { argv0, execPath } from "node:process";
|
|
5199
5259
|
|
|
5200
5260
|
// src/ipc-protocol.ts
|
|
@@ -5212,21 +5272,19 @@ import {
|
|
|
5212
5272
|
unlinkSync,
|
|
5213
5273
|
writeSync
|
|
5214
5274
|
} from "node:fs";
|
|
5215
|
-
import { dirname as
|
|
5275
|
+
import { dirname as dirname8 } from "node:path";
|
|
5216
5276
|
var OMO_DAEMON_PROTOCOL_VERSION = 1;
|
|
5217
5277
|
var AUTH_ERROR_CODE = -32001;
|
|
5218
5278
|
var PROTOCOL_ERROR_CODE = -32002;
|
|
5219
5279
|
var AUTH_TOKEN_BYTES = 32;
|
|
5220
5280
|
|
|
5221
5281
|
class UnsafePrivateDirectoryError extends Error {
|
|
5222
|
-
path;
|
|
5223
|
-
reason;
|
|
5224
|
-
name = "UnsafePrivateDirectoryError";
|
|
5225
|
-
code = "unsafe_private_directory";
|
|
5226
5282
|
constructor(path, reason) {
|
|
5227
5283
|
super(`unsafe private directory ${path}: ${reason}`);
|
|
5228
5284
|
this.path = path;
|
|
5229
5285
|
this.reason = reason;
|
|
5286
|
+
this.name = "UnsafePrivateDirectoryError";
|
|
5287
|
+
this.code = "unsafe_private_directory";
|
|
5230
5288
|
}
|
|
5231
5289
|
}
|
|
5232
5290
|
function authEnvelope(token) {
|
|
@@ -5322,7 +5380,7 @@ function setPrivateFileMode(path) {
|
|
|
5322
5380
|
chmodSync(path, 384);
|
|
5323
5381
|
}
|
|
5324
5382
|
function createAuthToken(paths) {
|
|
5325
|
-
ensurePrivateDirectory(
|
|
5383
|
+
ensurePrivateDirectory(dirname8(paths.auth));
|
|
5326
5384
|
const token = randomBytes(AUTH_TOKEN_BYTES).toString("base64url");
|
|
5327
5385
|
let fd;
|
|
5328
5386
|
try {
|
|
@@ -5410,20 +5468,18 @@ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
|
|
|
5410
5468
|
var DAEMON_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
5411
5469
|
|
|
5412
5470
|
class InvalidRuntimeOverrideError extends Error {
|
|
5413
|
-
code = "invalid_runtime_override";
|
|
5414
|
-
reason;
|
|
5415
5471
|
constructor(reason, message) {
|
|
5416
5472
|
super(message);
|
|
5473
|
+
this.code = "invalid_runtime_override";
|
|
5417
5474
|
this.name = "InvalidRuntimeOverrideError";
|
|
5418
5475
|
this.reason = reason;
|
|
5419
5476
|
}
|
|
5420
5477
|
}
|
|
5421
5478
|
|
|
5422
5479
|
class InvalidDaemonVersionError extends Error {
|
|
5423
|
-
code = "invalid_daemon_version";
|
|
5424
|
-
version;
|
|
5425
5480
|
constructor(version) {
|
|
5426
5481
|
super("LSP daemon version must match [A-Za-z0-9][A-Za-z0-9._+-]{0,127}");
|
|
5482
|
+
this.code = "invalid_daemon_version";
|
|
5427
5483
|
this.name = "InvalidDaemonVersionError";
|
|
5428
5484
|
this.version = version;
|
|
5429
5485
|
}
|
|
@@ -5469,10 +5525,9 @@ var requireFromHere = createRequire(import.meta.url);
|
|
|
5469
5525
|
var MAX_SOCKET_PATH_LENGTH = 100;
|
|
5470
5526
|
|
|
5471
5527
|
class InvalidDaemonDirectoryError extends Error {
|
|
5472
|
-
code = "invalid_daemon_directory";
|
|
5473
|
-
directory;
|
|
5474
5528
|
constructor(directory) {
|
|
5475
5529
|
super(`${OMO_LSP_DAEMON_DIR} must be an absolute path`);
|
|
5530
|
+
this.code = "invalid_daemon_directory";
|
|
5476
5531
|
this.name = "InvalidDaemonDirectoryError";
|
|
5477
5532
|
this.directory = directory;
|
|
5478
5533
|
}
|
|
@@ -5662,12 +5717,13 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
|
|
|
5662
5717
|
});
|
|
5663
5718
|
}
|
|
5664
5719
|
function spawnDaemonProcess(paths) {
|
|
5665
|
-
mkdirSync3(
|
|
5720
|
+
mkdirSync3(dirname9(paths.log), { recursive: true });
|
|
5666
5721
|
const logFd = openSync2(paths.log, "a");
|
|
5667
5722
|
try {
|
|
5668
5723
|
const child = spawn2(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
|
|
5669
5724
|
detached: true,
|
|
5670
|
-
stdio: ["ignore", logFd, logFd]
|
|
5725
|
+
stdio: ["ignore", logFd, logFd],
|
|
5726
|
+
windowsHide: true
|
|
5671
5727
|
});
|
|
5672
5728
|
child.once("spawn", () => closeSync2(logFd));
|
|
5673
5729
|
child.once("error", (error) => {
|
|
@@ -5681,7 +5737,7 @@ function spawnDaemonProcess(paths) {
|
|
|
5681
5737
|
throw error;
|
|
5682
5738
|
}
|
|
5683
5739
|
}
|
|
5684
|
-
function resolveDaemonNodeExecutable(cachedExecPath = execPath, originalArgv0 = argv0, pathExists =
|
|
5740
|
+
function resolveDaemonNodeExecutable(cachedExecPath = execPath, originalArgv0 = argv0, pathExists = existsSync12) {
|
|
5685
5741
|
if (pathExists(cachedExecPath))
|
|
5686
5742
|
return cachedExecPath;
|
|
5687
5743
|
if (isAbsolute4(originalArgv0) && pathExists(originalArgv0))
|
|
@@ -5780,7 +5836,10 @@ function parsePingResponse(message) {
|
|
|
5780
5836
|
var CONTEXT_KEY = "_context";
|
|
5781
5837
|
|
|
5782
5838
|
class InvalidDaemonRequestError extends Error {
|
|
5783
|
-
|
|
5839
|
+
constructor() {
|
|
5840
|
+
super(...arguments);
|
|
5841
|
+
this.name = "InvalidDaemonRequestError";
|
|
5842
|
+
}
|
|
5784
5843
|
}
|
|
5785
5844
|
function extractRequestContext(raw) {
|
|
5786
5845
|
if (!isPlainRecord(raw) || raw["method"] !== "tools/call")
|
|
@@ -5901,9 +5960,9 @@ function currentRequestContext(env = process.env) {
|
|
|
5901
5960
|
const home = env["HOME"] ?? homedir3();
|
|
5902
5961
|
return parseLspRequestContext({
|
|
5903
5962
|
cwd,
|
|
5904
|
-
projectConfigPaths: [
|
|
5905
|
-
userConfigPath:
|
|
5906
|
-
installDecisionsPath:
|
|
5963
|
+
projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
|
|
5964
|
+
userConfigPath: join8(home, ".codex", "lsp-client.json"),
|
|
5965
|
+
installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
|
|
5907
5966
|
capabilities: { installDecisionTool: true }
|
|
5908
5967
|
});
|
|
5909
5968
|
}
|
|
@@ -6158,18 +6217,18 @@ function canonicalizePathList(value) {
|
|
|
6158
6217
|
return value.split(delimiter4).map((entry) => canonicalizePath(entry) ?? entry).join(delimiter4);
|
|
6159
6218
|
}
|
|
6160
6219
|
function canonicalizePath(value) {
|
|
6161
|
-
if (value === undefined || !isAbsolute5(value) || !
|
|
6220
|
+
if (value === undefined || !isAbsolute5(value) || !existsSync13(value))
|
|
6162
6221
|
return value;
|
|
6163
|
-
return
|
|
6222
|
+
return realpathSync6(value);
|
|
6164
6223
|
}
|
|
6165
6224
|
function projectRootFromOpenCodeConfigPath(path2) {
|
|
6166
|
-
if (
|
|
6225
|
+
if (basename4(path2) !== "lsp.json" && basename4(path2) !== "lsp-client.json")
|
|
6167
6226
|
return;
|
|
6168
|
-
const configDir =
|
|
6169
|
-
const configDirName =
|
|
6227
|
+
const configDir = dirname10(path2);
|
|
6228
|
+
const configDirName = basename4(configDir);
|
|
6170
6229
|
if (configDirName !== ".opencode" && configDirName !== ".omo")
|
|
6171
6230
|
return;
|
|
6172
|
-
return
|
|
6231
|
+
return dirname10(configDir);
|
|
6173
6232
|
}
|
|
6174
6233
|
|
|
6175
6234
|
// src/daemon-server.ts
|
|
@@ -6178,12 +6237,12 @@ import { createServer as createServer2 } from "node:net";
|
|
|
6178
6237
|
|
|
6179
6238
|
// src/ownership.ts
|
|
6180
6239
|
import { randomUUID } from "node:crypto";
|
|
6181
|
-
import { existsSync as
|
|
6182
|
-
import { dirname as
|
|
6240
|
+
import { existsSync as existsSync14, lstatSync as lstatSync7, readFileSync as readFileSync7, statSync as statSync5, unlinkSync as unlinkSync3 } from "node:fs";
|
|
6241
|
+
import { dirname as dirname12 } from "node:path";
|
|
6183
6242
|
|
|
6184
6243
|
// src/lock.ts
|
|
6185
6244
|
import { closeSync as closeSync3, mkdirSync as mkdirSync4, openSync as openSync3, readFileSync as readFileSync6, unlinkSync as unlinkSync2, writeSync as writeSync3 } from "node:fs";
|
|
6186
|
-
import { dirname as
|
|
6245
|
+
import { dirname as dirname11 } from "node:path";
|
|
6187
6246
|
function isProcessAlive2(pid) {
|
|
6188
6247
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
6189
6248
|
return false;
|
|
@@ -6205,7 +6264,7 @@ function readLockPid(lockPath) {
|
|
|
6205
6264
|
}
|
|
6206
6265
|
}
|
|
6207
6266
|
function tryAcquireLock(lockPath, ownerPid = process.pid) {
|
|
6208
|
-
mkdirSync4(
|
|
6267
|
+
mkdirSync4(dirname11(lockPath), { recursive: true });
|
|
6209
6268
|
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
6210
6269
|
const handle = writeLockFile(lockPath, ownerPid);
|
|
6211
6270
|
if (handle)
|
|
@@ -6253,17 +6312,19 @@ function errorCode3(error) {
|
|
|
6253
6312
|
|
|
6254
6313
|
// src/ownership.ts
|
|
6255
6314
|
class DaemonAlreadyRunningError extends Error {
|
|
6256
|
-
|
|
6257
|
-
|
|
6315
|
+
constructor() {
|
|
6316
|
+
super(...arguments);
|
|
6317
|
+
this.name = "DaemonAlreadyRunningError";
|
|
6318
|
+
this.code = "daemon_already_running";
|
|
6319
|
+
}
|
|
6258
6320
|
}
|
|
6259
6321
|
|
|
6260
6322
|
class DaemonStartupDeferredError extends Error {
|
|
6261
|
-
reason;
|
|
6262
|
-
name = "DaemonStartupDeferredError";
|
|
6263
|
-
code = "daemon_startup_deferred";
|
|
6264
6323
|
constructor(reason) {
|
|
6265
6324
|
super(`LSP daemon startup deferred: ${reason}`);
|
|
6266
6325
|
this.reason = reason;
|
|
6326
|
+
this.name = "DaemonStartupDeferredError";
|
|
6327
|
+
this.code = "daemon_startup_deferred";
|
|
6267
6328
|
}
|
|
6268
6329
|
}
|
|
6269
6330
|
async function acquireStartupLease(paths, pingOwner) {
|
|
@@ -6286,7 +6347,7 @@ async function acquireStartupLease(paths, pingOwner) {
|
|
|
6286
6347
|
function ensureDaemonDirectories(paths) {
|
|
6287
6348
|
ensurePrivateDirectory(paths.dir);
|
|
6288
6349
|
if (process.platform !== "win32")
|
|
6289
|
-
ensurePrivateDirectory(
|
|
6350
|
+
ensurePrivateDirectory(dirname12(paths.socket));
|
|
6290
6351
|
}
|
|
6291
6352
|
function readDaemonOwner(paths) {
|
|
6292
6353
|
try {
|
|
@@ -6366,7 +6427,7 @@ async function validateExistingOwner(paths, pingOwner) {
|
|
|
6366
6427
|
throw new DaemonStartupDeferredError("reachable_owner_mismatch");
|
|
6367
6428
|
}
|
|
6368
6429
|
function cleanupDeadOwner(paths, owner) {
|
|
6369
|
-
if (process.platform !== "win32" &&
|
|
6430
|
+
if (process.platform !== "win32" && existsSync14(owner.endpoint.path)) {
|
|
6370
6431
|
const stat = lstatSync7(owner.endpoint.path);
|
|
6371
6432
|
if (stat.isSocket())
|
|
6372
6433
|
unlinkSync3(owner.endpoint.path);
|
|
@@ -6417,7 +6478,7 @@ function parseEndpoint(value) {
|
|
|
6417
6478
|
// src/version-reap.ts
|
|
6418
6479
|
import { execFile } from "node:child_process";
|
|
6419
6480
|
import { readdir, readFile, rm } from "node:fs/promises";
|
|
6420
|
-
import { basename as
|
|
6481
|
+
import { basename as basename5, dirname as dirname13, join as join9 } from "node:path";
|
|
6421
6482
|
var TERM_GRACE_MS = 5000;
|
|
6422
6483
|
var KILL_GRACE_MS = 1000;
|
|
6423
6484
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
@@ -6438,7 +6499,7 @@ async function attestDaemonCliProcess(pid, platform, deps = {}) {
|
|
|
6438
6499
|
return isNodeCliDaemonCommand(command.trim());
|
|
6439
6500
|
}
|
|
6440
6501
|
async function reapStaleDaemonVersions(ownPaths, deps = {}) {
|
|
6441
|
-
const baseDir =
|
|
6502
|
+
const baseDir = dirname13(ownPaths.dir);
|
|
6442
6503
|
const platform = deps.platform ?? process.platform;
|
|
6443
6504
|
const isAlive = deps.isAlive ?? isProcessAlive2;
|
|
6444
6505
|
const attest = deps.attest ?? ((pid) => attestDaemonCliProcess(pid, platform));
|
|
@@ -6457,7 +6518,7 @@ async function reapStaleDaemonVersions(ownPaths, deps = {}) {
|
|
|
6457
6518
|
const version = parseVersionEntry(entry.name);
|
|
6458
6519
|
if (version === null || !entry.isDirectory())
|
|
6459
6520
|
continue;
|
|
6460
|
-
const versionDir =
|
|
6521
|
+
const versionDir = join9(baseDir, entry.name);
|
|
6461
6522
|
const siblingPaths = daemonPaths({ [OMO_LSP_DAEMON_DIR]: baseDir }, { cliPath: ownPaths.cliPath, version });
|
|
6462
6523
|
results.push(await reapOneVersion({
|
|
6463
6524
|
version,
|
|
@@ -6481,7 +6542,7 @@ async function reapOneVersion(context) {
|
|
|
6481
6542
|
const { version, versionDir } = context;
|
|
6482
6543
|
const owner = context.readOwner(context.siblingPaths);
|
|
6483
6544
|
if (!owner) {
|
|
6484
|
-
const lockPid = readLockPid(
|
|
6545
|
+
const lockPid = readLockPid(join9(versionDir, "daemon.lock"));
|
|
6485
6546
|
if (lockPid !== null && context.isAlive(lockPid)) {
|
|
6486
6547
|
context.log(`reap: sparing v${version}: owner metadata missing but daemon.lock is held by live pid ${lockPid}`);
|
|
6487
6548
|
return { version, status: "spared", reason: `owner metadata missing but lock held by live pid ${lockPid}` };
|
|
@@ -6547,7 +6608,7 @@ function splitCmdline(buffer) {
|
|
|
6547
6608
|
function isNodeCliDaemonArgv(argv) {
|
|
6548
6609
|
if (argv.length < 2 || !argv.includes("daemon"))
|
|
6549
6610
|
return false;
|
|
6550
|
-
const executable =
|
|
6611
|
+
const executable = basename5(argv[0] ?? "");
|
|
6551
6612
|
if (!/^node(?:\.exe)?$/i.test(executable))
|
|
6552
6613
|
return false;
|
|
6553
6614
|
return argv.some((value) => value === "cli.js" || value.endsWith("/cli.js") || value.endsWith("\\cli.js"));
|
|
@@ -6560,7 +6621,7 @@ function defaultReadProcFile(path2) {
|
|
|
6560
6621
|
}
|
|
6561
6622
|
function defaultExecuteForStdout(file, args) {
|
|
6562
6623
|
return new Promise((resolve9) => {
|
|
6563
|
-
execFile(file, [...args], { encoding: "utf8", maxBuffer: 1024 * 1024, timeout: 1000 }, (error, stdout) => {
|
|
6624
|
+
execFile(file, [...args], { encoding: "utf8", maxBuffer: 1024 * 1024, timeout: 1000, windowsHide: true }, (error, stdout) => {
|
|
6564
6625
|
if (error !== null) {
|
|
6565
6626
|
resolve9(null);
|
|
6566
6627
|
return;
|