@kenkaiiii/gg-ai 5.9.2 → 5.9.3
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/index.cjs +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2683,10 +2683,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
|
2683
2683
|
"gemini-3.1-pro-preview",
|
|
2684
2684
|
"gemini-3.1-pro-preview-customtools",
|
|
2685
2685
|
"gemini-3-flash-preview",
|
|
2686
|
-
"gemini-3.
|
|
2686
|
+
"gemini-3.5-flash",
|
|
2687
|
+
"gemini-3-flash",
|
|
2688
|
+
"gemini-3.1-flash-lite",
|
|
2687
2689
|
"gemini-2.5-pro",
|
|
2688
2690
|
"gemini-2.5-flash",
|
|
2689
|
-
"gemini-2.5-flash-lite",
|
|
2690
2691
|
"gemma-4-31b-it",
|
|
2691
2692
|
"gemma-4-26b-a4b-it"
|
|
2692
2693
|
]);
|
|
@@ -2703,6 +2704,18 @@ function getCodeAssistEndpoint(method) {
|
|
|
2703
2704
|
function formatUnsupportedModelMessage(model) {
|
|
2704
2705
|
return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
|
|
2705
2706
|
}
|
|
2707
|
+
var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
|
|
2708
|
+
"gemini-3-flash",
|
|
2709
|
+
"gemini-3.5-flash",
|
|
2710
|
+
"gemini-3.1-pro-preview",
|
|
2711
|
+
"gemini-3.1-pro-preview-customtools"
|
|
2712
|
+
]);
|
|
2713
|
+
function accountGatedMessage(model) {
|
|
2714
|
+
return `Your Google account isn't entitled to "${model}" over Gemini Code Assist OAuth, so the API reports it as not found. This is an account-access limit, not a ggcoder bug.`;
|
|
2715
|
+
}
|
|
2716
|
+
function accountGatedHint() {
|
|
2717
|
+
return `Newer Gemini models (3.5 Flash, 3.1 Pro Preview) are available only to Code Assist Standard/Enterprise accounts with preview/GA access enabled by a cloud admin \u2014 free/personal accounts usually can't call them. Switch to Gemini 3.1 Flash Lite (it works on this account) with /model, or sign in with a Code Assist Standard/Enterprise account that has preview access.`;
|
|
2718
|
+
}
|
|
2706
2719
|
function formatErrorMessage(status, body, model) {
|
|
2707
2720
|
if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
|
|
2708
2721
|
return `Gemini API error (404): ${body}
|
|
@@ -3013,7 +3026,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
3013
3026
|
if (!response.ok) {
|
|
3014
3027
|
const text = await response.text().catch(() => "");
|
|
3015
3028
|
const quota = parseGeminiQuota(response.status, text);
|
|
3016
|
-
|
|
3029
|
+
const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
|
|
3030
|
+
let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
|
|
3017
3031
|
let resetsAt;
|
|
3018
3032
|
if (quota?.exhausted) {
|
|
3019
3033
|
message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
|
|
@@ -3022,7 +3036,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
3022
3036
|
}
|
|
3023
3037
|
throw new ProviderError("gemini", message, {
|
|
3024
3038
|
statusCode: response.status,
|
|
3025
|
-
...resetsAt !== void 0 ? { resetsAt } : {}
|
|
3039
|
+
...resetsAt !== void 0 ? { resetsAt } : {},
|
|
3040
|
+
...accountGated ? { hint: accountGatedHint() } : {}
|
|
3026
3041
|
});
|
|
3027
3042
|
}
|
|
3028
3043
|
return response;
|