@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,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Diff from 'diff';
|
|
7
|
+
import { BaseDeclarativeTool, type ToolInvocation, type ToolResult } from './tools.js';
|
|
8
|
+
import type { IIdeService, ILspService, IToolHost, IToolMessageBus } from '../interfaces/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Type representing a parsed patch operation
|
|
11
|
+
*/
|
|
12
|
+
export type PatchOperation = Diff.StructuredPatch;
|
|
13
|
+
/**
|
|
14
|
+
* Classifies patch operations to determine which files have content writes.
|
|
15
|
+
* Patches with hunks represent content modifications/creations.
|
|
16
|
+
* Patches without hunks are treated as rename/delete-only operations.
|
|
17
|
+
*
|
|
18
|
+
* @param operations - Array of parsed patch operations
|
|
19
|
+
* @returns Object containing content write file paths and boolean flag
|
|
20
|
+
*/
|
|
21
|
+
export declare function classifyPatchOperations(operations: PatchOperation[]): {
|
|
22
|
+
contentWriteFiles: string[];
|
|
23
|
+
hasAnyContentWrites: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for the ApplyPatch tool
|
|
27
|
+
*/
|
|
28
|
+
export interface ApplyPatchToolParams {
|
|
29
|
+
/**
|
|
30
|
+
* The absolute path to the file to modify
|
|
31
|
+
*/
|
|
32
|
+
absolute_path?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Alternative parameter name for absolute_path (for compatibility)
|
|
35
|
+
* Not shown in schema - internal use only
|
|
36
|
+
*/
|
|
37
|
+
file_path?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The unified diff format patch content to apply
|
|
40
|
+
*/
|
|
41
|
+
patch_content: string;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the edit was modified manually by the user.
|
|
44
|
+
*/
|
|
45
|
+
modified_by_user?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Initially proposed content.
|
|
48
|
+
*/
|
|
49
|
+
ai_proposed_content?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Implementation of the ApplyPatch tool logic
|
|
53
|
+
*/
|
|
54
|
+
export declare class ApplyPatchTool extends BaseDeclarativeTool<ApplyPatchToolParams, ToolResult> {
|
|
55
|
+
private readonly host;
|
|
56
|
+
static readonly Name = "apply_patch";
|
|
57
|
+
private readonly ideService?;
|
|
58
|
+
private readonly lspService?;
|
|
59
|
+
constructor(host?: IToolHost, messageBusOrIdeService?: IToolMessageBus | IIdeService, ideServiceOrLspService?: IIdeService | ILspService, lspService?: ILspService);
|
|
60
|
+
/**
|
|
61
|
+
* Validates the parameters for the ApplyPatch tool
|
|
62
|
+
*/
|
|
63
|
+
protected validateToolParamValues(params: ApplyPatchToolParams): string | null;
|
|
64
|
+
protected createInvocation(params: ApplyPatchToolParams, messageBus: IToolMessageBus): ToolInvocation<ApplyPatchToolParams, ToolResult>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,528 @@
|
|
|
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 tool behavior retained while moving ownership to packages/tools. */
|
|
7
|
+
/* @plan PLAN-20250212-LSP.P31 */
|
|
8
|
+
/* @requirement REQ-DIAG-010, REQ-DIAG-040, REQ-DIAG-070, REQ-GRACE-050, REQ-GRACE-055 */
|
|
9
|
+
import fs from 'node:fs/promises';
|
|
10
|
+
import process from 'node:process';
|
|
11
|
+
import * as Diff from 'diff';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import { BaseDeclarativeTool, BaseToolInvocation, Kind, ToolConfirmationOutcome, } from './tools.js';
|
|
14
|
+
import { ToolErrorType } from '../types/tool-error.js';
|
|
15
|
+
import { makeRelative, shortenPath } from '../utils/paths.js';
|
|
16
|
+
import { DEFAULT_CREATE_PATCH_OPTIONS, getDiffStat, } from '../utils/diffOptions.js';
|
|
17
|
+
import { APPLY_PATCH_TOOL } from '../types/tool-names.js';
|
|
18
|
+
import { collectLspDiagnosticsBlock } from '../utils/lsp-diagnostics-helper.js';
|
|
19
|
+
import { debugLogger } from '../utils/debugLogger.js';
|
|
20
|
+
import { validatePathWithinWorkspace } from '../utils/pathValidation.js';
|
|
21
|
+
function createDefaultToolHost() {
|
|
22
|
+
return {
|
|
23
|
+
getTargetDir: () => process.cwd(),
|
|
24
|
+
getWorkspaceRoots: () => [path.parse(process.cwd()).root],
|
|
25
|
+
getApprovalMode: () => 'auto',
|
|
26
|
+
setApprovalMode: () => { },
|
|
27
|
+
isInteractive: () => false,
|
|
28
|
+
hasFeatureFlag: () => false,
|
|
29
|
+
getFileService: () => ({
|
|
30
|
+
shouldGitIgnoreFile: () => false,
|
|
31
|
+
shouldLlxprtIgnoreFile: () => false,
|
|
32
|
+
filterFiles: (paths) => paths,
|
|
33
|
+
}),
|
|
34
|
+
getFileFilteringOptions: () => ({
|
|
35
|
+
respectGitIgnore: true,
|
|
36
|
+
respectLlxprtIgnore: true,
|
|
37
|
+
}),
|
|
38
|
+
getFileExclusions: () => [],
|
|
39
|
+
getReadManyFilesExclusions: () => [],
|
|
40
|
+
getFileFilteringRespectLlxprtIgnore: () => true,
|
|
41
|
+
getLlxprtIgnoreFilePath: () => null,
|
|
42
|
+
recordFileRead: () => { },
|
|
43
|
+
getLlxprtIgnorePatterns: () => [],
|
|
44
|
+
getEphemeralSettings: () => ({}),
|
|
45
|
+
getDebugMode: () => false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getTargetDirCompat(host) {
|
|
49
|
+
return host.getTargetDir?.() ?? process.cwd();
|
|
50
|
+
}
|
|
51
|
+
function getWorkspaceRootsCompat(host) {
|
|
52
|
+
const maybeHost = host;
|
|
53
|
+
return (maybeHost.getWorkspaceContext?.().getDirectories?.() ??
|
|
54
|
+
maybeHost.getWorkspaceRoots?.() ?? [
|
|
55
|
+
maybeHost.getTargetDir?.() ?? process.cwd(),
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
function toIdeConnectionStatus(status) {
|
|
59
|
+
if (typeof status === 'string') {
|
|
60
|
+
return status === 'connected' || status === 'connecting'
|
|
61
|
+
? status
|
|
62
|
+
: 'disconnected';
|
|
63
|
+
}
|
|
64
|
+
if (typeof status === 'object' && status !== null && 'status' in status) {
|
|
65
|
+
return toIdeConnectionStatus(status.status);
|
|
66
|
+
}
|
|
67
|
+
return 'disconnected';
|
|
68
|
+
}
|
|
69
|
+
function hasMessageBusShape(value) {
|
|
70
|
+
return (typeof value === 'object' &&
|
|
71
|
+
value !== null &&
|
|
72
|
+
('requestConfirmation' in value ||
|
|
73
|
+
'publishPolicyUpdate' in value ||
|
|
74
|
+
'publish' in value ||
|
|
75
|
+
'subscribe' in value));
|
|
76
|
+
}
|
|
77
|
+
function hasIdeServiceShape(value) {
|
|
78
|
+
return (typeof value === 'object' &&
|
|
79
|
+
value !== null &&
|
|
80
|
+
('applyDiff' in value ||
|
|
81
|
+
'openDiff' in value ||
|
|
82
|
+
'getConnectionStatus' in value));
|
|
83
|
+
}
|
|
84
|
+
function hasLspServiceShape(value) {
|
|
85
|
+
return (typeof value === 'object' &&
|
|
86
|
+
value !== null &&
|
|
87
|
+
('waitForDiagnostics' in value ||
|
|
88
|
+
'getDiagnostics' in value ||
|
|
89
|
+
'getLspConfig' in value));
|
|
90
|
+
}
|
|
91
|
+
function getLegacyIdeService(host) {
|
|
92
|
+
const maybeHost = host;
|
|
93
|
+
if (typeof maybeHost.getIdeMode !== 'function' ||
|
|
94
|
+
typeof maybeHost.getIdeClient !== 'function') {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const getLegacyIdeClient = () => {
|
|
98
|
+
if (maybeHost.getIdeMode?.() !== true) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const ideClient = maybeHost.getIdeClient?.();
|
|
102
|
+
if (typeof ideClient !== 'object' ||
|
|
103
|
+
ideClient === null ||
|
|
104
|
+
!('openDiff' in ideClient)) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return ideClient;
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
applyDiff: async ({ filePath, diff }) => {
|
|
111
|
+
const legacyIdeClient = getLegacyIdeClient();
|
|
112
|
+
if (legacyIdeClient?.openDiff === undefined) {
|
|
113
|
+
return { status: 'rejected', content: undefined };
|
|
114
|
+
}
|
|
115
|
+
const result = await legacyIdeClient.openDiff(filePath, diff);
|
|
116
|
+
return result.status === 'accepted'
|
|
117
|
+
? { status: 'accepted', content: result.content }
|
|
118
|
+
: { status: 'rejected', content: undefined };
|
|
119
|
+
},
|
|
120
|
+
getConnectionStatus: () => toIdeConnectionStatus(getLegacyIdeClient()?.getConnectionStatus?.()),
|
|
121
|
+
openDiff: async ({ filePath, newContent }) => {
|
|
122
|
+
await getLegacyIdeClient()?.openDiff?.(filePath, newContent);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function getLegacyLspService(host) {
|
|
127
|
+
const maybeHost = host;
|
|
128
|
+
const lspClient = maybeHost.getLspServiceClient?.();
|
|
129
|
+
if (typeof lspClient !== 'object' || lspClient === null) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
getDiagnostics: () => [],
|
|
134
|
+
waitForDiagnostics: async (filePath, _timeout) => {
|
|
135
|
+
const isAlive = lspClient.isAlive?.();
|
|
136
|
+
if (isAlive !== true) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
const checkFile = lspClient.checkFile;
|
|
140
|
+
if (typeof checkFile !== 'function') {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
const diagnostics = await checkFile.call(lspClient, filePath);
|
|
144
|
+
return Array.isArray(diagnostics) ? diagnostics : [];
|
|
145
|
+
},
|
|
146
|
+
getLspConfig: () => maybeHost.getLspConfig?.(),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function isNodeError(err) {
|
|
150
|
+
return err instanceof Error && 'code' in err;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Classifies patch operations to determine which files have content writes.
|
|
154
|
+
* Patches with hunks represent content modifications/creations.
|
|
155
|
+
* Patches without hunks are treated as rename/delete-only operations.
|
|
156
|
+
*
|
|
157
|
+
* @param operations - Array of parsed patch operations
|
|
158
|
+
* @returns Object containing content write file paths and boolean flag
|
|
159
|
+
*/
|
|
160
|
+
export function classifyPatchOperations(operations) {
|
|
161
|
+
const contentWriteFiles = [];
|
|
162
|
+
for (const op of operations) {
|
|
163
|
+
// Patches with hunks represent content changes
|
|
164
|
+
if (op.hunks.length > 0) {
|
|
165
|
+
// Use newFileName as the target file
|
|
166
|
+
contentWriteFiles.push(op.newFileName);
|
|
167
|
+
}
|
|
168
|
+
// Patches with no hunks are rename/delete-only - no content write
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
contentWriteFiles,
|
|
172
|
+
hasAnyContentWrites: contentWriteFiles.length > 0,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
class ApplyPatchToolInvocation extends BaseToolInvocation {
|
|
176
|
+
host;
|
|
177
|
+
ideService;
|
|
178
|
+
lspService;
|
|
179
|
+
constructor(host, ideService, lspService, params, messageBus) {
|
|
180
|
+
super(params, messageBus);
|
|
181
|
+
this.host = host;
|
|
182
|
+
this.ideService = ideService;
|
|
183
|
+
this.lspService = lspService;
|
|
184
|
+
}
|
|
185
|
+
getToolName() {
|
|
186
|
+
return ApplyPatchTool.Name;
|
|
187
|
+
}
|
|
188
|
+
getFilePath() {
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: empty string paths should fall through to next option
|
|
190
|
+
return this.params.absolute_path || this.params.file_path || '';
|
|
191
|
+
}
|
|
192
|
+
toolLocations() {
|
|
193
|
+
return [{ path: this.getFilePath() }];
|
|
194
|
+
}
|
|
195
|
+
getDescription() {
|
|
196
|
+
const filePath = this.getFilePath();
|
|
197
|
+
const relativePath = makeRelative(filePath, getTargetDirCompat(this.host));
|
|
198
|
+
return `Apply patch to ${shortenPath(relativePath)}`;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns confirmation details for this patch operation.
|
|
202
|
+
*/
|
|
203
|
+
getConfirmationDetails() {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Handles the confirmation prompt for the ApplyPatch tool.
|
|
208
|
+
*/
|
|
209
|
+
async shouldConfirmExecute(_abortSignal) {
|
|
210
|
+
const approvalMode = this.host.getApprovalMode();
|
|
211
|
+
if (approvalMode === 'auto' || approvalMode === 'yolo') {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
const filePath = this.getFilePath();
|
|
215
|
+
let currentContent = '';
|
|
216
|
+
try {
|
|
217
|
+
currentContent = await this.readTextFile(filePath);
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
// File doesn't exist yet - will be created
|
|
221
|
+
if (!isNodeError(err) || err.code !== 'ENOENT') {
|
|
222
|
+
throw err;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Parse and apply patch to get preview
|
|
226
|
+
const patches = Diff.parsePatch(this.params.patch_content);
|
|
227
|
+
const newContentResult = Diff.applyPatch(currentContent, patches[0]);
|
|
228
|
+
if (typeof newContentResult !== 'string') {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
const newContent = newContentResult;
|
|
232
|
+
const relativePath = makeRelative(filePath, getTargetDirCompat(this.host));
|
|
233
|
+
const fileName = path.basename(filePath);
|
|
234
|
+
const fileDiffResult = Diff.createPatch(fileName, currentContent, newContent, 'Current', 'Proposed', DEFAULT_CREATE_PATCH_OPTIONS);
|
|
235
|
+
if (!fileDiffResult) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
const fileDiff = fileDiffResult;
|
|
239
|
+
const ideConfirmation = this.ideService !== undefined &&
|
|
240
|
+
toIdeConnectionStatus(this.ideService.getConnectionStatus()) ===
|
|
241
|
+
'connected'
|
|
242
|
+
? this.ideService.applyDiff({ filePath, diff: newContent })
|
|
243
|
+
: undefined;
|
|
244
|
+
const confirmationDetails = {
|
|
245
|
+
type: 'edit',
|
|
246
|
+
title: `Confirm Apply Patch: ${shortenPath(relativePath)}`,
|
|
247
|
+
fileName,
|
|
248
|
+
filePath,
|
|
249
|
+
fileDiff,
|
|
250
|
+
originalContent: currentContent,
|
|
251
|
+
newContent,
|
|
252
|
+
onConfirm: async (outcome) => {
|
|
253
|
+
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
254
|
+
this.host.setApprovalMode('auto');
|
|
255
|
+
}
|
|
256
|
+
if (ideConfirmation) {
|
|
257
|
+
const result = await ideConfirmation;
|
|
258
|
+
if (result.status === 'accepted' && result.content) {
|
|
259
|
+
// User modified content in IDE - we'd need to regenerate patch
|
|
260
|
+
// For now, we don't support this flow for apply_patch
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
ideConfirmation,
|
|
265
|
+
};
|
|
266
|
+
return confirmationDetails;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Executes the apply_patch operation
|
|
270
|
+
*/
|
|
271
|
+
async execute(_signal) {
|
|
272
|
+
const filePath = this.getFilePath();
|
|
273
|
+
// Validate file path is within workspace
|
|
274
|
+
const pathError = validatePathWithinWorkspace(getWorkspaceRootsCompat(this.host), filePath);
|
|
275
|
+
if (pathError) {
|
|
276
|
+
return {
|
|
277
|
+
llmContent: pathError,
|
|
278
|
+
returnDisplay: 'File path is not within workspace',
|
|
279
|
+
error: {
|
|
280
|
+
message: pathError,
|
|
281
|
+
type: ToolErrorType.INVALID_TOOL_PARAMS,
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const { currentContent, fileExists } = await this.readCurrentContent(filePath);
|
|
286
|
+
const patches = this.parsePatchContent();
|
|
287
|
+
if (!Array.isArray(patches))
|
|
288
|
+
return patches;
|
|
289
|
+
const classification = classifyPatchOperations(patches);
|
|
290
|
+
const newContent = this.applyPatch(currentContent, patches);
|
|
291
|
+
if (typeof newContent !== 'string')
|
|
292
|
+
return newContent;
|
|
293
|
+
return this.writeAndFormatResult(filePath, currentContent, newContent, fileExists, classification);
|
|
294
|
+
}
|
|
295
|
+
async readTextFile(filePath) {
|
|
296
|
+
const fileSystemService = this.host.getFileSystemService?.();
|
|
297
|
+
if (fileSystemService !== undefined) {
|
|
298
|
+
return fileSystemService.readTextFile(filePath);
|
|
299
|
+
}
|
|
300
|
+
return fs.readFile(filePath, 'utf8');
|
|
301
|
+
}
|
|
302
|
+
async writeTextFile(filePath, content) {
|
|
303
|
+
const fileSystemService = this.host.getFileSystemService?.();
|
|
304
|
+
if (fileSystemService !== undefined) {
|
|
305
|
+
await fileSystemService.writeTextFile(filePath, content);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
await fs.writeFile(filePath, content, 'utf8');
|
|
309
|
+
}
|
|
310
|
+
async readCurrentContent(filePath) {
|
|
311
|
+
let currentContent = '';
|
|
312
|
+
let fileExists = false;
|
|
313
|
+
try {
|
|
314
|
+
currentContent = await this.readTextFile(filePath);
|
|
315
|
+
currentContent = currentContent.replace(/\r\n/g, '\n');
|
|
316
|
+
fileExists = true;
|
|
317
|
+
}
|
|
318
|
+
catch (err) {
|
|
319
|
+
if (!isNodeError(err) || err.code !== 'ENOENT') {
|
|
320
|
+
throw err;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return { currentContent, fileExists };
|
|
324
|
+
}
|
|
325
|
+
parsePatchContent() {
|
|
326
|
+
try {
|
|
327
|
+
return Diff.parsePatch(this.params.patch_content);
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
331
|
+
return {
|
|
332
|
+
llmContent: `Failed to parse patch: ${errorMsg}`,
|
|
333
|
+
returnDisplay: `Error parsing patch: ${errorMsg}`,
|
|
334
|
+
error: {
|
|
335
|
+
message: `Failed to parse patch: ${errorMsg}`,
|
|
336
|
+
type: ToolErrorType.INVALID_TOOL_PARAMS,
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
applyPatch(currentContent, patches) {
|
|
342
|
+
try {
|
|
343
|
+
const newContentResult = Diff.applyPatch(currentContent, patches[0]);
|
|
344
|
+
if (typeof newContentResult !== 'string') {
|
|
345
|
+
throw new Error('Failed to apply patch: could not apply');
|
|
346
|
+
}
|
|
347
|
+
return newContentResult;
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
351
|
+
return {
|
|
352
|
+
llmContent: `Failed to apply patch: ${errorMsg}`,
|
|
353
|
+
returnDisplay: `Error applying patch: ${errorMsg}`,
|
|
354
|
+
error: {
|
|
355
|
+
message: `Failed to apply patch: ${errorMsg}`,
|
|
356
|
+
type: ToolErrorType.EDIT_NO_CHANGE,
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
async writeAndFormatResult(filePath, currentContent, newContent, fileExists, classification) {
|
|
362
|
+
try {
|
|
363
|
+
await this.writeTextFile(filePath, newContent);
|
|
364
|
+
const gitStats = await this.trackGitStats(filePath, currentContent, newContent);
|
|
365
|
+
const fileName = path.basename(filePath);
|
|
366
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: empty string ai_proposed_content should be preserved, not replaced */
|
|
367
|
+
const originallyProposedContent = this.params.ai_proposed_content || newContent;
|
|
368
|
+
/* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
|
|
369
|
+
const diffStat = getDiffStat(fileName, currentContent, originallyProposedContent, newContent);
|
|
370
|
+
const fileDiff = Diff.createPatch(fileName, currentContent, newContent, 'Current', 'Proposed', DEFAULT_CREATE_PATCH_OPTIONS);
|
|
371
|
+
const displayResult = {
|
|
372
|
+
fileDiff,
|
|
373
|
+
fileName,
|
|
374
|
+
originalContent: currentContent,
|
|
375
|
+
newContent,
|
|
376
|
+
diffStat,
|
|
377
|
+
};
|
|
378
|
+
const llmSuccessMessageParts = [
|
|
379
|
+
fileExists
|
|
380
|
+
? `Successfully applied patch to file: ${filePath}.`
|
|
381
|
+
: `Successfully created file from patch: ${filePath}.`,
|
|
382
|
+
];
|
|
383
|
+
if (this.params.modified_by_user === true) {
|
|
384
|
+
llmSuccessMessageParts.push(`User modified the patch content.`);
|
|
385
|
+
}
|
|
386
|
+
await this.appendLspDiagnostics(filePath, classification, llmSuccessMessageParts);
|
|
387
|
+
const result = {
|
|
388
|
+
llmContent: llmSuccessMessageParts.join('\n\n'),
|
|
389
|
+
returnDisplay: displayResult,
|
|
390
|
+
};
|
|
391
|
+
if (gitStats !== null) {
|
|
392
|
+
result.metadata = { ...result.metadata, gitStats };
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
398
|
+
return {
|
|
399
|
+
llmContent: `Error writing file: ${errorMsg}`,
|
|
400
|
+
returnDisplay: `Error writing file: ${errorMsg}`,
|
|
401
|
+
error: {
|
|
402
|
+
message: errorMsg,
|
|
403
|
+
type: ToolErrorType.FILE_WRITE_FAILURE,
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
async trackGitStats(filePath, currentContent, newContent) {
|
|
409
|
+
if (this.host.getConversationLoggingEnabled?.() !== true)
|
|
410
|
+
return null;
|
|
411
|
+
const gitStatsService = this.host.getGitStatsService?.();
|
|
412
|
+
if (!gitStatsService)
|
|
413
|
+
return null;
|
|
414
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
415
|
+
try {
|
|
416
|
+
return await gitStatsService.trackFileEdit(filePath, currentContent, newContent);
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
debugLogger.warn('Failed to track git stats:', error);
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
// @plan PLAN-20250212-LSP.P31
|
|
424
|
+
// @requirement REQ-DIAG-010
|
|
425
|
+
async appendLspDiagnostics(filePath, classification, llmParts) {
|
|
426
|
+
try {
|
|
427
|
+
if (this.lspService !== undefined) {
|
|
428
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
429
|
+
for (const contentFile of classification.contentWriteFiles) {
|
|
430
|
+
const absoluteFilePath = path.resolve(getTargetDirCompat(this.host), contentFile);
|
|
431
|
+
await this.lspService.waitForDiagnostics(absoluteFilePath, 5000);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
const diagBlock = this.lspService === undefined
|
|
435
|
+
? null
|
|
436
|
+
: await collectLspDiagnosticsBlock(this.lspService, this.host, filePath);
|
|
437
|
+
if (diagBlock) {
|
|
438
|
+
llmParts.push(diagBlock);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
catch {
|
|
442
|
+
// LSP failure must never fail the patch (REQ-GRACE-050, REQ-GRACE-055)
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Implementation of the ApplyPatch tool logic
|
|
448
|
+
*/
|
|
449
|
+
export class ApplyPatchTool extends BaseDeclarativeTool {
|
|
450
|
+
host;
|
|
451
|
+
static Name = APPLY_PATCH_TOOL;
|
|
452
|
+
ideService;
|
|
453
|
+
lspService;
|
|
454
|
+
constructor(host = createDefaultToolHost(), messageBusOrIdeService, ideServiceOrLspService, lspService) {
|
|
455
|
+
const secondArgumentIsMessageBus = hasMessageBusShape(messageBusOrIdeService);
|
|
456
|
+
const explicitIdeService = secondArgumentIsMessageBus
|
|
457
|
+
? ideServiceOrLspService
|
|
458
|
+
: messageBusOrIdeService;
|
|
459
|
+
const ideService = hasIdeServiceShape(explicitIdeService)
|
|
460
|
+
? explicitIdeService
|
|
461
|
+
: getLegacyIdeService(host);
|
|
462
|
+
const messageBus = secondArgumentIsMessageBus
|
|
463
|
+
? messageBusOrIdeService
|
|
464
|
+
: undefined;
|
|
465
|
+
const explicitLspService = secondArgumentIsMessageBus
|
|
466
|
+
? lspService
|
|
467
|
+
: ideServiceOrLspService;
|
|
468
|
+
const resolvedLspService = hasLspServiceShape(explicitLspService)
|
|
469
|
+
? explicitLspService
|
|
470
|
+
: getLegacyLspService(host);
|
|
471
|
+
super(ApplyPatchTool.Name, 'ApplyPatch', `Applies a unified diff format patch to a file. This tool parses the patch content and applies it to the target file.
|
|
472
|
+
|
|
473
|
+
The patch_content parameter should contain a valid unified diff patch. The tool will parse, validate, and apply the patch, returning the result.`, Kind.Edit, {
|
|
474
|
+
properties: {
|
|
475
|
+
absolute_path: {
|
|
476
|
+
description: process.platform === 'win32'
|
|
477
|
+
? "The absolute path to the file to modify (e.g., 'C:\\Users\\project\\file.txt'). Must be an absolute path."
|
|
478
|
+
: "The absolute path to the file to modify (e.g., '/home/user/project/file.txt'). Must start with '/'.",
|
|
479
|
+
type: 'string',
|
|
480
|
+
},
|
|
481
|
+
file_path: {
|
|
482
|
+
description: 'Alternative parameter name for absolute_path (for backward compatibility). The absolute path to the file to modify.',
|
|
483
|
+
type: 'string',
|
|
484
|
+
},
|
|
485
|
+
patch_content: {
|
|
486
|
+
description: 'The unified diff format patch content to apply to the file.',
|
|
487
|
+
type: 'string',
|
|
488
|
+
},
|
|
489
|
+
},
|
|
490
|
+
required: ['patch_content'],
|
|
491
|
+
type: 'object',
|
|
492
|
+
}, true, false, messageBus);
|
|
493
|
+
this.host = host;
|
|
494
|
+
this.ideService = ideService;
|
|
495
|
+
this.lspService = resolvedLspService;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Validates the parameters for the ApplyPatch tool
|
|
499
|
+
*/
|
|
500
|
+
validateToolParamValues(params) {
|
|
501
|
+
// Accept either absolute_path or file_path
|
|
502
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: empty string paths should fall through to next option
|
|
503
|
+
const filePath = params.absolute_path || params.file_path || '';
|
|
504
|
+
if (filePath.trim() === '') {
|
|
505
|
+
return "Either 'absolute_path' or 'file_path' parameter must be provided and non-empty.";
|
|
506
|
+
}
|
|
507
|
+
if (!path.isAbsolute(filePath)) {
|
|
508
|
+
return `File path must be absolute: ${filePath}`;
|
|
509
|
+
}
|
|
510
|
+
const pathError = validatePathWithinWorkspace(getWorkspaceRootsCompat(this.host), filePath);
|
|
511
|
+
if (pathError) {
|
|
512
|
+
return pathError;
|
|
513
|
+
}
|
|
514
|
+
if (!params.patch_content || params.patch_content.trim() === '') {
|
|
515
|
+
return 'patch_content parameter must be provided and non-empty.';
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
createInvocation(params, messageBus) {
|
|
520
|
+
// Normalize parameters: if file_path is provided but not absolute_path, copy it over
|
|
521
|
+
const normalizedParams = { ...params };
|
|
522
|
+
if (!normalizedParams.absolute_path && normalizedParams.file_path) {
|
|
523
|
+
normalizedParams.absolute_path = normalizedParams.file_path;
|
|
524
|
+
}
|
|
525
|
+
return new ApplyPatchToolInvocation(this.host, this.ideService, this.lspService, normalizedParams, messageBus);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
//# sourceMappingURL=apply-patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-patch.js","sourceRoot":"","sources":["../../../src/tools/apply-patch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iJAAiJ;AAEjJ,iCAAiC;AACjC,yFAAyF;AAEzF,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,M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