blun-king-cli 9.1.96 → 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.96
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.96
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
@@ -30427,6 +30428,7 @@ var init_input_schema = __esmMin((() => {
30427
30428
  var todo_list_default;
30428
30429
  var init_todo_list$1 = __esmMin((() => {
30429
30430
  todo_list_default = "Use this tool to maintain a structured TODO list as you work through a multi-step task. Use it proactively and often when progress tracking helps the current work. This is especially useful in long-running investigations and implementation tasks with several tool calls; in plan mode, write the plan to the plan file rather than tracking it here.\n\n**When to use:**\n- Multi-step tasks that span several tool calls\n- Tracking investigation progress across a large codebase search\n- Planning a sequence of edits before making them\n- After receiving new multi-step instructions, capture the requirements as todos\n- Before starting a tracked task, mark exactly one item as `in_progress`\n- Immediately after finishing a tracked task, record its truthful terminal state; do not batch completions at the end\n\n**When NOT to use:**\n- Single-shot answers that complete in one or two tool calls\n- Trivial requests where tracking adds no clarity\n- Purely conversational or informational replies\n\n**Avoid churn:**\n- Do not re-call this tool when nothing meaningful has changed since the last call — update the list only after real progress.\n- When unsure of the current state, call query mode first (omit `todos`) to check the list before deciding what to update.\n- If no available tool can move any task forward, tell the user where you are stuck instead of repeatedly re-ordering the same todos.\n\n**How to use:**\n- Call with `todos: [...]` to replace the full list. Statuses: pending / in_progress / done / blocked / waiting_approval / aborted.\n- Call with no `todos` argument to retrieve the current list without changing it.\n- Call with `todos: []` to clear the list.\n- Keep titles short and actionable (e.g. \"Read session-control.ts\", \"Add planMode flag to TurnManager\").\n- Update statuses as you make progress.\n- When work is underway, keep exactly one task `in_progress`.\n- Use `done` only when fully accomplished. Use `blocked` with the reason and the action that would unblock it, `waiting_approval` with the prepared result that awaits approval, and `aborted` with the last reached state.\n- Never mark a task `done` if tests are failing, implementation is partial, unresolved errors remain, or required files/dependencies could not be found.\n";
30431
+ todo_list_default = "Maintain a structured TODO list when it adds clarity to multi-step work; skip it for conversation or a single-shot task. In plan mode, use the plan file instead.\n\nCall with `todos: [...]` to replace the full list. Statuses are `pending`, `in_progress`, `done`, `blocked`, `waiting_approval`, and `aborted`. Omit `todos` to query the current list; use `todos: []` to clear it.\n\nKeep titles short and actionable. Capture the real requirements, keep exactly one item `in_progress` while tracked work is active, and update a status immediately after real progress instead of batching or rewriting an unchanged list. Use `done` only for fully verified work. A `blocked` item names the reason and the action that can unblock it; `waiting_approval` names the prepared result awaiting approval; `aborted` records the last reached state. Before finishing, reconcile every tracked item truthfully. If no available tool can move the work forward, report the blocker to the user instead of churning the list.";
30430
30432
  }));
30431
30433
  //#endregion
30432
30434
  //#region ../../packages/agent-core/src/tools/builtin/state/todo-list.ts
@@ -75240,10 +75242,11 @@ function extractCompactionSummary(response) {
75240
75242
  if (summary.trim().length === 0) throw new APIEmptyResponseError("The compaction response did not contain a non-empty summary.");
75241
75243
  return summary;
75242
75244
  }
75243
- 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;
75244
75246
  var init_full = __esmMin((() => {
75245
75247
  ({ archiveCompactionHistory, buildCompactionArchiveNotice } = createRequire(import.meta.url)("./bin/compaction-history-archive.cjs"));
75246
75248
  ({ capCompactionStageTarget } = createRequire(import.meta.url)("./bin/compaction-stage-policy.cjs"));
75249
+ ({ proactiveCompactionEligibility } = createRequire(import.meta.url)("./bin/proactive-compaction-policy.cjs"));
75247
75250
  init_errors$8();
75248
75251
  init_src$4();
75249
75252
  init_errors$4();
@@ -75299,6 +75302,7 @@ var init_full = __esmMin((() => {
75299
75302
  compactionTimingByProviderModel = /* @__PURE__ */ new Map();
75300
75303
  lastCompactedState = null;
75301
75304
  consecutiveOverflowCompactions = 0;
75305
+ proactiveCompactionRequested = false;
75302
75306
  strategy;
75303
75307
  requiresShrinkableHistory;
75304
75308
  constructor(agent, strategy) {
@@ -75328,6 +75332,27 @@ var init_full = __esmMin((() => {
75328
75332
  const budget = this.strategy.compactionBudgetTokens;
75329
75333
  return budget !== void 0 && Number.isFinite(budget) && budget > 0 ? Math.floor(budget) : void 0;
75330
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
+ }
75331
75356
  estimateCurrentRequestTokens(context = {}) {
75332
75357
  const estimated = this.estimateProjectedRequestTokens(context);
75333
75358
  return Math.max(this.tokenCountWithPending, estimated);
@@ -75405,6 +75430,7 @@ var init_full = __esmMin((() => {
75405
75430
  this.compactionCountInTurn = 0;
75406
75431
  this.lastCompactedState = null;
75407
75432
  this.consecutiveOverflowCompactions = 0;
75433
+ this.proactiveCompactionRequested = false;
75408
75434
  }
75409
75435
  async handleOverflowError(signal, error) {
75410
75436
  this.consecutiveOverflowCompactions += 1;
@@ -75434,8 +75460,14 @@ var init_full = __esmMin((() => {
75434
75460
  } });
75435
75461
  return compacted;
75436
75462
  }
75437
- async afterStep() {
75463
+ async afterStep(signal) {
75438
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
+ }
75439
75471
  if (this.strategy.checkAfterStep) this.checkAutoCompaction(false);
75440
75472
  }
75441
75473
  checkAutoCompaction(throwOnLimit = true, usedSize = this.tokenCountWithPending, messages = this.agent.context.history) {
@@ -260978,7 +261010,9 @@ var init_turn = __esmMin((() => {
260978
261010
  const loopControl = this.agent.blunConfig?.loopControl;
260979
261011
  let stopForGoalBudget = false;
260980
261012
  try {
260981
- 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());
260982
261016
  const toolSelection = fastConversation ? {
260983
261017
  tools: [...blunFastConversationTools(eligibleTools, input, pendingMediaJobIds)],
260984
261018
  deferredToolCount: 0
@@ -261076,7 +261110,8 @@ var init_turn = __esmMin((() => {
261076
261110
  previousStepToolOutcome = currentStepHadTool ? currentStepHadFailure ? "failure" : "success" : "none";
261077
261111
  this.agent.usage.record(this.agent.activeResponderModel ?? model, usage, "turn");
261078
261112
  if (stopForGoalBudget) this.setActiveSteerAcceptance(turnId, false);
261079
- 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);
261080
261115
  deduper.endStep();
261081
261116
  return stopForGoalBudget ? { stopTurn: true } : void 0;
261082
261117
  },
@@ -261433,6 +261468,41 @@ var init_update_goal = __esmMin((() => {
261433
261468
  };
261434
261469
  }));
261435
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
261436
261506
  //#region ../../packages/agent-core/src/tools/builtin/planning/enter-plan-mode.md?raw
261437
261507
  var enter_plan_mode_default;
261438
261508
  var init_enter_plan_mode$1 = __esmMin((() => {
@@ -262869,6 +262939,7 @@ var init_tool$1 = __esmMin((() => {
262869
262939
  init_profile();
262870
262940
  init_skill$4();
262871
262941
  init_builtin();
262942
+ init_compact_conversation_tool();
262872
262943
  init_types$3();
262873
262944
  SHELL_FOREGROUND_TIMEOUT_S = 120;
262874
262945
  ToolManager = class {
@@ -263262,6 +263333,7 @@ var init_tool$1 = __esmMin((() => {
263262
263333
  goalToolsEnabled && new UpdateGoalTool(this.agent),
263263
263334
  this.agent.rpc?.requestQuestion && new AskUserQuestionTool(this.agent),
263264
263335
  new TodoListTool(this.toolStore),
263336
+ new CompactConversationTool(this.agent),
263265
263337
  new TaskListTool(background),
263266
263338
  new TaskOutputTool(background),
263267
263339
  new TaskStopTool(background),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.96",
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": {