blun-king-cli 9.1.484 → 9.1.485

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.
@@ -211,6 +211,12 @@ function shouldResumeAfterStartupUpdate(args, updateResult) {
211
211
  && args[0] === '-c';
212
212
  }
213
213
 
214
+ function clearStartupUpdateViewport(output = process.stdout) {
215
+ if (output?.isTTY !== true || typeof output.write !== 'function') return false;
216
+ output.write('\u001B[2J\u001B[H');
217
+ return true;
218
+ }
219
+
214
220
  async function superviseProtectedCore(args, env, cwd, releaseLauncherLeases, options = {}) {
215
221
  const spawnCore = options.spawnProtectedCore || spawnProtectedCore;
216
222
  const core = options.existingCore || spawnCore(args, env, cwd, {
@@ -457,6 +463,7 @@ async function runLauncher(options = {}) {
457
463
  });
458
464
  if (shouldResumeAfterStartupUpdate(ARGS, updateResult)) {
459
465
  await releaseLauncherLeases();
466
+ clearStartupUpdateViewport(process.stdout);
460
467
  process.exitCode = await spawnManagedLauncher(process.execPath, callerCwd);
461
468
  return;
462
469
  }
@@ -525,6 +532,7 @@ async function runLauncher(options = {}) {
525
532
  }
526
533
 
527
534
  module.exports = {
535
+ clearStartupUpdateViewport,
528
536
  createManagedNodeEnvironment,
529
537
  resolveLauncherPrivatePaths,
530
538
  runLauncher,
@@ -19,4 +19,22 @@ function replayWindowStartIndex(records, activeTurnCount, startsTurn) {
19
19
  return 0;
20
20
  }
21
21
 
22
- module.exports = { replayWindowStartIndex };
22
+ function resolveReplayActiveTurnCount(options = {}) {
23
+ const savedActiveTurnCount = options.activeTurnCount;
24
+ if (
25
+ options.loadedExisting === true
26
+ && Number.isSafeInteger(options.totalLines)
27
+ && options.totalLines > 0
28
+ && Number.isSafeInteger(savedActiveTurnCount)
29
+ && savedActiveTurnCount > 0
30
+ ) {
31
+ return savedActiveTurnCount;
32
+ }
33
+
34
+ const fallbackTurnCount = options.fallbackTurnCount;
35
+ return Number.isSafeInteger(fallbackTurnCount) && fallbackTurnCount > 0
36
+ ? fallbackTurnCount
37
+ : undefined;
38
+ }
39
+
40
+ module.exports = { replayWindowStartIndex, resolveReplayActiveTurnCount };
package/blun.mjs CHANGED
@@ -53,7 +53,7 @@ const { clearCompactionModelConfig, normalizeCompactionModelSelection, resolveCo
53
53
  const { createAgentResumeSnapshot, restoreAgentResumeSnapshot } = agentResumeSnapshot;
54
54
  const { loadResumeCheckpoint, writeResumeCheckpoint } = sessionResumeCheckpoint;
55
55
  const { SessionScrollbackArchive, sessionScrollbackArchiveDirectory } = sessionScrollbackArchive;
56
- const { replayWindowStartIndex } = sessionReplayWindowPolicy;
56
+ const { replayWindowStartIndex, resolveReplayActiveTurnCount } = sessionReplayWindowPolicy;
57
57
  const { globPatternError } = globPatternPolicy;
58
58
  const { unsupportedUserHomePathError } = userHomePathPolicy;
59
59
  import { EventEmitter as EventEmitter$1 } from "node:events";
@@ -506817,7 +506817,12 @@ var ScrollbackController = class {
506817
506817
  reset: !resumeCheckpointRestored,
506818
506818
  reuse: resumeCheckpointRestored
506819
506819
  });
506820
- const activeTurnCount = resumeCheckpointRestored && loadedExisting && buffer.totalLines > 0 ? buffer.activeTurnCount : void 0;
506820
+ const activeTurnCount = resolveReplayActiveTurnCount({
506821
+ loadedExisting,
506822
+ totalLines: buffer.totalLines,
506823
+ activeTurnCount: buffer.activeTurnCount,
506824
+ fallbackTurnCount: TRANSCRIPT_MAX_TURNS
506825
+ });
506821
506826
  this.suppressReplayArchiveWrites = resumeCheckpointRestored && loadedExisting && activeTurnCount === void 0;
506822
506827
  return activeTurnCount;
506823
506828
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.484",
3
+ "version": "9.1.485",
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": {