@kenkaiiii/gg-ai 5.9.2 → 5.9.4

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.d.cts CHANGED
@@ -343,15 +343,15 @@ declare const providerRegistry: ProviderRegistryImpl;
343
343
  *
344
344
  * Every error users see should answer one question: "is this me or them?"
345
345
  * That answer drives whether they retry, switch model, log in, or report a
346
- * ggcoder bug. The `FormattedError` shape captures it in plain English:
346
+ * GG Coder bug. The `FormattedError` shape captures it in plain English:
347
347
  *
348
348
  * ✗ OpenAI returned an error.
349
349
  * An error occurred while processing your request...
350
- * → This is an OpenAI issue, not ggcoder. Retry — if it persists, check status.openai.com.
350
+ * → This is an OpenAI issue, not GG Coder. Retry — if it persists, check status.openai.com.
351
351
  *
352
- * ✗ ggcoder hit an unexpected error.
352
+ * ✗ GG Coder hit an unexpected error.
353
353
  * Cannot read property 'foo' of undefined
354
- * → This is a ggcoder bug — please report it.
354
+ * → This is a GG Coder bug — please report it.
355
355
  */
356
356
  type ErrorSource = "provider" | "ggcoder" | "network" | "auth" | "capability";
357
357
  interface FormattedError {
package/dist/index.d.ts CHANGED
@@ -343,15 +343,15 @@ declare const providerRegistry: ProviderRegistryImpl;
343
343
  *
344
344
  * Every error users see should answer one question: "is this me or them?"
345
345
  * That answer drives whether they retry, switch model, log in, or report a
346
- * ggcoder bug. The `FormattedError` shape captures it in plain English:
346
+ * GG Coder bug. The `FormattedError` shape captures it in plain English:
347
347
  *
348
348
  * ✗ OpenAI returned an error.
349
349
  * An error occurred while processing your request...
350
- * → This is an OpenAI issue, not ggcoder. Retry — if it persists, check status.openai.com.
350
+ * → This is an OpenAI issue, not GG Coder. Retry — if it persists, check status.openai.com.
351
351
  *
352
- * ✗ ggcoder hit an unexpected error.
352
+ * ✗ GG Coder hit an unexpected error.
353
353
  * Cannot read property 'foo' of undefined
354
- * → This is a ggcoder bug — please report it.
354
+ * → This is a GG Coder bug — please report it.
355
355
  */
356
356
  type ErrorSource = "provider" | "ggcoder" | "network" | "auth" | "capability";
357
357
  interface FormattedError {
package/dist/index.js CHANGED
@@ -159,7 +159,7 @@ function finaliseBySource(source, message, requestId, hint) {
159
159
  headline: "Network error \u2014 couldn't reach the provider.",
160
160
  source,
161
161
  message,
162
- guidance: hint ?? "Check your internet connection. Not a ggcoder issue \u2014 retry shortly.",
162
+ guidance: hint ?? "Check your internet connection. Not a GG Coder issue \u2014 retry shortly.",
163
163
  ...requestId ? { requestId } : {}
164
164
  };
165
165
  case "auth":
@@ -188,10 +188,10 @@ function finaliseBySource(source, message, requestId, hint) {
188
188
  };
189
189
  case "ggcoder":
190
190
  return {
191
- headline: "ggcoder hit an unexpected error.",
191
+ headline: "GG Coder hit an unexpected error.",
192
192
  source,
193
193
  message,
194
- guidance: hint ?? "This looks like a ggcoder bug \u2014 please report it to the developer (see /help).",
194
+ guidance: hint ?? "This looks like a GG Coder bug \u2014 please report it to the developer (see /help).",
195
195
  ...requestId ? { requestId } : {}
196
196
  };
197
197
  }
@@ -225,25 +225,25 @@ function providerGuidance(provider, message, statusCode) {
225
225
  return `Authentication failed with ${name}. Re-authenticate to refresh your credentials.`;
226
226
  }
227
227
  if (lower.includes("overloaded") || lower.includes("engine_overloaded")) {
228
- return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a ggcoder issue.`;
228
+ return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a GG Coder issue.`;
229
229
  }
230
230
  if (lower.includes("insufficient balance") || lower.includes("quota exceeded") || lower.includes("recharge") || lower.includes("no resource package")) {
231
- return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a ggcoder issue.`;
231
+ return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a GG Coder issue.`;
232
232
  }
233
233
  if (statusCode === 429 || lower.includes("rate limit") || lower.includes("too many requests")) {
234
- return `${name} rate limit hit. Wait a moment then retry \u2014 not a ggcoder issue.`;
234
+ return `${name} rate limit hit. Wait a moment then retry \u2014 not a GG Coder issue.`;
235
235
  }
236
236
  if (statusCode === 502 || lower.includes("bad gateway")) {
237
- return `${name} returned a bad gateway. Retry \u2014 this is on their side, not ggcoder.`;
237
+ return `${name} returned a bad gateway. Retry \u2014 this is on their side, not GG Coder.`;
238
238
  }
239
239
  if (statusCode === 503 || lower.includes("service unavailable")) {
240
- return `${name} is temporarily unavailable. Retry shortly \u2014 not a ggcoder issue.`;
240
+ return `${name} is temporarily unavailable. Retry shortly \u2014 not a GG Coder issue.`;
241
241
  }
242
242
  if (statusCode === 500 || lower.includes("server_error") || lower.includes("500") && lower.includes("internal server error")) {
243
- return status ? `This is an error from ${name}, not ggcoder. Retry \u2014 if it keeps happening, check ${status}.` : `This is an error from ${name}, not ggcoder. Retry \u2014 if it keeps happening, try a different model with /model.`;
243
+ return status ? `This is an error from ${name}, not GG Coder. Retry \u2014 if it keeps happening, check ${status}.` : `This is an error from ${name}, not GG Coder. Retry \u2014 if it keeps happening, try a different model with /model.`;
244
244
  }
245
245
  if (lower.includes("timeout") || lower.includes("timed out")) {
246
- return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a ggcoder issue.`;
246
+ return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a GG Coder issue.`;
247
247
  }
248
248
  if (lower.includes("does not recognize the requested model") || lower.includes("model") && (lower.includes("not exist") || lower.includes("not found") || lower.includes("no access"))) {
249
249
  return `${name} doesn't recognise this model on your account. Use /model to switch, or check your subscription tier.`;
@@ -251,7 +251,10 @@ function providerGuidance(provider, message, statusCode) {
251
251
  if (lower.includes("context_length_exceeded") || lower.includes("prompt is too long")) {
252
252
  return `Context window for this ${name} model is full. Run /compact to shrink history, or start a new session.`;
253
253
  }
254
- return status ? `This is an error from ${name}, not ggcoder. Retry \u2014 if it persists, check ${status}.` : `This is an error from ${name}, not ggcoder. Retry \u2014 if it persists, try a different model with /model.`;
254
+ if (statusCode === 413 || lower.includes("request_too_large") || lower.includes("request exceeds the maximum size")) {
255
+ return `The request to ${name} is too large. Run /compact to shrink history, or start a new session.`;
256
+ }
257
+ return status ? `This is an error from ${name}, not GG Coder. Retry \u2014 if it persists, check ${status}.` : `This is an error from ${name}, not GG Coder. Retry \u2014 if it persists, try a different model with /model.`;
255
258
  }
256
259
 
257
260
  // src/providers/anthropic.ts
@@ -2628,10 +2631,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
2628
2631
  "gemini-3.1-pro-preview",
2629
2632
  "gemini-3.1-pro-preview-customtools",
2630
2633
  "gemini-3-flash-preview",
2631
- "gemini-3.1-flash-lite-preview",
2634
+ "gemini-3.5-flash",
2635
+ "gemini-3-flash",
2636
+ "gemini-3.1-flash-lite",
2632
2637
  "gemini-2.5-pro",
2633
2638
  "gemini-2.5-flash",
2634
- "gemini-2.5-flash-lite",
2635
2639
  "gemma-4-31b-it",
2636
2640
  "gemma-4-26b-a4b-it"
2637
2641
  ]);
@@ -2648,6 +2652,18 @@ function getCodeAssistEndpoint(method) {
2648
2652
  function formatUnsupportedModelMessage(model) {
2649
2653
  return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
2650
2654
  }
2655
+ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
2656
+ "gemini-3-flash",
2657
+ "gemini-3.5-flash",
2658
+ "gemini-3.1-pro-preview",
2659
+ "gemini-3.1-pro-preview-customtools"
2660
+ ]);
2661
+ function accountGatedMessage(model) {
2662
+ 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.`;
2663
+ }
2664
+ function accountGatedHint() {
2665
+ 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.`;
2666
+ }
2651
2667
  function formatErrorMessage(status, body, model) {
2652
2668
  if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
2653
2669
  return `Gemini API error (404): ${body}
@@ -2958,7 +2974,8 @@ async function fetchCodeAssist(plan, options) {
2958
2974
  if (!response.ok) {
2959
2975
  const text = await response.text().catch(() => "");
2960
2976
  const quota = parseGeminiQuota(response.status, text);
2961
- let message = formatErrorMessage(response.status, text, options.model);
2977
+ const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
2978
+ let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
2962
2979
  let resetsAt;
2963
2980
  if (quota?.exhausted) {
2964
2981
  message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
@@ -2967,7 +2984,8 @@ async function fetchCodeAssist(plan, options) {
2967
2984
  }
2968
2985
  throw new ProviderError("gemini", message, {
2969
2986
  statusCode: response.status,
2970
- ...resetsAt !== void 0 ? { resetsAt } : {}
2987
+ ...resetsAt !== void 0 ? { resetsAt } : {},
2988
+ ...accountGated ? { hint: accountGatedHint() } : {}
2971
2989
  });
2972
2990
  }
2973
2991
  return response;