@vybestack/llxprt-code-core 0.1.12
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/dist/.last_build +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__mocks__/fs/promises.d.ts +11 -0
- package/dist/src/__mocks__/fs/promises.js +17 -0
- package/dist/src/__mocks__/fs/promises.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +9 -0
- package/dist/src/code_assist/codeAssist.js +19 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +68 -0
- package/dist/src/code_assist/converter.js +125 -0
- package/dist/src/code_assist/converter.js.map +1 -0
- package/dist/src/code_assist/converter.test.d.ts +6 -0
- package/dist/src/code_assist/converter.test.js +229 -0
- package/dist/src/code_assist/converter.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +20 -0
- package/dist/src/code_assist/oauth2.js +339 -0
- package/dist/src/code_assist/oauth2.js.map +1 -0
- package/dist/src/code_assist/oauth2.test.d.ts +6 -0
- package/dist/src/code_assist/oauth2.test.js +249 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -0
- package/dist/src/code_assist/server.d.ts +39 -0
- package/dist/src/code_assist/server.js +191 -0
- package/dist/src/code_assist/server.js.map +1 -0
- package/dist/src/code_assist/server.test.d.ts +6 -0
- package/dist/src/code_assist/server.test.js +123 -0
- package/dist/src/code_assist/server.test.js.map +1 -0
- package/dist/src/code_assist/setup.d.ts +15 -0
- package/dist/src/code_assist/setup.js +67 -0
- package/dist/src/code_assist/setup.js.map +1 -0
- package/dist/src/code_assist/setup.test.d.ts +6 -0
- package/dist/src/code_assist/setup.test.js +62 -0
- package/dist/src/code_assist/setup.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +148 -0
- package/dist/src/code_assist/types.js +46 -0
- package/dist/src/code_assist/types.js.map +1 -0
- package/dist/src/config/config.d.ts +212 -0
- package/dist/src/config/config.js +454 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/config.test.d.ts +6 -0
- package/dist/src/config/config.test.js +291 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/flashFallback.test.d.ts +6 -0
- package/dist/src/config/flashFallback.test.js +115 -0
- package/dist/src/config/flashFallback.test.js.map +1 -0
- package/dist/src/config/models.d.ts +8 -0
- package/dist/src/config/models.js +9 -0
- package/dist/src/config/models.js.map +1 -0
- package/dist/src/core/client.d.ts +59 -0
- package/dist/src/core/client.js +503 -0
- package/dist/src/core/client.js.map +1 -0
- package/dist/src/core/client.test.d.ts +6 -0
- package/dist/src/core/client.test.js +1006 -0
- package/dist/src/core/client.test.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +36 -0
- package/dist/src/core/contentGenerator.js +79 -0
- package/dist/src/core/contentGenerator.js.map +1 -0
- package/dist/src/core/contentGenerator.test.d.ts +6 -0
- package/dist/src/core/contentGenerator.test.js +92 -0
- package/dist/src/core/contentGenerator.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +104 -0
- package/dist/src/core/coreToolScheduler.js +413 -0
- package/dist/src/core/coreToolScheduler.js.map +1 -0
- package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
- package/dist/src/core/coreToolScheduler.test.js +347 -0
- package/dist/src/core/coreToolScheduler.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +116 -0
- package/dist/src/core/geminiChat.js +513 -0
- package/dist/src/core/geminiChat.js.map +1 -0
- package/dist/src/core/geminiChat.test.d.ts +6 -0
- package/dist/src/core/geminiChat.test.js +424 -0
- package/dist/src/core/geminiChat.test.js.map +1 -0
- package/dist/src/core/geminiRequest.d.ts +13 -0
- package/dist/src/core/geminiRequest.js +45 -0
- package/dist/src/core/geminiRequest.js.map +1 -0
- package/dist/src/core/geminiRequest.test.d.ts +6 -0
- package/dist/src/core/geminiRequest.test.js +72 -0
- package/dist/src/core/geminiRequest.test.js.map +1 -0
- package/dist/src/core/logger.d.ts +38 -0
- package/dist/src/core/logger.js +237 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/core/logger.test.d.ts +6 -0
- package/dist/src/core/logger.test.js +387 -0
- package/dist/src/core/logger.test.js.map +1 -0
- package/dist/src/core/modelCheck.d.ts +14 -0
- package/dist/src/core/modelCheck.js +55 -0
- package/dist/src/core/modelCheck.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +12 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +93 -0
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js +180 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
- package/dist/src/core/prompts.d.ts +12 -0
- package/dist/src/core/prompts.js +418 -0
- package/dist/src/core/prompts.js.map +1 -0
- package/dist/src/core/prompts.test.d.ts +6 -0
- package/dist/src/core/prompts.test.js +97 -0
- package/dist/src/core/prompts.test.js.map +1 -0
- package/dist/src/core/tokenLimits.d.ts +10 -0
- package/dist/src/core/tokenLimits.js +75 -0
- package/dist/src/core/tokenLimits.js.map +1 -0
- package/dist/src/core/tokenLimits.test.d.ts +6 -0
- package/dist/src/core/tokenLimits.test.js +66 -0
- package/dist/src/core/tokenLimits.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +116 -0
- package/dist/src/core/turn.js +131 -0
- package/dist/src/core/turn.js.map +1 -0
- package/dist/src/core/turn.test.d.ts +6 -0
- package/dist/src/core/turn.test.js +237 -0
- package/dist/src/core/turn.test.js.map +1 -0
- package/dist/src/index.d.ts +57 -0
- package/dist/src/index.js +64 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.test.d.ts +6 -0
- package/dist/src/index.test.js +12 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/providers/ProviderContentGenerator.d.ts +21 -0
- package/dist/src/providers/ProviderContentGenerator.js +52 -0
- package/dist/src/providers/ProviderContentGenerator.js.map +1 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.d.ts +68 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.js +549 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.js.map +1 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.d.ts +6 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js +253 -0
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js.map +1 -0
- package/dist/src/providers/types.d.ts +82 -0
- package/dist/src/providers/types.js +7 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.d.ts +35 -0
- package/dist/src/services/fileDiscoveryService.js +91 -0
- package/dist/src/services/fileDiscoveryService.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
- package/dist/src/services/fileDiscoveryService.test.js +102 -0
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
- package/dist/src/services/gitService.d.ts +21 -0
- package/dist/src/services/gitService.js +102 -0
- package/dist/src/services/gitService.js.map +1 -0
- package/dist/src/services/gitService.test.d.ts +6 -0
- package/dist/src/services/gitService.test.js +246 -0
- package/dist/src/services/gitService.test.js.map +1 -0
- package/dist/src/services/ideContext.d.ts +124 -0
- package/dist/src/services/ideContext.js +90 -0
- package/dist/src/services/ideContext.js.map +1 -0
- package/dist/src/services/ideContext.test.d.ts +6 -0
- package/dist/src/services/ideContext.test.js +101 -0
- package/dist/src/services/ideContext.test.js.map +1 -0
- package/dist/src/services/loopDetectionService.d.ts +35 -0
- package/dist/src/services/loopDetectionService.js +117 -0
- package/dist/src/services/loopDetectionService.js.map +1 -0
- package/dist/src/services/loopDetectionService.test.d.ts +6 -0
- package/dist/src/services/loopDetectionService.test.js +232 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +35 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +424 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +47 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +123 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +20 -0
- package/dist/src/telemetry/constants.js +21 -0
- package/dist/src/telemetry/constants.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +18 -0
- package/dist/src/telemetry/index.js +20 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
- package/dist/src/telemetry/integration.test.circular.js +53 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +15 -0
- package/dist/src/telemetry/loggers.js +229 -0
- package/dist/src/telemetry/loggers.js.map +1 -0
- package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.circular.js +100 -0
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.test.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.js +558 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +19 -0
- package/dist/src/telemetry/metrics.js +144 -0
- package/dist/src/telemetry/metrics.js.map +1 -0
- package/dist/src/telemetry/metrics.test.d.ts +6 -0
- package/dist/src/telemetry/metrics.test.js +162 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -0
- package/dist/src/telemetry/sdk.js +120 -0
- package/dist/src/telemetry/sdk.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry.test.js +52 -0
- package/dist/src/telemetry/telemetry.test.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +115 -0
- package/dist/src/telemetry/types.js +217 -0
- package/dist/src/telemetry/types.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.d.ts +67 -0
- package/dist/src/telemetry/uiTelemetry.js +131 -0
- package/dist/src/telemetry/uiTelemetry.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
- package/dist/src/telemetry/uiTelemetry.test.js +412 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +7 -0
- package/dist/src/tools/diffOptions.js +10 -0
- package/dist/src/tools/diffOptions.js.map +1 -0
- package/dist/src/tools/edit.d.ts +73 -0
- package/dist/src/tools/edit.js +343 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/edit.test.d.ts +6 -0
- package/dist/src/tools/edit.test.js +500 -0
- package/dist/src/tools/edit.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +58 -0
- package/dist/src/tools/glob.js +193 -0
- package/dist/src/tools/glob.js.map +1 -0
- package/dist/src/tools/glob.test.d.ts +6 -0
- package/dist/src/tools/glob.test.js +294 -0
- package/dist/src/tools/glob.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +78 -0
- package/dist/src/tools/grep.js +422 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/grep.test.d.ts +6 -0
- package/dist/src/tools/grep.test.js +188 -0
- package/dist/src/tools/grep.test.js.map +1 -0
- package/dist/src/tools/ls.d.ts +83 -0
- package/dist/src/tools/ls.js +194 -0
- package/dist/src/tools/ls.js.map +1 -0
- package/dist/src/tools/mcp-client.d.ts +112 -0
- package/dist/src/tools/mcp-client.js +332 -0
- package/dist/src/tools/mcp-client.js.map +1 -0
- package/dist/src/tools/mcp-client.test.d.ts +6 -0
- package/dist/src/tools/mcp-client.test.js +227 -0
- package/dist/src/tools/mcp-client.test.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +23 -0
- package/dist/src/tools/mcp-tool.js +119 -0
- package/dist/src/tools/mcp-tool.js.map +1 -0
- package/dist/src/tools/mcp-tool.test.d.ts +6 -0
- package/dist/src/tools/mcp-tool.test.js +173 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +28 -0
- package/dist/src/tools/memoryTool.js +172 -0
- package/dist/src/tools/memoryTool.js.map +1 -0
- package/dist/src/tools/memoryTool.test.d.ts +6 -0
- package/dist/src/tools/memoryTool.test.js +181 -0
- package/dist/src/tools/memoryTool.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +29 -0
- package/dist/src/tools/modifiable-tool.js +85 -0
- package/dist/src/tools/modifiable-tool.js.map +1 -0
- package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
- package/dist/src/tools/modifiable-tool.test.js +204 -0
- package/dist/src/tools/modifiable-tool.test.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +35 -0
- package/dist/src/tools/read-file.js +106 -0
- package/dist/src/tools/read-file.js.map +1 -0
- package/dist/src/tools/read-file.test.d.ts +6 -0
- package/dist/src/tools/read-file.test.js +181 -0
- package/dist/src/tools/read-file.test.js.map +1 -0
- package/dist/src/tools/read-many-files.d.ts +59 -0
- package/dist/src/tools/read-many-files.js +321 -0
- package/dist/src/tools/read-many-files.js.map +1 -0
- package/dist/src/tools/read-many-files.test.d.ts +6 -0
- package/dist/src/tools/read-many-files.test.js +312 -0
- package/dist/src/tools/read-many-files.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +43 -0
- package/dist/src/tools/shell.js +435 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/shell.test.d.ts +6 -0
- package/dist/src/tools/shell.test.js +407 -0
- package/dist/src/tools/shell.test.js.map +1 -0
- package/dist/src/tools/todo-read.d.ts +15 -0
- package/dist/src/tools/todo-read.js +66 -0
- package/dist/src/tools/todo-read.js.map +1 -0
- package/dist/src/tools/todo-read.test.d.ts +6 -0
- package/dist/src/tools/todo-read.test.js +158 -0
- package/dist/src/tools/todo-read.test.js.map +1 -0
- package/dist/src/tools/todo-schemas.d.ts +43 -0
- package/dist/src/tools/todo-schemas.js +16 -0
- package/dist/src/tools/todo-schemas.js.map +1 -0
- package/dist/src/tools/todo-schemas.test.d.ts +6 -0
- package/dist/src/tools/todo-schemas.test.js +152 -0
- package/dist/src/tools/todo-schemas.test.js.map +1 -0
- package/dist/src/tools/todo-store.d.ts +15 -0
- package/dist/src/tools/todo-store.js +59 -0
- package/dist/src/tools/todo-store.js.map +1 -0
- package/dist/src/tools/todo-store.test.d.ts +6 -0
- package/dist/src/tools/todo-store.test.js +175 -0
- package/dist/src/tools/todo-store.test.js.map +1 -0
- package/dist/src/tools/todo-write.d.ts +17 -0
- package/dist/src/tools/todo-write.js +98 -0
- package/dist/src/tools/todo-write.js.map +1 -0
- package/dist/src/tools/todo-write.test.d.ts +6 -0
- package/dist/src/tools/todo-write.test.js +208 -0
- package/dist/src/tools/todo-write.test.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +67 -0
- package/dist/src/tools/tool-registry.js +326 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/tools/tool-registry.test.d.ts +6 -0
- package/dist/src/tools/tool-registry.test.js +398 -0
- package/dist/src/tools/tool-registry.test.js.map +1 -0
- package/dist/src/tools/tools.d.ts +184 -0
- package/dist/src/tools/tools.js +88 -0
- package/dist/src/tools/tools.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +29 -0
- package/dist/src/tools/web-fetch.js +243 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/tools/web-fetch.test.d.ts +6 -0
- package/dist/src/tools/web-fetch.test.js +70 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -0
- package/dist/src/tools/web-search.d.ts +49 -0
- package/dist/src/tools/web-search.js +120 -0
- package/dist/src/tools/web-search.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +42 -0
- package/dist/src/tools/write-file.js +248 -0
- package/dist/src/tools/write-file.js.map +1 -0
- package/dist/src/tools/write-file.test.d.ts +6 -0
- package/dist/src/tools/write-file.test.js +413 -0
- package/dist/src/tools/write-file.test.js.map +1 -0
- package/dist/src/utils/LruCache.d.ts +13 -0
- package/dist/src/utils/LruCache.js +38 -0
- package/dist/src/utils/LruCache.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +22 -0
- package/dist/src/utils/bfsFileSearch.js +62 -0
- package/dist/src/utils/bfsFileSearch.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
- package/dist/src/utils/bfsFileSearch.test.js +129 -0
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
- package/dist/src/utils/editCorrector.d.ts +53 -0
- package/dist/src/utils/editCorrector.js +546 -0
- package/dist/src/utils/editCorrector.js.map +1 -0
- package/dist/src/utils/editCorrector.test.d.ts +6 -0
- package/dist/src/utils/editCorrector.test.js +564 -0
- package/dist/src/utils/editCorrector.test.js.map +1 -0
- package/dist/src/utils/editor.d.ts +28 -0
- package/dist/src/utils/editor.js +163 -0
- package/dist/src/utils/editor.js.map +1 -0
- package/dist/src/utils/editor.test.d.ts +6 -0
- package/dist/src/utils/editor.test.js +293 -0
- package/dist/src/utils/editor.test.js.map +1 -0
- package/dist/src/utils/errorReporting.d.ts +14 -0
- package/dist/src/utils/errorReporting.js +88 -0
- package/dist/src/utils/errorReporting.js.map +1 -0
- package/dist/src/utils/errorReporting.test.d.ts +6 -0
- package/dist/src/utils/errorReporting.test.js +124 -0
- package/dist/src/utils/errorReporting.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +14 -0
- package/dist/src/utils/errors.js +54 -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 +51 -0
- package/dist/src/utils/fetch.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +49 -0
- package/dist/src/utils/fileUtils.js +286 -0
- package/dist/src/utils/fileUtils.js.map +1 -0
- package/dist/src/utils/fileUtils.test.d.ts +6 -0
- package/dist/src/utils/fileUtils.test.js +321 -0
- package/dist/src/utils/fileUtils.test.js.map +1 -0
- package/dist/src/utils/flashFallback.integration.test.d.ts +6 -0
- package/dist/src/utils/flashFallback.integration.test.js +112 -0
- package/dist/src/utils/flashFallback.integration.test.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +14 -0
- package/dist/src/utils/generateContentResponseUtilities.js +92 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js +273 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.d.ts +30 -0
- package/dist/src/utils/getFolderStructure.js +247 -0
- package/dist/src/utils/getFolderStructure.js.map +1 -0
- package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
- package/dist/src/utils/getFolderStructure.test.js +298 -0
- package/dist/src/utils/getFolderStructure.test.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.d.ts +20 -0
- package/dist/src/utils/gitIgnoreParser.js +64 -0
- package/dist/src/utils/gitIgnoreParser.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/gitIgnoreParser.test.js +145 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +17 -0
- package/dist/src/utils/gitUtils.js +61 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +14 -0
- package/dist/src/utils/memoryDiscovery.js +219 -0
- package/dist/src/utils/memoryDiscovery.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
- package/dist/src/utils/memoryDiscovery.test.js +432 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.d.ts +35 -0
- package/dist/src/utils/memoryImportProcessor.js +141 -0
- package/dist/src/utils/memoryImportProcessor.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
- package/dist/src/utils/memoryImportProcessor.test.js +170 -0
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
- package/dist/src/utils/messageInspectors.d.ts +8 -0
- package/dist/src/utils/messageInspectors.js +16 -0
- package/dist/src/utils/messageInspectors.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
- package/dist/src/utils/nextSpeakerChecker.js +113 -0
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
- package/dist/src/utils/nextSpeakerChecker.test.js +168 -0
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +49 -0
- package/dist/src/utils/paths.js +145 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +22 -0
- package/dist/src/utils/quotaErrorDetection.js +67 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -0
- package/dist/src/utils/retry.d.ts +21 -0
- package/dist/src/utils/retry.js +276 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/retry.test.d.ts +6 -0
- package/dist/src/utils/retry.test.js +322 -0
- package/dist/src/utils/retry.test.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.d.ts +13 -0
- package/dist/src/utils/safeJsonStringify.js +25 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
- package/dist/src/utils/safeJsonStringify.test.js +61 -0
- package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
- package/dist/src/utils/schemaValidator.d.ts +23 -0
- package/dist/src/utils/schemaValidator.js +142 -0
- package/dist/src/utils/schemaValidator.js.map +1 -0
- package/dist/src/utils/schemaValidator.test.d.ts +6 -0
- package/dist/src/utils/schemaValidator.test.js +146 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -0
- package/dist/src/utils/session.d.ts +6 -0
- package/dist/src/utils/session.js +8 -0
- package/dist/src/utils/session.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +25 -0
- package/dist/src/utils/summarizer.js +80 -0
- package/dist/src/utils/summarizer.js.map +1 -0
- package/dist/src/utils/summarizer.test.d.ts +6 -0
- package/dist/src/utils/summarizer.test.js +131 -0
- package/dist/src/utils/summarizer.test.js.map +1 -0
- package/dist/src/utils/testUtils.d.ts +29 -0
- package/dist/src/utils/testUtils.js +70 -0
- package/dist/src/utils/testUtils.js.map +1 -0
- package/dist/src/utils/user_account.d.ts +9 -0
- package/dist/src/utils/user_account.js +99 -0
- package/dist/src/utils/user_account.js.map +1 -0
- package/dist/src/utils/user_account.test.d.ts +6 -0
- package/dist/src/utils/user_account.test.js +153 -0
- package/dist/src/utils/user_account.test.js.map +1 -0
- package/dist/src/utils/user_id.d.ts +11 -0
- package/dist/src/utils/user_id.js +49 -0
- package/dist/src/utils/user_id.js.map +1 -0
- package/dist/src/utils/user_id.test.d.ts +6 -0
- package/dist/src/utils/user_id.test.js +21 -0
- package/dist/src/utils/user_id.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vybestack-llxprt-code-core-0.1.12.tgz +0 -0
- package/package.json +62 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
7
|
+
import { reportError } from './errorReporting.js';
|
|
8
|
+
import fs from 'node:fs/promises';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
// Mock dependencies
|
|
11
|
+
vi.mock('node:fs/promises');
|
|
12
|
+
vi.mock('node:os');
|
|
13
|
+
describe('reportError', () => {
|
|
14
|
+
let consoleErrorSpy;
|
|
15
|
+
const MOCK_TMP_DIR = '/tmp';
|
|
16
|
+
const MOCK_TIMESTAMP = '2025-01-01T00-00-00-000Z';
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
vi.resetAllMocks();
|
|
19
|
+
consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
20
|
+
os.tmpdir.mockReturnValue(MOCK_TMP_DIR);
|
|
21
|
+
vi.spyOn(Date.prototype, 'toISOString').mockReturnValue(MOCK_TIMESTAMP);
|
|
22
|
+
});
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
vi.restoreAllMocks();
|
|
25
|
+
});
|
|
26
|
+
const getExpectedReportPath = (type) => `${MOCK_TMP_DIR}/gemini-client-error-${type}-${MOCK_TIMESTAMP}.json`;
|
|
27
|
+
it('should generate a report and log the path', async () => {
|
|
28
|
+
const error = new Error('Test error');
|
|
29
|
+
error.stack = 'Test stack';
|
|
30
|
+
const baseMessage = 'An error occurred.';
|
|
31
|
+
const context = { data: 'test context' };
|
|
32
|
+
const type = 'test-type';
|
|
33
|
+
const expectedReportPath = getExpectedReportPath(type);
|
|
34
|
+
fs.writeFile.mockResolvedValue(undefined);
|
|
35
|
+
await reportError(error, baseMessage, context, type);
|
|
36
|
+
expect(os.tmpdir).toHaveBeenCalledTimes(1);
|
|
37
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedReportPath, JSON.stringify({
|
|
38
|
+
error: { message: 'Test error', stack: error.stack },
|
|
39
|
+
context,
|
|
40
|
+
}, null, 2));
|
|
41
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Full report available at: ${expectedReportPath}`);
|
|
42
|
+
});
|
|
43
|
+
it('should handle errors that are plain objects with a message property', async () => {
|
|
44
|
+
const error = { message: 'Test plain object error' };
|
|
45
|
+
const baseMessage = 'Another error.';
|
|
46
|
+
const type = 'general';
|
|
47
|
+
const expectedReportPath = getExpectedReportPath(type);
|
|
48
|
+
fs.writeFile.mockResolvedValue(undefined);
|
|
49
|
+
await reportError(error, baseMessage);
|
|
50
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedReportPath, JSON.stringify({
|
|
51
|
+
error: { message: 'Test plain object error' },
|
|
52
|
+
}, null, 2));
|
|
53
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Full report available at: ${expectedReportPath}`);
|
|
54
|
+
});
|
|
55
|
+
it('should handle string errors', async () => {
|
|
56
|
+
const error = 'Just a string error';
|
|
57
|
+
const baseMessage = 'String error occurred.';
|
|
58
|
+
const type = 'general';
|
|
59
|
+
const expectedReportPath = getExpectedReportPath(type);
|
|
60
|
+
fs.writeFile.mockResolvedValue(undefined);
|
|
61
|
+
await reportError(error, baseMessage);
|
|
62
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedReportPath, JSON.stringify({
|
|
63
|
+
error: { message: 'Just a string error' },
|
|
64
|
+
}, null, 2));
|
|
65
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Full report available at: ${expectedReportPath}`);
|
|
66
|
+
});
|
|
67
|
+
it('should log fallback message if writing report fails', async () => {
|
|
68
|
+
const error = new Error('Main error');
|
|
69
|
+
const baseMessage = 'Failed operation.';
|
|
70
|
+
const writeError = new Error('Failed to write file');
|
|
71
|
+
const context = ['some context'];
|
|
72
|
+
const type = 'general';
|
|
73
|
+
const expectedReportPath = getExpectedReportPath(type);
|
|
74
|
+
fs.writeFile.mockRejectedValue(writeError);
|
|
75
|
+
await reportError(error, baseMessage, context, type);
|
|
76
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedReportPath, expect.any(String)); // It still tries to write
|
|
77
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Additionally, failed to write detailed error report:`, writeError);
|
|
78
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Original error that triggered report generation:', error);
|
|
79
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Original context:', context);
|
|
80
|
+
});
|
|
81
|
+
it('should handle stringification failure of report content (e.g. BigInt in context)', async () => {
|
|
82
|
+
const error = new Error('Main error');
|
|
83
|
+
error.stack = 'Main stack';
|
|
84
|
+
const baseMessage = 'Failed operation with BigInt.';
|
|
85
|
+
const context = { a: BigInt(1) }; // BigInt cannot be stringified by JSON.stringify
|
|
86
|
+
const type = 'bigint-fail';
|
|
87
|
+
const stringifyError = new TypeError('Do not know how to serialize a BigInt');
|
|
88
|
+
const expectedMinimalReportPath = getExpectedReportPath(type);
|
|
89
|
+
// Simulate JSON.stringify throwing an error for the full report
|
|
90
|
+
const originalJsonStringify = JSON.stringify;
|
|
91
|
+
let callCount = 0;
|
|
92
|
+
vi.spyOn(JSON, 'stringify').mockImplementation((value, replacer, space) => {
|
|
93
|
+
callCount++;
|
|
94
|
+
if (callCount === 1) {
|
|
95
|
+
// First call is for the full report content
|
|
96
|
+
throw stringifyError;
|
|
97
|
+
}
|
|
98
|
+
// Subsequent calls (for minimal report) should succeed
|
|
99
|
+
return originalJsonStringify(value, replacer, space);
|
|
100
|
+
});
|
|
101
|
+
fs.writeFile.mockResolvedValue(undefined); // Mock for the minimal report write
|
|
102
|
+
await reportError(error, baseMessage, context, type);
|
|
103
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Could not stringify report content (likely due to context):`, stringifyError);
|
|
104
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Original error that triggered report generation:', error);
|
|
105
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Original context could not be stringified or included in report.');
|
|
106
|
+
// Check that it attempts to write a minimal report
|
|
107
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedMinimalReportPath, originalJsonStringify({ error: { message: error.message, stack: error.stack } }, null, 2));
|
|
108
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Partial report (excluding context) available at: ${expectedMinimalReportPath}`);
|
|
109
|
+
});
|
|
110
|
+
it('should generate a report without context if context is not provided', async () => {
|
|
111
|
+
const error = new Error('Error without context');
|
|
112
|
+
error.stack = 'No context stack';
|
|
113
|
+
const baseMessage = 'Simple error.';
|
|
114
|
+
const type = 'general';
|
|
115
|
+
const expectedReportPath = getExpectedReportPath(type);
|
|
116
|
+
fs.writeFile.mockResolvedValue(undefined);
|
|
117
|
+
await reportError(error, baseMessage, undefined, type);
|
|
118
|
+
expect(fs.writeFile).toHaveBeenCalledWith(expectedReportPath, JSON.stringify({
|
|
119
|
+
error: { message: 'Error without context', stack: error.stack },
|
|
120
|
+
}, null, 2));
|
|
121
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(`${baseMessage} Full report available at: ${expectedReportPath}`);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=errorReporting.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorReporting.test.js","sourceRoot":"","sources":["../../../src/utils/errorReporting.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAQ,MAAM,QAAQ,CAAC;AAI/E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,oBAAoB;AACpB,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAC5B,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAEnB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,eAA4B,CAAC;IACjC,MAAM,YAAY,GAAG,MAAM,CAAC;IAC5B,MAAM,cAAc,GAAG,0BAA0B,CAAC;IAElD,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,eAAe,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,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|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export declare function isNodeError(error: unknown): error is NodeJS.ErrnoException;
|
|
7
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
8
|
+
export declare class ForbiddenError extends Error {
|
|
9
|
+
}
|
|
10
|
+
export declare class UnauthorizedError extends Error {
|
|
11
|
+
}
|
|
12
|
+
export declare class BadRequestError extends Error {
|
|
13
|
+
}
|
|
14
|
+
export declare function toFriendlyError(error: unknown): unknown;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GaxiosError } from 'gaxios';
|
|
7
|
+
export function isNodeError(error) {
|
|
8
|
+
return error instanceof Error && 'code' in error;
|
|
9
|
+
}
|
|
10
|
+
export function getErrorMessage(error) {
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
return error.message;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
return String(error);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return 'Failed to get error details';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class ForbiddenError extends Error {
|
|
22
|
+
}
|
|
23
|
+
export class UnauthorizedError extends Error {
|
|
24
|
+
}
|
|
25
|
+
export class BadRequestError extends Error {
|
|
26
|
+
}
|
|
27
|
+
export function toFriendlyError(error) {
|
|
28
|
+
if (error instanceof GaxiosError) {
|
|
29
|
+
const data = parseResponseData(error);
|
|
30
|
+
if (data.error && data.error.message && data.error.code) {
|
|
31
|
+
switch (data.error.code) {
|
|
32
|
+
case 400:
|
|
33
|
+
return new BadRequestError(data.error.message);
|
|
34
|
+
case 401:
|
|
35
|
+
return new UnauthorizedError(data.error.message);
|
|
36
|
+
case 403:
|
|
37
|
+
// It's import to pass the message here since it might
|
|
38
|
+
// explain the cause like "the cloud project you're
|
|
39
|
+
// using doesn't have code assist enabled".
|
|
40
|
+
return new ForbiddenError(data.error.message);
|
|
41
|
+
default:
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return error;
|
|
46
|
+
}
|
|
47
|
+
function parseResponseData(error) {
|
|
48
|
+
// Inexplicably, Gaxios sometimes doesn't JSONify the response data.
|
|
49
|
+
if (typeof error.response?.data === 'string') {
|
|
50
|
+
return JSON.parse(error.response?.data);
|
|
51
|
+
}
|
|
52
|
+
return typeof error.response?.data;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,6BAA6B,CAAC;IACvC,CAAC;AACH,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;CAAG;AAC5C,MAAM,OAAO,iBAAkB,SAAQ,KAAK;CAAG;AAC/C,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAS7C,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACxD,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBACxB,KAAK,GAAG;oBACN,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACjD,KAAK,GAAG;oBACN,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACnD,KAAK,GAAG;oBACN,sDAAsD;oBACtD,mDAAmD;oBACnD,2CAA2C;oBAC3C,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAChD,QAAQ;YACV,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAkB;IAC3C,oEAAoE;IACpE,IAAI,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAiB,CAAC;IAC1D,CAAC;IACD,OAAO,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAoB,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export declare class FetchError extends Error {
|
|
7
|
+
code?: string | undefined;
|
|
8
|
+
constructor(message: string, code?: string | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare function isPrivateIp(url: string): boolean;
|
|
11
|
+
export declare function fetchWithTimeout(url: string, timeout: number): Promise<Response>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { getErrorMessage, isNodeError } from './errors.js';
|
|
7
|
+
import { URL } from 'url';
|
|
8
|
+
const PRIVATE_IP_RANGES = [
|
|
9
|
+
/^10\./,
|
|
10
|
+
/^127\./,
|
|
11
|
+
/^172\.(1[6-9]|2[0-9]|3[0-1])\./,
|
|
12
|
+
/^192\.168\./,
|
|
13
|
+
/^::1$/,
|
|
14
|
+
/^fc00:/,
|
|
15
|
+
/^fe80:/,
|
|
16
|
+
];
|
|
17
|
+
export class FetchError extends Error {
|
|
18
|
+
code;
|
|
19
|
+
constructor(message, code) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.code = code;
|
|
22
|
+
this.name = 'FetchError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function isPrivateIp(url) {
|
|
26
|
+
try {
|
|
27
|
+
const hostname = new URL(url).hostname;
|
|
28
|
+
return PRIVATE_IP_RANGES.some((range) => range.test(hostname));
|
|
29
|
+
}
|
|
30
|
+
catch (_e) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function fetchWithTimeout(url, timeout) {
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (isNodeError(error) && error.code === 'ABORT_ERR') {
|
|
43
|
+
throw new FetchError(`Request timed out after ${timeout}ms`, 'ETIMEDOUT');
|
|
44
|
+
}
|
|
45
|
+
throw new FetchError(getErrorMessage(error));
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
clearTimeout(timeoutId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMapp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CAAC;QACjE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACrD,MAAM,IAAI,UAAU,CAAC,2BAA2B,OAAO,IAAI,EAAE,WAAW,CAAC,CAAC;QAC5E,CAAC;QACD,MAAM,IAAI,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { PartUnion } from '@google/genai';
|
|
7
|
+
export declare const DEFAULT_ENCODING: BufferEncoding;
|
|
8
|
+
/**
|
|
9
|
+
* Looks up the specific MIME type for a file path.
|
|
10
|
+
* @param filePath Path to the file.
|
|
11
|
+
* @returns The specific MIME type string (e.g., 'text/python', 'application/javascript') or undefined if not found or ambiguous.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSpecificMimeType(filePath: string): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a path is within a given root directory.
|
|
16
|
+
* @param pathToCheck The absolute path to check.
|
|
17
|
+
* @param rootDirectory The absolute root directory.
|
|
18
|
+
* @returns True if the path is within the root directory, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isWithinRoot(pathToCheck: string, rootDirectory: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if a file is likely binary based on content sampling.
|
|
23
|
+
* @param filePath Path to the file.
|
|
24
|
+
* @returns True if the file appears to be binary.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isBinaryFile(filePath: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Detects the type of file based on extension and content.
|
|
29
|
+
* @param filePath Path to the file.
|
|
30
|
+
* @returns 'text', 'image', 'pdf', 'audio', 'video', 'binary', or 'svg'.
|
|
31
|
+
*/
|
|
32
|
+
export declare function detectFileType(filePath: string): 'text' | 'image' | 'pdf' | 'audio' | 'video' | 'binary' | 'svg';
|
|
33
|
+
export interface ProcessedFileReadResult {
|
|
34
|
+
llmContent: PartUnion;
|
|
35
|
+
returnDisplay: string;
|
|
36
|
+
error?: string;
|
|
37
|
+
isTruncated?: boolean;
|
|
38
|
+
originalLineCount?: number;
|
|
39
|
+
linesShown?: [number, number];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reads and processes a single file, handling text, images, and PDFs.
|
|
43
|
+
* @param filePath Absolute path to the file.
|
|
44
|
+
* @param rootDirectory Absolute path to the project root for relative path display.
|
|
45
|
+
* @param offset Optional offset for text files (0-based line number).
|
|
46
|
+
* @param limit Optional limit for text files (number of lines to read).
|
|
47
|
+
* @returns ProcessedFileReadResult object.
|
|
48
|
+
*/
|
|
49
|
+
export declare function processSingleFileContent(filePath: string, rootDirectory: string, offset?: number, limit?: number): Promise<ProcessedFileReadResult>;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import mime from 'mime-types';
|
|
9
|
+
// Constants for text file processing
|
|
10
|
+
const DEFAULT_MAX_LINES_TEXT_FILE = 2000;
|
|
11
|
+
const MAX_LINE_LENGTH_TEXT_FILE = 2000;
|
|
12
|
+
// Default values for encoding and separator format
|
|
13
|
+
export const DEFAULT_ENCODING = 'utf-8';
|
|
14
|
+
/**
|
|
15
|
+
* Looks up the specific MIME type for a file path.
|
|
16
|
+
* @param filePath Path to the file.
|
|
17
|
+
* @returns The specific MIME type string (e.g., 'text/python', 'application/javascript') or undefined if not found or ambiguous.
|
|
18
|
+
*/
|
|
19
|
+
export function getSpecificMimeType(filePath) {
|
|
20
|
+
const lookedUpMime = mime.lookup(filePath);
|
|
21
|
+
return typeof lookedUpMime === 'string' ? lookedUpMime : undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a path is within a given root directory.
|
|
25
|
+
* @param pathToCheck The absolute path to check.
|
|
26
|
+
* @param rootDirectory The absolute root directory.
|
|
27
|
+
* @returns True if the path is within the root directory, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
export function isWithinRoot(pathToCheck, rootDirectory) {
|
|
30
|
+
const normalizedPathToCheck = path.resolve(pathToCheck);
|
|
31
|
+
const normalizedRootDirectory = path.resolve(rootDirectory);
|
|
32
|
+
// Ensure the rootDirectory path ends with a separator for correct startsWith comparison,
|
|
33
|
+
// unless it's the root path itself (e.g., '/' or 'C:\').
|
|
34
|
+
const rootWithSeparator = normalizedRootDirectory === path.sep ||
|
|
35
|
+
normalizedRootDirectory.endsWith(path.sep)
|
|
36
|
+
? normalizedRootDirectory
|
|
37
|
+
: normalizedRootDirectory + path.sep;
|
|
38
|
+
return (normalizedPathToCheck === normalizedRootDirectory ||
|
|
39
|
+
normalizedPathToCheck.startsWith(rootWithSeparator));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Determines if a file is likely binary based on content sampling.
|
|
43
|
+
* @param filePath Path to the file.
|
|
44
|
+
* @returns True if the file appears to be binary.
|
|
45
|
+
*/
|
|
46
|
+
export function isBinaryFile(filePath) {
|
|
47
|
+
try {
|
|
48
|
+
const fd = fs.openSync(filePath, 'r');
|
|
49
|
+
// Read up to 4KB or file size, whichever is smaller
|
|
50
|
+
const fileSize = fs.fstatSync(fd).size;
|
|
51
|
+
if (fileSize === 0) {
|
|
52
|
+
// Empty file is not considered binary for content checking
|
|
53
|
+
fs.closeSync(fd);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const bufferSize = Math.min(4096, fileSize);
|
|
57
|
+
const buffer = Buffer.alloc(bufferSize);
|
|
58
|
+
const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0);
|
|
59
|
+
fs.closeSync(fd);
|
|
60
|
+
if (bytesRead === 0)
|
|
61
|
+
return false;
|
|
62
|
+
let nonPrintableCount = 0;
|
|
63
|
+
for (let i = 0; i < bytesRead; i++) {
|
|
64
|
+
if (buffer[i] === 0)
|
|
65
|
+
return true; // Null byte is a strong indicator
|
|
66
|
+
if (buffer[i] < 9 || (buffer[i] > 13 && buffer[i] < 32)) {
|
|
67
|
+
nonPrintableCount++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// If >30% non-printable characters, consider it binary
|
|
71
|
+
return nonPrintableCount / bytesRead > 0.3;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// If any error occurs (e.g. file not found, permissions),
|
|
75
|
+
// treat as not binary here; let higher-level functions handle existence/access errors.
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Detects the type of file based on extension and content.
|
|
81
|
+
* @param filePath Path to the file.
|
|
82
|
+
* @returns 'text', 'image', 'pdf', 'audio', 'video', 'binary', or 'svg'.
|
|
83
|
+
*/
|
|
84
|
+
export function detectFileType(filePath) {
|
|
85
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
86
|
+
// The mimetype for "ts" is MPEG transport stream (a video format) but we want
|
|
87
|
+
// to assume these are typescript files instead.
|
|
88
|
+
if (ext === '.ts') {
|
|
89
|
+
return 'text';
|
|
90
|
+
}
|
|
91
|
+
if (ext === '.svg') {
|
|
92
|
+
return 'svg';
|
|
93
|
+
}
|
|
94
|
+
const lookedUpMimeType = mime.lookup(filePath); // Returns false if not found, or the mime type string
|
|
95
|
+
if (lookedUpMimeType) {
|
|
96
|
+
if (lookedUpMimeType.startsWith('image/')) {
|
|
97
|
+
return 'image';
|
|
98
|
+
}
|
|
99
|
+
if (lookedUpMimeType.startsWith('audio/')) {
|
|
100
|
+
return 'audio';
|
|
101
|
+
}
|
|
102
|
+
if (lookedUpMimeType.startsWith('video/')) {
|
|
103
|
+
return 'video';
|
|
104
|
+
}
|
|
105
|
+
if (lookedUpMimeType === 'application/pdf') {
|
|
106
|
+
return 'pdf';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Stricter binary check for common non-text extensions before content check
|
|
110
|
+
// These are often not well-covered by mime-types or might be misidentified.
|
|
111
|
+
if ([
|
|
112
|
+
'.zip',
|
|
113
|
+
'.tar',
|
|
114
|
+
'.gz',
|
|
115
|
+
'.exe',
|
|
116
|
+
'.dll',
|
|
117
|
+
'.so',
|
|
118
|
+
'.class',
|
|
119
|
+
'.jar',
|
|
120
|
+
'.war',
|
|
121
|
+
'.7z',
|
|
122
|
+
'.doc',
|
|
123
|
+
'.docx',
|
|
124
|
+
'.xls',
|
|
125
|
+
'.xlsx',
|
|
126
|
+
'.ppt',
|
|
127
|
+
'.pptx',
|
|
128
|
+
'.odt',
|
|
129
|
+
'.ods',
|
|
130
|
+
'.odp',
|
|
131
|
+
'.bin',
|
|
132
|
+
'.dat',
|
|
133
|
+
'.obj',
|
|
134
|
+
'.o',
|
|
135
|
+
'.a',
|
|
136
|
+
'.lib',
|
|
137
|
+
'.wasm',
|
|
138
|
+
'.pyc',
|
|
139
|
+
'.pyo',
|
|
140
|
+
].includes(ext)) {
|
|
141
|
+
return 'binary';
|
|
142
|
+
}
|
|
143
|
+
// Fallback to content-based check if mime type wasn't conclusive for image/pdf
|
|
144
|
+
// and it's not a known binary extension.
|
|
145
|
+
if (isBinaryFile(filePath)) {
|
|
146
|
+
return 'binary';
|
|
147
|
+
}
|
|
148
|
+
return 'text';
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reads and processes a single file, handling text, images, and PDFs.
|
|
152
|
+
* @param filePath Absolute path to the file.
|
|
153
|
+
* @param rootDirectory Absolute path to the project root for relative path display.
|
|
154
|
+
* @param offset Optional offset for text files (0-based line number).
|
|
155
|
+
* @param limit Optional limit for text files (number of lines to read).
|
|
156
|
+
* @returns ProcessedFileReadResult object.
|
|
157
|
+
*/
|
|
158
|
+
export async function processSingleFileContent(filePath, rootDirectory, offset, limit) {
|
|
159
|
+
try {
|
|
160
|
+
if (!fs.existsSync(filePath)) {
|
|
161
|
+
// Sync check is acceptable before async read
|
|
162
|
+
return {
|
|
163
|
+
llmContent: '',
|
|
164
|
+
returnDisplay: 'File not found.',
|
|
165
|
+
error: `File not found: ${filePath}`,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const stats = await fs.promises.stat(filePath);
|
|
169
|
+
if (stats.isDirectory()) {
|
|
170
|
+
return {
|
|
171
|
+
llmContent: '',
|
|
172
|
+
returnDisplay: 'Path is a directory.',
|
|
173
|
+
error: `Path is a directory, not a file: ${filePath}`,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const fileSizeInBytes = stats.size;
|
|
177
|
+
// 20MB limit
|
|
178
|
+
const maxFileSize = 20 * 1024 * 1024;
|
|
179
|
+
if (fileSizeInBytes > maxFileSize) {
|
|
180
|
+
throw new Error(`File size exceeds the 20MB limit: ${filePath} (${(fileSizeInBytes /
|
|
181
|
+
(1024 * 1024)).toFixed(2)}MB)`);
|
|
182
|
+
}
|
|
183
|
+
const fileType = detectFileType(filePath);
|
|
184
|
+
const relativePathForDisplay = path
|
|
185
|
+
.relative(rootDirectory, filePath)
|
|
186
|
+
.replace(/\\/g, '/');
|
|
187
|
+
switch (fileType) {
|
|
188
|
+
case 'binary': {
|
|
189
|
+
return {
|
|
190
|
+
llmContent: `Cannot display content of binary file: ${relativePathForDisplay}`,
|
|
191
|
+
returnDisplay: `Skipped binary file: ${relativePathForDisplay}`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case 'svg': {
|
|
195
|
+
const SVG_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
196
|
+
if (stats.size > SVG_MAX_SIZE_BYTES) {
|
|
197
|
+
return {
|
|
198
|
+
llmContent: `Cannot display content of SVG file larger than 1MB: ${relativePathForDisplay}`,
|
|
199
|
+
returnDisplay: `Skipped large SVG file (>1MB): ${relativePathForDisplay}`,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const content = await fs.promises.readFile(filePath, 'utf8');
|
|
203
|
+
return {
|
|
204
|
+
llmContent: content,
|
|
205
|
+
returnDisplay: `Read SVG as text: ${relativePathForDisplay}`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
case 'text': {
|
|
209
|
+
const content = await fs.promises.readFile(filePath, 'utf8');
|
|
210
|
+
const lines = content.split('\n');
|
|
211
|
+
const originalLineCount = lines.length;
|
|
212
|
+
const startLine = offset || 0;
|
|
213
|
+
const effectiveLimit = limit === undefined ? DEFAULT_MAX_LINES_TEXT_FILE : limit;
|
|
214
|
+
// Ensure endLine does not exceed originalLineCount
|
|
215
|
+
const endLine = Math.min(startLine + effectiveLimit, originalLineCount);
|
|
216
|
+
// Ensure selectedLines doesn't try to slice beyond array bounds if startLine is too high
|
|
217
|
+
const actualStartLine = Math.min(startLine, originalLineCount);
|
|
218
|
+
const selectedLines = lines.slice(actualStartLine, endLine);
|
|
219
|
+
let linesWereTruncatedInLength = false;
|
|
220
|
+
const formattedLines = selectedLines.map((line) => {
|
|
221
|
+
if (line.length > MAX_LINE_LENGTH_TEXT_FILE) {
|
|
222
|
+
linesWereTruncatedInLength = true;
|
|
223
|
+
return (line.substring(0, MAX_LINE_LENGTH_TEXT_FILE) + '... [truncated]');
|
|
224
|
+
}
|
|
225
|
+
return line;
|
|
226
|
+
});
|
|
227
|
+
const contentRangeTruncated = endLine < originalLineCount;
|
|
228
|
+
const isTruncated = contentRangeTruncated || linesWereTruncatedInLength;
|
|
229
|
+
let llmTextContent = '';
|
|
230
|
+
if (contentRangeTruncated) {
|
|
231
|
+
const nextOffset = endLine;
|
|
232
|
+
llmTextContent += `[File content truncated. Showing lines ${actualStartLine + 1}-${endLine} of ${originalLineCount}. To read the next chunk, use offset: ${nextOffset}, limit: ${effectiveLimit}.]\n`;
|
|
233
|
+
}
|
|
234
|
+
else if (linesWereTruncatedInLength) {
|
|
235
|
+
llmTextContent += `[File content partially truncated: some lines exceeded maximum length of ${MAX_LINE_LENGTH_TEXT_FILE} characters.]\n`;
|
|
236
|
+
}
|
|
237
|
+
llmTextContent += formattedLines.join('\n');
|
|
238
|
+
return {
|
|
239
|
+
llmContent: llmTextContent,
|
|
240
|
+
returnDisplay: isTruncated ? '(truncated)' : '',
|
|
241
|
+
isTruncated,
|
|
242
|
+
originalLineCount,
|
|
243
|
+
linesShown: [actualStartLine + 1, endLine],
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
case 'image':
|
|
247
|
+
case 'pdf':
|
|
248
|
+
case 'audio':
|
|
249
|
+
case 'video': {
|
|
250
|
+
const contentBuffer = await fs.promises.readFile(filePath);
|
|
251
|
+
const base64Data = contentBuffer.toString('base64');
|
|
252
|
+
const mimeType = mime.lookup(filePath) || 'application/octet-stream';
|
|
253
|
+
return {
|
|
254
|
+
llmContent: {
|
|
255
|
+
inlineData: {
|
|
256
|
+
data: base64Data,
|
|
257
|
+
mimeType,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
returnDisplay: `Read ${fileType} file: ${relativePathForDisplay}`,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
default: {
|
|
264
|
+
// Should not happen with current detectFileType logic
|
|
265
|
+
const exhaustiveCheck = fileType;
|
|
266
|
+
return {
|
|
267
|
+
llmContent: `Unhandled file type: ${exhaustiveCheck}`,
|
|
268
|
+
returnDisplay: `Skipped unhandled file type: ${relativePathForDisplay}`,
|
|
269
|
+
error: `Unhandled file type for ${filePath}`,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
276
|
+
const displayPath = path
|
|
277
|
+
.relative(rootDirectory, filePath)
|
|
278
|
+
.replace(/\\/g, '/');
|
|
279
|
+
return {
|
|
280
|
+
llmContent: `Error reading file ${displayPath}: ${errorMessage}`,
|
|
281
|
+
returnDisplay: `Error reading file ${displayPath}: ${errorMessage}`,
|
|
282
|
+
error: `Error reading file ${filePath}: ${errorMessage}`,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=fileUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,IAAI,MAAM,YAAY,CAAC;AAE9B,qCAAqC;AACrC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AACzC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAmB,OAAO,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,WAAmB,EACnB,aAAqB;IAErB,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5D,yFAAyF;IACzF,yDAAyD;IACzD,MAAM,iBAAiB,GACrB,uBAAuB,KAAK,IAAI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