@prestyj/ai 5.3.1 → 5.4.0

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
- * ezcoder bug. The `FormattedError` shape captures it in plain English:
346
+ * EZ 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 ezcoder. Retry — if it persists, check status.openai.com.
350
+ * → This is an OpenAI issue, not EZ Coder. Retry — if it persists, check status.openai.com.
351
351
  *
352
- * ✗ ezcoder hit an unexpected error.
352
+ * ✗ EZ Coder hit an unexpected error.
353
353
  * Cannot read property 'foo' of undefined
354
- * → This is a ezcoder bug — please report it.
354
+ * → This is a EZ Coder bug — please report it.
355
355
  */
356
356
  type ErrorSource = "provider" | "ezcoder" | "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
- * ezcoder bug. The `FormattedError` shape captures it in plain English:
346
+ * EZ 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 ezcoder. Retry — if it persists, check status.openai.com.
350
+ * → This is an OpenAI issue, not EZ Coder. Retry — if it persists, check status.openai.com.
351
351
  *
352
- * ✗ ezcoder hit an unexpected error.
352
+ * ✗ EZ Coder hit an unexpected error.
353
353
  * Cannot read property 'foo' of undefined
354
- * → This is a ezcoder bug — please report it.
354
+ * → This is a EZ Coder bug — please report it.
355
355
  */
356
356
  type ErrorSource = "provider" | "ezcoder" | "network" | "auth" | "capability";
357
357
  interface FormattedError {
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function formatError(err) {
117
117
  provider: err.provider,
118
118
  statusCode: err.statusCode,
119
119
  ...err.requestId ? { requestId: err.requestId } : {},
120
- guidance: "Request access via your Anthropic account team (see platform.claude.com/docs/en/about-claude/models/overview), or switch to claude-fable-5 with /model \u2014 same underlying model, generally available."
120
+ guidance: "Request access via your Anthropic account team (see platform.claude.com/docs/en/about-claude/models/overview), or switch to Claude Fable 5 via the model selector \u2014 same underlying model, generally available."
121
121
  };
122
122
  }
123
123
  if (isUsageLimitError(err)) {
@@ -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 ezcoder issue \u2014 retry shortly.",
162
+ guidance: hint ?? "Check your internet connection. Not a EZ Coder issue \u2014 retry shortly.",
163
163
  ...requestId ? { requestId } : {}
164
164
  };
165
165
  case "auth":
@@ -167,7 +167,7 @@ function finaliseBySource(source, message, requestId, hint) {
167
167
  headline: "Authentication issue.",
168
168
  source,
169
169
  message,
170
- guidance: hint ?? "Run `ezcoder login` to refresh your credentials.",
170
+ guidance: hint ?? "Re-authenticate to refresh your credentials.",
171
171
  ...requestId ? { requestId } : {}
172
172
  };
173
173
  case "provider":
@@ -183,15 +183,15 @@ function finaliseBySource(source, message, requestId, hint) {
183
183
  headline: message,
184
184
  source,
185
185
  message: "",
186
- guidance: hint ?? "Only Kimi, Gemini, MiniMax, and MiMo-V2.5 can analyze video. Switch with /model.",
186
+ guidance: hint ?? "Only Kimi, Gemini, MiniMax, and MiMo-V2.5 can analyze video. Switch to one of those via the model selector.",
187
187
  ...requestId ? { requestId } : {}
188
188
  };
189
189
  case "ezcoder":
190
190
  return {
191
- headline: "ezcoder hit an unexpected error.",
191
+ headline: "EZ Coder hit an unexpected error.",
192
192
  source,
193
193
  message,
194
- guidance: hint ?? "This looks like a ezcoder bug \u2014 please report it to the developer (see /help).",
194
+ guidance: hint ?? "This looks like a EZ Coder bug \u2014 please report it to the developer (see /help).",
195
195
  ...requestId ? { requestId } : {}
196
196
  };
197
197
  }
@@ -222,36 +222,39 @@ function providerGuidance(provider, message, statusCode) {
222
222
  const status = provider ? PROVIDER_STATUS_URL[provider] : void 0;
223
223
  const lower = message.toLowerCase();
224
224
  if (statusCode === 401 || lower.includes("unauthorized") || lower.includes("invalid api key")) {
225
- return `Authentication failed with ${name}. Run \`ezcoder login\` to refresh your credentials.`;
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 ezcoder issue.`;
228
+ return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a EZ 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 ezcoder issue.`;
231
+ return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a EZ 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 ezcoder issue.`;
234
+ return `${name} rate limit hit. Wait a moment then retry \u2014 not a EZ 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 ezcoder.`;
237
+ return `${name} returned a bad gateway. Retry \u2014 this is on their side, not EZ Coder.`;
238
238
  }
239
239
  if (statusCode === 503 || lower.includes("service unavailable")) {
240
- return `${name} is temporarily unavailable. Retry shortly \u2014 not a ezcoder issue.`;
240
+ return `${name} is temporarily unavailable. Retry shortly \u2014 not a EZ 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 ezcoder. Retry \u2014 if it keeps happening, check ${status}.` : `This is an error from ${name}, not ezcoder. Retry \u2014 if it keeps happening, try a different model with /model.`;
243
+ return status ? `This is an error from ${name}, not EZ Coder. Retry \u2014 if it keeps happening, check ${status}.` : `This is an error from ${name}, not EZ Coder. Retry \u2014 if it keeps happening, try a different model via the model selector.`;
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 ezcoder issue.`;
246
+ return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a EZ 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
- return `${name} doesn't recognise this model on your account. Use /model to switch, or check your subscription tier.`;
249
+ return `${name} doesn't recognise this model on your account. Switch to a different model via the model selector, or check your subscription tier.`;
250
250
  }
251
251
  if (lower.includes("context_length_exceeded") || lower.includes("prompt is too long")) {
252
- return `Context window for this ${name} model is full. Run /compact to shrink history, or start a new session.`;
252
+ return `Context window for this ${name} model is full. Compact the conversation to shrink history, or start a new session.`;
253
253
  }
254
- return status ? `This is an error from ${name}, not ezcoder. Retry \u2014 if it persists, check ${status}.` : `This is an error from ${name}, not ezcoder. 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. Compact the conversation to shrink history, or start a new session.`;
256
+ }
257
+ return status ? `This is an error from ${name}, not EZ Coder. Retry \u2014 if it persists, check ${status}.` : `This is an error from ${name}, not EZ Coder. Retry \u2014 if it persists, try a different model via the model selector.`;
255
258
  }
256
259
 
257
260
  // src/providers/anthropic.ts
@@ -2202,10 +2205,10 @@ async function* runStream3(options) {
2202
2205
  if (options.model === "gpt-5.5-pro") {
2203
2206
  hint = "Use gpt-5.5 instead. OpenAI's Codex model catalog does not list gpt-5.5-pro.";
2204
2207
  } else {
2205
- hint = "This model is not available through Codex for the authenticated account. Run /model and choose a model listed for OpenAI Codex, or check your Codex model picker/usage limits.";
2208
+ hint = "This model is not available through Codex for the authenticated account. Switch to a model listed for OpenAI Codex via the model selector, or check your Codex usage limits.";
2206
2209
  }
2207
2210
  } else if (response.status === 404 && text.includes("does not exist")) {
2208
- hint = "This model is not in the current OpenAI Codex catalog for this account. Try gpt-5.5, gpt-5.4, gpt-5.4-mini, or gpt-5.3-codex.";
2211
+ hint = "This model is not in the current OpenAI Codex catalog for this account. Switch to gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, or gpt-5.5 via the model selector.";
2209
2212
  }
2210
2213
  throw new ProviderError("openai", message, {
2211
2214
  statusCode: response.status,
@@ -2629,10 +2632,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
2629
2632
  "gemini-3.1-pro-preview",
2630
2633
  "gemini-3.1-pro-preview-customtools",
2631
2634
  "gemini-3-flash-preview",
2632
- "gemini-3.1-flash-lite-preview",
2635
+ "gemini-3.5-flash",
2636
+ "gemini-3-flash",
2637
+ "gemini-3.1-flash-lite",
2633
2638
  "gemini-2.5-pro",
2634
2639
  "gemini-2.5-flash",
2635
- "gemini-2.5-flash-lite",
2636
2640
  "gemma-4-31b-it",
2637
2641
  "gemma-4-26b-a4b-it"
2638
2642
  ]);
@@ -2649,6 +2653,18 @@ function getCodeAssistEndpoint(method) {
2649
2653
  function formatUnsupportedModelMessage(model) {
2650
2654
  return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
2651
2655
  }
2656
+ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
2657
+ "gemini-3-flash",
2658
+ "gemini-3.5-flash",
2659
+ "gemini-3.1-pro-preview",
2660
+ "gemini-3.1-pro-preview-customtools"
2661
+ ]);
2662
+ function accountGatedMessage(model) {
2663
+ 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 ezcoder bug.`;
2664
+ }
2665
+ function accountGatedHint() {
2666
+ 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.`;
2667
+ }
2652
2668
  function formatErrorMessage(status, body, model) {
2653
2669
  if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
2654
2670
  return `Gemini API error (404): ${body}
@@ -2959,7 +2975,8 @@ async function fetchCodeAssist(plan, options) {
2959
2975
  if (!response.ok) {
2960
2976
  const text = await response.text().catch(() => "");
2961
2977
  const quota = parseGeminiQuota(response.status, text);
2962
- let message = formatErrorMessage(response.status, text, options.model);
2978
+ const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
2979
+ let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
2963
2980
  let resetsAt;
2964
2981
  if (quota?.exhausted) {
2965
2982
  message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
@@ -2968,7 +2985,8 @@ async function fetchCodeAssist(plan, options) {
2968
2985
  }
2969
2986
  throw new ProviderError("gemini", message, {
2970
2987
  statusCode: response.status,
2971
- ...resetsAt !== void 0 ? { resetsAt } : {}
2988
+ ...resetsAt !== void 0 ? { resetsAt } : {},
2989
+ ...accountGated ? { hint: accountGatedHint() } : {}
2972
2990
  });
2973
2991
  }
2974
2992
  return response;