@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.cjs CHANGED
@@ -214,7 +214,7 @@ function finaliseBySource(source, message, requestId, hint) {
214
214
  headline: "Network error \u2014 couldn't reach the provider.",
215
215
  source,
216
216
  message,
217
- guidance: hint ?? "Check your internet connection. Not a ggcoder issue \u2014 retry shortly.",
217
+ guidance: hint ?? "Check your internet connection. Not a GG Coder issue \u2014 retry shortly.",
218
218
  ...requestId ? { requestId } : {}
219
219
  };
220
220
  case "auth":
@@ -243,10 +243,10 @@ function finaliseBySource(source, message, requestId, hint) {
243
243
  };
244
244
  case "ggcoder":
245
245
  return {
246
- headline: "ggcoder hit an unexpected error.",
246
+ headline: "GG Coder hit an unexpected error.",
247
247
  source,
248
248
  message,
249
- guidance: hint ?? "This looks like a ggcoder bug \u2014 please report it to the developer (see /help).",
249
+ guidance: hint ?? "This looks like a GG Coder bug \u2014 please report it to the developer (see /help).",
250
250
  ...requestId ? { requestId } : {}
251
251
  };
252
252
  }
@@ -280,25 +280,25 @@ function providerGuidance(provider, message, statusCode) {
280
280
  return `Authentication failed with ${name}. Re-authenticate to refresh your credentials.`;
281
281
  }
282
282
  if (lower.includes("overloaded") || lower.includes("engine_overloaded")) {
283
- return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a ggcoder issue.`;
283
+ return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a GG Coder issue.`;
284
284
  }
285
285
  if (lower.includes("insufficient balance") || lower.includes("quota exceeded") || lower.includes("recharge") || lower.includes("no resource package")) {
286
- return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a ggcoder issue.`;
286
+ return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a GG Coder issue.`;
287
287
  }
288
288
  if (statusCode === 429 || lower.includes("rate limit") || lower.includes("too many requests")) {
289
- return `${name} rate limit hit. Wait a moment then retry \u2014 not a ggcoder issue.`;
289
+ return `${name} rate limit hit. Wait a moment then retry \u2014 not a GG Coder issue.`;
290
290
  }
291
291
  if (statusCode === 502 || lower.includes("bad gateway")) {
292
- return `${name} returned a bad gateway. Retry \u2014 this is on their side, not ggcoder.`;
292
+ return `${name} returned a bad gateway. Retry \u2014 this is on their side, not GG Coder.`;
293
293
  }
294
294
  if (statusCode === 503 || lower.includes("service unavailable")) {
295
- return `${name} is temporarily unavailable. Retry shortly \u2014 not a ggcoder issue.`;
295
+ return `${name} is temporarily unavailable. Retry shortly \u2014 not a GG Coder issue.`;
296
296
  }
297
297
  if (statusCode === 500 || lower.includes("server_error") || lower.includes("500") && lower.includes("internal server error")) {
298
- 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.`;
298
+ 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.`;
299
299
  }
300
300
  if (lower.includes("timeout") || lower.includes("timed out")) {
301
- return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a ggcoder issue.`;
301
+ return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a GG Coder issue.`;
302
302
  }
303
303
  if (lower.includes("does not recognize the requested model") || lower.includes("model") && (lower.includes("not exist") || lower.includes("not found") || lower.includes("no access"))) {
304
304
  return `${name} doesn't recognise this model on your account. Use /model to switch, or check your subscription tier.`;
@@ -306,7 +306,10 @@ function providerGuidance(provider, message, statusCode) {
306
306
  if (lower.includes("context_length_exceeded") || lower.includes("prompt is too long")) {
307
307
  return `Context window for this ${name} model is full. Run /compact to shrink history, or start a new session.`;
308
308
  }
309
- 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.`;
309
+ if (statusCode === 413 || lower.includes("request_too_large") || lower.includes("request exceeds the maximum size")) {
310
+ return `The request to ${name} is too large. Run /compact to shrink history, or start a new session.`;
311
+ }
312
+ 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.`;
310
313
  }
311
314
 
312
315
  // src/providers/anthropic.ts
@@ -2683,10 +2686,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
2683
2686
  "gemini-3.1-pro-preview",
2684
2687
  "gemini-3.1-pro-preview-customtools",
2685
2688
  "gemini-3-flash-preview",
2686
- "gemini-3.1-flash-lite-preview",
2689
+ "gemini-3.5-flash",
2690
+ "gemini-3-flash",
2691
+ "gemini-3.1-flash-lite",
2687
2692
  "gemini-2.5-pro",
2688
2693
  "gemini-2.5-flash",
2689
- "gemini-2.5-flash-lite",
2690
2694
  "gemma-4-31b-it",
2691
2695
  "gemma-4-26b-a4b-it"
2692
2696
  ]);
@@ -2703,6 +2707,18 @@ function getCodeAssistEndpoint(method) {
2703
2707
  function formatUnsupportedModelMessage(model) {
2704
2708
  return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
2705
2709
  }
2710
+ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
2711
+ "gemini-3-flash",
2712
+ "gemini-3.5-flash",
2713
+ "gemini-3.1-pro-preview",
2714
+ "gemini-3.1-pro-preview-customtools"
2715
+ ]);
2716
+ function accountGatedMessage(model) {
2717
+ 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.`;
2718
+ }
2719
+ function accountGatedHint() {
2720
+ 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.`;
2721
+ }
2706
2722
  function formatErrorMessage(status, body, model) {
2707
2723
  if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
2708
2724
  return `Gemini API error (404): ${body}
@@ -3013,7 +3029,8 @@ async function fetchCodeAssist(plan, options) {
3013
3029
  if (!response.ok) {
3014
3030
  const text = await response.text().catch(() => "");
3015
3031
  const quota = parseGeminiQuota(response.status, text);
3016
- let message = formatErrorMessage(response.status, text, options.model);
3032
+ const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
3033
+ let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
3017
3034
  let resetsAt;
3018
3035
  if (quota?.exhausted) {
3019
3036
  message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
@@ -3022,7 +3039,8 @@ async function fetchCodeAssist(plan, options) {
3022
3039
  }
3023
3040
  throw new ProviderError("gemini", message, {
3024
3041
  statusCode: response.status,
3025
- ...resetsAt !== void 0 ? { resetsAt } : {}
3042
+ ...resetsAt !== void 0 ? { resetsAt } : {},
3043
+ ...accountGated ? { hint: accountGatedHint() } : {}
3026
3044
  });
3027
3045
  }
3028
3046
  return response;