blun-king-cli 9.1.84 → 9.1.85

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.84
12
+ npm install -g blun-king-cli@9.1.85
13
13
 
14
14
  Start
15
15
  -----
@@ -80,7 +80,7 @@ Dabei werden keine gespeicherten Nachrichten geändert oder gelöscht. Fortsetze
80
80
 
81
81
  ## Große Werkzeugausgaben und isolierte Teilagenten
82
82
 
83
- Werkzeugausgaben mit mehr als 50.000 Zeichen werden vollständig unter `<agent-home>/tool-results/` gespeichert. Im Modellkontext bleiben nur eine Vorschau der ersten 2.000 Zeichen, der genaue `output_path` und der Hinweis, die Datei bei Bedarf mit `Read` zu öffnen. Dadurch bleibt die vollständige Ausgabe wiederauffindbar, ohne in jedem weiteren Modellschritt erneut als großer Textblock mitzufahren.
83
+ 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 eine Vorschau mit 2.000 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 enthalten die folgenden Modellanfragen nur noch die Vorschau und den lesbaren Pfad; der vollständige Text bleibt lokal verfügbar.
84
84
 
85
85
  Das Telemetrieereignis `tool_result_offloaded` enthält ausschließlich `tool_name`, `output_size_chars`, `output_size_bytes` und `preview_size_chars`. Es enthält weder den Inhalt noch den Speicherpfad. Beispiel: Eine Ausgabe mit 80.000 Zeichen erzeugt eine Vorschau mit 2.000 Zeichen; die Telemetrie zeigt die Größenersparnis, ohne Nutzdaten zu protokollieren.
86
86
 
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.84
12
+ npm install -g blun-king-cli@9.1.85
13
13
  ```
14
14
 
15
15
  ## Reproduzierbares Staging und Packen
@@ -102,7 +102,7 @@ Dabei werden keine gespeicherten Nachrichten geändert oder gelöscht. Fortsetze
102
102
 
103
103
  ## Große Werkzeugausgaben und isolierte Teilagenten
104
104
 
105
- Werkzeugausgaben mit mehr als 50.000 Zeichen werden vollständig unter `<agent-home>/tool-results/` gespeichert. Im Modellkontext bleiben nur eine Vorschau der ersten 2.000 Zeichen, der genaue `output_path` und der Hinweis, die Datei bei Bedarf mit `Read` zu öffnen. Dadurch bleibt die vollständige Ausgabe wiederauffindbar, ohne in jedem weiteren Modellschritt erneut als großer Textblock mitzufahren.
105
+ 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 eine Vorschau mit 2.000 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 enthalten die folgenden Modellanfragen nur noch die Vorschau und den lesbaren Pfad; der vollständige Text bleibt lokal verfügbar.
106
106
 
107
107
  Das Telemetrieereignis `tool_result_offloaded` enthält ausschließlich `tool_name`, `output_size_chars`, `output_size_bytes` und `preview_size_chars`. Es enthält weder den Inhalt noch den Speicherpfad. Beispiel: Eine Ausgabe mit 80.000 Zeichen erzeugt eine Vorschau mit 2.000 Zeichen; die Telemetrie zeigt die Größenersparnis, ohne Nutzdaten zu protokollieren.
108
108
 
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const TOOL_RESULT_MAX_CHARS = 12_000;
4
+ const TOOL_RESULT_PREVIEW_CHARS = 2_000;
5
+ const TOOL_RESULT_OFFLOAD_MARKER = '[Tool result offloaded]';
6
+
7
+ function shouldOffloadToolResult(textLength) {
8
+ return Number.isFinite(textLength) && textLength > TOOL_RESULT_MAX_CHARS;
9
+ }
10
+
11
+ function isPersistedToolResultReference(content) {
12
+ if (!Array.isArray(content)) return false;
13
+
14
+ return content.some((part) => {
15
+ if (part?.type !== 'text' || typeof part.text !== 'string') return false;
16
+ if (!part.text.includes('\noutput_path: ')) return false;
17
+ return part.text.startsWith(`${TOOL_RESULT_OFFLOAD_MARKER}\n`)
18
+ || /^Tool output exceeded \d+ characters; showing a preview only\.\n/u.test(part.text);
19
+ });
20
+ }
21
+
22
+ module.exports = {
23
+ TOOL_RESULT_MAX_CHARS,
24
+ TOOL_RESULT_PREVIEW_CHARS,
25
+ TOOL_RESULT_OFFLOAD_MARKER,
26
+ isPersistedToolResultReference,
27
+ shouldOffloadToolResult,
28
+ };
package/blun.mjs CHANGED
@@ -75911,9 +75911,10 @@ var init_full = __esmMin((() => {
75911
75911
  }));
75912
75912
  //#endregion
75913
75913
  //#region ../../packages/agent-core/src/agent/compaction/micro.ts
75914
- var selectMicroCompactionCutoff, DEFAULT_CONFIG, MicroCompaction;
75914
+ var selectMicroCompactionCutoff, isPersistedToolResultReference, DEFAULT_CONFIG, MicroCompaction;
75915
75915
  var init_micro = __esmMin((() => {
75916
75916
  ({ selectMicroCompactionCutoff } = createRequire(import.meta.url)("./bin/micro-compaction-policy.cjs"));
75917
+ ({ isPersistedToolResultReference } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
75917
75918
  init_tokens();
75918
75919
  DEFAULT_CONFIG = {
75919
75920
  keepRecentMessages: 20,
@@ -76000,7 +76001,7 @@ var init_micro = __esmMin((() => {
76000
76001
  const result = [];
76001
76002
  let i = 0;
76002
76003
  for (const msg of messages) {
76003
- if (i < this.cutoff && msg.role === "tool" && msg.toolCallId !== void 0 && estimateTokensForContentParts(msg.content) >= config.minContentTokens) result.push({
76004
+ if (i < this.cutoff && msg.role === "tool" && msg.toolCallId !== void 0 && !isPersistedToolResultReference(msg.content) && estimateTokensForContentParts(msg.content) >= config.minContentTokens) result.push({
76004
76005
  ...msg,
76005
76006
  content: [{
76006
76007
  type: "text",
@@ -76045,7 +76046,7 @@ var init_micro = __esmMin((() => {
76045
76046
  const serializedArgumentsMarker = JSON.stringify({ _blun_compacted: this.config.truncatedArgumentsMarker });
76046
76047
  for (let i = 0; i < messages.length && i < cutoff; i++) {
76047
76048
  const message = messages[i];
76048
- if (message?.role === "tool" && message.toolCallId !== void 0) {
76049
+ if (message?.role === "tool" && message.toolCallId !== void 0 && !isPersistedToolResultReference(message.content)) {
76049
76050
  const contentTokens = estimateTokensForContentParts(message.content);
76050
76051
  if (contentTokens >= this.config.minContentTokens) {
76051
76052
  markerTokenCount ??= estimateTokensForContentParts([{
@@ -259961,7 +259962,7 @@ var init_tool_dedup = __esmMin((() => {
259961
259962
  //#region ../../packages/agent-core/src/agent/turn/tool-result-budget.ts
259962
259963
  async function budgetToolResultForModel(options) {
259963
259964
  const text = persistableToolResultText(options.result.output);
259964
- if (text === void 0 || text.length <= TOOL_RESULT_MAX_CHARS) return options.result;
259965
+ if (text === void 0 || !shouldOffloadToolResult(text.length)) return options.result;
259965
259966
  if (options.result.truncated === true) return options.result;
259966
259967
  if (options.homedir === void 0) return options.result;
259967
259968
  const outputPath = await saveToolResult({
@@ -260000,7 +260001,8 @@ async function saveToolResult(options, text) {
260000
260001
  const outputPath = join$4(dir, `${safeToolResultFileStem(options.toolName, options.toolCallId)}-${randomUUID()}.txt`);
260001
260002
  await writeFile(outputPath, text, {
260002
260003
  encoding: "utf8",
260003
- flag: "wx"
260004
+ flag: "wx",
260005
+ mode: 384
260004
260006
  });
260005
260007
  return outputPath;
260006
260008
  } catch {
@@ -260009,6 +260011,7 @@ async function saveToolResult(options, text) {
260009
260011
  }
260010
260012
  function renderPersistedToolResult(toolName, toolCallId, text, outputPath) {
260011
260013
  const lines = [
260014
+ TOOL_RESULT_OFFLOAD_MARKER,
260012
260015
  `Tool output exceeded ${String(TOOL_RESULT_MAX_CHARS)} characters; showing a preview only.`,
260013
260016
  `tool_name: ${toolName}`,
260014
260017
  `tool_call_id: ${toolCallId}`,
@@ -260023,12 +260026,15 @@ function renderPersistedToolResult(toolName, toolCallId, text, outputPath) {
260023
260026
  function safeToolResultFileStem(toolName, toolCallId) {
260024
260027
  return `${toolName}-${toolCallId}`.replace(/[^a-zA-Z0-9._-]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 80) || "tool-result";
260025
260028
  }
260026
- var TOOL_RESULT_MAX_CHARS, TOOL_RESULT_PREVIEW_CHARS, buildToolResultOffloadTelemetry;
260029
+ var TOOL_RESULT_MAX_CHARS, TOOL_RESULT_PREVIEW_CHARS, TOOL_RESULT_OFFLOAD_MARKER, shouldOffloadToolResult, buildToolResultOffloadTelemetry;
260027
260030
  var init_tool_result_budget = __esmMin((() => {
260028
260031
  init_dist$6();
260032
+ const toolResultOffloadPolicy = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs");
260029
260033
  ({ buildToolResultOffloadTelemetry } = createRequire(import.meta.url)("./bin/tool-result-offload-telemetry.cjs"));
260030
- TOOL_RESULT_MAX_CHARS = 5e4;
260031
- TOOL_RESULT_PREVIEW_CHARS = 2e3;
260034
+ TOOL_RESULT_MAX_CHARS = toolResultOffloadPolicy.TOOL_RESULT_MAX_CHARS;
260035
+ TOOL_RESULT_PREVIEW_CHARS = toolResultOffloadPolicy.TOOL_RESULT_PREVIEW_CHARS;
260036
+ TOOL_RESULT_OFFLOAD_MARKER = toolResultOffloadPolicy.TOOL_RESULT_OFFLOAD_MARKER;
260037
+ shouldOffloadToolResult = toolResultOffloadPolicy.shouldOffloadToolResult;
260032
260038
  }));
260033
260039
  //#endregion
260034
260040
  //#region ../../packages/agent-core/src/agent/turn/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.84",
3
+ "version": "9.1.85",
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": {