blun-king-cli 9.1.400 → 9.1.402

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/README.md CHANGED
@@ -415,6 +415,31 @@ Profilspeicher erhalten. Damit kann eine gemessene Projektregel später wieder
415
415
  aufgerufen werden, ohne als vermeintlich allgemeine Regel in fachfremde Projekte
416
416
  zu gelangen.
417
417
 
418
+ ## Sofort sichtbarer Antwortbeginn
419
+
420
+ Ab BLUN King 9.1.401 rendert die TUI das erste Textfragment eines neuen Zuges
421
+ oder eines neuen Antwortabschnitts sofort. Es wartet nicht mehr auf den ersten
422
+ Intervall-Timer und übernimmt auch keinen Render-Zeitstempel aus dem vorherigen
423
+ Zug. Dadurch erscheint der Antwortbeginn ohne vermeidbare Pause in der Konsole.
424
+
425
+ Weitere Text-, Denk- und Werkzeugfragmente bleiben adaptiv gebündelt. Kurze
426
+ Ausgaben behalten ihren schnellen Takt; bei langen Ausgaben wächst das Intervall
427
+ weiterhin stufenweise, damit vollständige Neurenderings die TUI nicht ausbremsen.
428
+
429
+ ## Bereinigung alter Verdichtungsarchive beim Start
430
+
431
+ Ab BLUN King 9.1.402 beginnt beim Start einmalig eine Hintergrundbereinigung
432
+ für private Verdichtungsarchive unter `~/.blun/conversation-history/`. Dateien,
433
+ deren Aufbewahrungsfrist abgelaufen ist, werden damit auch dann entfernt, wenn
434
+ anschließend keine neue Vollverdichtung stattfindet.
435
+
436
+ Die Bereinigung wird nicht abgewartet und kann den Start weder verzögern noch
437
+ verhindern. Sie bleibt auf reguläre `compaction-*.md`-Dateien direkt im
438
+ Archivverzeichnis begrenzt. Fehler werden protokolliert und fallen weich
439
+ zurück; Sitzungs-Wire, andere Dateien und laufende Antworten bleiben
440
+ unverändert. `BLUN_COMPACTION_HISTORY_RETENTION_DAYS=0` schaltet die
441
+ Bereinigung weiterhin vollständig ab.
442
+
418
443
  ## Reaktionsfähige Wiederaufnahme großer Sitzungen
419
444
 
420
445
  Ab BLUN King 9.1.400 spielt die TUI gespeicherte Sitzungsverläufe weiterhin
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ const { sweepCompactionHistory } = require('./compaction-history-archive.cjs');
4
+
5
+ function startCompactionHistoryStartupSweep(options = {}) {
6
+ const sweep = typeof options.sweep === 'function'
7
+ ? options.sweep
8
+ : sweepCompactionHistory;
9
+ const sweepOptions = { homedir: options.homedir };
10
+ if (options.now !== undefined) sweepOptions.now = options.now;
11
+ if (options.retentionDays !== undefined) sweepOptions.retentionDays = options.retentionDays;
12
+
13
+ return Promise.resolve()
14
+ .then(() => sweep(sweepOptions))
15
+ .then((result) => {
16
+ const normalized = normalizeSweepResult(result);
17
+ if (normalized.deleted > 0 || normalized.failed > 0) {
18
+ safeLog(options.logger, 'info', 'compaction history startup sweep completed', normalized);
19
+ }
20
+ return normalized;
21
+ })
22
+ .catch((error) => {
23
+ const result = { deleted: 0, failed: 1 };
24
+ safeLog(options.logger, 'warn', 'compaction history startup sweep failed', {
25
+ error: error instanceof Error ? error.message : String(error),
26
+ });
27
+ return result;
28
+ });
29
+ }
30
+
31
+ function normalizeSweepResult(result) {
32
+ return {
33
+ deleted: nonNegativeInteger(result?.deleted),
34
+ failed: nonNegativeInteger(result?.failed),
35
+ };
36
+ }
37
+
38
+ function nonNegativeInteger(value) {
39
+ return Number.isInteger(value) && value >= 0 ? value : 0;
40
+ }
41
+
42
+ function safeLog(logger, level, message, properties) {
43
+ try {
44
+ logger?.[level]?.(message, properties);
45
+ } catch {}
46
+ }
47
+
48
+ module.exports = {
49
+ startCompactionHistoryStartupSweep,
50
+ };
package/blun.mjs CHANGED
@@ -511059,6 +511059,7 @@ var StreamingUIController = class {
511059
511059
  this._liveTurnStartedAtMs = Date.now();
511060
511060
  this._liveOutputTokens.reset();
511061
511061
  this._countedToolCallIds.clear();
511062
+ this.lastFlushAt = void 0;
511062
511063
  }
511063
511064
  getLiveActivityMetrics() {
511064
511065
  return {
@@ -511114,7 +511115,10 @@ var StreamingUIController = class {
511114
511115
  }
511115
511116
  appendAssistantDelta(delta) {
511116
511117
  this.recordLiveOutput(delta);
511117
- if (this._streamingBlock === null) this.onStreamingTextStart();
511118
+ if (this._streamingBlock === null) {
511119
+ this.onStreamingTextStart();
511120
+ this.lastFlushAt = void 0;
511121
+ }
511118
511122
  this._assistantDraft += delta;
511119
511123
  this.pendingAssistantFlush = true;
511120
511124
  }
@@ -511402,6 +511406,10 @@ var StreamingUIController = class {
511402
511406
  scheduleFlush() {
511403
511407
  if (!this.hasPending()) return;
511404
511408
  if (this.flushTimer !== void 0) return;
511409
+ if (this.lastFlushAt === void 0) {
511410
+ this.flush();
511411
+ return;
511412
+ }
511405
511413
  const flushIntervalMs = resolveStreamingFlushInterval({
511406
511414
  assistantChars: this._assistantDraft.length,
511407
511415
  thinkingChars: this._thinkingDraft.length,
@@ -519866,6 +519874,7 @@ function errorMessage(error) {
519866
519874
  * Parses CLI arguments via Commander.js, validates options, runs the
519867
519875
  * outer update preflight, then delegates to the requested UI runner.
519868
519876
  */
519877
+ const { startCompactionHistoryStartupSweep } = createRequire(import.meta.url)("./bin/compaction-history-startup.cjs");
519869
519878
  /** Keep the plain `blun` launcher Telegram-free without changing plugin state on disk. */
519870
519879
  function configureTelegramPluginLaunchMode(env) {
519871
519880
  const disabled = new Set((env["BLUN_DISABLED_PLUGINS"] ?? "").split(/[,;\s]+/).map((id) => id.trim().toLowerCase()).filter((id) => /^[a-z0-9][a-z0-9_-]{0,63}$/.test(id)));
@@ -519885,6 +519894,10 @@ async function handleMainCommand(opts, version) {
519885
519894
  }
519886
519895
  throw error;
519887
519896
  }
519897
+ void startCompactionHistoryStartupSweep({
519898
+ homedir: resolveBlunHome$1(),
519899
+ logger: log
519900
+ });
519888
519901
  const mistakeSync = await startAutomaticMistakeSync({
519889
519902
  homeDir: resolveBlunHome$1(),
519890
519903
  env: process.env
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.400",
3
+ "version": "9.1.402",
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": {