@hibanacloud/core 0.3.15
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 +19 -0
- package/dist/index.js +20 -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 +12 -0
- package/dist/src/code_assist/codeAssist.js +31 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +74 -0
- package/dist/src/code_assist/converter.js +160 -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 +372 -0
- package/dist/src/code_assist/converter.test.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.d.ts +25 -0
- package/dist/src/code_assist/oauth-credential-storage.js +109 -0
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +6 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js +136 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +22 -0
- package/dist/src/code_assist/oauth2.js +431 -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 +818 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -0
- package/dist/src/code_assist/server.d.ts +37 -0
- package/dist/src/code_assist/server.js +148 -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 +159 -0
- package/dist/src/code_assist/server.test.js.map +1 -0
- package/dist/src/code_assist/setup.d.ts +20 -0
- package/dist/src/code_assist/setup.js +101 -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 +171 -0
- package/dist/src/code_assist/setup.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +163 -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 +431 -0
- package/dist/src/config/config.js +869 -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 +896 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/constants.d.ts +11 -0
- package/dist/src/config/constants.js +16 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/flashFallback.test.d.ts +6 -0
- package/dist/src/config/flashFallback.test.js +87 -0
- package/dist/src/config/flashFallback.test.js.map +1 -0
- package/dist/src/config/models.d.ts +28 -0
- package/dist/src/config/models.js +42 -0
- package/dist/src/config/models.js.map +1 -0
- package/dist/src/config/models.test.d.ts +6 -0
- package/dist/src/config/models.test.js +55 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +34 -0
- package/dist/src/config/storage.js +95 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/config/storage.test.d.ts +6 -0
- package/dist/src/config/storage.test.js +43 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.d.ts +6 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.js +295 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.js.map +1 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.d.ts +64 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.js +122 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +49 -0
- package/dist/src/core/baseLlmClient.js +104 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/baseLlmClient.test.d.ts +6 -0
- package/dist/src/core/baseLlmClient.test.js +323 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +56 -0
- package/dist/src/core/client.js +522 -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 +1829 -0
- package/dist/src/core/client.test.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +52 -0
- package/dist/src/core/contentGenerator.js +106 -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 +77 -0
- package/dist/src/core/contentGenerator.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +134 -0
- package/dist/src/core/coreToolScheduler.js +774 -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 +1802 -0
- package/dist/src/core/coreToolScheduler.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +124 -0
- package/dist/src/core/geminiChat.js +518 -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 +1149 -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 +11 -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 +73 -0
- package/dist/src/core/geminiRequest.test.js.map +1 -0
- package/dist/src/core/logger.d.ts +67 -0
- package/dist/src/core/logger.js +361 -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 +534 -0
- package/dist/src/core/logger.test.js.map +1 -0
- package/dist/src/core/loggingContentGenerator.d.ts +25 -0
- package/dist/src/core/loggingContentGenerator.js +94 -0
- package/dist/src/core/loggingContentGenerator.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +16 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +29 -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 +294 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/constants.d.ts +7 -0
- package/dist/src/core/openaiContentGenerator/constants.js +8 -0
- package/dist/src/core/openaiContentGenerator/constants.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/converter.d.ts +108 -0
- package/dist/src/core/openaiContentGenerator/converter.js +851 -0
- package/dist/src/core/openaiContentGenerator/converter.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/converter.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/converter.test.js +108 -0
- package/dist/src/core/openaiContentGenerator/converter.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.d.ts +20 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.js +82 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.js +287 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/index.d.ts +22 -0
- package/dist/src/core/openaiContentGenerator/index.js +49 -0
- package/dist/src/core/openaiContentGenerator/index.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.d.ts +21 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.js +105 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.js +230 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/pipeline.d.ts +66 -0
- package/dist/src/core/openaiContentGenerator/pipeline.js +265 -0
- package/dist/src/core/openaiContentGenerator/pipeline.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.js +1028 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/README.md +61 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.d.ts +14 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.js +28 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.d.ts +1 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.js +138 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.d.ts +63 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.js +241 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.js +707 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.d.ts +14 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.js +70 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.js +151 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/default.d.ts +15 -0
- package/dist/src/core/openaiContentGenerator/provider/default.js +48 -0
- package/dist/src/core/openaiContentGenerator/provider/default.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.js +176 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/index.d.ts +7 -0
- package/dist/src/core/openaiContentGenerator/provider/index.js +7 -0
- package/dist/src/core/openaiContentGenerator/provider/index.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.d.ts +17 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.js +25 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.js +66 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.d.ts +10 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.js +33 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.js +175 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/types.d.ts +23 -0
- package/dist/src/core/openaiContentGenerator/provider/types.js +2 -0
- package/dist/src/core/openaiContentGenerator/provider/types.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.d.ts +145 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.js +381 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.js +537 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.d.ts +36 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.js +150 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.js +978 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.js.map +1 -0
- package/dist/src/core/prompts.d.ts +73 -0
- package/dist/src/core/prompts.js +813 -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 +488 -0
- package/dist/src/core/prompts.test.js.map +1 -0
- package/dist/src/core/tokenLimits.d.ts +25 -0
- package/dist/src/core/tokenLimits.js +194 -0
- package/dist/src/core/tokenLimits.js.map +1 -0
- package/dist/src/core/tokenLimits.test.d.ts +1 -0
- package/dist/src/core/tokenLimits.test.js +304 -0
- package/dist/src/core/tokenLimits.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +152 -0
- package/dist/src/core/turn.js +187 -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 +628 -0
- package/dist/src/core/turn.test.js.map +1 -0
- package/dist/src/fallback/handler.d.ts +7 -0
- package/dist/src/fallback/handler.js +97 -0
- package/dist/src/fallback/handler.js.map +1 -0
- package/dist/src/fallback/handler.test.d.ts +6 -0
- package/dist/src/fallback/handler.test.js +130 -0
- package/dist/src/fallback/handler.test.js.map +1 -0
- package/dist/src/fallback/types.d.ts +14 -0
- package/dist/src/fallback/types.js +7 -0
- package/dist/src/fallback/types.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +7 -0
- package/dist/src/generated/git-commit.js +10 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/ide/constants.d.ts +9 -0
- package/dist/src/ide/constants.js +10 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +56 -0
- package/dist/src/ide/detect-ide.js +68 -0
- package/dist/src/ide/detect-ide.js.map +1 -0
- package/dist/src/ide/detect-ide.test.d.ts +6 -0
- package/dist/src/ide/detect-ide.test.js +113 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +110 -0
- package/dist/src/ide/ide-client.js +651 -0
- package/dist/src/ide/ide-client.js.map +1 -0
- package/dist/src/ide/ide-client.test.d.ts +6 -0
- package/dist/src/ide/ide-client.test.js +390 -0
- package/dist/src/ide/ide-client.test.js.map +1 -0
- package/dist/src/ide/ide-installer.d.ts +14 -0
- package/dist/src/ide/ide-installer.js +112 -0
- package/dist/src/ide/ide-installer.js.map +1 -0
- package/dist/src/ide/ide-installer.test.d.ts +6 -0
- package/dist/src/ide/ide-installer.test.js +134 -0
- package/dist/src/ide/ide-installer.test.js.map +1 -0
- package/dist/src/ide/ideContext.d.ts +44 -0
- package/dist/src/ide/ideContext.js +101 -0
- package/dist/src/ide/ideContext.js.map +1 -0
- package/dist/src/ide/ideContext.test.d.ts +6 -0
- package/dist/src/ide/ideContext.test.js +393 -0
- package/dist/src/ide/ideContext.test.js.map +1 -0
- package/dist/src/ide/process-utils.d.ts +21 -0
- package/dist/src/ide/process-utils.js +171 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +158 -0
- package/dist/src/ide/process-utils.test.js.map +1 -0
- package/dist/src/ide/types.d.ts +486 -0
- package/dist/src/ide/types.js +138 -0
- package/dist/src/ide/types.js.map +1 -0
- package/dist/src/index.d.ts +99 -0
- package/dist/src/index.js +112 -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/mcp/google-auth-provider.d.ts +23 -0
- package/dist/src/mcp/google-auth-provider.js +72 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
- package/dist/src/mcp/google-auth-provider.test.js +89 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +150 -0
- package/dist/src/mcp/oauth-provider.js +613 -0
- package/dist/src/mcp/oauth-provider.js.map +1 -0
- package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
- package/dist/src/mcp/oauth-provider.test.js +847 -0
- package/dist/src/mcp/oauth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.d.ts +65 -0
- package/dist/src/mcp/oauth-token-storage.js +180 -0
- package/dist/src/mcp/oauth-token-storage.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/oauth-token-storage.test.js +299 -0
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
- package/dist/src/mcp/oauth-utils.d.ts +119 -0
- package/dist/src/mcp/oauth-utils.js +236 -0
- package/dist/src/mcp/oauth-utils.js.map +1 -0
- package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
- package/dist/src/mcp/oauth-utils.test.js +199 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
- package/dist/src/mcp/sa-impersonation-provider.js +130 -0
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
- package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
- package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.d.ts +24 -0
- package/dist/src/mcp/token-storage/file-token-storage.js +144 -0
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js +235 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +23 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +78 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +193 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/index.d.ts +11 -0
- package/dist/src/mcp/token-storage/index.js +12 -0
- package/dist/src/mcp/token-storage/index.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +31 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +190 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +254 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +38 -0
- package/dist/src/mcp/token-storage/types.js +11 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -0
- package/dist/src/mocks/msw.d.ts +6 -0
- package/dist/src/mocks/msw.js +8 -0
- package/dist/src/mocks/msw.js.map +1 -0
- package/dist/src/oauth/callbackServer.d.ts +15 -0
- package/dist/src/oauth/callbackServer.js +89 -0
- package/dist/src/oauth/callbackServer.js.map +1 -0
- package/dist/src/oauth/oauthClient.d.ts +57 -0
- package/dist/src/oauth/oauthClient.js +233 -0
- package/dist/src/oauth/oauthClient.js.map +1 -0
- package/dist/src/oauth/pkce.d.ts +25 -0
- package/dist/src/oauth/pkce.js +45 -0
- package/dist/src/oauth/pkce.js.map +1 -0
- package/dist/src/oauth/tokenManager.d.ts +37 -0
- package/dist/src/oauth/tokenManager.js +110 -0
- package/dist/src/oauth/tokenManager.js.map +1 -0
- package/dist/src/output/json-formatter.d.ts +11 -0
- package/dist/src/output/json-formatter.js +30 -0
- package/dist/src/output/json-formatter.js.map +1 -0
- package/dist/src/output/json-formatter.test.d.ts +6 -0
- package/dist/src/output/json-formatter.test.js +266 -0
- package/dist/src/output/json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +25 -0
- package/dist/src/output/types.js +17 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +8 -0
- package/dist/src/prompts/mcp-prompts.js +13 -0
- package/dist/src/prompts/mcp-prompts.js.map +1 -0
- package/dist/src/prompts/prompt-registry.d.ts +34 -0
- package/dist/src/prompts/prompt-registry.js +63 -0
- package/dist/src/prompts/prompt-registry.js.map +1 -0
- package/dist/src/qwen/qwenContentGenerator.d.ts +70 -0
- package/dist/src/qwen/qwenContentGenerator.js +180 -0
- package/dist/src/qwen/qwenContentGenerator.js.map +1 -0
- package/dist/src/qwen/qwenContentGenerator.test.d.ts +6 -0
- package/dist/src/qwen/qwenContentGenerator.test.js +1178 -0
- package/dist/src/qwen/qwenContentGenerator.test.js.map +1 -0
- package/dist/src/qwen/qwenOAuth2.d.ts +194 -0
- package/dist/src/qwen/qwenOAuth2.js +594 -0
- package/dist/src/qwen/qwenOAuth2.js.map +1 -0
- package/dist/src/qwen/qwenOAuth2.test.d.ts +6 -0
- package/dist/src/qwen/qwenOAuth2.test.js +1724 -0
- package/dist/src/qwen/qwenOAuth2.test.js.map +1 -0
- package/dist/src/qwen/sharedTokenManager.d.ts +196 -0
- package/dist/src/qwen/sharedTokenManager.js +647 -0
- package/dist/src/qwen/sharedTokenManager.js.map +1 -0
- package/dist/src/qwen/sharedTokenManager.test.d.ts +7 -0
- package/dist/src/qwen/sharedTokenManager.test.js +662 -0
- package/dist/src/qwen/sharedTokenManager.test.js.map +1 -0
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +180 -0
- package/dist/src/services/chatCompressionService.js.map +1 -0
- package/dist/src/services/chatCompressionService.test.d.ts +6 -0
- package/dist/src/services/chatCompressionService.test.js +292 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +144 -0
- package/dist/src/services/chatRecordingService.js +330 -0
- package/dist/src/services/chatRecordingService.js.map +1 -0
- package/dist/src/services/chatRecordingService.test.d.ts +6 -0
- package/dist/src/services/chatRecordingService.test.js +332 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.d.ts +45 -0
- package/dist/src/services/fileDiscoveryService.js +104 -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 +143 -0
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
- package/dist/src/services/fileSystemService.d.ts +40 -0
- package/dist/src/services/fileSystemService.js +29 -0
- package/dist/src/services/fileSystemService.js.map +1 -0
- package/dist/src/services/fileSystemService.test.d.ts +6 -0
- package/dist/src/services/fileSystemService.test.js +41 -0
- package/dist/src/services/fileSystemService.test.js.map +1 -0
- package/dist/src/services/gitService.d.ts +22 -0
- package/dist/src/services/gitService.js +98 -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 +187 -0
- package/dist/src/services/gitService.test.js.map +1 -0
- package/dist/src/services/loopDetectionService.d.ts +103 -0
- package/dist/src/services/loopDetectionService.js +379 -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 +588 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +102 -0
- package/dist/src/services/shellExecutionService.js +522 -0
- package/dist/src/services/shellExecutionService.js.map +1 -0
- package/dist/src/services/shellExecutionService.test.d.ts +6 -0
- package/dist/src/services/shellExecutionService.test.js +655 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -0
- package/dist/src/subagents/builtin-agents.d.ts +35 -0
- package/dist/src/subagents/builtin-agents.js +85 -0
- package/dist/src/subagents/builtin-agents.js.map +1 -0
- package/dist/src/subagents/builtin-agents.test.d.ts +6 -0
- package/dist/src/subagents/builtin-agents.test.js +78 -0
- package/dist/src/subagents/builtin-agents.test.js.map +1 -0
- package/dist/src/subagents/index.d.ts +29 -0
- package/dist/src/subagents/index.js +15 -0
- package/dist/src/subagents/index.js.map +1 -0
- package/dist/src/subagents/subagent-events.d.ts +95 -0
- package/dist/src/subagents/subagent-events.js +31 -0
- package/dist/src/subagents/subagent-events.js.map +1 -0
- package/dist/src/subagents/subagent-hooks.d.ts +29 -0
- package/dist/src/subagents/subagent-hooks.js +7 -0
- package/dist/src/subagents/subagent-hooks.js.map +1 -0
- package/dist/src/subagents/subagent-manager.d.ts +170 -0
- package/dist/src/subagents/subagent-manager.js +596 -0
- package/dist/src/subagents/subagent-manager.js.map +1 -0
- package/dist/src/subagents/subagent-manager.test.d.ts +6 -0
- package/dist/src/subagents/subagent-manager.test.js +822 -0
- package/dist/src/subagents/subagent-manager.test.js.map +1 -0
- package/dist/src/subagents/subagent-statistics.d.ts +46 -0
- package/dist/src/subagents/subagent-statistics.js +193 -0
- package/dist/src/subagents/subagent-statistics.js.map +1 -0
- package/dist/src/subagents/subagent-statistics.test.d.ts +6 -0
- package/dist/src/subagents/subagent-statistics.test.js +231 -0
- package/dist/src/subagents/subagent-statistics.test.js.map +1 -0
- package/dist/src/subagents/subagent.d.ts +162 -0
- package/dist/src/subagents/subagent.js +677 -0
- package/dist/src/subagents/subagent.js.map +1 -0
- package/dist/src/subagents/subagent.test.d.ts +6 -0
- package/dist/src/subagents/subagent.test.js +477 -0
- package/dist/src/subagents/subagent.test.js.map +1 -0
- package/dist/src/subagents/types.d.ts +218 -0
- package/dist/src/subagents/types.js +58 -0
- package/dist/src/subagents/types.js.map +1 -0
- package/dist/src/subagents/types.test.d.ts +6 -0
- package/dist/src/subagents/types.test.js +31 -0
- package/dist/src/subagents/types.test.js.map +1 -0
- package/dist/src/subagents/validation.d.ts +63 -0
- package/dist/src/subagents/validation.js +293 -0
- package/dist/src/subagents/validation.js.map +1 -0
- package/dist/src/subagents/validation.test.d.ts +6 -0
- package/dist/src/subagents/validation.test.js +330 -0
- package/dist/src/subagents/validation.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +137 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +915 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +18 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +594 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +115 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +291 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
- package/dist/src/telemetry/config.d.ts +31 -0
- package/dist/src/telemetry/config.js +76 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/config.test.d.ts +6 -0
- package/dist/src/telemetry/config.test.js +124 -0
- package/dist/src/telemetry/config.test.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +36 -0
- package/dist/src/telemetry/constants.js +38 -0
- package/dist/src/telemetry/constants.js.map +1 -0
- package/dist/src/telemetry/file-exporters.d.ts +29 -0
- package/dist/src/telemetry/file-exporters.js +62 -0
- package/dist/src/telemetry/file-exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +25 -0
- package/dist/src/telemetry/index.js +31 -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 +95 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +37 -0
- package/dist/src/telemetry/loggers.js +651 -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 +107 -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 +978 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +320 -0
- package/dist/src/telemetry/metrics.js +532 -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 +744 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/event-types.d.ts +88 -0
- package/dist/src/telemetry/qwen-logger/event-types.js +2 -0
- package/dist/src/telemetry/qwen-logger/event-types.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.d.ts +91 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.js +685 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.d.ts +6 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.js +317 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -0
- package/dist/src/telemetry/sdk.js +164 -0
- package/dist/src/telemetry/sdk.js.map +1 -0
- package/dist/src/telemetry/sdk.test.d.ts +6 -0
- package/dist/src/telemetry/sdk.test.js +116 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.js +14 -0
- package/dist/src/telemetry/telemetry-utils.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.test.js +40 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry.test.js +50 -0
- package/dist/src/telemetry/telemetry.test.js.map +1 -0
- package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
- package/dist/src/telemetry/tool-call-decision.js +29 -0
- package/dist/src/telemetry/tool-call-decision.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +327 -0
- package/dist/src/telemetry/types.js +558 -0
- package/dist/src/telemetry/types.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.d.ts +75 -0
- package/dist/src/telemetry/uiTelemetry.js +152 -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 +625 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
- package/dist/src/test-utils/config.d.ts +17 -0
- package/dist/src/test-utils/config.js +32 -0
- package/dist/src/test-utils/config.js.map +1 -0
- package/dist/src/test-utils/index.d.ts +6 -0
- package/dist/src/test-utils/index.js +7 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/mock-tool.d.ts +66 -0
- package/dist/src/test-utils/mock-tool.js +121 -0
- package/dist/src/test-utils/mock-tool.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
- package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
- package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +9 -0
- package/dist/src/tools/diffOptions.js +46 -0
- package/dist/src/tools/diffOptions.js.map +1 -0
- package/dist/src/tools/diffOptions.test.d.ts +6 -0
- package/dist/src/tools/diffOptions.test.js +155 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +55 -0
- package/dist/src/tools/edit.js +421 -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 +684 -0
- package/dist/src/tools/edit.test.js.map +1 -0
- package/dist/src/tools/exitPlanMode.d.ts +28 -0
- package/dist/src/tools/exitPlanMode.js +132 -0
- package/dist/src/tools/exitPlanMode.js.map +1 -0
- package/dist/src/tools/exitPlanMode.test.d.ts +6 -0
- package/dist/src/tools/exitPlanMode.test.js +178 -0
- package/dist/src/tools/exitPlanMode.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +44 -0
- package/dist/src/tools/glob.js +190 -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 +442 -0
- package/dist/src/tools/glob.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +44 -0
- package/dist/src/tools/grep.js +425 -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 +360 -0
- package/dist/src/tools/grep.test.js.map +1 -0
- package/dist/src/tools/ls.d.ts +68 -0
- package/dist/src/tools/ls.js +215 -0
- package/dist/src/tools/ls.js.map +1 -0
- package/dist/src/tools/ls.test.d.ts +6 -0
- package/dist/src/tools/ls.test.js +249 -0
- package/dist/src/tools/ls.test.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.d.ts +40 -0
- package/dist/src/tools/mcp-client-manager.js +83 -0
- package/dist/src/tools/mcp-client-manager.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
- package/dist/src/tools/mcp-client-manager.test.js +58 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
- package/dist/src/tools/mcp-client.d.ts +189 -0
- package/dist/src/tools/mcp-client.js +957 -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 +309 -0
- package/dist/src/tools/mcp-client.test.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +24 -0
- package/dist/src/tools/mcp-tool.js +268 -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 +714 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +41 -0
- package/dist/src/tools/memoryTool.js +396 -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 +419 -0
- package/dist/src/tools/memoryTool.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +32 -0
- package/dist/src/tools/modifiable-tool.js +88 -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 +193 -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 +124 -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 +339 -0
- package/dist/src/tools/read-file.test.js.map +1 -0
- package/dist/src/tools/read-many-files.d.ts +60 -0
- package/dist/src/tools/read-many-files.js +391 -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 +566 -0
- package/dist/src/tools/read-many-files.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +44 -0
- package/dist/src/tools/ripGrep.js +233 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/ripGrep.test.d.ts +6 -0
- package/dist/src/tools/ripGrep.test.js +529 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +33 -0
- package/dist/src/tools/shell.js +388 -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 +566 -0
- package/dist/src/tools/shell.test.js.map +1 -0
- package/dist/src/tools/smart-edit.d.ts +91 -0
- package/dist/src/tools/smart-edit.js +703 -0
- package/dist/src/tools/smart-edit.js.map +1 -0
- package/dist/src/tools/smart-edit.test.d.ts +6 -0
- package/dist/src/tools/smart-edit.test.js +542 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/task.d.ts +59 -0
- package/dist/src/tools/task.js +412 -0
- package/dist/src/tools/task.js.map +1 -0
- package/dist/src/tools/task.test.d.ts +6 -0
- package/dist/src/tools/task.test.js +369 -0
- package/dist/src/tools/task.test.js.map +1 -0
- package/dist/src/tools/todoWrite.d.ts +42 -0
- package/dist/src/tools/todoWrite.js +407 -0
- package/dist/src/tools/todoWrite.js.map +1 -0
- package/dist/src/tools/todoWrite.test.d.ts +6 -0
- package/dist/src/tools/todoWrite.test.js +234 -0
- package/dist/src/tools/todoWrite.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +45 -0
- package/dist/src/tools/tool-error.js +61 -0
- package/dist/src/tools/tool-error.js.map +1 -0
- package/dist/src/tools/tool-names.d.ts +56 -0
- package/dist/src/tools/tool-names.js +62 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +87 -0
- package/dist/src/tools/tool-registry.js +370 -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 +332 -0
- package/dist/src/tools/tool-registry.test.js.map +1 -0
- package/dist/src/tools/tools.d.ts +327 -0
- package/dist/src/tools/tools.js +258 -0
- package/dist/src/tools/tools.js.map +1 -0
- package/dist/src/tools/tools.test.d.ts +6 -0
- package/dist/src/tools/tools.test.js +205 -0
- package/dist/src/tools/tools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +31 -0
- package/dist/src/tools/web-fetch.js +163 -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 +133 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -0
- package/dist/src/tools/web-search/base-provider.d.ts +31 -0
- package/dist/src/tools/web-search/base-provider.js +34 -0
- package/dist/src/tools/web-search/base-provider.js.map +1 -0
- package/dist/src/tools/web-search/index.d.ts +24 -0
- package/dist/src/tools/web-search/index.js +245 -0
- package/dist/src/tools/web-search/index.js.map +1 -0
- package/dist/src/tools/web-search/index.test.d.ts +6 -0
- package/dist/src/tools/web-search/index.test.js +237 -0
- package/dist/src/tools/web-search/index.test.js.map +1 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.d.ts +23 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.js +120 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.js.map +1 -0
- package/dist/src/tools/web-search/providers/google-provider.d.ts +17 -0
- package/dist/src/tools/web-search/providers/google-provider.js +55 -0
- package/dist/src/tools/web-search/providers/google-provider.js.map +1 -0
- package/dist/src/tools/web-search/providers/tavily-provider.d.ts +17 -0
- package/dist/src/tools/web-search/providers/tavily-provider.js +54 -0
- package/dist/src/tools/web-search/providers/tavily-provider.js.map +1 -0
- package/dist/src/tools/web-search/types.d.ts +138 -0
- package/dist/src/tools/web-search/types.js +7 -0
- package/dist/src/tools/web-search/types.js.map +1 -0
- package/dist/src/tools/web-search/utils.d.ts +28 -0
- package/dist/src/tools/web-search/utils.js +35 -0
- package/dist/src/tools/web-search/utils.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +52 -0
- package/dist/src/tools/write-file.js +293 -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 +516 -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 +24 -0
- package/dist/src/utils/bfsFileSearch.js +95 -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 +163 -0
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
- package/dist/src/utils/browser.d.ts +13 -0
- package/dist/src/utils/browser.js +50 -0
- package/dist/src/utils/browser.js.map +1 -0
- package/dist/src/utils/editHelper.d.ts +53 -0
- package/dist/src/utils/editHelper.js +359 -0
- package/dist/src/utils/editHelper.js.map +1 -0
- package/dist/src/utils/editHelper.test.d.ts +6 -0
- package/dist/src/utils/editHelper.test.js +93 -0
- package/dist/src/utils/editHelper.test.js.map +1 -0
- package/dist/src/utils/editor.d.ts +28 -0
- package/dist/src/utils/editor.js +177 -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 +437 -0
- package/dist/src/utils/editor.test.js.map +1 -0
- package/dist/src/utils/environmentContext.d.ts +22 -0
- package/dist/src/utils/environmentContext.js +108 -0
- package/dist/src/utils/environmentContext.js.map +1 -0
- package/dist/src/utils/environmentContext.test.d.ts +6 -0
- package/dist/src/utils/environmentContext.test.js +219 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -0
- package/dist/src/utils/errorParsing.d.ts +8 -0
- package/dist/src/utils/errorParsing.js +93 -0
- package/dist/src/utils/errorParsing.js.map +1 -0
- package/dist/src/utils/errorParsing.test.d.ts +6 -0
- package/dist/src/utils/errorParsing.test.js +172 -0
- package/dist/src/utils/errorParsing.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 +130 -0
- package/dist/src/utils/errorReporting.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +39 -0
- package/dist/src/utils/errors.js +96 -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 +69 -0
- package/dist/src/utils/fileUtils.js +426 -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 +685 -0
- package/dist/src/utils/fileUtils.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
- package/dist/src/utils/filesearch/crawlCache.js +57 -0
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
- package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.d.ts +15 -0
- package/dist/src/utils/filesearch/crawler.js +50 -0
- package/dist/src/utils/filesearch/crawler.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawler.test.js +468 -0
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.d.ts +38 -0
- package/dist/src/utils/filesearch/fileSearch.js +191 -0
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
- package/dist/src/utils/filesearch/fileSearch.test.js +642 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.d.ts +42 -0
- package/dist/src/utils/filesearch/ignore.js +106 -0
- package/dist/src/utils/filesearch/ignore.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
- package/dist/src/utils/filesearch/ignore.test.js +144 -0
- package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
- package/dist/src/utils/filesearch/result-cache.js +59 -0
- package/dist/src/utils/filesearch/result-cache.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/result-cache.test.js +46 -0
- package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
- package/dist/src/utils/flashFallback.test.d.ts +6 -0
- package/dist/src/utils/flashFallback.test.js +122 -0
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- package/dist/src/utils/formatters.d.ts +6 -0
- package/dist/src/utils/formatters.js +16 -0
- package/dist/src/utils/formatters.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +13 -0
- package/dist/src/utils/generateContentResponseUtilities.js +80 -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 +235 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.d.ts +31 -0
- package/dist/src/utils/getFolderStructure.js +246 -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 +282 -0
- package/dist/src/utils/getFolderStructure.test.js.map +1 -0
- package/dist/src/utils/getPty.d.ts +19 -0
- package/dist/src/utils/getPty.js +23 -0
- package/dist/src/utils/getPty.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.d.ts +16 -0
- package/dist/src/utils/gitIgnoreParser.js +152 -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 +185 -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/ignorePatterns.d.ts +103 -0
- package/dist/src/utils/ignorePatterns.js +220 -0
- package/dist/src/utils/ignorePatterns.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
- package/dist/src/utils/ignorePatterns.test.js +250 -0
- package/dist/src/utils/ignorePatterns.test.js.map +1 -0
- package/dist/src/utils/installationManager.d.ts +16 -0
- package/dist/src/utils/installationManager.js +50 -0
- package/dist/src/utils/installationManager.js.map +1 -0
- package/dist/src/utils/installationManager.test.d.ts +6 -0
- package/dist/src/utils/installationManager.test.js +83 -0
- package/dist/src/utils/installationManager.test.js.map +1 -0
- package/dist/src/utils/language-detection.d.ts +6 -0
- package/dist/src/utils/language-detection.js +101 -0
- package/dist/src/utils/language-detection.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.d.ts +26 -0
- package/dist/src/utils/llm-edit-fixer.js +131 -0
- package/dist/src/utils/llm-edit-fixer.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.test.d.ts +6 -0
- package/dist/src/utils/llm-edit-fixer.test.js +186 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +16 -0
- package/dist/src/utils/memoryDiscovery.js +272 -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 +244 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
- package/dist/src/utils/memoryImportProcessor.js +284 -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 +587 -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 +97 -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 +181 -0
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
- package/dist/src/utils/openaiLogger.d.ts +42 -0
- package/dist/src/utils/openaiLogger.js +138 -0
- package/dist/src/utils/openaiLogger.js.map +1 -0
- package/dist/src/utils/openaiLogger.test.d.ts +6 -0
- package/dist/src/utils/openaiLogger.test.js +304 -0
- package/dist/src/utils/openaiLogger.test.js.map +1 -0
- package/dist/src/utils/partUtils.d.ts +35 -0
- package/dist/src/utils/partUtils.js +133 -0
- package/dist/src/utils/partUtils.js.map +1 -0
- package/dist/src/utils/partUtils.test.d.ts +6 -0
- package/dist/src/utils/partUtils.test.js +241 -0
- package/dist/src/utils/partUtils.test.js.map +1 -0
- package/dist/src/utils/pathReader.d.ts +17 -0
- package/dist/src/utils/pathReader.js +92 -0
- package/dist/src/utils/pathReader.js.map +1 -0
- package/dist/src/utils/pathReader.test.d.ts +6 -0
- package/dist/src/utils/pathReader.test.js +365 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +93 -0
- package/dist/src/utils/paths.js +229 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/paths.test.d.ts +6 -0
- package/dist/src/utils/paths.test.js +438 -0
- package/dist/src/utils/paths.test.js.map +1 -0
- package/dist/src/utils/projectSummary.d.ts +22 -0
- package/dist/src/utils/projectSummary.js +86 -0
- package/dist/src/utils/projectSummary.js.map +1 -0
- package/dist/src/utils/promptIdContext.d.ts +7 -0
- package/dist/src/utils/promptIdContext.js +8 -0
- package/dist/src/utils/promptIdContext.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +20 -0
- package/dist/src/utils/quotaErrorDetection.js +114 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.test.d.ts +6 -0
- package/dist/src/utils/quotaErrorDetection.test.js +153 -0
- package/dist/src/utils/quotaErrorDetection.test.js.map +1 -0
- package/dist/src/utils/qwenIgnoreParser.d.ts +18 -0
- package/dist/src/utils/qwenIgnoreParser.js +69 -0
- package/dist/src/utils/qwenIgnoreParser.js.map +1 -0
- package/dist/src/utils/qwenIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/qwenIgnoreParser.test.js +50 -0
- package/dist/src/utils/qwenIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.d.ts +112 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.js +401 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.js +114 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/index.d.ts +18 -0
- package/dist/src/utils/request-tokenizer/index.js +30 -0
- package/dist/src/utils/request-tokenizer/index.js.map +1 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.d.ts +56 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.js +263 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.js +245 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.d.ts +30 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.js +41 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.js.map +1 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.d.ts +29 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.js +88 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.js +253 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/types.d.ts +55 -0
- package/dist/src/utils/request-tokenizer/types.js +7 -0
- package/dist/src/utils/request-tokenizer/types.js.map +1 -0
- package/dist/src/utils/retry.d.ts +32 -0
- package/dist/src/utils/retry.js +303 -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 +474 -0
- package/dist/src/utils/retry.test.js.map +1 -0
- package/dist/src/utils/ripgrepUtils.d.ts +61 -0
- package/dist/src/utils/ripgrepUtils.js +230 -0
- package/dist/src/utils/ripgrepUtils.js.map +1 -0
- package/dist/src/utils/ripgrepUtils.test.d.ts +6 -0
- package/dist/src/utils/ripgrepUtils.test.js +101 -0
- package/dist/src/utils/ripgrepUtils.test.js.map +1 -0
- package/dist/src/utils/safeJsonParse.d.ts +15 -0
- package/dist/src/utils/safeJsonParse.js +41 -0
- package/dist/src/utils/safeJsonParse.js.map +1 -0
- package/dist/src/utils/safeJsonParse.test.d.ts +6 -0
- package/dist/src/utils/safeJsonParse.test.js +112 -0
- package/dist/src/utils/safeJsonParse.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 +15 -0
- package/dist/src/utils/schemaValidator.js +67 -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 +113 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
- package/dist/src/utils/secure-browser-launcher.js +165 -0
- package/dist/src/utils/secure-browser-launcher.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
- package/dist/src/utils/secure-browser-launcher.test.js +149 -0
- package/dist/src/utils/secure-browser-launcher.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/shell-utils.d.ts +152 -0
- package/dist/src/utils/shell-utils.js +467 -0
- package/dist/src/utils/shell-utils.js.map +1 -0
- package/dist/src/utils/shell-utils.test.d.ts +6 -0
- package/dist/src/utils/shell-utils.test.js +351 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -0
- package/dist/src/utils/shellReadOnlyChecker.d.ts +6 -0
- package/dist/src/utils/shellReadOnlyChecker.js +247 -0
- package/dist/src/utils/shellReadOnlyChecker.js.map +1 -0
- package/dist/src/utils/shellReadOnlyChecker.test.d.ts +6 -0
- package/dist/src/utils/shellReadOnlyChecker.test.js +47 -0
- package/dist/src/utils/shellReadOnlyChecker.test.js.map +1 -0
- package/dist/src/utils/subagentGenerator.d.ts +20 -0
- package/dist/src/utils/subagentGenerator.js +120 -0
- package/dist/src/utils/subagentGenerator.js.map +1 -0
- package/dist/src/utils/subagentGenerator.test.d.ts +6 -0
- package/dist/src/utils/subagentGenerator.test.js +135 -0
- package/dist/src/utils/subagentGenerator.test.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +25 -0
- package/dist/src/utils/summarizer.js +51 -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/systemEncoding.d.ts +40 -0
- package/dist/src/utils/systemEncoding.js +149 -0
- package/dist/src/utils/systemEncoding.js.map +1 -0
- package/dist/src/utils/systemEncoding.test.d.ts +6 -0
- package/dist/src/utils/systemEncoding.test.js +368 -0
- package/dist/src/utils/systemEncoding.test.js.map +1 -0
- package/dist/src/utils/terminalSerializer.d.ts +25 -0
- package/dist/src/utils/terminalSerializer.js +432 -0
- package/dist/src/utils/terminalSerializer.js.map +1 -0
- package/dist/src/utils/terminalSerializer.test.d.ts +6 -0
- package/dist/src/utils/terminalSerializer.test.js +176 -0
- package/dist/src/utils/terminalSerializer.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/textUtils.d.ts +18 -0
- package/dist/src/utils/textUtils.js +42 -0
- package/dist/src/utils/textUtils.js.map +1 -0
- package/dist/src/utils/textUtils.test.d.ts +6 -0
- package/dist/src/utils/textUtils.test.js +59 -0
- package/dist/src/utils/textUtils.test.js.map +1 -0
- package/dist/src/utils/thoughtUtils.d.ts +21 -0
- package/dist/src/utils/thoughtUtils.js +39 -0
- package/dist/src/utils/thoughtUtils.js.map +1 -0
- package/dist/src/utils/thoughtUtils.test.d.ts +6 -0
- package/dist/src/utils/thoughtUtils.test.js +78 -0
- package/dist/src/utils/thoughtUtils.test.js.map +1 -0
- package/dist/src/utils/tool-utils.d.ts +22 -0
- package/dist/src/utils/tool-utils.js +121 -0
- package/dist/src/utils/tool-utils.js.map +1 -0
- package/dist/src/utils/tool-utils.test.d.ts +6 -0
- package/dist/src/utils/tool-utils.test.js +100 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -0
- package/dist/src/utils/userAccountManager.d.ts +20 -0
- package/dist/src/utils/userAccountManager.js +114 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/userAccountManager.test.d.ts +6 -0
- package/dist/src/utils/userAccountManager.test.js +223 -0
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.d.ts +66 -0
- package/dist/src/utils/workspaceContext.js +171 -0
- package/dist/src/utils/workspaceContext.js.map +1 -0
- package/dist/src/utils/workspaceContext.test.d.ts +6 -0
- package/dist/src/utils/workspaceContext.test.js +318 -0
- package/dist/src/utils/workspaceContext.test.js.map +1 -0
- package/dist/src/utils/yaml-parser.d.ts +29 -0
- package/dist/src/utils/yaml-parser.js +172 -0
- package/dist/src/utils/yaml-parser.js.map +1 -0
- package/dist/src/utils/yaml-parser.test.d.ts +6 -0
- package/dist/src/utils/yaml-parser.test.js +170 -0
- package/dist/src/utils/yaml-parser.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +106 -0
- package/scripts/postinstall.js +100 -0
- package/vendor/ripgrep/COPYING +3 -0
- package/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/vendor/ripgrep/arm64-linux/rg +0 -0
- package/vendor/ripgrep/x64-darwin/rg +0 -0
- package/vendor/ripgrep/x64-linux/rg +0 -0
- package/vendor/ripgrep/x64-win32/rg.exe +0 -0
|
@@ -0,0 +1,896 @@
|
|
|
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 { Config, ApprovalMode } from './config.js';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryTool.js';
|
|
10
|
+
import { DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, QwenLogger, } from '../telemetry/index.js';
|
|
11
|
+
import { DEFAULT_DASHSCOPE_BASE_URL } from '../core/openaiContentGenerator/constants.js';
|
|
12
|
+
import { AuthType, createContentGeneratorConfig, } from '../core/contentGenerator.js';
|
|
13
|
+
import { GeminiClient } from '../core/client.js';
|
|
14
|
+
import { GitService } from '../services/gitService.js';
|
|
15
|
+
vi.mock('fs', async (importOriginal) => {
|
|
16
|
+
const actual = await importOriginal();
|
|
17
|
+
return {
|
|
18
|
+
...actual,
|
|
19
|
+
existsSync: vi.fn().mockReturnValue(true),
|
|
20
|
+
statSync: vi.fn().mockReturnValue({
|
|
21
|
+
isDirectory: vi.fn().mockReturnValue(true),
|
|
22
|
+
}),
|
|
23
|
+
realpathSync: vi.fn((path) => path),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
import { ShellTool } from '../tools/shell.js';
|
|
27
|
+
import { ReadFileTool } from '../tools/read-file.js';
|
|
28
|
+
import { GrepTool } from '../tools/grep.js';
|
|
29
|
+
import { canUseRipgrep } from '../utils/ripgrepUtils.js';
|
|
30
|
+
import { RipGrepTool } from '../tools/ripGrep.js';
|
|
31
|
+
import { logRipgrepFallback } from '../telemetry/loggers.js';
|
|
32
|
+
import { RipgrepFallbackEvent } from '../telemetry/types.js';
|
|
33
|
+
import { ToolRegistry } from '../tools/tool-registry.js';
|
|
34
|
+
function createToolMock(toolName) {
|
|
35
|
+
const ToolMock = vi.fn();
|
|
36
|
+
Object.defineProperty(ToolMock, 'Name', {
|
|
37
|
+
value: toolName,
|
|
38
|
+
writable: true,
|
|
39
|
+
});
|
|
40
|
+
return ToolMock;
|
|
41
|
+
}
|
|
42
|
+
vi.mock('fs', async (importOriginal) => {
|
|
43
|
+
const actual = await importOriginal();
|
|
44
|
+
return {
|
|
45
|
+
...actual,
|
|
46
|
+
existsSync: vi.fn().mockReturnValue(true),
|
|
47
|
+
statSync: vi.fn().mockReturnValue({
|
|
48
|
+
isDirectory: vi.fn().mockReturnValue(true),
|
|
49
|
+
}),
|
|
50
|
+
realpathSync: vi.fn((path) => path),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
// Mock dependencies that might be called during Config construction or createServerConfig
|
|
54
|
+
vi.mock('../tools/tool-registry', () => {
|
|
55
|
+
const ToolRegistryMock = vi.fn();
|
|
56
|
+
ToolRegistryMock.prototype.registerTool = vi.fn();
|
|
57
|
+
ToolRegistryMock.prototype.discoverAllTools = vi.fn();
|
|
58
|
+
ToolRegistryMock.prototype.getAllTools = vi.fn(() => []); // Mock methods if needed
|
|
59
|
+
ToolRegistryMock.prototype.getTool = vi.fn();
|
|
60
|
+
ToolRegistryMock.prototype.getFunctionDeclarations = vi.fn(() => []);
|
|
61
|
+
return { ToolRegistry: ToolRegistryMock };
|
|
62
|
+
});
|
|
63
|
+
vi.mock('../utils/memoryDiscovery.js', () => ({
|
|
64
|
+
loadServerHierarchicalMemory: vi.fn(),
|
|
65
|
+
}));
|
|
66
|
+
// Mock individual tools if their constructors are complex or have side effects
|
|
67
|
+
vi.mock('../tools/ls', () => ({
|
|
68
|
+
LSTool: createToolMock('list_directory'),
|
|
69
|
+
}));
|
|
70
|
+
vi.mock('../tools/read-file', () => ({
|
|
71
|
+
ReadFileTool: createToolMock('read_file'),
|
|
72
|
+
}));
|
|
73
|
+
vi.mock('../tools/grep.js', () => ({
|
|
74
|
+
GrepTool: createToolMock('grep_search'),
|
|
75
|
+
}));
|
|
76
|
+
vi.mock('../tools/ripGrep.js', () => ({
|
|
77
|
+
RipGrepTool: createToolMock('grep_search'),
|
|
78
|
+
}));
|
|
79
|
+
vi.mock('../utils/ripgrepUtils.js', () => ({
|
|
80
|
+
canUseRipgrep: vi.fn(),
|
|
81
|
+
}));
|
|
82
|
+
vi.mock('../tools/glob', () => ({
|
|
83
|
+
GlobTool: createToolMock('glob'),
|
|
84
|
+
}));
|
|
85
|
+
vi.mock('../tools/edit', () => ({
|
|
86
|
+
EditTool: createToolMock('edit'),
|
|
87
|
+
}));
|
|
88
|
+
vi.mock('../tools/shell', () => ({
|
|
89
|
+
ShellTool: createToolMock('run_shell_command'),
|
|
90
|
+
}));
|
|
91
|
+
vi.mock('../tools/write-file', () => ({
|
|
92
|
+
WriteFileTool: createToolMock('write_file'),
|
|
93
|
+
}));
|
|
94
|
+
vi.mock('../tools/web-fetch', () => ({
|
|
95
|
+
WebFetchTool: createToolMock('web_fetch'),
|
|
96
|
+
}));
|
|
97
|
+
vi.mock('../tools/read-many-files', () => ({
|
|
98
|
+
ReadManyFilesTool: createToolMock('read_many_files'),
|
|
99
|
+
}));
|
|
100
|
+
vi.mock('../tools/memoryTool', () => ({
|
|
101
|
+
MemoryTool: createToolMock('save_memory'),
|
|
102
|
+
setGeminiMdFilename: vi.fn(),
|
|
103
|
+
getCurrentGeminiMdFilename: vi.fn(() => 'QWEN.md'), // Mock the original filename
|
|
104
|
+
DEFAULT_CONTEXT_FILENAME: 'QWEN.md',
|
|
105
|
+
QWEN_CONFIG_DIR: '.qwen',
|
|
106
|
+
}));
|
|
107
|
+
vi.mock('../core/contentGenerator.js');
|
|
108
|
+
vi.mock('../core/client.js', () => ({
|
|
109
|
+
GeminiClient: vi.fn().mockImplementation(() => ({
|
|
110
|
+
initialize: vi.fn().mockResolvedValue(undefined),
|
|
111
|
+
isInitialized: vi.fn().mockReturnValue(true),
|
|
112
|
+
stripThoughtsFromHistory: vi.fn(),
|
|
113
|
+
setTools: vi.fn(),
|
|
114
|
+
})),
|
|
115
|
+
}));
|
|
116
|
+
vi.mock('../telemetry/index.js', async (importOriginal) => {
|
|
117
|
+
const actual = await importOriginal();
|
|
118
|
+
return {
|
|
119
|
+
...actual,
|
|
120
|
+
initializeTelemetry: vi.fn(),
|
|
121
|
+
uiTelemetryService: {
|
|
122
|
+
getLastPromptTokenCount: vi.fn(),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
vi.mock('../telemetry/loggers.js', async (importOriginal) => {
|
|
127
|
+
const actual = await importOriginal();
|
|
128
|
+
return {
|
|
129
|
+
...actual,
|
|
130
|
+
logRipgrepFallback: vi.fn(),
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
vi.mock('../services/gitService.js', () => {
|
|
134
|
+
const GitServiceMock = vi.fn();
|
|
135
|
+
GitServiceMock.prototype.initialize = vi.fn();
|
|
136
|
+
return { GitService: GitServiceMock };
|
|
137
|
+
});
|
|
138
|
+
vi.mock('../ide/ide-client.js', () => ({
|
|
139
|
+
IdeClient: {
|
|
140
|
+
getInstance: vi.fn().mockResolvedValue({
|
|
141
|
+
getConnectionStatus: vi.fn(),
|
|
142
|
+
initialize: vi.fn(),
|
|
143
|
+
shutdown: vi.fn(),
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
}));
|
|
147
|
+
import { BaseLlmClient } from '../core/baseLlmClient.js';
|
|
148
|
+
import { tokenLimit } from '../core/tokenLimits.js';
|
|
149
|
+
import { uiTelemetryService } from '../telemetry/index.js';
|
|
150
|
+
vi.mock('../core/baseLlmClient.js');
|
|
151
|
+
vi.mock('../core/tokenLimits.js', () => ({
|
|
152
|
+
tokenLimit: vi.fn(),
|
|
153
|
+
}));
|
|
154
|
+
describe('Server Config (config.ts)', () => {
|
|
155
|
+
const MODEL = 'qwen3-coder-plus';
|
|
156
|
+
// Default mock for canUseRipgrep to return true (tests that care about ripgrep will override this)
|
|
157
|
+
beforeEach(() => {
|
|
158
|
+
vi.mocked(canUseRipgrep).mockResolvedValue(true);
|
|
159
|
+
});
|
|
160
|
+
const SANDBOX = {
|
|
161
|
+
command: 'docker',
|
|
162
|
+
image: 'qwen-code-sandbox',
|
|
163
|
+
};
|
|
164
|
+
const TARGET_DIR = '/path/to/target';
|
|
165
|
+
const DEBUG_MODE = false;
|
|
166
|
+
const QUESTION = 'test question';
|
|
167
|
+
const FULL_CONTEXT = false;
|
|
168
|
+
const USER_MEMORY = 'Test User Memory';
|
|
169
|
+
const TELEMETRY_SETTINGS = { enabled: false };
|
|
170
|
+
const EMBEDDING_MODEL = 'gemini-embedding';
|
|
171
|
+
const SESSION_ID = 'test-session-id';
|
|
172
|
+
const baseParams = {
|
|
173
|
+
cwd: '/tmp',
|
|
174
|
+
embeddingModel: EMBEDDING_MODEL,
|
|
175
|
+
sandbox: SANDBOX,
|
|
176
|
+
targetDir: TARGET_DIR,
|
|
177
|
+
debugMode: DEBUG_MODE,
|
|
178
|
+
question: QUESTION,
|
|
179
|
+
fullContext: FULL_CONTEXT,
|
|
180
|
+
userMemory: USER_MEMORY,
|
|
181
|
+
telemetry: TELEMETRY_SETTINGS,
|
|
182
|
+
sessionId: SESSION_ID,
|
|
183
|
+
model: MODEL,
|
|
184
|
+
usageStatisticsEnabled: false,
|
|
185
|
+
};
|
|
186
|
+
beforeEach(() => {
|
|
187
|
+
// Reset mocks if necessary
|
|
188
|
+
vi.clearAllMocks();
|
|
189
|
+
vi.spyOn(QwenLogger.prototype, 'logStartSessionEvent').mockImplementation(() => undefined);
|
|
190
|
+
});
|
|
191
|
+
describe('initialize', () => {
|
|
192
|
+
it('should throw an error if checkpointing is enabled and GitService fails', async () => {
|
|
193
|
+
const gitError = new Error('Git is not installed');
|
|
194
|
+
GitService.prototype.initialize.mockRejectedValue(gitError);
|
|
195
|
+
const config = new Config({
|
|
196
|
+
...baseParams,
|
|
197
|
+
checkpointing: true,
|
|
198
|
+
});
|
|
199
|
+
await expect(config.initialize()).rejects.toThrow(gitError);
|
|
200
|
+
});
|
|
201
|
+
it('should not throw an error if checkpointing is disabled and GitService fails', async () => {
|
|
202
|
+
const gitError = new Error('Git is not installed');
|
|
203
|
+
GitService.prototype.initialize.mockRejectedValue(gitError);
|
|
204
|
+
const config = new Config({
|
|
205
|
+
...baseParams,
|
|
206
|
+
checkpointing: false,
|
|
207
|
+
});
|
|
208
|
+
await expect(config.initialize()).resolves.toBeUndefined();
|
|
209
|
+
});
|
|
210
|
+
it('should throw an error if initialized more than once', async () => {
|
|
211
|
+
const config = new Config({
|
|
212
|
+
...baseParams,
|
|
213
|
+
checkpointing: false,
|
|
214
|
+
});
|
|
215
|
+
await expect(config.initialize()).resolves.toBeUndefined();
|
|
216
|
+
await expect(config.initialize()).rejects.toThrow('Config was already initialized');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
describe('refreshAuth', () => {
|
|
220
|
+
it('should refresh auth and update config', async () => {
|
|
221
|
+
const config = new Config(baseParams);
|
|
222
|
+
const authType = AuthType.USE_GEMINI;
|
|
223
|
+
const mockContentConfig = {
|
|
224
|
+
apiKey: 'test-key',
|
|
225
|
+
model: 'qwen3-coder-plus',
|
|
226
|
+
};
|
|
227
|
+
vi.mocked(createContentGeneratorConfig).mockReturnValue(mockContentConfig);
|
|
228
|
+
// Set fallback mode to true to ensure it gets reset
|
|
229
|
+
config.setFallbackMode(true);
|
|
230
|
+
expect(config.isInFallbackMode()).toBe(true);
|
|
231
|
+
await config.refreshAuth(authType);
|
|
232
|
+
expect(createContentGeneratorConfig).toHaveBeenCalledWith(config, authType, {
|
|
233
|
+
model: MODEL,
|
|
234
|
+
baseUrl: DEFAULT_DASHSCOPE_BASE_URL,
|
|
235
|
+
});
|
|
236
|
+
// Verify that contentGeneratorConfig is updated
|
|
237
|
+
expect(config.getContentGeneratorConfig()).toEqual(mockContentConfig);
|
|
238
|
+
expect(GeminiClient).toHaveBeenCalledWith(config);
|
|
239
|
+
// Verify that fallback mode is reset
|
|
240
|
+
expect(config.isInFallbackMode()).toBe(false);
|
|
241
|
+
});
|
|
242
|
+
it('should strip thoughts when switching from GenAI to Vertex', async () => {
|
|
243
|
+
const config = new Config(baseParams);
|
|
244
|
+
vi.mocked(createContentGeneratorConfig).mockImplementation((_, authType) => ({ authType }));
|
|
245
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
246
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
247
|
+
expect(config.getGeminiClient().stripThoughtsFromHistory).toHaveBeenCalledWith();
|
|
248
|
+
});
|
|
249
|
+
it('should not strip thoughts when switching from Vertex to GenAI', async () => {
|
|
250
|
+
const config = new Config(baseParams);
|
|
251
|
+
vi.mocked(createContentGeneratorConfig).mockImplementation((_, authType) => ({ authType }));
|
|
252
|
+
await config.refreshAuth(AuthType.USE_VERTEX_AI);
|
|
253
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
254
|
+
expect(config.getGeminiClient().stripThoughtsFromHistory).not.toHaveBeenCalledWith();
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
it('Config constructor should store userMemory correctly', () => {
|
|
258
|
+
const config = new Config(baseParams);
|
|
259
|
+
expect(config.getUserMemory()).toBe(USER_MEMORY);
|
|
260
|
+
// Verify other getters if needed
|
|
261
|
+
expect(config.getTargetDir()).toBe(path.resolve(TARGET_DIR)); // Check resolved path
|
|
262
|
+
});
|
|
263
|
+
it('Config constructor should default userMemory to empty string if not provided', () => {
|
|
264
|
+
const paramsWithoutMemory = { ...baseParams };
|
|
265
|
+
delete paramsWithoutMemory.userMemory;
|
|
266
|
+
const config = new Config(paramsWithoutMemory);
|
|
267
|
+
expect(config.getUserMemory()).toBe('');
|
|
268
|
+
});
|
|
269
|
+
it('Config constructor should call setGeminiMdFilename with contextFileName if provided', () => {
|
|
270
|
+
const contextFileName = 'CUSTOM_AGENTS.md';
|
|
271
|
+
const paramsWithContextFile = {
|
|
272
|
+
...baseParams,
|
|
273
|
+
contextFileName,
|
|
274
|
+
};
|
|
275
|
+
new Config(paramsWithContextFile);
|
|
276
|
+
expect(mockSetGeminiMdFilename).toHaveBeenCalledWith(contextFileName);
|
|
277
|
+
});
|
|
278
|
+
it('Config constructor should not call setGeminiMdFilename if contextFileName is not provided', () => {
|
|
279
|
+
new Config(baseParams); // baseParams does not have contextFileName
|
|
280
|
+
expect(mockSetGeminiMdFilename).not.toHaveBeenCalled();
|
|
281
|
+
});
|
|
282
|
+
it('should set default file filtering settings when not provided', () => {
|
|
283
|
+
const config = new Config(baseParams);
|
|
284
|
+
expect(config.getFileFilteringRespectGitIgnore()).toBe(true);
|
|
285
|
+
});
|
|
286
|
+
it('should set custom file filtering settings when provided', () => {
|
|
287
|
+
const paramsWithFileFiltering = {
|
|
288
|
+
...baseParams,
|
|
289
|
+
fileFiltering: {
|
|
290
|
+
respectGitIgnore: false,
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
const config = new Config(paramsWithFileFiltering);
|
|
294
|
+
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
|
295
|
+
});
|
|
296
|
+
it('should initialize WorkspaceContext with includeDirectories', () => {
|
|
297
|
+
const includeDirectories = ['/path/to/dir1', '/path/to/dir2'];
|
|
298
|
+
const paramsWithIncludeDirs = {
|
|
299
|
+
...baseParams,
|
|
300
|
+
includeDirectories,
|
|
301
|
+
};
|
|
302
|
+
const config = new Config(paramsWithIncludeDirs);
|
|
303
|
+
const workspaceContext = config.getWorkspaceContext();
|
|
304
|
+
const directories = workspaceContext.getDirectories();
|
|
305
|
+
// Should include the target directory plus the included directories
|
|
306
|
+
expect(directories).toHaveLength(3);
|
|
307
|
+
expect(directories).toContain(path.resolve(baseParams.targetDir));
|
|
308
|
+
expect(directories).toContain('/path/to/dir1');
|
|
309
|
+
expect(directories).toContain('/path/to/dir2');
|
|
310
|
+
});
|
|
311
|
+
it('Config constructor should set telemetry to true when provided as true', () => {
|
|
312
|
+
const paramsWithTelemetry = {
|
|
313
|
+
...baseParams,
|
|
314
|
+
telemetry: { enabled: true },
|
|
315
|
+
};
|
|
316
|
+
const config = new Config(paramsWithTelemetry);
|
|
317
|
+
expect(config.getTelemetryEnabled()).toBe(true);
|
|
318
|
+
});
|
|
319
|
+
it('Config constructor should set telemetry to false when provided as false', () => {
|
|
320
|
+
const paramsWithTelemetry = {
|
|
321
|
+
...baseParams,
|
|
322
|
+
telemetry: { enabled: false },
|
|
323
|
+
};
|
|
324
|
+
const config = new Config(paramsWithTelemetry);
|
|
325
|
+
expect(config.getTelemetryEnabled()).toBe(false);
|
|
326
|
+
});
|
|
327
|
+
it('Config constructor should default telemetry to default value if not provided', () => {
|
|
328
|
+
const paramsWithoutTelemetry = { ...baseParams };
|
|
329
|
+
delete paramsWithoutTelemetry.telemetry;
|
|
330
|
+
const config = new Config(paramsWithoutTelemetry);
|
|
331
|
+
expect(config.getTelemetryEnabled()).toBe(TELEMETRY_SETTINGS.enabled);
|
|
332
|
+
});
|
|
333
|
+
it('Config constructor should set telemetry useCollector to true when provided', () => {
|
|
334
|
+
const paramsWithTelemetry = {
|
|
335
|
+
...baseParams,
|
|
336
|
+
telemetry: { enabled: true, useCollector: true },
|
|
337
|
+
};
|
|
338
|
+
const config = new Config(paramsWithTelemetry);
|
|
339
|
+
expect(config.getTelemetryUseCollector()).toBe(true);
|
|
340
|
+
});
|
|
341
|
+
it('Config constructor should set telemetry useCollector to false when provided', () => {
|
|
342
|
+
const paramsWithTelemetry = {
|
|
343
|
+
...baseParams,
|
|
344
|
+
telemetry: { enabled: true, useCollector: false },
|
|
345
|
+
};
|
|
346
|
+
const config = new Config(paramsWithTelemetry);
|
|
347
|
+
expect(config.getTelemetryUseCollector()).toBe(false);
|
|
348
|
+
});
|
|
349
|
+
it('Config constructor should default telemetry useCollector to false if not provided', () => {
|
|
350
|
+
const paramsWithTelemetry = {
|
|
351
|
+
...baseParams,
|
|
352
|
+
telemetry: { enabled: true },
|
|
353
|
+
};
|
|
354
|
+
const config = new Config(paramsWithTelemetry);
|
|
355
|
+
expect(config.getTelemetryUseCollector()).toBe(false);
|
|
356
|
+
});
|
|
357
|
+
it('should have a getFileService method that returns FileDiscoveryService', () => {
|
|
358
|
+
const config = new Config(baseParams);
|
|
359
|
+
const fileService = config.getFileService();
|
|
360
|
+
expect(fileService).toBeDefined();
|
|
361
|
+
});
|
|
362
|
+
describe('Usage Statistics', () => {
|
|
363
|
+
it('defaults usage statistics to enabled if not specified', () => {
|
|
364
|
+
const config = new Config({
|
|
365
|
+
...baseParams,
|
|
366
|
+
usageStatisticsEnabled: undefined,
|
|
367
|
+
});
|
|
368
|
+
expect(config.getUsageStatisticsEnabled()).toBe(true);
|
|
369
|
+
});
|
|
370
|
+
it.each([{ enabled: true }, { enabled: false }])('sets usage statistics based on the provided value (enabled: $enabled)', ({ enabled }) => {
|
|
371
|
+
const config = new Config({
|
|
372
|
+
...baseParams,
|
|
373
|
+
usageStatisticsEnabled: enabled,
|
|
374
|
+
});
|
|
375
|
+
expect(config.getUsageStatisticsEnabled()).toBe(enabled);
|
|
376
|
+
});
|
|
377
|
+
it('logs the session start event', async () => {
|
|
378
|
+
const config = new Config({
|
|
379
|
+
...baseParams,
|
|
380
|
+
usageStatisticsEnabled: true,
|
|
381
|
+
});
|
|
382
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
383
|
+
expect(QwenLogger.prototype.logStartSessionEvent).toHaveBeenCalledOnce();
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
describe('Telemetry Settings', () => {
|
|
387
|
+
it('should return default telemetry target if not provided', () => {
|
|
388
|
+
const params = {
|
|
389
|
+
...baseParams,
|
|
390
|
+
telemetry: { enabled: true },
|
|
391
|
+
};
|
|
392
|
+
const config = new Config(params);
|
|
393
|
+
expect(config.getTelemetryTarget()).toBe(DEFAULT_TELEMETRY_TARGET);
|
|
394
|
+
});
|
|
395
|
+
it('should return provided OTLP endpoint', () => {
|
|
396
|
+
const endpoint = 'http://custom.otel.collector:4317';
|
|
397
|
+
const params = {
|
|
398
|
+
...baseParams,
|
|
399
|
+
telemetry: { enabled: true, otlpEndpoint: endpoint },
|
|
400
|
+
};
|
|
401
|
+
const config = new Config(params);
|
|
402
|
+
expect(config.getTelemetryOtlpEndpoint()).toBe(endpoint);
|
|
403
|
+
});
|
|
404
|
+
it('should return default OTLP endpoint if not provided', () => {
|
|
405
|
+
const params = {
|
|
406
|
+
...baseParams,
|
|
407
|
+
telemetry: { enabled: true },
|
|
408
|
+
};
|
|
409
|
+
const config = new Config(params);
|
|
410
|
+
expect(config.getTelemetryOtlpEndpoint()).toBe(DEFAULT_OTLP_ENDPOINT);
|
|
411
|
+
});
|
|
412
|
+
it('should return provided logPrompts setting', () => {
|
|
413
|
+
const params = {
|
|
414
|
+
...baseParams,
|
|
415
|
+
telemetry: { enabled: true, logPrompts: false },
|
|
416
|
+
};
|
|
417
|
+
const config = new Config(params);
|
|
418
|
+
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
|
419
|
+
});
|
|
420
|
+
it('should return default logPrompts setting (true) if not provided', () => {
|
|
421
|
+
const params = {
|
|
422
|
+
...baseParams,
|
|
423
|
+
telemetry: { enabled: true },
|
|
424
|
+
};
|
|
425
|
+
const config = new Config(params);
|
|
426
|
+
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
|
427
|
+
});
|
|
428
|
+
it('should return default logPrompts setting (true) if telemetry object is not provided', () => {
|
|
429
|
+
const paramsWithoutTelemetry = { ...baseParams };
|
|
430
|
+
delete paramsWithoutTelemetry.telemetry;
|
|
431
|
+
const config = new Config(paramsWithoutTelemetry);
|
|
432
|
+
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
|
433
|
+
});
|
|
434
|
+
it('should return default telemetry target if telemetry object is not provided', () => {
|
|
435
|
+
const paramsWithoutTelemetry = { ...baseParams };
|
|
436
|
+
delete paramsWithoutTelemetry.telemetry;
|
|
437
|
+
const config = new Config(paramsWithoutTelemetry);
|
|
438
|
+
expect(config.getTelemetryTarget()).toBe(DEFAULT_TELEMETRY_TARGET);
|
|
439
|
+
});
|
|
440
|
+
it('should return default OTLP endpoint if telemetry object is not provided', () => {
|
|
441
|
+
const paramsWithoutTelemetry = { ...baseParams };
|
|
442
|
+
delete paramsWithoutTelemetry.telemetry;
|
|
443
|
+
const config = new Config(paramsWithoutTelemetry);
|
|
444
|
+
expect(config.getTelemetryOtlpEndpoint()).toBe(DEFAULT_OTLP_ENDPOINT);
|
|
445
|
+
});
|
|
446
|
+
it('should return provided OTLP protocol', () => {
|
|
447
|
+
const params = {
|
|
448
|
+
...baseParams,
|
|
449
|
+
telemetry: { enabled: true, otlpProtocol: 'http' },
|
|
450
|
+
};
|
|
451
|
+
const config = new Config(params);
|
|
452
|
+
expect(config.getTelemetryOtlpProtocol()).toBe('http');
|
|
453
|
+
});
|
|
454
|
+
it('should return default OTLP protocol if not provided', () => {
|
|
455
|
+
const params = {
|
|
456
|
+
...baseParams,
|
|
457
|
+
telemetry: { enabled: true },
|
|
458
|
+
};
|
|
459
|
+
const config = new Config(params);
|
|
460
|
+
expect(config.getTelemetryOtlpProtocol()).toBe('grpc');
|
|
461
|
+
});
|
|
462
|
+
it('should return default OTLP protocol if telemetry object is not provided', () => {
|
|
463
|
+
const paramsWithoutTelemetry = { ...baseParams };
|
|
464
|
+
delete paramsWithoutTelemetry.telemetry;
|
|
465
|
+
const config = new Config(paramsWithoutTelemetry);
|
|
466
|
+
expect(config.getTelemetryOtlpProtocol()).toBe('grpc');
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
describe('UseRipgrep Configuration', () => {
|
|
470
|
+
it('should default useRipgrep to true when not provided', () => {
|
|
471
|
+
const config = new Config(baseParams);
|
|
472
|
+
expect(config.getUseRipgrep()).toBe(true);
|
|
473
|
+
});
|
|
474
|
+
it('should set useRipgrep to false when provided as false', () => {
|
|
475
|
+
const paramsWithRipgrep = {
|
|
476
|
+
...baseParams,
|
|
477
|
+
useRipgrep: false,
|
|
478
|
+
};
|
|
479
|
+
const config = new Config(paramsWithRipgrep);
|
|
480
|
+
expect(config.getUseRipgrep()).toBe(false);
|
|
481
|
+
});
|
|
482
|
+
it('should set useRipgrep to true when explicitly provided as true', () => {
|
|
483
|
+
const paramsWithRipgrep = {
|
|
484
|
+
...baseParams,
|
|
485
|
+
useRipgrep: true,
|
|
486
|
+
};
|
|
487
|
+
const config = new Config(paramsWithRipgrep);
|
|
488
|
+
expect(config.getUseRipgrep()).toBe(true);
|
|
489
|
+
});
|
|
490
|
+
it('should default useRipgrep to true when undefined', () => {
|
|
491
|
+
const paramsWithUndefinedRipgrep = {
|
|
492
|
+
...baseParams,
|
|
493
|
+
useRipgrep: undefined,
|
|
494
|
+
};
|
|
495
|
+
const config = new Config(paramsWithUndefinedRipgrep);
|
|
496
|
+
expect(config.getUseRipgrep()).toBe(true);
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
describe('UseBuiltinRipgrep Configuration', () => {
|
|
500
|
+
it('should default useBuiltinRipgrep to true when not provided', () => {
|
|
501
|
+
const config = new Config(baseParams);
|
|
502
|
+
expect(config.getUseBuiltinRipgrep()).toBe(true);
|
|
503
|
+
});
|
|
504
|
+
it('should set useBuiltinRipgrep to false when provided as false', () => {
|
|
505
|
+
const paramsWithBuiltinRipgrep = {
|
|
506
|
+
...baseParams,
|
|
507
|
+
useBuiltinRipgrep: false,
|
|
508
|
+
};
|
|
509
|
+
const config = new Config(paramsWithBuiltinRipgrep);
|
|
510
|
+
expect(config.getUseBuiltinRipgrep()).toBe(false);
|
|
511
|
+
});
|
|
512
|
+
it('should set useBuiltinRipgrep to true when explicitly provided as true', () => {
|
|
513
|
+
const paramsWithBuiltinRipgrep = {
|
|
514
|
+
...baseParams,
|
|
515
|
+
useBuiltinRipgrep: true,
|
|
516
|
+
};
|
|
517
|
+
const config = new Config(paramsWithBuiltinRipgrep);
|
|
518
|
+
expect(config.getUseBuiltinRipgrep()).toBe(true);
|
|
519
|
+
});
|
|
520
|
+
it('should default useBuiltinRipgrep to true when undefined', () => {
|
|
521
|
+
const paramsWithUndefinedBuiltinRipgrep = {
|
|
522
|
+
...baseParams,
|
|
523
|
+
useBuiltinRipgrep: undefined,
|
|
524
|
+
};
|
|
525
|
+
const config = new Config(paramsWithUndefinedBuiltinRipgrep);
|
|
526
|
+
expect(config.getUseBuiltinRipgrep()).toBe(true);
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
describe('createToolRegistry', () => {
|
|
530
|
+
it('should register a tool if coreTools contains an argument-specific pattern', async () => {
|
|
531
|
+
const params = {
|
|
532
|
+
...baseParams,
|
|
533
|
+
coreTools: ['Shell(git status)'], // Use display name instead of class name
|
|
534
|
+
};
|
|
535
|
+
const config = new Config(params);
|
|
536
|
+
await config.initialize();
|
|
537
|
+
// The ToolRegistry class is mocked, so we can inspect its prototype's methods.
|
|
538
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
539
|
+
// Check that registerTool was called for ShellTool
|
|
540
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
541
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
542
|
+
// Check that registerTool was NOT called for ReadFileTool
|
|
543
|
+
const wasReadFileToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ReadFileTool));
|
|
544
|
+
expect(wasReadFileToolRegistered).toBe(false);
|
|
545
|
+
});
|
|
546
|
+
it('should register a tool if coreTools contains the displayName', async () => {
|
|
547
|
+
const params = {
|
|
548
|
+
...baseParams,
|
|
549
|
+
coreTools: ['Shell'],
|
|
550
|
+
};
|
|
551
|
+
const config = new Config(params);
|
|
552
|
+
await config.initialize();
|
|
553
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
554
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
555
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
556
|
+
});
|
|
557
|
+
it('should register a tool if coreTools contains the displayName with argument-specific pattern', async () => {
|
|
558
|
+
const params = {
|
|
559
|
+
...baseParams,
|
|
560
|
+
coreTools: ['Shell(git status)'],
|
|
561
|
+
};
|
|
562
|
+
const config = new Config(params);
|
|
563
|
+
await config.initialize();
|
|
564
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
565
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
566
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
567
|
+
});
|
|
568
|
+
it('should register a tool if coreTools contains a legacy tool name alias', async () => {
|
|
569
|
+
const params = {
|
|
570
|
+
...baseParams,
|
|
571
|
+
useRipgrep: false,
|
|
572
|
+
coreTools: ['search_file_content'],
|
|
573
|
+
};
|
|
574
|
+
const config = new Config(params);
|
|
575
|
+
await config.initialize();
|
|
576
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
577
|
+
const wasGrepToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
578
|
+
expect(wasGrepToolRegistered).toBe(true);
|
|
579
|
+
});
|
|
580
|
+
it('should not register a tool if excludeTools contains a legacy display name alias', async () => {
|
|
581
|
+
const params = {
|
|
582
|
+
...baseParams,
|
|
583
|
+
useRipgrep: false,
|
|
584
|
+
coreTools: undefined,
|
|
585
|
+
excludeTools: ['SearchFiles'],
|
|
586
|
+
};
|
|
587
|
+
const config = new Config(params);
|
|
588
|
+
await config.initialize();
|
|
589
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
590
|
+
const wasGrepToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
591
|
+
expect(wasGrepToolRegistered).toBe(false);
|
|
592
|
+
});
|
|
593
|
+
describe('with minified tool class names', () => {
|
|
594
|
+
beforeEach(() => {
|
|
595
|
+
Object.defineProperty(vi.mocked(ShellTool).prototype.constructor, 'name', {
|
|
596
|
+
value: '_ShellTool',
|
|
597
|
+
configurable: true,
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
afterEach(() => {
|
|
601
|
+
Object.defineProperty(vi.mocked(ShellTool).prototype.constructor, 'name', {
|
|
602
|
+
value: 'ShellTool',
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
it('should register a tool if coreTools contains the non-minified class name', async () => {
|
|
606
|
+
const params = {
|
|
607
|
+
...baseParams,
|
|
608
|
+
coreTools: ['Shell'], // Use display name instead of class name
|
|
609
|
+
};
|
|
610
|
+
const config = new Config(params);
|
|
611
|
+
await config.initialize();
|
|
612
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
613
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
614
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
615
|
+
});
|
|
616
|
+
it('should register a tool if coreTools contains the displayName', async () => {
|
|
617
|
+
const params = {
|
|
618
|
+
...baseParams,
|
|
619
|
+
coreTools: ['Shell'],
|
|
620
|
+
};
|
|
621
|
+
const config = new Config(params);
|
|
622
|
+
await config.initialize();
|
|
623
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
624
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
625
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
626
|
+
});
|
|
627
|
+
it('should not register a tool if excludeTools contains the non-minified class name', async () => {
|
|
628
|
+
const params = {
|
|
629
|
+
...baseParams,
|
|
630
|
+
coreTools: undefined, // all tools enabled by default
|
|
631
|
+
excludeTools: ['Shell'], // Use display name instead of class name
|
|
632
|
+
};
|
|
633
|
+
const config = new Config(params);
|
|
634
|
+
await config.initialize();
|
|
635
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
636
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
637
|
+
expect(wasShellToolRegistered).toBe(false);
|
|
638
|
+
});
|
|
639
|
+
it('should not register a tool if excludeTools contains the displayName', async () => {
|
|
640
|
+
const params = {
|
|
641
|
+
...baseParams,
|
|
642
|
+
coreTools: undefined, // all tools enabled by default
|
|
643
|
+
excludeTools: ['Shell'],
|
|
644
|
+
};
|
|
645
|
+
const config = new Config(params);
|
|
646
|
+
await config.initialize();
|
|
647
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
648
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
649
|
+
expect(wasShellToolRegistered).toBe(false);
|
|
650
|
+
});
|
|
651
|
+
it('should register a tool if coreTools contains an argument-specific pattern with the non-minified class name', async () => {
|
|
652
|
+
const params = {
|
|
653
|
+
...baseParams,
|
|
654
|
+
coreTools: ['Shell(git status)'], // Use display name instead of class name
|
|
655
|
+
};
|
|
656
|
+
const config = new Config(params);
|
|
657
|
+
await config.initialize();
|
|
658
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
659
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
660
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
661
|
+
});
|
|
662
|
+
it('should register a tool if coreTools contains an argument-specific pattern with the displayName', async () => {
|
|
663
|
+
const params = {
|
|
664
|
+
...baseParams,
|
|
665
|
+
coreTools: ['Shell(git status)'],
|
|
666
|
+
};
|
|
667
|
+
const config = new Config(params);
|
|
668
|
+
await config.initialize();
|
|
669
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
670
|
+
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
671
|
+
expect(wasShellToolRegistered).toBe(true);
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
describe('getTruncateToolOutputThreshold', () => {
|
|
676
|
+
beforeEach(() => {
|
|
677
|
+
vi.clearAllMocks();
|
|
678
|
+
});
|
|
679
|
+
it('should return the calculated threshold when it is smaller than the default', () => {
|
|
680
|
+
const config = new Config(baseParams);
|
|
681
|
+
vi.mocked(tokenLimit).mockReturnValue(8000);
|
|
682
|
+
vi.mocked(uiTelemetryService.getLastPromptTokenCount).mockReturnValue(2000);
|
|
683
|
+
// 4 * (8000 - 2000) = 4 * 6000 = 24000
|
|
684
|
+
// default is 25_000
|
|
685
|
+
expect(config.getTruncateToolOutputThreshold()).toBe(24000);
|
|
686
|
+
});
|
|
687
|
+
it('should return the default threshold when the calculated value is larger', () => {
|
|
688
|
+
const config = new Config(baseParams);
|
|
689
|
+
vi.mocked(tokenLimit).mockReturnValue(2_000_000);
|
|
690
|
+
vi.mocked(uiTelemetryService.getLastPromptTokenCount).mockReturnValue(500_000);
|
|
691
|
+
// 4 * (2_000_000 - 500_000) = 4 * 1_500_000 = 6_000_000
|
|
692
|
+
// default is 25_000
|
|
693
|
+
expect(config.getTruncateToolOutputThreshold()).toBe(25_000);
|
|
694
|
+
});
|
|
695
|
+
it('should use a custom truncateToolOutputThreshold if provided', () => {
|
|
696
|
+
const customParams = {
|
|
697
|
+
...baseParams,
|
|
698
|
+
truncateToolOutputThreshold: 50000,
|
|
699
|
+
};
|
|
700
|
+
const config = new Config(customParams);
|
|
701
|
+
vi.mocked(tokenLimit).mockReturnValue(8000);
|
|
702
|
+
vi.mocked(uiTelemetryService.getLastPromptTokenCount).mockReturnValue(2000);
|
|
703
|
+
// 4 * (8000 - 2000) = 4 * 6000 = 24000
|
|
704
|
+
// custom threshold is 50000
|
|
705
|
+
expect(config.getTruncateToolOutputThreshold()).toBe(24000);
|
|
706
|
+
vi.mocked(tokenLimit).mockReturnValue(32000);
|
|
707
|
+
vi.mocked(uiTelemetryService.getLastPromptTokenCount).mockReturnValue(1000);
|
|
708
|
+
// 4 * (32000 - 1000) = 124000
|
|
709
|
+
// custom threshold is 50000
|
|
710
|
+
expect(config.getTruncateToolOutputThreshold()).toBe(50000);
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
});
|
|
714
|
+
describe('setApprovalMode with folder trust', () => {
|
|
715
|
+
const baseParams = {
|
|
716
|
+
sessionId: 'test',
|
|
717
|
+
targetDir: '.',
|
|
718
|
+
debugMode: false,
|
|
719
|
+
model: 'test-model',
|
|
720
|
+
cwd: '.',
|
|
721
|
+
};
|
|
722
|
+
it('should throw an error when setting YOLO mode in an untrusted folder', () => {
|
|
723
|
+
const config = new Config(baseParams);
|
|
724
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(false);
|
|
725
|
+
expect(() => config.setApprovalMode(ApprovalMode.YOLO)).toThrow('Cannot enable privileged approval modes in an untrusted folder.');
|
|
726
|
+
});
|
|
727
|
+
it('should throw an error when setting AUTO_EDIT mode in an untrusted folder', () => {
|
|
728
|
+
const config = new Config(baseParams);
|
|
729
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(false);
|
|
730
|
+
expect(() => config.setApprovalMode(ApprovalMode.AUTO_EDIT)).toThrow('Cannot enable privileged approval modes in an untrusted folder.');
|
|
731
|
+
});
|
|
732
|
+
it('should NOT throw an error when setting DEFAULT mode in an untrusted folder', () => {
|
|
733
|
+
const config = new Config(baseParams);
|
|
734
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(false);
|
|
735
|
+
expect(() => config.setApprovalMode(ApprovalMode.DEFAULT)).not.toThrow();
|
|
736
|
+
});
|
|
737
|
+
it('should NOT throw an error when setting PLAN mode in an untrusted folder', () => {
|
|
738
|
+
const config = new Config({
|
|
739
|
+
sessionId: 'test',
|
|
740
|
+
targetDir: '.',
|
|
741
|
+
debugMode: false,
|
|
742
|
+
model: 'test-model',
|
|
743
|
+
cwd: '.',
|
|
744
|
+
trustedFolder: false, // Untrusted
|
|
745
|
+
});
|
|
746
|
+
expect(() => config.setApprovalMode(ApprovalMode.PLAN)).not.toThrow();
|
|
747
|
+
});
|
|
748
|
+
it('should NOT throw an error when setting any mode in a trusted folder', () => {
|
|
749
|
+
const config = new Config(baseParams);
|
|
750
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(true);
|
|
751
|
+
expect(() => config.setApprovalMode(ApprovalMode.YOLO)).not.toThrow();
|
|
752
|
+
expect(() => config.setApprovalMode(ApprovalMode.AUTO_EDIT)).not.toThrow();
|
|
753
|
+
expect(() => config.setApprovalMode(ApprovalMode.DEFAULT)).not.toThrow();
|
|
754
|
+
expect(() => config.setApprovalMode(ApprovalMode.PLAN)).not.toThrow();
|
|
755
|
+
});
|
|
756
|
+
it('should NOT throw an error when setting any mode if trustedFolder is undefined', () => {
|
|
757
|
+
const config = new Config(baseParams);
|
|
758
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(true); // isTrustedFolder defaults to true
|
|
759
|
+
expect(() => config.setApprovalMode(ApprovalMode.YOLO)).not.toThrow();
|
|
760
|
+
expect(() => config.setApprovalMode(ApprovalMode.AUTO_EDIT)).not.toThrow();
|
|
761
|
+
expect(() => config.setApprovalMode(ApprovalMode.DEFAULT)).not.toThrow();
|
|
762
|
+
expect(() => config.setApprovalMode(ApprovalMode.PLAN)).not.toThrow();
|
|
763
|
+
});
|
|
764
|
+
describe('registerCoreTools', () => {
|
|
765
|
+
beforeEach(() => {
|
|
766
|
+
vi.clearAllMocks();
|
|
767
|
+
});
|
|
768
|
+
it('should register RipGrepTool when useRipgrep is true and it is available', async () => {
|
|
769
|
+
canUseRipgrep.mockResolvedValue(true);
|
|
770
|
+
const config = new Config({ ...baseParams, useRipgrep: true });
|
|
771
|
+
await config.initialize();
|
|
772
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
773
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
774
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
775
|
+
expect(wasRipGrepRegistered).toBe(true);
|
|
776
|
+
expect(wasGrepRegistered).toBe(false);
|
|
777
|
+
expect(canUseRipgrep).toHaveBeenCalledWith(true);
|
|
778
|
+
});
|
|
779
|
+
it('should register RipGrepTool with system ripgrep when useBuiltinRipgrep is false', async () => {
|
|
780
|
+
canUseRipgrep.mockResolvedValue(true);
|
|
781
|
+
const config = new Config({
|
|
782
|
+
...baseParams,
|
|
783
|
+
useRipgrep: true,
|
|
784
|
+
useBuiltinRipgrep: false,
|
|
785
|
+
});
|
|
786
|
+
await config.initialize();
|
|
787
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
788
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
789
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
790
|
+
expect(wasRipGrepRegistered).toBe(true);
|
|
791
|
+
expect(wasGrepRegistered).toBe(false);
|
|
792
|
+
expect(canUseRipgrep).toHaveBeenCalledWith(false);
|
|
793
|
+
});
|
|
794
|
+
it('should fall back to GrepTool and log error when useBuiltinRipgrep is false but system ripgrep is not available', async () => {
|
|
795
|
+
canUseRipgrep.mockResolvedValue(false);
|
|
796
|
+
const config = new Config({
|
|
797
|
+
...baseParams,
|
|
798
|
+
useRipgrep: true,
|
|
799
|
+
useBuiltinRipgrep: false,
|
|
800
|
+
});
|
|
801
|
+
await config.initialize();
|
|
802
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
803
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
804
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
805
|
+
expect(wasRipGrepRegistered).toBe(false);
|
|
806
|
+
expect(wasGrepRegistered).toBe(true);
|
|
807
|
+
expect(canUseRipgrep).toHaveBeenCalledWith(false);
|
|
808
|
+
expect(logRipgrepFallback).toHaveBeenCalledWith(config, expect.any(RipgrepFallbackEvent));
|
|
809
|
+
const event = logRipgrepFallback.mock.calls[0][1];
|
|
810
|
+
expect(event.error).toContain('ripgrep is not available');
|
|
811
|
+
});
|
|
812
|
+
it('should fall back to GrepTool and log error when useRipgrep is true and builtin ripgrep is not available', async () => {
|
|
813
|
+
canUseRipgrep.mockResolvedValue(false);
|
|
814
|
+
const config = new Config({ ...baseParams, useRipgrep: true });
|
|
815
|
+
await config.initialize();
|
|
816
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
817
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
818
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
819
|
+
expect(wasRipGrepRegistered).toBe(false);
|
|
820
|
+
expect(wasGrepRegistered).toBe(true);
|
|
821
|
+
expect(canUseRipgrep).toHaveBeenCalledWith(true);
|
|
822
|
+
expect(logRipgrepFallback).toHaveBeenCalledWith(config, expect.any(RipgrepFallbackEvent));
|
|
823
|
+
const event = logRipgrepFallback.mock.calls[0][1];
|
|
824
|
+
expect(event.error).toContain('ripgrep is not available');
|
|
825
|
+
});
|
|
826
|
+
it('should fall back to GrepTool and log error when canUseRipgrep throws an error', async () => {
|
|
827
|
+
const error = new Error('ripGrep check failed');
|
|
828
|
+
canUseRipgrep.mockRejectedValue(error);
|
|
829
|
+
const config = new Config({ ...baseParams, useRipgrep: true });
|
|
830
|
+
await config.initialize();
|
|
831
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
832
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
833
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
834
|
+
expect(wasRipGrepRegistered).toBe(false);
|
|
835
|
+
expect(wasGrepRegistered).toBe(true);
|
|
836
|
+
expect(logRipgrepFallback).toHaveBeenCalledWith(config, expect.any(RipgrepFallbackEvent));
|
|
837
|
+
const event = logRipgrepFallback.mock.calls[0][1];
|
|
838
|
+
expect(event.error).toBe(`ripGrep check failed`);
|
|
839
|
+
});
|
|
840
|
+
it('should register GrepTool when useRipgrep is false', async () => {
|
|
841
|
+
const config = new Config({ ...baseParams, useRipgrep: false });
|
|
842
|
+
await config.initialize();
|
|
843
|
+
const calls = ToolRegistry.prototype.registerTool.mock.calls;
|
|
844
|
+
const wasRipGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(RipGrepTool));
|
|
845
|
+
const wasGrepRegistered = calls.some((call) => call[0] instanceof vi.mocked(GrepTool));
|
|
846
|
+
expect(wasRipGrepRegistered).toBe(false);
|
|
847
|
+
expect(wasGrepRegistered).toBe(true);
|
|
848
|
+
expect(canUseRipgrep).not.toHaveBeenCalled();
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
describe('BaseLlmClient Lifecycle', () => {
|
|
853
|
+
const MODEL = 'gemini-pro';
|
|
854
|
+
const SANDBOX = {
|
|
855
|
+
command: 'docker',
|
|
856
|
+
image: 'gemini-cli-sandbox',
|
|
857
|
+
};
|
|
858
|
+
const TARGET_DIR = '/path/to/target';
|
|
859
|
+
const DEBUG_MODE = false;
|
|
860
|
+
const QUESTION = 'test question';
|
|
861
|
+
const FULL_CONTEXT = false;
|
|
862
|
+
const USER_MEMORY = 'Test User Memory';
|
|
863
|
+
const TELEMETRY_SETTINGS = { enabled: false };
|
|
864
|
+
const EMBEDDING_MODEL = 'gemini-embedding';
|
|
865
|
+
const SESSION_ID = 'test-session-id';
|
|
866
|
+
const baseParams = {
|
|
867
|
+
cwd: '/tmp',
|
|
868
|
+
embeddingModel: EMBEDDING_MODEL,
|
|
869
|
+
sandbox: SANDBOX,
|
|
870
|
+
targetDir: TARGET_DIR,
|
|
871
|
+
debugMode: DEBUG_MODE,
|
|
872
|
+
question: QUESTION,
|
|
873
|
+
fullContext: FULL_CONTEXT,
|
|
874
|
+
userMemory: USER_MEMORY,
|
|
875
|
+
telemetry: TELEMETRY_SETTINGS,
|
|
876
|
+
sessionId: SESSION_ID,
|
|
877
|
+
model: MODEL,
|
|
878
|
+
usageStatisticsEnabled: false,
|
|
879
|
+
};
|
|
880
|
+
it('should throw an error if getBaseLlmClient is called before refreshAuth', () => {
|
|
881
|
+
const config = new Config(baseParams);
|
|
882
|
+
expect(() => config.getBaseLlmClient()).toThrow('BaseLlmClient not initialized. Ensure authentication has occurred and ContentGenerator is ready.');
|
|
883
|
+
});
|
|
884
|
+
it('should successfully initialize BaseLlmClient after refreshAuth is called', async () => {
|
|
885
|
+
const config = new Config(baseParams);
|
|
886
|
+
const authType = AuthType.USE_GEMINI;
|
|
887
|
+
const mockContentConfig = { model: 'gemini-flash', apiKey: 'test-key' };
|
|
888
|
+
vi.mocked(createContentGeneratorConfig).mockReturnValue(mockContentConfig);
|
|
889
|
+
await config.refreshAuth(authType);
|
|
890
|
+
// Should not throw
|
|
891
|
+
const llmService = config.getBaseLlmClient();
|
|
892
|
+
expect(llmService).toBeDefined();
|
|
893
|
+
expect(BaseLlmClient).toHaveBeenCalledWith(config.getContentGenerator(), config);
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
//# sourceMappingURL=config.test.js.map
|