blun-king-cli 9.1.81 → 9.1.82

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.81
12
+ npm install -g blun-king-cli@9.1.82
13
13
 
14
14
  Start
15
15
  -----
@@ -99,6 +99,8 @@ Rein lesende Sitzungsdiagnose
99
99
 
100
100
  Der mitgelieferte Standardskill `blun-session-inspector` untersucht den nur ergänzten Sitzungs-Wire und die zugehörigen Telemetriedateien, ohne eine Sitzung zu verändern. Er meldet Modellschritte, Werkzeugaufrufe, Zähler zum Tokenverbrauch, Voll- und Mikroverdichtungen, fehlgeschlagene Verdichtungen sowie ausgelagerte Werkzeugergebnisse. Prompts, Systemanweisungen, Werkzeugargumente, Werkzeugergebnisse, private Pfade und verborgenes Denken erscheinen nicht in der Standardausgabe.
101
101
 
102
+ Zusätzlich liest der Inspektor das sitzungseigene BLUN-Protokoll und meldet, wie viele Werkzeugschemata verfügbar, ausgewählt und zurückgestellt waren, wie viele geschätzte Schema-Token vermieden wurden und warum die Werkzeugmenge reduziert wurde. Andere Protokollinhalte werden weder ausgegeben noch ausgewertet.
103
+
102
104
  Beispiele:
103
105
 
104
106
  node "$SKILL_DIR/scripts/inspect-session.cjs" --list 20
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.81
12
+ npm install -g blun-king-cli@9.1.82
13
13
  ```
14
14
 
15
15
  ## Reproduzierbares Staging und Packen
@@ -120,6 +120,8 @@ Reguläre `Agent`-Teilaufgaben verwenden eine eigene `ContextMemory` und eine ei
120
120
 
121
121
  Der mitgelieferte Standardskill `blun-session-inspector` untersucht den nur ergänzten Sitzungs-Wire und die zugehörigen Telemetriedateien, ohne eine Sitzung zu verändern. Er meldet Modellschritte, Werkzeugaufrufe, Zähler zum Tokenverbrauch, Voll- und Mikroverdichtungen, fehlgeschlagene Verdichtungen sowie ausgelagerte Werkzeugergebnisse. Prompts, Systemanweisungen, Werkzeugargumente, Werkzeugergebnisse, private Pfade und verborgenes Denken erscheinen nicht in der Standardausgabe.
122
122
 
123
+ Zusätzlich liest der Inspektor das sitzungseigene BLUN-Protokoll und meldet, wie viele Werkzeugschemata verfügbar, ausgewählt und zurückgestellt waren, wie viele geschätzte Schema-Token vermieden wurden und warum die Werkzeugmenge reduziert wurde. Andere Protokollinhalte werden weder ausgegeben noch ausgewertet.
124
+
123
125
  Beispiele:
124
126
 
125
127
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.81",
3
+ "version": "9.1.82",
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": {
@@ -9,6 +9,8 @@ compatibility: designed for BLUN Code
9
9
 
10
10
  Use the bundled script instead of manually reading `wire.jsonl` or telemetry files. It reports counts and timing metadata without returning prompts, system instructions, tool arguments, tool results, private paths, or hidden reasoning.
11
11
 
12
+ In addition to wire and telemetry counts, the summary reads only structured `turn request tools` fields from the session's own BLUN log. It reports eligible, selected, and deferred schema counts, estimated schema tokens avoided, and suppression reasons. Other log lines are ignored and never emitted.
13
+
12
14
  Resolve `SKILL_DIR` to the directory containing this file. Do not assume a user-specific installation path.
13
15
 
14
16
  List recent sessions:
@@ -139,6 +139,17 @@ function numberValue(value) {
139
139
  return Number.isFinite(Number(value)) ? Number(value) : 0;
140
140
  }
141
141
 
142
+ function emptyTokenSeries() {
143
+ return { total: 0, min: null, max: null, last: null };
144
+ }
145
+
146
+ function addTokenValue(series, value) {
147
+ series.total += value;
148
+ series.min = series.min === null ? value : Math.min(series.min, value);
149
+ series.max = series.max === null ? value : Math.max(series.max, value);
150
+ series.last = value;
151
+ }
152
+
142
153
  function usageValue(usage, camelName, snakeName) {
143
154
  return numberValue(usage?.[camelName] ?? usage?.[snakeName]);
144
155
  }
@@ -290,6 +301,61 @@ async function summarizeTelemetry(telemetryDir, sessionId, warnings) {
290
301
  return summary;
291
302
  }
292
303
 
304
+ async function summarizeToolSchemas(logPath) {
305
+ const summary = {
306
+ requests: 0,
307
+ deferred_requests: 0,
308
+ suppression_reasons: [],
309
+ eligible_schema_tokens: emptyTokenSeries(),
310
+ selected_schema_tokens: emptyTokenSeries(),
311
+ estimated_schema_tokens_avoided: 0,
312
+ last: null,
313
+ };
314
+ if (!fs.existsSync(logPath)) return summary;
315
+
316
+ const reasonCounts = new Map();
317
+ const input = fs.createReadStream(logPath, { encoding: 'utf8' });
318
+ const lines = readline.createInterface({ input, crlfDelay: Infinity });
319
+ for await (const line of lines) {
320
+ if (!line.includes('turn request tools')) continue;
321
+ const values = Object.fromEntries(
322
+ [...line.matchAll(/\b(toolSuppressionReason|eligibleToolCount|selectedToolCount|deferredToolCount|eligibleToolSchemaTokens|selectedToolSchemaTokens)=([^\s]+)/gu)]
323
+ .map((match) => [match[1], match[2]]),
324
+ );
325
+ const numericKeys = [
326
+ 'eligibleToolCount',
327
+ 'selectedToolCount',
328
+ 'deferredToolCount',
329
+ 'eligibleToolSchemaTokens',
330
+ 'selectedToolSchemaTokens',
331
+ ];
332
+ if (!values.toolSuppressionReason || !numericKeys.every((key) => /^\d+$/u.test(values[key] || ''))) continue;
333
+
334
+ const eligibleToolCount = Number(values.eligibleToolCount);
335
+ const selectedToolCount = Number(values.selectedToolCount);
336
+ const deferredToolCount = Number(values.deferredToolCount);
337
+ const eligibleSchemaTokens = Number(values.eligibleToolSchemaTokens);
338
+ const selectedSchemaTokens = Number(values.selectedToolSchemaTokens);
339
+ summary.requests += 1;
340
+ if (deferredToolCount > 0) summary.deferred_requests += 1;
341
+ reasonCounts.set(values.toolSuppressionReason, (reasonCounts.get(values.toolSuppressionReason) || 0) + 1);
342
+ addTokenValue(summary.eligible_schema_tokens, eligibleSchemaTokens);
343
+ addTokenValue(summary.selected_schema_tokens, selectedSchemaTokens);
344
+ summary.estimated_schema_tokens_avoided += Math.max(0, eligibleSchemaTokens - selectedSchemaTokens);
345
+ summary.last = {
346
+ eligible_tool_count: eligibleToolCount,
347
+ selected_tool_count: selectedToolCount,
348
+ deferred_tool_count: deferredToolCount,
349
+ eligible_schema_tokens: eligibleSchemaTokens,
350
+ selected_schema_tokens: selectedSchemaTokens,
351
+ };
352
+ }
353
+ summary.suppression_reasons = [...reasonCounts.entries()]
354
+ .map(([reason, requests]) => ({ reason, requests }))
355
+ .sort((left, right) => right.requests - left.requests || left.reason.localeCompare(right.reason));
356
+ return summary;
357
+ }
358
+
293
359
  function listSessions(options, profileRoot, sessions, warnings) {
294
360
  const listed = sessions
295
361
  .filter((entry) => {
@@ -337,6 +403,7 @@ async function inspectSession(options, profileRoot, sessions, inheritedWarnings)
337
403
  agents,
338
404
  totals: combineAgents(agents),
339
405
  telemetry: await summarizeTelemetry(path.join(options.blunHome, 'telemetry'), entry.sessionId, warnings),
406
+ tool_schemas: await summarizeToolSchemas(path.join(entry.sessionDir, 'logs', 'blun.log')),
340
407
  warnings,
341
408
  };
342
409
  if (options.includeMetadata) {