blun-king-cli 9.1.222 → 9.1.223
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/blun.mjs +10 -4
- package/package.json +1 -1
package/blun.mjs
CHANGED
|
@@ -30305,10 +30305,7 @@ async function chatWithRetry(input) {
|
|
|
30305
30305
|
logRequestFailure(input, terminal, attempt, maxAttempts);
|
|
30306
30306
|
throw terminal;
|
|
30307
30307
|
}
|
|
30308
|
-
completionBudgetRetry = error
|
|
30309
|
-
minimumCompletionTokens: MIN_THINKING_COMPLETION_TOKENS,
|
|
30310
|
-
multiplier: 2
|
|
30311
|
-
} : void 0;
|
|
30308
|
+
completionBudgetRetry = completionBudgetRetryForEmpty(error);
|
|
30312
30309
|
emptyRetryKind = error.emptyResponseKind;
|
|
30313
30310
|
input.params.signal.throwIfAborted();
|
|
30314
30311
|
input.dispatchEvent({
|
|
@@ -30344,6 +30341,15 @@ async function chatWithRetry(input) {
|
|
|
30344
30341
|
await sleepForRetry(delayMs, input.params.signal);
|
|
30345
30342
|
}
|
|
30346
30343
|
}
|
|
30344
|
+
function completionBudgetRetryForEmpty(error) {
|
|
30345
|
+
if (error.emptyResponseKind !== "length") return;
|
|
30346
|
+
const exhaustedBudget = typeof error.completionTokens === "number" && typeof error.maxCompletionTokens === "number" && error.maxCompletionTokens > 0 && error.completionTokens >= error.maxCompletionTokens;
|
|
30347
|
+
const negligibleReasoning = error.reasoningLength < 64;
|
|
30348
|
+
return {
|
|
30349
|
+
minimumCompletionTokens: MIN_THINKING_COMPLETION_TOKENS,
|
|
30350
|
+
multiplier: exhaustedBudget && negligibleReasoning ? .125 : 2
|
|
30351
|
+
};
|
|
30352
|
+
}
|
|
30347
30353
|
function retryDelayForError(error, fallbackDelayMs) {
|
|
30348
30354
|
if (!(error instanceof APIProviderRateLimitError) || error.retryAfterMs === null) return fallbackDelayMs;
|
|
30349
30355
|
return Math.max(fallbackDelayMs, error.retryAfterMs);
|