gsd-pi 2.34.0-dev.bbb5216 → 2.34.0-dev.e6d9bed
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/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
- package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
- package/dist/resources/extensions/gsd/doctor.js +36 -0
- package/dist/resources/extensions/gsd/guided-flow.js +4 -2
- package/dist/resources/extensions/gsd/preferences-validation.js +38 -0
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/mcp-client/index.js +2 -1
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/package.json +1 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +3 -9
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +3 -9
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +8 -79
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
- package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
- package/packages/pi-ai/src/providers/openai-responses.ts +15 -95
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
- package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
- package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +33 -58
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +1 -3
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/error.js +7 -0
- package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
- package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/resource-loader.ts +43 -67
- package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/core/skills.ts +1 -4
- package/packages/pi-coding-agent/src/index.ts +1 -7
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +25 -31
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts +0 -4
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +94 -162
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
- package/src/resources/extensions/gsd/commands.ts +9 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
- package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
- package/src/resources/extensions/gsd/doctor-types.ts +9 -1
- package/src/resources/extensions/gsd/doctor.ts +35 -0
- package/src/resources/extensions/gsd/guided-flow.ts +4 -2
- package/src/resources/extensions/gsd/preferences-validation.ts +38 -0
- package/src/resources/extensions/gsd/preferences.ts +2 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
- package/src/resources/extensions/gsd/tests/preferences.test.ts +28 -0
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared file-locking utilities built on `proper-lockfile`.
|
|
3
|
+
*
|
|
4
|
+
* Centralises the synchronous retry-loop and async lock/release patterns
|
|
5
|
+
* that were previously duplicated across auth-storage, session-manager,
|
|
6
|
+
* settings-manager, and models-json-writer.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import lockfile from "proper-lockfile";
|
|
10
|
+
|
|
11
|
+
const DEFAULT_MAX_ATTEMPTS = 10;
|
|
12
|
+
const DEFAULT_DELAY_MS = 20;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Acquire a synchronous file lock with retry.
|
|
16
|
+
*
|
|
17
|
+
* Retries up to `maxAttempts` times when the lock is held by another process
|
|
18
|
+
* (ELOCKED), using a busy-wait between attempts.
|
|
19
|
+
*
|
|
20
|
+
* @returns A release function to unlock.
|
|
21
|
+
* @throws On non-ELOCKED errors or when all attempts are exhausted.
|
|
22
|
+
*/
|
|
23
|
+
export function acquireLockSyncWithRetry(
|
|
24
|
+
lockPath: string,
|
|
25
|
+
maxAttempts: number = DEFAULT_MAX_ATTEMPTS,
|
|
26
|
+
delayMs: number = DEFAULT_DELAY_MS,
|
|
27
|
+
): () => void {
|
|
28
|
+
let lastError: unknown;
|
|
29
|
+
|
|
30
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
31
|
+
try {
|
|
32
|
+
return lockfile.lockSync(lockPath, { realpath: false });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
const code =
|
|
35
|
+
typeof error === "object" && error !== null && "code" in error
|
|
36
|
+
? String((error as { code?: unknown }).code)
|
|
37
|
+
: undefined;
|
|
38
|
+
if (code !== "ELOCKED" || attempt === maxAttempts) {
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
lastError = error;
|
|
42
|
+
const start = Date.now();
|
|
43
|
+
while (Date.now() - start < delayMs) {
|
|
44
|
+
// Busy-wait to avoid changing callers to async.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
throw (lastError as Error) ?? new Error("Failed to acquire file lock");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Non-throwing variant of {@link acquireLockSyncWithRetry}.
|
|
54
|
+
*
|
|
55
|
+
* Returns `undefined` instead of throwing when the lock cannot be acquired,
|
|
56
|
+
* allowing callers to proceed without the lock rather than losing data.
|
|
57
|
+
*/
|
|
58
|
+
export function tryAcquireLockSync(
|
|
59
|
+
lockPath: string,
|
|
60
|
+
maxAttempts: number = DEFAULT_MAX_ATTEMPTS,
|
|
61
|
+
delayMs: number = DEFAULT_DELAY_MS,
|
|
62
|
+
): (() => void) | undefined {
|
|
63
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
64
|
+
try {
|
|
65
|
+
return lockfile.lockSync(lockPath, { realpath: false });
|
|
66
|
+
} catch (error) {
|
|
67
|
+
const code =
|
|
68
|
+
typeof error === "object" && error !== null && "code" in error
|
|
69
|
+
? String((error as { code?: unknown }).code)
|
|
70
|
+
: undefined;
|
|
71
|
+
if (code !== "ELOCKED" || attempt === maxAttempts) {
|
|
72
|
+
// Non-fatal: proceed without lock rather than losing data
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const start = Date.now();
|
|
76
|
+
while (Date.now() - start < delayMs) {
|
|
77
|
+
// Busy-wait to avoid changing callers to async.
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AsyncLockOptions {
|
|
85
|
+
/** Maximum staleness in ms before the lock is considered stale. */
|
|
86
|
+
staleMs?: number;
|
|
87
|
+
/** Called if the lock is compromised while held. */
|
|
88
|
+
onCompromised?: (err: Error) => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Acquire an async file lock with retries and optional staleness detection.
|
|
93
|
+
*
|
|
94
|
+
* Uses `proper-lockfile`'s async API with exponential-backoff retries.
|
|
95
|
+
*
|
|
96
|
+
* @returns A release function (async) to unlock.
|
|
97
|
+
*/
|
|
98
|
+
export async function acquireLockAsync(
|
|
99
|
+
lockPath: string,
|
|
100
|
+
options?: AsyncLockOptions,
|
|
101
|
+
): Promise<() => Promise<void>> {
|
|
102
|
+
return lockfile.lock(lockPath, {
|
|
103
|
+
retries: {
|
|
104
|
+
retries: 10,
|
|
105
|
+
factor: 2,
|
|
106
|
+
minTimeout: 100,
|
|
107
|
+
maxTimeout: 10000,
|
|
108
|
+
randomize: true,
|
|
109
|
+
},
|
|
110
|
+
stale: options?.staleMs,
|
|
111
|
+
onCompromised: options?.onCompromised,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -618,76 +618,6 @@ export async function ensureFileOpen(client: LspClient, filePath: string, signal
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
/**
|
|
622
|
-
* Sync in-memory content to the LSP client without reading from disk.
|
|
623
|
-
*/
|
|
624
|
-
export async function syncContent(
|
|
625
|
-
client: LspClient,
|
|
626
|
-
filePath: string,
|
|
627
|
-
content: string,
|
|
628
|
-
signal?: AbortSignal,
|
|
629
|
-
): Promise<void> {
|
|
630
|
-
const uri = fileToUri(filePath);
|
|
631
|
-
const lockKey = `${client.name}:${uri}`;
|
|
632
|
-
throwIfAborted(signal);
|
|
633
|
-
|
|
634
|
-
const existingLock = fileOperationLocks.get(lockKey);
|
|
635
|
-
if (existingLock) {
|
|
636
|
-
await untilAborted(signal, () => existingLock);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
const syncPromise = (async () => {
|
|
640
|
-
client.diagnostics.delete(uri);
|
|
641
|
-
|
|
642
|
-
const info = client.openFiles.get(uri);
|
|
643
|
-
|
|
644
|
-
if (!info) {
|
|
645
|
-
const languageId = detectLanguageId(filePath);
|
|
646
|
-
throwIfAborted(signal);
|
|
647
|
-
await sendNotification(client, "textDocument/didOpen", {
|
|
648
|
-
textDocument: {
|
|
649
|
-
uri,
|
|
650
|
-
languageId,
|
|
651
|
-
version: 1,
|
|
652
|
-
text: content,
|
|
653
|
-
},
|
|
654
|
-
});
|
|
655
|
-
client.openFiles.set(uri, { version: 1, languageId });
|
|
656
|
-
client.lastActivity = Date.now();
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
const version = ++info.version;
|
|
661
|
-
throwIfAborted(signal);
|
|
662
|
-
await sendNotification(client, "textDocument/didChange", {
|
|
663
|
-
textDocument: { uri, version },
|
|
664
|
-
contentChanges: [{ text: content }],
|
|
665
|
-
});
|
|
666
|
-
client.lastActivity = Date.now();
|
|
667
|
-
})();
|
|
668
|
-
|
|
669
|
-
fileOperationLocks.set(lockKey, syncPromise);
|
|
670
|
-
try {
|
|
671
|
-
await syncPromise;
|
|
672
|
-
} finally {
|
|
673
|
-
fileOperationLocks.delete(lockKey);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* Notify LSP that a file was saved.
|
|
679
|
-
*/
|
|
680
|
-
export async function notifySaved(client: LspClient, filePath: string, signal?: AbortSignal): Promise<void> {
|
|
681
|
-
const uri = fileToUri(filePath);
|
|
682
|
-
const info = client.openFiles.get(uri);
|
|
683
|
-
if (!info) return;
|
|
684
|
-
|
|
685
|
-
throwIfAborted(signal);
|
|
686
|
-
await sendNotification(client, "textDocument/didSave", {
|
|
687
|
-
textDocument: { uri },
|
|
688
|
-
});
|
|
689
|
-
client.lastActivity = Date.now();
|
|
690
|
-
}
|
|
691
621
|
|
|
692
622
|
/**
|
|
693
623
|
* Refresh a file in the LSP client.
|
|
@@ -761,7 +691,7 @@ export function notifyFileChanged(filePath: string): void {
|
|
|
761
691
|
/**
|
|
762
692
|
* Shutdown a specific client by key.
|
|
763
693
|
*/
|
|
764
|
-
|
|
694
|
+
function shutdownClient(key: string): void {
|
|
765
695
|
const client = clients.get(key);
|
|
766
696
|
if (!client) return;
|
|
767
697
|
|
|
@@ -865,7 +795,7 @@ export async function sendRequest(
|
|
|
865
795
|
return promise;
|
|
866
796
|
}
|
|
867
797
|
|
|
868
|
-
|
|
798
|
+
async function sendNotification(client: LspClient, method: string, params: unknown): Promise<void> {
|
|
869
799
|
const notification: LspJsonRpcNotification = {
|
|
870
800
|
jsonrpc: "2.0",
|
|
871
801
|
method,
|
|
@@ -889,7 +819,7 @@ export async function sendNotification(client: LspClient, method: string, params
|
|
|
889
819
|
/**
|
|
890
820
|
* Shutdown all LSP clients.
|
|
891
821
|
*/
|
|
892
|
-
|
|
822
|
+
function shutdownAll(): void {
|
|
893
823
|
const clientsToShutdown = Array.from(clients.values());
|
|
894
824
|
clients.clear();
|
|
895
825
|
|
|
@@ -176,7 +176,7 @@ const LOCAL_BIN_PATHS: Array<{ markers: string[]; binDir: string }> = [
|
|
|
176
176
|
{ markers: ["go.mod", "go.sum"], binDir: "bin" },
|
|
177
177
|
];
|
|
178
178
|
|
|
179
|
-
function which(command: string): string | null {
|
|
179
|
+
export function which(command: string): string | null {
|
|
180
180
|
// On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`
|
|
181
181
|
// returns POSIX paths (/c/Users/...) that Node's spawn() can't execute.
|
|
182
182
|
// `where.exe` returns native Windows paths (C:\Users\...).
|
|
@@ -320,13 +320,5 @@ export function getServersForFile(config: LspConfig, filePath: string): Array<[s
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
export function getServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null {
|
|
323
|
-
|
|
324
|
-
return servers.length > 0 ? servers[0] : null;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
export function hasCapability(
|
|
328
|
-
config: ServerConfig,
|
|
329
|
-
capability: keyof NonNullable<ServerConfig["capabilities"]>,
|
|
330
|
-
): boolean {
|
|
331
|
-
return config.capabilities?.[capability] === true;
|
|
323
|
+
return getServersForFile(config, filePath)[0] ?? null;
|
|
332
324
|
}
|
|
@@ -11,7 +11,7 @@ import { uriToFile } from "./utils.js";
|
|
|
11
11
|
* Apply text edits to a string in-memory.
|
|
12
12
|
* Edits are applied in reverse order (bottom-to-top) to preserve line/character indices.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
function applyTextEditsToString(content: string, edits: TextEdit[]): string {
|
|
15
15
|
const lines = content.split("\n");
|
|
16
16
|
|
|
17
17
|
// Sort edits in reverse order (bottom-to-top, right-to-left)
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
setIdleTimeout,
|
|
15
15
|
WARMUP_TIMEOUT_MS,
|
|
16
16
|
} from "./client.js";
|
|
17
|
-
import { getServersForFile, type LspConfig, loadConfig, hasRootMarkers, resolveCommand } from "./config.js";
|
|
17
|
+
import { getServerForFile, getServersForFile, type LspConfig, loadConfig, hasRootMarkers, resolveCommand } from "./config.js";
|
|
18
18
|
import { applyTextEdits, applyWorkspaceEdit } from "./edits.js";
|
|
19
19
|
import { ToolAbortError, clampTimeout, throwIfAborted } from "./helpers.js";
|
|
20
20
|
import { detectLspmux } from "./lspmux.js";
|
|
@@ -144,15 +144,6 @@ function getLspServers(config: LspConfig): Array<[string, ServerConfig]> {
|
|
|
144
144
|
return Object.entries(config.servers) as Array<[string, ServerConfig]>;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
function getLspServersForFile(config: LspConfig, filePath: string): Array<[string, ServerConfig]> {
|
|
148
|
-
return getServersForFile(config, filePath);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function getLspServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null {
|
|
152
|
-
const servers = getLspServersForFile(config, filePath);
|
|
153
|
-
return servers.length > 0 ? servers[0] : null;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
147
|
const DIAGNOSTIC_MESSAGE_LIMIT = 50;
|
|
157
148
|
const SINGLE_DIAGNOSTICS_WAIT_TIMEOUT_MS = 3000;
|
|
158
149
|
const BATCH_DIAGNOSTICS_WAIT_TIMEOUT_MS = 400;
|
|
@@ -197,6 +188,73 @@ async function formatLocationWithContext(location: Location, cwd: string): Promi
|
|
|
197
188
|
return `${header}\n${context.map(lineText => ` ${lineText}`).join("\n")}`;
|
|
198
189
|
}
|
|
199
190
|
|
|
191
|
+
async function formatLocationResults(
|
|
192
|
+
result: Location | Location[] | LocationLink | LocationLink[] | null,
|
|
193
|
+
label: string,
|
|
194
|
+
cwd: string,
|
|
195
|
+
): Promise<string> {
|
|
196
|
+
const locations = normalizeLocationResult(result);
|
|
197
|
+
if (locations.length === 0) {
|
|
198
|
+
return `No ${label} found`;
|
|
199
|
+
}
|
|
200
|
+
const lines = await Promise.all(locations.map(location => formatLocationWithContext(location, cwd)));
|
|
201
|
+
return `Found ${locations.length} ${label}(s):\n${lines.join("\n")}`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function formatCallHierarchyResults(
|
|
205
|
+
client: LspClient,
|
|
206
|
+
position: { line: number; character: number },
|
|
207
|
+
uri: string,
|
|
208
|
+
direction: "incoming" | "outgoing",
|
|
209
|
+
cwd: string,
|
|
210
|
+
signal?: AbortSignal,
|
|
211
|
+
): Promise<string> {
|
|
212
|
+
const prepareResult = (await sendRequest(
|
|
213
|
+
client,
|
|
214
|
+
"textDocument/prepareCallHierarchy",
|
|
215
|
+
{ textDocument: { uri }, position },
|
|
216
|
+
signal,
|
|
217
|
+
)) as CallHierarchyItem[] | null;
|
|
218
|
+
|
|
219
|
+
if (!prepareResult || prepareResult.length === 0) {
|
|
220
|
+
return "No call hierarchy item found at this position";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const method = direction === "incoming" ? "callHierarchy/incomingCalls" : "callHierarchy/outgoingCalls";
|
|
224
|
+
const callResult = (await sendRequest(client, method, { item: prepareResult[0] }, signal)) as
|
|
225
|
+
| CallHierarchyIncomingCall[]
|
|
226
|
+
| CallHierarchyOutgoingCall[]
|
|
227
|
+
| null;
|
|
228
|
+
|
|
229
|
+
if (!callResult || callResult.length === 0) {
|
|
230
|
+
const verb = direction === "incoming" ? "incoming calls" : "outgoing calls";
|
|
231
|
+
const prep = direction === "incoming" ? "for" : "from";
|
|
232
|
+
return `No ${verb} found ${prep} ${prepareResult[0].name}`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const lines: string[] = [];
|
|
236
|
+
const limited = callResult.slice(0, REFERENCE_CONTEXT_LIMIT);
|
|
237
|
+
for (const call of limited) {
|
|
238
|
+
const item = "from" in call ? call.from : call.to;
|
|
239
|
+
const header = formatCallHierarchyItem(item, cwd);
|
|
240
|
+
const filePath = uriToFile(item.uri);
|
|
241
|
+
const callLine = ("from" in call ? call.fromRanges[0]?.start.line : undefined) ?? item.selectionRange.start.line;
|
|
242
|
+
const context = await readLocationContext(filePath, callLine + 1, LOCATION_CONTEXT_LINES);
|
|
243
|
+
if (context.length > 0) {
|
|
244
|
+
lines.push(` ${header}\n${context.map(l => ` ${l}`).join("\n")}`);
|
|
245
|
+
} else {
|
|
246
|
+
lines.push(` ${header}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const noun = direction === "incoming" ? "caller" : "callee";
|
|
251
|
+
const prep = direction === "incoming" ? "of" : "from";
|
|
252
|
+
const truncation = callResult.length > REFERENCE_CONTEXT_LIMIT
|
|
253
|
+
? `\n ... ${callResult.length - REFERENCE_CONTEXT_LIMIT} additional ${noun}(s) omitted`
|
|
254
|
+
: "";
|
|
255
|
+
return `${callResult.length} ${noun}(s) ${prep} ${prepareResult[0].name}:\n${lines.join("\n")}${truncation}`;
|
|
256
|
+
}
|
|
257
|
+
|
|
200
258
|
async function reloadServer(client: LspClient, serverName: string, signal?: AbortSignal): Promise<string> {
|
|
201
259
|
let output = `Restarted ${serverName}`;
|
|
202
260
|
const reloadMethods = ["rust-analyzer/reloadWorkspace", "workspace/didChangeConfiguration"];
|
|
@@ -647,7 +705,7 @@ export function createLspTool(cwd: string): AgentTool<typeof lspSchema, LspToolD
|
|
|
647
705
|
}
|
|
648
706
|
|
|
649
707
|
// File-specific actions
|
|
650
|
-
const serverInfo = resolvedFile ?
|
|
708
|
+
const serverInfo = resolvedFile ? getServerForFile(config, resolvedFile) : null;
|
|
651
709
|
if (!serverInfo) {
|
|
652
710
|
return {
|
|
653
711
|
content: [{ type: "text", text: "No language server found for this action" }],
|
|
@@ -676,74 +734,35 @@ export function createLspTool(cwd: string): AgentTool<typeof lspSchema, LspToolD
|
|
|
676
734
|
|
|
677
735
|
switch (action) {
|
|
678
736
|
case "definition": {
|
|
679
|
-
const result =
|
|
737
|
+
const result = await sendRequest(
|
|
680
738
|
client,
|
|
681
739
|
"textDocument/definition",
|
|
682
|
-
{
|
|
683
|
-
textDocument: { uri },
|
|
684
|
-
position,
|
|
685
|
-
},
|
|
740
|
+
{ textDocument: { uri }, position },
|
|
686
741
|
signal,
|
|
687
|
-
)
|
|
688
|
-
|
|
689
|
-
const locations = normalizeLocationResult(result);
|
|
690
|
-
|
|
691
|
-
if (locations.length === 0) {
|
|
692
|
-
output = "No definition found";
|
|
693
|
-
} else {
|
|
694
|
-
const lines = await Promise.all(
|
|
695
|
-
locations.map(location => formatLocationWithContext(location, cwd)),
|
|
696
|
-
);
|
|
697
|
-
output = `Found ${locations.length} definition(s):\n${lines.join("\n")}`;
|
|
698
|
-
}
|
|
742
|
+
);
|
|
743
|
+
output = await formatLocationResults(result as Location | Location[] | LocationLink | LocationLink[] | null, "definition", cwd);
|
|
699
744
|
break;
|
|
700
745
|
}
|
|
701
746
|
|
|
702
747
|
case "type_definition": {
|
|
703
|
-
const result =
|
|
748
|
+
const result = await sendRequest(
|
|
704
749
|
client,
|
|
705
750
|
"textDocument/typeDefinition",
|
|
706
|
-
{
|
|
707
|
-
textDocument: { uri },
|
|
708
|
-
position,
|
|
709
|
-
},
|
|
751
|
+
{ textDocument: { uri }, position },
|
|
710
752
|
signal,
|
|
711
|
-
)
|
|
712
|
-
|
|
713
|
-
const locations = normalizeLocationResult(result);
|
|
714
|
-
|
|
715
|
-
if (locations.length === 0) {
|
|
716
|
-
output = "No type definition found";
|
|
717
|
-
} else {
|
|
718
|
-
const lines = await Promise.all(
|
|
719
|
-
locations.map(location => formatLocationWithContext(location, cwd)),
|
|
720
|
-
);
|
|
721
|
-
output = `Found ${locations.length} type definition(s):\n${lines.join("\n")}`;
|
|
722
|
-
}
|
|
753
|
+
);
|
|
754
|
+
output = await formatLocationResults(result as Location | Location[] | LocationLink | LocationLink[] | null, "type definition", cwd);
|
|
723
755
|
break;
|
|
724
756
|
}
|
|
725
757
|
|
|
726
758
|
case "implementation": {
|
|
727
|
-
const result =
|
|
759
|
+
const result = await sendRequest(
|
|
728
760
|
client,
|
|
729
761
|
"textDocument/implementation",
|
|
730
|
-
{
|
|
731
|
-
textDocument: { uri },
|
|
732
|
-
position,
|
|
733
|
-
},
|
|
762
|
+
{ textDocument: { uri }, position },
|
|
734
763
|
signal,
|
|
735
|
-
)
|
|
736
|
-
|
|
737
|
-
const locations = normalizeLocationResult(result);
|
|
738
|
-
|
|
739
|
-
if (locations.length === 0) {
|
|
740
|
-
output = "No implementation found";
|
|
741
|
-
} else {
|
|
742
|
-
const lines = await Promise.all(
|
|
743
|
-
locations.map(location => formatLocationWithContext(location, cwd)),
|
|
744
|
-
);
|
|
745
|
-
output = `Found ${locations.length} implementation(s):\n${lines.join("\n")}`;
|
|
746
|
-
}
|
|
764
|
+
);
|
|
765
|
+
output = await formatLocationResults(result as Location | Location[] | LocationLink | LocationLink[] | null, "implementation", cwd);
|
|
747
766
|
break;
|
|
748
767
|
}
|
|
749
768
|
|
|
@@ -917,100 +936,12 @@ export function createLspTool(cwd: string): AgentTool<typeof lspSchema, LspToolD
|
|
|
917
936
|
}
|
|
918
937
|
|
|
919
938
|
case "incoming_calls": {
|
|
920
|
-
|
|
921
|
-
client,
|
|
922
|
-
"textDocument/prepareCallHierarchy",
|
|
923
|
-
{
|
|
924
|
-
textDocument: { uri },
|
|
925
|
-
position,
|
|
926
|
-
},
|
|
927
|
-
signal,
|
|
928
|
-
)) as CallHierarchyItem[] | null;
|
|
929
|
-
|
|
930
|
-
if (!prepareResult || prepareResult.length === 0) {
|
|
931
|
-
output = "No call hierarchy item found at this position";
|
|
932
|
-
break;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
const incomingResult = (await sendRequest(
|
|
936
|
-
client,
|
|
937
|
-
"callHierarchy/incomingCalls",
|
|
938
|
-
{ item: prepareResult[0] },
|
|
939
|
-
signal,
|
|
940
|
-
)) as CallHierarchyIncomingCall[] | null;
|
|
941
|
-
|
|
942
|
-
if (!incomingResult || incomingResult.length === 0) {
|
|
943
|
-
output = `No incoming calls found for ${prepareResult[0].name}`;
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
const incomingLines: string[] = [];
|
|
948
|
-
const limitedIncoming = incomingResult.slice(0, REFERENCE_CONTEXT_LIMIT);
|
|
949
|
-
for (const call of limitedIncoming) {
|
|
950
|
-
const header = formatCallHierarchyItem(call.from, cwd);
|
|
951
|
-
const filePath = uriToFile(call.from.uri);
|
|
952
|
-
const callLine = call.fromRanges[0]?.start.line ?? call.from.selectionRange.start.line;
|
|
953
|
-
const context = await readLocationContext(filePath, callLine + 1, LOCATION_CONTEXT_LINES);
|
|
954
|
-
if (context.length > 0) {
|
|
955
|
-
incomingLines.push(` ${header}\n${context.map(l => ` ${l}`).join("\n")}`);
|
|
956
|
-
} else {
|
|
957
|
-
incomingLines.push(` ${header}`);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
const truncation = incomingResult.length > REFERENCE_CONTEXT_LIMIT
|
|
962
|
-
? `\n ... ${incomingResult.length - REFERENCE_CONTEXT_LIMIT} additional caller(s) omitted`
|
|
963
|
-
: "";
|
|
964
|
-
output = `${incomingResult.length} caller(s) of ${prepareResult[0].name}:\n${incomingLines.join("\n")}${truncation}`;
|
|
939
|
+
output = await formatCallHierarchyResults(client, position, uri, "incoming", cwd, signal);
|
|
965
940
|
break;
|
|
966
941
|
}
|
|
967
942
|
|
|
968
943
|
case "outgoing_calls": {
|
|
969
|
-
|
|
970
|
-
client,
|
|
971
|
-
"textDocument/prepareCallHierarchy",
|
|
972
|
-
{
|
|
973
|
-
textDocument: { uri },
|
|
974
|
-
position,
|
|
975
|
-
},
|
|
976
|
-
signal,
|
|
977
|
-
)) as CallHierarchyItem[] | null;
|
|
978
|
-
|
|
979
|
-
if (!prepareResult || prepareResult.length === 0) {
|
|
980
|
-
output = "No call hierarchy item found at this position";
|
|
981
|
-
break;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
const outgoingResult = (await sendRequest(
|
|
985
|
-
client,
|
|
986
|
-
"callHierarchy/outgoingCalls",
|
|
987
|
-
{ item: prepareResult[0] },
|
|
988
|
-
signal,
|
|
989
|
-
)) as CallHierarchyOutgoingCall[] | null;
|
|
990
|
-
|
|
991
|
-
if (!outgoingResult || outgoingResult.length === 0) {
|
|
992
|
-
output = `No outgoing calls found from ${prepareResult[0].name}`;
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
const outgoingLines: string[] = [];
|
|
997
|
-
const limitedOutgoing = outgoingResult.slice(0, REFERENCE_CONTEXT_LIMIT);
|
|
998
|
-
for (const call of limitedOutgoing) {
|
|
999
|
-
const header = formatCallHierarchyItem(call.to, cwd);
|
|
1000
|
-
const filePath = uriToFile(call.to.uri);
|
|
1001
|
-
const callLine = call.to.selectionRange.start.line;
|
|
1002
|
-
const context = await readLocationContext(filePath, callLine + 1, LOCATION_CONTEXT_LINES);
|
|
1003
|
-
if (context.length > 0) {
|
|
1004
|
-
outgoingLines.push(` ${header}\n${context.map(l => ` ${l}`).join("\n")}`);
|
|
1005
|
-
} else {
|
|
1006
|
-
outgoingLines.push(` ${header}`);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
const outTruncation = outgoingResult.length > REFERENCE_CONTEXT_LIMIT
|
|
1011
|
-
? `\n ... ${outgoingResult.length - REFERENCE_CONTEXT_LIMIT} additional callee(s) omitted`
|
|
1012
|
-
: "";
|
|
1013
|
-
output = `${outgoingResult.length} callee(s) from ${prepareResult[0].name}:\n${outgoingLines.join("\n")}${outTruncation}`;
|
|
944
|
+
output = await formatCallHierarchyResults(client, position, uri, "outgoing", cwd, signal);
|
|
1014
945
|
break;
|
|
1015
946
|
}
|
|
1016
947
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
2
|
import * as fsPromises from "node:fs/promises";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { LSP_LIVENESS_TIMEOUT_MS, LSP_STATE_CACHE_TTL_MS } from "../constants.js";
|
|
6
|
+
import { which } from "./config.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* lspmux integration for LSP server multiplexing.
|
|
@@ -43,27 +44,6 @@ const DEFAULT_SUPPORTED_SERVERS = new Set([
|
|
|
43
44
|
]);
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
// =============================================================================
|
|
47
|
-
// Helpers
|
|
48
|
-
// =============================================================================
|
|
49
|
-
|
|
50
|
-
function which(command: string): string | null {
|
|
51
|
-
try {
|
|
52
|
-
// On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`
|
|
53
|
-
// returns POSIX paths (/c/Users/...) that Node's spawn() can't execute (#1121).
|
|
54
|
-
const isWindows = process.platform === "win32";
|
|
55
|
-
const cmd = isWindows ? "where.exe" : "which";
|
|
56
|
-
const result = isWindows
|
|
57
|
-
? execSync(`${cmd} ${command}`, { encoding: "utf-8" })
|
|
58
|
-
: execSync(`which ${command}`, { encoding: "utf-8" });
|
|
59
|
-
// `where.exe` may return multiple lines — take the first
|
|
60
|
-
const resolved = result.trim().split(/\r?\n/)[0]?.trim();
|
|
61
|
-
return resolved || null;
|
|
62
|
-
} catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
47
|
// =============================================================================
|
|
68
48
|
// Config Path
|
|
69
49
|
// =============================================================================
|
|
@@ -172,7 +152,7 @@ export interface LspmuxWrappedCommand {
|
|
|
172
152
|
env?: Record<string, string>;
|
|
173
153
|
}
|
|
174
154
|
|
|
175
|
-
|
|
155
|
+
function wrapWithLspmux(
|
|
176
156
|
originalCommand: string,
|
|
177
157
|
originalArgs: string[] | undefined,
|
|
178
158
|
state: LspmuxState,
|
|
@@ -256,35 +256,6 @@ export type SymbolKind =
|
|
|
256
256
|
| 25 // Operator
|
|
257
257
|
| 26; // TypeParameter
|
|
258
258
|
|
|
259
|
-
export const SYMBOL_KIND_NAMES: Record<SymbolKind, string> = {
|
|
260
|
-
1: "File",
|
|
261
|
-
2: "Module",
|
|
262
|
-
3: "Namespace",
|
|
263
|
-
4: "Package",
|
|
264
|
-
5: "Class",
|
|
265
|
-
6: "Method",
|
|
266
|
-
7: "Property",
|
|
267
|
-
8: "Field",
|
|
268
|
-
9: "Constructor",
|
|
269
|
-
10: "Enum",
|
|
270
|
-
11: "Interface",
|
|
271
|
-
12: "Function",
|
|
272
|
-
13: "Variable",
|
|
273
|
-
14: "Constant",
|
|
274
|
-
15: "String",
|
|
275
|
-
16: "Number",
|
|
276
|
-
17: "Boolean",
|
|
277
|
-
18: "Array",
|
|
278
|
-
19: "Object",
|
|
279
|
-
20: "Key",
|
|
280
|
-
21: "Null",
|
|
281
|
-
22: "EnumMember",
|
|
282
|
-
23: "Struct",
|
|
283
|
-
24: "Event",
|
|
284
|
-
25: "Operator",
|
|
285
|
-
26: "TypeParameter",
|
|
286
|
-
};
|
|
287
|
-
|
|
288
259
|
export interface DocumentSymbol {
|
|
289
260
|
name: string;
|
|
290
261
|
detail?: string;
|
|
@@ -192,7 +192,7 @@ const SEVERITY_NAMES: Record<DiagnosticSeverity, string> = {
|
|
|
192
192
|
4: "hint",
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
function severityToString(severity?: DiagnosticSeverity): string {
|
|
196
196
|
return SEVERITY_NAMES[severity ?? 1] ?? "unknown";
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -211,21 +211,6 @@ export function sortDiagnostics(diagnostics: Diagnostic[]): Diagnostic[] {
|
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
export function severityToIcon(severity?: DiagnosticSeverity): string {
|
|
215
|
-
switch (severity ?? 1) {
|
|
216
|
-
case 1:
|
|
217
|
-
return "[E]";
|
|
218
|
-
case 2:
|
|
219
|
-
return "[W]";
|
|
220
|
-
case 3:
|
|
221
|
-
return "[I]";
|
|
222
|
-
case 4:
|
|
223
|
-
return "[H]";
|
|
224
|
-
default:
|
|
225
|
-
return "[E]";
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
214
|
function stripDiagnosticNoise(message: string): string {
|
|
230
215
|
return message
|
|
231
216
|
.split("\n")
|
|
@@ -353,10 +338,6 @@ export function formatLocation(location: Location, cwd: string): string {
|
|
|
353
338
|
return `${file}:${line}:${col}`;
|
|
354
339
|
}
|
|
355
340
|
|
|
356
|
-
export function formatPosition(line: number, col: number): string {
|
|
357
|
-
return `${line}:${col}`;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
341
|
// =============================================================================
|
|
361
342
|
// WorkspaceEdit Formatting
|
|
362
343
|
// =============================================================================
|
|
@@ -397,15 +378,6 @@ export function formatWorkspaceEdit(edit: WorkspaceEdit, cwd: string): string[]
|
|
|
397
378
|
return results;
|
|
398
379
|
}
|
|
399
380
|
|
|
400
|
-
export function formatTextEdit(edit: TextEdit, maxLength = 50): string {
|
|
401
|
-
const range = `${edit.range.start.line + 1}:${edit.range.start.character + 1}`;
|
|
402
|
-
const preview =
|
|
403
|
-
edit.newText.length > maxLength
|
|
404
|
-
? `${edit.newText.slice(0, maxLength).replace(/\n/g, "\\n")}…`
|
|
405
|
-
: edit.newText.replace(/\n/g, "\\n");
|
|
406
|
-
return `line ${range} -> "${preview}"`;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
381
|
// =============================================================================
|
|
410
382
|
// Symbol Formatting
|
|
411
383
|
// =============================================================================
|
|
@@ -443,10 +415,6 @@ export function symbolKindToIcon(kind: SymbolKind): string {
|
|
|
443
415
|
return `[${SYMBOL_KIND_LABELS[kind] ?? "?"}]`;
|
|
444
416
|
}
|
|
445
417
|
|
|
446
|
-
export function symbolKindToName(kind: SymbolKind): string {
|
|
447
|
-
return SYMBOL_KIND_LABELS[kind] ?? "Unknown";
|
|
448
|
-
}
|
|
449
|
-
|
|
450
418
|
export function formatDocumentSymbol(symbol: DocumentSymbol, indent = 0): string[] {
|
|
451
419
|
const prefix = " ".repeat(indent);
|
|
452
420
|
const icon = symbolKindToIcon(symbol.kind);
|