@google/gemini-cli 0.1.9-nightly.250709.c8cf954e → 0.1.9-nightly.250710.da50a1ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/google-gemini-cli-0.1.9.tgz +0 -0
- package/dist/package.json +6 -6
- package/dist/src/config/config.js +7 -5
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/settings.d.ts +5 -2
- package/dist/src/config/settings.js +38 -2
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.js +4 -1
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/nonInteractiveCli.d.ts +1 -1
- package/dist/src/nonInteractiveCli.js +4 -2
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/ui/App.js +62 -7
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.js +10 -9
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/contexts/SessionContext.d.ts +3 -0
- package/dist/src/ui/contexts/SessionContext.js +12 -2
- package/dist/src/ui/contexts/SessionContext.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +2 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.d.ts +2 -2
- package/dist/src/ui/hooks/useGeminiStream.js +33 -10
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/utils/errorParsing.d.ts +2 -10
- package/dist/src/ui/utils/errorParsing.js +34 -23
- package/dist/src/ui/utils/errorParsing.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -3,41 +3,52 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { AuthType } from '@google/gemini-cli-core';
|
|
7
|
-
|
|
6
|
+
import { AuthType, UserTierId, DEFAULT_GEMINI_FLASH_MODEL, DEFAULT_GEMINI_MODEL, isProQuotaExceededError, isGenericQuotaExceededError, isApiError, isStructuredError, } from '@google/gemini-cli-core';
|
|
7
|
+
// Free Tier message functions
|
|
8
|
+
const getRateLimitErrorMessageGoogleFree = (fallbackModel = DEFAULT_GEMINI_FLASH_MODEL) => `\nPossible quota limitations in place or slow response times detected. Switching to the ${fallbackModel} model for the rest of this session.`;
|
|
9
|
+
const getRateLimitErrorMessageGoogleProQuotaFree = (currentModel = DEFAULT_GEMINI_MODEL, fallbackModel = DEFAULT_GEMINI_FLASH_MODEL) => `\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
10
|
+
const getRateLimitErrorMessageGoogleGenericQuotaFree = () => `\nYou have reached your daily quota limit. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
11
|
+
// Legacy/Standard Tier message functions
|
|
12
|
+
const getRateLimitErrorMessageGooglePaid = (fallbackModel = DEFAULT_GEMINI_FLASH_MODEL) => `\nPossible quota limitations in place or slow response times detected. Switching to the ${fallbackModel} model for the rest of this session. We appreciate you for choosing Gemini Code Assist and the Gemini CLI.`;
|
|
13
|
+
const getRateLimitErrorMessageGoogleProQuotaPaid = (currentModel = DEFAULT_GEMINI_MODEL, fallbackModel = DEFAULT_GEMINI_FLASH_MODEL) => `\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. We appreciate you for choosing Gemini Code Assist and the Gemini CLI. To continue accessing the ${currentModel} model today, consider using /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
14
|
+
const getRateLimitErrorMessageGoogleGenericQuotaPaid = (currentModel = DEFAULT_GEMINI_MODEL) => `\nYou have reached your daily quota limit. We appreciate you for choosing Gemini Code Assist and the Gemini CLI. To continue accessing the ${currentModel} model today, consider using /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
|
|
8
15
|
const RATE_LIMIT_ERROR_MESSAGE_USE_GEMINI = '\nPlease wait and try again later. To increase your limits, request a quota increase through AI Studio, or switch to another /auth method';
|
|
9
16
|
const RATE_LIMIT_ERROR_MESSAGE_VERTEX = '\nPlease wait and try again later. To increase your limits, request a quota increase through Vertex, or switch to another /auth method';
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
return (typeof error === 'object' &&
|
|
13
|
-
error !== null &&
|
|
14
|
-
'error' in error &&
|
|
15
|
-
typeof error.error === 'object' &&
|
|
16
|
-
'message' in error.error);
|
|
17
|
-
}
|
|
18
|
-
function isStructuredError(error) {
|
|
19
|
-
return (typeof error === 'object' &&
|
|
20
|
-
error !== null &&
|
|
21
|
-
'message' in error &&
|
|
22
|
-
typeof error.message === 'string');
|
|
23
|
-
}
|
|
24
|
-
function getRateLimitMessage(authType) {
|
|
17
|
+
const getRateLimitErrorMessageDefault = (fallbackModel = DEFAULT_GEMINI_FLASH_MODEL) => `\nPossible quota limitations in place or slow response times detected. Switching to the ${fallbackModel} model for the rest of this session.`;
|
|
18
|
+
function getRateLimitMessage(authType, error, userTier, currentModel, fallbackModel) {
|
|
25
19
|
switch (authType) {
|
|
26
|
-
case AuthType.LOGIN_WITH_GOOGLE:
|
|
27
|
-
|
|
20
|
+
case AuthType.LOGIN_WITH_GOOGLE: {
|
|
21
|
+
// Determine if user is on a paid tier (Legacy or Standard) - default to FREE if not specified
|
|
22
|
+
const isPaidTier = userTier === UserTierId.LEGACY || userTier === UserTierId.STANDARD;
|
|
23
|
+
if (isProQuotaExceededError(error)) {
|
|
24
|
+
return isPaidTier
|
|
25
|
+
? getRateLimitErrorMessageGoogleProQuotaPaid(currentModel || DEFAULT_GEMINI_MODEL, fallbackModel)
|
|
26
|
+
: getRateLimitErrorMessageGoogleProQuotaFree(currentModel || DEFAULT_GEMINI_MODEL, fallbackModel);
|
|
27
|
+
}
|
|
28
|
+
else if (isGenericQuotaExceededError(error)) {
|
|
29
|
+
return isPaidTier
|
|
30
|
+
? getRateLimitErrorMessageGoogleGenericQuotaPaid(currentModel || DEFAULT_GEMINI_MODEL)
|
|
31
|
+
: getRateLimitErrorMessageGoogleGenericQuotaFree();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return isPaidTier
|
|
35
|
+
? getRateLimitErrorMessageGooglePaid(fallbackModel)
|
|
36
|
+
: getRateLimitErrorMessageGoogleFree(fallbackModel);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
case AuthType.USE_GEMINI:
|
|
29
40
|
return RATE_LIMIT_ERROR_MESSAGE_USE_GEMINI;
|
|
30
41
|
case AuthType.USE_VERTEX_AI:
|
|
31
42
|
return RATE_LIMIT_ERROR_MESSAGE_VERTEX;
|
|
32
43
|
default:
|
|
33
|
-
return
|
|
44
|
+
return getRateLimitErrorMessageDefault(fallbackModel);
|
|
34
45
|
}
|
|
35
46
|
}
|
|
36
|
-
export function parseAndFormatApiError(error, authType) {
|
|
47
|
+
export function parseAndFormatApiError(error, authType, userTier, currentModel, fallbackModel) {
|
|
37
48
|
if (isStructuredError(error)) {
|
|
38
49
|
let text = `[API Error: ${error.message}]`;
|
|
39
50
|
if (error.status === 429) {
|
|
40
|
-
text += getRateLimitMessage(authType);
|
|
51
|
+
text += getRateLimitMessage(authType, error, userTier, currentModel, fallbackModel);
|
|
41
52
|
}
|
|
42
53
|
return text;
|
|
43
54
|
}
|
|
@@ -64,7 +75,7 @@ export function parseAndFormatApiError(error, authType) {
|
|
|
64
75
|
}
|
|
65
76
|
let text = `[API Error: ${finalMessage} (Status: ${parsedError.error.status})]`;
|
|
66
77
|
if (parsedError.error.code === 429) {
|
|
67
|
-
text += getRateLimitMessage(authType);
|
|
78
|
+
text += getRateLimitMessage(authType, parsedError, userTier, currentModel, fallbackModel);
|
|
68
79
|
}
|
|
69
80
|
return text;
|
|
70
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorParsing.js","sourceRoot":"","sources":["../../../../src/ui/utils/errorParsing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"errorParsing.js","sourceRoot":"","sources":["../../../../src/ui/utils/errorParsing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,UAAU,EACV,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,8BAA8B;AAC9B,MAAM,kCAAkC,GAAG,CACzC,gBAAwB,0BAA0B,EAClD,EAAE,CACF,2FAA2F,aAAa,sCAAsC,CAAC;AAEjJ,MAAM,0CAA0C,GAAG,CACjD,eAAuB,oBAAoB,EAC3C,gBAAwB,0BAA0B,EAClD,EAAE,CACF,iCAAiC,YAAY,6CAA6C,aAAa,gSAAgS,CAAC;AAE1Y,MAAM,8CAA8C,GAAG,GAAG,EAAE,CAC1D,sSAAsS,CAAC;AAEzS,yCAAyC;AACzC,MAAM,kCAAkC,GAAG,CACzC,gBAAwB,0BAA0B,EAClD,EAAE,CACF,2FAA2F,aAAa,4GAA4G,CAAC;AAEvN,MAAM,0CAA0C,GAAG,CACjD,eAAuB,oBAAoB,EAC3C,gBAAwB,0BAA0B,EAClD,EAAE,CACF,iCAAiC,YAAY,6CAA6C,aAAa,wIAAwI,YAAY,2HAA2H,CAAC;AAEzX,MAAM,8CAA8C,GAAG,CACrD,eAAuB,oBAAoB,EAC3C,EAAE,CACF,8IAA8I,YAAY,2HAA2H,CAAC;AACxR,MAAM,mCAAmC,GACvC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