@vybestack/llxprt-code-tools 0.10.0-nightly.260613.1adad3b34
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 +202 -0
- package/README.md +294 -0
- package/dist/.last_build +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.d.ts +29 -0
- package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.js +30 -0
- package/dist/src/__tests__/fixtures/filesystem-tool-fixtures.js.map +1 -0
- package/dist/src/__tests__/fixtures/key-storage-fixtures.d.ts +39 -0
- package/dist/src/__tests__/fixtures/key-storage-fixtures.js +53 -0
- package/dist/src/__tests__/fixtures/key-storage-fixtures.js.map +1 -0
- package/dist/src/__tests__/fixtures/provider-formatting-fixtures.d.ts +140 -0
- package/dist/src/__tests__/fixtures/provider-formatting-fixtures.js +157 -0
- package/dist/src/__tests__/fixtures/provider-formatting-fixtures.js.map +1 -0
- package/dist/src/__tests__/red-test-helpers.d.ts +14 -0
- package/dist/src/__tests__/red-test-helpers.js +18 -0
- package/dist/src/__tests__/red-test-helpers.js.map +1 -0
- package/dist/src/formatters/IToolFormatter.d.ts +84 -0
- package/dist/src/formatters/IToolFormatter.js +6 -0
- package/dist/src/formatters/IToolFormatter.js.map +1 -0
- package/dist/src/formatters/ToolFormatter.d.ts +94 -0
- package/dist/src/formatters/ToolFormatter.js +379 -0
- package/dist/src/formatters/ToolFormatter.js.map +1 -0
- package/dist/src/formatters/ToolIdStrategy.d.ts +79 -0
- package/dist/src/formatters/ToolIdStrategy.js +173 -0
- package/dist/src/formatters/ToolIdStrategy.js.map +1 -0
- package/dist/src/formatters/doubleEscapeUtils.d.ts +46 -0
- package/dist/src/formatters/doubleEscapeUtils.js +223 -0
- package/dist/src/formatters/doubleEscapeUtils.js.map +1 -0
- package/dist/src/formatters/index.d.ts +21 -0
- package/dist/src/formatters/index.js +12 -0
- package/dist/src/formatters/index.js.map +1 -0
- package/dist/src/formatters/toolIdNormalization.d.ts +28 -0
- package/dist/src/formatters/toolIdNormalization.js +97 -0
- package/dist/src/formatters/toolIdNormalization.js.map +1 -0
- package/dist/src/formatters/toolNameUtils.d.ts +43 -0
- package/dist/src/formatters/toolNameUtils.js +143 -0
- package/dist/src/formatters/toolNameUtils.js.map +1 -0
- package/dist/src/index.d.ts +88 -0
- package/dist/src/index.js +68 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces/IAsyncTaskService.d.ts +57 -0
- package/dist/src/interfaces/IAsyncTaskService.js +6 -0
- package/dist/src/interfaces/IAsyncTaskService.js.map +1 -0
- package/dist/src/interfaces/IIdeService.d.ts +62 -0
- package/dist/src/interfaces/IIdeService.js +6 -0
- package/dist/src/interfaces/IIdeService.js.map +1 -0
- package/dist/src/interfaces/ILspService.d.ts +54 -0
- package/dist/src/interfaces/ILspService.js +6 -0
- package/dist/src/interfaces/ILspService.js.map +1 -0
- package/dist/src/interfaces/IMcpToolService.d.ts +47 -0
- package/dist/src/interfaces/IMcpToolService.js +6 -0
- package/dist/src/interfaces/IMcpToolService.js.map +1 -0
- package/dist/src/interfaces/IPromptRegistryService.d.ts +51 -0
- package/dist/src/interfaces/IPromptRegistryService.js +6 -0
- package/dist/src/interfaces/IPromptRegistryService.js.map +1 -0
- package/dist/src/interfaces/ISettingsService.d.ts +50 -0
- package/dist/src/interfaces/ISettingsService.js +6 -0
- package/dist/src/interfaces/ISettingsService.js.map +1 -0
- package/dist/src/interfaces/IShellExecutionService.d.ts +55 -0
- package/dist/src/interfaces/IShellExecutionService.js +6 -0
- package/dist/src/interfaces/IShellExecutionService.js.map +1 -0
- package/dist/src/interfaces/IShellToolHost.d.ts +176 -0
- package/dist/src/interfaces/IShellToolHost.js +6 -0
- package/dist/src/interfaces/IShellToolHost.js.map +1 -0
- package/dist/src/interfaces/ISkillService.d.ts +69 -0
- package/dist/src/interfaces/ISkillService.js +6 -0
- package/dist/src/interfaces/ISkillService.js.map +1 -0
- package/dist/src/interfaces/IStorageService.d.ts +42 -0
- package/dist/src/interfaces/IStorageService.js +6 -0
- package/dist/src/interfaces/IStorageService.js.map +1 -0
- package/dist/src/interfaces/ISubagentService.d.ts +112 -0
- package/dist/src/interfaces/ISubagentService.js +6 -0
- package/dist/src/interfaces/ISubagentService.js.map +1 -0
- package/dist/src/interfaces/ITaskToolHost.d.ts +185 -0
- package/dist/src/interfaces/ITaskToolHost.js +6 -0
- package/dist/src/interfaces/ITaskToolHost.js.map +1 -0
- package/dist/src/interfaces/ITodoService.d.ts +79 -0
- package/dist/src/interfaces/ITodoService.js +6 -0
- package/dist/src/interfaces/ITodoService.js.map +1 -0
- package/dist/src/interfaces/IToolHost.d.ts +91 -0
- package/dist/src/interfaces/IToolHost.js +6 -0
- package/dist/src/interfaces/IToolHost.js.map +1 -0
- package/dist/src/interfaces/IToolKeyStorage.d.ts +62 -0
- package/dist/src/interfaces/IToolKeyStorage.js +6 -0
- package/dist/src/interfaces/IToolKeyStorage.js.map +1 -0
- package/dist/src/interfaces/IToolMessageBus.d.ts +63 -0
- package/dist/src/interfaces/IToolMessageBus.js +6 -0
- package/dist/src/interfaces/IToolMessageBus.js.map +1 -0
- package/dist/src/interfaces/IToolRegistryHost.d.ts +43 -0
- package/dist/src/interfaces/IToolRegistryHost.js +6 -0
- package/dist/src/interfaces/IToolRegistryHost.js.map +1 -0
- package/dist/src/interfaces/IWebSearchService.d.ts +16 -0
- package/dist/src/interfaces/IWebSearchService.js +7 -0
- package/dist/src/interfaces/IWebSearchService.js.map +1 -0
- package/dist/src/interfaces/index.d.ts +33 -0
- package/dist/src/interfaces/index.js +6 -0
- package/dist/src/interfaces/index.js.map +1 -0
- package/dist/src/tools/activate-skill.d.ts +26 -0
- package/dist/src/tools/activate-skill.js +121 -0
- package/dist/src/tools/activate-skill.js.map +1 -0
- package/dist/src/tools/apply-patch.d.ts +65 -0
- package/dist/src/tools/apply-patch.js +528 -0
- package/dist/src/tools/apply-patch.js.map +1 -0
- package/dist/src/tools/ast-edit/ast-config.d.ts +67 -0
- package/dist/src/tools/ast-edit/ast-config.js +72 -0
- package/dist/src/tools/ast-edit/ast-config.js.map +1 -0
- package/dist/src/tools/ast-edit/ast-edit-invocation.d.ts +40 -0
- package/dist/src/tools/ast-edit/ast-edit-invocation.js +410 -0
- package/dist/src/tools/ast-edit/ast-edit-invocation.js.map +1 -0
- package/dist/src/tools/ast-edit/ast-query-extractor.d.ts +21 -0
- package/dist/src/tools/ast-edit/ast-query-extractor.js +178 -0
- package/dist/src/tools/ast-edit/ast-query-extractor.js.map +1 -0
- package/dist/src/tools/ast-edit/ast-read-file-invocation.d.ts +26 -0
- package/dist/src/tools/ast-edit/ast-read-file-invocation.js +149 -0
- package/dist/src/tools/ast-edit/ast-read-file-invocation.js.map +1 -0
- package/dist/src/tools/ast-edit/constants.d.ts +30 -0
- package/dist/src/tools/ast-edit/constants.js +36 -0
- package/dist/src/tools/ast-edit/constants.js.map +1 -0
- package/dist/src/tools/ast-edit/context-collector.d.ts +25 -0
- package/dist/src/tools/ast-edit/context-collector.js +115 -0
- package/dist/src/tools/ast-edit/context-collector.js.map +1 -0
- package/dist/src/tools/ast-edit/context-optimizer.d.ts +29 -0
- package/dist/src/tools/ast-edit/context-optimizer.js +86 -0
- package/dist/src/tools/ast-edit/context-optimizer.js.map +1 -0
- package/dist/src/tools/ast-edit/cross-file-analyzer.d.ts +41 -0
- package/dist/src/tools/ast-edit/cross-file-analyzer.js +294 -0
- package/dist/src/tools/ast-edit/cross-file-analyzer.js.map +1 -0
- package/dist/src/tools/ast-edit/edit-calculator.d.ts +71 -0
- package/dist/src/tools/ast-edit/edit-calculator.js +249 -0
- package/dist/src/tools/ast-edit/edit-calculator.js.map +1 -0
- package/dist/src/tools/ast-edit/edit-helpers.d.ts +22 -0
- package/dist/src/tools/ast-edit/edit-helpers.js +36 -0
- package/dist/src/tools/ast-edit/edit-helpers.js.map +1 -0
- package/dist/src/tools/ast-edit/language-analysis.d.ts +19 -0
- package/dist/src/tools/ast-edit/language-analysis.js +123 -0
- package/dist/src/tools/ast-edit/language-analysis.js.map +1 -0
- package/dist/src/tools/ast-edit/local-context-analyzer.d.ts +84 -0
- package/dist/src/tools/ast-edit/local-context-analyzer.js +267 -0
- package/dist/src/tools/ast-edit/local-context-analyzer.js.map +1 -0
- package/dist/src/tools/ast-edit/repository-context-provider.d.ts +22 -0
- package/dist/src/tools/ast-edit/repository-context-provider.js +139 -0
- package/dist/src/tools/ast-edit/repository-context-provider.js.map +1 -0
- package/dist/src/tools/ast-edit/types.d.ts +155 -0
- package/dist/src/tools/ast-edit/types.js +7 -0
- package/dist/src/tools/ast-edit/types.js.map +1 -0
- package/dist/src/tools/ast-edit/workspace-context-provider.d.ts +22 -0
- package/dist/src/tools/ast-edit/workspace-context-provider.js +39 -0
- package/dist/src/tools/ast-edit/workspace-context-provider.js.map +1 -0
- package/dist/src/tools/ast-edit.d.ts +43 -0
- package/dist/src/tools/ast-edit.js +183 -0
- package/dist/src/tools/ast-edit.js.map +1 -0
- package/dist/src/tools/ast-grep.d.ts +22 -0
- package/dist/src/tools/ast-grep.js +291 -0
- package/dist/src/tools/ast-grep.js.map +1 -0
- package/dist/src/tools/check-async-tasks.d.ts +46 -0
- package/dist/src/tools/check-async-tasks.js +241 -0
- package/dist/src/tools/check-async-tasks.js.map +1 -0
- package/dist/src/tools/codesearch.d.ts +25 -0
- package/dist/src/tools/codesearch.js +153 -0
- package/dist/src/tools/codesearch.js.map +1 -0
- package/dist/src/tools/delete_line_range.d.ts +41 -0
- package/dist/src/tools/delete_line_range.js +238 -0
- package/dist/src/tools/delete_line_range.js.map +1 -0
- package/dist/src/tools/direct-web-fetch.d.ts +22 -0
- package/dist/src/tools/direct-web-fetch.js +215 -0
- package/dist/src/tools/direct-web-fetch.js.map +1 -0
- package/dist/src/tools/edit-utils.d.ts +53 -0
- package/dist/src/tools/edit-utils.js +250 -0
- package/dist/src/tools/edit-utils.js.map +1 -0
- package/dist/src/tools/edit.d.ts +70 -0
- package/dist/src/tools/edit.js +816 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/exa-web-search.d.ts +27 -0
- package/dist/src/tools/exa-web-search.js +153 -0
- package/dist/src/tools/exa-web-search.js.map +1 -0
- package/dist/src/tools/glob.d.ts +55 -0
- package/dist/src/tools/glob.js +284 -0
- package/dist/src/tools/glob.js.map +1 -0
- package/dist/src/tools/google-web-fetch.d.ts +34 -0
- package/dist/src/tools/google-web-fetch.js +417 -0
- package/dist/src/tools/google-web-fetch.js.map +1 -0
- package/dist/src/tools/google-web-search-invocation.d.ts +53 -0
- package/dist/src/tools/google-web-search-invocation.js +180 -0
- package/dist/src/tools/google-web-search-invocation.js.map +1 -0
- package/dist/src/tools/google-web-search.d.ts +16 -0
- package/dist/src/tools/google-web-search.js +34 -0
- package/dist/src/tools/google-web-search.js.map +1 -0
- package/dist/src/tools/grep.d.ts +56 -0
- package/dist/src/tools/grep.js +883 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/insert_at_line.d.ts +41 -0
- package/dist/src/tools/insert_at_line.js +287 -0
- package/dist/src/tools/insert_at_line.js.map +1 -0
- package/dist/src/tools/list-subagents.d.ts +31 -0
- package/dist/src/tools/list-subagents.js +122 -0
- package/dist/src/tools/list-subagents.js.map +1 -0
- package/dist/src/tools/ls.d.ts +71 -0
- package/dist/src/tools/ls.js +238 -0
- package/dist/src/tools/ls.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +66 -0
- package/dist/src/tools/memoryTool.js +435 -0
- package/dist/src/tools/memoryTool.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +37 -0
- package/dist/src/tools/modifiable-tool.js +120 -0
- package/dist/src/tools/modifiable-tool.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +49 -0
- package/dist/src/tools/read-file.js +279 -0
- package/dist/src/tools/read-file.js.map +1 -0
- package/dist/src/tools/read-many-files.d.ts +60 -0
- package/dist/src/tools/read-many-files.js +529 -0
- package/dist/src/tools/read-many-files.js.map +1 -0
- package/dist/src/tools/read_line_range.d.ts +47 -0
- package/dist/src/tools/read_line_range.js +248 -0
- package/dist/src/tools/read_line_range.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +41 -0
- package/dist/src/tools/ripGrep.js +395 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/shell.d.ts +60 -0
- package/dist/src/tools/shell.js +735 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/structural-analysis.d.ts +27 -0
- package/dist/src/tools/structural-analysis.js +1089 -0
- package/dist/src/tools/structural-analysis.js.map +1 -0
- package/dist/src/tools/stubs.d.ts +10 -0
- package/dist/src/tools/stubs.js +6 -0
- package/dist/src/tools/stubs.js.map +1 -0
- package/dist/src/tools/task.d.ts +41 -0
- package/dist/src/tools/task.js +195 -0
- package/dist/src/tools/task.js.map +1 -0
- package/dist/src/tools/todo-events.d.ts +22 -0
- package/dist/src/tools/todo-events.js +24 -0
- package/dist/src/tools/todo-events.js.map +1 -0
- package/dist/src/tools/todo-pause.d.ts +29 -0
- package/dist/src/tools/todo-pause.js +172 -0
- package/dist/src/tools/todo-pause.js.map +1 -0
- package/dist/src/tools/todo-read.d.ts +18 -0
- package/dist/src/tools/todo-read.js +98 -0
- package/dist/src/tools/todo-read.js.map +1 -0
- package/dist/src/tools/todo-store.d.ts +35 -0
- package/dist/src/tools/todo-store.js +124 -0
- package/dist/src/tools/todo-store.js.map +1 -0
- package/dist/src/tools/todo-write.d.ts +29 -0
- package/dist/src/tools/todo-write.js +366 -0
- package/dist/src/tools/todo-write.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +156 -0
- package/dist/src/tools/tool-registry.js +623 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/tools/tools.d.ts +403 -0
- package/dist/src/tools/tools.js +519 -0
- package/dist/src/tools/tools.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +45 -0
- package/dist/src/tools/write-file.js +320 -0
- package/dist/src/tools/write-file.js.map +1 -0
- package/dist/src/types/index.d.ts +17 -0
- package/dist/src/types/index.js +9 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/provider-content-types.d.ts +56 -0
- package/dist/src/types/provider-content-types.js +6 -0
- package/dist/src/types/provider-content-types.js.map +1 -0
- package/dist/src/types/todo-schemas.d.ts +263 -0
- package/dist/src/types/todo-schemas.js +32 -0
- package/dist/src/types/todo-schemas.js.map +1 -0
- package/dist/src/types/tool-confirmation-types.d.ts +34 -0
- package/dist/src/types/tool-confirmation-types.js +29 -0
- package/dist/src/types/tool-confirmation-types.js.map +1 -0
- package/dist/src/types/tool-context.d.ts +31 -0
- package/dist/src/types/tool-context.js +6 -0
- package/dist/src/types/tool-context.js.map +1 -0
- package/dist/src/types/tool-error.d.ts +69 -0
- package/dist/src/types/tool-error.js +94 -0
- package/dist/src/types/tool-error.js.map +1 -0
- package/dist/src/types/tool-names.d.ts +57 -0
- package/dist/src/types/tool-names.js +64 -0
- package/dist/src/types/tool-names.js.map +1 -0
- package/dist/src/utils/EmojiFilter.d.ts +134 -0
- package/dist/src/utils/EmojiFilter.js +370 -0
- package/dist/src/utils/EmojiFilter.js.map +1 -0
- package/dist/src/utils/ast-grep-utils.d.ts +42 -0
- package/dist/src/utils/ast-grep-utils.js +140 -0
- package/dist/src/utils/ast-grep-utils.js.map +1 -0
- package/dist/src/utils/debugLogger.d.ts +11 -0
- package/dist/src/utils/debugLogger.js +16 -0
- package/dist/src/utils/debugLogger.js.map +1 -0
- package/dist/src/utils/diffOptions.d.ts +14 -0
- package/dist/src/utils/diffOptions.js +46 -0
- package/dist/src/utils/diffOptions.js.map +1 -0
- package/dist/src/utils/editor.d.ts +39 -0
- package/dist/src/utils/editor.js +212 -0
- package/dist/src/utils/editor.js.map +1 -0
- package/dist/src/utils/ensure-dirs.d.ts +10 -0
- package/dist/src/utils/ensure-dirs.js +16 -0
- package/dist/src/utils/ensure-dirs.js.map +1 -0
- package/dist/src/utils/errors.d.ts +59 -0
- package/dist/src/utils/errors.js +178 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +11 -0
- package/dist/src/utils/fetch.js +74 -0
- package/dist/src/utils/fetch.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +32 -0
- package/dist/src/utils/fileUtils.js +363 -0
- package/dist/src/utils/fileUtils.js.map +1 -0
- package/dist/src/utils/fuzzy-replacer.d.ts +61 -0
- package/dist/src/utils/fuzzy-replacer.js +492 -0
- package/dist/src/utils/fuzzy-replacer.js.map +1 -0
- package/dist/src/utils/gitLineChanges.d.ts +12 -0
- package/dist/src/utils/gitLineChanges.js +171 -0
- package/dist/src/utils/gitLineChanges.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +6 -0
- package/dist/src/utils/gitUtils.js +31 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/lsp-diagnostics-helper.d.ts +27 -0
- package/dist/src/utils/lsp-diagnostics-helper.js +62 -0
- package/dist/src/utils/lsp-diagnostics-helper.js.map +1 -0
- package/dist/src/utils/mediaUtils.d.ts +38 -0
- package/dist/src/utils/mediaUtils.js +22 -0
- package/dist/src/utils/mediaUtils.js.map +1 -0
- package/dist/src/utils/pathValidation.d.ts +7 -0
- package/dist/src/utils/pathValidation.js +39 -0
- package/dist/src/utils/pathValidation.js.map +1 -0
- package/dist/src/utils/paths.d.ts +7 -0
- package/dist/src/utils/paths.js +158 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/resolveTextSearchTarget.d.ts +17 -0
- package/dist/src/utils/resolveTextSearchTarget.js +45 -0
- package/dist/src/utils/resolveTextSearchTarget.js.map +1 -0
- package/dist/src/utils/retry.d.ts +17 -0
- package/dist/src/utils/retry.js +185 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/ripgrepPathResolver.d.ts +23 -0
- package/dist/src/utils/ripgrepPathResolver.js +179 -0
- package/dist/src/utils/ripgrepPathResolver.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.d.ts +9 -0
- package/dist/src/utils/safeJsonStringify.js +21 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -0
- package/dist/src/utils/schemaValidator.d.ts +13 -0
- package/dist/src/utils/schemaValidator.js +275 -0
- package/dist/src/utils/schemaValidator.js.map +1 -0
- package/dist/src/utils/terminalSerializer.d.ts +33 -0
- package/dist/src/utils/terminalSerializer.js +6 -0
- package/dist/src/utils/terminalSerializer.js.map +1 -0
- package/dist/src/utils/todoContextTracker.d.ts +12 -0
- package/dist/src/utils/todoContextTracker.js +28 -0
- package/dist/src/utils/todoContextTracker.js.map +1 -0
- package/dist/src/utils/todoFormatter.d.ts +24 -0
- package/dist/src/utils/todoFormatter.js +157 -0
- package/dist/src/utils/todoFormatter.js.map +1 -0
- package/dist/src/utils/todoReminderService.d.ts +22 -0
- package/dist/src/utils/todoReminderService.js +43 -0
- package/dist/src/utils/todoReminderService.js.map +1 -0
- package/dist/src/utils/tool-key-storage-facade.d.ts +32 -0
- package/dist/src/utils/tool-key-storage-facade.js +56 -0
- package/dist/src/utils/tool-key-storage-facade.js.map +1 -0
- package/dist/src/utils/tool-key-storage-types.d.ts +56 -0
- package/dist/src/utils/tool-key-storage-types.js +56 -0
- package/dist/src/utils/tool-key-storage-types.js.map +1 -0
- package/dist/src/utils/toolOutputLimiter.d.ts +29 -0
- package/dist/src/utils/toolOutputLimiter.js +107 -0
- package/dist/src/utils/toolOutputLimiter.js.map +1 -0
- package/dist/src/utils/unicodeUtils.d.ts +55 -0
- package/dist/src/utils/unicodeUtils.js +129 -0
- package/dist/src/utils/unicodeUtils.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable complexity, sonarjs/cognitive-complexity -- Phase 5: legacy core boundary retained while larger decomposition continues. */
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { BaseDeclarativeTool, BaseToolInvocation, Kind, } from './tools.js';
|
|
9
|
+
import { makeRelative, shortenPath } from '../utils/paths.js';
|
|
10
|
+
import { processSingleFileContent, getSpecificMimeType, } from '../utils/fileUtils.js';
|
|
11
|
+
import { validatePathWithinWorkspace } from '../utils/pathValidation.js';
|
|
12
|
+
import { getGitLineChanges } from '../utils/gitLineChanges.js';
|
|
13
|
+
function formatWithLineNumbers(content, startLine) {
|
|
14
|
+
const lines = content.split('\n');
|
|
15
|
+
const maxLine = startLine + lines.length - 1;
|
|
16
|
+
const width = Math.max(4, String(maxLine).length);
|
|
17
|
+
return lines
|
|
18
|
+
.map((line, index) => {
|
|
19
|
+
const lineNo = startLine + index;
|
|
20
|
+
const padded = String(lineNo).padStart(width, ' ');
|
|
21
|
+
return `${padded}| ${line}`;
|
|
22
|
+
})
|
|
23
|
+
.join('\n');
|
|
24
|
+
}
|
|
25
|
+
function formatWithGitChanges(content, startLine, markers, deletionAfterLines, showLineNumbers) {
|
|
26
|
+
const lines = content.split('\n');
|
|
27
|
+
const maxLine = startLine + lines.length - 1;
|
|
28
|
+
const width = showLineNumbers ? Math.max(4, String(maxLine).length) : 0;
|
|
29
|
+
const formattedLines = [];
|
|
30
|
+
const hasDeletionBeforeRange = deletionAfterLines.has(startLine - 1) ||
|
|
31
|
+
deletionAfterLines.has(startLine) ||
|
|
32
|
+
(startLine === 1 && deletionAfterLines.has(0));
|
|
33
|
+
if (hasDeletionBeforeRange) {
|
|
34
|
+
if (showLineNumbers) {
|
|
35
|
+
const padded = ''.padStart(width, ' ');
|
|
36
|
+
formattedLines.push(`D${padded}|`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
formattedLines.push('D');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
formattedLines.push(...lines.map((line, index) => {
|
|
43
|
+
const lineNo = startLine + index;
|
|
44
|
+
const baseMarker = markers.get(lineNo) ?? '░';
|
|
45
|
+
const marker = deletionAfterLines.has(lineNo) ? 'D' : baseMarker;
|
|
46
|
+
if (showLineNumbers) {
|
|
47
|
+
const padded = String(lineNo).padStart(width, ' ');
|
|
48
|
+
return `${marker}${padded}| ${line}`;
|
|
49
|
+
}
|
|
50
|
+
return `${marker}${line}`;
|
|
51
|
+
}));
|
|
52
|
+
return formattedLines.join('\n');
|
|
53
|
+
}
|
|
54
|
+
class ReadLineRangeToolInvocation extends BaseToolInvocation {
|
|
55
|
+
host;
|
|
56
|
+
constructor(host, params, messageBus) {
|
|
57
|
+
super(params, messageBus);
|
|
58
|
+
this.host = host;
|
|
59
|
+
}
|
|
60
|
+
getDescription() {
|
|
61
|
+
const relativePath = makeRelative(this.params.absolute_path, this.host.getTargetDir());
|
|
62
|
+
return shortenPath(relativePath);
|
|
63
|
+
}
|
|
64
|
+
toolLocations() {
|
|
65
|
+
return [{ path: this.params.absolute_path, line: this.params.start_line }];
|
|
66
|
+
}
|
|
67
|
+
async fetchGitAnnotations(filePath) {
|
|
68
|
+
const gitResult = await getGitLineChanges(filePath);
|
|
69
|
+
return {
|
|
70
|
+
gitWarning: gitResult.warning,
|
|
71
|
+
markersByLine: gitResult.markersByLine,
|
|
72
|
+
deletionAfterLines: gitResult.deletionAfterLines,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
applyTextFormatting(content, startLine, markersByLine, deletionAfterLines) {
|
|
76
|
+
if (this.params.showGitChanges === true &&
|
|
77
|
+
markersByLine &&
|
|
78
|
+
deletionAfterLines) {
|
|
79
|
+
return formatWithGitChanges(content, startLine, markersByLine, deletionAfterLines, this.params.showLineNumbers === true);
|
|
80
|
+
}
|
|
81
|
+
if (this.params.showLineNumbers === true) {
|
|
82
|
+
return formatWithLineNumbers(content, startLine);
|
|
83
|
+
}
|
|
84
|
+
return content;
|
|
85
|
+
}
|
|
86
|
+
prependGitHeader(llmContent, gitWarning) {
|
|
87
|
+
if (this.params.showGitChanges !== true) {
|
|
88
|
+
return llmContent;
|
|
89
|
+
}
|
|
90
|
+
const headerParts = [];
|
|
91
|
+
if (gitWarning) {
|
|
92
|
+
headerParts.push(`NOTE: Failed to read git change status: ${gitWarning}`);
|
|
93
|
+
}
|
|
94
|
+
headerParts.push('Git changes legend: ░ unchanged, N new, M modified, D deletion after line.');
|
|
95
|
+
return `${headerParts.join('\n')}\n\n${llmContent}`;
|
|
96
|
+
}
|
|
97
|
+
buildTruncatedLlmContent(result, gitWarning, markersByLine, deletionAfterLines) {
|
|
98
|
+
const [start, end] = result.linesShown;
|
|
99
|
+
const total = result.originalLineCount;
|
|
100
|
+
const formattedContent = this.applyTextFormatting(result.llmContent, this.params.start_line, markersByLine, deletionAfterLines);
|
|
101
|
+
const gitLegend = this.params.showGitChanges === true
|
|
102
|
+
? `\nGit changes legend: ░ unchanged, N new, M modified, D deletion after line.\n`
|
|
103
|
+
: '';
|
|
104
|
+
const gitWarningText = this.params.showGitChanges === true && gitWarning !== undefined
|
|
105
|
+
? `\nNOTE: Failed to read git change status: ${gitWarning}\n`
|
|
106
|
+
: '';
|
|
107
|
+
return `\nIMPORTANT: The file content has been truncated.${gitWarningText}${gitLegend}\nStatus: Showing lines ${start}-${end} of ${total} total lines.\nAction: To read more of the file, you can use the 'read_line_range' tool with adjusted 'start_line' and 'end_line' parameters.\n\n--- FILE CONTENT (truncated) ---\n${formattedContent}`;
|
|
108
|
+
}
|
|
109
|
+
buildFullLlmContent(result, gitWarning, markersByLine, deletionAfterLines) {
|
|
110
|
+
const formatted = this.applyTextFormatting(result.llmContent, this.params.start_line, markersByLine, deletionAfterLines);
|
|
111
|
+
return this.prependGitHeader(formatted, gitWarning);
|
|
112
|
+
}
|
|
113
|
+
recordReadMetric(llmContent, filePath) {
|
|
114
|
+
const lines = typeof llmContent === 'string'
|
|
115
|
+
? llmContent.split('\n').length
|
|
116
|
+
: undefined;
|
|
117
|
+
const mimetype = getSpecificMimeType(filePath);
|
|
118
|
+
void lines;
|
|
119
|
+
void mimetype;
|
|
120
|
+
void filePath;
|
|
121
|
+
}
|
|
122
|
+
async execute() {
|
|
123
|
+
const offset = this.params.start_line - 1;
|
|
124
|
+
const limit = this.params.end_line - this.params.start_line + 1;
|
|
125
|
+
const result = await processSingleFileContent(this.params.absolute_path, this.host.getTargetDir(), offset, limit);
|
|
126
|
+
if (result.error) {
|
|
127
|
+
return {
|
|
128
|
+
llmContent: result.llmContent,
|
|
129
|
+
returnDisplay: result.returnDisplay || 'Error reading file',
|
|
130
|
+
error: { message: result.error, type: result.errorType },
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
let gitWarning;
|
|
134
|
+
let markersByLine;
|
|
135
|
+
let deletionAfterLines;
|
|
136
|
+
const shouldAnnotateGit = this.params.showGitChanges === true &&
|
|
137
|
+
typeof result.llmContent === 'string';
|
|
138
|
+
if (shouldAnnotateGit) {
|
|
139
|
+
({ gitWarning, markersByLine, deletionAfterLines } =
|
|
140
|
+
await this.fetchGitAnnotations(this.params.absolute_path));
|
|
141
|
+
}
|
|
142
|
+
let llmContent;
|
|
143
|
+
if (typeof result.llmContent !== 'string') {
|
|
144
|
+
llmContent = result.llmContent;
|
|
145
|
+
}
|
|
146
|
+
else if (result.isTruncated === true) {
|
|
147
|
+
llmContent = this.buildTruncatedLlmContent(result, gitWarning, markersByLine, deletionAfterLines);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
llmContent = this.buildFullLlmContent(result, gitWarning, markersByLine, deletionAfterLines);
|
|
151
|
+
}
|
|
152
|
+
this.recordReadMetric(result.llmContent, this.params.absolute_path);
|
|
153
|
+
return {
|
|
154
|
+
llmContent,
|
|
155
|
+
returnDisplay: result.returnDisplay || '',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Implementation of the ReadLineRange tool logic
|
|
161
|
+
*/
|
|
162
|
+
export class ReadLineRangeTool extends BaseDeclarativeTool {
|
|
163
|
+
host;
|
|
164
|
+
static Name = 'read_line_range';
|
|
165
|
+
constructor(host) {
|
|
166
|
+
super(ReadLineRangeTool.Name, 'ReadLineRange', `Reads a specific range of lines from a file. This is very useful for "copying" a function or class after finding its definition. The 'start_line' and 'end_line' parameters are 1-based and inclusive.
|
|
167
|
+
|
|
168
|
+
Optional: when 'showGitChanges' is true, prefixes each returned text line with a single-character git-change marker column and includes a legend.
|
|
169
|
+
Legend: '░' unchanged, 'N' new, 'M' modified, 'D' deletion after line.
|
|
170
|
+
Column order: git marker first, then (optional) virtual line number column, then line content.
|
|
171
|
+
The git marker column is virtual and not part of the file content.
|
|
172
|
+
If git status cannot be read, the tool will still return file content and include a brief warning.`, Kind.Read, {
|
|
173
|
+
properties: {
|
|
174
|
+
absolute_path: {
|
|
175
|
+
description: "The absolute path to the file to read (e.g., '/home/user/project/file.txt'). Relative paths are not supported. You must provide an absolute path.",
|
|
176
|
+
type: 'string',
|
|
177
|
+
},
|
|
178
|
+
file_path: {
|
|
179
|
+
description: 'Alternative parameter name for absolute_path (for backward compatibility). The absolute path to the file to read.',
|
|
180
|
+
type: 'string',
|
|
181
|
+
},
|
|
182
|
+
start_line: {
|
|
183
|
+
description: 'The 1-based line number to start reading from (inclusive).',
|
|
184
|
+
type: 'number',
|
|
185
|
+
minimum: 1,
|
|
186
|
+
},
|
|
187
|
+
end_line: {
|
|
188
|
+
description: 'The 1-based line number to end reading at (inclusive). Must be >= start_line.',
|
|
189
|
+
type: 'number',
|
|
190
|
+
minimum: 1,
|
|
191
|
+
},
|
|
192
|
+
showLineNumbers: {
|
|
193
|
+
description: 'Optional: When true, prefixes each returned line with its 1-based virtual line number and a separator bar (for example, " 294| const x = 1;"). This numbering is not part of the underlying file; it is only a visual aid. Recommended when you need to precisely understand line numbers in large files for follow-up editing operations.',
|
|
194
|
+
type: 'boolean',
|
|
195
|
+
},
|
|
196
|
+
showGitChanges: {
|
|
197
|
+
description: "Optional: When true (text files only), prefixes each returned line with a single-character git-change marker column computed relative to HEAD (includes both staged and unstaged changes). This marker column is virtual and not part of the file content. Legend: '░' unchanged, 'N' new, 'M' modified, 'D' deletion after line. Column order: git marker first, then (optional) the virtual line number column, then line content. If git status cannot be read, content is still returned and a brief warning is included.",
|
|
198
|
+
type: 'boolean',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
required: ['start_line', 'end_line'],
|
|
202
|
+
type: 'object',
|
|
203
|
+
});
|
|
204
|
+
this.host = host;
|
|
205
|
+
}
|
|
206
|
+
validateToolParamValues(params) {
|
|
207
|
+
const filePath = params.absolute_path || params.file_path || '';
|
|
208
|
+
if (filePath.trim() === '') {
|
|
209
|
+
return "Either 'absolute_path' or 'file_path' parameter must be provided and non-empty.";
|
|
210
|
+
}
|
|
211
|
+
if (!path.isAbsolute(filePath)) {
|
|
212
|
+
return `File path must be absolute: ${filePath}`;
|
|
213
|
+
}
|
|
214
|
+
const pathError = validatePathWithinWorkspace(this.host.getWorkspaceRoots(), filePath);
|
|
215
|
+
if (pathError) {
|
|
216
|
+
return pathError;
|
|
217
|
+
}
|
|
218
|
+
if (params.start_line < 1) {
|
|
219
|
+
return 'start_line must be a positive integer (>= 1)';
|
|
220
|
+
}
|
|
221
|
+
if (params.end_line < 1) {
|
|
222
|
+
return 'end_line must be a positive integer (>= 1)';
|
|
223
|
+
}
|
|
224
|
+
if (params.end_line < params.start_line) {
|
|
225
|
+
return 'end_line must be greater than or equal to start_line';
|
|
226
|
+
}
|
|
227
|
+
const fileService = this.host.getFileService();
|
|
228
|
+
if (fileService.shouldLlxprtIgnoreFile(filePath)) {
|
|
229
|
+
return `File path '${filePath}' is ignored by .llxprtignore pattern(s).`;
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
createInvocation(params, messageBus) {
|
|
234
|
+
const normalizedParams = { ...params };
|
|
235
|
+
if (!normalizedParams.absolute_path && normalizedParams.file_path) {
|
|
236
|
+
normalizedParams.absolute_path = normalizedParams.file_path;
|
|
237
|
+
}
|
|
238
|
+
return new ReadLineRangeToolInvocation(this.host, normalizedParams, messageBus);
|
|
239
|
+
}
|
|
240
|
+
async execute(params, signal = new AbortController().signal) {
|
|
241
|
+
const result = await this.build(params).execute(signal);
|
|
242
|
+
if (typeof result.llmContent === 'string') {
|
|
243
|
+
return { ...result, returnDisplay: result.llmContent };
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=read_line_range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_line_range.js","sourceRoot":"","sources":["../../../src/tools/read_line_range.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6IAA6I;AAE7I,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,GAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAqC/D,SAAS,qBAAqB,CAAC,OAAe,EAAE,SAAiB;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACnB,MAAM,MAAM,G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GAAG,gBAAgB,CAAC,SAAS,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,2BAA2B,CACpC,IAAI,CAAC,IAAI,EACT,gBAAgB,EAChB,UAAU,CACX,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,OAAO,CACX,MAA+B,EAC/B,SAAsB,IAAI,eAAe,EAAE,CAAC,MAAM;QAElD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC1C,OAAO,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QACzD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BaseDeclarativeTool, type ToolInvocation, type ToolResult } from './tools.js';
|
|
7
|
+
import type { IToolHost, IToolMessageBus } from '../interfaces/index.js';
|
|
8
|
+
export declare const ripGrepDebugLogger: {
|
|
9
|
+
error: (..._args: unknown[]) => void;
|
|
10
|
+
warn: (..._args: unknown[]) => void;
|
|
11
|
+
debug: (..._args: unknown[]) => void;
|
|
12
|
+
log: (..._args: unknown[]) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parameters for the GrepTool
|
|
16
|
+
*/
|
|
17
|
+
export interface RipGrepToolParams {
|
|
18
|
+
/**
|
|
19
|
+
* The regular expression pattern to search for in file contents
|
|
20
|
+
*/
|
|
21
|
+
pattern: string;
|
|
22
|
+
/**
|
|
23
|
+
* The directory to search in (optional, defaults to current directory relative to root)
|
|
24
|
+
*/
|
|
25
|
+
path?: string;
|
|
26
|
+
/**
|
|
27
|
+
* File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")
|
|
28
|
+
*/
|
|
29
|
+
include?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Implementation of the Grep tool logic (moved from CLI)
|
|
33
|
+
*/
|
|
34
|
+
export declare class RipGrepTool extends BaseDeclarativeTool<RipGrepToolParams, ToolResult> {
|
|
35
|
+
private readonly host;
|
|
36
|
+
static readonly Name = "search_file_content";
|
|
37
|
+
constructor(host: IToolHost);
|
|
38
|
+
validateToolParams(params: RipGrepToolParams): string | null;
|
|
39
|
+
protected createInvocation(params: RipGrepToolParams, messageBus: IToolMessageBus): ToolInvocation<RipGrepToolParams, ToolResult>;
|
|
40
|
+
execute(params: RipGrepToolParams, signal?: AbortSignal): Promise<ToolResult>;
|
|
41
|
+
}
|