@greppleai/grip 0.0.0-stage → 0.1.3
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/CHANGELOG.md +115 -0
- package/README.md +731 -2
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +13 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/embedded-assets.d.ts +3 -0
- package/dist/bun/embedded-assets.d.ts.map +1 -0
- package/dist/bun/embedded-assets.js +52 -0
- package/dist/bun/embedded-assets.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +70 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +442 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +60 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +406 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session.d.ts +970 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +5191 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +150 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +557 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +26 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +99 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +83 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +220 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +65 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +550 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts +34 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.js +52 -0
- package/dist/core/compaction/compression-detection-ledger.js.map +1 -0
- package/dist/core/compaction/compression-detector.d.ts +71 -0
- package/dist/core/compaction/compression-detector.d.ts.map +1 -0
- package/dist/core/compaction/compression-detector.js +407 -0
- package/dist/core/compaction/compression-detector.js.map +1 -0
- package/dist/core/compaction/compression-economics.d.ts +55 -0
- package/dist/core/compaction/compression-economics.d.ts.map +1 -0
- package/dist/core/compaction/compression-economics.js +151 -0
- package/dist/core/compaction/compression-economics.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +28 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +165 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +18 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +245 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +21 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +230 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +32 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +613 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +160 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +962 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1311 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +51 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +318 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/grip-agent.d.ts +240 -0
- package/dist/core/grip-agent.d.ts.map +1 -0
- package/dist/core/grip-agent.js +1243 -0
- package/dist/core/grip-agent.js.map +1 -0
- package/dist/core/grip-manifest.d.ts +9 -0
- package/dist/core/grip-manifest.d.ts.map +1 -0
- package/dist/core/grip-manifest.js +25 -0
- package/dist/core/grip-manifest.js.map +1 -0
- package/dist/core/hooks/aggregate.d.ts +5 -0
- package/dist/core/hooks/aggregate.d.ts.map +1 -0
- package/dist/core/hooks/aggregate.js +226 -0
- package/dist/core/hooks/aggregate.js.map +1 -0
- package/dist/core/hooks/config.d.ts +14 -0
- package/dist/core/hooks/config.d.ts.map +1 -0
- package/dist/core/hooks/config.js +372 -0
- package/dist/core/hooks/config.js.map +1 -0
- package/dist/core/hooks/executor.d.ts +12 -0
- package/dist/core/hooks/executor.d.ts.map +1 -0
- package/dist/core/hooks/executor.js +708 -0
- package/dist/core/hooks/executor.js.map +1 -0
- package/dist/core/hooks/index.d.ts +9 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +14 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/matcher.d.ts +10 -0
- package/dist/core/hooks/matcher.d.ts.map +1 -0
- package/dist/core/hooks/matcher.js +70 -0
- package/dist/core/hooks/matcher.js.map +1 -0
- package/dist/core/hooks/trust-store.d.ts +38 -0
- package/dist/core/hooks/trust-store.d.ts.map +1 -0
- package/dist/core/hooks/trust-store.js +167 -0
- package/dist/core/hooks/trust-store.js.map +1 -0
- package/dist/core/hooks/types.d.ts +234 -0
- package/dist/core/hooks/types.d.ts.map +1 -0
- package/dist/core/hooks/types.js +52 -0
- package/dist/core/hooks/types.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +21 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +82 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/instruction-resource-loader.d.ts +81 -0
- package/dist/core/instruction-resource-loader.d.ts.map +1 -0
- package/dist/core/instruction-resource-loader.js +574 -0
- package/dist/core/instruction-resource-loader.js.map +1 -0
- package/dist/core/keybindings.d.ts +399 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +299 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/lsp/abort.d.ts +3 -0
- package/dist/core/lsp/abort.d.ts.map +1 -0
- package/dist/core/lsp/abort.js +28 -0
- package/dist/core/lsp/abort.js.map +1 -0
- package/dist/core/lsp/client.d.ts +108 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +586 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/config-loader.d.ts +44 -0
- package/dist/core/lsp/config-loader.d.ts.map +1 -0
- package/dist/core/lsp/config-loader.js +223 -0
- package/dist/core/lsp/config-loader.js.map +1 -0
- package/dist/core/lsp/config.d.ts +134 -0
- package/dist/core/lsp/config.d.ts.map +1 -0
- package/dist/core/lsp/config.js +682 -0
- package/dist/core/lsp/config.js.map +1 -0
- package/dist/core/lsp/diagnostics.d.ts +18 -0
- package/dist/core/lsp/diagnostics.d.ts.map +1 -0
- package/dist/core/lsp/diagnostics.js +311 -0
- package/dist/core/lsp/diagnostics.js.map +1 -0
- package/dist/core/lsp/file-sync.d.ts +58 -0
- package/dist/core/lsp/file-sync.d.ts.map +1 -0
- package/dist/core/lsp/file-sync.js +432 -0
- package/dist/core/lsp/file-sync.js.map +1 -0
- package/dist/core/lsp/integration.d.ts +62 -0
- package/dist/core/lsp/integration.d.ts.map +1 -0
- package/dist/core/lsp/integration.js +145 -0
- package/dist/core/lsp/integration.js.map +1 -0
- package/dist/core/lsp/language-map.d.ts +54 -0
- package/dist/core/lsp/language-map.d.ts.map +1 -0
- package/dist/core/lsp/language-map.js +300 -0
- package/dist/core/lsp/language-map.js.map +1 -0
- package/dist/core/lsp/manager.d.ts +120 -0
- package/dist/core/lsp/manager.d.ts.map +1 -0
- package/dist/core/lsp/manager.js +636 -0
- package/dist/core/lsp/manager.js.map +1 -0
- package/dist/core/lsp/navigation.d.ts +32 -0
- package/dist/core/lsp/navigation.d.ts.map +1 -0
- package/dist/core/lsp/navigation.js +327 -0
- package/dist/core/lsp/navigation.js.map +1 -0
- package/dist/core/lsp/portable-path.d.ts +18 -0
- package/dist/core/lsp/portable-path.d.ts.map +1 -0
- package/dist/core/lsp/portable-path.js +83 -0
- package/dist/core/lsp/portable-path.js.map +1 -0
- package/dist/core/lsp/refactor.d.ts +32 -0
- package/dist/core/lsp/refactor.d.ts.map +1 -0
- package/dist/core/lsp/refactor.js +519 -0
- package/dist/core/lsp/refactor.js.map +1 -0
- package/dist/core/lsp/transport.d.ts +39 -0
- package/dist/core/lsp/transport.d.ts.map +1 -0
- package/dist/core/lsp/transport.js +261 -0
- package/dist/core/lsp/transport.js.map +1 -0
- package/dist/core/messages.d.ts +34 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +140 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +148 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +812 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +115 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +498 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +209 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2341 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +57 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +353 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts +465 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.js +825 -0
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts +16 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.js +54 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts +23 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +112 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts +30 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +243 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts +3 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js +31 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts +9 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js +89 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -0
- package/dist/core/remote-workspace-protocol/session.d.ts +249 -0
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/session.js +1842 -0
- package/dist/core/remote-workspace-protocol/session.js.map +1 -0
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts +71 -0
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/shared-transport.js +68 -0
- package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +32 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +257 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +200 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +1209 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/rules.d.ts +40 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +57 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/sandbox/command.d.ts +25 -0
- package/dist/core/sandbox/command.d.ts.map +1 -0
- package/dist/core/sandbox/command.js +102 -0
- package/dist/core/sandbox/command.js.map +1 -0
- package/dist/core/sandbox/config.d.ts +91 -0
- package/dist/core/sandbox/config.d.ts.map +1 -0
- package/dist/core/sandbox/config.js +88 -0
- package/dist/core/sandbox/config.js.map +1 -0
- package/dist/core/sandbox/lima-guest-binary.d.ts +11 -0
- package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -0
- package/dist/core/sandbox/lima-guest-binary.js +140 -0
- package/dist/core/sandbox/lima-guest-binary.js.map +1 -0
- package/dist/core/sandbox/lima.d.ts +57 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -0
- package/dist/core/sandbox/lima.js +716 -0
- package/dist/core/sandbox/lima.js.map +1 -0
- package/dist/core/sandbox/shared-lima-roots.d.ts +11 -0
- package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -0
- package/dist/core/sandbox/shared-lima-roots.js +25 -0
- package/dist/core/sandbox/shared-lima-roots.js.map +1 -0
- package/dist/core/sandbox/update-shared-guest-binary.d.ts +8 -0
- package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -0
- package/dist/core/sandbox/update-shared-guest-binary.js +100 -0
- package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -0
- package/dist/core/session/constants.d.ts +2 -0
- package/dist/core/session/constants.d.ts.map +1 -0
- package/dist/core/session/constants.js +2 -0
- package/dist/core/session/constants.js.map +1 -0
- package/dist/core/session/context-metadata.d.ts +5 -0
- package/dist/core/session/context-metadata.d.ts.map +1 -0
- package/dist/core/session/context-metadata.js +55 -0
- package/dist/core/session/context-metadata.js.map +1 -0
- package/dist/core/session/context.d.ts +14 -0
- package/dist/core/session/context.d.ts.map +1 -0
- package/dist/core/session/context.js +117 -0
- package/dist/core/session/context.js.map +1 -0
- package/dist/core/session/ids.d.ts +9 -0
- package/dist/core/session/ids.d.ts.map +1 -0
- package/dist/core/session/ids.js +21 -0
- package/dist/core/session/ids.js.map +1 -0
- package/dist/core/session/in-memory-session-manager.d.ts +17 -0
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -0
- package/dist/core/session/in-memory-session-manager.js +40 -0
- package/dist/core/session/in-memory-session-manager.js.map +1 -0
- package/dist/core/session/in-memory-session.d.ts +7 -0
- package/dist/core/session/in-memory-session.d.ts.map +1 -0
- package/dist/core/session/in-memory-session.js +11 -0
- package/dist/core/session/in-memory-session.js.map +1 -0
- package/dist/core/session/jsonl-errors.d.ts +36 -0
- package/dist/core/session/jsonl-errors.d.ts.map +1 -0
- package/dist/core/session/jsonl-errors.js +49 -0
- package/dist/core/session/jsonl-errors.js.map +1 -0
- package/dist/core/session/jsonl-helpers.d.ts +20 -0
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -0
- package/dist/core/session/jsonl-helpers.js +21 -0
- package/dist/core/session/jsonl-helpers.js.map +1 -0
- package/dist/core/session/local-session-manager.d.ts +30 -0
- package/dist/core/session/local-session-manager.d.ts.map +1 -0
- package/dist/core/session/local-session-manager.js +205 -0
- package/dist/core/session/local-session-manager.js.map +1 -0
- package/dist/core/session/local-session.d.ts +9 -0
- package/dist/core/session/local-session.d.ts.map +1 -0
- package/dist/core/session/local-session.js +15 -0
- package/dist/core/session/local-session.js.map +1 -0
- package/dist/core/session/migrations.d.ts +11 -0
- package/dist/core/session/migrations.d.ts.map +1 -0
- package/dist/core/session/migrations.js +78 -0
- package/dist/core/session/migrations.js.map +1 -0
- package/dist/core/session/remote-session-client.d.ts +83 -0
- package/dist/core/session/remote-session-client.d.ts.map +1 -0
- package/dist/core/session/remote-session-client.js +224 -0
- package/dist/core/session/remote-session-client.js.map +1 -0
- package/dist/core/session/remote-session-manager.d.ts +32 -0
- package/dist/core/session/remote-session-manager.d.ts.map +1 -0
- package/dist/core/session/remote-session-manager.js +124 -0
- package/dist/core/session/remote-session-manager.js.map +1 -0
- package/dist/core/session/remote-session.d.ts +20 -0
- package/dist/core/session/remote-session.d.ts.map +1 -0
- package/dist/core/session/remote-session.js +33 -0
- package/dist/core/session/remote-session.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +18 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +2 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/session/session.d.ts +140 -0
- package/dist/core/session/session.d.ts.map +1 -0
- package/dist/core/session/session.js +461 -0
- package/dist/core/session/session.js.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts +39 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.js +168 -0
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts +97 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.js +1140 -0
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -0
- package/dist/core/session/stores/remote-session-store.d.ts +44 -0
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/remote-session-store.js +159 -0
- package/dist/core/session/stores/remote-session-store.js.map +1 -0
- package/dist/core/session/stores/session-store.d.ts +42 -0
- package/dist/core/session/stores/session-store.d.ts.map +1 -0
- package/dist/core/session/stores/session-store.js +2 -0
- package/dist/core/session/stores/session-store.js.map +1 -0
- package/dist/core/session/types.d.ts +141 -0
- package/dist/core/session/types.d.ts.map +1 -0
- package/dist/core/session/types.js +2 -0
- package/dist/core/session/types.js.map +1 -0
- package/dist/core/session/usage-ledger.d.ts +18 -0
- package/dist/core/session/usage-ledger.d.ts.map +1 -0
- package/dist/core/session/usage-ledger.js +68 -0
- package/dist/core/session/usage-ledger.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/settings-manager.d.ts +314 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +991 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +40 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +57 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +36 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +26 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +27 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +32 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +131 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +51 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +321 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/compress-context.d.ts +27 -0
- package/dist/core/tools/compress-context.d.ts.map +1 -0
- package/dist/core/tools/compress-context.js +142 -0
- package/dist/core/tools/compress-context.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +82 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +327 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +8 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +69 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +22 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +268 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +27 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +332 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/hash-store.d.ts +12 -0
- package/dist/core/tools/hash-store.d.ts.map +1 -0
- package/dist/core/tools/hash-store.js +48 -0
- package/dist/core/tools/hash-store.js.map +1 -0
- package/dist/core/tools/hashline/apply.d.ts +40 -0
- package/dist/core/tools/hashline/apply.d.ts.map +1 -0
- package/dist/core/tools/hashline/apply.js +261 -0
- package/dist/core/tools/hashline/apply.js.map +1 -0
- package/dist/core/tools/hashline/hash.d.ts +56 -0
- package/dist/core/tools/hashline/hash.d.ts.map +1 -0
- package/dist/core/tools/hashline/hash.js +196 -0
- package/dist/core/tools/hashline/hash.js.map +1 -0
- package/dist/core/tools/hashline/parse.d.ts +8 -0
- package/dist/core/tools/hashline/parse.d.ts.map +1 -0
- package/dist/core/tools/hashline/parse.js +41 -0
- package/dist/core/tools/hashline/parse.js.map +1 -0
- package/dist/core/tools/hashline/resolve.d.ts +51 -0
- package/dist/core/tools/hashline/resolve.d.ts.map +1 -0
- package/dist/core/tools/hashline/resolve.js +187 -0
- package/dist/core/tools/hashline/resolve.js.map +1 -0
- package/dist/core/tools/hashline-utils.d.ts +6 -0
- package/dist/core/tools/hashline-utils.d.ts.map +1 -0
- package/dist/core/tools/hashline-utils.js +23 -0
- package/dist/core/tools/hashline-utils.js.map +1 -0
- package/dist/core/tools/index.d.ts +36 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +141 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +21 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +156 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/operations.d.ts +212 -0
- package/dist/core/tools/operations.d.ts.map +1 -0
- package/dist/core/tools/operations.js +793 -0
- package/dist/core/tools/operations.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +54 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +9 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +32 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +318 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +33 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +61 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/replace-diff.d.ts +16 -0
- package/dist/core/tools/replace-diff.d.ts.map +1 -0
- package/dist/core/tools/replace-diff.js +117 -0
- package/dist/core/tools/replace-diff.js.map +1 -0
- package/dist/core/tools/replace-normalize.d.ts +2 -0
- package/dist/core/tools/replace-normalize.d.ts.map +1 -0
- package/dist/core/tools/replace-normalize.js +73 -0
- package/dist/core/tools/replace-normalize.js.map +1 -0
- package/dist/core/tools/replace-render.d.ts +51 -0
- package/dist/core/tools/replace-render.d.ts.map +1 -0
- package/dist/core/tools/replace-render.js +162 -0
- package/dist/core/tools/replace-render.js.map +1 -0
- package/dist/core/tools/runtime.d.ts +2 -0
- package/dist/core/tools/runtime.d.ts.map +1 -0
- package/dist/core/tools/runtime.js +6 -0
- package/dist/core/tools/runtime.js.map +1 -0
- package/dist/core/tools/session-history.d.ts +55 -0
- package/dist/core/tools/session-history.d.ts.map +1 -0
- package/dist/core/tools/session-history.js +649 -0
- package/dist/core/tools/session-history.js.map +1 -0
- package/dist/core/tools/subagent-agents.d.ts +29 -0
- package/dist/core/tools/subagent-agents.d.ts.map +1 -0
- package/dist/core/tools/subagent-agents.js +223 -0
- package/dist/core/tools/subagent-agents.js.map +1 -0
- package/dist/core/tools/subagent.d.ts +185 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +1309 -0
- package/dist/core/tools/subagent.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +39 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +33 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +341 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/workspace-tool-host.d.ts +102 -0
- package/dist/core/tools/workspace-tool-host.d.ts.map +1 -0
- package/dist/core/tools/workspace-tool-host.js +348 -0
- package/dist/core/tools/workspace-tool-host.js.map +1 -0
- package/dist/core/tools/write.d.ts +16 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +204 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/workspace-identity.d.ts +7 -0
- package/dist/core/workspace-identity.d.ts.map +1 -0
- package/dist/core/workspace-identity.js +2 -0
- package/dist/core/workspace-identity.js.map +1 -0
- package/dist/daemon/activity-budget.d.ts +10 -0
- package/dist/daemon/activity-budget.d.ts.map +1 -0
- package/dist/daemon/activity-budget.js +34 -0
- package/dist/daemon/activity-budget.js.map +1 -0
- package/dist/daemon/command.d.ts +6 -0
- package/dist/daemon/command.d.ts.map +1 -0
- package/dist/daemon/command.js +58 -0
- package/dist/daemon/command.js.map +1 -0
- package/dist/daemon/config.d.ts +45 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +319 -0
- package/dist/daemon/config.js.map +1 -0
- package/dist/daemon/help.d.ts +2 -0
- package/dist/daemon/help.d.ts.map +1 -0
- package/dist/daemon/help.js +42 -0
- package/dist/daemon/help.js.map +1 -0
- package/dist/daemon/lsp-config.d.ts +4 -0
- package/dist/daemon/lsp-config.d.ts.map +1 -0
- package/dist/daemon/lsp-config.js +155 -0
- package/dist/daemon/lsp-config.js.map +1 -0
- package/dist/daemon/outbound-budget.d.ts +10 -0
- package/dist/daemon/outbound-budget.d.ts.map +1 -0
- package/dist/daemon/outbound-budget.js +30 -0
- package/dist/daemon/outbound-budget.js.map +1 -0
- package/dist/daemon/security.d.ts +19 -0
- package/dist/daemon/security.d.ts.map +1 -0
- package/dist/daemon/security.js +177 -0
- package/dist/daemon/security.js.map +1 -0
- package/dist/daemon/server.d.ts +20 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +480 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/shared-connection.d.ts +33 -0
- package/dist/daemon/shared-connection.d.ts.map +1 -0
- package/dist/daemon/shared-connection.js +271 -0
- package/dist/daemon/shared-connection.js.map +1 -0
- package/dist/daemon/shared-revision.d.ts +5 -0
- package/dist/daemon/shared-revision.d.ts.map +1 -0
- package/dist/daemon/shared-revision.js +61 -0
- package/dist/daemon/shared-revision.js.map +1 -0
- package/dist/daemon/shared-roots.d.ts +9 -0
- package/dist/daemon/shared-roots.d.ts.map +1 -0
- package/dist/daemon/shared-roots.js +33 -0
- package/dist/daemon/shared-roots.js.map +1 -0
- package/dist/daemon/workspace-runtime.d.ts +46 -0
- package/dist/daemon/workspace-runtime.d.ts.map +1 -0
- package/dist/daemon/workspace-runtime.js +705 -0
- package/dist/daemon/workspace-runtime.js.map +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +39 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +765 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +35 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +412 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +159 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +173 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +18 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +45 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +46 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +74 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +514 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +25 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +85 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +81 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +118 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +36 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +227 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/hook-execution.d.ts +19 -0
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/hook-execution.js +185 -0
- package/dist/modes/interactive/components/hook-execution.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +55 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +176 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +14 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +228 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/message-card.d.ts +9 -0
- package/dist/modes/interactive/components/message-card.d.ts.map +1 -0
- package/dist/modes/interactive/components/message-card.js +24 -0
- package/dist/modes/interactive/components/message-card.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +52 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +296 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +50 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +300 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +144 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +108 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +835 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +455 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +18 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +48 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +51 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +312 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +127 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1098 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +16 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +50 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +554 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5870 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +86 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +109 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1040 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +29 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +142 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +321 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +755 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +963 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +652 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +488 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +25 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +23 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +74 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +15 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +88 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +13 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +248 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +171 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/directory-completions.d.ts +5 -0
- package/dist/utils/directory-completions.d.ts.map +1 -0
- package/dist/utils/directory-completions.js +64 -0
- package/dist/utils/directory-completions.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +6 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +166 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +27 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +237 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/grip-user-agent.d.ts +2 -0
- package/dist/utils/grip-user-agent.d.ts.map +1 -0
- package/dist/utils/grip-user-agent.js +5 -0
- package/dist/utils/grip-user-agent.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +43 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +133 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +19 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +86 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +87 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +22 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +126 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +28 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +188 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +125 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +5 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +329 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +91 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +408 -0
- package/docs/custom-provider.md +714 -0
- package/docs/daemon-architecture.md +399 -0
- package/docs/daemon.md +112 -0
- package/docs/development.md +72 -0
- package/docs/docs.json +164 -0
- package/docs/extensions.md +2745 -0
- package/docs/hooks.md +85 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +77 -0
- package/docs/json.md +89 -0
- package/docs/keybindings.md +230 -0
- package/docs/lsp.md +499 -0
- package/docs/migrating-to-grip.md +18 -0
- package/docs/models.md +496 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +251 -0
- package/docs/quickstart.md +159 -0
- package/docs/rpc.md +1492 -0
- package/docs/rules.md +117 -0
- package/docs/sandbox.md +104 -0
- package/docs/sdk.md +360 -0
- package/docs/session-format.md +414 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +372 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +246 -0
- package/docs/terminal-setup.md +112 -0
- package/docs/termux.md +112 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +918 -0
- package/docs/usage.md +304 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +29 -0
- package/examples/daemon-docker/Dockerfile +43 -0
- package/examples/daemon-docker/README.md +45 -0
- package/examples/extensions/README.md +208 -0
- package/examples/extensions/auto-commit-on-exit.ts +46 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +259 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +82 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +131 -0
- package/examples/extensions/custom-footer.ts +79 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +707 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +402 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +104 -0
- package/examples/extensions/dirty-repo-guard.ts +59 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/RULES.md +8 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +16 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +125 -0
- package/examples/extensions/github-issue-autocomplete.ts +191 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +104 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +194 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +428 -0
- package/examples/extensions/modal-editor.ts +86 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1374 -0
- package/examples/extensions/overlay-test.ts +171 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +346 -0
- package/examples/extensions/plan-mode/utils.ts +172 -0
- package/examples/extensions/preset.ts +426 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +29 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +125 -0
- package/examples/extensions/question.ts +294 -0
- package/examples/extensions/questionnaire.ts +459 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +320 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +381 -0
- package/examples/extensions/space-invaders.ts +597 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1083 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +186 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1091 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +306 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +141 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +200 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/remote-session-server/README.md +71 -0
- package/examples/remote-session-server/server.ts +353 -0
- package/examples/rpc-extension-ui.ts +642 -0
- package/examples/sdk/01-minimal.ts +27 -0
- package/examples/sdk/02-custom-model.ts +54 -0
- package/examples/sdk/03-custom-prompt.ts +76 -0
- package/examples/sdk/04-skills.ts +60 -0
- package/examples/sdk/05-tools.ts +55 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +56 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +50 -0
- package/examples/sdk/10-settings.ts +58 -0
- package/examples/sdk/11-sessions.ts +54 -0
- package/examples/sdk/12-full-control.ts +79 -0
- package/examples/sdk/13-session-runtime.ts +49 -0
- package/examples/sdk/README.md +94 -0
- package/npm-shrinkwrap.json +1878 -0
- package/package.json +101 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { posix, win32 } from "node:path";
|
|
2
|
+
export type PortablePathFlavor = "posix" | "windows";
|
|
3
|
+
type PathApi = typeof posix | typeof win32;
|
|
4
|
+
export declare function absolutePathFlavor(value: string): PortablePathFlavor | undefined;
|
|
5
|
+
export declare function pathFlavor(value: string, fallback?: PortablePathFlavor): PortablePathFlavor;
|
|
6
|
+
export declare function pathApi(flavor: PortablePathFlavor): PathApi;
|
|
7
|
+
export declare function isPortableAbsolute(value: string): boolean;
|
|
8
|
+
export declare function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string;
|
|
9
|
+
export declare function resolvePortablePath(baseDir: string, value: string): string;
|
|
10
|
+
export declare function joinPortablePath(basePath: string, ...parts: string[]): string;
|
|
11
|
+
export declare function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string;
|
|
12
|
+
export declare function pathComparisonValue(value: string, flavor?: PortablePathFlavor): string;
|
|
13
|
+
export declare function portablePathToFileUri(filePath: string): string;
|
|
14
|
+
export declare function relativePortablePath(from: string, to: string): string;
|
|
15
|
+
/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */
|
|
16
|
+
export declare function relativeWithin(root: string, candidate: string): string | undefined;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=portable-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-path.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,KAAK,OAAO,GAAG,OAAO,KAAK,GAAG,OAAO,KAAK,CAAC;AAE3C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAIhF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAA4B,GAAG,kBAAkB,CAEpG;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAE3D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAE1F;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAE7E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAExF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAoB,GAAG,MAAM,CAGrF;AAUD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY9D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYlF","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { posix, win32 } from "node:path";
|
|
2
|
+
export function absolutePathFlavor(value) {
|
|
3
|
+
if (/^[A-Za-z]:[\\/]/.test(value) || /^[\\/]{2}[^\\/]+[\\/][^\\/]+/.test(value))
|
|
4
|
+
return "windows";
|
|
5
|
+
if (value.startsWith("/"))
|
|
6
|
+
return "posix";
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
export function pathFlavor(value, fallback = "posix") {
|
|
10
|
+
return absolutePathFlavor(value) ?? fallback;
|
|
11
|
+
}
|
|
12
|
+
export function pathApi(flavor) {
|
|
13
|
+
return flavor === "windows" ? win32 : posix;
|
|
14
|
+
}
|
|
15
|
+
export function isPortableAbsolute(value) {
|
|
16
|
+
return absolutePathFlavor(value) !== undefined;
|
|
17
|
+
}
|
|
18
|
+
export function normalizePortablePath(value, fallback) {
|
|
19
|
+
return pathApi(pathFlavor(value, fallback)).normalize(value);
|
|
20
|
+
}
|
|
21
|
+
export function resolvePortablePath(baseDir, value) {
|
|
22
|
+
const absoluteFlavor = absolutePathFlavor(value);
|
|
23
|
+
if (absoluteFlavor)
|
|
24
|
+
return pathApi(absoluteFlavor).normalize(value);
|
|
25
|
+
const baseFlavor = pathFlavor(baseDir);
|
|
26
|
+
return pathApi(baseFlavor).resolve(baseDir, value);
|
|
27
|
+
}
|
|
28
|
+
export function joinPortablePath(basePath, ...parts) {
|
|
29
|
+
return pathApi(pathFlavor(basePath)).join(basePath, ...parts);
|
|
30
|
+
}
|
|
31
|
+
export function dirnamePortablePath(value, fallback) {
|
|
32
|
+
return pathApi(pathFlavor(value, fallback)).dirname(value);
|
|
33
|
+
}
|
|
34
|
+
export function pathComparisonValue(value, flavor = pathFlavor(value)) {
|
|
35
|
+
const normalized = pathApi(flavor).normalize(value);
|
|
36
|
+
return flavor === "windows" ? normalized.toLowerCase() : normalized;
|
|
37
|
+
}
|
|
38
|
+
function encodePathSegments(value, flavor) {
|
|
39
|
+
return value
|
|
40
|
+
.split(flavor === "windows" ? /[\\/]/ : "/")
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.map((segment) => encodeURIComponent(segment))
|
|
43
|
+
.join("/");
|
|
44
|
+
}
|
|
45
|
+
export function portablePathToFileUri(filePath) {
|
|
46
|
+
const flavor = pathFlavor(filePath);
|
|
47
|
+
const normalized = normalizePortablePath(filePath, flavor);
|
|
48
|
+
if (flavor === "posix")
|
|
49
|
+
return `file:///${encodePathSegments(normalized, flavor)}`;
|
|
50
|
+
if (normalized.startsWith("\\\\")) {
|
|
51
|
+
const parts = normalized.slice(2).split("\\");
|
|
52
|
+
const host = parts.shift();
|
|
53
|
+
if (!host)
|
|
54
|
+
throw new Error(`Invalid UNC path: ${filePath}`);
|
|
55
|
+
return `file://${host}/${encodePathSegments(parts.join("/"), flavor)}`;
|
|
56
|
+
}
|
|
57
|
+
const drive = normalized.slice(0, 2);
|
|
58
|
+
return `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;
|
|
59
|
+
}
|
|
60
|
+
export function relativePortablePath(from, to) {
|
|
61
|
+
const flavor = pathFlavor(from);
|
|
62
|
+
if (absolutePathFlavor(to) !== flavor)
|
|
63
|
+
return to;
|
|
64
|
+
return pathApi(flavor).relative(from, to);
|
|
65
|
+
}
|
|
66
|
+
/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */
|
|
67
|
+
export function relativeWithin(root, candidate) {
|
|
68
|
+
const flavor = pathFlavor(root);
|
|
69
|
+
if (absolutePathFlavor(candidate) !== flavor)
|
|
70
|
+
return undefined;
|
|
71
|
+
const api = pathApi(flavor);
|
|
72
|
+
const normalizedRoot = api.normalize(root);
|
|
73
|
+
const normalizedCandidate = api.normalize(candidate);
|
|
74
|
+
const comparableRoot = pathComparisonValue(normalizedRoot, flavor);
|
|
75
|
+
const comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);
|
|
76
|
+
if (comparableRoot === comparableCandidate)
|
|
77
|
+
return "";
|
|
78
|
+
const prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;
|
|
79
|
+
if (!comparableCandidate.startsWith(prefix))
|
|
80
|
+
return undefined;
|
|
81
|
+
return normalizedCandidate.slice(prefix.length);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=portable-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-path.js","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAMzC,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAkC;IACjF,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClG,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,QAAQ,GAAuB,OAAO,EAAsB;IACrG,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC;AAAA,CAC7C;AAED,MAAM,UAAU,OAAO,CAAC,MAA0B,EAAW;IAC5D,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAAA,CAC5C;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAW;IAC1D,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAAA,CAC/C;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,QAA6B,EAAU;IAC3F,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAAA,CAC7D;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,KAAa,EAAU;IAC3E,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,cAAc;QAAE,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAAA,CACnD;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,GAAG,KAAe,EAAU;IAC9E,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;AAAA,CAC9D;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,QAA6B,EAAU;IACzF,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC3D;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,EAAU;IACtF,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAAA,CACpE;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,MAA0B,EAAU;IAC9E,OAAO,KAAK;SACV,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;SAC3C,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC7C,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,CACZ;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAU;IAC/D,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,WAAW,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;IACnF,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;QAC5D,OAAO,UAAU,IAAI,IAAI,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,OAAO,WAAW,KAAK,IAAI,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;AAAA,CAC7E;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,EAAU,EAAU;IACtE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,EAAE,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACjD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAAA,CAC1C;AAED,0GAA0G;AAC1G,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,SAAiB,EAAsB;IACnF,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,SAAS,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,mBAAmB,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,cAAc,KAAK,mBAAmB;QAAE,OAAO,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,OAAO,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAAA,CAChD","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
3
|
+
import type { ToolOperations } from "../tools/operations.ts";
|
|
4
|
+
import type { LspRuntimeState } from "./integration.ts";
|
|
5
|
+
declare const renameSchema: Type.TObject<{
|
|
6
|
+
path: Type.TString;
|
|
7
|
+
line: Type.TInteger;
|
|
8
|
+
character: Type.TInteger;
|
|
9
|
+
newName: Type.TString;
|
|
10
|
+
}>;
|
|
11
|
+
declare const codeActionsSchema: Type.TObject<{
|
|
12
|
+
path: Type.TString;
|
|
13
|
+
line: Type.TInteger;
|
|
14
|
+
character: Type.TInteger;
|
|
15
|
+
endLine: Type.TOptional<Type.TInteger>;
|
|
16
|
+
endCharacter: Type.TOptional<Type.TInteger>;
|
|
17
|
+
kind: Type.TOptional<Type.TString>;
|
|
18
|
+
}>;
|
|
19
|
+
export interface LspRenameDetails {
|
|
20
|
+
fileCount: number;
|
|
21
|
+
editCount: number;
|
|
22
|
+
truncated?: boolean;
|
|
23
|
+
conflict?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface LspCodeActionsDetails {
|
|
26
|
+
count: number;
|
|
27
|
+
preferredCount: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function createLspRenameTool(getState: () => LspRuntimeState, getOperations?: () => ToolOperations): ToolDefinition<typeof renameSchema, LspRenameDetails>;
|
|
30
|
+
export declare function createLspCodeActionsTool(getState: () => LspRuntimeState, getOperations?: () => ToolOperations): ToolDefinition<typeof codeActionsSchema, LspCodeActionsDetails>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=refactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/refactor.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAU5C,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,QAAA,MAAM,YAAY;;;;;EAGhB,CAAC;AAEH,QAAA,MAAM,iBAAiB;;;;;;;EASrB,CAAC;AAcH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACvB;AAifD,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,YAAY,EAAE,gBAAgB,CAAC,CAmGvD;AAED,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,iBAAiB,EAAE,qBAAqB,CAAC,CAqEjE","sourcesContent":["import { Text } from \"@greppleai/grip-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type {\n\tCodeAction,\n\tCommand,\n\tDiagnostic,\n\tPosition,\n\tRange,\n\tTextEdit,\n\tWorkspaceEdit,\n} from \"vscode-languageserver-protocol\";\nimport type { AgentToolResult, ToolDefinition } from \"../extensions/types.ts\";\nimport type { ToolOperations } from \"../tools/operations.ts\";\nimport { throwIfAborted } from \"./abort.ts\";\nimport type { LspRuntimeState } from \"./integration.ts\";\nimport type { LspClientRoute, LspClientRouteCollection, LspClientRouteFailure, LspToolFeature } from \"./manager.ts\";\nimport { relativePortablePath } from \"./portable-path.ts\";\n\nconst MAX_ACTIONS = 40;\nconst MAX_EDIT_LINES = 80;\n\nconst positionFields = {\n\tpath: Type.String({ description: \"File path\" }),\n\tline: Type.Integer({ minimum: 1, description: \"Line number, 1-indexed\" }),\n\tcharacter: Type.Integer({ minimum: 1, description: \"Column number, 1-indexed\" }),\n};\n\nconst renameSchema = Type.Object({\n\t...positionFields,\n\tnewName: Type.String({ description: \"New name for the symbol\" }),\n});\n\nconst codeActionsSchema = Type.Object({\n\t...positionFields,\n\tendLine: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"End line for a range selection, 1-indexed. Defaults to line.\" }),\n\t),\n\tendCharacter: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"End column for a range selection, 1-indexed. Defaults to character.\" }),\n\t),\n\tkind: Type.Optional(Type.String({ description: \"Optional action kind filter, e.g. quickfix, refactor, source.\" })),\n});\n\ntype RenameInput = Static<typeof renameSchema>;\ntype CodeActionsInput = Static<typeof codeActionsSchema>;\n\ninterface OneBasedPosition {\n\tline: number;\n\tcharacter: number;\n}\n\ninterface LspFileInput {\n\tpath: string;\n}\n\nexport interface LspRenameDetails {\n\tfileCount: number;\n\teditCount: number;\n\ttruncated?: boolean;\n\tconflict?: boolean;\n}\n\nexport interface LspCodeActionsDetails {\n\tcount: number;\n\tpreferredCount: number;\n}\n\ntype CodeActionResponse = (CodeAction | Command)[] | null;\n\ninterface TextDocumentEditReference {\n\turi: string;\n\tversion?: number | null;\n}\n\ntype TextDocumentEditLike = {\n\ttextDocument: TextDocumentEditReference;\n\tedits: TextEdit[];\n};\n\ninterface WorkspaceEditEntry {\n\tpath: string;\n\tedit: TextEdit;\n\tversion?: number | null;\n}\n\ninterface WorkspaceEditCollection {\n\tentries: WorkspaceEditEntry[];\n\tresourceOperations: ResourceOperationPreview[];\n\tversionErrors: string[];\n}\n\ninterface WorkspaceEditCollectionContext {\n\tstate: LspRuntimeState;\n\troute: LspClientRoute;\n\tvalidateDocumentVersions: boolean;\n}\n\ninterface WorkspaceEditPreview {\n\tlines: string[];\n\tfileCount: number;\n\teditCount: number;\n\ttruncated: boolean;\n\tsignature: string;\n\tversionErrors: string[];\n}\n\ninterface RenamePreviewResult {\n\tserverId: string;\n\tpreview: WorkspaceEditPreview;\n}\n\ninterface AggregatedAction {\n\titem: CodeAction | Command;\n\troute: LspClientRoute;\n\tserverIds: string[];\n\tpreferred: boolean;\n}\n\ninterface CodeActionRouteOutcome {\n\troute: LspClientRoute;\n\titems: (CodeAction | Command)[];\n\tfailure?: LspClientRouteFailure;\n}\n\nfunction toPosition(input: OneBasedPosition): Position {\n\treturn { line: input.line - 1, character: input.character - 1 };\n}\n\nfunction relativeUriPath(state: LspRuntimeState, route: LspClientRoute, uri: string): string {\n\tconst mapped = route.target.mapper.serverUriToAgentPath(uri);\n\treturn mapped.ok ? relativePortablePath(state.manager.cwd, mapped.value) : `[unmapped URI: ${mapped.reason}]`;\n}\n\nfunction formatTextEdit(edit: TextEdit): string {\n\tconst startLine = edit.range.start.line + 1;\n\tconst startColumn = edit.range.start.character + 1;\n\tconst endLine = edit.range.end.line + 1;\n\tconst endColumn = edit.range.end.character + 1;\n\tconst replacement = edit.newText.replace(/\\n/g, \"\\\\n\");\n\tconst clipped = replacement.length > 120 ? `${replacement.slice(0, 117)}...` : replacement;\n\treturn `${startLine}:${startColumn}-${endLine}:${endColumn} -> ${JSON.stringify(clipped)}`;\n}\n\nfunction isTextDocumentEditLike(value: unknown): value is TextDocumentEditLike {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"textDocument\" in value &&\n\t\t\"edits\" in value &&\n\t\tArray.isArray((value as { edits?: unknown }).edits)\n\t);\n}\n\nfunction stableSerialize(value: unknown, ancestors = new Set<object>()): string {\n\tif (value === null || typeof value !== \"object\") return JSON.stringify(value) ?? String(value);\n\tif (ancestors.has(value)) return '\"[circular]\"';\n\tancestors.add(value);\n\tlet output: string;\n\tif (Array.isArray(value)) {\n\t\toutput = `[${value.map((item) => stableSerialize(item, ancestors)).join(\",\")}]`;\n\t} else {\n\t\tconst entries = Object.entries(value).sort(([left], [right]) => left.localeCompare(right));\n\t\toutput = `{${entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, ancestors)}`).join(\",\")}}`;\n\t}\n\tancestors.delete(value);\n\treturn output;\n}\n\ninterface ResourceOperationPreview {\n\tline: string;\n\tpaths: string[];\n\tsignature: string;\n}\n\nfunction normalizeResourceOperation(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tvalue: unknown,\n): ResourceOperationPreview {\n\tif (typeof value !== \"object\" || value === null || !(\"kind\" in value) || typeof value.kind !== \"string\") {\n\t\tconst signature = stableSerialize(value);\n\t\treturn { line: `[unknown workspace operation: ${signature}]`, paths: [], signature };\n\t}\n\tif ((value.kind === \"create\" || value.kind === \"delete\") && \"uri\" in value && typeof value.uri === \"string\") {\n\t\tconst path = relativeUriPath(state, route, value.uri);\n\t\tconst options = \"options\" in value ? value.options : undefined;\n\t\tconst signature = stableSerialize({ kind: value.kind, path, options });\n\t\treturn { line: `[workspace ${value.kind}: ${path}]`, paths: [path], signature };\n\t}\n\tif (\n\t\tvalue.kind === \"rename\" &&\n\t\t\"oldUri\" in value &&\n\t\ttypeof value.oldUri === \"string\" &&\n\t\t\"newUri\" in value &&\n\t\ttypeof value.newUri === \"string\"\n\t) {\n\t\tconst oldPath = relativeUriPath(state, route, value.oldUri);\n\t\tconst newPath = relativeUriPath(state, route, value.newUri);\n\t\tconst options = \"options\" in value ? value.options : undefined;\n\t\tconst signature = stableSerialize({ kind: value.kind, oldPath, newPath, options });\n\t\treturn { line: `[workspace rename: ${oldPath} -> ${newPath}]`, paths: [oldPath, newPath], signature };\n\t}\n\tconst signature = stableSerialize(value);\n\treturn { line: `[unknown workspace operation: ${signature}]`, paths: [], signature };\n}\n\nfunction documentVersionError(\n\tcontext: WorkspaceEditCollectionContext,\n\turi: string,\n\tpath: string,\n\tversion: number | null | undefined,\n): string | undefined {\n\tif (!context.validateDocumentVersions || typeof version !== \"number\") return undefined;\n\tconst trackedVersion = context.state.fileSync.getTrackedVersion(uri, context.route.target.instanceKey);\n\tif (trackedVersion === undefined) {\n\t\treturn `unknown tracked version for ${path}; response requires document version ${version}`;\n\t}\n\tif (trackedVersion !== version) {\n\t\treturn `stale document version ${version}; tracked version is ${trackedVersion} for ${path}`;\n\t}\n\treturn undefined;\n}\n\nfunction collectDocumentChanges(\n\tcontext: WorkspaceEditCollectionContext,\n\tedit: WorkspaceEdit,\n\tcollection: WorkspaceEditCollection,\n): void {\n\tfor (const change of edit.documentChanges ?? []) {\n\t\tif (!isTextDocumentEditLike(change)) {\n\t\t\tcollection.resourceOperations.push(normalizeResourceOperation(context.state, context.route, change));\n\t\t\tcontinue;\n\t\t}\n\t\tconst path = relativeUriPath(context.state, context.route, change.textDocument.uri);\n\t\tconst version = change.textDocument.version;\n\t\tconst versionError = documentVersionError(context, change.textDocument.uri, path, version);\n\t\tif (versionError) collection.versionErrors.push(versionError);\n\t\tfor (const textEdit of change.edits) collection.entries.push({ path, edit: textEdit, version });\n\t}\n}\n\nfunction collectUriTextEdits(\n\tcontext: WorkspaceEditCollectionContext,\n\tedit: WorkspaceEdit,\n\tcollection: WorkspaceEditCollection,\n): void {\n\tfor (const [uri, edits] of Object.entries(edit.changes ?? {})) {\n\t\tconst path = relativeUriPath(context.state, context.route, uri);\n\t\tfor (const textEdit of edits) collection.entries.push({ path, edit: textEdit });\n\t}\n}\n\nfunction sortWorkspaceEditCollection(collection: WorkspaceEditCollection): void {\n\tcollection.entries.sort(\n\t\t(left, right) =>\n\t\t\tleft.path.localeCompare(right.path) ||\n\t\t\tleft.edit.range.start.line - right.edit.range.start.line ||\n\t\t\tleft.edit.range.start.character - right.edit.range.start.character ||\n\t\t\tleft.edit.range.end.line - right.edit.range.end.line ||\n\t\t\tleft.edit.range.end.character - right.edit.range.end.character ||\n\t\t\tleft.edit.newText.localeCompare(right.edit.newText),\n\t);\n\tcollection.resourceOperations.sort((left, right) => left.signature.localeCompare(right.signature));\n}\n\nfunction renderWorkspaceEditLines(collection: WorkspaceEditCollection): string[] {\n\tconst lines: string[] = [];\n\tlet previousDocument: string | undefined;\n\tfor (const entry of collection.entries) {\n\t\tconst versionLabel =\n\t\t\tentry.version === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: entry.version === null\n\t\t\t\t\t? \" (document version: unversioned)\"\n\t\t\t\t\t: ` (document version ${entry.version})`;\n\t\tconst document = `${entry.path}\\u0000${versionLabel}`;\n\t\tif (document !== previousDocument) {\n\t\t\tlines.push(`${entry.path}${versionLabel}:`);\n\t\t\tpreviousDocument = document;\n\t\t}\n\t\tlines.push(` ${formatTextEdit(entry.edit)}`);\n\t}\n\tfor (const operation of collection.resourceOperations) lines.push(operation.line);\n\treturn lines;\n}\n\nfunction workspaceEditSignature(collection: WorkspaceEditCollection): string {\n\tif (collection.entries.length === 0 && collection.resourceOperations.length === 0) return \"[]\";\n\treturn stableSerialize({\n\t\tentries: collection.entries.map((entry) => ({\n\t\t\tpath: entry.path,\n\t\t\trange: entry.edit.range,\n\t\t\tnewText: entry.edit.newText,\n\t\t})),\n\t\tresourceOperations: collection.resourceOperations.map((operation) => operation.signature),\n\t});\n}\n\nfunction collectWorkspaceEditPreview(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tedit: WorkspaceEdit | undefined,\n\tvalidateDocumentVersions = false,\n): WorkspaceEditPreview {\n\tif (!edit) {\n\t\treturn { lines: [], fileCount: 0, editCount: 0, truncated: false, signature: \"[]\", versionErrors: [] };\n\t}\n\tconst context: WorkspaceEditCollectionContext = { state, route, validateDocumentVersions };\n\tconst collection: WorkspaceEditCollection = { entries: [], resourceOperations: [], versionErrors: [] };\n\tcollectDocumentChanges(context, edit, collection);\n\tcollectUriTextEdits(context, edit, collection);\n\tsortWorkspaceEditCollection(collection);\n\tconst lines = renderWorkspaceEditLines(collection);\n\tconst shown = lines.slice(0, MAX_EDIT_LINES);\n\treturn {\n\t\tlines: shown,\n\t\tfileCount: new Set([\n\t\t\t...collection.entries.map((entry) => entry.path),\n\t\t\t...collection.resourceOperations.flatMap((operation) => operation.paths),\n\t\t]).size,\n\t\teditCount: collection.entries.length + collection.resourceOperations.length,\n\t\ttruncated: shown.length < lines.length,\n\t\tsignature: workspaceEditSignature(collection),\n\t\tversionErrors: collection.versionErrors,\n\t};\n}\n\nfunction isCodeAction(item: CodeAction | Command): item is CodeAction {\n\treturn typeof item.command !== \"string\";\n}\n\nfunction comparePosition(left: Position, right: Position): number {\n\treturn left.line - right.line || left.character - right.character;\n}\n\nfunction rangesOverlap(left: Range, right: Range): boolean {\n\treturn comparePosition(left.end, right.start) >= 0 && comparePosition(right.end, left.start) >= 0;\n}\n\nfunction failureText(failures: readonly LspClientRouteFailure[]): string {\n\tconst unique = [\n\t\t...new Map(failures.map((failure) => [`${failure.serverId}\\u0000${failure.reason}`, failure])).values(),\n\t];\n\treturn unique.length === 0\n\t\t? \"\"\n\t\t: `\\n\\nUnavailable or unsupported servers:\\n${unique.map((failure) => `- ${failure.serverId}: ${failure.reason}`).join(\"\\n\")}`;\n}\n\nasync function getClientsAndSync(\n\tstate: LspRuntimeState,\n\tinput: LspFileInput,\n\toperations: ToolOperations,\n\tfeature: LspToolFeature,\n\tsignal?: AbortSignal,\n): Promise<LspClientRouteCollection> {\n\tawait state.manager.setToolOperations(operations, signal);\n\tconst collection = await state.manager.getClientRoutesForFeature(input.path, feature, signal);\n\tif (collection.routes.length > 0) {\n\t\tconst result = await state.fileSync.synchronizeFileRead(input.path, operations, signal);\n\t\tif (result.lifecycleCancelled) {\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: [],\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...collection.routes.map((route) => ({\n\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\treason: \"synchronization was cancelled by an LSP lifecycle change\",\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tif (result.failures.length > 0) {\n\t\t\tconst failedInstances = new Set(result.failures.map((failure) => failure.instanceKey));\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: collection.routes.filter((route) => !failedInstances.has(route.target.instanceKey)),\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...result.failures.map((failure) => ({ serverId: failure.serverId, reason: failure.reason })),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t}\n\treturn collection;\n}\n\nasync function noCapableResult(\n\tstate: LspRuntimeState,\n\tpath: string,\n\tfeature: LspToolFeature,\n\tcollection: LspClientRouteCollection,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tif (collection.matchedServerCount === 0) return state.manager.getUnavailableReason(path, signal);\n\treturn `No capable LSP server is available for ${feature}.${failureText(collection.failures)}`;\n}\n\nfunction rethrowIfAborted(signal: AbortSignal | undefined): void {\n\tthrowIfAborted(signal);\n}\n\nfunction actionKey(item: CodeAction | Command, preview: WorkspaceEditPreview): string {\n\tif (isCodeAction(item)) {\n\t\treturn stableSerialize({\n\t\t\ttitle: item.title,\n\t\t\tkind: item.kind,\n\t\t\tcommand: item.command,\n\t\t\tdata: item.data,\n\t\t\tedit: preview.signature,\n\t\t});\n\t}\n\treturn stableSerialize({ title: item.title, command: item.command, arguments: item.arguments });\n}\n\nasync function requestCodeActions(\n\troute: LspClientRoute,\n\tinput: CodeActionsInput,\n\trange: Range,\n\tsignal: AbortSignal | undefined,\n): Promise<CodeActionRouteOutcome> {\n\ttry {\n\t\tconst uri = route.target.serverUri;\n\t\tconst diagnostics = route.client\n\n\t\t\t.getDiagnostics(uri)\n\n\t\t\t.filter((diagnostic: Diagnostic) => rangesOverlap(diagnostic.range, range));\n\t\tconst response = await route.client.sendRequest<CodeActionResponse>(\n\t\t\t\"textDocument/codeAction\",\n\t\t\t{\n\t\t\t\ttextDocument: { uri },\n\t\t\t\trange,\n\t\t\t\tcontext: { diagnostics, only: input.kind ? [input.kind] : undefined },\n\t\t\t},\n\t\t\tsignal,\n\t\t);\n\t\treturn { route, items: response ?? [] };\n\t} catch (error) {\n\t\trethrowIfAborted(signal);\n\t\treturn {\n\t\t\troute,\n\t\t\titems: [],\n\t\t\tfailure: {\n\t\t\t\tserverId: route.target.serverId,\n\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction aggregateCodeActions(state: LspRuntimeState, outcomes: readonly CodeActionRouteOutcome[]): AggregatedAction[] {\n\tconst aggregated = new Map<string, AggregatedAction>();\n\tfor (const outcome of outcomes) {\n\t\tfor (const item of outcome.items) {\n\t\t\tconst preview = collectWorkspaceEditPreview(state, outcome.route, isCodeAction(item) ? item.edit : undefined);\n\t\t\tconst key = actionKey(item, preview);\n\t\t\tconst existing = aggregated.get(key);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.serverIds.includes(outcome.route.target.serverId)) {\n\t\t\t\t\texisting.serverIds.push(outcome.route.target.serverId);\n\t\t\t\t}\n\t\t\t\texisting.preferred ||= isCodeAction(item) && item.isPreferred === true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\taggregated.set(key, {\n\t\t\t\titem,\n\t\t\t\troute: outcome.route,\n\t\t\t\tserverIds: [outcome.route.target.serverId],\n\t\t\t\tpreferred: isCodeAction(item) && item.isPreferred === true,\n\t\t\t});\n\t\t}\n\t}\n\treturn [...aggregated.values()];\n}\n\nfunction renderCodeActionLines(\n\tstate: LspRuntimeState,\n\tactions: readonly AggregatedAction[],\n\tattribute: boolean,\n): string[] {\n\tconst lines: string[] = [];\n\tfor (const [index, action] of actions.slice(0, MAX_ACTIONS).entries()) {\n\t\tconst provider = attribute ? `[${action.serverIds.join(\", \")}] ` : \"\";\n\t\tif (!isCodeAction(action.item)) {\n\t\t\tlines.push(`${index + 1}. ${provider}${action.item.title} [command-only: ${action.item.command}]`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst kind = action.item.kind ? ` [${action.item.kind}]` : \"\";\n\t\tconst preferred = action.preferred ? \" preferred\" : \"\";\n\t\tlines.push(`${index + 1}. ${provider}${action.item.title}${kind}${preferred}`);\n\t\tconst preview = collectWorkspaceEditPreview(state, action.route, action.item.edit);\n\t\tfor (const line of preview.lines.slice(0, 8)) lines.push(` ${line}`);\n\t\tif (preview.truncated) lines.push(\" [edit preview truncated]\");\n\t}\n\tif (actions.length > MAX_ACTIONS) lines.push(`[Showing ${MAX_ACTIONS} of ${actions.length} actions.]`);\n\treturn lines;\n}\n\nfunction consensusRenamePreview(\n\tnewName: string,\n\tpreviews: RenamePreviewResult[],\n\tfailures: readonly LspClientRouteFailure[],\n\tmatchedServerCount: number,\n): AgentToolResult<LspRenameDetails> {\n\tconst bySignature = new Map<string, RenamePreviewResult[]>();\n\tfor (const preview of previews) {\n\t\tbySignature.set(preview.preview.signature, [...(bySignature.get(preview.preview.signature) ?? []), preview]);\n\t}\n\tif (bySignature.size > 1) {\n\t\tconst sections = [...bySignature.values()].map((group) => {\n\t\t\tconst first = group[0];\n\t\t\treturn first.preview.editCount === 0\n\t\t\t\t? `[${group.map((entry) => entry.serverId).join(\", \")}] no edits`\n\t\t\t\t: `[${group.map((entry) => entry.serverId).join(\", \")}] ${first.preview.editCount} edit(s):\\n${first.preview.lines.join(\"\\n\")}`;\n\t\t});\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: `Conflicting rename previews for ${JSON.stringify(newName)}. No preview was selected and no changes were applied.\\n\\n${sections.join(\"\\n\\n\")}${failureText(failures)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: {\n\t\t\t\tfileCount: Math.max(...previews.map((entry) => entry.preview.fileCount)),\n\t\t\t\teditCount: Math.max(...previews.map((entry) => entry.preview.editCount)),\n\t\t\t\tconflict: true,\n\t\t\t},\n\t\t};\n\t}\n\tconst matching = [...bySignature.values()][0];\n\tconst selected = matching[0];\n\tif (selected.preview.editCount === 0) {\n\t\tconst providers = matching.map((entry) => entry.serverId).join(\", \");\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: `Rename preview: no edits. Successful provider(s): ${providers}. No changes were applied.${failureText(failures)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t};\n\t}\n\tconst attribution =\n\t\tmatchedServerCount > 1 ? ` Selected provider(s): ${matching.map((entry) => entry.serverId).join(\", \")}.` : \"\";\n\tconst suffix = selected.preview.truncated ? `\\n[Showing ${selected.preview.lines.length} edit preview lines.]` : \"\";\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: `Rename preview for ${JSON.stringify(newName)}: ${selected.preview.editCount} edit(s) across ${selected.preview.fileCount} file(s).${attribution} No changes were applied.\\n\\n${selected.preview.lines.join(\"\\n\")}${suffix}${failureText(failures)}`,\n\t\t\t},\n\t\t],\n\t\tdetails: {\n\t\t\tfileCount: selected.preview.fileCount,\n\t\t\teditCount: selected.preview.editCount,\n\t\t\t...(selected.preview.truncated ? { truncated: true } : {}),\n\t\t},\n\t};\n}\n\nexport function createLspRenameTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof renameSchema, LspRenameDetails> {\n\treturn {\n\t\tname: \"lsp_rename\",\n\t\tlabel: \"lsp_rename\",\n\t\tdescription:\n\t\t\t\"Preview a rename from all capable matching LSP servers. A preview is selected only when every successful response agrees, including empty responses, and document versions are current. Conflicting or stale edits are reported without choosing one. No changes are applied.\",\n\t\tpromptSnippet: \"Preview a symbol rename via LSP without applying changes\",\n\t\tpromptGuidelines: [\"lsp_rename is preview-only. Apply reviewed changes with read/edit using hashline anchors.\"],\n\t\tparameters: renameSchema,\n\t\tasync execute(_toolCallId, input: RenameInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"rename\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"rename\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<WorkspaceEdit | null>(\n\t\t\t\t\t\t\t\"textDocument/rename\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextDocument: { uri: route.target.serverUri },\n\t\t\t\t\t\t\t\tposition: toPosition(input),\n\t\t\t\t\t\t\t\tnewName: input.newName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tpreview: collectWorkspaceEditPreview(state, route, result ?? undefined, true),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst previews = outcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : []));\n\t\t\tif (previews.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `No LSP server returned a rename preview. No changes were applied.${failureText(failures)}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst unsafeVersions = previews.flatMap((entry) =>\n\t\t\t\tentry.preview.versionErrors.map((reason) => `[${entry.serverId}] ${reason}`),\n\t\t\t);\n\t\t\tif (unsafeVersions.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `Unsafe rename preview for ${JSON.stringify(input.newName)} due to stale or unknown document versions. No preview was selected and no changes were applied.\\n\\n${unsafeVersions.join(\"\\n\")}${failureText(failures)}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tfileCount: Math.max(...previews.map((entry) => entry.preview.fileCount)),\n\t\t\t\t\t\teditCount: Math.max(...previews.map((entry) => entry.preview.editCount)),\n\t\t\t\t\t\tconflict: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn consensusRenamePreview(input.newName, previews, failures, collection.matchedServerCount);\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_rename\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)} -> ${theme.fg(\"muted\", args.newName)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspCodeActionsTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof codeActionsSchema, LspCodeActionsDetails> {\n\treturn {\n\t\tname: \"lsp_code_actions\",\n\t\tlabel: \"lsp_code_actions\",\n\t\tdescription:\n\t\t\t\"List code actions from all capable matching LSP servers. Identical actions are deduplicated, distinct actions are attributed, and edit previews are never applied.\",\n\t\tpromptSnippet: \"List available LSP code actions and refactorings\",\n\t\tpromptGuidelines: [\n\t\t\t\"lsp_code_actions is preview-only. Apply reviewed edits with read/edit using hashline anchors.\",\n\t\t],\n\t\tparameters: codeActionsSchema,\n\t\tasync execute(_toolCallId, input: CodeActionsInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"codeActions\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"codeActions\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0, preferredCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst range: Range = {\n\t\t\t\tstart: toPosition(input),\n\t\t\t\tend: {\n\t\t\t\t\tline: (input.endLine ?? input.line) - 1,\n\t\t\t\t\tcharacter: (input.endCharacter ?? input.character) - 1,\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map((route) => requestCodeActions(route, input, range, signal)),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst actions = aggregateCodeActions(state, outcomes);\n\t\t\tif (actions.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No code actions available.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0, preferredCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst preferredCount = actions.filter((action) => action.preferred).length;\n\t\t\tconst lines = renderCodeActionLines(state, actions, collection.matchedServerCount > 1);\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${actions.length} code action(s). No changes were applied.\\n\\n${lines.join(\"\\n\")}${failureText(failures)}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: { count: actions.length, preferredCount },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_code_actions\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
|