@prestyj/ai 5.3.1 → 5.4.1
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 +55 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +55 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -172,7 +172,7 @@ function formatError(err) {
|
|
|
172
172
|
provider: err.provider,
|
|
173
173
|
statusCode: err.statusCode,
|
|
174
174
|
...err.requestId ? { requestId: err.requestId } : {},
|
|
175
|
-
guidance: "Request access via your Anthropic account team (see platform.claude.com/docs/en/about-claude/models/overview), or switch to
|
|
175
|
+
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."
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
if (isUsageLimitError(err)) {
|
|
@@ -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
|
|
217
|
+
guidance: hint ?? "Check your internet connection. Not a EZ Coder issue \u2014 retry shortly.",
|
|
218
218
|
...requestId ? { requestId } : {}
|
|
219
219
|
};
|
|
220
220
|
case "auth":
|
|
@@ -222,7 +222,7 @@ function finaliseBySource(source, message, requestId, hint) {
|
|
|
222
222
|
headline: "Authentication issue.",
|
|
223
223
|
source,
|
|
224
224
|
message,
|
|
225
|
-
guidance: hint ?? "
|
|
225
|
+
guidance: hint ?? "Re-authenticate to refresh your credentials.",
|
|
226
226
|
...requestId ? { requestId } : {}
|
|
227
227
|
};
|
|
228
228
|
case "provider":
|
|
@@ -238,15 +238,15 @@ function finaliseBySource(source, message, requestId, hint) {
|
|
|
238
238
|
headline: message,
|
|
239
239
|
source,
|
|
240
240
|
message: "",
|
|
241
|
-
guidance: hint ?? "Only Kimi, Gemini, MiniMax, and MiMo-V2.5 can analyze video. Switch
|
|
241
|
+
guidance: hint ?? "Only Kimi, Gemini, MiniMax, and MiMo-V2.5 can analyze video. Switch to one of those via the model selector.",
|
|
242
242
|
...requestId ? { requestId } : {}
|
|
243
243
|
};
|
|
244
244
|
case "ezcoder":
|
|
245
245
|
return {
|
|
246
|
-
headline: "
|
|
246
|
+
headline: "EZ Coder hit an unexpected error.",
|
|
247
247
|
source,
|
|
248
248
|
message,
|
|
249
|
-
guidance: hint ?? "This looks like a
|
|
249
|
+
guidance: hint ?? "This looks like a EZ Coder bug \u2014 please report it to the developer (see /help).",
|
|
250
250
|
...requestId ? { requestId } : {}
|
|
251
251
|
};
|
|
252
252
|
}
|
|
@@ -277,36 +277,39 @@ function providerGuidance(provider, message, statusCode) {
|
|
|
277
277
|
const status = provider ? PROVIDER_STATUS_URL[provider] : void 0;
|
|
278
278
|
const lower = message.toLowerCase();
|
|
279
279
|
if (statusCode === 401 || lower.includes("unauthorized") || lower.includes("invalid api key")) {
|
|
280
|
-
return `Authentication failed with ${name}.
|
|
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
|
|
283
|
+
return `${name}'s servers are overloaded right now. Retry in a moment \u2014 not a EZ 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
|
|
286
|
+
return `Your ${name} account has a billing or quota issue \u2014 check your balance. Not a EZ 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
|
|
289
|
+
return `${name} rate limit hit. Wait a moment then retry \u2014 not a EZ 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
|
|
292
|
+
return `${name} returned a bad gateway. Retry \u2014 this is on their side, not EZ Coder.`;
|
|
293
293
|
}
|
|
294
294
|
if (statusCode === 503 || lower.includes("service unavailable")) {
|
|
295
|
-
return `${name} is temporarily unavailable. Retry shortly \u2014 not a
|
|
295
|
+
return `${name} is temporarily unavailable. Retry shortly \u2014 not a EZ 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
|
|
298
|
+
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.`;
|
|
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
|
|
301
|
+
return `Request to ${name} timed out. Their servers may be slow \u2014 retry. Not a EZ 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
|
-
return `${name} doesn't recognise this model on your account.
|
|
304
|
+
return `${name} doesn't recognise this model on your account. Switch to a different model via the model selector, or check your subscription tier.`;
|
|
305
305
|
}
|
|
306
306
|
if (lower.includes("context_length_exceeded") || lower.includes("prompt is too long")) {
|
|
307
|
-
return `Context window for this ${name} model is full.
|
|
307
|
+
return `Context window for this ${name} model is full. Compact the conversation to shrink history, or start a new session.`;
|
|
308
308
|
}
|
|
309
|
-
|
|
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. Compact the conversation to shrink history, or start a new session.`;
|
|
311
|
+
}
|
|
312
|
+
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.`;
|
|
310
313
|
}
|
|
311
314
|
|
|
312
315
|
// src/providers/anthropic.ts
|
|
@@ -2187,6 +2190,10 @@ function extractRequestIdFromMessage(message) {
|
|
|
2187
2190
|
|
|
2188
2191
|
// src/providers/openai-codex.ts
|
|
2189
2192
|
var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
|
|
2193
|
+
var CODEX_CLIENT_VERSION = "0.144.1";
|
|
2194
|
+
function usesResponsesLite(model) {
|
|
2195
|
+
return model.startsWith("gpt-5.6-");
|
|
2196
|
+
}
|
|
2190
2197
|
function outputTextKey(itemId, contentIndex) {
|
|
2191
2198
|
return `${itemId ?? ""}:${contentIndex ?? 0}`;
|
|
2192
2199
|
}
|
|
@@ -2202,6 +2209,7 @@ async function* runStream3(options) {
|
|
|
2202
2209
|
const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
|
|
2203
2210
|
const downgraded = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
|
|
2204
2211
|
const { system, input } = toCodexInput(downgraded, { supportsImages: options.supportsImages });
|
|
2212
|
+
const responsesLite = usesResponsesLite(options.model);
|
|
2205
2213
|
const body = {
|
|
2206
2214
|
model: options.model,
|
|
2207
2215
|
store: false,
|
|
@@ -2209,7 +2217,7 @@ async function* runStream3(options) {
|
|
|
2209
2217
|
instructions: system,
|
|
2210
2218
|
input,
|
|
2211
2219
|
tool_choice: "auto",
|
|
2212
|
-
parallel_tool_calls:
|
|
2220
|
+
parallel_tool_calls: !responsesLite,
|
|
2213
2221
|
include: ["reasoning.encrypted_content"]
|
|
2214
2222
|
};
|
|
2215
2223
|
if (options.tools?.length) {
|
|
@@ -2221,15 +2229,20 @@ async function* runStream3(options) {
|
|
|
2221
2229
|
}
|
|
2222
2230
|
body.reasoning = {
|
|
2223
2231
|
effort: options.thinking ?? "none",
|
|
2224
|
-
summary: "auto"
|
|
2232
|
+
summary: "auto",
|
|
2233
|
+
...responsesLite ? { context: "all_turns" } : {}
|
|
2225
2234
|
};
|
|
2226
2235
|
const headers = {
|
|
2227
2236
|
"Content-Type": "application/json",
|
|
2228
2237
|
Accept: "text/event-stream",
|
|
2229
2238
|
Authorization: `Bearer ${options.apiKey}`,
|
|
2230
2239
|
"OpenAI-Beta": "responses=experimental",
|
|
2231
|
-
originator: "ezcoder",
|
|
2232
|
-
"User-Agent": `ezcoder (${import_node_os.default.platform()} ${import_node_os.default.release()}; ${import_node_os.default.arch()})
|
|
2240
|
+
originator: responsesLite ? "codex_cli_rs" : "ezcoder",
|
|
2241
|
+
"User-Agent": responsesLite ? `codex_cli_rs/${CODEX_CLIENT_VERSION}` : `ezcoder (${import_node_os.default.platform()} ${import_node_os.default.release()}; ${import_node_os.default.arch()})`,
|
|
2242
|
+
...responsesLite ? {
|
|
2243
|
+
version: CODEX_CLIENT_VERSION,
|
|
2244
|
+
"X-OpenAI-Internal-Codex-Responses-Lite": "true"
|
|
2245
|
+
} : {}
|
|
2233
2246
|
};
|
|
2234
2247
|
if (options.accountId) {
|
|
2235
2248
|
headers["chatgpt-account-id"] = options.accountId;
|
|
@@ -2257,10 +2270,10 @@ async function* runStream3(options) {
|
|
|
2257
2270
|
if (options.model === "gpt-5.5-pro") {
|
|
2258
2271
|
hint = "Use gpt-5.5 instead. OpenAI's Codex model catalog does not list gpt-5.5-pro.";
|
|
2259
2272
|
} else {
|
|
2260
|
-
hint = "This model is not available through Codex for the authenticated account.
|
|
2273
|
+
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.";
|
|
2261
2274
|
}
|
|
2262
2275
|
} else if (response.status === 404 && text.includes("does not exist")) {
|
|
2263
|
-
hint = "This model is not in the current OpenAI Codex catalog for this account.
|
|
2276
|
+
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.";
|
|
2264
2277
|
}
|
|
2265
2278
|
throw new ProviderError("openai", message, {
|
|
2266
2279
|
statusCode: response.status,
|
|
@@ -2684,10 +2697,11 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
|
|
|
2684
2697
|
"gemini-3.1-pro-preview",
|
|
2685
2698
|
"gemini-3.1-pro-preview-customtools",
|
|
2686
2699
|
"gemini-3-flash-preview",
|
|
2687
|
-
"gemini-3.
|
|
2700
|
+
"gemini-3.5-flash",
|
|
2701
|
+
"gemini-3-flash",
|
|
2702
|
+
"gemini-3.1-flash-lite",
|
|
2688
2703
|
"gemini-2.5-pro",
|
|
2689
2704
|
"gemini-2.5-flash",
|
|
2690
|
-
"gemini-2.5-flash-lite",
|
|
2691
2705
|
"gemma-4-31b-it",
|
|
2692
2706
|
"gemma-4-26b-a4b-it"
|
|
2693
2707
|
]);
|
|
@@ -2704,6 +2718,18 @@ function getCodeAssistEndpoint(method) {
|
|
|
2704
2718
|
function formatUnsupportedModelMessage(model) {
|
|
2705
2719
|
return `Gemini OAuth is configured to use the Gemini Code Assist subscription endpoint only. That endpoint does not currently expose model "${model}".`;
|
|
2706
2720
|
}
|
|
2721
|
+
var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
|
|
2722
|
+
"gemini-3-flash",
|
|
2723
|
+
"gemini-3.5-flash",
|
|
2724
|
+
"gemini-3.1-pro-preview",
|
|
2725
|
+
"gemini-3.1-pro-preview-customtools"
|
|
2726
|
+
]);
|
|
2727
|
+
function accountGatedMessage(model) {
|
|
2728
|
+
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.`;
|
|
2729
|
+
}
|
|
2730
|
+
function accountGatedHint() {
|
|
2731
|
+
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.`;
|
|
2732
|
+
}
|
|
2707
2733
|
function formatErrorMessage(status, body, model) {
|
|
2708
2734
|
if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
|
|
2709
2735
|
return `Gemini API error (404): ${body}
|
|
@@ -3014,7 +3040,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
3014
3040
|
if (!response.ok) {
|
|
3015
3041
|
const text = await response.text().catch(() => "");
|
|
3016
3042
|
const quota = parseGeminiQuota(response.status, text);
|
|
3017
|
-
|
|
3043
|
+
const accountGated = response.status === 404 && ACCOUNT_GATED_MODELS.has(options.model);
|
|
3044
|
+
let message = accountGated ? accountGatedMessage(options.model) : formatErrorMessage(response.status, text, options.model);
|
|
3018
3045
|
let resetsAt;
|
|
3019
3046
|
if (quota?.exhausted) {
|
|
3020
3047
|
message = `Gemini quota exhausted \u2014 usage limit reached. ${message}`;
|
|
@@ -3023,7 +3050,8 @@ async function fetchCodeAssist(plan, options) {
|
|
|
3023
3050
|
}
|
|
3024
3051
|
throw new ProviderError("gemini", message, {
|
|
3025
3052
|
statusCode: response.status,
|
|
3026
|
-
...resetsAt !== void 0 ? { resetsAt } : {}
|
|
3053
|
+
...resetsAt !== void 0 ? { resetsAt } : {},
|
|
3054
|
+
...accountGated ? { hint: accountGatedHint() } : {}
|
|
3027
3055
|
});
|
|
3028
3056
|
}
|
|
3029
3057
|
return response;
|