blun-king-cli 9.1.586 → 9.1.587
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/CHANGELOG.md +7 -0
- package/bin/context-performance-policy.cjs +5 -1
- package/bin/thinking-only-guard.cjs +1 -0
- package/blun.mjs +51 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 9.1.587 - 2026-09-10
|
|
2
|
+
|
|
3
|
+
- Preserve the active tool catalog across buffered instructions and the following work step. Required tools remain available; retained optional schemas are reselected when the existing schema budget is exceeded.
|
|
4
|
+
- Restore earlier automatic context compaction and allow another automatic compaction in the same turn after a successful shrinking summary. Smaller model limits and failure limits remain in force.
|
|
5
|
+
- After a thinking-only timeout, use the existing single recovery attempt with thinking disabled so the model can answer or call a tool. Subsequent ordinary steps retain the chosen thinking setting; cancellation, approval checks and timeout bounds remain in force.
|
|
6
|
+
- Set BLUN_STABLE_STEER_TOOLS=0 or BLUN_EARLY_COMPACTION=0 before starting King to restore the previous behavior for the respective feature. No existing sessions or configuration files are rewritten by this update.
|
|
7
|
+
|
|
1
8
|
## 9.1.586 - 2026-09-09
|
|
2
9
|
|
|
3
10
|
- Fix Telegram receiver startup on Windows when an old bridge PID has been reused by an unrelated process. Preserve uncertain process ownership and never stop that unrelated process.
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
const DEFAULT_COMPACTION_TRIGGER_MAX_TOKENS = 256_000;
|
|
4
4
|
const DEFAULT_COMPACTION_BLOCK_MAX_TOKENS = 288_000;
|
|
5
5
|
|
|
6
|
-
function capCompactionThreshold(threshold,
|
|
6
|
+
function capCompactionThreshold(threshold, phase) {
|
|
7
7
|
if (threshold === undefined) return undefined;
|
|
8
|
+
if (process.env.BLUN_EARLY_COMPACTION !== "0") {
|
|
9
|
+
if (phase === "trigger") return Math.min(threshold, DEFAULT_COMPACTION_TRIGGER_MAX_TOKENS);
|
|
10
|
+
if (phase === "block") return Math.min(threshold, DEFAULT_COMPACTION_BLOCK_MAX_TOKENS);
|
|
11
|
+
}
|
|
8
12
|
return threshold;
|
|
9
13
|
}
|
|
10
14
|
|
package/blun.mjs
CHANGED
|
@@ -75058,7 +75058,8 @@ var init_kosong_llm = __esmMin((() => {
|
|
|
75058
75058
|
this.notifyMediaDropped(dropped);
|
|
75059
75059
|
});
|
|
75060
75060
|
completionBudget = this.describeRequest(outgoingMessages, tools, params.completionBudgetRetry).details;
|
|
75061
|
-
|
|
75061
|
+
const requestProvider = params.thinkingOnlyRecovery === true ? completionBudget.provider.withThinking("off") : completionBudget.provider;
|
|
75062
|
+
result = await this.generate(requestProvider, this.systemPrompt, tools, outgoingMessages, callbacks, options);
|
|
75062
75063
|
} catch (error) {
|
|
75063
75064
|
if (error instanceof APIEmptyResponseError) throw error.withMetadata({ maxCompletionTokens: completionBudget === void 0 ? null : completionBudget.maxCompletionTokens ?? null });
|
|
75064
75065
|
if (error instanceof APIPaymentRequiredError) {
|
|
@@ -75843,6 +75844,8 @@ var init_full = __esmMin((() => {
|
|
|
75843
75844
|
}
|
|
75844
75845
|
markCompleted() {
|
|
75845
75846
|
this.agent.records.logRecord({ type: "full_compaction.complete" });
|
|
75847
|
+
const completedTransaction = this.compacting?.transaction;
|
|
75848
|
+
if (process.env.BLUN_EARLY_COMPACTION !== "0" && completedTransaction?.state === "summarized" && completedTransaction.tokensAfter < completedTransaction.tokensBefore) this.compactionCountInTurn = 0;
|
|
75846
75849
|
this.closeTransaction("success");
|
|
75847
75850
|
this.compacting = null;
|
|
75848
75851
|
this.sessionCompactionState = resetCompactionFailures();
|
|
@@ -263255,6 +263258,52 @@ function blunSelectTurnTools(tools, maxContextTokens, loadedToolNames, requiredT
|
|
|
263255
263258
|
deferredToolCount: deferred.length
|
|
263256
263259
|
};
|
|
263257
263260
|
}
|
|
263261
|
+
function blunSelectStableSteerTools(selectedTools, eligibleTools, loadedToolNames, requiredToolNames, maxContextTokens, log) {
|
|
263262
|
+
const selectedNames = new Set(selectedTools.map((tool) => tool.name));
|
|
263263
|
+
const additions = [];
|
|
263264
|
+
for (const tool of eligibleTools) {
|
|
263265
|
+
if (!requiredToolNames.has(tool.name) || selectedNames.has(tool.name)) continue;
|
|
263266
|
+
additions.push(tool);
|
|
263267
|
+
selectedNames.add(tool.name);
|
|
263268
|
+
}
|
|
263269
|
+
const proposed = [...selectedTools, ...additions];
|
|
263270
|
+
let deferred = eligibleTools.filter((tool) => !selectedNames.has(tool.name));
|
|
263271
|
+
const recoveryLoader = deferred.length > 0 && !selectedNames.has("ToolSearch") ? createDeferredToolLoader(selectedTools, deferred, loadedToolNames) : void 0;
|
|
263272
|
+
if (recoveryLoader) proposed.push(recoveryLoader);
|
|
263273
|
+
const schemaBudgetTokens = toolSchemaBudgetTokens(maxContextTokens);
|
|
263274
|
+
const proposedSchemaTokens = estimateTokensForTools(proposed);
|
|
263275
|
+
// A full-catalog alias must never shrink the eligible catalog itself.
|
|
263276
|
+
const budgetFallback = proposedSchemaTokens > schemaBudgetTokens && selectedTools !== eligibleTools;
|
|
263277
|
+
if (budgetFallback) {
|
|
263278
|
+
const selection = blunSelectTurnTools(eligibleTools, maxContextTokens, loadedToolNames, requiredToolNames);
|
|
263279
|
+
selectedTools.length = 0;
|
|
263280
|
+
for (const tool of selection.tools) if (tool.name !== "ToolSearch") selectedTools.push(tool);
|
|
263281
|
+
const retainedNames = new Set(selectedTools.map((tool) => tool.name));
|
|
263282
|
+
deferred = eligibleTools.filter((tool) => !retainedNames.has(tool.name));
|
|
263283
|
+
// Rebind discovery to the shared array, including former residents.
|
|
263284
|
+
if (deferred.length > 0) selectedTools.push(createDeferredToolLoader(selectedTools, deferred, loadedToolNames));
|
|
263285
|
+
} else {
|
|
263286
|
+
for (const tool of additions) selectedTools.push(tool);
|
|
263287
|
+
if (recoveryLoader) selectedTools.push(recoveryLoader);
|
|
263288
|
+
}
|
|
263289
|
+
const schemaTokenEstimate = estimateTokensForTools(selectedTools);
|
|
263290
|
+
const schemaBudgetExceeded = schemaTokenEstimate > schemaBudgetTokens;
|
|
263291
|
+
if (budgetFallback || schemaBudgetExceeded) log?.info("stable steer budget fallback", {
|
|
263292
|
+
budgetFallback,
|
|
263293
|
+
proposedSchemaTokens,
|
|
263294
|
+
schemaTokenEstimate,
|
|
263295
|
+
schemaBudgetTokens,
|
|
263296
|
+
schemaBudgetExceeded
|
|
263297
|
+
});
|
|
263298
|
+
return {
|
|
263299
|
+
tools: selectedTools,
|
|
263300
|
+
deferredToolCount: deferred.length,
|
|
263301
|
+
budgetFallback,
|
|
263302
|
+
schemaTokenEstimate,
|
|
263303
|
+
schemaBudgetTokens,
|
|
263304
|
+
schemaBudgetExceeded
|
|
263305
|
+
};
|
|
263306
|
+
}
|
|
263258
263307
|
function blunToolSuppressionReason(turnNeedsTools, eligibleTools, deferredToolCount, fastConversation) {
|
|
263259
263308
|
if (fastConversation) return "fast_conversation";
|
|
263260
263309
|
if (!turnNeedsTools) return "greeting_optimization";
|
|
@@ -264496,7 +264545,7 @@ var init_turn = __esmMin((() => {
|
|
|
264496
264545
|
const steerRequiredToolNames = mediaToolNamesForTurnText(steerText);
|
|
264497
264546
|
for (const name of rankedToolNamesForTurnText(eligibleTools, steerText)) steerRequiredToolNames.add(name);
|
|
264498
264547
|
if (steerEfforts.some((effort) => effort === void 0)) {
|
|
264499
|
-
const prioritizedSelection = blunSelectTurnTools(eligibleTools, this.agent.config.modelCapabilities?.max_context_tokens, this.loadedToolNames, steerRequiredToolNames);
|
|
264548
|
+
const prioritizedSelection = process.env.BLUN_STABLE_STEER_TOOLS !== "0" ? blunSelectStableSteerTools(selectedTools, eligibleTools, this.loadedToolNames, steerRequiredToolNames, this.agent.config.modelCapabilities?.max_context_tokens, this.agent.log) : blunSelectTurnTools(eligibleTools, this.agent.config.modelCapabilities?.max_context_tokens, this.loadedToolNames, steerRequiredToolNames);
|
|
264500
264549
|
this.agent.context.appendSystemReminder(ACTIVE_STEER_PRIORITY_REMINDER, {
|
|
264501
264550
|
kind: "injection",
|
|
264502
264551
|
variant: "active_steer_priority"
|