@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,684 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
const mockGenerateJson = vi.hoisted(() => vi.fn());
|
|
8
|
+
const mockOpenDiff = vi.hoisted(() => vi.fn());
|
|
9
|
+
import { IdeClient } from '../ide/ide-client.js';
|
|
10
|
+
vi.mock('../ide/ide-client.js', () => ({
|
|
11
|
+
IdeClient: {
|
|
12
|
+
getInstance: vi.fn(),
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('../utils/editor.js', () => ({
|
|
16
|
+
openDiff: mockOpenDiff,
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('../telemetry/loggers.js', () => ({
|
|
19
|
+
logFileOperation: vi.fn(),
|
|
20
|
+
}));
|
|
21
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
22
|
+
import { applyReplacement, EditTool } from './edit.js';
|
|
23
|
+
import { ToolConfirmationOutcome } from './tools.js';
|
|
24
|
+
import { ToolErrorType } from './tool-error.js';
|
|
25
|
+
import path from 'node:path';
|
|
26
|
+
import fs from 'node:fs';
|
|
27
|
+
import os from 'node:os';
|
|
28
|
+
import { ApprovalMode } from '../config/config.js';
|
|
29
|
+
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
|
30
|
+
import { StandardFileSystemService } from '../services/fileSystemService.js';
|
|
31
|
+
describe('EditTool', () => {
|
|
32
|
+
let tool;
|
|
33
|
+
let tempDir;
|
|
34
|
+
let rootDir;
|
|
35
|
+
let mockConfig;
|
|
36
|
+
let geminiClient;
|
|
37
|
+
let baseLlmClient;
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
vi.restoreAllMocks();
|
|
40
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'edit-tool-test-'));
|
|
41
|
+
rootDir = path.join(tempDir, 'root');
|
|
42
|
+
fs.mkdirSync(rootDir);
|
|
43
|
+
geminiClient = {
|
|
44
|
+
generateJson: mockGenerateJson, // mockGenerateJson is already defined and hoisted
|
|
45
|
+
};
|
|
46
|
+
baseLlmClient = {
|
|
47
|
+
generateJson: vi.fn(),
|
|
48
|
+
};
|
|
49
|
+
mockConfig = {
|
|
50
|
+
getGeminiClient: vi.fn().mockReturnValue(geminiClient),
|
|
51
|
+
getBaseLlmClient: vi.fn().mockReturnValue(baseLlmClient),
|
|
52
|
+
getTargetDir: () => rootDir,
|
|
53
|
+
getApprovalMode: vi.fn(),
|
|
54
|
+
setApprovalMode: vi.fn(),
|
|
55
|
+
getWorkspaceContext: () => createMockWorkspaceContext(rootDir),
|
|
56
|
+
getFileSystemService: () => new StandardFileSystemService(),
|
|
57
|
+
getIdeMode: () => false,
|
|
58
|
+
getApiKey: () => 'test-api-key',
|
|
59
|
+
getModel: () => 'test-model',
|
|
60
|
+
getSandbox: () => false,
|
|
61
|
+
getDebugMode: () => false,
|
|
62
|
+
getQuestion: () => undefined,
|
|
63
|
+
getFullContext: () => false,
|
|
64
|
+
getToolDiscoveryCommand: () => undefined,
|
|
65
|
+
getToolCallCommand: () => undefined,
|
|
66
|
+
getMcpServerCommand: () => undefined,
|
|
67
|
+
getMcpServers: () => undefined,
|
|
68
|
+
getUserAgent: () => 'test-agent',
|
|
69
|
+
getUserMemory: () => '',
|
|
70
|
+
setUserMemory: vi.fn(),
|
|
71
|
+
getGeminiMdFileCount: () => 0,
|
|
72
|
+
setGeminiMdFileCount: vi.fn(),
|
|
73
|
+
getToolRegistry: () => ({}), // Minimal mock for ToolRegistry
|
|
74
|
+
};
|
|
75
|
+
// Reset mocks before each test
|
|
76
|
+
mockConfig.getApprovalMode.mockClear();
|
|
77
|
+
// Default to not skipping confirmation
|
|
78
|
+
mockConfig.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
|
|
79
|
+
tool = new EditTool(mockConfig);
|
|
80
|
+
});
|
|
81
|
+
afterEach(() => {
|
|
82
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
83
|
+
});
|
|
84
|
+
describe('applyReplacement', () => {
|
|
85
|
+
it('should return newString if isNewFile is true', () => {
|
|
86
|
+
expect(applyReplacement(null, 'old', 'new', true)).toBe('new');
|
|
87
|
+
expect(applyReplacement('existing', 'old', 'new', true)).toBe('new');
|
|
88
|
+
});
|
|
89
|
+
it('should return newString if currentContent is null and oldString is empty (defensive)', () => {
|
|
90
|
+
expect(applyReplacement(null, '', 'new', false)).toBe('new');
|
|
91
|
+
});
|
|
92
|
+
it('should return empty string if currentContent is null and oldString is not empty (defensive)', () => {
|
|
93
|
+
expect(applyReplacement(null, 'old', 'new', false)).toBe('');
|
|
94
|
+
});
|
|
95
|
+
it('should replace oldString with newString in currentContent', () => {
|
|
96
|
+
expect(applyReplacement('hello old world old', 'old', 'new', false)).toBe('hello new world new');
|
|
97
|
+
});
|
|
98
|
+
it('should return currentContent if oldString is empty and not a new file', () => {
|
|
99
|
+
expect(applyReplacement('hello world', '', 'new', false)).toBe('hello world');
|
|
100
|
+
});
|
|
101
|
+
it('should treat $ literally and not as replacement pattern', () => {
|
|
102
|
+
const current = "price is $100 and pattern end is ' '";
|
|
103
|
+
const oldStr = 'price is $100';
|
|
104
|
+
const newStr = 'price is $200';
|
|
105
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
106
|
+
expect(result).toBe("price is $200 and pattern end is ' '");
|
|
107
|
+
});
|
|
108
|
+
it("should treat $' literally and not as a replacement pattern", () => {
|
|
109
|
+
const current = 'foo';
|
|
110
|
+
const oldStr = 'foo';
|
|
111
|
+
const newStr = "bar$'baz";
|
|
112
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
113
|
+
expect(result).toBe("bar$'baz");
|
|
114
|
+
});
|
|
115
|
+
it('should treat $& literally and not as a replacement pattern', () => {
|
|
116
|
+
const current = 'hello world';
|
|
117
|
+
const oldStr = 'hello';
|
|
118
|
+
const newStr = '$&-replacement';
|
|
119
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
120
|
+
expect(result).toBe('$&-replacement world');
|
|
121
|
+
});
|
|
122
|
+
it('should treat $` literally and not as a replacement pattern', () => {
|
|
123
|
+
const current = 'prefix-middle-suffix';
|
|
124
|
+
const oldStr = 'middle';
|
|
125
|
+
const newStr = 'new$`content';
|
|
126
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
127
|
+
expect(result).toBe('prefix-new$`content-suffix');
|
|
128
|
+
});
|
|
129
|
+
it('should treat $1, $2 capture groups literally', () => {
|
|
130
|
+
const current = 'test string';
|
|
131
|
+
const oldStr = 'test';
|
|
132
|
+
const newStr = '$1$2replacement';
|
|
133
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
134
|
+
expect(result).toBe('$1$2replacement string');
|
|
135
|
+
});
|
|
136
|
+
it('should use replaceAll for normal strings without problematic $ sequences', () => {
|
|
137
|
+
const current = 'normal text replacement';
|
|
138
|
+
const oldStr = 'text';
|
|
139
|
+
const newStr = 'string';
|
|
140
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
141
|
+
expect(result).toBe('normal string replacement');
|
|
142
|
+
});
|
|
143
|
+
it('should handle multiple occurrences with problematic $ sequences', () => {
|
|
144
|
+
const current = 'foo bar foo baz';
|
|
145
|
+
const oldStr = 'foo';
|
|
146
|
+
const newStr = "test$'end";
|
|
147
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
148
|
+
expect(result).toBe("test$'end bar test$'end baz");
|
|
149
|
+
});
|
|
150
|
+
it('should handle complex regex patterns with $ at end', () => {
|
|
151
|
+
const current = "| select('match', '^[sv]d[a-z]$')";
|
|
152
|
+
const oldStr = "'^[sv]d[a-z]$'";
|
|
153
|
+
const newStr = "'^[sv]d[a-z]$' # updated";
|
|
154
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
155
|
+
expect(result).toBe("| select('match', '^[sv]d[a-z]$' # updated)");
|
|
156
|
+
});
|
|
157
|
+
it('should handle empty replacement with problematic $ in newString', () => {
|
|
158
|
+
const current = 'test content';
|
|
159
|
+
const oldStr = 'nothing';
|
|
160
|
+
const newStr = "replacement$'text";
|
|
161
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
162
|
+
expect(result).toBe('test content'); // No replacement because oldStr not found
|
|
163
|
+
});
|
|
164
|
+
it('should handle $$ (escaped dollar) correctly', () => {
|
|
165
|
+
const current = 'price value';
|
|
166
|
+
const oldStr = 'value';
|
|
167
|
+
const newStr = '$$100';
|
|
168
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
169
|
+
expect(result).toBe('price $$100');
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
describe('validateToolParams', () => {
|
|
173
|
+
it('should return null for valid params', () => {
|
|
174
|
+
const params = {
|
|
175
|
+
file_path: path.join(rootDir, 'test.txt'),
|
|
176
|
+
old_string: 'old',
|
|
177
|
+
new_string: 'new',
|
|
178
|
+
};
|
|
179
|
+
expect(tool.validateToolParams(params)).toBeNull();
|
|
180
|
+
});
|
|
181
|
+
it('should return error for relative path', () => {
|
|
182
|
+
const params = {
|
|
183
|
+
file_path: 'test.txt',
|
|
184
|
+
old_string: 'old',
|
|
185
|
+
new_string: 'new',
|
|
186
|
+
};
|
|
187
|
+
expect(tool.validateToolParams(params)).toMatch(/File path must be absolute/);
|
|
188
|
+
});
|
|
189
|
+
it('should return error for path outside root', () => {
|
|
190
|
+
const params = {
|
|
191
|
+
file_path: path.join(tempDir, 'outside-root.txt'),
|
|
192
|
+
old_string: 'old',
|
|
193
|
+
new_string: 'new',
|
|
194
|
+
};
|
|
195
|
+
const error = tool.validateToolParams(params);
|
|
196
|
+
expect(error).toContain('File path must be within one of the workspace directories');
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
describe('shouldConfirmExecute', () => {
|
|
200
|
+
const testFile = 'edit_me.txt';
|
|
201
|
+
let filePath;
|
|
202
|
+
beforeEach(() => {
|
|
203
|
+
filePath = path.join(rootDir, testFile);
|
|
204
|
+
});
|
|
205
|
+
it('should throw an error if params are invalid', async () => {
|
|
206
|
+
const params = {
|
|
207
|
+
file_path: 'relative.txt',
|
|
208
|
+
old_string: 'old',
|
|
209
|
+
new_string: 'new',
|
|
210
|
+
};
|
|
211
|
+
expect(() => tool.build(params)).toThrow();
|
|
212
|
+
});
|
|
213
|
+
it('should request confirmation for valid edit', async () => {
|
|
214
|
+
fs.writeFileSync(filePath, 'some old content here');
|
|
215
|
+
const params = {
|
|
216
|
+
file_path: filePath,
|
|
217
|
+
old_string: 'old',
|
|
218
|
+
new_string: 'new',
|
|
219
|
+
};
|
|
220
|
+
const invocation = tool.build(params);
|
|
221
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
222
|
+
expect(confirmation).toEqual(expect.objectContaining({
|
|
223
|
+
title: `Confirm Edit: ${testFile}`,
|
|
224
|
+
fileName: testFile,
|
|
225
|
+
fileDiff: expect.any(String),
|
|
226
|
+
}));
|
|
227
|
+
});
|
|
228
|
+
it('should return false if old_string is not found', async () => {
|
|
229
|
+
fs.writeFileSync(filePath, 'some content here');
|
|
230
|
+
const params = {
|
|
231
|
+
file_path: filePath,
|
|
232
|
+
old_string: 'not_found',
|
|
233
|
+
new_string: 'new',
|
|
234
|
+
};
|
|
235
|
+
const invocation = tool.build(params);
|
|
236
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
237
|
+
expect(confirmation).toBe(false);
|
|
238
|
+
});
|
|
239
|
+
it('should return false if multiple occurrences of old_string are found', async () => {
|
|
240
|
+
fs.writeFileSync(filePath, 'old old content here');
|
|
241
|
+
const params = {
|
|
242
|
+
file_path: filePath,
|
|
243
|
+
old_string: 'old',
|
|
244
|
+
new_string: 'new',
|
|
245
|
+
};
|
|
246
|
+
const invocation = tool.build(params);
|
|
247
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
248
|
+
expect(confirmation).toBe(false);
|
|
249
|
+
});
|
|
250
|
+
it('should request confirmation for creating a new file (empty old_string)', async () => {
|
|
251
|
+
const newFileName = 'new_file.txt';
|
|
252
|
+
const newFilePath = path.join(rootDir, newFileName);
|
|
253
|
+
const params = {
|
|
254
|
+
file_path: newFilePath,
|
|
255
|
+
old_string: '',
|
|
256
|
+
new_string: 'new file content',
|
|
257
|
+
};
|
|
258
|
+
const invocation = tool.build(params);
|
|
259
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
260
|
+
expect(confirmation).toEqual(expect.objectContaining({
|
|
261
|
+
title: `Confirm Edit: ${newFileName}`,
|
|
262
|
+
fileName: newFileName,
|
|
263
|
+
fileDiff: expect.any(String),
|
|
264
|
+
}));
|
|
265
|
+
});
|
|
266
|
+
it('should rethrow calculateEdit errors when the abort signal is triggered', async () => {
|
|
267
|
+
const filePath = path.join(rootDir, 'abort-confirmation.txt');
|
|
268
|
+
const params = {
|
|
269
|
+
file_path: filePath,
|
|
270
|
+
old_string: 'old',
|
|
271
|
+
new_string: 'new',
|
|
272
|
+
};
|
|
273
|
+
const invocation = tool.build(params);
|
|
274
|
+
const abortController = new AbortController();
|
|
275
|
+
const abortError = new Error('Abort requested');
|
|
276
|
+
const calculateSpy = vi
|
|
277
|
+
.spyOn(invocation, 'calculateEdit')
|
|
278
|
+
.mockImplementation(async () => {
|
|
279
|
+
if (!abortController.signal.aborted) {
|
|
280
|
+
abortController.abort();
|
|
281
|
+
}
|
|
282
|
+
throw abortError;
|
|
283
|
+
});
|
|
284
|
+
await expect(invocation.shouldConfirmExecute(abortController.signal)).rejects.toBe(abortError);
|
|
285
|
+
calculateSpy.mockRestore();
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
describe('execute', () => {
|
|
289
|
+
const testFile = 'execute_me.txt';
|
|
290
|
+
let filePath;
|
|
291
|
+
beforeEach(() => {
|
|
292
|
+
filePath = path.join(rootDir, testFile);
|
|
293
|
+
});
|
|
294
|
+
it('should throw error if file path is not absolute', async () => {
|
|
295
|
+
const params = {
|
|
296
|
+
file_path: 'relative.txt',
|
|
297
|
+
old_string: 'old',
|
|
298
|
+
new_string: 'new',
|
|
299
|
+
};
|
|
300
|
+
expect(() => tool.build(params)).toThrow(/File path must be absolute/);
|
|
301
|
+
});
|
|
302
|
+
it('should throw error if file path is empty', async () => {
|
|
303
|
+
const params = {
|
|
304
|
+
file_path: '',
|
|
305
|
+
old_string: 'old',
|
|
306
|
+
new_string: 'new',
|
|
307
|
+
};
|
|
308
|
+
expect(() => tool.build(params)).toThrow(/The 'file_path' parameter must be non-empty./);
|
|
309
|
+
});
|
|
310
|
+
it('should reject when calculateEdit fails after an abort signal', async () => {
|
|
311
|
+
const params = {
|
|
312
|
+
file_path: path.join(rootDir, 'abort-execute.txt'),
|
|
313
|
+
old_string: 'old',
|
|
314
|
+
new_string: 'new',
|
|
315
|
+
};
|
|
316
|
+
const invocation = tool.build(params);
|
|
317
|
+
const abortController = new AbortController();
|
|
318
|
+
const abortError = new Error('Abort requested during execute');
|
|
319
|
+
const calculateSpy = vi
|
|
320
|
+
.spyOn(invocation, 'calculateEdit')
|
|
321
|
+
.mockImplementation(async () => {
|
|
322
|
+
if (!abortController.signal.aborted) {
|
|
323
|
+
abortController.abort();
|
|
324
|
+
}
|
|
325
|
+
throw abortError;
|
|
326
|
+
});
|
|
327
|
+
await expect(invocation.execute(abortController.signal)).rejects.toBe(abortError);
|
|
328
|
+
calculateSpy.mockRestore();
|
|
329
|
+
});
|
|
330
|
+
it('should edit an existing file and return diff with fileName', async () => {
|
|
331
|
+
const initialContent = 'This is some old text.';
|
|
332
|
+
const newContent = 'This is some new text.'; // old -> new
|
|
333
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
334
|
+
const params = {
|
|
335
|
+
file_path: filePath,
|
|
336
|
+
old_string: 'old',
|
|
337
|
+
new_string: 'new',
|
|
338
|
+
};
|
|
339
|
+
const invocation = tool.build(params);
|
|
340
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
341
|
+
expect(result.llmContent).toMatch(/Showing lines \d+-\d+ of \d+ from the edited file:/);
|
|
342
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe(newContent);
|
|
343
|
+
const display = result.returnDisplay;
|
|
344
|
+
expect(display.fileDiff).toMatch(initialContent);
|
|
345
|
+
expect(display.fileDiff).toMatch(newContent);
|
|
346
|
+
expect(display.fileName).toBe(testFile);
|
|
347
|
+
});
|
|
348
|
+
it('should create a new file if old_string is empty and file does not exist, and return created message', async () => {
|
|
349
|
+
const newFileName = 'brand_new_file.txt';
|
|
350
|
+
const newFilePath = path.join(rootDir, newFileName);
|
|
351
|
+
const fileContent = 'Content for the new file.';
|
|
352
|
+
const params = {
|
|
353
|
+
file_path: newFilePath,
|
|
354
|
+
old_string: '',
|
|
355
|
+
new_string: fileContent,
|
|
356
|
+
};
|
|
357
|
+
mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
|
|
358
|
+
const invocation = tool.build(params);
|
|
359
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
360
|
+
expect(result.llmContent).toMatch(/Created new file/);
|
|
361
|
+
expect(result.llmContent).toMatch(/Showing lines \d+-\d+ of \d+ from the edited file:/);
|
|
362
|
+
expect(fs.existsSync(newFilePath)).toBe(true);
|
|
363
|
+
expect(fs.readFileSync(newFilePath, 'utf8')).toBe(fileContent);
|
|
364
|
+
const display = result.returnDisplay;
|
|
365
|
+
expect(display.fileDiff).toMatch(/\+Content for the new file\./);
|
|
366
|
+
expect(display.fileName).toBe(newFileName);
|
|
367
|
+
expect(result.returnDisplay.diffStat).toStrictEqual({
|
|
368
|
+
model_added_lines: 1,
|
|
369
|
+
model_removed_lines: 0,
|
|
370
|
+
model_added_chars: 25,
|
|
371
|
+
model_removed_chars: 0,
|
|
372
|
+
user_added_lines: 0,
|
|
373
|
+
user_removed_lines: 0,
|
|
374
|
+
user_added_chars: 0,
|
|
375
|
+
user_removed_chars: 0,
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
it('should return error if old_string is not found in file', async () => {
|
|
379
|
+
fs.writeFileSync(filePath, 'Some content.', 'utf8');
|
|
380
|
+
const params = {
|
|
381
|
+
file_path: filePath,
|
|
382
|
+
old_string: 'nonexistent',
|
|
383
|
+
new_string: 'replacement',
|
|
384
|
+
};
|
|
385
|
+
const invocation = tool.build(params);
|
|
386
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
387
|
+
expect(result.llmContent).toMatch(/0 occurrences found for old_string in/);
|
|
388
|
+
expect(result.returnDisplay).toMatch(/Failed to edit, could not find the string to replace./);
|
|
389
|
+
});
|
|
390
|
+
it('should return error if multiple occurrences of old_string are found and replace_all is false', async () => {
|
|
391
|
+
fs.writeFileSync(filePath, 'multiple old old strings', 'utf8');
|
|
392
|
+
const params = {
|
|
393
|
+
file_path: filePath,
|
|
394
|
+
old_string: 'old',
|
|
395
|
+
new_string: 'new',
|
|
396
|
+
};
|
|
397
|
+
const invocation = tool.build(params);
|
|
398
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
399
|
+
expect(result.llmContent).toMatch(/replace_all was not enabled/);
|
|
400
|
+
expect(result.returnDisplay).toMatch(/Failed to edit because the text matches multiple locations/);
|
|
401
|
+
});
|
|
402
|
+
it('should successfully replace multiple occurrences when replace_all is true', async () => {
|
|
403
|
+
fs.writeFileSync(filePath, 'old text\nold text\nold text', 'utf8');
|
|
404
|
+
const params = {
|
|
405
|
+
file_path: filePath,
|
|
406
|
+
old_string: 'old',
|
|
407
|
+
new_string: 'new',
|
|
408
|
+
replace_all: true,
|
|
409
|
+
};
|
|
410
|
+
const invocation = tool.build(params);
|
|
411
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
412
|
+
expect(result.llmContent).toMatch(/Showing lines \d+-\d+ of \d+ from the edited file/);
|
|
413
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe('new text\nnew text\nnew text');
|
|
414
|
+
const display = result.returnDisplay;
|
|
415
|
+
expect(display.fileDiff).toMatch(/-old text\n-old text\n-old text/);
|
|
416
|
+
expect(display.fileDiff).toMatch(/\+new text\n\+new text\n\+new text/);
|
|
417
|
+
expect(display.fileName).toBe(testFile);
|
|
418
|
+
expect(result.returnDisplay.diffStat).toStrictEqual({
|
|
419
|
+
model_added_lines: 3,
|
|
420
|
+
model_removed_lines: 3,
|
|
421
|
+
model_added_chars: 24,
|
|
422
|
+
model_removed_chars: 24,
|
|
423
|
+
user_added_lines: 0,
|
|
424
|
+
user_removed_lines: 0,
|
|
425
|
+
user_added_chars: 0,
|
|
426
|
+
user_removed_chars: 0,
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
it('should return error if trying to create a file that already exists (empty old_string)', async () => {
|
|
430
|
+
fs.writeFileSync(filePath, 'Existing content', 'utf8');
|
|
431
|
+
const params = {
|
|
432
|
+
file_path: filePath,
|
|
433
|
+
old_string: '',
|
|
434
|
+
new_string: 'new content',
|
|
435
|
+
};
|
|
436
|
+
const invocation = tool.build(params);
|
|
437
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
438
|
+
expect(result.llmContent).toMatch(/File already exists, cannot create/);
|
|
439
|
+
expect(result.returnDisplay).toMatch(/Attempted to create a file that already exists/);
|
|
440
|
+
});
|
|
441
|
+
it('should not include modification message when proposed content is not modified', async () => {
|
|
442
|
+
const initialContent = 'This is some old text.';
|
|
443
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
444
|
+
const params = {
|
|
445
|
+
file_path: filePath,
|
|
446
|
+
old_string: 'old',
|
|
447
|
+
new_string: 'new',
|
|
448
|
+
modified_by_user: false,
|
|
449
|
+
};
|
|
450
|
+
mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
|
|
451
|
+
const invocation = tool.build(params);
|
|
452
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
453
|
+
expect(result.llmContent).not.toMatch(/User modified the `new_string` content/);
|
|
454
|
+
});
|
|
455
|
+
it('should not include modification message when modified_by_user is not provided', async () => {
|
|
456
|
+
const initialContent = 'This is some old text.';
|
|
457
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
458
|
+
const params = {
|
|
459
|
+
file_path: filePath,
|
|
460
|
+
old_string: 'old',
|
|
461
|
+
new_string: 'new',
|
|
462
|
+
};
|
|
463
|
+
mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
|
|
464
|
+
const invocation = tool.build(params);
|
|
465
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
466
|
+
expect(result.llmContent).not.toMatch(/User modified the `new_string` content/);
|
|
467
|
+
});
|
|
468
|
+
it('should return error if old_string and new_string are identical', async () => {
|
|
469
|
+
const initialContent = 'This is some identical text.';
|
|
470
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
471
|
+
const params = {
|
|
472
|
+
file_path: filePath,
|
|
473
|
+
old_string: 'identical',
|
|
474
|
+
new_string: 'identical',
|
|
475
|
+
};
|
|
476
|
+
const invocation = tool.build(params);
|
|
477
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
478
|
+
expect(result.llmContent).toMatch(/No changes to apply/);
|
|
479
|
+
expect(result.returnDisplay).toMatch(/No changes to apply/);
|
|
480
|
+
});
|
|
481
|
+
it('should return EDIT_NO_CHANGE error if replacement results in identical content', async () => {
|
|
482
|
+
// This can happen if the literal string replacement with `replaceAll` results in no change.
|
|
483
|
+
const initialContent = 'line 1\nline 2\nline 3'; // Note the double space
|
|
484
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
485
|
+
const params = {
|
|
486
|
+
file_path: filePath,
|
|
487
|
+
// old_string has a single space, so it won't be found by replaceAll
|
|
488
|
+
old_string: 'line 1\nline 2\nline 3',
|
|
489
|
+
new_string: 'line 1\nnew line 2\nline 3',
|
|
490
|
+
};
|
|
491
|
+
const invocation = tool.build(params);
|
|
492
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
493
|
+
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_OCCURRENCE_FOUND);
|
|
494
|
+
expect(result.returnDisplay).toMatch(/Failed to edit, could not find the string to replace./);
|
|
495
|
+
// Ensure the file was not actually changed
|
|
496
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe(initialContent);
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
describe('Error Scenarios', () => {
|
|
500
|
+
const testFile = 'error_test.txt';
|
|
501
|
+
let filePath;
|
|
502
|
+
beforeEach(() => {
|
|
503
|
+
filePath = path.join(rootDir, testFile);
|
|
504
|
+
});
|
|
505
|
+
it('should return FILE_NOT_FOUND error', async () => {
|
|
506
|
+
const params = {
|
|
507
|
+
file_path: filePath,
|
|
508
|
+
old_string: 'any',
|
|
509
|
+
new_string: 'new',
|
|
510
|
+
};
|
|
511
|
+
const invocation = tool.build(params);
|
|
512
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
513
|
+
expect(result.error?.type).toBe(ToolErrorType.FILE_NOT_FOUND);
|
|
514
|
+
});
|
|
515
|
+
it('should return ATTEMPT_TO_CREATE_EXISTING_FILE error', async () => {
|
|
516
|
+
fs.writeFileSync(filePath, 'existing content', 'utf8');
|
|
517
|
+
const params = {
|
|
518
|
+
file_path: filePath,
|
|
519
|
+
old_string: '',
|
|
520
|
+
new_string: 'new content',
|
|
521
|
+
};
|
|
522
|
+
const invocation = tool.build(params);
|
|
523
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
524
|
+
expect(result.error?.type).toBe(ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE);
|
|
525
|
+
});
|
|
526
|
+
it('should return NO_OCCURRENCE_FOUND error', async () => {
|
|
527
|
+
fs.writeFileSync(filePath, 'content', 'utf8');
|
|
528
|
+
const params = {
|
|
529
|
+
file_path: filePath,
|
|
530
|
+
old_string: 'not-found',
|
|
531
|
+
new_string: 'new',
|
|
532
|
+
};
|
|
533
|
+
const invocation = tool.build(params);
|
|
534
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
535
|
+
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_OCCURRENCE_FOUND);
|
|
536
|
+
});
|
|
537
|
+
it('should return EXPECTED_OCCURRENCE_MISMATCH error when replace_all is false and text is not unique', async () => {
|
|
538
|
+
fs.writeFileSync(filePath, 'one one two', 'utf8');
|
|
539
|
+
const params = {
|
|
540
|
+
file_path: filePath,
|
|
541
|
+
old_string: 'one',
|
|
542
|
+
new_string: 'new',
|
|
543
|
+
};
|
|
544
|
+
const invocation = tool.build(params);
|
|
545
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
546
|
+
expect(result.error?.type).toBe(ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH);
|
|
547
|
+
});
|
|
548
|
+
it('should return NO_CHANGE error', async () => {
|
|
549
|
+
fs.writeFileSync(filePath, 'content', 'utf8');
|
|
550
|
+
const params = {
|
|
551
|
+
file_path: filePath,
|
|
552
|
+
old_string: 'content',
|
|
553
|
+
new_string: 'content',
|
|
554
|
+
};
|
|
555
|
+
const invocation = tool.build(params);
|
|
556
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
557
|
+
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE);
|
|
558
|
+
});
|
|
559
|
+
it('should throw INVALID_PARAMETERS error for relative path', async () => {
|
|
560
|
+
const params = {
|
|
561
|
+
file_path: 'relative/path.txt',
|
|
562
|
+
old_string: 'a',
|
|
563
|
+
new_string: 'b',
|
|
564
|
+
};
|
|
565
|
+
expect(() => tool.build(params)).toThrow();
|
|
566
|
+
});
|
|
567
|
+
it('should return FILE_WRITE_FAILURE on write error', async () => {
|
|
568
|
+
fs.writeFileSync(filePath, 'content', 'utf8');
|
|
569
|
+
// Make file readonly to trigger a write error
|
|
570
|
+
fs.chmodSync(filePath, '444');
|
|
571
|
+
const params = {
|
|
572
|
+
file_path: filePath,
|
|
573
|
+
old_string: 'content',
|
|
574
|
+
new_string: 'new content',
|
|
575
|
+
};
|
|
576
|
+
const invocation = tool.build(params);
|
|
577
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
578
|
+
expect(result.error?.type).toBe(ToolErrorType.FILE_WRITE_FAILURE);
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
describe('getDescription', () => {
|
|
582
|
+
it('should return "No file changes to..." if old_string and new_string are the same', () => {
|
|
583
|
+
const testFileName = 'test.txt';
|
|
584
|
+
const params = {
|
|
585
|
+
file_path: path.join(rootDir, testFileName),
|
|
586
|
+
old_string: 'identical_string',
|
|
587
|
+
new_string: 'identical_string',
|
|
588
|
+
};
|
|
589
|
+
const invocation = tool.build(params);
|
|
590
|
+
// shortenPath will be called internally, resulting in just the file name
|
|
591
|
+
expect(invocation.getDescription()).toBe(`No file changes to ${testFileName}`);
|
|
592
|
+
});
|
|
593
|
+
it('should return a snippet of old and new strings if they are different', () => {
|
|
594
|
+
const testFileName = 'test.txt';
|
|
595
|
+
const params = {
|
|
596
|
+
file_path: path.join(rootDir, testFileName),
|
|
597
|
+
old_string: 'this is the old string value',
|
|
598
|
+
new_string: 'this is the new string value',
|
|
599
|
+
};
|
|
600
|
+
const invocation = tool.build(params);
|
|
601
|
+
// shortenPath will be called internally, resulting in just the file name
|
|
602
|
+
// The snippets are truncated at 30 chars + '...'
|
|
603
|
+
expect(invocation.getDescription()).toBe(`${testFileName}: this is the old string value => this is the new string value`);
|
|
604
|
+
});
|
|
605
|
+
it('should handle very short strings correctly in the description', () => {
|
|
606
|
+
const testFileName = 'short.txt';
|
|
607
|
+
const params = {
|
|
608
|
+
file_path: path.join(rootDir, testFileName),
|
|
609
|
+
old_string: 'old',
|
|
610
|
+
new_string: 'new',
|
|
611
|
+
};
|
|
612
|
+
const invocation = tool.build(params);
|
|
613
|
+
expect(invocation.getDescription()).toBe(`${testFileName}: old => new`);
|
|
614
|
+
});
|
|
615
|
+
it('should truncate long strings in the description', () => {
|
|
616
|
+
const testFileName = 'long.txt';
|
|
617
|
+
const params = {
|
|
618
|
+
file_path: path.join(rootDir, testFileName),
|
|
619
|
+
old_string: 'this is a very long old string that will definitely be truncated',
|
|
620
|
+
new_string: 'this is a very long new string that will also be truncated',
|
|
621
|
+
};
|
|
622
|
+
const invocation = tool.build(params);
|
|
623
|
+
expect(invocation.getDescription()).toBe(`${testFileName}: this is a very long old string... => this is a very long new string...`);
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
describe('workspace boundary validation', () => {
|
|
627
|
+
it('should validate paths are within workspace root', () => {
|
|
628
|
+
const validPath = {
|
|
629
|
+
file_path: path.join(rootDir, 'file.txt'),
|
|
630
|
+
old_string: 'old',
|
|
631
|
+
new_string: 'new',
|
|
632
|
+
};
|
|
633
|
+
expect(tool.validateToolParams(validPath)).toBeNull();
|
|
634
|
+
});
|
|
635
|
+
it('should reject paths outside workspace root', () => {
|
|
636
|
+
const invalidPath = {
|
|
637
|
+
file_path: '/etc/passwd',
|
|
638
|
+
old_string: 'root',
|
|
639
|
+
new_string: 'hacked',
|
|
640
|
+
};
|
|
641
|
+
const error = tool.validateToolParams(invalidPath);
|
|
642
|
+
expect(error).toContain('File path must be within one of the workspace directories');
|
|
643
|
+
expect(error).toContain(rootDir);
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
describe('IDE mode', () => {
|
|
647
|
+
const testFile = 'edit_me.txt';
|
|
648
|
+
let filePath;
|
|
649
|
+
let ideClient;
|
|
650
|
+
beforeEach(() => {
|
|
651
|
+
filePath = path.join(rootDir, testFile);
|
|
652
|
+
ideClient = {
|
|
653
|
+
openDiff: vi.fn(),
|
|
654
|
+
isDiffingEnabled: vi.fn().mockReturnValue(true),
|
|
655
|
+
};
|
|
656
|
+
vi.mocked(IdeClient.getInstance).mockResolvedValue(ideClient);
|
|
657
|
+
mockConfig.getIdeMode = () => true;
|
|
658
|
+
});
|
|
659
|
+
it('should call ideClient.openDiff and update params on confirmation', async () => {
|
|
660
|
+
const initialContent = 'some old content here';
|
|
661
|
+
const newContent = 'some new content here';
|
|
662
|
+
const modifiedContent = 'some modified content here';
|
|
663
|
+
fs.writeFileSync(filePath, initialContent);
|
|
664
|
+
const params = {
|
|
665
|
+
file_path: filePath,
|
|
666
|
+
old_string: 'old',
|
|
667
|
+
new_string: 'new',
|
|
668
|
+
};
|
|
669
|
+
ideClient.openDiff.mockResolvedValueOnce({
|
|
670
|
+
status: 'accepted',
|
|
671
|
+
content: modifiedContent,
|
|
672
|
+
});
|
|
673
|
+
const invocation = tool.build(params);
|
|
674
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
675
|
+
expect(ideClient.openDiff).toHaveBeenCalledWith(filePath, newContent);
|
|
676
|
+
if (confirmation && 'onConfirm' in confirmation) {
|
|
677
|
+
await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
678
|
+
}
|
|
679
|
+
expect(params.old_string).toBe(initialContent);
|
|
680
|
+
expect(params.new_string).toBe(modifiedContent);
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
//# sourceMappingURL=edit.test.js.map
|