blun-king-cli 9.1.222 → 9.1.224
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 +15 -5
- 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);
|
|
@@ -261009,6 +261015,10 @@ function blunThinkingIntentInput(input) {
|
|
|
261009
261015
|
function blunTurnHasAttachment(input) {
|
|
261010
261016
|
return input.some((part) => part.type !== "text") || BLUN_ATTACHMENT_MARKER_RE.test(blunExtractText(input));
|
|
261011
261017
|
}
|
|
261018
|
+
function blunTurnNeedsInitialMcp(input, origin) {
|
|
261019
|
+
if (blunTurnNeedsTools(input, origin)) return true;
|
|
261020
|
+
return BLUN_TELEGRAM_CHANNEL_RE.test(blunExtractText(input)) || blunTurnHasAttachment(input);
|
|
261021
|
+
}
|
|
261012
261022
|
function blunMessageTextChars(message) {
|
|
261013
261023
|
return message.content.reduce((total, part) => total + (part.type === "text" ? part.text.length : 0), 0);
|
|
261014
261024
|
}
|
|
@@ -261906,7 +261916,7 @@ var init_turn = __esmMin((() => {
|
|
|
261906
261916
|
let stopHookContinuationUsed = false;
|
|
261907
261917
|
let goalOutcomeMessageContinuationUsed = false;
|
|
261908
261918
|
const deduper = new ToolCallDeduplicator({ telemetry: this.agent.telemetry });
|
|
261909
|
-
await this.agent.mcp?.waitForInitialLoad(signal);
|
|
261919
|
+
if (blunTurnNeedsInitialMcp(input, origin)) await this.agent.mcp?.waitForInitialLoad(signal);
|
|
261910
261920
|
const personalMemoryRecall = await this.agent.injection.injectPersonalMemoryForTurn(turnId, input, origin, signal);
|
|
261911
261921
|
await this.agent.injection.injectGoal();
|
|
261912
261922
|
this.setActiveSteerAcceptance(turnId, true);
|