@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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @plan:PLAN-20260608-ISSUE1585.P05
|
|
3
|
+
* @requirement:REQ-API-001, REQ-TEMPORARY-INTERFACES
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2025 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Package-local tool name constants.
|
|
12
|
+
*
|
|
13
|
+
* Centralizes tool name strings to prevent circular dependencies.
|
|
14
|
+
* Self-contained with zero core imports.
|
|
15
|
+
*/
|
|
16
|
+
// Web Search Tools
|
|
17
|
+
export const GOOGLE_WEB_SEARCH_TOOL = 'google_web_search';
|
|
18
|
+
export const EXA_WEB_SEARCH_TOOL = 'exa_web_search';
|
|
19
|
+
// Aliases for upstream compatibility
|
|
20
|
+
export const EDIT_TOOL_NAME = 'replace';
|
|
21
|
+
export const GREP_TOOL_NAME = 'search_file_content';
|
|
22
|
+
export const READ_MANY_FILES_TOOL_NAME = 'read_many_files';
|
|
23
|
+
export const READ_FILE_TOOL_NAME = 'read_file';
|
|
24
|
+
export const LS_TOOL_NAME = 'list_directory';
|
|
25
|
+
export const MEMORY_TOOL_NAME = 'save_memory';
|
|
26
|
+
export const ACTIVATE_SKILL_TOOL_NAME = 'activate_skill';
|
|
27
|
+
// File System Tools
|
|
28
|
+
export const READ_FILE_TOOL = 'read_file';
|
|
29
|
+
export const WRITE_FILE_TOOL = 'write_file';
|
|
30
|
+
export const EDIT_TOOL = 'replace';
|
|
31
|
+
export const INSERT_AT_LINE_TOOL = 'insert_at_line';
|
|
32
|
+
export const DELETE_LINE_RANGE_TOOL = 'delete_line_range';
|
|
33
|
+
export const READ_LINE_RANGE_TOOL = 'read_line_range';
|
|
34
|
+
export const READ_MANY_FILES_TOOL = 'read_many_files';
|
|
35
|
+
// Search & Discovery Tools
|
|
36
|
+
export const GREP_TOOL = 'search_file_content';
|
|
37
|
+
export const RIPGREP_TOOL = 'ripgrep';
|
|
38
|
+
export const GLOB_TOOL = 'glob';
|
|
39
|
+
export const LS_TOOL = 'ls';
|
|
40
|
+
export const LIST_DIRECTORY_TOOL = 'list_directory';
|
|
41
|
+
export const CODE_SEARCH_TOOL = 'code_search';
|
|
42
|
+
// Web Fetch Tools
|
|
43
|
+
export const GOOGLE_WEB_FETCH_TOOL = 'web_fetch';
|
|
44
|
+
export const DIRECT_WEB_FETCH_TOOL = 'direct_web_fetch';
|
|
45
|
+
// Task & Memory Tools
|
|
46
|
+
export const TASK_TOOL = 'task';
|
|
47
|
+
export const MEMORY_TOOL = 'memory';
|
|
48
|
+
export const TODO_READ_TOOL = 'todo_read';
|
|
49
|
+
export const TODO_WRITE_TOOL = 'todo_write';
|
|
50
|
+
export const TODO_PAUSE_TOOL = 'todo_pause';
|
|
51
|
+
// Agent Tools
|
|
52
|
+
export const LIST_SUBAGENTS_TOOL = 'list_subagents';
|
|
53
|
+
// Shell Tool
|
|
54
|
+
export const SHELL_TOOL = 'shell';
|
|
55
|
+
// AST Analysis Tools
|
|
56
|
+
export const AST_GREP_TOOL = 'ast_grep';
|
|
57
|
+
export const STRUCTURAL_ANALYSIS_TOOL = 'structural_analysis';
|
|
58
|
+
// Patch Tools
|
|
59
|
+
export const APPLY_PATCH_TOOL = 'apply_patch';
|
|
60
|
+
/**
|
|
61
|
+
* Set of edit tool names for checkpointing and restore operations.
|
|
62
|
+
*/
|
|
63
|
+
export const EDIT_TOOL_NAMES = new Set([EDIT_TOOL_NAME, WRITE_FILE_TOOL]);
|
|
64
|
+
//# sourceMappingURL=tool-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-names.js","sourceRoot":"","sources":["../../../src/types/tool-names.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH,mBAAmB;AACnB,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAEpD,qCAAqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AACxC,MAAM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MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,cAAc;AACd,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAEpD,aAAa;AACb,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAElC,qBAAqB;AACrB,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AACxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAE9D,cAAc;AACd,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* EmojiFilter - Filters emojis from text content based on configuration
|
|
8
|
+
* Implementation stub based on pseudocode lines 01-186
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Emoji filter modes
|
|
12
|
+
*/
|
|
13
|
+
export type EmojiFilterMode = 'allowed' | 'auto' | 'warn' | 'error';
|
|
14
|
+
export declare const VALID_EMOJI_FILTER_MODES: ReadonlySet<string>;
|
|
15
|
+
export declare function isEmojiFilterMode(value: unknown): value is EmojiFilterMode;
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for emoji filtering behavior
|
|
18
|
+
* @requirement REQ-004.1 - Silent filtering in auto mode
|
|
19
|
+
*/
|
|
20
|
+
export interface FilterConfiguration {
|
|
21
|
+
mode: EmojiFilterMode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Result of emoji filtering operation
|
|
25
|
+
*/
|
|
26
|
+
export interface FilterResult {
|
|
27
|
+
filtered: string | object | null;
|
|
28
|
+
emojiDetected: boolean;
|
|
29
|
+
blocked: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
systemFeedback?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets the most restrictive filter mode from two modes
|
|
35
|
+
* Hierarchy: error > warn > auto > allowed
|
|
36
|
+
*/
|
|
37
|
+
export declare function getMostRestrictiveFilter(mode1: EmojiFilterMode, mode2: EmojiFilterMode): EmojiFilterMode;
|
|
38
|
+
/**
|
|
39
|
+
* EmojiFilter class for filtering emojis from various content types
|
|
40
|
+
* @pseudocode lines 01-186
|
|
41
|
+
*/
|
|
42
|
+
export declare class EmojiFilter {
|
|
43
|
+
private patterns;
|
|
44
|
+
private conversions;
|
|
45
|
+
private buffer;
|
|
46
|
+
private config;
|
|
47
|
+
/**
|
|
48
|
+
* Creates new EmojiFilter instance
|
|
49
|
+
* @param config Filter configuration
|
|
50
|
+
* @pseudocode lines 07-12
|
|
51
|
+
*/
|
|
52
|
+
constructor(config: FilterConfiguration);
|
|
53
|
+
/**
|
|
54
|
+
* Filters text content for emojis
|
|
55
|
+
* @param text Text to filter
|
|
56
|
+
* @returns Filter result with processed text
|
|
57
|
+
* @pseudocode lines 14-45
|
|
58
|
+
*/
|
|
59
|
+
filterText(text: string): FilterResult;
|
|
60
|
+
/**
|
|
61
|
+
* Filters streaming text chunks for emojis
|
|
62
|
+
* @param chunk Text chunk to filter
|
|
63
|
+
* @returns Filter result with processed chunk
|
|
64
|
+
* @pseudocode lines 47-60
|
|
65
|
+
*/
|
|
66
|
+
filterStreamChunk(chunk: string): FilterResult;
|
|
67
|
+
/**
|
|
68
|
+
* Filters tool arguments for emojis
|
|
69
|
+
* @param args Tool arguments object
|
|
70
|
+
* @returns Filter result with processed arguments
|
|
71
|
+
* @pseudocode lines 62-95
|
|
72
|
+
*/
|
|
73
|
+
filterToolArgs(args: object): FilterResult;
|
|
74
|
+
/**
|
|
75
|
+
* Filters file content for emojis
|
|
76
|
+
* @param content File content to filter
|
|
77
|
+
* @param toolName Name of the tool writing the file
|
|
78
|
+
* @returns Filter result with processed content
|
|
79
|
+
* @pseudocode lines 97-128
|
|
80
|
+
*/
|
|
81
|
+
filterFileContent(content: string, toolName: string): FilterResult;
|
|
82
|
+
/**
|
|
83
|
+
* Flushes remaining buffered content
|
|
84
|
+
* @returns Remaining filtered content
|
|
85
|
+
* @pseudocode lines 130-138
|
|
86
|
+
*/
|
|
87
|
+
flushBuffer(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Detects if text contains emojis
|
|
90
|
+
* @param text Text to check
|
|
91
|
+
* @returns True if emojis detected
|
|
92
|
+
* @pseudocode lines 140-147
|
|
93
|
+
*/
|
|
94
|
+
private detectEmojis;
|
|
95
|
+
/**
|
|
96
|
+
* Applies emoji-to-text conversions
|
|
97
|
+
* @param text Text to convert
|
|
98
|
+
* @returns Text with emojis converted
|
|
99
|
+
* @pseudocode lines 149-155
|
|
100
|
+
*/
|
|
101
|
+
private applyConversions;
|
|
102
|
+
/**
|
|
103
|
+
* Removes decorative emojis from text
|
|
104
|
+
* @param text Text to clean
|
|
105
|
+
* @returns Text with decorative emojis removed
|
|
106
|
+
* @pseudocode lines 157-163
|
|
107
|
+
*/
|
|
108
|
+
private removeDecorativeEmojis;
|
|
109
|
+
/**
|
|
110
|
+
* Finds last safe boundary to avoid splitting multi-byte characters
|
|
111
|
+
* @param text Text to analyze
|
|
112
|
+
* @returns Safe boundary position or -1 if none found
|
|
113
|
+
* @pseudocode lines 165-180
|
|
114
|
+
*/
|
|
115
|
+
private findLastSafeBoundary;
|
|
116
|
+
/**
|
|
117
|
+
* Compiles emoji detection patterns
|
|
118
|
+
* @returns Array of compiled regex patterns
|
|
119
|
+
* @pseudocode line 09
|
|
120
|
+
*/
|
|
121
|
+
private compileEmojiPatterns;
|
|
122
|
+
/**
|
|
123
|
+
* Loads emoji-to-text conversion map
|
|
124
|
+
* @returns Map of emoji conversions
|
|
125
|
+
* @pseudocode line 10
|
|
126
|
+
*/
|
|
127
|
+
private loadConversionMap;
|
|
128
|
+
/**
|
|
129
|
+
* Recursively filters emojis from object properties
|
|
130
|
+
* @param obj Object to filter
|
|
131
|
+
* @returns Filtered object
|
|
132
|
+
*/
|
|
133
|
+
private deepFilterObject;
|
|
134
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export const VALID_EMOJI_FILTER_MODES = new Set([
|
|
7
|
+
'allowed',
|
|
8
|
+
'auto',
|
|
9
|
+
'warn',
|
|
10
|
+
'error',
|
|
11
|
+
]);
|
|
12
|
+
export function isEmojiFilterMode(value) {
|
|
13
|
+
return typeof value === 'string' && VALID_EMOJI_FILTER_MODES.has(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Gets the most restrictive filter mode from two modes
|
|
17
|
+
* Hierarchy: error > warn > auto > allowed
|
|
18
|
+
*/
|
|
19
|
+
export function getMostRestrictiveFilter(mode1, mode2) {
|
|
20
|
+
const priority = {
|
|
21
|
+
allowed: 0,
|
|
22
|
+
auto: 1,
|
|
23
|
+
warn: 2,
|
|
24
|
+
error: 3,
|
|
25
|
+
};
|
|
26
|
+
return priority[mode1] >= priority[mode2] ? mode1 : mode2;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* EmojiFilter class for filtering emojis from various content types
|
|
30
|
+
* @pseudocode lines 01-186
|
|
31
|
+
*/
|
|
32
|
+
export class EmojiFilter {
|
|
33
|
+
patterns;
|
|
34
|
+
conversions;
|
|
35
|
+
buffer;
|
|
36
|
+
config;
|
|
37
|
+
/**
|
|
38
|
+
* Creates new EmojiFilter instance
|
|
39
|
+
* @param config Filter configuration
|
|
40
|
+
* @pseudocode lines 07-12
|
|
41
|
+
*/
|
|
42
|
+
constructor(config) {
|
|
43
|
+
this.config = config;
|
|
44
|
+
this.patterns = this.compileEmojiPatterns();
|
|
45
|
+
this.conversions = this.loadConversionMap();
|
|
46
|
+
this.buffer = '';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Filters text content for emojis
|
|
50
|
+
* @param text Text to filter
|
|
51
|
+
* @returns Filter result with processed text
|
|
52
|
+
* @pseudocode lines 14-45
|
|
53
|
+
*/
|
|
54
|
+
filterText(text) {
|
|
55
|
+
if (this.config.mode === 'allowed') {
|
|
56
|
+
return { filtered: text, emojiDetected: false, blocked: false };
|
|
57
|
+
}
|
|
58
|
+
const emojiDetected = this.detectEmojis(text);
|
|
59
|
+
if (!emojiDetected) {
|
|
60
|
+
return { filtered: text, emojiDetected: false, blocked: false };
|
|
61
|
+
}
|
|
62
|
+
if (this.config.mode === 'error') {
|
|
63
|
+
return {
|
|
64
|
+
filtered: null,
|
|
65
|
+
emojiDetected: true,
|
|
66
|
+
blocked: true,
|
|
67
|
+
error: 'Emojis detected in content',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
let filtered = this.applyConversions(text);
|
|
71
|
+
filtered = this.removeDecorativeEmojis(filtered);
|
|
72
|
+
/**
|
|
73
|
+
* @requirement REQ-004.1 - Silent filtering in auto mode
|
|
74
|
+
*/
|
|
75
|
+
return {
|
|
76
|
+
filtered,
|
|
77
|
+
emojiDetected: true,
|
|
78
|
+
blocked: false,
|
|
79
|
+
systemFeedback: this.config.mode === 'warn'
|
|
80
|
+
? 'Emojis were detected and removed. Please avoid using emojis.'
|
|
81
|
+
: undefined,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Filters streaming text chunks for emojis
|
|
86
|
+
* @param chunk Text chunk to filter
|
|
87
|
+
* @returns Filter result with processed chunk
|
|
88
|
+
* @pseudocode lines 47-60
|
|
89
|
+
*/
|
|
90
|
+
filterStreamChunk(chunk) {
|
|
91
|
+
const combined = this.buffer + chunk;
|
|
92
|
+
const lastBoundary = this.findLastSafeBoundary(combined);
|
|
93
|
+
if (lastBoundary === -1 || lastBoundary === 0) {
|
|
94
|
+
this.buffer = combined;
|
|
95
|
+
// In error mode, check if buffer has emojis and return error immediately
|
|
96
|
+
if (this.config.mode === 'error' && this.detectEmojis(combined)) {
|
|
97
|
+
return {
|
|
98
|
+
filtered: null,
|
|
99
|
+
emojiDetected: true,
|
|
100
|
+
blocked: true,
|
|
101
|
+
error: 'Emojis detected in content',
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { filtered: '', emojiDetected: false, blocked: false };
|
|
105
|
+
}
|
|
106
|
+
const toProcess = combined.substring(0, lastBoundary);
|
|
107
|
+
this.buffer = combined.substring(lastBoundary);
|
|
108
|
+
return this.filterText(toProcess);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Filters tool arguments for emojis
|
|
112
|
+
* @param args Tool arguments object
|
|
113
|
+
* @returns Filter result with processed arguments
|
|
114
|
+
* @pseudocode lines 62-95
|
|
115
|
+
*/
|
|
116
|
+
filterToolArgs(args) {
|
|
117
|
+
if (this.config.mode === 'allowed') {
|
|
118
|
+
return { filtered: args, emojiDetected: false, blocked: false };
|
|
119
|
+
}
|
|
120
|
+
const stringified = JSON.stringify(args);
|
|
121
|
+
const emojiDetected = this.detectEmojis(stringified);
|
|
122
|
+
if (!emojiDetected) {
|
|
123
|
+
return { filtered: args, emojiDetected: false, blocked: false };
|
|
124
|
+
}
|
|
125
|
+
if (this.config.mode === 'error') {
|
|
126
|
+
return {
|
|
127
|
+
filtered: null,
|
|
128
|
+
emojiDetected: true,
|
|
129
|
+
blocked: true,
|
|
130
|
+
error: 'Cannot execute tool with emojis in parameters',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const filteredArgs = this.deepFilterObject(args);
|
|
134
|
+
/**
|
|
135
|
+
* @requirement REQ-004.1 - Silent filtering in auto mode
|
|
136
|
+
*/
|
|
137
|
+
return {
|
|
138
|
+
filtered: filteredArgs,
|
|
139
|
+
emojiDetected: true,
|
|
140
|
+
blocked: false,
|
|
141
|
+
systemFeedback: this.config.mode === 'warn'
|
|
142
|
+
? 'Emojis were detected and removed from your tool call. Please avoid using emojis in tool parameters.'
|
|
143
|
+
: undefined,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Filters file content for emojis
|
|
148
|
+
* @param content File content to filter
|
|
149
|
+
* @param toolName Name of the tool writing the file
|
|
150
|
+
* @returns Filter result with processed content
|
|
151
|
+
* @pseudocode lines 97-128
|
|
152
|
+
*/
|
|
153
|
+
filterFileContent(content, toolName) {
|
|
154
|
+
if (this.config.mode === 'allowed') {
|
|
155
|
+
return { filtered: content, emojiDetected: false, blocked: false };
|
|
156
|
+
}
|
|
157
|
+
const emojiDetected = this.detectEmojis(content);
|
|
158
|
+
if (!emojiDetected) {
|
|
159
|
+
return { filtered: content, emojiDetected: false, blocked: false };
|
|
160
|
+
}
|
|
161
|
+
if (this.config.mode === 'error') {
|
|
162
|
+
return {
|
|
163
|
+
filtered: null,
|
|
164
|
+
emojiDetected: true,
|
|
165
|
+
blocked: true,
|
|
166
|
+
error: 'Cannot write emojis to code files',
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
let filtered = this.applyConversions(content);
|
|
170
|
+
filtered = this.removeDecorativeEmojis(filtered);
|
|
171
|
+
/**
|
|
172
|
+
* @requirement REQ-004.1 - Silent filtering in auto mode
|
|
173
|
+
*/
|
|
174
|
+
return {
|
|
175
|
+
filtered,
|
|
176
|
+
emojiDetected: true,
|
|
177
|
+
blocked: false,
|
|
178
|
+
systemFeedback: this.config.mode === 'warn'
|
|
179
|
+
? `Emojis were removed from ${toolName} content. Please avoid using emojis in code.`
|
|
180
|
+
: undefined,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Flushes remaining buffered content
|
|
185
|
+
* @returns Remaining filtered content
|
|
186
|
+
* @pseudocode lines 130-138
|
|
187
|
+
*/
|
|
188
|
+
flushBuffer() {
|
|
189
|
+
const remaining = this.buffer;
|
|
190
|
+
this.buffer = '';
|
|
191
|
+
if (remaining.length > 0) {
|
|
192
|
+
const result = this.filterText(remaining);
|
|
193
|
+
return (typeof result.filtered === 'string' ? result.filtered : '') || '';
|
|
194
|
+
}
|
|
195
|
+
return '';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Detects if text contains emojis
|
|
199
|
+
* @param text Text to check
|
|
200
|
+
* @returns True if emojis detected
|
|
201
|
+
* @pseudocode lines 140-147
|
|
202
|
+
*/
|
|
203
|
+
detectEmojis(text) {
|
|
204
|
+
for (const pattern of this.patterns) {
|
|
205
|
+
// Reset lastIndex to ensure test starts from beginning
|
|
206
|
+
pattern.lastIndex = 0;
|
|
207
|
+
if (pattern.test(text)) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Applies emoji-to-text conversions
|
|
215
|
+
* @param text Text to convert
|
|
216
|
+
* @returns Text with emojis converted
|
|
217
|
+
* @pseudocode lines 149-155
|
|
218
|
+
*/
|
|
219
|
+
applyConversions(text) {
|
|
220
|
+
let result = text;
|
|
221
|
+
for (const [emoji, replacement] of this.conversions) {
|
|
222
|
+
result = result.replaceAll(emoji, replacement);
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Removes decorative emojis from text
|
|
228
|
+
* @param text Text to clean
|
|
229
|
+
* @returns Text with decorative emojis removed
|
|
230
|
+
* @pseudocode lines 157-163
|
|
231
|
+
*/
|
|
232
|
+
removeDecorativeEmojis(text) {
|
|
233
|
+
// Remove ALL emojis using comprehensive Unicode patterns
|
|
234
|
+
// Note: Functional emojis (✅, ✓, ⚠️, ❌, ⚡) are already converted by applyConversions
|
|
235
|
+
let result = text;
|
|
236
|
+
// Apply each pattern to remove emojis
|
|
237
|
+
for (const pattern of this.patterns) {
|
|
238
|
+
result = result.replace(new RegExp(pattern.source, pattern.flags), '');
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Finds last safe boundary to avoid splitting multi-byte characters
|
|
244
|
+
* @param text Text to analyze
|
|
245
|
+
* @returns Safe boundary position or -1 if none found
|
|
246
|
+
* @pseudocode lines 165-180
|
|
247
|
+
*/
|
|
248
|
+
findLastSafeBoundary(text) {
|
|
249
|
+
const length = text.length;
|
|
250
|
+
if (length === 0) {
|
|
251
|
+
return -1;
|
|
252
|
+
}
|
|
253
|
+
// If text contains emojis, be more conservative about boundaries
|
|
254
|
+
const hasEmojis = this.detectEmojis(text);
|
|
255
|
+
// Special case: if text ends with known complete words (common endings)
|
|
256
|
+
const endsWithKnownCompleteWords = /(?:done|completed|finished|success|error|failed|ready|developer|warnings)$/i.test(text);
|
|
257
|
+
if (endsWithKnownCompleteWords) {
|
|
258
|
+
return length;
|
|
259
|
+
}
|
|
260
|
+
// If we have emojis in the text, be very conservative - only process
|
|
261
|
+
// when we have known complete words or strong punctuation
|
|
262
|
+
if (hasEmojis) {
|
|
263
|
+
const endsWithPunctuation = /[.!?]$/.test(text);
|
|
264
|
+
if (endsWithPunctuation) {
|
|
265
|
+
return length;
|
|
266
|
+
}
|
|
267
|
+
return -1;
|
|
268
|
+
}
|
|
269
|
+
// For text without emojis, check if text ends with clear termination
|
|
270
|
+
const endsWithPunctuation = /[.!?]$/.test(text);
|
|
271
|
+
const endsWithSpace = /\s$/.test(text);
|
|
272
|
+
// Process text if it ends with punctuation or whitespace
|
|
273
|
+
if (endsWithPunctuation || endsWithSpace) {
|
|
274
|
+
return length;
|
|
275
|
+
}
|
|
276
|
+
// Otherwise buffer - text might be incomplete (like 'tas' from 'task')
|
|
277
|
+
return -1;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Compiles emoji detection patterns
|
|
281
|
+
* @returns Array of compiled regex patterns
|
|
282
|
+
* @pseudocode line 09
|
|
283
|
+
*/
|
|
284
|
+
compileEmojiPatterns() {
|
|
285
|
+
return [
|
|
286
|
+
// Unicode emoji ranges for comprehensive detection
|
|
287
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
288
|
+
/[\u{1F300}-\u{1F9FF}]/gu, // Miscellaneous Symbols and Pictographs + Supplemental Symbols
|
|
289
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
290
|
+
/[\u{1FA00}-\u{1FAFF}]/gu, // Extended Symbols and Pictographs (includes magic wand, rock, blood, planet, berries, vegetables, teapot, beans, jar)
|
|
291
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
292
|
+
/[\u{2600}-\u{26FF}]/gu, // Miscellaneous Symbols
|
|
293
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
294
|
+
/[\u{2700}-\u{27BF}]/gu, // Dingbats
|
|
295
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
296
|
+
/[\u{1F170}-\u{1F1FF}]/gu, // Enclosed Alphanumeric Supplement (includes 🆙 U+1F199) and Regional Indicators
|
|
297
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
298
|
+
/[\u{1F600}-\u{1F64F}]/gu, // Emoticons
|
|
299
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
300
|
+
/[\u{1F680}-\u{1F6FF}]/gu, // Transport and Map Symbols
|
|
301
|
+
// eslint-disable-next-line sonarjs/regular-expr -- Static regex reviewed for lint hardening; behavior preserved.
|
|
302
|
+
/[\u{23E9}-\u{23FF}]/gu, // Additional symbols including ⏳ (hourglass)
|
|
303
|
+
// Specific functional emojis that might not be caught by ranges
|
|
304
|
+
/[\u2705\u2713\u26A0\u274C\u26A1]|\u26A0\uFE0F/gu,
|
|
305
|
+
// Variation selectors and combining characters often used with emojis
|
|
306
|
+
/[\uFE0E\uFE0F]/gu, // Variation selectors
|
|
307
|
+
/[\u200D]/gu, // Zero-width joiner
|
|
308
|
+
];
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Loads emoji-to-text conversion map
|
|
312
|
+
* @returns Map of emoji conversions
|
|
313
|
+
* @pseudocode line 10
|
|
314
|
+
*/
|
|
315
|
+
loadConversionMap() {
|
|
316
|
+
return new Map([
|
|
317
|
+
['✅', '[OK]'], // ✅ -> [OK]
|
|
318
|
+
['✓', '[OK]'], // ✓ -> [OK]
|
|
319
|
+
['⚠️', 'WARNING:'], // ⚠️ -> WARNING:
|
|
320
|
+
['❌', '[ERROR]'], // ❌ -> [ERROR]
|
|
321
|
+
['⚡', '[ACTION]'], // ⚡ -> [ACTION]
|
|
322
|
+
['🪄', '[MAGIC]'], // 🪄 -> [MAGIC]
|
|
323
|
+
['🆙', '[UP]'], // 🆙 -> [UP]
|
|
324
|
+
['⭐', '[STAR]'], // ⭐ -> [STAR]
|
|
325
|
+
['🪨', '[ROCK]'], // 🪨 -> [ROCK]
|
|
326
|
+
['🩸', '[BLOOD]'], // 🩸 -> [BLOOD]
|
|
327
|
+
['🪐', '[PLANET]'], // 🪐 -> [PLANET]
|
|
328
|
+
['🫐', '[BLUEBERRIES]'], // 🫐 -> [BLUEBERRIES]
|
|
329
|
+
['🫒', '[OLIVE]'], // 🫒 -> [OLIVE]
|
|
330
|
+
['🫑', '[BELL_PEPPER]'], // 🫑 -> [BELL_PEPPER]
|
|
331
|
+
['🫖', '[TEAPOT]'], // 🫖 -> [TEAPOT]
|
|
332
|
+
['🫘', '[BEANS]'], // 🫘 -> [BEANS]
|
|
333
|
+
['🫙', '[JAR]'], // 🫙 -> [JAR]
|
|
334
|
+
// Emoji numbers to regular numbers
|
|
335
|
+
['0️⃣', '0'], // 0️⃣ -> 0
|
|
336
|
+
['1️⃣', '1'], // 1️⃣ -> 1
|
|
337
|
+
['2️⃣', '2'], // 2️⃣ -> 2
|
|
338
|
+
['3️⃣', '3'], // 3️⃣ -> 3
|
|
339
|
+
['4️⃣', '4'], // 4️⃣ -> 4
|
|
340
|
+
['5️⃣', '5'], // 5️⃣ -> 5
|
|
341
|
+
['6️⃣', '6'], // 6️⃣ -> 6
|
|
342
|
+
['7️⃣', '7'], // 7️⃣ -> 7
|
|
343
|
+
['8️⃣', '8'], // 8️⃣ -> 8
|
|
344
|
+
['9️⃣', '9'], // 9️⃣ -> 9
|
|
345
|
+
// Note: 📝 is treated as decorative in the tests, not functional
|
|
346
|
+
]);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Recursively filters emojis from object properties
|
|
350
|
+
* @param obj Object to filter
|
|
351
|
+
* @returns Filtered object
|
|
352
|
+
*/
|
|
353
|
+
deepFilterObject(obj) {
|
|
354
|
+
if (typeof obj === 'string') {
|
|
355
|
+
return this.filterText(obj).filtered;
|
|
356
|
+
}
|
|
357
|
+
if (Array.isArray(obj)) {
|
|
358
|
+
return obj.map((item) => this.deepFilterObject(item));
|
|
359
|
+
}
|
|
360
|
+
if (obj !== null && typeof obj === 'object') {
|
|
361
|
+
const filtered = {};
|
|
362
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
363
|
+
filtered[key] = this.deepFilterObject(value);
|
|
364
|
+
}
|
|
365
|
+
return filtered;
|
|
366
|
+
}
|
|
367
|
+
return obj;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=EmojiFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiFilter.js","sourceRoot":"","sources":["../../../src/utils/EmojiFilter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,MAAM,CAAC,MAAM,w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
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared AST-grep utilities for all tools that use @ast-grep/napi.
|
|
3
|
+
* Single source of truth for language mapping, parsing, and error normalization.
|
|
4
|
+
*
|
|
5
|
+
* @plan PLAN-20260211-ASTGREP.P03
|
|
6
|
+
*/
|
|
7
|
+
import { parse, Lang } from '@ast-grep/napi';
|
|
8
|
+
/**
|
|
9
|
+
* File extension to ast-grep language mapping.
|
|
10
|
+
* Single source of truth across all AST tools.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LANGUAGE_MAP: Record<string, string | Lang>;
|
|
13
|
+
/**
|
|
14
|
+
* File extensions that belong to the JavaScript/TypeScript language family.
|
|
15
|
+
*/
|
|
16
|
+
export declare const JAVASCRIPT_FAMILY_EXTENSIONS: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a file extension or language name to an ast-grep language.
|
|
19
|
+
* Accepts both extensions ('ts', 'py') and full names ('typescript', 'python').
|
|
20
|
+
* Returns undefined for unrecognized inputs.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAstLanguage(extOrName: string): string | Lang | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Detect the ast-grep language from a file path's extension.
|
|
25
|
+
* Returns undefined if the extension is not recognized.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveLanguageFromPath(filePath: string): string | Lang | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Check if @ast-grep/napi is available and usable.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isAstGrepAvailable(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Parse source code with error normalization.
|
|
34
|
+
* Returns { root } on success or { error } on failure.
|
|
35
|
+
* Does not throw.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseSource(language: string | Lang, content: string): {
|
|
38
|
+
root: ReturnType<typeof parse>;
|
|
39
|
+
} | {
|
|
40
|
+
error: string;
|
|
41
|
+
};
|
|
42
|
+
export { parse, Lang, findInFiles } from '@ast-grep/napi';
|