@cleanslate/sdk 0.1.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/LICENSE +22 -0
- package/NOTICE +48 -0
- package/README.md +103 -0
- package/VENDOR.md +60 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.d.ts +55 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.js +474 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.js.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.d.ts +22 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.js +205 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.js.map +1 -0
- package/dist/agent/cleanSlateAgentParsing.d.ts +21 -0
- package/dist/agent/cleanSlateAgentParsing.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentParsing.js +106 -0
- package/dist/agent/cleanSlateAgentParsing.js.map +1 -0
- package/dist/agent/cleanSlateAgentSession.d.ts +44 -0
- package/dist/agent/cleanSlateAgentSession.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentSession.js +205 -0
- package/dist/agent/cleanSlateAgentSession.js.map +1 -0
- package/dist/agent/cleanSlateAgentTypes.d.ts +91 -0
- package/dist/agent/cleanSlateAgentTypes.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentTypes.js +27 -0
- package/dist/agent/cleanSlateAgentTypes.js.map +1 -0
- package/dist/agent/cleanSlateCommandPolicy.d.ts +12 -0
- package/dist/agent/cleanSlateCommandPolicy.d.ts.map +1 -0
- package/dist/agent/cleanSlateCommandPolicy.js +30 -0
- package/dist/agent/cleanSlateCommandPolicy.js.map +1 -0
- package/dist/agent/cleanSlateContextBudgetManager.d.ts +82 -0
- package/dist/agent/cleanSlateContextBudgetManager.d.ts.map +1 -0
- package/dist/agent/cleanSlateContextBudgetManager.js +419 -0
- package/dist/agent/cleanSlateContextBudgetManager.js.map +1 -0
- package/dist/agent/cleanSlateDomainProfile.d.ts +71 -0
- package/dist/agent/cleanSlateDomainProfile.d.ts.map +1 -0
- package/dist/agent/cleanSlateDomainProfile.js +124 -0
- package/dist/agent/cleanSlateDomainProfile.js.map +1 -0
- package/dist/agent/cleanSlateExecutionBudget.d.ts +19 -0
- package/dist/agent/cleanSlateExecutionBudget.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionBudget.js +28 -0
- package/dist/agent/cleanSlateExecutionBudget.js.map +1 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.d.ts +15 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.js +148 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.js.map +1 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.d.ts +23 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.js +121 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.js.map +1 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.d.ts +5 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.js +41 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.js.map +1 -0
- package/dist/agent/cleanSlateExecutionQuery.d.ts +162 -0
- package/dist/agent/cleanSlateExecutionQuery.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionQuery.js +1448 -0
- package/dist/agent/cleanSlateExecutionQuery.js.map +1 -0
- package/dist/agent/cleanSlateFilesModifiedService.d.ts +96 -0
- package/dist/agent/cleanSlateFilesModifiedService.d.ts.map +1 -0
- package/dist/agent/cleanSlateFilesModifiedService.js +581 -0
- package/dist/agent/cleanSlateFilesModifiedService.js.map +1 -0
- package/dist/agent/cleanSlateNativeToolTranscript.d.ts +22 -0
- package/dist/agent/cleanSlateNativeToolTranscript.d.ts.map +1 -0
- package/dist/agent/cleanSlateNativeToolTranscript.js +77 -0
- package/dist/agent/cleanSlateNativeToolTranscript.js.map +1 -0
- package/dist/agent/cleanSlatePrompts.d.ts +30 -0
- package/dist/agent/cleanSlatePrompts.d.ts.map +1 -0
- package/dist/agent/cleanSlatePrompts.js +65 -0
- package/dist/agent/cleanSlatePrompts.js.map +1 -0
- package/dist/agent/cleanSlateQueryRunner.d.ts +56 -0
- package/dist/agent/cleanSlateQueryRunner.d.ts.map +1 -0
- package/dist/agent/cleanSlateQueryRunner.js +69 -0
- package/dist/agent/cleanSlateQueryRunner.js.map +1 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.d.ts +30 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.d.ts.map +1 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.js +99 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.js.map +1 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.d.ts +55 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.d.ts.map +1 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.js +214 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.js.map +1 -0
- package/dist/agent/cleanSlateToolCallLedger.d.ts +32 -0
- package/dist/agent/cleanSlateToolCallLedger.d.ts.map +1 -0
- package/dist/agent/cleanSlateToolCallLedger.js +164 -0
- package/dist/agent/cleanSlateToolCallLedger.js.map +1 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.d.ts +9 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.d.ts.map +1 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.js +184 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.js.map +1 -0
- package/dist/composer/commands/slashCommands.d.ts +8 -0
- package/dist/composer/commands/slashCommands.d.ts.map +1 -0
- package/dist/composer/commands/slashCommands.js +46 -0
- package/dist/composer/commands/slashCommands.js.map +1 -0
- package/dist/composer/instructions/baseInstructions.d.ts +3 -0
- package/dist/composer/instructions/baseInstructions.d.ts.map +1 -0
- package/dist/composer/instructions/baseInstructions.js +35 -0
- package/dist/composer/instructions/baseInstructions.js.map +1 -0
- package/dist/composer/instructions/runtimeInstructions.d.ts +11 -0
- package/dist/composer/instructions/runtimeInstructions.d.ts.map +1 -0
- package/dist/composer/instructions/runtimeInstructions.js +31 -0
- package/dist/composer/instructions/runtimeInstructions.js.map +1 -0
- package/dist/composer/kernel/coreKernel.d.ts +3 -0
- package/dist/composer/kernel/coreKernel.d.ts.map +1 -0
- package/dist/composer/kernel/coreKernel.js +11 -0
- package/dist/composer/kernel/coreKernel.js.map +1 -0
- package/dist/composer/kernel/editingRules.d.ts +3 -0
- package/dist/composer/kernel/editingRules.d.ts.map +1 -0
- package/dist/composer/kernel/editingRules.js +24 -0
- package/dist/composer/kernel/editingRules.js.map +1 -0
- package/dist/composer/kernel/toolProtocols.d.ts +2 -0
- package/dist/composer/kernel/toolProtocols.d.ts.map +1 -0
- package/dist/composer/kernel/toolProtocols.js +32 -0
- package/dist/composer/kernel/toolProtocols.js.map +1 -0
- package/dist/composer/modes/execution.mode.d.ts +2 -0
- package/dist/composer/modes/execution.mode.d.ts.map +1 -0
- package/dist/composer/modes/execution.mode.js +21 -0
- package/dist/composer/modes/execution.mode.js.map +1 -0
- package/dist/composer/modes/planning.mode.d.ts +2 -0
- package/dist/composer/modes/planning.mode.d.ts.map +1 -0
- package/dist/composer/modes/planning.mode.js +23 -0
- package/dist/composer/modes/planning.mode.js.map +1 -0
- package/dist/composer/promptComposer.d.ts +22 -0
- package/dist/composer/promptComposer.d.ts.map +1 -0
- package/dist/composer/promptComposer.js +62 -0
- package/dist/composer/promptComposer.js.map +1 -0
- package/dist/composer/registry/agentSchema.d.ts +16 -0
- package/dist/composer/registry/agentSchema.d.ts.map +1 -0
- package/dist/composer/registry/agentSchema.js +6 -0
- package/dist/composer/registry/agentSchema.js.map +1 -0
- package/dist/core/arrays.d.ts +311 -0
- package/dist/core/arrays.d.ts.map +1 -0
- package/dist/core/arrays.js +811 -0
- package/dist/core/arrays.js.map +1 -0
- package/dist/core/arraysFind.d.ts +72 -0
- package/dist/core/arraysFind.d.ts.map +1 -0
- package/dist/core/arraysFind.js +200 -0
- package/dist/core/arraysFind.js.map +1 -0
- package/dist/core/assert.d.ts +36 -0
- package/dist/core/assert.d.ts.map +1 -0
- package/dist/core/assert.js +84 -0
- package/dist/core/assert.js.map +1 -0
- package/dist/core/async.d.ts +11 -0
- package/dist/core/async.d.ts.map +1 -0
- package/dist/core/async.js +6 -0
- package/dist/core/async.js.map +1 -0
- package/dist/core/buffer.d.ts +23 -0
- package/dist/core/buffer.d.ts.map +1 -0
- package/dist/core/buffer.js +40 -0
- package/dist/core/buffer.js.map +1 -0
- package/dist/core/cancellation.d.ts +52 -0
- package/dist/core/cancellation.d.ts.map +1 -0
- package/dist/core/cancellation.js +169 -0
- package/dist/core/cancellation.js.map +1 -0
- package/dist/core/charCode.d.ts +428 -0
- package/dist/core/charCode.d.ts.map +1 -0
- package/dist/core/charCode.js +439 -0
- package/dist/core/charCode.js.map +1 -0
- package/dist/core/collections.d.ts +49 -0
- package/dist/core/collections.d.ts.map +1 -0
- package/dist/core/collections.js +132 -0
- package/dist/core/collections.js.map +1 -0
- package/dist/core/diff/diff.d.ts +151 -0
- package/dist/core/diff/diff.d.ts.map +1 -0
- package/dist/core/diff/diff.js +1076 -0
- package/dist/core/diff/diff.js.map +1 -0
- package/dist/core/diff/diffChange.d.ts +39 -0
- package/dist/core/diff/diffChange.d.ts.map +1 -0
- package/dist/core/diff/diffChange.js +37 -0
- package/dist/core/diff/diffChange.js.map +1 -0
- package/dist/core/errors.d.ts +114 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +258 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/event.d.ts +595 -0
- package/dist/core/event.d.ts.map +1 -0
- package/dist/core/event.js +1479 -0
- package/dist/core/event.js.map +1 -0
- package/dist/core/functional.d.ts +5 -0
- package/dist/core/functional.d.ts.map +1 -0
- package/dist/core/functional.js +35 -0
- package/dist/core/functional.js.map +1 -0
- package/dist/core/hash.d.ts +15 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +27 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/iterator.d.ts +33 -0
- package/dist/core/iterator.d.ts.map +1 -0
- package/dist/core/iterator.js +188 -0
- package/dist/core/iterator.js.map +1 -0
- package/dist/core/lifecycle.d.ts +313 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +789 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/linkedList.d.ts +17 -0
- package/dist/core/linkedList.d.ts.map +1 -0
- package/dist/core/linkedList.js +138 -0
- package/dist/core/linkedList.js.map +1 -0
- package/dist/core/map.d.ts +175 -0
- package/dist/core/map.d.ts.map +1 -0
- package/dist/core/map.js +796 -0
- package/dist/core/map.js.map +1 -0
- package/dist/core/marshallingIds.d.ts +29 -0
- package/dist/core/marshallingIds.d.ts.map +1 -0
- package/dist/core/marshallingIds.js +38 -0
- package/dist/core/marshallingIds.js.map +1 -0
- package/dist/core/observable.d.ts +28 -0
- package/dist/core/observable.d.ts.map +1 -0
- package/dist/core/observable.js +6 -0
- package/dist/core/observable.js.map +1 -0
- package/dist/core/platform.d.ts +4 -0
- package/dist/core/platform.d.ts.map +1 -0
- package/dist/core/platform.js +17 -0
- package/dist/core/platform.js.map +1 -0
- package/dist/core/position.d.ts +91 -0
- package/dist/core/position.d.ts.map +1 -0
- package/dist/core/position.js +145 -0
- package/dist/core/position.js.map +1 -0
- package/dist/core/range.d.ts +198 -0
- package/dist/core/range.d.ts.map +1 -0
- package/dist/core/range.js +426 -0
- package/dist/core/range.js.map +1 -0
- package/dist/core/resources.d.ts +10 -0
- package/dist/core/resources.d.ts.map +1 -0
- package/dist/core/resources.js +126 -0
- package/dist/core/resources.js.map +1 -0
- package/dist/core/sequence.d.ts +20 -0
- package/dist/core/sequence.d.ts.map +1 -0
- package/dist/core/sequence.js +21 -0
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/stopwatch.d.ts +11 -0
- package/dist/core/stopwatch.d.ts.map +1 -0
- package/dist/core/stopwatch.js +33 -0
- package/dist/core/stopwatch.js.map +1 -0
- package/dist/core/symbols.d.ts +5 -0
- package/dist/core/symbols.d.ts.map +1 -0
- package/dist/core/symbols.js +13 -0
- package/dist/core/symbols.js.map +1 -0
- package/dist/core/types.d.ts +229 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +278 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/uint.d.ts +32 -0
- package/dist/core/uint.d.ts.map +1 -0
- package/dist/core/uint.js +57 -0
- package/dist/core/uint.js.map +1 -0
- package/dist/core/uri.d.ts +172 -0
- package/dist/core/uri.d.ts.map +1 -0
- package/dist/core/uri.js +623 -0
- package/dist/core/uri.js.map +1 -0
- package/dist/host/browserAutomation.d.ts +276 -0
- package/dist/host/browserAutomation.d.ts.map +1 -0
- package/dist/host/browserAutomation.js +6 -0
- package/dist/host/browserAutomation.js.map +1 -0
- package/dist/host/diagnostics.d.ts +68 -0
- package/dist/host/diagnostics.d.ts.map +1 -0
- package/dist/host/diagnostics.js +41 -0
- package/dist/host/diagnostics.js.map +1 -0
- package/dist/host/files.d.ts +70 -0
- package/dist/host/files.d.ts.map +1 -0
- package/dist/host/files.js +54 -0
- package/dist/host/files.js.map +1 -0
- package/dist/host/services.d.ts +106 -0
- package/dist/host/services.d.ts.map +1 -0
- package/dist/host/services.js +6 -0
- package/dist/host/services.js.map +1 -0
- package/dist/host/symbols.d.ts +45 -0
- package/dist/host/symbols.d.ts.map +1 -0
- package/dist/host/symbols.js +43 -0
- package/dist/host/symbols.js.map +1 -0
- package/dist/host/textModel.d.ts +83 -0
- package/dist/host/textModel.d.ts.map +1 -0
- package/dist/host/textModel.js +6 -0
- package/dist/host/textModel.js.map +1 -0
- package/dist/host/workspace.d.ts +123 -0
- package/dist/host/workspace.d.ts.map +1 -0
- package/dist/host/workspace.js +32 -0
- package/dist/host/workspace.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.d.ts +12 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.d.ts.map +1 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.js +130 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.js.map +1 -0
- package/dist/node/cleanSlateHeadlessRunner.d.ts +63 -0
- package/dist/node/cleanSlateHeadlessRunner.d.ts.map +1 -0
- package/dist/node/cleanSlateHeadlessRunner.js +84 -0
- package/dist/node/cleanSlateHeadlessRunner.js.map +1 -0
- package/dist/node/cleanSlateNodeAgentRuntime.d.ts +94 -0
- package/dist/node/cleanSlateNodeAgentRuntime.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeAgentRuntime.js +339 -0
- package/dist/node/cleanSlateNodeAgentRuntime.js.map +1 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.d.ts +279 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.js +470 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.js.map +1 -0
- package/dist/node/cleanSlateNodeCommandService.d.ts +40 -0
- package/dist/node/cleanSlateNodeCommandService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeCommandService.js +435 -0
- package/dist/node/cleanSlateNodeCommandService.js.map +1 -0
- package/dist/node/cleanSlateNodeFileServices.d.ts +68 -0
- package/dist/node/cleanSlateNodeFileServices.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeFileServices.js +138 -0
- package/dist/node/cleanSlateNodeFileServices.js.map +1 -0
- package/dist/node/cleanSlateNodeIndexService.d.ts +17 -0
- package/dist/node/cleanSlateNodeIndexService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeIndexService.js +128 -0
- package/dist/node/cleanSlateNodeIndexService.js.map +1 -0
- package/dist/node/cleanSlateNodeLanguageCommands.d.ts +11 -0
- package/dist/node/cleanSlateNodeLanguageCommands.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeLanguageCommands.js +146 -0
- package/dist/node/cleanSlateNodeLanguageCommands.js.map +1 -0
- package/dist/node/cleanSlateNodeMainService.d.ts +87 -0
- package/dist/node/cleanSlateNodeMainService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeMainService.js +1304 -0
- package/dist/node/cleanSlateNodeMainService.js.map +1 -0
- package/dist/node/cleanSlateNodeMcpClient.d.ts +20 -0
- package/dist/node/cleanSlateNodeMcpClient.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeMcpClient.js +184 -0
- package/dist/node/cleanSlateNodeMcpClient.js.map +1 -0
- package/dist/node/cleanSlateNodeSearchService.d.ts +14 -0
- package/dist/node/cleanSlateNodeSearchService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeSearchService.js +180 -0
- package/dist/node/cleanSlateNodeSearchService.js.map +1 -0
- package/dist/node/cleanSlateNodeTextModel.d.ts +56 -0
- package/dist/node/cleanSlateNodeTextModel.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeTextModel.js +127 -0
- package/dist/node/cleanSlateNodeTextModel.js.map +1 -0
- package/dist/node/cleanSlateNodeToolContext.d.ts +50 -0
- package/dist/node/cleanSlateNodeToolContext.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeToolContext.js +134 -0
- package/dist/node/cleanSlateNodeToolContext.js.map +1 -0
- package/dist/node/cleanSlateNodeWebRetrieval.d.ts +20 -0
- package/dist/node/cleanSlateNodeWebRetrieval.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeWebRetrieval.js +379 -0
- package/dist/node/cleanSlateNodeWebRetrieval.js.map +1 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.d.ts +8 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.d.ts.map +1 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.js +111 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.js.map +1 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.d.ts +18 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.d.ts.map +1 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.js +175 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.js.map +1 -0
- package/dist/node/index.d.ts +25 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +28 -0
- package/dist/node/index.js.map +1 -0
- package/dist/protocol/cleanSlateAI.d.ts +964 -0
- package/dist/protocol/cleanSlateAI.d.ts.map +1 -0
- package/dist/protocol/cleanSlateAI.js +35 -0
- package/dist/protocol/cleanSlateAI.js.map +1 -0
- package/dist/protocol/cleanSlateModelCapabilities.d.ts +86 -0
- package/dist/protocol/cleanSlateModelCapabilities.d.ts.map +1 -0
- package/dist/protocol/cleanSlateModelCapabilities.js +1104 -0
- package/dist/protocol/cleanSlateModelCapabilities.js.map +1 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.d.ts +11 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.d.ts.map +1 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.js +178 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.js.map +1 -0
- package/dist/protocol/cleanSlateService.d.ts +68 -0
- package/dist/protocol/cleanSlateService.d.ts.map +1 -0
- package/dist/protocol/cleanSlateService.js +1149 -0
- package/dist/protocol/cleanSlateService.js.map +1 -0
- package/dist/services/cleanSlateCancellation.d.ts +7 -0
- package/dist/services/cleanSlateCancellation.d.ts.map +1 -0
- package/dist/services/cleanSlateCancellation.js +56 -0
- package/dist/services/cleanSlateCancellation.js.map +1 -0
- package/dist/services/cleanSlateCommandExecutionService.d.ts +25 -0
- package/dist/services/cleanSlateCommandExecutionService.d.ts.map +1 -0
- package/dist/services/cleanSlateCommandExecutionService.js +31 -0
- package/dist/services/cleanSlateCommandExecutionService.js.map +1 -0
- package/dist/services/cleanSlateDiffService.d.ts +62 -0
- package/dist/services/cleanSlateDiffService.d.ts.map +1 -0
- package/dist/services/cleanSlateDiffService.js +428 -0
- package/dist/services/cleanSlateDiffService.js.map +1 -0
- package/dist/services/cleanSlateEditMatchValidator.d.ts +63 -0
- package/dist/services/cleanSlateEditMatchValidator.d.ts.map +1 -0
- package/dist/services/cleanSlateEditMatchValidator.js +341 -0
- package/dist/services/cleanSlateEditMatchValidator.js.map +1 -0
- package/dist/services/cleanSlateEditService.d.ts +155 -0
- package/dist/services/cleanSlateEditService.d.ts.map +1 -0
- package/dist/services/cleanSlateEditService.js +848 -0
- package/dist/services/cleanSlateEditService.js.map +1 -0
- package/dist/services/cleanSlateFileHistory.d.ts +56 -0
- package/dist/services/cleanSlateFileHistory.d.ts.map +1 -0
- package/dist/services/cleanSlateFileHistory.js +157 -0
- package/dist/services/cleanSlateFileHistory.js.map +1 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.d.ts +15 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.js +151 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.js.map +1 -0
- package/dist/services/cleanSlateTaskSessionService.d.ts +258 -0
- package/dist/services/cleanSlateTaskSessionService.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskSessionService.js +1079 -0
- package/dist/services/cleanSlateTaskSessionService.js.map +1 -0
- package/dist/services/cleanSlateTaskState.d.ts +32 -0
- package/dist/services/cleanSlateTaskState.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskState.js +40 -0
- package/dist/services/cleanSlateTaskState.js.map +1 -0
- package/dist/services/cleanSlateThreadService.d.ts +64 -0
- package/dist/services/cleanSlateThreadService.d.ts.map +1 -0
- package/dist/services/cleanSlateThreadService.js +188 -0
- package/dist/services/cleanSlateThreadService.js.map +1 -0
- package/dist/services/cleanSlateTools.d.ts +29 -0
- package/dist/services/cleanSlateTools.d.ts.map +1 -0
- package/dist/services/cleanSlateTools.js +38 -0
- package/dist/services/cleanSlateTools.js.map +1 -0
- package/dist/services/cleanSlateVerificationTargetTracker.d.ts +23 -0
- package/dist/services/cleanSlateVerificationTargetTracker.d.ts.map +1 -0
- package/dist/services/cleanSlateVerificationTargetTracker.js +214 -0
- package/dist/services/cleanSlateVerificationTargetTracker.js.map +1 -0
- package/dist/skills/cleanSlateSkillCatalog.d.ts +29 -0
- package/dist/skills/cleanSlateSkillCatalog.d.ts.map +1 -0
- package/dist/skills/cleanSlateSkillCatalog.js +225 -0
- package/dist/skills/cleanSlateSkillCatalog.js.map +1 -0
- package/dist/tools/ApplyEditTool.d.ts +73 -0
- package/dist/tools/ApplyEditTool.d.ts.map +1 -0
- package/dist/tools/ApplyEditTool.js +741 -0
- package/dist/tools/ApplyEditTool.js.map +1 -0
- package/dist/tools/AskQuestionTool.d.ts +3 -0
- package/dist/tools/AskQuestionTool.d.ts.map +1 -0
- package/dist/tools/AskQuestionTool.js +113 -0
- package/dist/tools/AskQuestionTool.js.map +1 -0
- package/dist/tools/BrowserAutomationTools.d.ts +28 -0
- package/dist/tools/BrowserAutomationTools.d.ts.map +1 -0
- package/dist/tools/BrowserAutomationTools.js +639 -0
- package/dist/tools/BrowserAutomationTools.js.map +1 -0
- package/dist/tools/CreateMultipleFilesTool.d.ts +6 -0
- package/dist/tools/CreateMultipleFilesTool.d.ts.map +1 -0
- package/dist/tools/CreateMultipleFilesTool.js +115 -0
- package/dist/tools/CreateMultipleFilesTool.js.map +1 -0
- package/dist/tools/ExecuteCommandTool.d.ts +12 -0
- package/dist/tools/ExecuteCommandTool.d.ts.map +1 -0
- package/dist/tools/ExecuteCommandTool.js +378 -0
- package/dist/tools/ExecuteCommandTool.js.map +1 -0
- package/dist/tools/FileHistoryRewindTool.d.ts +3 -0
- package/dist/tools/FileHistoryRewindTool.d.ts.map +1 -0
- package/dist/tools/FileHistoryRewindTool.js +45 -0
- package/dist/tools/FileHistoryRewindTool.js.map +1 -0
- package/dist/tools/FindByNameTool.d.ts +6 -0
- package/dist/tools/FindByNameTool.d.ts.map +1 -0
- package/dist/tools/FindByNameTool.js +80 -0
- package/dist/tools/FindByNameTool.js.map +1 -0
- package/dist/tools/FindReferencesTool.d.ts +3 -0
- package/dist/tools/FindReferencesTool.d.ts.map +1 -0
- package/dist/tools/FindReferencesTool.js +128 -0
- package/dist/tools/FindReferencesTool.js.map +1 -0
- package/dist/tools/GetDefinitionsTool.d.ts +3 -0
- package/dist/tools/GetDefinitionsTool.d.ts.map +1 -0
- package/dist/tools/GetDefinitionsTool.js +136 -0
- package/dist/tools/GetDefinitionsTool.js.map +1 -0
- package/dist/tools/GetOpenFilesTool.d.ts +6 -0
- package/dist/tools/GetOpenFilesTool.d.ts.map +1 -0
- package/dist/tools/GetOpenFilesTool.js +21 -0
- package/dist/tools/GetOpenFilesTool.js.map +1 -0
- package/dist/tools/GrepSearchTool.d.ts +7 -0
- package/dist/tools/GrepSearchTool.d.ts.map +1 -0
- package/dist/tools/GrepSearchTool.js +95 -0
- package/dist/tools/GrepSearchTool.js.map +1 -0
- package/dist/tools/ListDirTool.d.ts +6 -0
- package/dist/tools/ListDirTool.d.ts.map +1 -0
- package/dist/tools/ListDirTool.js +39 -0
- package/dist/tools/ListDirTool.js.map +1 -0
- package/dist/tools/MCPTools.d.ts +6 -0
- package/dist/tools/MCPTools.d.ts.map +1 -0
- package/dist/tools/MCPTools.js +103 -0
- package/dist/tools/MCPTools.js.map +1 -0
- package/dist/tools/MultiFileReplaceTool.d.ts +6 -0
- package/dist/tools/MultiFileReplaceTool.d.ts.map +1 -0
- package/dist/tools/MultiFileReplaceTool.js +345 -0
- package/dist/tools/MultiFileReplaceTool.js.map +1 -0
- package/dist/tools/ReadFileRangeTool.d.ts +6 -0
- package/dist/tools/ReadFileRangeTool.d.ts.map +1 -0
- package/dist/tools/ReadFileRangeTool.js +150 -0
- package/dist/tools/ReadFileRangeTool.js.map +1 -0
- package/dist/tools/ReadFileTool.d.ts +6 -0
- package/dist/tools/ReadFileTool.d.ts.map +1 -0
- package/dist/tools/ReadFileTool.js +183 -0
- package/dist/tools/ReadFileTool.js.map +1 -0
- package/dist/tools/ReadLintsTool.d.ts +6 -0
- package/dist/tools/ReadLintsTool.d.ts.map +1 -0
- package/dist/tools/ReadLintsTool.js +83 -0
- package/dist/tools/ReadLintsTool.js.map +1 -0
- package/dist/tools/ReadReferenceTool.d.ts +6 -0
- package/dist/tools/ReadReferenceTool.d.ts.map +1 -0
- package/dist/tools/ReadReferenceTool.js +24 -0
- package/dist/tools/ReadReferenceTool.js.map +1 -0
- package/dist/tools/ReadSymbolsTool.d.ts +3 -0
- package/dist/tools/ReadSymbolsTool.d.ts.map +1 -0
- package/dist/tools/ReadSymbolsTool.js +100 -0
- package/dist/tools/ReadSymbolsTool.js.map +1 -0
- package/dist/tools/SearchCodebaseTool.d.ts +6 -0
- package/dist/tools/SearchCodebaseTool.d.ts.map +1 -0
- package/dist/tools/SearchCodebaseTool.js +30 -0
- package/dist/tools/SearchCodebaseTool.js.map +1 -0
- package/dist/tools/SearchWorkspaceTool.d.ts +7 -0
- package/dist/tools/SearchWorkspaceTool.d.ts.map +1 -0
- package/dist/tools/SearchWorkspaceTool.js +21 -0
- package/dist/tools/SearchWorkspaceTool.js.map +1 -0
- package/dist/tools/SemanticSearchTool.d.ts +12 -0
- package/dist/tools/SemanticSearchTool.d.ts.map +1 -0
- package/dist/tools/SemanticSearchTool.js +46 -0
- package/dist/tools/SemanticSearchTool.js.map +1 -0
- package/dist/tools/SkillTools.d.ts +3 -0
- package/dist/tools/SkillTools.d.ts.map +1 -0
- package/dist/tools/SkillTools.js +108 -0
- package/dist/tools/SkillTools.js.map +1 -0
- package/dist/tools/SpawnWorkerTool.d.ts +6 -0
- package/dist/tools/SpawnWorkerTool.d.ts.map +1 -0
- package/dist/tools/SpawnWorkerTool.js +28 -0
- package/dist/tools/SpawnWorkerTool.js.map +1 -0
- package/dist/tools/SubmitArtifactTool.d.ts +3 -0
- package/dist/tools/SubmitArtifactTool.d.ts.map +1 -0
- package/dist/tools/SubmitArtifactTool.js +121 -0
- package/dist/tools/SubmitArtifactTool.js.map +1 -0
- package/dist/tools/UndoEditTool.d.ts +3 -0
- package/dist/tools/UndoEditTool.d.ts.map +1 -0
- package/dist/tools/UndoEditTool.js +66 -0
- package/dist/tools/UndoEditTool.js.map +1 -0
- package/dist/tools/UpdateTodoTool.d.ts +6 -0
- package/dist/tools/UpdateTodoTool.d.ts.map +1 -0
- package/dist/tools/UpdateTodoTool.js +116 -0
- package/dist/tools/UpdateTodoTool.js.map +1 -0
- package/dist/tools/WebRetrievalTools.d.ts +4 -0
- package/dist/tools/WebRetrievalTools.d.ts.map +1 -0
- package/dist/tools/WebRetrievalTools.js +169 -0
- package/dist/tools/WebRetrievalTools.js.map +1 -0
- package/dist/tools/WriteFileTool.d.ts +6 -0
- package/dist/tools/WriteFileTool.d.ts.map +1 -0
- package/dist/tools/WriteFileTool.js +145 -0
- package/dist/tools/WriteFileTool.js.map +1 -0
- package/dist/tools/cleanSlateFileReadPolicy.d.ts +33 -0
- package/dist/tools/cleanSlateFileReadPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlateFileReadPolicy.js +84 -0
- package/dist/tools/cleanSlateFileReadPolicy.js.map +1 -0
- package/dist/tools/cleanSlateHostTypes.d.ts +100 -0
- package/dist/tools/cleanSlateHostTypes.d.ts.map +1 -0
- package/dist/tools/cleanSlateHostTypes.js +6 -0
- package/dist/tools/cleanSlateHostTypes.js.map +1 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.d.ts +47 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.js +126 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.js.map +1 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.d.ts +3 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.js +13 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.js.map +1 -0
- package/dist/tools/languageFeatureActivation.d.ts +13 -0
- package/dist/tools/languageFeatureActivation.d.ts.map +1 -0
- package/dist/tools/languageFeatureActivation.js +95 -0
- package/dist/tools/languageFeatureActivation.js.map +1 -0
- package/dist/tools/registry.d.ts +5 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +104 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/structuredEditCanonicalizer.d.ts +11 -0
- package/dist/tools/structuredEditCanonicalizer.d.ts.map +1 -0
- package/dist/tools/structuredEditCanonicalizer.js +44 -0
- package/dist/tools/structuredEditCanonicalizer.js.map +1 -0
- package/dist/tools/symbolContext.d.ts +36 -0
- package/dist/tools/symbolContext.d.ts.map +1 -0
- package/dist/tools/symbolContext.js +146 -0
- package/dist/tools/symbolContext.js.map +1 -0
- package/dist/tools/symbolEditResolver.d.ts +11 -0
- package/dist/tools/symbolEditResolver.d.ts.map +1 -0
- package/dist/tools/symbolEditResolver.js +259 -0
- package/dist/tools/symbolEditResolver.js.map +1 -0
- package/dist/tools/symbolIndex.d.ts +18 -0
- package/dist/tools/symbolIndex.d.ts.map +1 -0
- package/dist/tools/symbolIndex.js +235 -0
- package/dist/tools/symbolIndex.js.map +1 -0
- package/dist/tools/types.d.ts +108 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +6 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/utils.d.ts +56 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +205 -0
- package/dist/tools/utils.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) CleanSlate. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { CLEANSLATE_MAX_FILE_READ_LINES, resolveCleanSlateFileReadBudget, takeCleanSlateBoundedLineSlice } from './cleanSlateFileReadPolicy.js';
|
|
6
|
+
import { resolvePathToUri } from './utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Tool: read_file_range
|
|
9
|
+
*/
|
|
10
|
+
export const readFileRangeTool = {
|
|
11
|
+
name: 'read_file_range',
|
|
12
|
+
description: 'Reads a complete bounded line range from a file. Input: { path: string, startLine: number, endLine: number } (aliases start_line/end_line also supported). Returns the exact returned range, totalLines, and nextStartLine when more content remains; it never silently truncates content.',
|
|
13
|
+
parametersSchema: {
|
|
14
|
+
path: "string",
|
|
15
|
+
startLine: "number",
|
|
16
|
+
endLine: "number",
|
|
17
|
+
start_line: "number",
|
|
18
|
+
end_line: "number"
|
|
19
|
+
},
|
|
20
|
+
category: "discovery",
|
|
21
|
+
planningHint: "Use the explicit range suggested by a file_too_large read_file result, or a targeted range found through search. Read only non-overlapping ranges that are actually needed.",
|
|
22
|
+
async run(input, context) {
|
|
23
|
+
const path = input.path;
|
|
24
|
+
const startLine = typeof input.startLine === 'number' ? input.startLine : input.start_line;
|
|
25
|
+
const endLine = typeof input.endLine === 'number' ? input.endLine : input.end_line;
|
|
26
|
+
if (!path)
|
|
27
|
+
throw new Error('read_file_range requires a "path" parameter');
|
|
28
|
+
if (typeof startLine !== 'number' || typeof endLine !== 'number') {
|
|
29
|
+
throw new Error('read_file_range requires "startLine"/"endLine" (or "start_line"/"end_line") parameters as numbers');
|
|
30
|
+
}
|
|
31
|
+
if (!Number.isFinite(startLine) || !Number.isFinite(endLine)) {
|
|
32
|
+
throw new Error('read_file_range requires finite numeric startLine/endLine');
|
|
33
|
+
}
|
|
34
|
+
const normalizedStart = Math.max(1, Math.floor(startLine));
|
|
35
|
+
const normalizedEnd = Math.max(normalizedStart, Math.floor(endLine));
|
|
36
|
+
const requestedLineCount = normalizedEnd - normalizedStart + 1;
|
|
37
|
+
const cappedEnd = normalizedStart + Math.min(requestedLineCount, CLEANSLATE_MAX_FILE_READ_LINES) - 1;
|
|
38
|
+
try {
|
|
39
|
+
const uri = resolvePathToUri(path, context);
|
|
40
|
+
context.onProgress?.({ type: 'read', path: uri.fsPath });
|
|
41
|
+
let content = '';
|
|
42
|
+
let currentVersionId;
|
|
43
|
+
let mtime;
|
|
44
|
+
const model = context.modelService.getModel(uri);
|
|
45
|
+
if (model) {
|
|
46
|
+
content = model.getValue();
|
|
47
|
+
currentVersionId = model.getVersionId();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const fileContent = await context.textFileService.read(uri);
|
|
51
|
+
content = fileContent.value;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
mtime = (await context.fileService.stat(uri)).mtime;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Some schemes do not expose file metadata; version guards still apply when a model exists.
|
|
58
|
+
}
|
|
59
|
+
const lines = content.split('\n');
|
|
60
|
+
const config = context.configService.getConfiguration();
|
|
61
|
+
const contextWindowTokens = context.fileReadBudget?.contextWindowTokens
|
|
62
|
+
?? config.contextWindow
|
|
63
|
+
?? config.maxInputTokens
|
|
64
|
+
?? 64_000;
|
|
65
|
+
const availableInputTokens = context.fileReadBudget?.availableInputTokens ?? contextWindowTokens;
|
|
66
|
+
const readBudget = resolveCleanSlateFileReadBudget(contextWindowTokens, availableInputTokens);
|
|
67
|
+
const startIdx = normalizedStart - 1;
|
|
68
|
+
const endIdxExclusive = Math.min(lines.length, cappedEnd);
|
|
69
|
+
if (startIdx >= lines.length) {
|
|
70
|
+
throw new Error(`Start line ${normalizedStart} is beyond the end of the file (${lines.length} lines)`);
|
|
71
|
+
}
|
|
72
|
+
const boundedSlice = takeCleanSlateBoundedLineSlice(lines, startIdx, endIdxExclusive, readBudget.maxBytes);
|
|
73
|
+
if (boundedSlice.oversizedFirstLine) {
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
code: 'line_too_large',
|
|
77
|
+
path: uri.fsPath,
|
|
78
|
+
totalLines: lines.length,
|
|
79
|
+
maxBytes: readBudget.maxBytes,
|
|
80
|
+
maxTokens: readBudget.maxTokens,
|
|
81
|
+
message: `Line ${normalizedStart} exceeds this model turn's file-read budget of ${readBudget.maxBytes} UTF-8 bytes / ${readBudget.maxTokens} estimated tokens. No partial line was returned.`,
|
|
82
|
+
recoveryHint: 'Use grep_search or another targeted structured tool instead of reading this generated/minified line as source text.'
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const rangeContent = boundedSlice.content;
|
|
86
|
+
const actualEndLine = Math.max(normalizedStart, boundedSlice.endExclusive);
|
|
87
|
+
const requestedEndWithinFile = Math.min(lines.length, normalizedEnd);
|
|
88
|
+
const truncated = boundedSlice.endExclusive < requestedEndWithinFile || normalizedEnd > cappedEnd;
|
|
89
|
+
const hasMore = actualEndLine < lines.length;
|
|
90
|
+
const previousReadState = context.readFileState?.get(uri.toString());
|
|
91
|
+
const canReusePreviousRanges = previousReadState
|
|
92
|
+
&& previousReadState.currentVersionId === currentVersionId
|
|
93
|
+
&& previousReadState.mtime === mtime;
|
|
94
|
+
const previousRanges = canReusePreviousRanges ? previousReadState.ranges ?? [] : [];
|
|
95
|
+
const nextRange = {
|
|
96
|
+
startLine: normalizedStart,
|
|
97
|
+
endLine: actualEndLine,
|
|
98
|
+
content: rangeContent,
|
|
99
|
+
currentVersionId,
|
|
100
|
+
mtime,
|
|
101
|
+
readAt: Date.now()
|
|
102
|
+
};
|
|
103
|
+
const ranges = [
|
|
104
|
+
...previousRanges.filter(range => range.startLine !== nextRange.startLine || range.endLine !== nextRange.endLine),
|
|
105
|
+
nextRange
|
|
106
|
+
].slice(-32);
|
|
107
|
+
context.readFileState?.set(uri.toString(), {
|
|
108
|
+
path: uri.fsPath,
|
|
109
|
+
uri: uri.toString(),
|
|
110
|
+
content: rangeContent,
|
|
111
|
+
currentVersionId,
|
|
112
|
+
mtime,
|
|
113
|
+
totalLines: lines.length,
|
|
114
|
+
isPartialView: true,
|
|
115
|
+
readAt: nextRange.readAt,
|
|
116
|
+
ranges
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
content: rangeContent,
|
|
120
|
+
path: uri.fsPath,
|
|
121
|
+
range: { startLine: normalizedStart, endLine: actualEndLine },
|
|
122
|
+
totalLines: lines.length,
|
|
123
|
+
currentVersionId,
|
|
124
|
+
truncated,
|
|
125
|
+
hasMore,
|
|
126
|
+
nextStartLine: hasMore ? actualEndLine + 1 : undefined,
|
|
127
|
+
maxBytes: readBudget.maxBytes,
|
|
128
|
+
maxTokens: readBudget.maxTokens
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const message = String(error);
|
|
133
|
+
const isMissingFile = message.includes('Unable to resolve nonexistent file')
|
|
134
|
+
|| message.includes('not found')
|
|
135
|
+
|| message.includes('does not exist');
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
code: isMissingFile ? 'not_found' : 'read_failed',
|
|
139
|
+
path,
|
|
140
|
+
message: isMissingFile
|
|
141
|
+
? `File not found: "${path}". Discover the real file path before requesting a range read.`
|
|
142
|
+
: `Failed to read file range "${path}": ${message}`,
|
|
143
|
+
recoveryHint: isMissingFile
|
|
144
|
+
? 'Use list_dir(".") or find_by_name to locate the file first, then retry the range read.'
|
|
145
|
+
: 'Verify the path and line range, then retry.'
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=ReadFileRangeTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadFileRangeTool.js","sourceRoot":"","sources":["../../src/tools/ReadFileRangeTool.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,8BAA8B,EAAE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|
|
1
|
+
{"version":3,"file":"ReadFileTool.d.ts","sourceRoot":"","sources":["../../src/tools/ReadFileTool.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAyB,MAAM,YAAY,CAAC;AAKnE;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAiL1B,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) CleanSlate. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { CLEANSLATE_ARTIFACT_SCHEME } from '../protocol/cleanSlateAI.js';
|
|
6
|
+
import { getVirtualArtifactType, resolvePathToUri } from './utils.js';
|
|
7
|
+
import { isStaleGeneratedDiagnosticPath, STALE_GENERATED_DIAGNOSTIC_WARNING } from './cleanSlateStaleDiagnosticPolicy.js';
|
|
8
|
+
import { CLEANSLATE_MAX_FILE_READ_LINES, CLEANSLATE_MAX_FULL_FILE_READ_BYTES, estimateCleanSlateFileReadTokens, estimateCleanSlateUtf8Bytes, resolveCleanSlateFileReadBudget, takeCleanSlateBoundedLineSlice } from './cleanSlateFileReadPolicy.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tool: read_file
|
|
11
|
+
*/
|
|
12
|
+
export const readFileTool = {
|
|
13
|
+
name: 'read_file',
|
|
14
|
+
description: 'Reads a complete text file from the workspace when it fits the file-read budget. Input: { path: string }. Large files return a structured file_too_large result with available size/line metadata and a suggested read_file_range; content is never silently truncated.',
|
|
15
|
+
parametersSchema: {
|
|
16
|
+
path: "string"
|
|
17
|
+
},
|
|
18
|
+
category: "discovery",
|
|
19
|
+
planningHint: "Use when complete file content is required. If the tool reports file_too_large, use its suggested read_file_range instead of repeating the same read or running wc.",
|
|
20
|
+
async run(input, context) {
|
|
21
|
+
const { path } = input;
|
|
22
|
+
if (!path)
|
|
23
|
+
throw new Error('read_file requires a "path" parameter');
|
|
24
|
+
try {
|
|
25
|
+
const uri = resolvePathToUri(path, context);
|
|
26
|
+
context.onProgress?.({ type: 'read', path: uri.fsPath });
|
|
27
|
+
let content = '';
|
|
28
|
+
let languageId = 'plaintext';
|
|
29
|
+
let currentVersionId;
|
|
30
|
+
let mtime;
|
|
31
|
+
// Check if it's a virtual artifact FIRST
|
|
32
|
+
if (uri.scheme === CLEANSLATE_ARTIFACT_SCHEME) {
|
|
33
|
+
const artifactType = getVirtualArtifactType(path);
|
|
34
|
+
let artifact;
|
|
35
|
+
if (artifactType === 'implementation_plan')
|
|
36
|
+
artifact = context.artifactService.getLatestArtifactByType('implementation_plan', { sessionId: context.sessionId });
|
|
37
|
+
else if (artifactType === 'walkthrough')
|
|
38
|
+
artifact = context.artifactService.getLatestArtifactByType('walkthrough', { sessionId: context.sessionId });
|
|
39
|
+
else if (artifactType === 'analysis')
|
|
40
|
+
artifact = context.artifactService.getLatestArtifactByType('analysis', { sessionId: context.sessionId });
|
|
41
|
+
if (artifact) {
|
|
42
|
+
content = artifact.content;
|
|
43
|
+
languageId = 'markdown';
|
|
44
|
+
return { content, languageId, path: uri.toString() };
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`Virtual artifact "${path}" not found.`);
|
|
47
|
+
}
|
|
48
|
+
const config = context.configService.getConfiguration();
|
|
49
|
+
const contextWindowTokens = context.fileReadBudget?.contextWindowTokens
|
|
50
|
+
?? config.contextWindow
|
|
51
|
+
?? config.maxInputTokens
|
|
52
|
+
?? 64_000;
|
|
53
|
+
const availableInputTokens = context.fileReadBudget?.availableInputTokens ?? contextWindowTokens;
|
|
54
|
+
const readBudget = resolveCleanSlateFileReadBudget(contextWindowTokens, availableInputTokens);
|
|
55
|
+
const model = context.modelService.getModel(uri);
|
|
56
|
+
let fileSize;
|
|
57
|
+
try {
|
|
58
|
+
const stat = await context.fileService.stat(uri);
|
|
59
|
+
mtime = stat.mtime;
|
|
60
|
+
fileSize = stat.size;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Some schemes do not expose file metadata; the adaptive result budget still applies.
|
|
64
|
+
}
|
|
65
|
+
if (!model && typeof fileSize === 'number' && fileSize > CLEANSLATE_MAX_FULL_FILE_READ_BYTES) {
|
|
66
|
+
context.readFileState?.set(uri.toString(), {
|
|
67
|
+
path: uri.fsPath,
|
|
68
|
+
uri: uri.toString(),
|
|
69
|
+
currentVersionId,
|
|
70
|
+
mtime,
|
|
71
|
+
isPartialView: true,
|
|
72
|
+
readAt: Date.now(),
|
|
73
|
+
ranges: []
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
code: 'file_too_large',
|
|
78
|
+
path: uri.fsPath,
|
|
79
|
+
totalBytes: fileSize,
|
|
80
|
+
maxFullFileBytes: CLEANSLATE_MAX_FULL_FILE_READ_BYTES,
|
|
81
|
+
maxBytes: readBudget.maxBytes,
|
|
82
|
+
maxTokens: readBudget.maxTokens,
|
|
83
|
+
contextWindowTokens: readBudget.contextWindowTokens,
|
|
84
|
+
availableInputTokens: readBudget.availableInputTokens,
|
|
85
|
+
suggestedRange: { startLine: 1, endLine: CLEANSLATE_MAX_FILE_READ_LINES },
|
|
86
|
+
message: `File is ${fileSize} bytes, exceeding the ${CLEANSLATE_MAX_FULL_FILE_READ_BYTES}-byte unrestricted full-read safety limit. The file was not loaded and no partial content was returned.`,
|
|
87
|
+
recoveryHint: 'Use a targeted search or read_file_range with the suggested starting range. Continue with later non-overlapping ranges only when needed.'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (model) {
|
|
91
|
+
content = model.getValue();
|
|
92
|
+
languageId = model.getLanguageId();
|
|
93
|
+
currentVersionId = model.getVersionId();
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const fileContent = await context.textFileService.read(uri);
|
|
97
|
+
content = fileContent.value;
|
|
98
|
+
// `read` reports a text encoding, not a language. With no model
|
|
99
|
+
// resolved there is nothing to ask, so leave the default rather
|
|
100
|
+
// than reporting "utf8" as the file's language.
|
|
101
|
+
languageId = 'plaintext';
|
|
102
|
+
}
|
|
103
|
+
const totalLines = content.split('\n').length;
|
|
104
|
+
const totalBytes = estimateCleanSlateUtf8Bytes(content);
|
|
105
|
+
const estimatedTokens = estimateCleanSlateFileReadTokens(content);
|
|
106
|
+
if (totalBytes > readBudget.maxBytes || estimatedTokens > readBudget.maxTokens) {
|
|
107
|
+
const lines = content.split('\n');
|
|
108
|
+
const suggestedSlice = takeCleanSlateBoundedLineSlice(lines, 0, Math.min(totalLines, CLEANSLATE_MAX_FILE_READ_LINES), readBudget.maxBytes);
|
|
109
|
+
const suggestedEndLine = Math.max(1, suggestedSlice.endExclusive);
|
|
110
|
+
context.readFileState?.set(uri.toString(), {
|
|
111
|
+
path: uri.fsPath,
|
|
112
|
+
uri: uri.toString(),
|
|
113
|
+
totalLines,
|
|
114
|
+
currentVersionId,
|
|
115
|
+
mtime,
|
|
116
|
+
isPartialView: true,
|
|
117
|
+
readAt: Date.now(),
|
|
118
|
+
ranges: []
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
code: 'file_too_large',
|
|
123
|
+
path: uri.fsPath,
|
|
124
|
+
totalLines,
|
|
125
|
+
totalBytes,
|
|
126
|
+
estimatedTokens,
|
|
127
|
+
maxBytes: readBudget.maxBytes,
|
|
128
|
+
maxTokens: readBudget.maxTokens,
|
|
129
|
+
contextWindowTokens: readBudget.contextWindowTokens,
|
|
130
|
+
availableInputTokens: readBudget.availableInputTokens,
|
|
131
|
+
currentVersionId,
|
|
132
|
+
suggestedRange: {
|
|
133
|
+
startLine: 1,
|
|
134
|
+
endLine: suggestedEndLine
|
|
135
|
+
},
|
|
136
|
+
message: `File has ${totalLines} lines, ${totalBytes} UTF-8 bytes, and approximately ${estimatedTokens} tokens. It exceeds this model turn's complete-read budget of ${readBudget.maxBytes} bytes / ${readBudget.maxTokens} estimated tokens. No partial content was returned.`,
|
|
137
|
+
recoveryHint: 'Call read_file_range once with the suggested range, then continue with later non-overlapping ranges only when those sections are needed. Do not repeat read_file or run wc; totalLines is already provided.'
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
context.readFileState?.set(uri.toString(), {
|
|
141
|
+
path: uri.fsPath,
|
|
142
|
+
uri: uri.toString(),
|
|
143
|
+
content,
|
|
144
|
+
totalLines,
|
|
145
|
+
currentVersionId,
|
|
146
|
+
mtime,
|
|
147
|
+
isPartialView: false,
|
|
148
|
+
readAt: Date.now(),
|
|
149
|
+
ranges: []
|
|
150
|
+
});
|
|
151
|
+
if (isStaleGeneratedDiagnosticPath(path) || isStaleGeneratedDiagnosticPath(uri.fsPath)) {
|
|
152
|
+
return {
|
|
153
|
+
content,
|
|
154
|
+
languageId,
|
|
155
|
+
path: uri.fsPath,
|
|
156
|
+
totalLines,
|
|
157
|
+
currentVersionId,
|
|
158
|
+
staleGeneratedDiagnostic: true,
|
|
159
|
+
warning: STALE_GENERATED_DIAGNOSTIC_WARNING
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return { content, languageId, path: uri.fsPath, totalLines, currentVersionId, truncated: false };
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
const message = String(error);
|
|
166
|
+
const isMissingFile = message.includes('Unable to resolve nonexistent file')
|
|
167
|
+
|| message.includes('not found')
|
|
168
|
+
|| message.includes('does not exist');
|
|
169
|
+
return {
|
|
170
|
+
success: false,
|
|
171
|
+
code: isMissingFile ? 'not_found' : 'read_failed',
|
|
172
|
+
path,
|
|
173
|
+
message: isMissingFile
|
|
174
|
+
? `File not found: "${path}". Do not assume common manifest files exist. Inspect the actual root listing and only read files that were discovered in this workspace.`
|
|
175
|
+
: `Failed to read file "${path}": ${message}`,
|
|
176
|
+
recoveryHint: isMissingFile
|
|
177
|
+
? 'Use list_dir(".") or find_by_name first, then read only files that actually exist.'
|
|
178
|
+
: 'Verify the path and retry. If the file is large, consider read_file_range after locating the correct target.'
|
|
179
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BACV,gBAAgB;oBAChB,wBAAwB,EAAE,IAAI;oBAC9B,OAAO,EAAE,kCAAkC;iBAC9C,CAAC;YACN,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACrG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,MAAM,aAAa,GACf,OAAO,CAAC,QAAQ,CAAC,oCAAoC,CAAC;mBACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;mBAC7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YAE1C,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;gBACjD,IAAI;gBACJ,OAAO,EAAE,aAAa;oBAClB,CAAC,CAAC,oBAAoB,IAAI,2IAA2I;oBACrK,CAAC,CAAC,wBAAwB,IAAI,MAAM,OAAO,EAAE;gBACjD,YAAY,EAAE,aAAa;oBACvB,CAAC,CAAC,oFAAoF;oBACtF,CAAC,CAAC,8GAA8G;aACvH,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadLintsTool.d.ts","sourceRoot":"","sources":["../../src/tools/ReadLintsTool.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAyB,MAAM,YAAY,CAAC;AAGnE;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cA8E3B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) CleanSlate. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { MarkerSeverity } from '../host/diagnostics.js';
|
|
6
|
+
import { resolvePathToUri } from './utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Tool: read_lints
|
|
9
|
+
*/
|
|
10
|
+
export const readLintsTool = {
|
|
11
|
+
name: 'read_lints',
|
|
12
|
+
description: 'Reads diagnostics (errors, warnings, hints) from the VS Code marker service. Input: { path?: string, paths?: string[] }. If path or paths are provided, returns lints for those files. If omitted, returns lints for the whole workspace.',
|
|
13
|
+
parametersSchema: {
|
|
14
|
+
path: "string (optional)",
|
|
15
|
+
paths: "string[] (optional) - Preferred after multi-file edits; scopes diagnostics to these files."
|
|
16
|
+
},
|
|
17
|
+
category: "discovery",
|
|
18
|
+
planningHint: "Use after edits to verify there are no new syntax or compiler errors.",
|
|
19
|
+
async run(input, context) {
|
|
20
|
+
const requestedPaths = [
|
|
21
|
+
...(typeof input.path === 'string' && input.path.trim().length > 0 ? [input.path] : []),
|
|
22
|
+
...(Array.isArray(input.paths) ? input.paths.filter((path) => typeof path === 'string' && path.trim().length > 0) : [])
|
|
23
|
+
];
|
|
24
|
+
const uniquePaths = [...new Set(requestedPaths)];
|
|
25
|
+
const resources = [];
|
|
26
|
+
for (const path of uniquePaths) {
|
|
27
|
+
try {
|
|
28
|
+
resources.push(resolvePathToUri(path, context));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return { success: false, message: `Invalid path: ${path}` };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const markers = resources.length > 0
|
|
35
|
+
? resources.flatMap(resource => context.markerService.read({ resource }))
|
|
36
|
+
: context.markerService.read({});
|
|
37
|
+
// Filter to errors and warnings only, or include all?
|
|
38
|
+
// Let's include everything but label them.
|
|
39
|
+
const results = markers.map(marker => {
|
|
40
|
+
// Broadcast focus lines for each significant diagnostic
|
|
41
|
+
if (context.recentFocusLines && marker.resource) {
|
|
42
|
+
const uriStr = marker.resource.toString();
|
|
43
|
+
if (!context.recentFocusLines.has(uriStr)) {
|
|
44
|
+
context.recentFocusLines.set(uriStr, new Set());
|
|
45
|
+
}
|
|
46
|
+
const focusSet = context.recentFocusLines.get(uriStr);
|
|
47
|
+
for (let i = marker.startLineNumber; i <= marker.endLineNumber; i++) {
|
|
48
|
+
focusSet.add(i);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
severity: MarkerSeverity.toString(marker.severity),
|
|
53
|
+
message: marker.message,
|
|
54
|
+
startLineNumber: marker.startLineNumber,
|
|
55
|
+
startColumn: marker.startColumn,
|
|
56
|
+
endLineNumber: marker.endLineNumber,
|
|
57
|
+
endColumn: marker.endColumn,
|
|
58
|
+
source: marker.source,
|
|
59
|
+
code: marker.code,
|
|
60
|
+
resource: marker.resource?.fsPath ?? marker.resource?.toString()
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
if (results.length === 0) {
|
|
64
|
+
const target = uniquePaths.length === 1
|
|
65
|
+
? uniquePaths[0]
|
|
66
|
+
: uniquePaths.length > 1
|
|
67
|
+
? `${uniquePaths.length} files`
|
|
68
|
+
: 'workspace';
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
message: `No lints found in ${target}.`,
|
|
72
|
+
errors: []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// Group by resource for easier reading if it's a workspace search
|
|
76
|
+
return {
|
|
77
|
+
success: true,
|
|
78
|
+
scopedPaths: uniquePaths,
|
|
79
|
+
errors: results
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=ReadLintsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadLintsTool.js","sourceRoot":"","sources":["../../src/tools/ReadLintsTool.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,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C,SAAS;gBAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE;aACnE,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,KAAK,CAAC;gBACnC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;gBAChB,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;oBACpB,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,QAAQ;oBAC/B,CAAC,CAAC,WAAW,CAAC;YACtB,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,qBAAqB,MAAM,GAAG;gBACvC,MAAM,EAAE,EAAE;aACb,CAAC;QACN,CAAC;QAED,kEAAkE;QAClE,OAAO;YACH,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,WAAW;YACxB,MAAM,EAAE,OAAO;SAClB,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadReferenceTool.d.ts","sourceRoot":"","sources":["../../src/tools/ReadReferenceTool.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAyB,MAAM,YAAY,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAe/B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) CleanSlate. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Tool: read_reference
|
|
7
|
+
*/
|
|
8
|
+
export const readReferenceTool = {
|
|
9
|
+
name: 'read_reference',
|
|
10
|
+
description: 'Retrieves the full content of a "sniped" tool result using its Reference ID. Input: { referenceId: string }. Returns: { content: string }',
|
|
11
|
+
parametersSchema: {
|
|
12
|
+
referenceId: "string - The Unique ID provided in the previous tool output placeholder (e.g. REF-123)"
|
|
13
|
+
},
|
|
14
|
+
category: "system",
|
|
15
|
+
async run(input, _context) {
|
|
16
|
+
// The implementation is handled in CleanSlateAgent by looking up its internal referenceBuffer
|
|
17
|
+
return {
|
|
18
|
+
success: true,
|
|
19
|
+
isReferenceRequest: true,
|
|
20
|
+
referenceId: input.referenceId
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ReadReferenceTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadReferenceTool.js","sourceRoot":"","sources":["../../src/tools/ReadReferenceTool.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC7C,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,2IAA2I;IACxJ,gBAAgB,EAAE;QACd,WAAW,EAAE,wFAAwF;KACxG;IACD,QAAQ,EAAE,QAAQ;IAClB,KAAK,CAAC,GAAG,CAAC,KAA8B,EAAE,QAA+B;QACrE,8FAA8F;QAC9F,OAAO;YACH,OAAO,EAAE,IAAI;YACb,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SACjC,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadSymbolsTool.d.ts","sourceRoot":"","sources":["../../src/tools/ReadSymbolsTool.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAyB,MAAM,YAAY,CAAC;AAMnE,eAAO,MAAM,eAAe,EAAE,cAgF7B,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) CleanSlate. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { resolvePathToUri } from './utils.js';
|
|
6
|
+
import { buildSymbolContext, symbolKindToLabel } from './symbolContext.js';
|
|
7
|
+
import { fireDocumentSymbolProvider, resolveBackgroundLanguageFeatureModel } from './languageFeatureActivation.js';
|
|
8
|
+
import { cancellationTokenFromAbortSignal } from '../services/cleanSlateCancellation.js';
|
|
9
|
+
export const readSymbolsTool = {
|
|
10
|
+
name: 'read_symbols',
|
|
11
|
+
description: 'Fetch all symbols plus a semantic owner map for each line using LSP. Use this to distinguish duplicate method/class names and target edits by symbolPath.',
|
|
12
|
+
parametersSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
path: { type: 'string', description: 'Path to the file relative to the workspace root.' }
|
|
16
|
+
},
|
|
17
|
+
required: ['path']
|
|
18
|
+
},
|
|
19
|
+
async run(input, context) {
|
|
20
|
+
if (!input.path || typeof input.path !== 'string') {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
code: 'invalid_input',
|
|
24
|
+
message: 'The "path" argument is required and must be a non-empty string.',
|
|
25
|
+
recoveryHint: 'Specify the relative path to the file you want to read symbols from.'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (!context.languageFeaturesService && !context.commandService) {
|
|
29
|
+
return { success: false, message: 'Language features command and provider services are not available.' };
|
|
30
|
+
}
|
|
31
|
+
const uri = resolvePathToUri(input.path, context);
|
|
32
|
+
const firedSymbols = await fireDocumentSymbolProvider(uri, context);
|
|
33
|
+
const model = await resolveBackgroundLanguageFeatureModel(uri, context);
|
|
34
|
+
if (!model) {
|
|
35
|
+
const fileContent = await context.textFileService.read(uri);
|
|
36
|
+
const totalLines = fileContent.value.split('\n').length;
|
|
37
|
+
const symbols = Array.isArray(firedSymbols) ? firedSymbols : [];
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
path: input.path,
|
|
41
|
+
symbols: symbols.map(formatSymbol),
|
|
42
|
+
symbolContext: buildSymbolContext(symbols, totalLines),
|
|
43
|
+
message: symbols.length > 0
|
|
44
|
+
? 'Symbols returned from the background language-feature command.'
|
|
45
|
+
: 'No model was loaded after background LSP activation.'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// 2. Wait for providers to register
|
|
49
|
+
let providers = context.languageFeaturesService?.documentSymbolProvider.ordered(model) ?? [];
|
|
50
|
+
if (providers.length === 0) {
|
|
51
|
+
for (let i = 0; i < 10; i++) {
|
|
52
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
53
|
+
providers = context.languageFeaturesService?.documentSymbolProvider.ordered(model) ?? [];
|
|
54
|
+
if (providers.length > 0)
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (providers.length === 0 && (!Array.isArray(firedSymbols) || firedSymbols.length === 0)) {
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
path: input.path,
|
|
62
|
+
symbols: [],
|
|
63
|
+
symbolContext: [],
|
|
64
|
+
message: 'No semantic symbol providers found after firing the language server for this file type.'
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const allSymbols = providers.length === 0 && Array.isArray(firedSymbols) ? [...firedSymbols] : [];
|
|
68
|
+
const token = cancellationTokenFromAbortSignal(context.signal);
|
|
69
|
+
for (const provider of providers) {
|
|
70
|
+
const result = await provider.provideDocumentSymbols(model, token);
|
|
71
|
+
if (result) {
|
|
72
|
+
allSymbols.push(...result);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const symbolContext = buildSymbolContext(allSymbols, model.getLineCount());
|
|
76
|
+
return {
|
|
77
|
+
success: true,
|
|
78
|
+
path: input.path,
|
|
79
|
+
symbols: allSymbols.map(formatSymbol),
|
|
80
|
+
symbolContext
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function formatSymbol(s) {
|
|
85
|
+
return {
|
|
86
|
+
name: s.name,
|
|
87
|
+
kind: s.kind,
|
|
88
|
+
kindLabel: symbolKindToLabel(s.kind),
|
|
89
|
+
range: {
|
|
90
|
+
start: s.range.startLineNumber,
|
|
91
|
+
end: s.range.endLineNumber
|
|
92
|
+
},
|
|
93
|
+
selectionRange: {
|
|
94
|
+
start: s.selectionRange.startLineNumber,
|
|
95
|
+
end: s.selectionRange.endLineNumber
|
|
96
|
+
},
|
|
97
|
+
children: s.children?.map(formatSymbol)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=ReadSymbolsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadSymbolsTool.js","sourceRoot":"","sources":["../../src/tools/ReadSymbolsTool.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC3C,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,2JAA2J;IACxK,gBAAgB,EAAE;QACd,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kDAAkD,EAAE;SAC5F;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACrB;IACD,KAAK,CAAC,GAAG,CAAC,KAAU,EAAE,OAA8B;QAChD,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OA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