@windagency/valora 2.2.1 → 2.3.0
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/README.md +45 -19
- package/data/agents/secops-engineer.md +74 -7
- package/data/commands/_meta/schema.json +3 -1
- package/data/commands/assert.md +1 -1
- package/data/commands/generate-all-documentation.md +1 -1
- package/data/commands/generate-docs.md +1 -1
- package/data/commands/plan-architecture.md +1 -1
- package/data/commands/plan-implementation.md +1 -1
- package/data/commands/plan.md +1 -1
- package/data/commands/refine-task.md +1 -1
- package/data/commands/registry.json +11 -11
- package/data/commands/review-code.md +1 -1
- package/data/commands/review-functional.md +1 -1
- package/data/prompts/01_onboard/analyze-patterns.md +1 -0
- package/data/prompts/01_onboard/collect-clarifications.md +1 -0
- package/data/prompts/01_onboard/map-dependencies.md +1 -0
- package/data/prompts/02_context/analyze-change-scope.md +1 -0
- package/data/prompts/02_context/analyze-changes-for-review.md +1 -0
- package/data/prompts/02_context/analyze-codebase-changes.md +1 -0
- package/data/prompts/02_context/analyze-command-execution.md +1 -0
- package/data/prompts/02_context/analyze-commits-for-pr.md +1 -0
- package/data/prompts/02_context/analyze-functional-scope.md +1 -0
- package/data/prompts/02_context/analyze-git-branch.md +1 -0
- package/data/prompts/02_context/analyze-git-status.md +1 -0
- package/data/prompts/02_context/analyze-task-context.md +1 -0
- package/data/prompts/02_context/extract-ticket-info.md +1 -0
- package/data/prompts/02_context/extract-ticket-references.md +1 -0
- package/data/prompts/02_context/gather-git-metrics.md +1 -0
- package/data/prompts/02_context/identify-completed-workflow.md +1 -0
- package/data/prompts/02_context/load-and-analyze-parallel.md +1 -0
- package/data/prompts/02_context/load-commit-template.md +1 -0
- package/data/prompts/02_context/load-implementation-context.md +1 -0
- package/data/prompts/02_context/load-plan-context.md +1 -0
- package/data/prompts/02_context/load-pr-template.md +1 -0
- package/data/prompts/02_context/scan-codebase.md +1 -0
- package/data/prompts/02_context/use-modern-cli-tools.md +1 -0
- package/data/prompts/03_plan/assess-complexity.md +1 -0
- package/data/prompts/03_plan/assess-risks.md +1 -0
- package/data/prompts/03_plan/breakdown-implementation.md +1 -0
- package/data/prompts/03_plan/define-architecture.md +1 -0
- package/data/prompts/03_plan/identify-dependencies.md +1 -0
- package/data/prompts/04_code/calculate-version-bump.md +1 -0
- package/data/prompts/04_code/create-version-tag.md +1 -0
- package/data/prompts/04_code/determine-commit-strategy.md +1 -0
- package/data/prompts/04_code/determine-labels.md +1 -0
- package/data/prompts/04_code/determine-reviewers.md +1 -0
- package/data/prompts/04_code/generate-commit-messages.md +1 -0
- package/data/prompts/04_code/generate-pr-description.md +1 -0
- package/data/prompts/04_code/generate-pr-title.md +1 -0
- package/data/prompts/04_code/implement-changes.md +1 -0
- package/data/prompts/04_code/implement-tests.md +1 -0
- package/data/prompts/04_code/interactive-review.md +1 -0
- package/data/prompts/04_code/push-and-create-pr.md +1 -0
- package/data/prompts/04_code/stage-and-commit.md +1 -0
- package/data/prompts/04_code/validate-prerequisites.md +1 -0
- package/data/prompts/04_code/verify-implementation.md +1 -0
- package/data/prompts/05_review/assess-code-quality.md +1 -0
- package/data/prompts/05_review/assess-constraints.md +1 -0
- package/data/prompts/05_review/evaluate-quality-outcomes.md +1 -0
- package/data/prompts/05_review/generate-commit-insights.md +1 -0
- package/data/prompts/05_review/identify-improvement-areas.md +1 -0
- package/data/prompts/05_review/synthesize-plan-assessment.md +1 -0
- package/data/prompts/05_review/synthesize-validation-report.md +1 -0
- package/data/prompts/05_review/validate-functional-requirements.md +1 -0
- package/data/prompts/05_review/validate-maintainability.md +1 -0
- package/data/prompts/05_review/validate-performance.md +1 -0
- package/data/prompts/05_review/validate-pr-creation.md +1 -0
- package/data/prompts/05_review/validate-pr-readiness.md +1 -0
- package/data/prompts/05_review/validate-risk-coverage.md +1 -0
- package/data/prompts/05_review/validate-step-quality.md +1 -0
- package/data/prompts/05_review/validate-technical-feasibility.md +1 -0
- package/data/prompts/05_review/validate-test-strategy.md +1 -0
- package/data/prompts/05_review/verify-commits.md +1 -0
- package/data/prompts/06_test/analyze-results.md +1 -0
- package/data/prompts/06_test/analyze-test-infrastructure.md +1 -0
- package/data/prompts/06_test/execute-tests.md +1 -0
- package/data/prompts/07_documentation/generate-all-domains-parallel.md +1 -0
- package/data/prompts/07_documentation/generate-code-review-report.md +1 -0
- package/data/prompts/07_documentation/generate-feedback-report.md +1 -0
- package/data/prompts/07_documentation/generate-feedback-summary.md +1 -0
- package/data/prompts/07_documentation/generate-functional-review-report.md +1 -0
- package/data/prompts/07_documentation/generate-prd.md +1 -0
- package/data/prompts/07_documentation/review-and-persist-parallel.md +1 -0
- package/data/prompts/07_documentation/update-changelog.md +1 -0
- package/data/prompts/07_documentation/update-inline-docs.md +1 -0
- package/data/prompts/07_documentation/update-knowledge-base.md +1 -0
- package/data/prompts/_meta/schema.json +4 -0
- package/data/prompts/registry.json +72 -72
- package/dist/ast/ast-context.service.d.ts +32 -0
- package/dist/ast/ast-context.service.d.ts.map +1 -0
- package/dist/ast/ast-context.service.js +220 -0
- package/dist/ast/ast-context.service.js.map +1 -0
- package/dist/ast/ast-index-watcher.service.d.ts +40 -0
- package/dist/ast/ast-index-watcher.service.d.ts.map +1 -0
- package/dist/ast/ast-index-watcher.service.js +124 -0
- package/dist/ast/ast-index-watcher.service.js.map +1 -0
- package/dist/ast/ast-index.service.d.ts +111 -0
- package/dist/ast/ast-index.service.d.ts.map +1 -0
- package/dist/ast/ast-index.service.js +437 -0
- package/dist/ast/ast-index.service.js.map +1 -0
- package/dist/ast/ast-parser.service.d.ts +31 -0
- package/dist/ast/ast-parser.service.d.ts.map +1 -0
- package/dist/ast/ast-parser.service.js +524 -0
- package/dist/ast/ast-parser.service.js.map +1 -0
- package/dist/ast/ast-query.service.d.ts +34 -0
- package/dist/ast/ast-query.service.d.ts.map +1 -0
- package/dist/ast/ast-query.service.js +203 -0
- package/dist/ast/ast-query.service.js.map +1 -0
- package/dist/ast/ast-tools.service.d.ts +39 -0
- package/dist/ast/ast-tools.service.d.ts.map +1 -0
- package/dist/ast/ast-tools.service.js +187 -0
- package/dist/ast/ast-tools.service.js.map +1 -0
- package/dist/ast/ast.types.d.ts +195 -0
- package/dist/ast/ast.types.d.ts.map +1 -0
- package/dist/ast/ast.types.js +8 -0
- package/dist/ast/ast.types.js.map +1 -0
- package/dist/ast/grammars/grammar-loader.d.ts +23 -0
- package/dist/ast/grammars/grammar-loader.d.ts.map +1 -0
- package/dist/ast/grammars/grammar-loader.js +28 -0
- package/dist/ast/grammars/grammar-loader.js.map +1 -0
- package/dist/ast/grammars/language-map.d.ts +28 -0
- package/dist/ast/grammars/language-map.d.ts.map +1 -0
- package/dist/ast/grammars/language-map.js +65 -0
- package/dist/ast/grammars/language-map.js.map +1 -0
- package/dist/ast/grammars/tree-sitter-adapter.d.ts +39 -0
- package/dist/ast/grammars/tree-sitter-adapter.d.ts.map +1 -0
- package/dist/ast/grammars/tree-sitter-adapter.interface.d.ts +84 -0
- package/dist/ast/grammars/tree-sitter-adapter.interface.d.ts.map +1 -0
- package/dist/ast/grammars/tree-sitter-adapter.interface.js +48 -0
- package/dist/ast/grammars/tree-sitter-adapter.interface.js.map +1 -0
- package/dist/ast/grammars/tree-sitter-adapter.js +91 -0
- package/dist/ast/grammars/tree-sitter-adapter.js.map +1 -0
- package/dist/cli/autocomplete.d.ts.map +1 -1
- package/dist/cli/autocomplete.js +6 -6
- package/dist/cli/autocomplete.js.map +1 -1
- package/dist/cli/command-executor.d.ts +10 -0
- package/dist/cli/command-executor.d.ts.map +1 -1
- package/dist/cli/command-executor.js +85 -11
- package/dist/cli/command-executor.js.map +1 -1
- package/dist/cli/command-wizard.d.ts.map +1 -1
- package/dist/cli/command-wizard.js +8 -2
- package/dist/cli/command-wizard.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +5 -2
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/first-run-setup.d.ts.map +1 -1
- package/dist/cli/first-run-setup.js +3 -1
- package/dist/cli/first-run-setup.js.map +1 -1
- package/dist/cli/provider-resolver.d.ts.map +1 -1
- package/dist/cli/provider-resolver.js +11 -0
- package/dist/cli/provider-resolver.js.map +1 -1
- package/dist/config/constants.d.ts +18 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +18 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/interactive-wizard.d.ts +7 -0
- package/dist/config/interactive-wizard.d.ts.map +1 -1
- package/dist/config/interactive-wizard.js +24 -19
- package/dist/config/interactive-wizard.js.map +1 -1
- package/dist/config/loader.d.ts +5 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +24 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/providers.config.d.ts.map +1 -1
- package/dist/config/providers.config.js +17 -1
- package/dist/config/providers.config.js.map +1 -1
- package/dist/config/schema.d.ts +194 -6
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config/validation-helpers.d.ts.map +1 -1
- package/dist/config/validation-helpers.js +84 -41
- package/dist/config/validation-helpers.js.map +1 -1
- package/dist/di/container.d.ts +5 -0
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +17 -0
- package/dist/di/container.js.map +1 -1
- package/dist/executor/message-builder.service.d.ts +2 -0
- package/dist/executor/message-builder.service.d.ts.map +1 -1
- package/dist/executor/message-builder.service.js +6 -1
- package/dist/executor/message-builder.service.js.map +1 -1
- package/dist/executor/stage-executor.d.ts.map +1 -1
- package/dist/executor/stage-executor.js +35 -8
- package/dist/executor/stage-executor.js.map +1 -1
- package/dist/executor/stage-output-cache.d.ts +3 -3
- package/dist/executor/stage-output-cache.d.ts.map +1 -1
- package/dist/executor/stage-output-cache.js +6 -6
- package/dist/executor/stage-output-cache.js.map +1 -1
- package/dist/executor/tool-execution.service.d.ts +2 -0
- package/dist/executor/tool-execution.service.d.ts.map +1 -1
- package/dist/executor/tool-execution.service.js +230 -2
- package/dist/executor/tool-execution.service.js.map +1 -1
- package/dist/executor/tools/search-tools.service.d.ts +1 -1
- package/dist/executor/tools/search-tools.service.d.ts.map +1 -1
- package/dist/executor/tools/search-tools.service.js +25 -3
- package/dist/executor/tools/search-tools.service.js.map +1 -1
- package/dist/executor/variables.d.ts.map +1 -1
- package/dist/executor/variables.js +5 -0
- package/dist/executor/variables.js.map +1 -1
- package/dist/llm/model-mapping-registry.d.ts.map +1 -1
- package/dist/llm/model-mapping-registry.js +11 -3
- package/dist/llm/model-mapping-registry.js.map +1 -1
- package/dist/llm/providers/anthropic.provider.d.ts.map +1 -1
- package/dist/llm/providers/anthropic.provider.js +5 -1
- package/dist/llm/providers/anthropic.provider.js.map +1 -1
- package/dist/llm/providers/index.d.ts +2 -0
- package/dist/llm/providers/index.d.ts.map +1 -1
- package/dist/llm/providers/index.js +2 -0
- package/dist/llm/providers/index.js.map +1 -1
- package/dist/llm/providers/local.provider.d.ts +27 -0
- package/dist/llm/providers/local.provider.d.ts.map +1 -0
- package/dist/llm/providers/local.provider.js +179 -0
- package/dist/llm/providers/local.provider.js.map +1 -0
- package/dist/llm/providers/openai.provider.d.ts.map +1 -1
- package/dist/llm/providers/openai.provider.js +1 -0
- package/dist/llm/providers/openai.provider.js.map +1 -1
- package/dist/lsp/lsp-client-manager.service.d.ts +47 -0
- package/dist/lsp/lsp-client-manager.service.d.ts.map +1 -0
- package/dist/lsp/lsp-client-manager.service.js +117 -0
- package/dist/lsp/lsp-client-manager.service.js.map +1 -0
- package/dist/lsp/lsp-client.d.ts +45 -0
- package/dist/lsp/lsp-client.d.ts.map +1 -0
- package/dist/lsp/lsp-client.js +147 -0
- package/dist/lsp/lsp-client.js.map +1 -0
- package/dist/lsp/lsp-context-enricher.d.ts +15 -0
- package/dist/lsp/lsp-context-enricher.d.ts.map +1 -0
- package/dist/lsp/lsp-context-enricher.js +72 -0
- package/dist/lsp/lsp-context-enricher.js.map +1 -0
- package/dist/lsp/lsp-language-registry.d.ts +24 -0
- package/dist/lsp/lsp-language-registry.d.ts.map +1 -0
- package/dist/lsp/lsp-language-registry.js +108 -0
- package/dist/lsp/lsp-language-registry.js.map +1 -0
- package/dist/lsp/lsp-lifecycle.service.d.ts +34 -0
- package/dist/lsp/lsp-lifecycle.service.d.ts.map +1 -0
- package/dist/lsp/lsp-lifecycle.service.js +57 -0
- package/dist/lsp/lsp-lifecycle.service.js.map +1 -0
- package/dist/lsp/lsp-protocol-adapter.d.ts +32 -0
- package/dist/lsp/lsp-protocol-adapter.d.ts.map +1 -0
- package/dist/lsp/lsp-protocol-adapter.interface.d.ts +93 -0
- package/dist/lsp/lsp-protocol-adapter.interface.d.ts.map +1 -0
- package/dist/lsp/lsp-protocol-adapter.interface.js +50 -0
- package/dist/lsp/lsp-protocol-adapter.interface.js.map +1 -0
- package/dist/lsp/lsp-protocol-adapter.js +69 -0
- package/dist/lsp/lsp-protocol-adapter.js.map +1 -0
- package/dist/lsp/lsp-result-cache.d.ts +43 -0
- package/dist/lsp/lsp-result-cache.d.ts.map +1 -0
- package/dist/lsp/lsp-result-cache.js +87 -0
- package/dist/lsp/lsp-result-cache.js.map +1 -0
- package/dist/lsp/lsp-tools.service.d.ts +68 -0
- package/dist/lsp/lsp-tools.service.d.ts.map +1 -0
- package/dist/lsp/lsp-tools.service.js +310 -0
- package/dist/lsp/lsp-tools.service.js.map +1 -0
- package/dist/lsp/lsp.types.d.ts +122 -0
- package/dist/lsp/lsp.types.d.ts.map +1 -0
- package/dist/lsp/lsp.types.js +7 -0
- package/dist/lsp/lsp.types.js.map +1 -0
- package/dist/mcp/mcp-client-manager.service.d.ts.map +1 -1
- package/dist/mcp/mcp-client-manager.service.js +32 -6
- package/dist/mcp/mcp-client-manager.service.js.map +1 -1
- package/dist/mcp/mcp-tool-handler.d.ts.map +1 -1
- package/dist/mcp/mcp-tool-handler.js +17 -1
- package/dist/mcp/mcp-tool-handler.js.map +1 -1
- package/dist/package.json +4 -1
- package/dist/security/command-guard.d.ts +58 -0
- package/dist/security/command-guard.d.ts.map +1 -0
- package/dist/security/command-guard.js +249 -0
- package/dist/security/command-guard.js.map +1 -0
- package/dist/security/credential-guard.d.ts +42 -0
- package/dist/security/credential-guard.d.ts.map +1 -0
- package/dist/security/credential-guard.js +181 -0
- package/dist/security/credential-guard.js.map +1 -0
- package/dist/security/index.d.ts +22 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +17 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/prompt-injection-detector.d.ts +55 -0
- package/dist/security/prompt-injection-detector.d.ts.map +1 -0
- package/dist/security/prompt-injection-detector.js +233 -0
- package/dist/security/prompt-injection-detector.js.map +1 -0
- package/dist/security/security-event.types.d.ts +19 -0
- package/dist/security/security-event.types.d.ts.map +1 -0
- package/dist/security/security-event.types.js +13 -0
- package/dist/security/security-event.types.js.map +1 -0
- package/dist/security/tool-definition-validator.d.ts +55 -0
- package/dist/security/tool-definition-validator.d.ts.map +1 -0
- package/dist/security/tool-definition-validator.js +221 -0
- package/dist/security/tool-definition-validator.js.map +1 -0
- package/dist/security/tool-integrity-monitor.d.ts +67 -0
- package/dist/security/tool-integrity-monitor.d.ts.map +1 -0
- package/dist/security/tool-integrity-monitor.js +155 -0
- package/dist/security/tool-integrity-monitor.js.map +1 -0
- package/dist/tsconfig.json +3 -0
- package/dist/types/command.types.d.ts +3 -1
- package/dist/types/command.types.d.ts.map +1 -1
- package/dist/types/command.types.js.map +1 -1
- package/dist/types/llm.types.d.ts +2 -0
- package/dist/types/llm.types.d.ts.map +1 -1
- package/dist/types/provider-names.types.d.ts +3 -0
- package/dist/types/provider-names.types.d.ts.map +1 -1
- package/dist/types/provider-names.types.js +3 -0
- package/dist/types/provider-names.types.js.map +1 -1
- package/dist/ui/dashboard/detail-panels/spending-panel.d.ts.map +1 -1
- package/dist/ui/dashboard/detail-panels/spending-panel.js +8 -3
- package/dist/ui/dashboard/detail-panels/spending-panel.js.map +1 -1
- package/dist/ui/dashboard/detail-panels/token-usage-panel.d.ts.map +1 -1
- package/dist/ui/dashboard/detail-panels/token-usage-panel.js +37 -13
- package/dist/ui/dashboard/detail-panels/token-usage-panel.js.map +1 -1
- package/dist/ui/dashboard/views/agent-analytics-view.js +1 -1
- package/dist/ui/dashboard/views/agent-analytics-view.js.map +1 -1
- package/dist/ui/dashboard/views/cache-stats-view.js +1 -1
- package/dist/ui/dashboard/views/cache-stats-view.js.map +1 -1
- package/dist/ui/dashboard/views/performance-view.js +1 -1
- package/dist/ui/dashboard/views/performance-view.js.map +1 -1
- package/dist/utils/spending-tracker.d.ts +22 -0
- package/dist/utils/spending-tracker.d.ts.map +1 -1
- package/dist/utils/spending-tracker.js +33 -1
- package/dist/utils/spending-tracker.js.map +1 -1
- package/dist/utils/token-estimator.d.ts +21 -5
- package/dist/utils/token-estimator.d.ts.map +1 -1
- package/dist/utils/token-estimator.js +74 -28
- package/dist/utils/token-estimator.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Lifecycle Service
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle of LSP servers within the context of a pipeline run.
|
|
5
|
+
* Handles spawn-on-demand, session scoping, and cleanup.
|
|
6
|
+
*/
|
|
7
|
+
import { getLSPClientManager } from './lsp-client-manager.service.js';
|
|
8
|
+
/**
|
|
9
|
+
* LSP Lifecycle Service — coordinates server lifecycle with pipeline execution
|
|
10
|
+
*/
|
|
11
|
+
export class LSPLifecycleService {
|
|
12
|
+
manager;
|
|
13
|
+
sessionActive = false;
|
|
14
|
+
constructor(projectRoot) {
|
|
15
|
+
this.manager = getLSPClientManager(projectRoot);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Start a session — allows servers to be spawned
|
|
19
|
+
*/
|
|
20
|
+
startSession() {
|
|
21
|
+
this.sessionActive = true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* End a session — shuts down all servers
|
|
25
|
+
*/
|
|
26
|
+
async endSession() {
|
|
27
|
+
this.sessionActive = false;
|
|
28
|
+
await this.manager.shutdownAll();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if a session is active
|
|
32
|
+
*/
|
|
33
|
+
isSessionActive() {
|
|
34
|
+
return this.sessionActive;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the client manager (for tool handlers to use)
|
|
38
|
+
*/
|
|
39
|
+
getManager() {
|
|
40
|
+
return this.manager;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Singleton management
|
|
45
|
+
*/
|
|
46
|
+
let lifecycleInstance = null;
|
|
47
|
+
export function getLSPLifecycle(projectRoot) {
|
|
48
|
+
if (!lifecycleInstance && projectRoot) {
|
|
49
|
+
lifecycleInstance = new LSPLifecycleService(projectRoot);
|
|
50
|
+
}
|
|
51
|
+
lifecycleInstance ??= new LSPLifecycleService(process.cwd());
|
|
52
|
+
return lifecycleInstance;
|
|
53
|
+
}
|
|
54
|
+
export function resetLSPLifecycle() {
|
|
55
|
+
lifecycleInstance = null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=lsp-lifecycle.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-lifecycle.service.js","sourceRoot":"","sources":["../../src/lsp/lsp-lifecycle.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAgC,MAAM,8BAA8B,CAAC;AAEjG;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACvB,OAAO,CAA0B;IACjC,aAAa,GAAG,KAAK,CAAC;IAE9B,YAAY,WAAmB;QAC9B,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,YAAY;QACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACf,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,eAAe;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,UAAU;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD;AAED;;GAEG;AACH,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AAEzD,MAAM,UAAU,eAAe,CAAC,WAAoB;IACnD,IAAI,CAAC,iBAAiB,IAAI,WAAW,EAAE,CAAC;QACvC,iBAAiB,GAAG,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC1D,CAAC;IACD,iBAAiB,KAAK,IAAI,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7D,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB;IAChC,iBAAiB,GAAG,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VSCode LSP Protocol Adapter — vscode-languageserver-protocol implementation
|
|
3
|
+
*
|
|
4
|
+
* This is a concrete implementation of LSPProtocolAdapter using the
|
|
5
|
+
* vscode-languageserver-protocol library for JSON-RPC communication.
|
|
6
|
+
* The interfaces are defined separately to allow for other implementations
|
|
7
|
+
* (custom JSON-RPC, mock connections for testing, etc.)
|
|
8
|
+
*
|
|
9
|
+
* Benefits:
|
|
10
|
+
* - Implements library-agnostic LSPProtocolAdapter interface
|
|
11
|
+
* - Can be swapped with other implementations without changing consumers
|
|
12
|
+
* - Isolates all vscode-languageserver-protocol dependencies to this file
|
|
13
|
+
*/
|
|
14
|
+
import type { ChildProcess } from 'child_process';
|
|
15
|
+
import type { LSPProtocolAdapter, LSPProtocolConnection } from './lsp-protocol-adapter.interface.js';
|
|
16
|
+
/**
|
|
17
|
+
* VSCode LSP Protocol Adapter Implementation
|
|
18
|
+
*
|
|
19
|
+
* Concrete implementation using vscode-languageserver-protocol.
|
|
20
|
+
*/
|
|
21
|
+
export declare class VSCodeLSPProtocolAdapter implements LSPProtocolAdapter {
|
|
22
|
+
/**
|
|
23
|
+
* Create a protocol connection from a child process's stdio streams
|
|
24
|
+
*/
|
|
25
|
+
createConnection(process: ChildProcess): LSPProtocolConnection | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Default adapter instance factory
|
|
29
|
+
* This is used by the getLSPProtocolAdapter function in the interface
|
|
30
|
+
*/
|
|
31
|
+
export declare function createDefaultLSPProtocolAdapter(): LSPProtocolAdapter;
|
|
32
|
+
//# sourceMappingURL=lsp-protocol-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-protocol-adapter.d.ts","sourceRoot":"","sources":["../../src/lsp/lsp-protocol-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAqDlG;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IAClE;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,qBAAqB,GAAG,IAAI;CASrE;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,kBAAkB,CAEpE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Protocol Adapter Interface
|
|
3
|
+
*
|
|
4
|
+
* Library-agnostic interface for LSP JSON-RPC protocol communication.
|
|
5
|
+
* Implementations can use vscode-languageserver-protocol, custom JSON-RPC, or any
|
|
6
|
+
* compatible transport.
|
|
7
|
+
*
|
|
8
|
+
* This separation allows:
|
|
9
|
+
* - Multiple adapter implementations without coupling
|
|
10
|
+
* - Easy testing with mock protocol connections
|
|
11
|
+
* - Library migration without changing consumer code
|
|
12
|
+
*/
|
|
13
|
+
import type { ChildProcess } from 'child_process';
|
|
14
|
+
/**
|
|
15
|
+
* A protocol connection to a language server process
|
|
16
|
+
*
|
|
17
|
+
* Wraps the JSON-RPC transport layer, providing typed request/notification methods
|
|
18
|
+
* without exposing the underlying protocol library.
|
|
19
|
+
*/
|
|
20
|
+
export interface LSPProtocolConnection {
|
|
21
|
+
/**
|
|
22
|
+
* Clean up and release all resources
|
|
23
|
+
*/
|
|
24
|
+
dispose(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Register a handler for connection close events
|
|
27
|
+
*/
|
|
28
|
+
onClose(handler: () => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Register a handler for connection errors
|
|
31
|
+
*/
|
|
32
|
+
onError(handler: (error: Error) => void): void;
|
|
33
|
+
/**
|
|
34
|
+
* Send a JSON-RPC notification (no response expected)
|
|
35
|
+
*
|
|
36
|
+
* @param method - The LSP method name
|
|
37
|
+
* @param params - Optional parameters
|
|
38
|
+
*/
|
|
39
|
+
sendNotification(method: string, params?: unknown): void;
|
|
40
|
+
/**
|
|
41
|
+
* Send a JSON-RPC request and wait for response
|
|
42
|
+
*
|
|
43
|
+
* @param method - The LSP method name
|
|
44
|
+
* @param params - Optional parameters
|
|
45
|
+
* @returns The response result
|
|
46
|
+
*/
|
|
47
|
+
sendRequest(method: string, params?: unknown): Promise<unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Start listening for incoming messages
|
|
50
|
+
*/
|
|
51
|
+
listen(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* LSP Protocol Adapter Interface
|
|
55
|
+
*
|
|
56
|
+
* Defines the contract for creating LSP protocol connections.
|
|
57
|
+
* All protocol-level operations should go through this interface.
|
|
58
|
+
*/
|
|
59
|
+
export interface LSPProtocolAdapter {
|
|
60
|
+
/**
|
|
61
|
+
* Create a protocol connection from a child process's stdio streams
|
|
62
|
+
*
|
|
63
|
+
* @param process - The child process running the language server
|
|
64
|
+
* @returns A protocol connection, or null if streams are unavailable
|
|
65
|
+
*/
|
|
66
|
+
createConnection(process: ChildProcess): LSPProtocolConnection | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the singleton LSPProtocolAdapter instance
|
|
70
|
+
*
|
|
71
|
+
* @returns LSPProtocolAdapter instance
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* import { getLSPProtocolAdapter } from './lsp-protocol-adapter.interface.js';
|
|
75
|
+
*
|
|
76
|
+
* const adapter = getLSPProtocolAdapter();
|
|
77
|
+
* const connection = adapter.createConnection(childProcess);
|
|
78
|
+
* connection.listen();
|
|
79
|
+
* const result = await connection.sendRequest('initialize', params);
|
|
80
|
+
*/
|
|
81
|
+
export declare function getLSPProtocolAdapter(): LSPProtocolAdapter;
|
|
82
|
+
/**
|
|
83
|
+
* Set a custom LSPProtocolAdapter implementation
|
|
84
|
+
* Useful for testing or switching to different protocol libraries
|
|
85
|
+
*
|
|
86
|
+
* @param adapter - The adapter instance to use
|
|
87
|
+
*/
|
|
88
|
+
export declare function setLSPProtocolAdapter(adapter: LSPProtocolAdapter): void;
|
|
89
|
+
/**
|
|
90
|
+
* Reset the singleton instance (for testing)
|
|
91
|
+
*/
|
|
92
|
+
export declare function resetLSPProtocolAdapter(): void;
|
|
93
|
+
//# sourceMappingURL=lsp-protocol-adapter.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-protocol-adapter.interface.d.ts","sourceRoot":"","sources":["../../src/lsp/lsp-protocol-adapter.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAE/C;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzD;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,qBAAqB,GAAG,IAAI,CAAC;CACtE;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAG1D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAEvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Protocol Adapter Interface
|
|
3
|
+
*
|
|
4
|
+
* Library-agnostic interface for LSP JSON-RPC protocol communication.
|
|
5
|
+
* Implementations can use vscode-languageserver-protocol, custom JSON-RPC, or any
|
|
6
|
+
* compatible transport.
|
|
7
|
+
*
|
|
8
|
+
* This separation allows:
|
|
9
|
+
* - Multiple adapter implementations without coupling
|
|
10
|
+
* - Easy testing with mock protocol connections
|
|
11
|
+
* - Library migration without changing consumer code
|
|
12
|
+
*/
|
|
13
|
+
import { createDefaultLSPProtocolAdapter } from './lsp-protocol-adapter.js';
|
|
14
|
+
/**
|
|
15
|
+
* Singleton instance
|
|
16
|
+
*/
|
|
17
|
+
let adapterInstance = null;
|
|
18
|
+
/**
|
|
19
|
+
* Get the singleton LSPProtocolAdapter instance
|
|
20
|
+
*
|
|
21
|
+
* @returns LSPProtocolAdapter instance
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { getLSPProtocolAdapter } from './lsp-protocol-adapter.interface.js';
|
|
25
|
+
*
|
|
26
|
+
* const adapter = getLSPProtocolAdapter();
|
|
27
|
+
* const connection = adapter.createConnection(childProcess);
|
|
28
|
+
* connection.listen();
|
|
29
|
+
* const result = await connection.sendRequest('initialize', params);
|
|
30
|
+
*/
|
|
31
|
+
export function getLSPProtocolAdapter() {
|
|
32
|
+
adapterInstance ??= createDefaultLSPProtocolAdapter();
|
|
33
|
+
return adapterInstance;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Set a custom LSPProtocolAdapter implementation
|
|
37
|
+
* Useful for testing or switching to different protocol libraries
|
|
38
|
+
*
|
|
39
|
+
* @param adapter - The adapter instance to use
|
|
40
|
+
*/
|
|
41
|
+
export function setLSPProtocolAdapter(adapter) {
|
|
42
|
+
adapterInstance = adapter;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reset the singleton instance (for testing)
|
|
46
|
+
*/
|
|
47
|
+
export function resetLSPProtocolAdapter() {
|
|
48
|
+
adapterInstance = null;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=lsp-protocol-adapter.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-protocol-adapter.interface.js","sourceRoot":"","sources":["../../src/lsp/lsp-protocol-adapter.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AA+DzE;;GAEG;AACH,IAAI,eAAe,GAA8B,IAAI,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB;IACpC,eAAe,KAAK,+BAA+B,EAAE,CAAC;IACtD,OAAO,eAAe,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA2B;IAChE,eAAe,GAAG,OAAO,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACtC,eAAe,GAAG,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VSCode LSP Protocol Adapter — vscode-languageserver-protocol implementation
|
|
3
|
+
*
|
|
4
|
+
* This is a concrete implementation of LSPProtocolAdapter using the
|
|
5
|
+
* vscode-languageserver-protocol library for JSON-RPC communication.
|
|
6
|
+
* The interfaces are defined separately to allow for other implementations
|
|
7
|
+
* (custom JSON-RPC, mock connections for testing, etc.)
|
|
8
|
+
*
|
|
9
|
+
* Benefits:
|
|
10
|
+
* - Implements library-agnostic LSPProtocolAdapter interface
|
|
11
|
+
* - Can be swapped with other implementations without changing consumers
|
|
12
|
+
* - Isolates all vscode-languageserver-protocol dependencies to this file
|
|
13
|
+
*/
|
|
14
|
+
import { createProtocolConnection, StreamMessageReader, StreamMessageWriter } from 'vscode-languageserver-protocol/node';
|
|
15
|
+
/**
|
|
16
|
+
* Wraps a vscode-languageserver-protocol ProtocolConnection
|
|
17
|
+
*/
|
|
18
|
+
class VSCodeProtocolConnection {
|
|
19
|
+
connection;
|
|
20
|
+
constructor(connection) {
|
|
21
|
+
this.connection = connection;
|
|
22
|
+
}
|
|
23
|
+
dispose() {
|
|
24
|
+
this.connection.dispose();
|
|
25
|
+
}
|
|
26
|
+
listen() {
|
|
27
|
+
this.connection.listen();
|
|
28
|
+
}
|
|
29
|
+
onClose(handler) {
|
|
30
|
+
this.connection.onClose(handler);
|
|
31
|
+
}
|
|
32
|
+
onError(handler) {
|
|
33
|
+
this.connection.onError(([error]) => {
|
|
34
|
+
handler(error);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
sendNotification(method, params) {
|
|
38
|
+
void this.connection.sendNotification(method, params);
|
|
39
|
+
}
|
|
40
|
+
async sendRequest(method, params) {
|
|
41
|
+
return this.connection.sendRequest(method, params);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* VSCode LSP Protocol Adapter Implementation
|
|
46
|
+
*
|
|
47
|
+
* Concrete implementation using vscode-languageserver-protocol.
|
|
48
|
+
*/
|
|
49
|
+
export class VSCodeLSPProtocolAdapter {
|
|
50
|
+
/**
|
|
51
|
+
* Create a protocol connection from a child process's stdio streams
|
|
52
|
+
*/
|
|
53
|
+
createConnection(process) {
|
|
54
|
+
if (!process.stdout || !process.stdin)
|
|
55
|
+
return null;
|
|
56
|
+
const reader = new StreamMessageReader(process.stdout);
|
|
57
|
+
const writer = new StreamMessageWriter(process.stdin);
|
|
58
|
+
const connection = createProtocolConnection(reader, writer);
|
|
59
|
+
return new VSCodeProtocolConnection(connection);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Default adapter instance factory
|
|
64
|
+
* This is used by the getLSPProtocolAdapter function in the interface
|
|
65
|
+
*/
|
|
66
|
+
export function createDefaultLSPProtocolAdapter() {
|
|
67
|
+
return new VSCodeLSPProtocolAdapter();
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=lsp-protocol-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-protocol-adapter.js","sourceRoot":"","sources":["../../src/lsp/lsp-protocol-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,qCAAqC,CAAC;AAkB7C;;GAEG;AACH,MAAM,wBAAwB;IACZ,UAAU,CAA6B;IAExD,YAAY,UAAsC;QACjD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM;QACL,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,OAAmB;QAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,CAAC,OAA+B;QACtC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,gBAAgB,CAAC,MAAc,EAAE,MAAgB;QAChD,KAAK,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAc,EAAE,MAAgB;QACjD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACH,gBAAgB,CAAC,OAAqB;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAEnD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAE5D,OAAO,IAAI,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC9C,OAAO,IAAI,wBAAwB,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Result Cache
|
|
3
|
+
*
|
|
4
|
+
* LRU cache for LSP responses to avoid redundant server calls.
|
|
5
|
+
*/
|
|
6
|
+
import type { LSPCacheOptions } from './lsp.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* LRU cache for LSP results
|
|
9
|
+
*/
|
|
10
|
+
export declare class LSPResultCache {
|
|
11
|
+
private readonly cache;
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(options?: Partial<LSPCacheOptions>);
|
|
14
|
+
/**
|
|
15
|
+
* Get a cached result
|
|
16
|
+
*/
|
|
17
|
+
get<T>(key: string): null | T;
|
|
18
|
+
/**
|
|
19
|
+
* Set a cached result
|
|
20
|
+
*/
|
|
21
|
+
set<T>(key: string, value: T): void;
|
|
22
|
+
/**
|
|
23
|
+
* Invalidate entries for a file (e.g., when file is modified)
|
|
24
|
+
*/
|
|
25
|
+
invalidateFile(filePath: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clear the entire cache
|
|
28
|
+
*/
|
|
29
|
+
clear(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get cache statistics
|
|
32
|
+
*/
|
|
33
|
+
getStats(): {
|
|
34
|
+
maxEntries: number;
|
|
35
|
+
size: number;
|
|
36
|
+
ttlMs: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Generate a cache key for an LSP request
|
|
40
|
+
*/
|
|
41
|
+
static makeKey(method: string, filePath: string, ...extra: Array<number | string>): string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=lsp-result-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-result-cache.d.ts","sourceRoot":"","sources":["../../src/lsp/lsp-result-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AAQ/D;;GAEG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0C;IAChE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;gBAE9B,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IAI9C;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC;IAiB7B;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAgBnC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQtC;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAQ/D;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM;CAG1F"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Result Cache
|
|
3
|
+
*
|
|
4
|
+
* LRU cache for LSP responses to avoid redundant server calls.
|
|
5
|
+
*/
|
|
6
|
+
/** Default cache settings */
|
|
7
|
+
const DEFAULT_OPTIONS = {
|
|
8
|
+
maxEntries: 500,
|
|
9
|
+
ttlMs: 30_000 // 30 seconds
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* LRU cache for LSP results
|
|
13
|
+
*/
|
|
14
|
+
export class LSPResultCache {
|
|
15
|
+
cache = new Map();
|
|
16
|
+
options;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a cached result
|
|
22
|
+
*/
|
|
23
|
+
get(key) {
|
|
24
|
+
const entry = this.cache.get(key);
|
|
25
|
+
if (!entry)
|
|
26
|
+
return null;
|
|
27
|
+
// Check TTL
|
|
28
|
+
if (Date.now() - entry.timestamp > this.options.ttlMs) {
|
|
29
|
+
this.cache.delete(key);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
// Move to end (most recently used)
|
|
33
|
+
this.cache.delete(key);
|
|
34
|
+
this.cache.set(key, entry);
|
|
35
|
+
return entry.value;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Set a cached result
|
|
39
|
+
*/
|
|
40
|
+
set(key, value) {
|
|
41
|
+
// Evict oldest if at capacity
|
|
42
|
+
if (this.cache.size >= this.options.maxEntries) {
|
|
43
|
+
const oldest = this.cache.keys().next().value;
|
|
44
|
+
if (oldest !== undefined) {
|
|
45
|
+
this.cache.delete(oldest);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
this.cache.set(key, {
|
|
49
|
+
key,
|
|
50
|
+
timestamp: Date.now(),
|
|
51
|
+
value
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Invalidate entries for a file (e.g., when file is modified)
|
|
56
|
+
*/
|
|
57
|
+
invalidateFile(filePath) {
|
|
58
|
+
for (const [key] of this.cache) {
|
|
59
|
+
if (key.startsWith(filePath)) {
|
|
60
|
+
this.cache.delete(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Clear the entire cache
|
|
66
|
+
*/
|
|
67
|
+
clear() {
|
|
68
|
+
this.cache.clear();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get cache statistics
|
|
72
|
+
*/
|
|
73
|
+
getStats() {
|
|
74
|
+
return {
|
|
75
|
+
maxEntries: this.options.maxEntries,
|
|
76
|
+
size: this.cache.size,
|
|
77
|
+
ttlMs: this.options.ttlMs
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Generate a cache key for an LSP request
|
|
82
|
+
*/
|
|
83
|
+
static makeKey(method, filePath, ...extra) {
|
|
84
|
+
return [filePath, method, ...extra.map(String)].join(':');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=lsp-result-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-result-cache.js","sourceRoot":"","sources":["../../src/lsp/lsp-result-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,6BAA6B;AAC7B,MAAM,eAAe,GAAoB;IACxC,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,MAAM,CAAC,aAAa;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,cAAc;IACT,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC/C,OAAO,CAAkB;IAE1C,YAAY,OAAkC;QAC7C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,GAAG,CAAI,GAAW;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAExB,YAAY;QACZ,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,mCAAmC;QACnC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE3B,OAAO,KAAK,CAAC,KAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,GAAG,CAAI,GAAW,EAAE,KAAQ;QAC3B,8BAA8B;QAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YAC9C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;QACF,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACnB,GAAG;YACH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,QAAgB;QAC9B,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;IACF,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO;YACN,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACrB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;SACzB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAc,EAAE,QAAgB,EAAE,GAAG,KAA6B;QAChF,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;CACD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Tools Service
|
|
3
|
+
*
|
|
4
|
+
* LLM tool handlers for LSP operations:
|
|
5
|
+
* goto_definition, get_type_info, get_diagnostics, hover_info
|
|
6
|
+
*/
|
|
7
|
+
import type { getLogger } from '../output/logger.js';
|
|
8
|
+
type Logger = ReturnType<typeof getLogger>;
|
|
9
|
+
/**
|
|
10
|
+
* LSP Tools Service — handles LLM tool calls for LSP operations
|
|
11
|
+
*/
|
|
12
|
+
export declare class LSPToolsService {
|
|
13
|
+
private readonly cache;
|
|
14
|
+
private readonly projectRoot;
|
|
15
|
+
constructor(projectRoot?: string, _logger?: Logger);
|
|
16
|
+
/**
|
|
17
|
+
* Execute the goto_definition tool
|
|
18
|
+
*/
|
|
19
|
+
executeGotoDefinition(args: Record<string, unknown>): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Execute the get_type_info tool
|
|
22
|
+
*/
|
|
23
|
+
executeGetTypeInfo(args: Record<string, unknown>): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Execute the get_diagnostics tool
|
|
26
|
+
*/
|
|
27
|
+
executeGetDiagnostics(args: Record<string, unknown>): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Execute the hover_info tool
|
|
30
|
+
*/
|
|
31
|
+
executeHoverInfo(args: Record<string, unknown>): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Execute a hover request
|
|
34
|
+
*/
|
|
35
|
+
private executeHover;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a position from either symbol name or line/character
|
|
38
|
+
*/
|
|
39
|
+
private resolvePosition;
|
|
40
|
+
/**
|
|
41
|
+
* Read file content
|
|
42
|
+
*/
|
|
43
|
+
private readFileContent;
|
|
44
|
+
/**
|
|
45
|
+
* Convert file path to URI
|
|
46
|
+
*/
|
|
47
|
+
private toUri;
|
|
48
|
+
/**
|
|
49
|
+
* Get language ID for a file
|
|
50
|
+
*/
|
|
51
|
+
private getLanguageId;
|
|
52
|
+
/**
|
|
53
|
+
* Parse a definition result from LSP
|
|
54
|
+
*/
|
|
55
|
+
private parseDefinitionResult;
|
|
56
|
+
/**
|
|
57
|
+
* Format a definition result for display
|
|
58
|
+
*/
|
|
59
|
+
private formatDefinitionResult;
|
|
60
|
+
/**
|
|
61
|
+
* Format diagnostics for display
|
|
62
|
+
*/
|
|
63
|
+
private formatDiagnostics;
|
|
64
|
+
}
|
|
65
|
+
export declare function getLSPToolsService(projectRoot?: string): LSPToolsService;
|
|
66
|
+
export declare function resetLSPToolsService(): void;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=lsp-tools.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-tools.service.d.ts","sourceRoot":"","sources":["../../src/lsp/lsp-tools.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO/C,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AA2B3C;;GAEG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAC9C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,WAAW,GAAE,MAAsB,EAAE,OAAO,CAAC,EAAE,MAAM;IAIjE;;OAEG;IACG,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA8C3E;;OAEG;IACG,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAUxE;;OAEG;IACG,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAwC3E;;OAEG;IACG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAYtE;;OAEG;YACW,YAAY;IA0C1B;;OAEG;YACW,eAAe;IAuB7B;;OAEG;YACW,eAAe;IAS7B;;OAEG;IACH,OAAO,CAAC,KAAK;IAKb;;OAEG;IACH,OAAO,CAAC,aAAa;IAKrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmB7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAmBzB;AAkBD,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAGxE;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|