blun-king-cli 9.1.34 → 9.1.35

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.1
12
+ npm install -g blun-king-cli@9.1.35
13
13
 
14
14
  Start
15
15
  -----
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.34
12
+ npm install -g blun-king-cli@9.1.35
13
13
  ```
14
14
 
15
15
  ## Reproduzierbares Staging und Packen
package/blun.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:ec5eb56eb8addc29b2ddab22ca4987f2156e16b88a8f468ce3248d312afa717f
2
+ // BLUN_BUILD_INPUT_SHA256:760e619c78a4f7144ea03820db15402ea00e8058f86f431c12fb1bbb633de6b9
3
3
  import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
4
4
  import { dirname as __cjsShimDirname } from 'node:path';
5
5
  const __filename = __cjsShimFileURLToPath(import.meta.url);
@@ -75019,10 +75019,17 @@ function isModelFallbackStatus(error) {
75019
75019
  function compactionTimingKey(provider) {
75020
75020
  return `${provider.name}\u0000${provider.modelName}`;
75021
75021
  }
75022
- function estimateCompactionProgressPercent(initialInputTokens, currentInputTokens) {
75023
- if (initialInputTokens <= 0) return 0;
75024
- const reducedTokens = Math.max(0, initialInputTokens - currentInputTokens);
75025
- return Math.min(99, Math.floor(reducedTokens / initialInputTokens * 100));
75022
+ function estimateCompactionStageCount(initialInputTokens, safeRequestLimitTokens, currentStage) {
75023
+ if (safeRequestLimitTokens <= 0) return currentStage;
75024
+ return Math.max(currentStage, Math.ceil(initialInputTokens / safeRequestLimitTokens));
75025
+ }
75026
+ function estimateCompactionProgressPercent(stage, estimatedStageCount) {
75027
+ if (estimatedStageCount <= 0) return 0;
75028
+ return Math.min(99, Math.floor(stage / estimatedStageCount * 100));
75029
+ }
75030
+ function estimateCompactionWindowUsagePercent(requestTokens, maxContextTokens) {
75031
+ if (maxContextTokens <= 0) return void 0;
75032
+ return Math.min(100, Math.max(0, Math.ceil(requestTokens / maxContextTokens * 100)));
75026
75033
  }
75027
75034
  function selectHierarchicalCompactionChunk(history, targetRequestTokens, hardRequestLimit, build) {
75028
75035
  const safeEnds = [];
@@ -75502,12 +75509,17 @@ var init_full = __esmMin((() => {
75502
75509
  provider = buildCompactionProvider(estimatedCompactionRequestTokens);
75503
75510
  attemptCount += 1;
75504
75511
  charsReceived = 0;
75505
- const estimatedProgressPercent = estimateCompactionProgressPercent(initialCompactionRequestTokens, estimatedCompactionRequestTokens);
75512
+ const stage = hierarchicalPassCount + 1;
75513
+ const estimatedStageCount = estimateCompactionStageCount(initialCompactionRequestTokens, safeCompactionRequestLimit, stage);
75514
+ const estimatedProgressPercent = estimateCompactionProgressPercent(stage, estimatedStageCount);
75515
+ const windowUsagePercent = estimateCompactionWindowUsagePercent(estimatedCompactionRequestTokens, compactionRequestLimit);
75506
75516
  this.agent.log.info("compaction stage request", {
75507
75517
  source: data.source,
75508
- stage: hierarchicalPassCount + 1,
75518
+ stage,
75519
+ estimatedStageCount,
75509
75520
  activeContextTokens: this.estimateProjectedRequestTokens(),
75510
75521
  estimatedInputTokens: estimatedCompactionRequestTokens,
75522
+ windowUsagePercent,
75511
75523
  safeInputLimitTokens: safeCompactionRequestLimit,
75512
75524
  maxContextTokens: compactionRequestLimit
75513
75525
  });
@@ -75517,9 +75529,11 @@ var init_full = __esmMin((() => {
75517
75529
  lastProgressEmitAt = now;
75518
75530
  this.agent.emitEvent({
75519
75531
  type: "compaction.progress",
75520
- stage: hierarchicalPassCount + 1,
75532
+ stage,
75533
+ estimatedStageCount,
75521
75534
  estimatedInputTokens: estimatedCompactionRequestTokens,
75522
75535
  estimatedProgressPercent,
75536
+ ...windowUsagePercent === void 0 ? {} : { windowUsagePercent },
75523
75537
  charsReceived,
75524
75538
  attempt: attemptCount,
75525
75539
  ...typicalDurationMs !== void 0 ? { typicalDurationMs } : {}
@@ -245396,7 +245410,9 @@ var init_events$1 = __esmMin((() => {
245396
245410
  compactionProgressEventSchema = object({
245397
245411
  type: literal("compaction.progress"),
245398
245412
  stage: number$1().int().positive().optional(),
245413
+ estimatedStageCount: number$1().int().positive().optional(),
245399
245414
  estimatedProgressPercent: number$1().int().min(0).max(99).optional(),
245415
+ windowUsagePercent: number$1().int().min(0).max(100).optional(),
245400
245416
  estimatedInputTokens: number$1().optional(),
245401
245417
  charsReceived: number$1(),
245402
245418
  attempt: number$1(),
@@ -425706,6 +425722,14 @@ function formatCompactCount(n) {
425706
425722
  if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
425707
425723
  return String(n);
425708
425724
  }
425725
+ function formatCompactionStageText(progress) {
425726
+ const stage = progress.stage;
425727
+ const total = progress.estimatedStageCount;
425728
+ const parts = [];
425729
+ if (stage !== void 0 && total !== void 0) parts.push(`${String(stage)}/~${String(total)}`);
425730
+ if (progress.windowUsagePercent !== void 0) parts.push(`${String(progress.windowUsagePercent)} %`);
425731
+ return parts.join(" · ");
425732
+ }
425709
425733
  function formatCompactionRunningText(inputTokens) {
425710
425734
  return inputTokens === void 0 ? uiText("compaction.running") : uiText("compaction.runningWithSize", { tokens: formatCompactCount(inputTokens) });
425711
425735
  }
@@ -425747,8 +425771,10 @@ var CompactionComponent = class extends Container {
425747
425771
  estimatedInputTokens;
425748
425772
  attempt = 1;
425749
425773
  stage = 1;
425774
+ estimatedStageCount;
425750
425775
  stageCount;
425751
425776
  estimatedProgressPercent;
425777
+ windowUsagePercent;
425752
425778
  constructor(ui, instruction, tip, showRunning = true) {
425753
425779
  super();
425754
425780
  this.showRunning = showRunning;
@@ -425803,7 +425829,9 @@ var CompactionComponent = class extends Container {
425803
425829
  if (progress.attempt !== this.attempt) this.attemptStartedAtMs = Date.now();
425804
425830
  this.attempt = progress.attempt;
425805
425831
  this.stage = progress.stage ?? this.stage;
425832
+ this.estimatedStageCount = progress.estimatedStageCount;
425806
425833
  this.estimatedProgressPercent = progress.estimatedProgressPercent;
425834
+ this.windowUsagePercent = progress.windowUsagePercent;
425807
425835
  this.statusText.setText(this.buildStatusLine());
425808
425836
  if (this.showRunning) this.ui?.requestRender();
425809
425837
  }
@@ -425828,8 +425856,17 @@ var CompactionComponent = class extends Container {
425828
425856
  const percent = this.estimatedProgressPercent ?? estimateCompactionPercent(elapsedMs, this.estimatedInputTokens);
425829
425857
  const filled = Math.round(percent / 100 * BAR_WIDTH);
425830
425858
  const bar = `[${"█".repeat(filled)}${"░".repeat(BAR_WIDTH - filled)}]`;
425831
- const runningText = `${formatCompactionRunningText(this.estimatedInputTokens)} · ${String(this.stage)}/?`;
425832
- return `${currentTheme.fg("primary", bar)} ${currentTheme.boldFg("primary", runningText)}${currentTheme.fg("textDim", ` ~${String(percent)} %`)}${currentTheme.fg("textDim", ` · ${String(this.elapsedSeconds())}s`)}${this.attempt > 1 ? currentTheme.fg("textDim", uiText("compaction.attempt", { attempt: this.attempt })) : ""}${currentTheme.fg("textDim", ` · ${uiText("compaction.cancelHint")}`)}${this.instruction ? currentTheme.fg("textDim", ` · ${this.instruction}`) : ""}${this.tip ? currentTheme.fg("textDim", ` · ${this.tip}`) : ""}`;
425859
+ const stageText = formatCompactionStageText({
425860
+ stage: this.stage,
425861
+ estimatedStageCount: this.estimatedStageCount,
425862
+ estimatedProgressPercent: this.estimatedProgressPercent,
425863
+ windowUsagePercent: this.windowUsagePercent,
425864
+ estimatedInputTokens: this.estimatedInputTokens,
425865
+ charsReceived: 0,
425866
+ attempt: this.attempt
425867
+ });
425868
+ const runningText = `${formatCompactionRunningText(this.estimatedInputTokens)}${stageText.length === 0 ? "" : ` · ${stageText}`}`;
425869
+ return `${currentTheme.fg("primary", bar)} ${currentTheme.boldFg("primary", runningText)}${this.windowUsagePercent === void 0 ? currentTheme.fg("textDim", ` ~${String(percent)} %`) : ""}${currentTheme.fg("textDim", ` · ${String(this.elapsedSeconds())}s`)}${this.attempt > 1 ? currentTheme.fg("textDim", uiText("compaction.attempt", { attempt: this.attempt })) : ""}${currentTheme.fg("textDim", ` · ${uiText("compaction.cancelHint")}`)}${this.instruction ? currentTheme.fg("textDim", ` · ${this.instruction}`) : ""}${this.tip ? currentTheme.fg("textDim", ` · ${this.tip}`) : ""}`;
425833
425870
  }
425834
425871
  startTicking() {
425835
425872
  this.timer = setInterval(() => {
@@ -506143,17 +506180,21 @@ function formatContextStatus(usage, tokens, maxTokens, colors, width, now = /* @
506143
506180
  for (const variant of variants) if (visibleWidth(variant) <= available) return variant;
506144
506181
  return truncateToWidth(current, available, "…");
506145
506182
  }
506146
- function formatCompactionStatus(elapsedMs, estimatedInputTokens, colors, width, now = /* @__PURE__ */ new Date()) {
506147
- const percent = estimateCompactionPercent(elapsedMs, estimatedInputTokens);
506183
+ function formatCompactionStatus(elapsedMs, estimatedInputTokens, progress, colors, width, now = /* @__PURE__ */ new Date()) {
506184
+ const percent = progress?.estimatedProgressPercent ?? estimateCompactionPercent(elapsedMs, estimatedInputTokens);
506148
506185
  const filled = Math.max(1, Math.ceil((1 - percent / 100) * CONTEXT_BAR_WIDTH));
506149
506186
  const bar = chalk.hex(colors.primary)(`${"█".repeat(filled)}${"░".repeat(CONTEXT_BAR_WIDTH - filled)}`);
506150
506187
  const label = formatCompactionRunningText(estimatedInputTokens);
506151
- const estimate = `~${String(percent)} %`;
506188
+ const stageText = progress === void 0 ? "" : formatCompactionStageText(progress);
506189
+ const compactStageText = progress?.stage === void 0 || progress.estimatedStageCount === void 0 ? "" : `${String(progress.stage)}/~${String(progress.estimatedStageCount)}${progress.windowUsagePercent === void 0 ? "" : ` · ${String(progress.windowUsagePercent)}%`}`;
506190
+ const estimate = progress?.windowUsagePercent === void 0 ? `~${String(percent)} %` : "";
506191
+ const clock = chalk.hex(colors.textDim)(` · ${clockHhmm(now)}`);
506152
506192
  const variants = [
506153
- `${label} ${bar} ${estimate}${chalk.hex(colors.textDim)(` · ${clockHhmm(now)}`)}`,
506154
- `${label} ${bar} ${estimate}`,
506155
- `${bar} ${estimate}`,
506156
- estimate
506193
+ `${label}${stageText.length === 0 ? "" : ` · ${stageText}`} ${bar}${estimate.length === 0 ? "" : ` ${estimate}`}${clock}`,
506194
+ `${label}${stageText.length === 0 ? "" : ` · ${stageText}`}`,
506195
+ compactStageText,
506196
+ `${bar}${estimate.length === 0 ? "" : ` ${estimate}`}`,
506197
+ stageText.length === 0 ? estimate : stageText
506157
506198
  ];
506158
506199
  const available = Math.max(0, width);
506159
506200
  for (const variant of variants) if (visibleWidth(variant) <= available) return variant;
@@ -506188,6 +506229,7 @@ var FooterComponent = class {
506188
506229
  goalTimer = null;
506189
506230
  compactionAttemptStartedAtMs = null;
506190
506231
  compactionEstimatedInputTokens;
506232
+ compactionProgress;
506191
506233
  compactionAttempt = 1;
506192
506234
  compactionTimer = null;
506193
506235
  /**
@@ -506222,6 +506264,7 @@ var FooterComponent = class {
506222
506264
  startCompaction() {
506223
506265
  this.compactionAttemptStartedAtMs = Date.now();
506224
506266
  this.compactionEstimatedInputTokens = void 0;
506267
+ this.compactionProgress = void 0;
506225
506268
  this.compactionAttempt = 1;
506226
506269
  if (this.compactionTimer === null) {
506227
506270
  this.compactionTimer = setInterval(() => {
@@ -506235,11 +506278,13 @@ var FooterComponent = class {
506235
506278
  if (progress.estimatedInputTokens !== void 0) this.compactionEstimatedInputTokens = progress.estimatedInputTokens;
506236
506279
  if (progress.attempt !== this.compactionAttempt) this.compactionAttemptStartedAtMs = Date.now();
506237
506280
  this.compactionAttempt = progress.attempt;
506281
+ this.compactionProgress = progress;
506238
506282
  this.onRefresh();
506239
506283
  }
506240
506284
  finishCompaction() {
506241
506285
  this.compactionAttemptStartedAtMs = null;
506242
506286
  this.compactionEstimatedInputTokens = void 0;
506287
+ this.compactionProgress = void 0;
506243
506288
  this.compactionAttempt = 1;
506244
506289
  if (this.compactionTimer !== null) {
506245
506290
  clearInterval(this.compactionTimer);
@@ -506306,7 +506351,7 @@ var FooterComponent = class {
506306
506351
  const leftLine = left.join(" ");
506307
506352
  const leftWidth = visibleWidth(leftLine);
506308
506353
  const context = contextMetrics(state);
506309
- const contextText = this.compactionAttemptStartedAtMs === null ? formatContextStatus(context.usage, context.tokens, context.maxTokens, colors, width) : formatCompactionStatus(Math.max(0, Date.now() - this.compactionAttemptStartedAtMs), this.compactionEstimatedInputTokens, colors, width);
506354
+ const contextText = this.compactionAttemptStartedAtMs === null ? formatContextStatus(context.usage, context.tokens, context.maxTokens, colors, width) : formatCompactionStatus(Math.max(0, Date.now() - this.compactionAttemptStartedAtMs), this.compactionEstimatedInputTokens, this.compactionProgress, colors, width);
506310
506355
  const right = this.transientHint && this.compactionAttemptStartedAtMs === null ? chalk.hex(colors.warning).bold(this.transientHint) : chalk.hex(colors.text)(contextText);
506311
506356
  const rightWidth = visibleWidth(right);
506312
506357
  let line1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.34",
3
+ "version": "9.1.35",
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": {