blun-king-cli 9.1.97 → 9.1.98

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/LIESMICH.txt CHANGED
@@ -9,7 +9,7 @@ Installation
9
9
  ------------
10
10
  Die geprüfte Version exakt global installieren:
11
11
 
12
- npm install -g blun-king-cli@9.1.97
12
+ npm install -g blun-king-cli@9.1.98
13
13
 
14
14
  Start
15
15
  -----
@@ -85,6 +85,8 @@ King bewahrt den vollständigen Verlauf weiterhin im Sitzungs-Wire auf. Erreicht
85
85
 
86
86
  Dabei werden keine gespeicherten Nachrichten geändert oder gelöscht. Fortsetzen, Exportieren und die sichtbare Historie behalten die ursprünglichen Werkzeugergebnisse und Werkzeugargumente. Das Telemetrieereignis `micro_compaction_finished` nennt den Auslöser, den Schnitt und die geschätzte Tokenzahl vor und nach der Entlastung. Außerdem zählt es getrennt, wie viele Werkzeugergebnisse und Werkzeugargumente entlastet wurden. Der Sitzungsinspektor summiert zusätzlich die eingesparten Argument-Token, ohne Inhalte offenzulegen. Beispiel: Ein früherer `Write`-Aufruf mit einem vollständigen Dateiinhalt bleibt im Wire erhalten; die Modellprojektion trägt nur noch einen Platzhalter, sobald für diesen `Write`-Aufruf ein zugehöriges Ergebnis vorliegt.
87
87
 
88
+ Ab BLUN King 9.1.98 kann King einen abgeschlossenen Arbeitsabschnitt verdichten, bevor die harte automatische Grenze erreicht ist. Unterhalb der halben Vollverdichtungsgrenze bleibt `CompactConversation` vollständig aus dem Modellprompt. Ab 128.000 geschätzten Token im Standardmodellfenster wird es für den nächsten Modellschritt verfügbar. Die Verdichtung beginnt erst nach Abschluss des aktuellen Werkzeugschritts, öffnet keinen konkurrierenden Zug und lässt den ursprünglichen Verlauf bei einem Fehlschlag unverändert.
89
+
88
90
  ## Große Werkzeugausgaben und isolierte Teilagenten
89
91
 
90
92
  Große textbasierte Werkzeugergebnisse bleiben nicht mehr vollständig im Modellkontext. Ab 12.001 Zeichen speichert BLUN King das vollständige Ergebnis in einer privaten Datei im Sitzungsordner `tool-results`. Im Modellkontext verbleiben die ersten 1.000 und die letzten 1.000 Zeichen, die genaue Zahl der ausgelassenen Zeichen und der `output_path`. Der Agent kann das vollständige Ergebnis anschließend mit `Read` seitenweise über diesen Pfad lesen. Ergebnisse bis einschließlich 12.000 Zeichen, gemischte Medienergebnisse und bereits gekürzte Ergebnisse bleiben unverändert. Auch eine spätere Mikroverdichtung bewahrt den Dateiverweis. Beispiel: Bei einem Suchergebnis mit 30.000 Zeichen sehen folgende Modellanfragen den Anfang und das abschließende Ergebnis oder den Fehler; der vollständige Text bleibt lokal verfügbar.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Voraussetzung ist Node.js 24.15 oder neuer. Die geprüfte Version wird exakt
9
9
  installiert:
10
10
 
11
11
  ```powershell
12
- npm install -g blun-king-cli@9.1.97
12
+ npm install -g blun-king-cli@9.1.98
13
13
  ```
14
14
 
15
15
  ## Reproduzierbares Staging und Packen
@@ -105,6 +105,8 @@ King bewahrt den vollständigen Verlauf weiterhin im Sitzungs-Wire auf. Bei 75 P
105
105
 
106
106
  Dabei werden keine gespeicherten Nachrichten geändert oder gelöscht. Fortsetzen, Exportieren und die sichtbare Historie behalten die ursprünglichen Werkzeugergebnisse und Werkzeugargumente. Das Telemetrieereignis `micro_compaction_finished` nennt den Auslöser, den Schnitt, die verwendete Druckgrenze, das Modellfenster und die geschätzte Tokenzahl vor und nach der Entlastung. Außerdem zählt es getrennt, wie viele Werkzeugergebnisse und Werkzeugargumente entlastet wurden. Der Sitzungsinspektor summiert zusätzlich die eingesparten Argument-Token, ohne Inhalte offenzulegen. Beispiel: Ein früherer `Write`-Aufruf mit einem vollständigen Dateiinhalt bleibt im Wire erhalten; die Modellprojektion trägt nur noch einen Platzhalter, sobald für diesen `Write`-Aufruf ein zugehöriges Ergebnis vorliegt.
107
107
 
108
+ Ab BLUN King 9.1.98 kann King einen abgeschlossenen Arbeitsabschnitt verdichten, bevor die harte automatische Grenze erreicht ist. Unterhalb der halben Vollverdichtungsgrenze bleibt `CompactConversation` vollständig aus dem Modellprompt. Ab 128.000 geschätzten Token im Standardmodellfenster wird es für den nächsten Modellschritt verfügbar. Die Verdichtung beginnt erst nach Abschluss des aktuellen Werkzeugschritts, öffnet keinen konkurrierenden Zug und lässt den ursprünglichen Verlauf bei einem Fehlschlag unverändert.
109
+
108
110
  ## Große Werkzeugausgaben und isolierte Teilagenten
109
111
 
110
112
  Große textbasierte Werkzeugergebnisse bleiben nicht mehr vollständig im Modellkontext. Ab 12.001 Zeichen speichert BLUN King das vollständige Ergebnis in einer privaten Datei im Sitzungsordner `tool-results`. Im Modellkontext verbleiben die ersten 1.000 und die letzten 1.000 Zeichen, die genaue Zahl der ausgelassenen Zeichen und der `output_path`. Der Agent kann das vollständige Ergebnis anschließend mit `Read` seitenweise über diesen Pfad lesen. Ergebnisse bis einschließlich 12.000 Zeichen, gemischte Medienergebnisse und bereits gekürzte Ergebnisse bleiben unverändert. Auch eine spätere Mikroverdichtung bewahrt den Dateiverweis. Beispiel: Bei einem Suchergebnis mit 30.000 Zeichen sehen folgende Modellanfragen den Anfang und das abschließende Ergebnis oder den Fehler; der vollständige Text bleibt lokal verfügbar.
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const PROACTIVE_COMPACTION_TRIGGER_FRACTION = 0.5;
4
+
5
+ function proactiveCompactionEligibility({ usedTokens, budgetTokens, hasShrinkableHistory, isCompacting }) {
6
+ const budget = Number(budgetTokens);
7
+ const thresholdTokens = Number.isFinite(budget) && budget > 0
8
+ ? Math.max(1, Math.floor(budget * PROACTIVE_COMPACTION_TRIGGER_FRACTION))
9
+ : undefined;
10
+
11
+ if (isCompacting === true) return { eligible: false, thresholdTokens, reason: 'already_compacting' };
12
+ if (thresholdTokens === undefined) return { eligible: false, thresholdTokens, reason: 'no_budget' };
13
+ if (!Number.isFinite(usedTokens) || usedTokens < thresholdTokens) {
14
+ return { eligible: false, thresholdTokens, reason: 'below_threshold' };
15
+ }
16
+ if (hasShrinkableHistory !== true) {
17
+ return { eligible: false, thresholdTokens, reason: 'nothing_to_compact' };
18
+ }
19
+ return { eligible: true, thresholdTokens, reason: 'eligible' };
20
+ }
21
+
22
+ module.exports = {
23
+ PROACTIVE_COMPACTION_TRIGGER_FRACTION,
24
+ proactiveCompactionEligibility,
25
+ };
@@ -10,6 +10,7 @@ const CORE_TOOL_NAMES = Object.freeze([
10
10
  'Grep',
11
11
  'Write',
12
12
  'TodoList',
13
+ 'CompactConversation',
13
14
  'Glob',
14
15
  'TaskList',
15
16
  'Agent',
package/blun.mjs CHANGED
@@ -28485,6 +28485,7 @@ var init_load = __esmMin((() => {
28485
28485
  var agent_default$1;
28486
28486
  var init_agent$3 = __esmMin((() => {
28487
28487
  agent_default$1 = "name: agent\ndescription: Default BLUN King agent\n\nsystemPromptPath: ./system.md\npromptVars:\n roleAdditional: ''\n\ntools:\n - Read\n - Write\n - Edit\n - Grep\n - Glob\n - Bash\n - TaskList\n - TaskOutput\n - TaskStop\n - CronCreate\n - CronList\n - CronDelete\n - ReadMediaFile\n - TodoList\n - Skill\n - WebSearch\n - Agent\n - AgentSwarm\n - FetchURL\n - GenerateImage\n - GenerateVideo\n - GenerateSpeech\n - GetMedia\n - AskUserQuestion\n - MistakeRecord\n - CodebaseSearch\n - EnterPlanMode\n - ExitPlanMode\n - CreateGoal\n - GetGoal\n - SetGoalBudget\n - UpdateGoal\n - mcp__*\n\nsubagents:\n coder:\n description: General software engineering agent — the only subagent type with file-editing tools; use it for any delegated task that must modify code.\n explore:\n description: Fast codebase exploration with prompt-enforced read-only behavior.\n plan:\n description: Read-only implementation planning and architecture design.\n";
28488
+ agent_default$1 = agent_default$1.replace(" - TodoList\n", " - TodoList\n - CompactConversation\n");
28488
28489
  }));
28489
28490
  //#endregion
28490
28491
  //#region ../../packages/agent-core/src/profile/default/coder.yaml?raw
@@ -75241,10 +75242,11 @@ function extractCompactionSummary(response) {
75241
75242
  if (summary.trim().length === 0) throw new APIEmptyResponseError("The compaction response did not contain a non-empty summary.");
75242
75243
  return summary;
75243
75244
  }
75244
- var archiveCompactionHistory, buildCompactionArchiveNotice, capCompactionStageTarget, DEFAULT_COMPACTION_MAX_COMPLETION_TOKENS, COMPACTION_THINKING_EFFORT, COMPACTION_SUMMARY_RESERVE_RATIO, MAX_HIERARCHICAL_COMPACTION_PASSES, HIERARCHICAL_COMPACTION_PREFIX, CompactionTruncatedError, CompactionStallError, COMPACTION_STALL_MEASUREMENT_MULTIPLIER, REBUILT_AFTER_COMPACTION_INJECTION_VARIANTS, FullCompaction, MAX_COMPACTION_OVERFLOW_SHRINK_ATTEMPTS, COMPACTION_OVERFLOW_SHRINK_RATIOS;
75245
+ var archiveCompactionHistory, buildCompactionArchiveNotice, capCompactionStageTarget, proactiveCompactionEligibility, DEFAULT_COMPACTION_MAX_COMPLETION_TOKENS, COMPACTION_THINKING_EFFORT, COMPACTION_SUMMARY_RESERVE_RATIO, MAX_HIERARCHICAL_COMPACTION_PASSES, HIERARCHICAL_COMPACTION_PREFIX, CompactionTruncatedError, CompactionStallError, COMPACTION_STALL_MEASUREMENT_MULTIPLIER, REBUILT_AFTER_COMPACTION_INJECTION_VARIANTS, FullCompaction, MAX_COMPACTION_OVERFLOW_SHRINK_ATTEMPTS, COMPACTION_OVERFLOW_SHRINK_RATIOS;
75245
75246
  var init_full = __esmMin((() => {
75246
75247
  ({ archiveCompactionHistory, buildCompactionArchiveNotice } = createRequire(import.meta.url)("./bin/compaction-history-archive.cjs"));
75247
75248
  ({ capCompactionStageTarget } = createRequire(import.meta.url)("./bin/compaction-stage-policy.cjs"));
75249
+ ({ proactiveCompactionEligibility } = createRequire(import.meta.url)("./bin/proactive-compaction-policy.cjs"));
75248
75250
  init_errors$8();
75249
75251
  init_src$4();
75250
75252
  init_errors$4();
@@ -75300,6 +75302,7 @@ var init_full = __esmMin((() => {
75300
75302
  compactionTimingByProviderModel = /* @__PURE__ */ new Map();
75301
75303
  lastCompactedState = null;
75302
75304
  consecutiveOverflowCompactions = 0;
75305
+ proactiveCompactionRequested = false;
75303
75306
  strategy;
75304
75307
  requiresShrinkableHistory;
75305
75308
  constructor(agent, strategy) {
@@ -75329,6 +75332,27 @@ var init_full = __esmMin((() => {
75329
75332
  const budget = this.strategy.compactionBudgetTokens;
75330
75333
  return budget !== void 0 && Number.isFinite(budget) && budget > 0 ? Math.floor(budget) : void 0;
75331
75334
  }
75335
+ proactiveCompactionStatus() {
75336
+ return proactiveCompactionEligibility({
75337
+ usedTokens: this.estimateCurrentRequestTokens(),
75338
+ budgetTokens: this.getCompactionBudgetTokens(),
75339
+ hasShrinkableHistory: this.hasShrinkableHistory(this.agent.context.history),
75340
+ isCompacting: this.isCompacting
75341
+ });
75342
+ }
75343
+ isProactiveCompactionEligible() {
75344
+ return this.proactiveCompactionStatus().eligible;
75345
+ }
75346
+ requestProactiveCompaction() {
75347
+ const status = this.proactiveCompactionStatus();
75348
+ if (!status.eligible) return status;
75349
+ this.proactiveCompactionRequested = true;
75350
+ this.agent.telemetry.track("proactive_compaction_requested", {
75351
+ used_tokens: this.estimateCurrentRequestTokens(),
75352
+ threshold_tokens: status.thresholdTokens
75353
+ });
75354
+ return status;
75355
+ }
75332
75356
  estimateCurrentRequestTokens(context = {}) {
75333
75357
  const estimated = this.estimateProjectedRequestTokens(context);
75334
75358
  return Math.max(this.tokenCountWithPending, estimated);
@@ -75406,6 +75430,7 @@ var init_full = __esmMin((() => {
75406
75430
  this.compactionCountInTurn = 0;
75407
75431
  this.lastCompactedState = null;
75408
75432
  this.consecutiveOverflowCompactions = 0;
75433
+ this.proactiveCompactionRequested = false;
75409
75434
  }
75410
75435
  async handleOverflowError(signal, error) {
75411
75436
  this.consecutiveOverflowCompactions += 1;
@@ -75435,8 +75460,14 @@ var init_full = __esmMin((() => {
75435
75460
  } });
75436
75461
  return compacted;
75437
75462
  }
75438
- async afterStep() {
75463
+ async afterStep(signal) {
75439
75464
  this.consecutiveOverflowCompactions = 0;
75465
+ if (this.proactiveCompactionRequested) {
75466
+ this.proactiveCompactionRequested = false;
75467
+ if (!this.compacting) this.beginAutoCompaction();
75468
+ await this.block(signal);
75469
+ return;
75470
+ }
75440
75471
  if (this.strategy.checkAfterStep) this.checkAutoCompaction(false);
75441
75472
  }
75442
75473
  checkAutoCompaction(throwOnLimit = true, usedSize = this.tokenCountWithPending, messages = this.agent.context.history) {
@@ -260979,7 +261010,9 @@ var init_turn = __esmMin((() => {
260979
261010
  const loopControl = this.agent.blunConfig?.loopControl;
260980
261011
  let stopForGoalBudget = false;
260981
261012
  try {
260982
- const eligibleTools = blunToolsForOrigin(this.agent.injection.filterPersonalMemoryToolsForTurn(turnId, input, origin, this.agent.tools.loopTools), origin);
261013
+ const originTools = blunToolsForOrigin(this.agent.injection.filterPersonalMemoryToolsForTurn(turnId, input, origin, this.agent.tools.loopTools), origin);
261014
+ const compactConversationTool = originTools.find((tool) => tool.name === "CompactConversation");
261015
+ const eligibleTools = originTools.filter((tool) => tool.name !== "CompactConversation" || this.agent.fullCompaction.isProactiveCompactionEligible());
260983
261016
  const toolSelection = fastConversation ? {
260984
261017
  tools: [...blunFastConversationTools(eligibleTools, input, pendingMediaJobIds)],
260985
261018
  deferredToolCount: 0
@@ -261077,7 +261110,8 @@ var init_turn = __esmMin((() => {
261077
261110
  previousStepToolOutcome = currentStepHadTool ? currentStepHadFailure ? "failure" : "success" : "none";
261078
261111
  this.agent.usage.record(this.agent.activeResponderModel ?? model, usage, "turn");
261079
261112
  if (stopForGoalBudget) this.setActiveSteerAcceptance(turnId, false);
261080
- await this.agent.fullCompaction.afterStep();
261113
+ await this.agent.fullCompaction.afterStep(signal);
261114
+ if (compactConversationTool !== void 0 && this.agent.fullCompaction.isProactiveCompactionEligible() && !selectedTools.includes(compactConversationTool)) selectedTools.push(compactConversationTool);
261081
261115
  deduper.endStep();
261082
261116
  return stopForGoalBudget ? { stopTurn: true } : void 0;
261083
261117
  },
@@ -261434,6 +261468,41 @@ var init_update_goal = __esmMin((() => {
261434
261468
  };
261435
261469
  }));
261436
261470
  //#endregion
261471
+ //#region ../../packages/agent-core/src/tools/builtin/compact-conversation.ts
261472
+ var CompactConversationTool;
261473
+ var init_compact_conversation_tool = __esmMin((() => {
261474
+ CompactConversationTool = class {
261475
+ agent;
261476
+ name = "CompactConversation";
261477
+ description = "Compact older conversation messages into a concise continuation summary. Use after finishing a substantial phase, before switching to an unrelated task, or when a long conversation is becoming costly. The tool appears only after the context reaches the safe proactive threshold and takes no arguments.";
261478
+ parameters = {
261479
+ type: "object",
261480
+ properties: {},
261481
+ additionalProperties: false
261482
+ };
261483
+ constructor(agent) {
261484
+ this.agent = agent;
261485
+ }
261486
+ resolveExecution(_args) {
261487
+ return {
261488
+ description: "Scheduling conversation compaction",
261489
+ approvalRule: this.name,
261490
+ execute: async () => {
261491
+ const status = this.agent.fullCompaction.requestProactiveCompaction();
261492
+ if (!status.eligible) return {
261493
+ isError: false,
261494
+ output: status.reason === "already_compacting" ? "Conversation compaction is already running." : "Nothing to compact yet; the conversation is within the safe proactive budget."
261495
+ };
261496
+ return {
261497
+ isError: false,
261498
+ output: `Conversation compaction scheduled at the end of this step (threshold: ${String(status.thresholdTokens)} estimated tokens).`
261499
+ };
261500
+ }
261501
+ };
261502
+ }
261503
+ };
261504
+ }));
261505
+ //#endregion
261437
261506
  //#region ../../packages/agent-core/src/tools/builtin/planning/enter-plan-mode.md?raw
261438
261507
  var enter_plan_mode_default;
261439
261508
  var init_enter_plan_mode$1 = __esmMin((() => {
@@ -262870,6 +262939,7 @@ var init_tool$1 = __esmMin((() => {
262870
262939
  init_profile();
262871
262940
  init_skill$4();
262872
262941
  init_builtin();
262942
+ init_compact_conversation_tool();
262873
262943
  init_types$3();
262874
262944
  SHELL_FOREGROUND_TIMEOUT_S = 120;
262875
262945
  ToolManager = class {
@@ -263263,6 +263333,7 @@ var init_tool$1 = __esmMin((() => {
263263
263333
  goalToolsEnabled && new UpdateGoalTool(this.agent),
263264
263334
  this.agent.rpc?.requestQuestion && new AskUserQuestionTool(this.agent),
263265
263335
  new TodoListTool(this.toolStore),
263336
+ new CompactConversationTool(this.agent),
263266
263337
  new TaskListTool(background),
263267
263338
  new TaskOutputTool(background),
263268
263339
  new TaskStopTool(background),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.97",
3
+ "version": "9.1.98",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {