blun-king-cli 9.1.401 → 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
@@ -426,6 +426,20 @@ Weitere Text-, Denk- und Werkzeugfragmente bleiben adaptiv gebündelt. Kurze
426
426
  Ausgaben behalten ihren schnellen Takt; bei langen Ausgaben wächst das Intervall
427
427
  weiterhin stufenweise, damit vollständige Neurenderings die TUI nicht ausbremsen.
428
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
+
429
443
  ## Reaktionsfähige Wiederaufnahme großer Sitzungen
430
444
 
431
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
@@ -519874,6 +519874,7 @@ function errorMessage(error) {
519874
519874
  * Parses CLI arguments via Commander.js, validates options, runs the
519875
519875
  * outer update preflight, then delegates to the requested UI runner.
519876
519876
  */
519877
+ const { startCompactionHistoryStartupSweep } = createRequire(import.meta.url)("./bin/compaction-history-startup.cjs");
519877
519878
  /** Keep the plain `blun` launcher Telegram-free without changing plugin state on disk. */
519878
519879
  function configureTelegramPluginLaunchMode(env) {
519879
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)));
@@ -519893,6 +519894,10 @@ async function handleMainCommand(opts, version) {
519893
519894
  }
519894
519895
  throw error;
519895
519896
  }
519897
+ void startCompactionHistoryStartupSweep({
519898
+ homedir: resolveBlunHome$1(),
519899
+ logger: log
519900
+ });
519896
519901
  const mistakeSync = await startAutomaticMistakeSync({
519897
519902
  homeDir: resolveBlunHome$1(),
519898
519903
  env: process.env
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.401",
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": {