@google/gemini-cli-core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +320 -0
- package/dist/.last_build +0 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +17 -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 +416 -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 +817 -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 +378 -0
- package/dist/src/config/config.js +765 -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 +712 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/flashFallback.test.d.ts +6 -0
- package/dist/src/config/flashFallback.test.js +87 -0
- package/dist/src/config/flashFallback.test.js.map +1 -0
- package/dist/src/config/models.d.ts +25 -0
- package/dist/src/config/models.js +39 -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 +47 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/confirmation-bus/index.d.ts +7 -0
- package/dist/src/confirmation-bus/index.js +8 -0
- package/dist/src/confirmation-bus/index.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.d.ts +17 -0
- package/dist/src/confirmation-bus/message-bus.js +81 -0
- package/dist/src/confirmation-bus/message-bus.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.test.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.test.js +164 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +38 -0
- package/dist/src/confirmation-bus/types.js +15 -0
- package/dist/src/confirmation-bus/types.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +46 -0
- package/dist/src/core/baseLlmClient.js +112 -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 +253 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +60 -0
- package/dist/src/core/client.js +602 -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 +1758 -0
- package/dist/src/core/client.test.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +32 -0
- package/dist/src/core/contentGenerator.js +76 -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 +122 -0
- package/dist/src/core/contentGenerator.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +131 -0
- package/dist/src/core/coreToolScheduler.js +706 -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 +1151 -0
- package/dist/src/core/coreToolScheduler.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +128 -0
- package/dist/src/core/geminiChat.js +537 -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 +1163 -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/logger.d.ts +60 -0
- package/dist/src/core/logger.js +360 -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 +10 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +24 -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/prompts.d.ts +17 -0
- package/dist/src/core/prompts.js +380 -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 +343 -0
- package/dist/src/core/prompts.test.js.map +1 -0
- package/dist/src/core/subagent.d.ts +236 -0
- package/dist/src/core/subagent.js +482 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagent.test.d.ts +6 -0
- package/dist/src/core/subagent.test.js +530 -0
- package/dist/src/core/subagent.test.js.map +1 -0
- package/dist/src/core/tokenLimits.d.ts +10 -0
- package/dist/src/core/tokenLimits.js +28 -0
- package/dist/src/core/tokenLimits.js.map +1 -0
- package/dist/src/core/turn.d.ts +141 -0
- package/dist/src/core/turn.js +188 -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 +51 -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 +53 -0
- package/dist/src/ide/detect-ide.js +58 -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 +69 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +109 -0
- package/dist/src/ide/ide-client.js +640 -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 +388 -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 +111 -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 +131 -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 +87 -0
- package/dist/src/index.js +97 -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 +149 -0
- package/dist/src/mcp/oauth-provider.js +608 -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 +711 -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 +235 -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/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/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 +20 -0
- package/dist/src/output/types.js +11 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/policy/index.d.ts +7 -0
- package/dist/src/policy/index.js +8 -0
- package/dist/src/policy/index.js.map +1 -0
- package/dist/src/policy/policy-engine.d.ts +30 -0
- package/dist/src/policy/policy-engine.js +83 -0
- package/dist/src/policy/policy-engine.js.map +1 -0
- package/dist/src/policy/policy-engine.test.d.ts +6 -0
- package/dist/src/policy/policy-engine.test.js +470 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -0
- package/dist/src/policy/stable-stringify.d.ts +58 -0
- package/dist/src/policy/stable-stringify.js +122 -0
- package/dist/src/policy/stable-stringify.js.map +1 -0
- package/dist/src/policy/types.d.ts +47 -0
- package/dist/src/policy/types.js +12 -0
- package/dist/src/policy/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/routing/modelRouterService.d.ts +23 -0
- package/dist/src/routing/modelRouterService.js +70 -0
- package/dist/src/routing/modelRouterService.js.map +1 -0
- package/dist/src/routing/modelRouterService.test.d.ts +6 -0
- package/dist/src/routing/modelRouterService.test.js +98 -0
- package/dist/src/routing/modelRouterService.test.js.map +1 -0
- package/dist/src/routing/routingStrategy.d.ts +62 -0
- package/dist/src/routing/routingStrategy.js +7 -0
- package/dist/src/routing/routingStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/classifierStrategy.js +173 -0
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js +192 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.d.ts +26 -0
- package/dist/src/routing/strategies/compositeStrategy.js +67 -0
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js +123 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/defaultStrategy.js +20 -0
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js +26 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/fallbackStrategy.js +25 -0
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js +55 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.d.ts +15 -0
- package/dist/src/routing/strategies/overrideStrategy.js +28 -0
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js +42 -0
- package/dist/src/routing/strategies/overrideStrategy.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 +105 -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 +31 -0
- package/dist/src/services/fileSystemService.js +18 -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 +23 -0
- package/dist/src/services/gitService.js +107 -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 +202 -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 +587 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +100 -0
- package/dist/src/services/shellExecutionService.js +466 -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 +614 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -0
- package/dist/src/telemetry/activity-detector.d.ts +41 -0
- package/dist/src/telemetry/activity-detector.js +61 -0
- package/dist/src/telemetry/activity-detector.js.map +1 -0
- package/dist/src/telemetry/activity-detector.test.d.ts +6 -0
- package/dist/src/telemetry/activity-detector.test.js +136 -0
- package/dist/src/telemetry/activity-detector.test.js.map +1 -0
- package/dist/src/telemetry/activity-types.d.ts +19 -0
- package/dist/src/telemetry/activity-types.js +21 -0
- package/dist/src/telemetry/activity-types.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +135 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +892 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +17 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +507 -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 +107 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +275 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +40 -0
- package/dist/src/telemetry/constants.js +41 -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/gcp-exporters.d.ts +34 -0
- package/dist/src/telemetry/gcp-exporters.js +117 -0
- package/dist/src/telemetry/gcp-exporters.js.map +1 -0
- package/dist/src/telemetry/gcp-exporters.test.d.ts +6 -0
- package/dist/src/telemetry/gcp-exporters.test.js +318 -0
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.d.ts +43 -0
- package/dist/src/telemetry/high-water-mark-tracker.js +88 -0
- package/dist/src/telemetry/high-water-mark-tracker.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +6 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js +152 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +26 -0
- package/dist/src/telemetry/index.js +26 -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 +54 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +33 -0
- package/dist/src/telemetry/loggers.js +536 -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 +887 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +37 -0
- package/dist/src/telemetry/metrics.js +231 -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 +264 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -0
- package/dist/src/telemetry/rate-limiter.d.ts +48 -0
- package/dist/src/telemetry/rate-limiter.js +100 -0
- package/dist/src/telemetry/rate-limiter.js.map +1 -0
- package/dist/src/telemetry/rate-limiter.test.d.ts +6 -0
- package/dist/src/telemetry/rate-limiter.test.js +207 -0
- package/dist/src/telemetry/rate-limiter.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -0
- package/dist/src/telemetry/sdk.js +178 -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 +177 -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 +284 -0
- package/dist/src/telemetry/types.js +487 -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 +558 -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 +41 -0
- package/dist/src/test-utils/mock-tool.js +51 -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/test-utils/tools.d.ts +45 -0
- package/dist/src/test-utils/tools.js +105 -0
- package/dist/src/test-utils/tools.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 +56 -0
- package/dist/src/tools/edit.js +414 -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 +824 -0
- package/dist/src/tools/edit.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +56 -0
- package/dist/src/tools/glob.js +243 -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 +426 -0
- package/dist/src/tools/glob.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +47 -0
- package/dist/src/tools/grep.js +517 -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 +295 -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 +214 -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 +199 -0
- package/dist/src/tools/mcp-client.js +1000 -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 +454 -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 +240 -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 +597 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +40 -0
- package/dist/src/tools/memoryTool.js +268 -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 +298 -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 +132 -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 +340 -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 +382 -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 +565 -0
- package/dist/src/tools/read-many-files.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +55 -0
- package/dist/src/tools/ripGrep.js +393 -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 +976 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +32 -0
- package/dist/src/tools/shell.js +316 -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 +301 -0
- package/dist/src/tools/shell.test.js.map +1 -0
- package/dist/src/tools/smart-edit.d.ts +72 -0
- package/dist/src/tools/smart-edit.js +594 -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 +419 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +43 -0
- package/dist/src/tools/tool-error.js +58 -0
- package/dist/src/tools/tool-error.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 +281 -0
- package/dist/src/tools/tools.js +257 -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 +27 -0
- package/dist/src/tools/web-fetch.js +244 -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 +114 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -0
- package/dist/src/tools/web-search.d.ts +49 -0
- package/dist/src/tools/web-search.js +139 -0
- package/dist/src/tools/web-search.js.map +1 -0
- package/dist/src/tools/web-search.test.d.ts +6 -0
- package/dist/src/tools/web-search.test.js +207 -0
- package/dist/src/tools/web-search.test.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +52 -0
- package/dist/src/tools/write-file.js +309 -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 +611 -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/editCorrector.d.ts +54 -0
- package/dist/src/utils/editCorrector.js +588 -0
- package/dist/src/utils/editCorrector.js.map +1 -0
- package/dist/src/utils/editCorrector.test.d.ts +6 -0
- package/dist/src/utils/editCorrector.test.js +515 -0
- package/dist/src/utils/editCorrector.test.js.map +1 -0
- package/dist/src/utils/editor.d.ts +28 -0
- package/dist/src/utils/editor.js +173 -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 +431 -0
- package/dist/src/utils/editor.test.js.map +1 -0
- package/dist/src/utils/environmentContext.d.ts +21 -0
- package/dist/src/utils/environmentContext.js +90 -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 +140 -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 +405 -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 +682 -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/geminiIgnoreParser.d.ts +18 -0
- package/dist/src/utils/geminiIgnoreParser.js +61 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/geminiIgnoreParser.test.js +50 -0
- package/dist/src/utils/geminiIgnoreParser.test.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 +121 -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 +105 -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 +254 -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 +296 -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 +573 -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 +179 -0
- package/dist/src/utils/nextSpeakerChecker.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 +363 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +58 -0
- package/dist/src/utils/paths.js +159 -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 +225 -0
- package/dist/src/utils/paths.test.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 +18 -0
- package/dist/src/utils/quotaErrorDetection.js +65 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -0
- package/dist/src/utils/retry.d.ts +30 -0
- package/dist/src/utils/retry.js +276 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/retry.test.d.ts +6 -0
- package/dist/src/utils/retry.test.js +325 -0
- package/dist/src/utils/retry.test.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.d.ts +13 -0
- package/dist/src/utils/safeJsonStringify.js +25 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
- package/dist/src/utils/safeJsonStringify.test.js +61 -0
- package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
- package/dist/src/utils/schemaValidator.d.ts +15 -0
- package/dist/src/utils/schemaValidator.js +38 -0
- package/dist/src/utils/schemaValidator.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 +122 -0
- package/dist/src/utils/shell-utils.js +393 -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 +332 -0
- package/dist/src/utils/shell-utils.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 +28 -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/tool-utils.d.ts +19 -0
- package/dist/src/utils/tool-utils.js +58 -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 +61 -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/tsconfig.tsbuildinfo +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, beforeEach, afterEach, vi, } from 'vitest';
|
|
7
|
+
import { getCorrectedFileContent, WriteFileTool } from './write-file.js';
|
|
8
|
+
import { ToolErrorType } from './tool-error.js';
|
|
9
|
+
import { ToolConfirmationOutcome } from './tools.js';
|
|
10
|
+
import {} from './edit.js';
|
|
11
|
+
import { ApprovalMode } from '../config/config.js';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import os from 'node:os';
|
|
15
|
+
import { GeminiClient } from '../core/client.js';
|
|
16
|
+
import { ensureCorrectEdit, ensureCorrectFileContent, } from '../utils/editCorrector.js';
|
|
17
|
+
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
|
18
|
+
import { StandardFileSystemService } from '../services/fileSystemService.js';
|
|
19
|
+
import { IdeClient } from '../ide/ide-client.js';
|
|
20
|
+
const rootDir = path.resolve(os.tmpdir(), 'gemini-cli-test-root');
|
|
21
|
+
// --- MOCKS ---
|
|
22
|
+
vi.mock('../core/client.js');
|
|
23
|
+
vi.mock('../utils/editCorrector.js');
|
|
24
|
+
vi.mock('../ide/ide-client.js', () => ({
|
|
25
|
+
IdeClient: {
|
|
26
|
+
getInstance: vi.fn(),
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
let mockGeminiClientInstance;
|
|
30
|
+
let mockBaseLlmClientInstance;
|
|
31
|
+
const mockEnsureCorrectEdit = vi.fn();
|
|
32
|
+
const mockEnsureCorrectFileContent = vi.fn();
|
|
33
|
+
const mockIdeClient = {
|
|
34
|
+
openDiff: vi.fn(),
|
|
35
|
+
isDiffingEnabled: vi.fn(),
|
|
36
|
+
};
|
|
37
|
+
// Wire up the mocked functions to be used by the actual module imports
|
|
38
|
+
vi.mocked(ensureCorrectEdit).mockImplementation(mockEnsureCorrectEdit);
|
|
39
|
+
vi.mocked(ensureCorrectFileContent).mockImplementation(mockEnsureCorrectFileContent);
|
|
40
|
+
vi.mocked(IdeClient.getInstance).mockResolvedValue(mockIdeClient);
|
|
41
|
+
// Mock Config
|
|
42
|
+
const fsService = new StandardFileSystemService();
|
|
43
|
+
const mockConfigInternal = {
|
|
44
|
+
getTargetDir: () => rootDir,
|
|
45
|
+
getApprovalMode: vi.fn(() => ApprovalMode.DEFAULT),
|
|
46
|
+
setApprovalMode: vi.fn(),
|
|
47
|
+
getGeminiClient: vi.fn(), // Initialize as a plain mock function
|
|
48
|
+
getBaseLlmClient: vi.fn(), // Initialize as a plain mock function
|
|
49
|
+
getFileSystemService: () => fsService,
|
|
50
|
+
getIdeMode: vi.fn(() => false),
|
|
51
|
+
getWorkspaceContext: () => createMockWorkspaceContext(rootDir),
|
|
52
|
+
getApiKey: () => 'test-key',
|
|
53
|
+
getModel: () => 'test-model',
|
|
54
|
+
getSandbox: () => false,
|
|
55
|
+
getDebugMode: () => false,
|
|
56
|
+
getQuestion: () => undefined,
|
|
57
|
+
getFullContext: () => false,
|
|
58
|
+
getToolDiscoveryCommand: () => undefined,
|
|
59
|
+
getToolCallCommand: () => undefined,
|
|
60
|
+
getMcpServerCommand: () => undefined,
|
|
61
|
+
getMcpServers: () => undefined,
|
|
62
|
+
getUserAgent: () => 'test-agent',
|
|
63
|
+
getUserMemory: () => '',
|
|
64
|
+
setUserMemory: vi.fn(),
|
|
65
|
+
getGeminiMdFileCount: () => 0,
|
|
66
|
+
setGeminiMdFileCount: vi.fn(),
|
|
67
|
+
getToolRegistry: () => ({
|
|
68
|
+
registerTool: vi.fn(),
|
|
69
|
+
discoverTools: vi.fn(),
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
const mockConfig = mockConfigInternal;
|
|
73
|
+
vi.mock('../telemetry/loggers.js', () => ({
|
|
74
|
+
logFileOperation: vi.fn(),
|
|
75
|
+
}));
|
|
76
|
+
// --- END MOCKS ---
|
|
77
|
+
describe('WriteFileTool', () => {
|
|
78
|
+
let tool;
|
|
79
|
+
let tempDir;
|
|
80
|
+
beforeEach(() => {
|
|
81
|
+
vi.clearAllMocks();
|
|
82
|
+
// Create a unique temporary directory for files created outside the root
|
|
83
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'write-file-test-external-'));
|
|
84
|
+
// Ensure the rootDir for the tool exists
|
|
85
|
+
if (!fs.existsSync(rootDir)) {
|
|
86
|
+
fs.mkdirSync(rootDir, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
// Setup GeminiClient mock
|
|
89
|
+
mockGeminiClientInstance = new (vi.mocked(GeminiClient))(mockConfig);
|
|
90
|
+
vi.mocked(GeminiClient).mockImplementation(() => mockGeminiClientInstance);
|
|
91
|
+
// Setup BaseLlmClient mock
|
|
92
|
+
mockBaseLlmClientInstance = {
|
|
93
|
+
generateJson: vi.fn(),
|
|
94
|
+
};
|
|
95
|
+
vi.mocked(ensureCorrectEdit).mockImplementation(mockEnsureCorrectEdit);
|
|
96
|
+
vi.mocked(ensureCorrectFileContent).mockImplementation(mockEnsureCorrectFileContent);
|
|
97
|
+
// Now that mock instances are initialized, set the mock implementations for config getters
|
|
98
|
+
mockConfigInternal.getGeminiClient.mockReturnValue(mockGeminiClientInstance);
|
|
99
|
+
mockConfigInternal.getBaseLlmClient.mockReturnValue(mockBaseLlmClientInstance);
|
|
100
|
+
tool = new WriteFileTool(mockConfig);
|
|
101
|
+
// Reset mocks before each test
|
|
102
|
+
mockConfigInternal.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
|
|
103
|
+
mockConfigInternal.setApprovalMode.mockClear();
|
|
104
|
+
mockEnsureCorrectEdit.mockReset();
|
|
105
|
+
mockEnsureCorrectFileContent.mockReset();
|
|
106
|
+
// Default mock implementations that return valid structures
|
|
107
|
+
mockEnsureCorrectEdit.mockImplementation(async (filePath, _currentContent, params, _client, _baseClient, signal) => {
|
|
108
|
+
if (signal?.aborted) {
|
|
109
|
+
return Promise.reject(new Error('Aborted'));
|
|
110
|
+
}
|
|
111
|
+
return Promise.resolve({
|
|
112
|
+
params: { ...params, new_string: params.new_string ?? '' },
|
|
113
|
+
occurrences: 1,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
mockEnsureCorrectFileContent.mockImplementation(async (content, _baseClient, signal) => {
|
|
117
|
+
if (signal?.aborted) {
|
|
118
|
+
return Promise.reject(new Error('Aborted'));
|
|
119
|
+
}
|
|
120
|
+
return Promise.resolve(content ?? '');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
afterEach(() => {
|
|
124
|
+
// Clean up the temporary directories
|
|
125
|
+
if (fs.existsSync(tempDir)) {
|
|
126
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
127
|
+
}
|
|
128
|
+
if (fs.existsSync(rootDir)) {
|
|
129
|
+
fs.rmSync(rootDir, { recursive: true, force: true });
|
|
130
|
+
}
|
|
131
|
+
vi.clearAllMocks();
|
|
132
|
+
});
|
|
133
|
+
describe('build', () => {
|
|
134
|
+
it('should return an invocation for a valid absolute path within root', () => {
|
|
135
|
+
const params = {
|
|
136
|
+
file_path: path.join(rootDir, 'test.txt'),
|
|
137
|
+
content: 'hello',
|
|
138
|
+
};
|
|
139
|
+
const invocation = tool.build(params);
|
|
140
|
+
expect(invocation).toBeDefined();
|
|
141
|
+
expect(invocation.params).toEqual(params);
|
|
142
|
+
});
|
|
143
|
+
it('should throw an error for a relative path', () => {
|
|
144
|
+
const params = { file_path: 'test.txt', content: 'hello' };
|
|
145
|
+
expect(() => tool.build(params)).toThrow(/File path must be absolute/);
|
|
146
|
+
});
|
|
147
|
+
it('should throw an error for a path outside root', () => {
|
|
148
|
+
const outsidePath = path.resolve(tempDir, 'outside-root.txt');
|
|
149
|
+
const params = {
|
|
150
|
+
file_path: outsidePath,
|
|
151
|
+
content: 'hello',
|
|
152
|
+
};
|
|
153
|
+
expect(() => tool.build(params)).toThrow(/File path must be within one of the workspace directories/);
|
|
154
|
+
});
|
|
155
|
+
it('should throw an error if path is a directory', () => {
|
|
156
|
+
const dirAsFilePath = path.join(rootDir, 'a_directory');
|
|
157
|
+
fs.mkdirSync(dirAsFilePath);
|
|
158
|
+
const params = {
|
|
159
|
+
file_path: dirAsFilePath,
|
|
160
|
+
content: 'hello',
|
|
161
|
+
};
|
|
162
|
+
expect(() => tool.build(params)).toThrow(`Path is a directory, not a file: ${dirAsFilePath}`);
|
|
163
|
+
});
|
|
164
|
+
it('should throw an error if the content is null', () => {
|
|
165
|
+
const dirAsFilePath = path.join(rootDir, 'a_directory');
|
|
166
|
+
fs.mkdirSync(dirAsFilePath);
|
|
167
|
+
const params = {
|
|
168
|
+
file_path: dirAsFilePath,
|
|
169
|
+
content: null,
|
|
170
|
+
}; // Intentionally non-conforming
|
|
171
|
+
expect(() => tool.build(params)).toThrow('params/content must be string');
|
|
172
|
+
});
|
|
173
|
+
it('should throw error if the file_path is empty', () => {
|
|
174
|
+
const dirAsFilePath = path.join(rootDir, 'a_directory');
|
|
175
|
+
fs.mkdirSync(dirAsFilePath);
|
|
176
|
+
const params = {
|
|
177
|
+
file_path: '',
|
|
178
|
+
content: '',
|
|
179
|
+
};
|
|
180
|
+
expect(() => tool.build(params)).toThrow(`Missing or empty "file_path"`);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe('getCorrectedFileContent', () => {
|
|
184
|
+
it('should call ensureCorrectFileContent for a new file', async () => {
|
|
185
|
+
const filePath = path.join(rootDir, 'new_corrected_file.txt');
|
|
186
|
+
const proposedContent = 'Proposed new content.';
|
|
187
|
+
const correctedContent = 'Corrected new content.';
|
|
188
|
+
const abortSignal = new AbortController().signal;
|
|
189
|
+
// Ensure the mock is set for this specific test case if needed, or rely on beforeEach
|
|
190
|
+
mockEnsureCorrectFileContent.mockResolvedValue(correctedContent);
|
|
191
|
+
const result = await getCorrectedFileContent(mockConfig, filePath, proposedContent, abortSignal);
|
|
192
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
193
|
+
expect(mockEnsureCorrectEdit).not.toHaveBeenCalled();
|
|
194
|
+
expect(result.correctedContent).toBe(correctedContent);
|
|
195
|
+
expect(result.originalContent).toBe('');
|
|
196
|
+
expect(result.fileExists).toBe(false);
|
|
197
|
+
expect(result.error).toBeUndefined();
|
|
198
|
+
});
|
|
199
|
+
it('should call ensureCorrectEdit for an existing file', async () => {
|
|
200
|
+
const filePath = path.join(rootDir, 'existing_corrected_file.txt');
|
|
201
|
+
const originalContent = 'Original existing content.';
|
|
202
|
+
const proposedContent = 'Proposed replacement content.';
|
|
203
|
+
const correctedProposedContent = 'Corrected replacement content.';
|
|
204
|
+
const abortSignal = new AbortController().signal;
|
|
205
|
+
fs.writeFileSync(filePath, originalContent, 'utf8');
|
|
206
|
+
// Ensure this mock is active and returns the correct structure
|
|
207
|
+
mockEnsureCorrectEdit.mockResolvedValue({
|
|
208
|
+
params: {
|
|
209
|
+
file_path: filePath,
|
|
210
|
+
old_string: originalContent,
|
|
211
|
+
new_string: correctedProposedContent,
|
|
212
|
+
},
|
|
213
|
+
occurrences: 1,
|
|
214
|
+
});
|
|
215
|
+
const result = await getCorrectedFileContent(mockConfig, filePath, proposedContent, abortSignal);
|
|
216
|
+
expect(mockEnsureCorrectEdit).toHaveBeenCalledWith(filePath, originalContent, {
|
|
217
|
+
old_string: originalContent,
|
|
218
|
+
new_string: proposedContent,
|
|
219
|
+
file_path: filePath,
|
|
220
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
221
|
+
expect(mockEnsureCorrectFileContent).not.toHaveBeenCalled();
|
|
222
|
+
expect(result.correctedContent).toBe(correctedProposedContent);
|
|
223
|
+
expect(result.originalContent).toBe(originalContent);
|
|
224
|
+
expect(result.fileExists).toBe(true);
|
|
225
|
+
expect(result.error).toBeUndefined();
|
|
226
|
+
});
|
|
227
|
+
it('should return error if reading an existing file fails (e.g. permissions)', async () => {
|
|
228
|
+
const filePath = path.join(rootDir, 'unreadable_file.txt');
|
|
229
|
+
const proposedContent = 'some content';
|
|
230
|
+
const abortSignal = new AbortController().signal;
|
|
231
|
+
fs.writeFileSync(filePath, 'content', { mode: 0o000 });
|
|
232
|
+
const readError = new Error('Permission denied');
|
|
233
|
+
vi.spyOn(fsService, 'readTextFile').mockImplementationOnce(() => Promise.reject(readError));
|
|
234
|
+
const result = await getCorrectedFileContent(mockConfig, filePath, proposedContent, abortSignal);
|
|
235
|
+
expect(fsService.readTextFile).toHaveBeenCalledWith(filePath);
|
|
236
|
+
expect(mockEnsureCorrectEdit).not.toHaveBeenCalled();
|
|
237
|
+
expect(mockEnsureCorrectFileContent).not.toHaveBeenCalled();
|
|
238
|
+
expect(result.correctedContent).toBe(proposedContent);
|
|
239
|
+
expect(result.originalContent).toBe('');
|
|
240
|
+
expect(result.fileExists).toBe(true);
|
|
241
|
+
expect(result.error).toEqual({
|
|
242
|
+
message: 'Permission denied',
|
|
243
|
+
code: undefined,
|
|
244
|
+
});
|
|
245
|
+
fs.chmodSync(filePath, 0o600);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
describe('shouldConfirmExecute', () => {
|
|
249
|
+
const abortSignal = new AbortController().signal;
|
|
250
|
+
it('should return false if _getCorrectedFileContent returns an error', async () => {
|
|
251
|
+
const filePath = path.join(rootDir, 'confirm_error_file.txt');
|
|
252
|
+
const params = { file_path: filePath, content: 'test content' };
|
|
253
|
+
fs.writeFileSync(filePath, 'original', { mode: 0o000 });
|
|
254
|
+
const readError = new Error('Simulated read error for confirmation');
|
|
255
|
+
vi.spyOn(fsService, 'readTextFile').mockImplementationOnce(() => Promise.reject(readError));
|
|
256
|
+
const invocation = tool.build(params);
|
|
257
|
+
const confirmation = await invocation.shouldConfirmExecute(abortSignal);
|
|
258
|
+
expect(confirmation).toBe(false);
|
|
259
|
+
fs.chmodSync(filePath, 0o600);
|
|
260
|
+
});
|
|
261
|
+
it('should request confirmation with diff for a new file (with corrected content)', async () => {
|
|
262
|
+
const filePath = path.join(rootDir, 'confirm_new_file.txt');
|
|
263
|
+
const proposedContent = 'Proposed new content for confirmation.';
|
|
264
|
+
const correctedContent = 'Corrected new content for confirmation.';
|
|
265
|
+
mockEnsureCorrectFileContent.mockResolvedValue(correctedContent); // Ensure this mock is active
|
|
266
|
+
const params = { file_path: filePath, content: proposedContent };
|
|
267
|
+
const invocation = tool.build(params);
|
|
268
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
269
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
270
|
+
expect(confirmation).toEqual(expect.objectContaining({
|
|
271
|
+
title: `Confirm Write: ${path.basename(filePath)}`,
|
|
272
|
+
fileName: 'confirm_new_file.txt',
|
|
273
|
+
fileDiff: expect.stringContaining(correctedContent),
|
|
274
|
+
}));
|
|
275
|
+
expect(confirmation.fileDiff).toMatch(/--- confirm_new_file.txt\tCurrent/);
|
|
276
|
+
expect(confirmation.fileDiff).toMatch(/\+\+\+ confirm_new_file.txt\tProposed/);
|
|
277
|
+
});
|
|
278
|
+
it('should request confirmation with diff for an existing file (with corrected content)', async () => {
|
|
279
|
+
const filePath = path.join(rootDir, 'confirm_existing_file.txt');
|
|
280
|
+
const originalContent = 'Original content for confirmation.';
|
|
281
|
+
const proposedContent = 'Proposed replacement for confirmation.';
|
|
282
|
+
const correctedProposedContent = 'Corrected replacement for confirmation.';
|
|
283
|
+
fs.writeFileSync(filePath, originalContent, 'utf8');
|
|
284
|
+
mockEnsureCorrectEdit.mockResolvedValue({
|
|
285
|
+
params: {
|
|
286
|
+
file_path: filePath,
|
|
287
|
+
old_string: originalContent,
|
|
288
|
+
new_string: correctedProposedContent,
|
|
289
|
+
},
|
|
290
|
+
occurrences: 1,
|
|
291
|
+
});
|
|
292
|
+
const params = { file_path: filePath, content: proposedContent };
|
|
293
|
+
const invocation = tool.build(params);
|
|
294
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
295
|
+
expect(mockEnsureCorrectEdit).toHaveBeenCalledWith(filePath, originalContent, {
|
|
296
|
+
old_string: originalContent,
|
|
297
|
+
new_string: proposedContent,
|
|
298
|
+
file_path: filePath,
|
|
299
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
300
|
+
expect(confirmation).toEqual(expect.objectContaining({
|
|
301
|
+
title: `Confirm Write: ${path.basename(filePath)}`,
|
|
302
|
+
fileName: 'confirm_existing_file.txt',
|
|
303
|
+
fileDiff: expect.stringContaining(correctedProposedContent),
|
|
304
|
+
}));
|
|
305
|
+
expect(confirmation.fileDiff).toMatch(originalContent.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&'));
|
|
306
|
+
});
|
|
307
|
+
describe('with IDE integration', () => {
|
|
308
|
+
beforeEach(() => {
|
|
309
|
+
// Enable IDE mode and set connection status for these tests
|
|
310
|
+
mockConfigInternal.getIdeMode.mockReturnValue(true);
|
|
311
|
+
mockIdeClient.isDiffingEnabled.mockReturnValue(true);
|
|
312
|
+
mockIdeClient.openDiff.mockResolvedValue({
|
|
313
|
+
status: 'accepted',
|
|
314
|
+
content: 'ide-modified-content',
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
it('should call openDiff and await it when in IDE mode and connected', async () => {
|
|
318
|
+
const filePath = path.join(rootDir, 'ide_confirm_file.txt');
|
|
319
|
+
const params = { file_path: filePath, content: 'test' };
|
|
320
|
+
const invocation = tool.build(params);
|
|
321
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
322
|
+
expect(mockIdeClient.openDiff).toHaveBeenCalledWith(filePath, 'test');
|
|
323
|
+
// Ensure the promise is awaited by checking the result
|
|
324
|
+
expect(confirmation.ideConfirmation).toBeDefined();
|
|
325
|
+
await confirmation.ideConfirmation; // Should resolve
|
|
326
|
+
});
|
|
327
|
+
it('should not call openDiff if not in IDE mode', async () => {
|
|
328
|
+
mockConfigInternal.getIdeMode.mockReturnValue(false);
|
|
329
|
+
const filePath = path.join(rootDir, 'ide_disabled_file.txt');
|
|
330
|
+
const params = { file_path: filePath, content: 'test' };
|
|
331
|
+
const invocation = tool.build(params);
|
|
332
|
+
await invocation.shouldConfirmExecute(abortSignal);
|
|
333
|
+
expect(mockIdeClient.openDiff).not.toHaveBeenCalled();
|
|
334
|
+
});
|
|
335
|
+
it('should not call openDiff if IDE is not connected', async () => {
|
|
336
|
+
mockIdeClient.isDiffingEnabled.mockReturnValue(false);
|
|
337
|
+
const filePath = path.join(rootDir, 'ide_disconnected_file.txt');
|
|
338
|
+
const params = { file_path: filePath, content: 'test' };
|
|
339
|
+
const invocation = tool.build(params);
|
|
340
|
+
await invocation.shouldConfirmExecute(abortSignal);
|
|
341
|
+
expect(mockIdeClient.openDiff).not.toHaveBeenCalled();
|
|
342
|
+
});
|
|
343
|
+
it('should update params.content with IDE content when onConfirm is called', async () => {
|
|
344
|
+
const filePath = path.join(rootDir, 'ide_onconfirm_file.txt');
|
|
345
|
+
const params = { file_path: filePath, content: 'original-content' };
|
|
346
|
+
const invocation = tool.build(params);
|
|
347
|
+
// This is the key part: get the confirmation details
|
|
348
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
349
|
+
// The `onConfirm` function should exist on the details object
|
|
350
|
+
expect(confirmation.onConfirm).toBeDefined();
|
|
351
|
+
// Call `onConfirm` to trigger the logic that updates the content
|
|
352
|
+
await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
353
|
+
// Now, check if the original `params` object (captured by the invocation) was modified
|
|
354
|
+
expect(invocation.params.content).toBe('ide-modified-content');
|
|
355
|
+
});
|
|
356
|
+
it('should not await ideConfirmation promise', async () => {
|
|
357
|
+
const filePath = path.join(rootDir, 'ide_no_await_file.txt');
|
|
358
|
+
const params = { file_path: filePath, content: 'test' };
|
|
359
|
+
const invocation = tool.build(params);
|
|
360
|
+
let diffPromiseResolved = false;
|
|
361
|
+
const diffPromise = new Promise((resolve) => {
|
|
362
|
+
setTimeout(() => {
|
|
363
|
+
diffPromiseResolved = true;
|
|
364
|
+
resolve({ status: 'accepted', content: 'ide-modified-content' });
|
|
365
|
+
}, 50); // A small delay to ensure the check happens before resolution
|
|
366
|
+
});
|
|
367
|
+
mockIdeClient.openDiff.mockReturnValue(diffPromise);
|
|
368
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
369
|
+
// This is the key check: the confirmation details should be returned
|
|
370
|
+
// *before* the diffPromise is resolved.
|
|
371
|
+
expect(diffPromiseResolved).toBe(false);
|
|
372
|
+
expect(confirmation).toBeDefined();
|
|
373
|
+
expect(confirmation.ideConfirmation).toBe(diffPromise);
|
|
374
|
+
// Now, we can await the promise to let the test finish cleanly.
|
|
375
|
+
await diffPromise;
|
|
376
|
+
expect(diffPromiseResolved).toBe(true);
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
describe('execute', () => {
|
|
381
|
+
const abortSignal = new AbortController().signal;
|
|
382
|
+
it('should return error if _getCorrectedFileContent returns an error during execute', async () => {
|
|
383
|
+
const filePath = path.join(rootDir, 'execute_error_file.txt');
|
|
384
|
+
const params = { file_path: filePath, content: 'test content' };
|
|
385
|
+
fs.writeFileSync(filePath, 'original', { mode: 0o000 });
|
|
386
|
+
vi.spyOn(fsService, 'readTextFile').mockImplementationOnce(() => {
|
|
387
|
+
const readError = new Error('Simulated read error for execute');
|
|
388
|
+
return Promise.reject(readError);
|
|
389
|
+
});
|
|
390
|
+
const invocation = tool.build(params);
|
|
391
|
+
const result = await invocation.execute(abortSignal);
|
|
392
|
+
expect(result.llmContent).toContain('Error checking existing file');
|
|
393
|
+
expect(result.returnDisplay).toMatch(/Error checking existing file: Simulated read error for execute/);
|
|
394
|
+
expect(result.error).toEqual({
|
|
395
|
+
message: 'Error checking existing file: Simulated read error for execute',
|
|
396
|
+
type: ToolErrorType.FILE_WRITE_FAILURE,
|
|
397
|
+
});
|
|
398
|
+
fs.chmodSync(filePath, 0o600);
|
|
399
|
+
});
|
|
400
|
+
it('should write a new file with corrected content and return diff', async () => {
|
|
401
|
+
const filePath = path.join(rootDir, 'execute_new_corrected_file.txt');
|
|
402
|
+
const proposedContent = 'Proposed new content for execute.';
|
|
403
|
+
const correctedContent = 'Corrected new content for execute.';
|
|
404
|
+
mockEnsureCorrectFileContent.mockResolvedValue(correctedContent);
|
|
405
|
+
const params = { file_path: filePath, content: proposedContent };
|
|
406
|
+
const invocation = tool.build(params);
|
|
407
|
+
const confirmDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
408
|
+
if (typeof confirmDetails === 'object' &&
|
|
409
|
+
'onConfirm' in confirmDetails &&
|
|
410
|
+
confirmDetails.onConfirm) {
|
|
411
|
+
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
412
|
+
}
|
|
413
|
+
const result = await invocation.execute(abortSignal);
|
|
414
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
415
|
+
expect(result.llmContent).toMatch(/Successfully created and wrote to new file/);
|
|
416
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
417
|
+
const writtenContent = await fsService.readTextFile(filePath);
|
|
418
|
+
expect(writtenContent).toBe(correctedContent);
|
|
419
|
+
const display = result.returnDisplay;
|
|
420
|
+
expect(display.fileName).toBe('execute_new_corrected_file.txt');
|
|
421
|
+
expect(display.fileDiff).toMatch(/--- execute_new_corrected_file.txt\tOriginal/);
|
|
422
|
+
expect(display.fileDiff).toMatch(/\+\+\+ execute_new_corrected_file.txt\tWritten/);
|
|
423
|
+
expect(display.fileDiff).toMatch(correctedContent.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&'));
|
|
424
|
+
});
|
|
425
|
+
it('should overwrite an existing file with corrected content and return diff', async () => {
|
|
426
|
+
const filePath = path.join(rootDir, 'execute_existing_corrected_file.txt');
|
|
427
|
+
const initialContent = 'Initial content for execute.';
|
|
428
|
+
const proposedContent = 'Proposed overwrite for execute.';
|
|
429
|
+
const correctedProposedContent = 'Corrected overwrite for execute.';
|
|
430
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
431
|
+
mockEnsureCorrectEdit.mockResolvedValue({
|
|
432
|
+
params: {
|
|
433
|
+
file_path: filePath,
|
|
434
|
+
old_string: initialContent,
|
|
435
|
+
new_string: correctedProposedContent,
|
|
436
|
+
},
|
|
437
|
+
occurrences: 1,
|
|
438
|
+
});
|
|
439
|
+
const params = { file_path: filePath, content: proposedContent };
|
|
440
|
+
const invocation = tool.build(params);
|
|
441
|
+
const confirmDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
442
|
+
if (typeof confirmDetails === 'object' &&
|
|
443
|
+
'onConfirm' in confirmDetails &&
|
|
444
|
+
confirmDetails.onConfirm) {
|
|
445
|
+
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
446
|
+
}
|
|
447
|
+
const result = await invocation.execute(abortSignal);
|
|
448
|
+
expect(mockEnsureCorrectEdit).toHaveBeenCalledWith(filePath, initialContent, {
|
|
449
|
+
old_string: initialContent,
|
|
450
|
+
new_string: proposedContent,
|
|
451
|
+
file_path: filePath,
|
|
452
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
453
|
+
expect(result.llmContent).toMatch(/Successfully overwrote file/);
|
|
454
|
+
const writtenContent = await fsService.readTextFile(filePath);
|
|
455
|
+
expect(writtenContent).toBe(correctedProposedContent);
|
|
456
|
+
const display = result.returnDisplay;
|
|
457
|
+
expect(display.fileName).toBe('execute_existing_corrected_file.txt');
|
|
458
|
+
expect(display.fileDiff).toMatch(initialContent.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&'));
|
|
459
|
+
expect(display.fileDiff).toMatch(correctedProposedContent.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&'));
|
|
460
|
+
});
|
|
461
|
+
it('should create directory if it does not exist', async () => {
|
|
462
|
+
const dirPath = path.join(rootDir, 'new_dir_for_write');
|
|
463
|
+
const filePath = path.join(dirPath, 'file_in_new_dir.txt');
|
|
464
|
+
const content = 'Content in new directory';
|
|
465
|
+
mockEnsureCorrectFileContent.mockResolvedValue(content); // Ensure this mock is active
|
|
466
|
+
const params = { file_path: filePath, content };
|
|
467
|
+
const invocation = tool.build(params);
|
|
468
|
+
// Simulate confirmation if your logic requires it before execute, or remove if not needed for this path
|
|
469
|
+
const confirmDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
470
|
+
if (typeof confirmDetails === 'object' &&
|
|
471
|
+
'onConfirm' in confirmDetails &&
|
|
472
|
+
confirmDetails.onConfirm) {
|
|
473
|
+
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
474
|
+
}
|
|
475
|
+
await invocation.execute(abortSignal);
|
|
476
|
+
expect(fs.existsSync(dirPath)).toBe(true);
|
|
477
|
+
expect(fs.statSync(dirPath).isDirectory()).toBe(true);
|
|
478
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
479
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe(content);
|
|
480
|
+
});
|
|
481
|
+
it('should include modification message when proposed content is modified', async () => {
|
|
482
|
+
const filePath = path.join(rootDir, 'new_file_modified.txt');
|
|
483
|
+
const content = 'New file content modified by user';
|
|
484
|
+
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
485
|
+
const params = {
|
|
486
|
+
file_path: filePath,
|
|
487
|
+
content,
|
|
488
|
+
modified_by_user: true,
|
|
489
|
+
};
|
|
490
|
+
const invocation = tool.build(params);
|
|
491
|
+
const result = await invocation.execute(abortSignal);
|
|
492
|
+
expect(result.llmContent).toMatch(/User modified the `content`/);
|
|
493
|
+
});
|
|
494
|
+
it('should not include modification message when proposed content is not modified', async () => {
|
|
495
|
+
const filePath = path.join(rootDir, 'new_file_unmodified.txt');
|
|
496
|
+
const content = 'New file content not modified';
|
|
497
|
+
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
498
|
+
const params = {
|
|
499
|
+
file_path: filePath,
|
|
500
|
+
content,
|
|
501
|
+
modified_by_user: false,
|
|
502
|
+
};
|
|
503
|
+
const invocation = tool.build(params);
|
|
504
|
+
const result = await invocation.execute(abortSignal);
|
|
505
|
+
expect(result.llmContent).not.toMatch(/User modified the `content`/);
|
|
506
|
+
});
|
|
507
|
+
it('should not include modification message when modified_by_user is not provided', async () => {
|
|
508
|
+
const filePath = path.join(rootDir, 'new_file_unmodified.txt');
|
|
509
|
+
const content = 'New file content not modified';
|
|
510
|
+
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
511
|
+
const params = {
|
|
512
|
+
file_path: filePath,
|
|
513
|
+
content,
|
|
514
|
+
};
|
|
515
|
+
const invocation = tool.build(params);
|
|
516
|
+
const result = await invocation.execute(abortSignal);
|
|
517
|
+
expect(result.llmContent).not.toMatch(/User modified the `content`/);
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
describe('workspace boundary validation', () => {
|
|
521
|
+
it('should validate paths are within workspace root', () => {
|
|
522
|
+
const params = {
|
|
523
|
+
file_path: path.join(rootDir, 'file.txt'),
|
|
524
|
+
content: 'test content',
|
|
525
|
+
};
|
|
526
|
+
expect(() => tool.build(params)).not.toThrow();
|
|
527
|
+
});
|
|
528
|
+
it('should reject paths outside workspace root', () => {
|
|
529
|
+
const params = {
|
|
530
|
+
file_path: '/etc/passwd',
|
|
531
|
+
content: 'malicious',
|
|
532
|
+
};
|
|
533
|
+
expect(() => tool.build(params)).toThrow(/File path must be within one of the workspace directories/);
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
describe('specific error types for write failures', () => {
|
|
537
|
+
const abortSignal = new AbortController().signal;
|
|
538
|
+
it('should return PERMISSION_DENIED error when write fails with EACCES', async () => {
|
|
539
|
+
const filePath = path.join(rootDir, 'permission_denied_file.txt');
|
|
540
|
+
const content = 'test content';
|
|
541
|
+
// Mock FileSystemService writeTextFile to throw EACCES error
|
|
542
|
+
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => {
|
|
543
|
+
const error = new Error('Permission denied');
|
|
544
|
+
error.code = 'EACCES';
|
|
545
|
+
return Promise.reject(error);
|
|
546
|
+
});
|
|
547
|
+
const params = { file_path: filePath, content };
|
|
548
|
+
const invocation = tool.build(params);
|
|
549
|
+
const result = await invocation.execute(abortSignal);
|
|
550
|
+
expect(result.error?.type).toBe(ToolErrorType.PERMISSION_DENIED);
|
|
551
|
+
expect(result.llmContent).toContain(`Permission denied writing to file: ${filePath} (EACCES)`);
|
|
552
|
+
expect(result.returnDisplay).toContain(`Permission denied writing to file: ${filePath} (EACCES)`);
|
|
553
|
+
});
|
|
554
|
+
it('should return NO_SPACE_LEFT error when write fails with ENOSPC', async () => {
|
|
555
|
+
const filePath = path.join(rootDir, 'no_space_file.txt');
|
|
556
|
+
const content = 'test content';
|
|
557
|
+
// Mock FileSystemService writeTextFile to throw ENOSPC error
|
|
558
|
+
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => {
|
|
559
|
+
const error = new Error('No space left on device');
|
|
560
|
+
error.code = 'ENOSPC';
|
|
561
|
+
return Promise.reject(error);
|
|
562
|
+
});
|
|
563
|
+
const params = { file_path: filePath, content };
|
|
564
|
+
const invocation = tool.build(params);
|
|
565
|
+
const result = await invocation.execute(abortSignal);
|
|
566
|
+
expect(result.error?.type).toBe(ToolErrorType.NO_SPACE_LEFT);
|
|
567
|
+
expect(result.llmContent).toContain(`No space left on device: ${filePath} (ENOSPC)`);
|
|
568
|
+
expect(result.returnDisplay).toContain(`No space left on device: ${filePath} (ENOSPC)`);
|
|
569
|
+
});
|
|
570
|
+
it('should return TARGET_IS_DIRECTORY error when write fails with EISDIR', async () => {
|
|
571
|
+
const dirPath = path.join(rootDir, 'test_directory');
|
|
572
|
+
const content = 'test content';
|
|
573
|
+
// Mock fs.existsSync to return false to bypass validation
|
|
574
|
+
const originalExistsSync = fs.existsSync;
|
|
575
|
+
vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
|
|
576
|
+
if (path === dirPath) {
|
|
577
|
+
return false; // Pretend directory doesn't exist to bypass validation
|
|
578
|
+
}
|
|
579
|
+
return originalExistsSync(path);
|
|
580
|
+
});
|
|
581
|
+
// Mock FileSystemService writeTextFile to throw EISDIR error
|
|
582
|
+
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => {
|
|
583
|
+
const error = new Error('Is a directory');
|
|
584
|
+
error.code = 'EISDIR';
|
|
585
|
+
return Promise.reject(error);
|
|
586
|
+
});
|
|
587
|
+
const params = { file_path: dirPath, content };
|
|
588
|
+
const invocation = tool.build(params);
|
|
589
|
+
const result = await invocation.execute(abortSignal);
|
|
590
|
+
expect(result.error?.type).toBe(ToolErrorType.TARGET_IS_DIRECTORY);
|
|
591
|
+
expect(result.llmContent).toContain(`Target is a directory, not a file: ${dirPath} (EISDIR)`);
|
|
592
|
+
expect(result.returnDisplay).toContain(`Target is a directory, not a file: ${dirPath} (EISDIR)`);
|
|
593
|
+
vi.spyOn(fs, 'existsSync').mockImplementation(originalExistsSync);
|
|
594
|
+
});
|
|
595
|
+
it('should return FILE_WRITE_FAILURE for generic write errors', async () => {
|
|
596
|
+
const filePath = path.join(rootDir, 'generic_error_file.txt');
|
|
597
|
+
const content = 'test content';
|
|
598
|
+
// Ensure fs.existsSync is not mocked for this test
|
|
599
|
+
vi.restoreAllMocks();
|
|
600
|
+
// Mock FileSystemService writeTextFile to throw generic error
|
|
601
|
+
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => Promise.reject(new Error('Generic write error')));
|
|
602
|
+
const params = { file_path: filePath, content };
|
|
603
|
+
const invocation = tool.build(params);
|
|
604
|
+
const result = await invocation.execute(abortSignal);
|
|
605
|
+
expect(result.error?.type).toBe(ToolErrorType.FILE_WRITE_FAILURE);
|
|
606
|
+
expect(result.llmContent).toContain('Error writing to file: Generic write error');
|
|
607
|
+
expect(result.returnDisplay).toContain('Error writing to file: Generic write error');
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
//# sourceMappingURL=write-file.test.js.map
|