@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.js
CHANGED
|
@@ -2628,10 +2628,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
|
2628
2628
|
"gemini-3.1-pro-preview",
|
|
2629
2629
|
"gemini-3.1-pro-preview-customtools",
|
|
2630
2630
|
"gemini-3-flash-preview",
|
|
2631
|
-
"gemini-3.
|
|
2631
|
+
"gemini-3.5-flash",
|
|
2632
|
+
"gemini-3-flash",
|
|
2633
|
+
"gemini-3.1-flash-lite",
|
|
2632
2634
|
"gemini-2.5-pro",
|
|
2633
2635
|
"gemini-2.5-flash",
|
|
2634
|
-
"gemini-2.5-flash-lite",
|
|
2635
2636
|
"gemma-4-31b-it",
|
|
2636
2637
|
"gemma-4-26b-a4b-it"
|
|
2637
2638
|
]);
|
|
@@ -2648,6 +2649,18 @@ function getCodeAssistEndpoint(method) {
|
|
|
2648
2649
|
function formatUnsupportedModelMessage(model) {
|
|
2649
2650
|
return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
|
|
2650
2651
|
}
|
|
2652
|
+
var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
|
|
2653
|
+
"gemini-3-flash",
|
|
2654
|
+
"gemini-3.5-flash",
|
|
2655
|
+
"gemini-3.1-pro-preview",
|
|
2656
|
+
"gemini-3.1-pro-preview-customtools"
|
|
2657
|
+
]);
|
|
2658
|
+
function accountGatedMessage(model) {
|
|
2659
|
+
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.`;
|
|
2660
|
+
}
|
|
2661
|
+
function accountGatedHint() {
|
|
2662
|
+
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.`;
|
|
2663
|
+
}
|
|
2651
2664
|
function formatErrorMessage(status, body, model) {
|
|
2652
2665
|
if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
|
|
2653
2666
|
return `Gemini API error (404): ${body}
|
|
@@ -2958,7 +2971,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
2958
2971
|
if (!response.ok) {
|
|
2959
2972
|
const text = await response.text().catch(() => "");
|
|
2960
2973
|
const quota = parseGeminiQuota(response.status, text);
|
|
2961
|
-
|
|
2974
|
+
const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
|
|
2975
|
+
let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
|
|
2962
2976
|
let resetsAt;
|
|
2963
2977
|
if (quota?.exhausted) {
|
|
2964
2978
|
message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
|
|
@@ -2967,7 +2981,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
2967
2981
|
}
|
|
2968
2982
|
throw new ProviderError("gemini", message, {
|
|
2969
2983
|
statusCode: response.status,
|
|
2970
|
-
...resetsAt !== void 0 ? { resetsAt } : {}
|
|
2984
|
+
...resetsAt !== void 0 ? { resetsAt } : {},
|
|
2985
|
+
...accountGated ? { hint: accountGatedHint() } : {}
|
|
2971
2986
|
});
|
|
2972
2987
|
}
|
|
2973
2988
|
return response;
|