@kenkaiiii/gg-ai 5.60.0 → 5.60.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 +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2579,7 +2579,7 @@ function toCodexToolChoice(choice, tools) {
|
|
|
2579
2579
|
function streamOpenAICodex(options) {
|
|
2580
2580
|
return new StreamResult(runStream3(options), options.signal);
|
|
2581
2581
|
}
|
|
2582
|
-
async function* runStream3(options) {
|
|
2582
|
+
async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
2583
2583
|
const baseUrl = (options.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
2584
2584
|
const url = `${baseUrl}/codex/responses`;
|
|
2585
2585
|
const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
|
|
@@ -2649,6 +2649,20 @@ async function* runStream3(options) {
|
|
|
2649
2649
|
const parsed = parseCodexErrorBody(text, response.status);
|
|
2650
2650
|
const message = parsed.message ?? `Codex API returned HTTP ${response.status}.`;
|
|
2651
2651
|
const requestId = parsed.requestId ?? readHeader(response.headers, "x-request-id", "openai-request-id", "x-oai-request-id");
|
|
2652
|
+
if (!retriedWithoutReasoning && !options.signal?.aborted && response.status === 400 && (parsed.errorObj?.code === "invalid_encrypted_content" || /encrypted content.*could not be (?:verified|decrypted|parsed)/i.test(message)) && options.messages.some(
|
|
2653
|
+
(msg) => msg.role === "assistant" && Array.isArray(msg.content) && msg.content.some((part) => part.type === "raw" && isEncryptedReasoning(part.data))
|
|
2654
|
+
)) {
|
|
2655
|
+
providerDiag("codex_retry_without_encrypted_reasoning", { status: response.status });
|
|
2656
|
+
const messages = options.messages.map(
|
|
2657
|
+
(msg) => msg.role === "assistant" && Array.isArray(msg.content) ? {
|
|
2658
|
+
...msg,
|
|
2659
|
+
content: msg.content.filter(
|
|
2660
|
+
(part) => !(part.type === "raw" && isEncryptedReasoning(part.data))
|
|
2661
|
+
)
|
|
2662
|
+
} : msg
|
|
2663
|
+
);
|
|
2664
|
+
return yield* runStream3({ ...options, messages }, true);
|
|
2665
|
+
}
|
|
2652
2666
|
const usageLimit = codexUsageLimitError(parsed.errorObj, response.status, requestId);
|
|
2653
2667
|
if (usageLimit) throw usageLimit;
|
|
2654
2668
|
let hint;
|