@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,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
7
|
+
import { escapePath, unescapePath, isSubpath } from './paths.js';
|
|
8
|
+
describe('escapePath', () => {
|
|
9
|
+
it('should escape spaces', () => {
|
|
10
|
+
expect(escapePath('my file.txt')).toBe('my\\ file.txt');
|
|
11
|
+
});
|
|
12
|
+
it('should escape tabs', () => {
|
|
13
|
+
expect(escapePath('file\twith\ttabs.txt')).toBe('file\\\twith\\\ttabs.txt');
|
|
14
|
+
});
|
|
15
|
+
it('should escape parentheses', () => {
|
|
16
|
+
expect(escapePath('file(1).txt')).toBe('file\\(1\\).txt');
|
|
17
|
+
});
|
|
18
|
+
it('should escape square brackets', () => {
|
|
19
|
+
expect(escapePath('file[backup].txt')).toBe('file\\[backup\\].txt');
|
|
20
|
+
});
|
|
21
|
+
it('should escape curly braces', () => {
|
|
22
|
+
expect(escapePath('file{temp}.txt')).toBe('file\\{temp\\}.txt');
|
|
23
|
+
});
|
|
24
|
+
it('should escape semicolons', () => {
|
|
25
|
+
expect(escapePath('file;name.txt')).toBe('file\\;name.txt');
|
|
26
|
+
});
|
|
27
|
+
it('should escape ampersands', () => {
|
|
28
|
+
expect(escapePath('file&name.txt')).toBe('file\\&name.txt');
|
|
29
|
+
});
|
|
30
|
+
it('should escape pipes', () => {
|
|
31
|
+
expect(escapePath('file|name.txt')).toBe('file\\|name.txt');
|
|
32
|
+
});
|
|
33
|
+
it('should escape asterisks', () => {
|
|
34
|
+
expect(escapePath('file*.txt')).toBe('file\\*.txt');
|
|
35
|
+
});
|
|
36
|
+
it('should escape question marks', () => {
|
|
37
|
+
expect(escapePath('file?.txt')).toBe('file\\?.txt');
|
|
38
|
+
});
|
|
39
|
+
it('should escape dollar signs', () => {
|
|
40
|
+
expect(escapePath('file$name.txt')).toBe('file\\$name.txt');
|
|
41
|
+
});
|
|
42
|
+
it('should escape backticks', () => {
|
|
43
|
+
expect(escapePath('file`name.txt')).toBe('file\\`name.txt');
|
|
44
|
+
});
|
|
45
|
+
it('should escape single quotes', () => {
|
|
46
|
+
expect(escapePath("file'name.txt")).toBe("file\\'name.txt");
|
|
47
|
+
});
|
|
48
|
+
it('should escape double quotes', () => {
|
|
49
|
+
expect(escapePath('file"name.txt')).toBe('file\\"name.txt');
|
|
50
|
+
});
|
|
51
|
+
it('should escape hash symbols', () => {
|
|
52
|
+
expect(escapePath('file#name.txt')).toBe('file\\#name.txt');
|
|
53
|
+
});
|
|
54
|
+
it('should escape exclamation marks', () => {
|
|
55
|
+
expect(escapePath('file!name.txt')).toBe('file\\!name.txt');
|
|
56
|
+
});
|
|
57
|
+
it('should escape tildes', () => {
|
|
58
|
+
expect(escapePath('file~name.txt')).toBe('file\\~name.txt');
|
|
59
|
+
});
|
|
60
|
+
it('should escape less than and greater than signs', () => {
|
|
61
|
+
expect(escapePath('file<name>.txt')).toBe('file\\<name\\>.txt');
|
|
62
|
+
});
|
|
63
|
+
it('should handle multiple special characters', () => {
|
|
64
|
+
expect(escapePath('my file (backup) [v1.2].txt')).toBe('my\\ file\\ \\(backup\\)\\ \\[v1.2\\].txt');
|
|
65
|
+
});
|
|
66
|
+
it('should not double-escape already escaped characters', () => {
|
|
67
|
+
expect(escapePath('my\\ file.txt')).toBe('my\\ file.txt');
|
|
68
|
+
expect(escapePath('file\\(name\\).txt')).toBe('file\\(name\\).txt');
|
|
69
|
+
});
|
|
70
|
+
it('should handle escaped backslashes correctly', () => {
|
|
71
|
+
// Double backslash (escaped backslash) followed by space should escape the space
|
|
72
|
+
expect(escapePath('path\\\\ file.txt')).toBe('path\\\\\\ file.txt');
|
|
73
|
+
// Triple backslash (escaped backslash + escaping backslash) followed by space should not double-escape
|
|
74
|
+
expect(escapePath('path\\\\\\ file.txt')).toBe('path\\\\\\ file.txt');
|
|
75
|
+
// Quadruple backslash (two escaped backslashes) followed by space should escape the space
|
|
76
|
+
expect(escapePath('path\\\\\\\\ file.txt')).toBe('path\\\\\\\\\\ file.txt');
|
|
77
|
+
});
|
|
78
|
+
it('should handle complex escaped backslash scenarios', () => {
|
|
79
|
+
// Escaped backslash before special character that needs escaping
|
|
80
|
+
expect(escapePath('file\\\\(test).txt')).toBe('file\\\\\\(test\\).txt');
|
|
81
|
+
// Multiple escaped backslashes
|
|
82
|
+
expect(escapePath('path\\\\\\\\with space.txt')).toBe('path\\\\\\\\with\\ space.txt');
|
|
83
|
+
});
|
|
84
|
+
it('should handle paths without special characters', () => {
|
|
85
|
+
expect(escapePath('normalfile.txt')).toBe('normalfile.txt');
|
|
86
|
+
expect(escapePath('path/to/normalfile.txt')).toBe('path/to/normalfile.txt');
|
|
87
|
+
});
|
|
88
|
+
it('should handle complex real-world examples', () => {
|
|
89
|
+
expect(escapePath('My Documents/Project (2024)/file [backup].txt')).toBe('My\\ Documents/Project\\ \\(2024\\)/file\\ \\[backup\\].txt');
|
|
90
|
+
expect(escapePath('file with $special &chars!.txt')).toBe('file\\ with\\ \\$special\\ \\&chars\\!.txt');
|
|
91
|
+
});
|
|
92
|
+
it('should handle empty strings', () => {
|
|
93
|
+
expect(escapePath('')).toBe('');
|
|
94
|
+
});
|
|
95
|
+
it('should handle paths with only special characters', () => {
|
|
96
|
+
expect(escapePath(' ()[]{};&|*?$`\'"#!~<>')).toBe('\\ \\(\\)\\[\\]\\{\\}\\;\\&\\|\\*\\?\\$\\`\\\'\\"\\#\\!\\~\\<\\>');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('unescapePath', () => {
|
|
100
|
+
it('should unescape spaces', () => {
|
|
101
|
+
expect(unescapePath('my\\ file.txt')).toBe('my file.txt');
|
|
102
|
+
});
|
|
103
|
+
it('should unescape tabs', () => {
|
|
104
|
+
expect(unescapePath('file\\\twith\\\ttabs.txt')).toBe('file\twith\ttabs.txt');
|
|
105
|
+
});
|
|
106
|
+
it('should unescape parentheses', () => {
|
|
107
|
+
expect(unescapePath('file\\(1\\).txt')).toBe('file(1).txt');
|
|
108
|
+
});
|
|
109
|
+
it('should unescape square brackets', () => {
|
|
110
|
+
expect(unescapePath('file\\[backup\\].txt')).toBe('file[backup].txt');
|
|
111
|
+
});
|
|
112
|
+
it('should unescape curly braces', () => {
|
|
113
|
+
expect(unescapePath('file\\{temp\\}.txt')).toBe('file{temp}.txt');
|
|
114
|
+
});
|
|
115
|
+
it('should unescape multiple special characters', () => {
|
|
116
|
+
expect(unescapePath('my\\ file\\ \\(backup\\)\\ \\[v1.2\\].txt')).toBe('my file (backup) [v1.2].txt');
|
|
117
|
+
});
|
|
118
|
+
it('should handle paths without escaped characters', () => {
|
|
119
|
+
expect(unescapePath('normalfile.txt')).toBe('normalfile.txt');
|
|
120
|
+
expect(unescapePath('path/to/normalfile.txt')).toBe('path/to/normalfile.txt');
|
|
121
|
+
});
|
|
122
|
+
it('should handle all special characters', () => {
|
|
123
|
+
expect(unescapePath('\\ \\(\\)\\[\\]\\{\\}\\;\\&\\|\\*\\?\\$\\`\\\'\\"\\#\\!\\~\\<\\>')).toBe(' ()[]{};&|*?$`\'"#!~<>');
|
|
124
|
+
});
|
|
125
|
+
it('should be the inverse of escapePath', () => {
|
|
126
|
+
const testCases = [
|
|
127
|
+
'my file.txt',
|
|
128
|
+
'file(1).txt',
|
|
129
|
+
'file[backup].txt',
|
|
130
|
+
'My Documents/Project (2024)/file [backup].txt',
|
|
131
|
+
'file with $special &chars!.txt',
|
|
132
|
+
' ()[]{};&|*?$`\'"#!~<>',
|
|
133
|
+
'file\twith\ttabs.txt',
|
|
134
|
+
];
|
|
135
|
+
testCases.forEach((testCase) => {
|
|
136
|
+
expect(unescapePath(escapePath(testCase))).toBe(testCase);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
it('should handle empty strings', () => {
|
|
140
|
+
expect(unescapePath('')).toBe('');
|
|
141
|
+
});
|
|
142
|
+
it('should not affect backslashes not followed by special characters', () => {
|
|
143
|
+
expect(unescapePath('file\\name.txt')).toBe('file\\name.txt');
|
|
144
|
+
expect(unescapePath('path\\to\\file.txt')).toBe('path\\to\\file.txt');
|
|
145
|
+
});
|
|
146
|
+
it('should handle escaped backslashes in unescaping', () => {
|
|
147
|
+
// Should correctly unescape when there are escaped backslashes
|
|
148
|
+
expect(unescapePath('path\\\\\\ file.txt')).toBe('path\\\\ file.txt');
|
|
149
|
+
expect(unescapePath('path\\\\\\\\\\ file.txt')).toBe('path\\\\\\\\ file.txt');
|
|
150
|
+
expect(unescapePath('file\\\\\\(test\\).txt')).toBe('file\\\\(test).txt');
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe('isSubpath', () => {
|
|
154
|
+
it('should return true for a direct subpath', () => {
|
|
155
|
+
expect(isSubpath('/a/b', '/a/b/c')).toBe(true);
|
|
156
|
+
});
|
|
157
|
+
it('should return true for the same path', () => {
|
|
158
|
+
expect(isSubpath('/a/b', '/a/b')).toBe(true);
|
|
159
|
+
});
|
|
160
|
+
it('should return false for a parent path', () => {
|
|
161
|
+
expect(isSubpath('/a/b/c', '/a/b')).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
it('should return false for a completely different path', () => {
|
|
164
|
+
expect(isSubpath('/a/b', '/x/y')).toBe(false);
|
|
165
|
+
});
|
|
166
|
+
it('should handle relative paths', () => {
|
|
167
|
+
expect(isSubpath('a/b', 'a/b/c')).toBe(true);
|
|
168
|
+
expect(isSubpath('a/b', 'a/c')).toBe(false);
|
|
169
|
+
});
|
|
170
|
+
it('should handle paths with ..', () => {
|
|
171
|
+
expect(isSubpath('/a/b', '/a/b/../b/c')).toBe(true);
|
|
172
|
+
expect(isSubpath('/a/b', '/a/c/../b')).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
it('should handle root paths', () => {
|
|
175
|
+
expect(isSubpath('/', '/a')).toBe(true);
|
|
176
|
+
expect(isSubpath('/a', '/')).toBe(false);
|
|
177
|
+
});
|
|
178
|
+
it('should handle trailing slashes', () => {
|
|
179
|
+
expect(isSubpath('/a/b/', '/a/b/c')).toBe(true);
|
|
180
|
+
expect(isSubpath('/a/b', '/a/b/c/')).toBe(true);
|
|
181
|
+
expect(isSubpath('/a/b/', '/a/b/c/')).toBe(true);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe('isSubpath on Windows', () => {
|
|
185
|
+
const originalPlatform = process.platform;
|
|
186
|
+
beforeAll(() => {
|
|
187
|
+
Object.defineProperty(process, 'platform', {
|
|
188
|
+
value: 'win32',
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
afterAll(() => {
|
|
192
|
+
Object.defineProperty(process, 'platform', {
|
|
193
|
+
value: originalPlatform,
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
it('should return true for a direct subpath on Windows', () => {
|
|
197
|
+
expect(isSubpath('C:\\Users\\Test', 'C:\\Users\\Test\\file.txt')).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
it('should return true for the same path on Windows', () => {
|
|
200
|
+
expect(isSubpath('C:\\Users\\Test', 'C:\\Users\\Test')).toBe(true);
|
|
201
|
+
});
|
|
202
|
+
it('should return false for a parent path on Windows', () => {
|
|
203
|
+
expect(isSubpath('C:\\Users\\Test\\file.txt', 'C:\\Users\\Test')).toBe(false);
|
|
204
|
+
});
|
|
205
|
+
it('should return false for a different drive on Windows', () => {
|
|
206
|
+
expect(isSubpath('C:\\Users\\Test', 'D:\\Users\\Test')).toBe(false);
|
|
207
|
+
});
|
|
208
|
+
it('should be case-insensitive for drive letters on Windows', () => {
|
|
209
|
+
expect(isSubpath('c:\\Users\\Test', 'C:\\Users\\Test\\file.txt')).toBe(true);
|
|
210
|
+
});
|
|
211
|
+
it('should be case-insensitive for path components on Windows', () => {
|
|
212
|
+
expect(isSubpath('C:\\Users\\Test', 'c:\\users\\test\\file.txt')).toBe(true);
|
|
213
|
+
});
|
|
214
|
+
it('should handle mixed slashes on Windows', () => {
|
|
215
|
+
expect(isSubpath('C:/Users/Test', 'C:\\Users\\Test\\file.txt')).toBe(true);
|
|
216
|
+
});
|
|
217
|
+
it('should handle trailing slashes on Windows', () => {
|
|
218
|
+
expect(isSubpath('C:\\Users\\Test\\', 'C:\\Users\\Test\\file.txt')).toBe(true);
|
|
219
|
+
});
|
|
220
|
+
it('should handle relative paths correctly on Windows', () => {
|
|
221
|
+
expect(isSubpath('Users\\Test', 'Users\\Test\\file.txt')).toBe(true);
|
|
222
|
+
expect(isSubpath('Users\\Test\\file.txt', 'Users\\Test')).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
//# sourceMappingURL=paths.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.test.js","sourceRoot":"","sources":["../../../src/utils/paths.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEjE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC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AAC,IAAI,CACpE,IAAI,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,SAAS,CAAC,eAAe,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,CACtE,IAAI,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptIdContext.js","sourceRoot":"","sources":["../../../src/utils/promptIdContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { StructuredError } from '../core/turn.js';
|
|
7
|
+
export interface ApiError {
|
|
8
|
+
error: {
|
|
9
|
+
code: number;
|
|
10
|
+
message: string;
|
|
11
|
+
status: string;
|
|
12
|
+
details: unknown[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function isApiError(error: unknown): error is ApiError;
|
|
16
|
+
export declare function isStructuredError(error: unknown): error is StructuredError;
|
|
17
|
+
export declare function isProQuotaExceededError(error: unknown): boolean;
|
|
18
|
+
export declare function isGenericQuotaExceededError(error: unknown): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export function isApiError(error) {
|
|
7
|
+
return (typeof error === 'object' &&
|
|
8
|
+
error !== null &&
|
|
9
|
+
'error' in error &&
|
|
10
|
+
typeof error.error === 'object' &&
|
|
11
|
+
'message' in error.error);
|
|
12
|
+
}
|
|
13
|
+
export function isStructuredError(error) {
|
|
14
|
+
return (typeof error === 'object' &&
|
|
15
|
+
error !== null &&
|
|
16
|
+
'message' in error &&
|
|
17
|
+
typeof error.message === 'string');
|
|
18
|
+
}
|
|
19
|
+
export function isProQuotaExceededError(error) {
|
|
20
|
+
// Check for Pro quota exceeded errors by looking for the specific pattern
|
|
21
|
+
// This will match patterns like:
|
|
22
|
+
// - "Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'"
|
|
23
|
+
// - "Quota exceeded for quota metric 'Gemini 2.5-preview Pro Requests'"
|
|
24
|
+
// We use string methods instead of regex to avoid ReDoS vulnerabilities
|
|
25
|
+
const checkMessage = (message) => message.includes("Quota exceeded for quota metric 'Gemini") &&
|
|
26
|
+
message.includes("Pro Requests'");
|
|
27
|
+
if (typeof error === 'string') {
|
|
28
|
+
return checkMessage(error);
|
|
29
|
+
}
|
|
30
|
+
if (isStructuredError(error)) {
|
|
31
|
+
return checkMessage(error.message);
|
|
32
|
+
}
|
|
33
|
+
if (isApiError(error)) {
|
|
34
|
+
return checkMessage(error.error.message);
|
|
35
|
+
}
|
|
36
|
+
// Check if it's a Gaxios error with response data
|
|
37
|
+
if (error && typeof error === 'object' && 'response' in error) {
|
|
38
|
+
const gaxiosError = error;
|
|
39
|
+
if (gaxiosError.response && gaxiosError.response.data) {
|
|
40
|
+
if (typeof gaxiosError.response.data === 'string') {
|
|
41
|
+
return checkMessage(gaxiosError.response.data);
|
|
42
|
+
}
|
|
43
|
+
if (typeof gaxiosError.response.data === 'object' &&
|
|
44
|
+
gaxiosError.response.data !== null &&
|
|
45
|
+
'error' in gaxiosError.response.data) {
|
|
46
|
+
const errorData = gaxiosError.response.data;
|
|
47
|
+
return checkMessage(errorData.error?.message || '');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
export function isGenericQuotaExceededError(error) {
|
|
54
|
+
if (typeof error === 'string') {
|
|
55
|
+
return error.includes('Quota exceeded for quota metric');
|
|
56
|
+
}
|
|
57
|
+
if (isStructuredError(error)) {
|
|
58
|
+
return error.message.includes('Quota exceeded for quota metric');
|
|
59
|
+
}
|
|
60
|
+
if (isApiError(error)) {
|
|
61
|
+
return error.error.message.includes('Quota exceeded for quota metric');
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=quotaErrorDetection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotaErrorDetection.js","sourceRoot":"","sources":["../../../src/utils/quotaErrorDetection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,OAAQ,KAAkB,CAAC,KAAK,KAAK,QAAQ;QAC7C,SAAS,IAAK,KAAkB,CAAC,KAAK,CACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KA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,CAAC,IAAI,EACpC,CAAC;gBACD,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,IAEtC,CAAC;gBACF,OAAO,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface HttpError extends Error {
|
|
7
|
+
status?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RetryOptions {
|
|
10
|
+
maxAttempts: number;
|
|
11
|
+
initialDelayMs: number;
|
|
12
|
+
maxDelayMs: number;
|
|
13
|
+
shouldRetry: (error: Error) => boolean;
|
|
14
|
+
onPersistent429?: (authType?: string, error?: unknown) => Promise<string | boolean | null>;
|
|
15
|
+
authType?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Retries a function with exponential backoff and jitter.
|
|
19
|
+
* @param fn The asynchronous function to retry.
|
|
20
|
+
* @param options Optional retry configuration.
|
|
21
|
+
* @returns A promise that resolves with the result of the function if successful.
|
|
22
|
+
* @throws The last error encountered if all attempts fail.
|
|
23
|
+
*/
|
|
24
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Extracts the HTTP status code from an error object.
|
|
27
|
+
* @param error The error object.
|
|
28
|
+
* @returns The HTTP status code, or undefined if not found.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getErrorStatus(error: unknown): number | undefined;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AuthType } from '../core/contentGenerator.js';
|
|
7
|
+
import { isProQuotaExceededError, isGenericQuotaExceededError, } from './quotaErrorDetection.js';
|
|
8
|
+
const DEFAULT_RETRY_OPTIONS = {
|
|
9
|
+
maxAttempts: 5,
|
|
10
|
+
initialDelayMs: 5000,
|
|
11
|
+
maxDelayMs: 30000, // 30 seconds
|
|
12
|
+
shouldRetry: defaultShouldRetry,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Default predicate function to determine if a retry should be attempted.
|
|
16
|
+
* Retries on 429 (Too Many Requests) and 5xx server errors.
|
|
17
|
+
* @param error The error object.
|
|
18
|
+
* @returns True if the error is a transient error, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function defaultShouldRetry(error) {
|
|
21
|
+
// Check for common transient error status codes either in message or a status property
|
|
22
|
+
if (error && typeof error.status === 'number') {
|
|
23
|
+
const status = error.status;
|
|
24
|
+
if (status === 429 || (status >= 500 && status < 600)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (error instanceof Error && error.message) {
|
|
29
|
+
if (error.message.includes('429'))
|
|
30
|
+
return true;
|
|
31
|
+
if (error.message.match(/5\d{2}/))
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Delays execution for a specified number of milliseconds.
|
|
38
|
+
* @param ms The number of milliseconds to delay.
|
|
39
|
+
* @returns A promise that resolves after the delay.
|
|
40
|
+
*/
|
|
41
|
+
function delay(ms) {
|
|
42
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Retries a function with exponential backoff and jitter.
|
|
46
|
+
* @param fn The asynchronous function to retry.
|
|
47
|
+
* @param options Optional retry configuration.
|
|
48
|
+
* @returns A promise that resolves with the result of the function if successful.
|
|
49
|
+
* @throws The last error encountered if all attempts fail.
|
|
50
|
+
*/
|
|
51
|
+
export async function retryWithBackoff(fn, options) {
|
|
52
|
+
const { maxAttempts, initialDelayMs, maxDelayMs, onPersistent429, authType, shouldRetry, } = {
|
|
53
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
54
|
+
...options,
|
|
55
|
+
};
|
|
56
|
+
let attempt = 0;
|
|
57
|
+
let currentDelay = initialDelayMs;
|
|
58
|
+
let consecutive429Count = 0;
|
|
59
|
+
while (attempt < maxAttempts) {
|
|
60
|
+
attempt++;
|
|
61
|
+
try {
|
|
62
|
+
return await fn();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const errorStatus = getErrorStatus(error);
|
|
66
|
+
// Check for Pro quota exceeded error first - immediate fallback for OAuth users
|
|
67
|
+
if (errorStatus === 429 &&
|
|
68
|
+
authType === AuthType.LOGIN_WITH_GOOGLE &&
|
|
69
|
+
isProQuotaExceededError(error) &&
|
|
70
|
+
onPersistent429) {
|
|
71
|
+
try {
|
|
72
|
+
const fallbackModel = await onPersistent429(authType, error);
|
|
73
|
+
if (fallbackModel !== false && fallbackModel !== null) {
|
|
74
|
+
// Reset attempt counter and try with new model
|
|
75
|
+
attempt = 0;
|
|
76
|
+
consecutive429Count = 0;
|
|
77
|
+
currentDelay = initialDelayMs;
|
|
78
|
+
// With the model updated, we continue to the next attempt
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// Fallback handler returned null/false, meaning don't continue - stop retry process
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (fallbackError) {
|
|
87
|
+
// If fallback fails, continue with original error
|
|
88
|
+
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Check for generic quota exceeded error (but not Pro, which was handled above) - immediate fallback for OAuth users
|
|
92
|
+
if (errorStatus === 429 &&
|
|
93
|
+
authType === AuthType.LOGIN_WITH_GOOGLE &&
|
|
94
|
+
!isProQuotaExceededError(error) &&
|
|
95
|
+
isGenericQuotaExceededError(error) &&
|
|
96
|
+
onPersistent429) {
|
|
97
|
+
try {
|
|
98
|
+
const fallbackModel = await onPersistent429(authType, error);
|
|
99
|
+
if (fallbackModel !== false && fallbackModel !== null) {
|
|
100
|
+
// Reset attempt counter and try with new model
|
|
101
|
+
attempt = 0;
|
|
102
|
+
consecutive429Count = 0;
|
|
103
|
+
currentDelay = initialDelayMs;
|
|
104
|
+
// With the model updated, we continue to the next attempt
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// Fallback handler returned null/false, meaning don't continue - stop retry process
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (fallbackError) {
|
|
113
|
+
// If fallback fails, continue with original error
|
|
114
|
+
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Track consecutive 429 errors
|
|
118
|
+
if (errorStatus === 429) {
|
|
119
|
+
consecutive429Count++;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
consecutive429Count = 0;
|
|
123
|
+
}
|
|
124
|
+
// If we have persistent 429s and a fallback callback for OAuth
|
|
125
|
+
if (consecutive429Count >= 2 &&
|
|
126
|
+
onPersistent429 &&
|
|
127
|
+
authType === AuthType.LOGIN_WITH_GOOGLE) {
|
|
128
|
+
try {
|
|
129
|
+
const fallbackModel = await onPersistent429(authType, error);
|
|
130
|
+
if (fallbackModel !== false && fallbackModel !== null) {
|
|
131
|
+
// Reset attempt counter and try with new model
|
|
132
|
+
attempt = 0;
|
|
133
|
+
consecutive429Count = 0;
|
|
134
|
+
currentDelay = initialDelayMs;
|
|
135
|
+
// With the model updated, we continue to the next attempt
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// Fallback handler returned null/false, meaning don't continue - stop retry process
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (fallbackError) {
|
|
144
|
+
// If fallback fails, continue with original error
|
|
145
|
+
console.warn('Fallback to Flash model failed:', fallbackError);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Check if we've exhausted retries or shouldn't retry
|
|
149
|
+
if (attempt >= maxAttempts || !shouldRetry(error)) {
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
const { delayDurationMs, errorStatus: delayErrorStatus } = getDelayDurationAndStatus(error);
|
|
153
|
+
if (delayDurationMs > 0) {
|
|
154
|
+
// Respect Retry-After header if present and parsed
|
|
155
|
+
console.warn(`Attempt ${attempt} failed with status ${delayErrorStatus ?? 'unknown'}. Retrying after explicit delay of ${delayDurationMs}ms...`, error);
|
|
156
|
+
await delay(delayDurationMs);
|
|
157
|
+
// Reset currentDelay for next potential non-429 error, or if Retry-After is not present next time
|
|
158
|
+
currentDelay = initialDelayMs;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// Fall back to exponential backoff with jitter
|
|
162
|
+
logRetryAttempt(attempt, error, errorStatus);
|
|
163
|
+
// Add jitter: +/- 30% of currentDelay
|
|
164
|
+
const jitter = currentDelay * 0.3 * (Math.random() * 2 - 1);
|
|
165
|
+
const delayWithJitter = Math.max(0, currentDelay + jitter);
|
|
166
|
+
await delay(delayWithJitter);
|
|
167
|
+
currentDelay = Math.min(maxDelayMs, currentDelay * 2);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// This line should theoretically be unreachable due to the throw in the catch block.
|
|
172
|
+
// Added for type safety and to satisfy the compiler that a promise is always returned.
|
|
173
|
+
throw new Error('Retry attempts exhausted');
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Extracts the HTTP status code from an error object.
|
|
177
|
+
* @param error The error object.
|
|
178
|
+
* @returns The HTTP status code, or undefined if not found.
|
|
179
|
+
*/
|
|
180
|
+
export function getErrorStatus(error) {
|
|
181
|
+
if (typeof error === 'object' && error !== null) {
|
|
182
|
+
if ('status' in error && typeof error.status === 'number') {
|
|
183
|
+
return error.status;
|
|
184
|
+
}
|
|
185
|
+
// Check for error.response.status (common in axios errors)
|
|
186
|
+
if ('response' in error &&
|
|
187
|
+
typeof error.response === 'object' &&
|
|
188
|
+
error.response !== null) {
|
|
189
|
+
const response = error.response;
|
|
190
|
+
if ('status' in response && typeof response.status === 'number') {
|
|
191
|
+
return response.status;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Extracts the Retry-After delay from an error object's headers.
|
|
199
|
+
* @param error The error object.
|
|
200
|
+
* @returns The delay in milliseconds, or 0 if not found or invalid.
|
|
201
|
+
*/
|
|
202
|
+
function getRetryAfterDelayMs(error) {
|
|
203
|
+
if (typeof error === 'object' && error !== null) {
|
|
204
|
+
// Check for error.response.headers (common in axios errors)
|
|
205
|
+
if ('response' in error &&
|
|
206
|
+
typeof error.response === 'object' &&
|
|
207
|
+
error.response !== null) {
|
|
208
|
+
const response = error.response;
|
|
209
|
+
if ('headers' in response &&
|
|
210
|
+
typeof response.headers === 'object' &&
|
|
211
|
+
response.headers !== null) {
|
|
212
|
+
const headers = response.headers;
|
|
213
|
+
const retryAfterHeader = headers['retry-after'];
|
|
214
|
+
if (typeof retryAfterHeader === 'string') {
|
|
215
|
+
const retryAfterSeconds = parseInt(retryAfterHeader, 10);
|
|
216
|
+
if (!isNaN(retryAfterSeconds)) {
|
|
217
|
+
return retryAfterSeconds * 1000;
|
|
218
|
+
}
|
|
219
|
+
// It might be an HTTP date
|
|
220
|
+
const retryAfterDate = new Date(retryAfterHeader);
|
|
221
|
+
if (!isNaN(retryAfterDate.getTime())) {
|
|
222
|
+
return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Determines the delay duration based on the error, prioritizing Retry-After header.
|
|
232
|
+
* @param error The error object.
|
|
233
|
+
* @returns An object containing the delay duration in milliseconds and the error status.
|
|
234
|
+
*/
|
|
235
|
+
function getDelayDurationAndStatus(error) {
|
|
236
|
+
const errorStatus = getErrorStatus(error);
|
|
237
|
+
let delayDurationMs = 0;
|
|
238
|
+
if (errorStatus === 429) {
|
|
239
|
+
delayDurationMs = getRetryAfterDelayMs(error);
|
|
240
|
+
}
|
|
241
|
+
return { delayDurationMs, errorStatus };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Logs a message for a retry attempt when using exponential backoff.
|
|
245
|
+
* @param attempt The current attempt number.
|
|
246
|
+
* @param error The error that caused the retry.
|
|
247
|
+
* @param errorStatus The HTTP status code of the error, if available.
|
|
248
|
+
*/
|
|
249
|
+
function logRetryAttempt(attempt, error, errorStatus) {
|
|
250
|
+
let message = `Attempt ${attempt} failed. Retrying with backoff...`;
|
|
251
|
+
if (errorStatus) {
|
|
252
|
+
message = `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...`;
|
|
253
|
+
}
|
|
254
|
+
if (errorStatus === 429) {
|
|
255
|
+
console.warn(message, error);
|
|
256
|
+
}
|
|
257
|
+
else if (errorStatus && errorStatus >= 500 && errorStatus < 600) {
|
|
258
|
+
console.error(message, error);
|
|
259
|
+
}
|
|
260
|
+
else if (error instanceof Error) {
|
|
261
|
+
// Fallback for errors that might not have a status but have a message
|
|
262
|
+
if (error.message.includes('429')) {
|
|
263
|
+
console.warn(`Attempt ${attempt} failed with 429 error (no Retry-After header). Retrying with backoff...`, error);
|
|
264
|
+
}
|
|
265
|
+
else if (error.message.match(/5\d{2}/)) {
|
|
266
|
+
console.error(`Attempt ${attempt} failed with 5xx error. Retrying with backoff...`, error);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
console.warn(message, error); // Default to warn for other errors
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
console.warn(message, error); // Default to warn if error type is unknown
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=retry.js.map
|