@google/gemini-cli-core 0.10.0-nightly.20250926.1487841d → 0.10.0-nightly.20251009.cd354aeb
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/README.md +108 -71
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +46 -0
- package/dist/src/agents/codebase-investigator.js +136 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -0
- package/dist/src/agents/executor.d.ts +92 -0
- package/dist/src/agents/executor.js +580 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.d.ts +6 -0
- package/dist/src/agents/executor.test.js +595 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +46 -0
- package/dist/src/agents/invocation.js +102 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.d.ts +6 -0
- package/dist/src/agents/invocation.test.js +215 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +36 -0
- package/dist/src/agents/registry.js +60 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.d.ts +6 -0
- package/dist/src/agents/registry.test.js +146 -0
- package/dist/src/agents/registry.test.js.map +1 -0
- package/dist/src/agents/schema-utils.d.ts +39 -0
- package/dist/src/agents/schema-utils.js +57 -0
- package/dist/src/agents/schema-utils.js.map +1 -0
- package/dist/src/agents/schema-utils.test.d.ts +6 -0
- package/dist/src/agents/schema-utils.test.js +144 -0
- package/dist/src/agents/schema-utils.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.d.ts +38 -0
- package/dist/src/agents/subagent-tool-wrapper.js +48 -0
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js +112 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +145 -0
- package/dist/src/agents/types.js +18 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +29 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/agents/utils.test.d.ts +6 -0
- package/dist/src/agents/utils.test.js +87 -0
- package/dist/src/agents/utils.test.js.map +1 -0
- package/dist/src/code_assist/setup.js +4 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/config/config.d.ts +28 -5
- package/dist/src/config/config.js +61 -7
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +63 -0
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/core/baseLlmClient.js +19 -21
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +57 -17
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +2 -0
- package/dist/src/core/client.js +52 -43
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +300 -95
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +3 -1
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +33 -23
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +6 -0
- package/dist/src/core/geminiChat.js +21 -18
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +20 -19
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +11 -11
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +2 -1
- package/dist/src/core/prompts.js +88 -15
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +73 -24
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +10 -2
- package/dist/src/core/turn.js +6 -1
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +1 -1
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/ide/detect-ide.d.ts +1 -0
- package/dist/src/ide/detect-ide.js +4 -1
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +11 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.js +3 -3
- package/dist/src/ide/ide-client.test.js +4 -4
- package/dist/src/ide/ide-installer.js +1 -1
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +13 -1
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
- package/dist/src/mcp/sa-impersonation-provider.js +130 -0
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +2 -1
- package/dist/src/services/chatRecordingService.js +2 -1
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +11 -0
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +2 -0
- package/dist/src/services/shellExecutionService.js +48 -7
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +13 -4
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +12 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +79 -9
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +99 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +11 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +27 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +6 -24
- package/dist/src/telemetry/constants.js +7 -25
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +5 -3
- package/dist/src/telemetry/index.js +10 -3
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +6 -1
- package/dist/src/telemetry/loggers.js +132 -12
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +3 -3
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +160 -13
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.d.ts +149 -0
- package/dist/src/telemetry/memory-monitor.js +335 -0
- package/dist/src/telemetry/memory-monitor.js.map +1 -0
- package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/memory-monitor.test.js +472 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +392 -20
- package/dist/src/telemetry/metrics.js +463 -235
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +391 -55
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +37 -1
- package/dist/src/telemetry/types.js +60 -0
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +2 -2
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/mock-tool.d.ts +28 -3
- package/dist/src/test-utils/mock-tool.js +71 -1
- package/dist/src/test-utils/mock-tool.js.map +1 -1
- package/dist/src/tools/glob.js +2 -1
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +3 -2
- package/dist/src/tools/mcp-client.js +44 -30
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +168 -5
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/shell.js +2 -2
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +1 -1
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +20 -1
- package/dist/src/tools/smart-edit.js +149 -9
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +150 -29
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +8 -0
- package/dist/src/tools/tool-names.js +17 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.test.js +10 -10
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/web-fetch.js +3 -0
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +44 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/write-file.js +2 -1
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +1 -1
- package/dist/src/tools/write-todos.js +4 -3
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/utils/editCorrector.js +2 -2
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editor.js +1 -0
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +1 -0
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/formatters.d.ts +1 -0
- package/dist/src/utils/formatters.js +2 -1
- package/dist/src/utils/formatters.js.map +1 -1
- package/dist/src/utils/formatters.test.d.ts +6 -0
- package/dist/src/utils/formatters.test.js +26 -0
- package/dist/src/utils/formatters.test.js.map +1 -0
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +108 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +212 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
- package/dist/src/utils/googleQuotaErrors.js +108 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +189 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.js +13 -4
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +81 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +1 -0
- package/dist/src/utils/memoryDiscovery.js +2 -1
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +99 -21
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +13 -20
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +14 -0
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +3 -1
- package/dist/src/utils/retry.js +53 -161
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +87 -146
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +1 -4
- package/dist/src/utils/terminalSerializer.js +3 -3
- package/dist/src/utils/terminalSerializer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/test-utils/tools.d.ts +0 -45
- package/dist/src/test-utils/tools.js +0 -105
- package/dist/src/test-utils/tools.js.map +0 -1
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { describe, it, expect } from 'vitest';
|
|
7
7
|
import { parseAndFormatApiError } from './errorParsing.js';
|
|
8
|
-
import { isProQuotaExceededError } from './quotaErrorDetection.js';
|
|
9
8
|
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
|
10
|
-
import { UserTierId } from '../code_assist/types.js';
|
|
11
9
|
import { AuthType } from '../core/contentGenerator.js';
|
|
12
10
|
describe('parseAndFormatApiError', () => {
|
|
13
11
|
const vertexMessage = 'request a quota increase through Vertex';
|
|
@@ -23,12 +21,6 @@ describe('parseAndFormatApiError', () => {
|
|
|
23
21
|
expect(result).toContain('[API Error: Rate limit exceeded');
|
|
24
22
|
expect(result).toContain('Possible quota limitations in place or slow response times detected. Switching to the gemini-2.5-flash model');
|
|
25
23
|
});
|
|
26
|
-
it('should format a 429 API error with the personal message', () => {
|
|
27
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Rate limit exceeded","status":"RESOURCE_EXHAUSTED"}}';
|
|
28
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
29
|
-
expect(result).toContain('[API Error: Rate limit exceeded');
|
|
30
|
-
expect(result).toContain('Possible quota limitations in place or slow response times detected. Switching to the gemini-2.5-flash model');
|
|
31
|
-
});
|
|
32
24
|
it('should format a 429 API error with the vertex message', () => {
|
|
33
25
|
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Rate limit exceeded","status":"RESOURCE_EXHAUSTED"}}';
|
|
34
26
|
const result = parseAndFormatApiError(errorMessage, AuthType.USE_VERTEX_AI);
|
|
@@ -88,85 +80,5 @@ describe('parseAndFormatApiError', () => {
|
|
|
88
80
|
const expected = '[API Error: An unknown error occurred.]';
|
|
89
81
|
expect(parseAndFormatApiError(error)).toBe(expected);
|
|
90
82
|
});
|
|
91
|
-
it('should format a 429 API error with Pro quota exceeded message for Google auth (Free tier)', () => {
|
|
92
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5 Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
93
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
94
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'");
|
|
95
|
-
expect(result).toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
96
|
-
expect(result).toContain('upgrade to get higher limits');
|
|
97
|
-
});
|
|
98
|
-
it('should format a regular 429 API error with standard message for Google auth', () => {
|
|
99
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Rate limit exceeded","status":"RESOURCE_EXHAUSTED"}}';
|
|
100
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
101
|
-
expect(result).toContain('[API Error: Rate limit exceeded');
|
|
102
|
-
expect(result).toContain('Possible quota limitations in place or slow response times detected. Switching to the gemini-2.5-flash model');
|
|
103
|
-
expect(result).not.toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
104
|
-
});
|
|
105
|
-
it('should format a 429 API error with generic quota exceeded message for Google auth', () => {
|
|
106
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'GenerationRequests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
107
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
108
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'GenerationRequests'");
|
|
109
|
-
expect(result).toContain('You have reached your daily quota limit');
|
|
110
|
-
expect(result).not.toContain('You have reached your daily Gemini 2.5 Pro quota limit');
|
|
111
|
-
});
|
|
112
|
-
it('should prioritize Pro quota message over generic quota message for Google auth', () => {
|
|
113
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5 Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
114
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
115
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'");
|
|
116
|
-
expect(result).toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
117
|
-
expect(result).not.toContain('You have reached your daily quota limit');
|
|
118
|
-
});
|
|
119
|
-
it('should format a 429 API error with Pro quota exceeded message for Google auth (Standard tier)', () => {
|
|
120
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5 Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
121
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, UserTierId.STANDARD, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
122
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'");
|
|
123
|
-
expect(result).toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
124
|
-
expect(result).toContain('We appreciate you for choosing Gemini Code Assist and the Gemini CLI');
|
|
125
|
-
expect(result).not.toContain('upgrade to get higher limits');
|
|
126
|
-
});
|
|
127
|
-
it('should format a 429 API error with Pro quota exceeded message for Google auth (Legacy tier)', () => {
|
|
128
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5 Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
129
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, UserTierId.LEGACY, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
130
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'Gemini 2.5 Pro Requests'");
|
|
131
|
-
expect(result).toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
132
|
-
expect(result).toContain('We appreciate you for choosing Gemini Code Assist and the Gemini CLI');
|
|
133
|
-
expect(result).not.toContain('upgrade to get higher limits');
|
|
134
|
-
});
|
|
135
|
-
it('should handle different Gemini 2.5 version strings in Pro quota exceeded errors', () => {
|
|
136
|
-
const errorMessage25 = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5 Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
137
|
-
const errorMessagePreview = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'Gemini 2.5-preview Pro Requests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
138
|
-
const result25 = parseAndFormatApiError(errorMessage25, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
139
|
-
const resultPreview = parseAndFormatApiError(errorMessagePreview, AuthType.LOGIN_WITH_GOOGLE, undefined, 'gemini-2.5-preview-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
140
|
-
expect(result25).toContain('You have reached your daily gemini-2.5-pro quota limit');
|
|
141
|
-
expect(resultPreview).toContain('You have reached your daily gemini-2.5-preview-pro quota limit');
|
|
142
|
-
expect(result25).toContain('upgrade to get higher limits');
|
|
143
|
-
expect(resultPreview).toContain('upgrade to get higher limits');
|
|
144
|
-
});
|
|
145
|
-
it('should not match non-Pro models with similar version strings', () => {
|
|
146
|
-
// Test that Flash models with similar version strings don't match
|
|
147
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'Gemini 2.5 Flash Requests' and limit")).toBe(false);
|
|
148
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'Gemini 2.5-preview Flash Requests' and limit")).toBe(false);
|
|
149
|
-
// Test other model types
|
|
150
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'Gemini 2.5 Ultra Requests' and limit")).toBe(false);
|
|
151
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'Gemini 2.5 Standard Requests' and limit")).toBe(false);
|
|
152
|
-
// Test generic quota messages
|
|
153
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'GenerationRequests' and limit")).toBe(false);
|
|
154
|
-
expect(isProQuotaExceededError("Quota exceeded for quota metric 'EmbeddingRequests' and limit")).toBe(false);
|
|
155
|
-
});
|
|
156
|
-
it('should format a generic quota exceeded message for Google auth (Standard tier)', () => {
|
|
157
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Quota exceeded for quota metric \'GenerationRequests\' and limit \'RequestsPerDay\' of service \'generativelanguage.googleapis.com\' for consumer \'project_number:123456789\'.","status":"RESOURCE_EXHAUSTED"}}';
|
|
158
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, UserTierId.STANDARD, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
159
|
-
expect(result).toContain("[API Error: Quota exceeded for quota metric 'GenerationRequests'");
|
|
160
|
-
expect(result).toContain('You have reached your daily quota limit');
|
|
161
|
-
expect(result).toContain('We appreciate you for choosing Gemini Code Assist and the Gemini CLI');
|
|
162
|
-
expect(result).not.toContain('upgrade to get higher limits');
|
|
163
|
-
});
|
|
164
|
-
it('should format a regular 429 API error with standard message for Google auth (Standard tier)', () => {
|
|
165
|
-
const errorMessage = 'got status: 429 Too Many Requests. {"error":{"code":429,"message":"Rate limit exceeded","status":"RESOURCE_EXHAUSTED"}}';
|
|
166
|
-
const result = parseAndFormatApiError(errorMessage, AuthType.LOGIN_WITH_GOOGLE, UserTierId.STANDARD, 'gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
167
|
-
expect(result).toContain('[API Error: Rate limit exceeded');
|
|
168
|
-
expect(result).toContain('We appreciate you for choosing Gemini Code Assist and the Gemini CLI');
|
|
169
|
-
expect(result).not.toContain('upgrade to get higher limits');
|
|
170
|
-
});
|
|
171
83
|
});
|
|
172
84
|
//# sourceMappingURL=errorParsing.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorParsing.test.js","sourceRoot":"","sources":["../../../src/utils/errorParsing.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"errorParsing.test.js","sourceRoot":"","sources":["../../../src/utils/errorParsing.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,aAAa,GAAG,yCAAyC,CAAC;IAChE,MAAM,aAAa,GAAG,4CAA4C,CAAC;IAEnE,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,YAAY,GAChB,6IAA6I,CAAC;QAChJ,MAAM,QAAQ,GACZ,yFAAyF,CAAC;QAC5F,MAAM,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,YAAY,GAChB,yHAAyH,CAAC;QAC5H,MAAM,MAAM,GAAG,sBAAsB,CACnC,YAAY,EACZ,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,0BAA0B,CAC3B,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;QAC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C3D,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
7
|
import { Config } from '../config/config.js';
|
|
8
8
|
import fs from 'node:fs';
|
|
9
|
-
import { setSimulate429, disableSimulationAfterFallback, shouldSimulate429,
|
|
9
|
+
import { setSimulate429, disableSimulationAfterFallback, shouldSimulate429, resetRequestCounter, } from './testUtils.js';
|
|
10
10
|
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
|
11
11
|
import { retryWithBackoff } from './retry.js';
|
|
12
12
|
import { AuthType } from '../core/contentGenerator.js';
|
|
13
|
+
import { TerminalQuotaError } from './googleQuotaErrors.js';
|
|
13
14
|
vi.mock('node:fs');
|
|
14
15
|
// Update the description to reflect that this tests the retry utility's integration
|
|
15
16
|
describe('Retry Utility Fallback Integration', () => {
|
|
16
17
|
let config;
|
|
18
|
+
let mockGoogleApiError;
|
|
17
19
|
beforeEach(() => {
|
|
18
20
|
vi.mocked(fs.existsSync).mockReturnValue(true);
|
|
19
21
|
vi.mocked(fs.statSync).mockReturnValue({
|
|
@@ -26,6 +28,11 @@ describe('Retry Utility Fallback Integration', () => {
|
|
|
26
28
|
cwd: '/test',
|
|
27
29
|
model: 'gemini-2.5-pro',
|
|
28
30
|
});
|
|
31
|
+
mockGoogleApiError = {
|
|
32
|
+
code: 429,
|
|
33
|
+
message: 'mock error',
|
|
34
|
+
details: [],
|
|
35
|
+
};
|
|
29
36
|
// Reset simulation state for each test
|
|
30
37
|
setSimulate429(false);
|
|
31
38
|
resetRequestCounter();
|
|
@@ -37,75 +44,49 @@ describe('Retry Utility Fallback Integration', () => {
|
|
|
37
44
|
// Use the generalized setter
|
|
38
45
|
config.setFallbackModelHandler(fallbackHandler);
|
|
39
46
|
// Call the handler directly via the config property
|
|
40
|
-
const result = await config.fallbackModelHandler('gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL);
|
|
47
|
+
const result = await config.fallbackModelHandler('gemini-2.5-pro', DEFAULT_GEMINI_FLASH_MODEL, new Error('test'));
|
|
41
48
|
// Verify it returns the correct intent
|
|
42
49
|
expect(result).toBe('retry');
|
|
43
50
|
});
|
|
44
51
|
// This test validates the retry utility's logic for triggering the callback.
|
|
45
|
-
it('should trigger onPersistent429
|
|
52
|
+
it('should trigger onPersistent429 on TerminalQuotaError for OAuth users', async () => {
|
|
46
53
|
let fallbackCalled = false;
|
|
47
|
-
// Removed fallbackModel variable as it's no longer relevant here.
|
|
48
|
-
// Mock function that simulates exactly 2 429 errors, then succeeds after fallback
|
|
49
54
|
const mockApiCall = vi
|
|
50
55
|
.fn()
|
|
51
|
-
.mockRejectedValueOnce(
|
|
52
|
-
.mockRejectedValueOnce(
|
|
56
|
+
.mockRejectedValueOnce(new TerminalQuotaError('Daily limit', mockGoogleApiError))
|
|
57
|
+
.mockRejectedValueOnce(new TerminalQuotaError('Daily limit', mockGoogleApiError))
|
|
53
58
|
.mockResolvedValueOnce('success after fallback');
|
|
54
|
-
// Mock the onPersistent429 callback (this is what client.ts/geminiChat.ts provides)
|
|
55
59
|
const mockPersistent429Callback = vi.fn(async (_authType) => {
|
|
56
60
|
fallbackCalled = true;
|
|
57
|
-
// Return true to signal retryWithBackoff to reset attempts and continue.
|
|
58
61
|
return true;
|
|
59
62
|
});
|
|
60
|
-
// Test with OAuth personal auth type, with maxAttempts = 2 to ensure fallback triggers
|
|
61
63
|
const result = await retryWithBackoff(mockApiCall, {
|
|
62
64
|
maxAttempts: 2,
|
|
63
65
|
initialDelayMs: 1,
|
|
64
66
|
maxDelayMs: 10,
|
|
65
|
-
shouldRetry: (error) => {
|
|
66
|
-
const status = error.status;
|
|
67
|
-
return status === 429;
|
|
68
|
-
},
|
|
69
67
|
onPersistent429: mockPersistent429Callback,
|
|
70
68
|
authType: AuthType.LOGIN_WITH_GOOGLE,
|
|
71
69
|
});
|
|
72
|
-
// Verify fallback mechanism was triggered
|
|
73
70
|
expect(fallbackCalled).toBe(true);
|
|
74
|
-
expect(mockPersistent429Callback).toHaveBeenCalledWith(AuthType.LOGIN_WITH_GOOGLE, expect.any(
|
|
71
|
+
expect(mockPersistent429Callback).toHaveBeenCalledWith(AuthType.LOGIN_WITH_GOOGLE, expect.any(TerminalQuotaError));
|
|
75
72
|
expect(result).toBe('success after fallback');
|
|
76
|
-
// Should have: 2 failures, then fallback triggered, then 1 success after retry reset
|
|
77
73
|
expect(mockApiCall).toHaveBeenCalledTimes(3);
|
|
78
74
|
});
|
|
79
75
|
it('should not trigger onPersistent429 for API key users', async () => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
const fallbackCallback = vi.fn();
|
|
77
|
+
const mockApiCall = vi
|
|
78
|
+
.fn()
|
|
79
|
+
.mockRejectedValueOnce(new TerminalQuotaError('Daily limit', mockGoogleApiError));
|
|
80
|
+
const promise = retryWithBackoff(mockApiCall, {
|
|
81
|
+
maxAttempts: 2,
|
|
82
|
+
initialDelayMs: 1,
|
|
83
|
+
maxDelayMs: 10,
|
|
84
|
+
onPersistent429: fallbackCallback,
|
|
85
|
+
authType: AuthType.USE_GEMINI, // API key auth type
|
|
87
86
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
maxAttempts: 5,
|
|
92
|
-
initialDelayMs: 10,
|
|
93
|
-
maxDelayMs: 100,
|
|
94
|
-
shouldRetry: (error) => {
|
|
95
|
-
const status = error.status;
|
|
96
|
-
return status === 429;
|
|
97
|
-
},
|
|
98
|
-
onPersistent429: mockPersistent429Callback,
|
|
99
|
-
authType: AuthType.USE_GEMINI, // API key auth type
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
// Expected to throw after max attempts
|
|
104
|
-
expect(error.message).toContain('Rate limit exceeded');
|
|
105
|
-
}
|
|
106
|
-
// Verify fallback was NOT triggered for API key users
|
|
107
|
-
expect(fallbackCalled).toBe(false);
|
|
108
|
-
expect(mockPersistent429Callback).not.toHaveBeenCalled();
|
|
87
|
+
await expect(promise).rejects.toThrow('Daily limit');
|
|
88
|
+
expect(fallbackCallback).not.toHaveBeenCalled();
|
|
89
|
+
expect(mockApiCall).toHaveBeenCalledTimes(1);
|
|
109
90
|
});
|
|
110
91
|
// This test validates the test utilities themselves.
|
|
111
92
|
it('should properly disable simulation state after fallback (Test Utility)', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flashFallback.test.js","sourceRoot":"","sources":["../../../src/utils/flashFallback.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,cAAc,EACd,8BAA8B,EAC9B,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"flashFallback.test.js","sourceRoot":"","sources":["../../../src/utils/flashFallback.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,cAAc,EACd,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,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1024 * 1024);
|
|
6
7
|
export const formatMemoryUsage = (bytes) => {
|
|
7
8
|
const gb = bytes / (1024 * 1024 * 1024);
|
|
8
9
|
if (bytes < 1024 * 1024) {
|
|
9
10
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
10
11
|
}
|
|
11
12
|
if (bytes < 1024 * 1024 * 1024) {
|
|
12
|
-
return `${(bytes
|
|
13
|
+
return `${bytesToMB(bytes).toFixed(1)} MB`;
|
|
13
14
|
}
|
|
14
15
|
return `${gb.toFixed(2)} GB`;
|
|
15
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QAC/B,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
import { bytesToMB, formatMemoryUsage } from './formatters.js';
|
|
8
|
+
describe('bytesToMB', () => {
|
|
9
|
+
it('converts bytes to megabytes', () => {
|
|
10
|
+
expect(bytesToMB(0)).toBe(0);
|
|
11
|
+
expect(bytesToMB(512 * 1024)).toBeCloseTo(0.5, 5);
|
|
12
|
+
expect(bytesToMB(5 * 1024 * 1024)).toBe(5);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
describe('formatMemoryUsage', () => {
|
|
16
|
+
it('formats values below one megabyte in KB', () => {
|
|
17
|
+
expect(formatMemoryUsage(512 * 1024)).toBe('512.0 KB');
|
|
18
|
+
});
|
|
19
|
+
it('formats values below one gigabyte in MB', () => {
|
|
20
|
+
expect(formatMemoryUsage(5 * 1024 * 1024)).toBe('5.0 MB');
|
|
21
|
+
});
|
|
22
|
+
it('formats values of one gigabyte or larger in GB', () => {
|
|
23
|
+
expect(formatMemoryUsage(2 * 1024 * 1024 * 1024)).toBe('2.00 GB');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
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AAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview
|
|
8
|
+
* This file contains types and functions for parsing structured Google API errors.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Based on google/rpc/error_details.proto
|
|
12
|
+
*/
|
|
13
|
+
export interface ErrorInfo {
|
|
14
|
+
'@type': 'type.googleapis.com/google.rpc.ErrorInfo';
|
|
15
|
+
reason: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
metadata: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface RetryInfo {
|
|
22
|
+
'@type': 'type.googleapis.com/google.rpc.RetryInfo';
|
|
23
|
+
retryDelay: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DebugInfo {
|
|
26
|
+
'@type': 'type.googleapis.com/google.rpc.DebugInfo';
|
|
27
|
+
stackEntries: string[];
|
|
28
|
+
detail: string;
|
|
29
|
+
}
|
|
30
|
+
export interface QuotaFailure {
|
|
31
|
+
'@type': 'type.googleapis.com/google.rpc.QuotaFailure';
|
|
32
|
+
violations: Array<{
|
|
33
|
+
subject: string;
|
|
34
|
+
description: string;
|
|
35
|
+
apiService?: string;
|
|
36
|
+
quotaMetric?: string;
|
|
37
|
+
quotaId?: string;
|
|
38
|
+
quotaDimensions?: {
|
|
39
|
+
[key: string]: string;
|
|
40
|
+
};
|
|
41
|
+
quotaValue?: number;
|
|
42
|
+
futureQuotaValue?: number;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export interface PreconditionFailure {
|
|
46
|
+
'@type': 'type.googleapis.com/google.rpc.PreconditionFailure';
|
|
47
|
+
violations: Array<{
|
|
48
|
+
type: string;
|
|
49
|
+
subject: string;
|
|
50
|
+
description: string;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
export interface LocalizedMessage {
|
|
54
|
+
'@type': 'type.googleapis.com/google.rpc.LocalizedMessage';
|
|
55
|
+
locale: string;
|
|
56
|
+
message: string;
|
|
57
|
+
}
|
|
58
|
+
export interface BadRequest {
|
|
59
|
+
'@type': 'type.googleapis.com/google.rpc.BadRequest';
|
|
60
|
+
fieldViolations: Array<{
|
|
61
|
+
field: string;
|
|
62
|
+
description: string;
|
|
63
|
+
reason?: string;
|
|
64
|
+
localizedMessage?: LocalizedMessage;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
export interface RequestInfo {
|
|
68
|
+
'@type': 'type.googleapis.com/google.rpc.RequestInfo';
|
|
69
|
+
requestId: string;
|
|
70
|
+
servingData: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ResourceInfo {
|
|
73
|
+
'@type': 'type.googleapis.com/google.rpc.ResourceInfo';
|
|
74
|
+
resourceType: string;
|
|
75
|
+
resourceName: string;
|
|
76
|
+
owner: string;
|
|
77
|
+
description: string;
|
|
78
|
+
}
|
|
79
|
+
export interface Help {
|
|
80
|
+
'@type': 'type.googleapis.com/google.rpc.Help';
|
|
81
|
+
links: Array<{
|
|
82
|
+
description: string;
|
|
83
|
+
url: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export type GoogleApiErrorDetail = ErrorInfo | RetryInfo | DebugInfo | QuotaFailure | PreconditionFailure | BadRequest | RequestInfo | ResourceInfo | Help | LocalizedMessage;
|
|
87
|
+
export interface GoogleApiError {
|
|
88
|
+
code: number;
|
|
89
|
+
message: string;
|
|
90
|
+
details: GoogleApiErrorDetail[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parses an error object to check if it's a structured Google API error
|
|
94
|
+
* and extracts all details.
|
|
95
|
+
*
|
|
96
|
+
* This function can handle two formats:
|
|
97
|
+
* 1. Standard Google API errors where `details` is a top-level field.
|
|
98
|
+
* 2. Errors where the entire structured error object is stringified inside
|
|
99
|
+
* the `message` field of a wrapper error.
|
|
100
|
+
*
|
|
101
|
+
* @param error The error object to inspect.
|
|
102
|
+
* @returns A GoogleApiError object if the error matches, otherwise null.
|
|
103
|
+
*/
|
|
104
|
+
export declare function parseGoogleApiError(error: unknown): GoogleApiError | null;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parses an error object to check if it's a structured Google API error
|
|
8
|
+
* and extracts all details.
|
|
9
|
+
*
|
|
10
|
+
* This function can handle two formats:
|
|
11
|
+
* 1. Standard Google API errors where `details` is a top-level field.
|
|
12
|
+
* 2. Errors where the entire structured error object is stringified inside
|
|
13
|
+
* the `message` field of a wrapper error.
|
|
14
|
+
*
|
|
15
|
+
* @param error The error object to inspect.
|
|
16
|
+
* @returns A GoogleApiError object if the error matches, otherwise null.
|
|
17
|
+
*/
|
|
18
|
+
export function parseGoogleApiError(error) {
|
|
19
|
+
if (!error) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
let errorObj = error;
|
|
23
|
+
// If error is a string, try to parse it.
|
|
24
|
+
if (typeof errorObj === 'string') {
|
|
25
|
+
try {
|
|
26
|
+
errorObj = JSON.parse(errorObj);
|
|
27
|
+
}
|
|
28
|
+
catch (_) {
|
|
29
|
+
// Not a JSON string, can't parse.
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (typeof errorObj !== 'object' || errorObj === null) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const gaxiosError = errorObj;
|
|
37
|
+
let outerError;
|
|
38
|
+
if (gaxiosError.response?.data) {
|
|
39
|
+
if (typeof gaxiosError.response.data === 'string') {
|
|
40
|
+
try {
|
|
41
|
+
const parsedData = JSON.parse(gaxiosError.response.data);
|
|
42
|
+
if (parsedData.error) {
|
|
43
|
+
outerError = parsedData.error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (_) {
|
|
47
|
+
// Not a JSON string, or doesn't contain .error
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (typeof gaxiosError.response.data === 'object' &&
|
|
51
|
+
gaxiosError.response.data !== null) {
|
|
52
|
+
outerError = gaxiosError.response.data.error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const responseStatus = gaxiosError.response?.status;
|
|
56
|
+
if (!outerError) {
|
|
57
|
+
// If the gaxios structure isn't there, check for a top-level `error` property.
|
|
58
|
+
if (gaxiosError.error) {
|
|
59
|
+
outerError = gaxiosError.error;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let currentError = outerError;
|
|
66
|
+
let depth = 0;
|
|
67
|
+
const maxDepth = 10;
|
|
68
|
+
// Handle cases where the actual error object is stringified inside the message
|
|
69
|
+
// by drilling down until we find an error that doesn't have a stringified message.
|
|
70
|
+
while (typeof currentError.message === 'string' && depth < maxDepth) {
|
|
71
|
+
try {
|
|
72
|
+
const parsedMessage = JSON.parse(currentError.message);
|
|
73
|
+
if (parsedMessage.error) {
|
|
74
|
+
currentError = parsedMessage.error;
|
|
75
|
+
depth++;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// The message is a JSON string, but not a nested error object.
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (_) {
|
|
83
|
+
// It wasn't a JSON string, so we've drilled down as far as we can.
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const code = responseStatus ?? currentError.code ?? gaxiosError.code;
|
|
88
|
+
const message = currentError.message;
|
|
89
|
+
const errorDetails = currentError.details;
|
|
90
|
+
if (Array.isArray(errorDetails) && code && message) {
|
|
91
|
+
const details = [];
|
|
92
|
+
for (const detail of errorDetails) {
|
|
93
|
+
if (detail && typeof detail === 'object' && '@type' in detail) {
|
|
94
|
+
// We can just cast it; the consumer will have to switch on @type
|
|
95
|
+
details.push(detail);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (details.length > 0) {
|
|
99
|
+
return {
|
|
100
|
+
code,
|
|
101
|
+
message,
|
|
102
|
+
details,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=googleErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"googleErrors.js","sourceRoot":"","sources":["../../../src/utils/googleErrors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4GH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,GAAY,KAAK,CAAC;IAE9B,yCAAyC;IACzC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,kCAAkC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAQD,MAAM,WAAW,GAAG,QAWnB,CAAC;IAEF,IAAI,UAAkC,CAAC;IACvC,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;Q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