blun-king-cli 3.0.2 → 3.0.4

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.
Files changed (2) hide show
  1. package/bin/blun.js +23 -15
  2. package/package.json +1 -1
package/bin/blun.js CHANGED
@@ -274,18 +274,21 @@ async function streamAnswer(answer, meta) {
274
274
  else if (line.match(/^\s*\d+\.\s/)) { var m = line.match(/^(\s*\d+\.)\s(.*)/); prefix = " " + C.yellow + m[1] + C.reset + " "; text = m[2]; }
275
275
  else if (line.trim() === "") { console.log(""); continue; }
276
276
 
277
- // Stream words
278
- var words = text.split(" ");
279
- process.stdout.write(prefix);
280
- for (var w = 0; w < words.length; w++) {
281
- var word = words[w];
282
- // Inline formatting
283
- word = word.replace(/\*\*(.+?)\*\*/g, C.bold + C.brightWhite + "$1" + C.reset);
284
- word = word.replace(/`(.+?)`/g, C.cyan + "$1" + C.reset);
285
- process.stdout.write(word + (w < words.length - 1 ? " " : ""));
286
- await new Promise(function(r) { setTimeout(r, delay); });
277
+ // Stream words with word-wrap
278
+ var wrappedLines = wordWrap(text, 4);
279
+ for (var wl = 0; wl < wrappedLines.length; wl++) {
280
+ var words = wrappedLines[wl].split(" ");
281
+ process.stdout.write(wl === 0 ? prefix : " ");
282
+ for (var w = 0; w < words.length; w++) {
283
+ var word = words[w];
284
+ // Inline formatting
285
+ word = word.replace(/\*\*(.+?)\*\*/g, C.bold + C.brightWhite + "$1" + C.reset);
286
+ word = word.replace(/`(.+?)`/g, C.cyan + "$1" + C.reset);
287
+ process.stdout.write(word + (w < words.length - 1 ? " " : ""));
288
+ await new Promise(function(r) { setTimeout(r, delay); });
289
+ }
290
+ process.stdout.write((wl === wrappedLines.length - 1 ? color : "") + "\n");
287
291
  }
288
- process.stdout.write(color + "\n");
289
292
  }
290
293
  console.log("");
291
294
  }
@@ -572,18 +575,22 @@ async function handleCommand(input) {
572
575
  }
573
576
  }
574
577
 
578
+ // ── Global UI bridge (set by interactive mode) ──
579
+ var _globalDrawPrompt = null;
580
+ var _globalEraseUI = null;
581
+
575
582
  // ── Chat ──
576
583
  async function sendChat(message) {
577
584
  try {
578
585
  printUserMessage(message);
579
- // Animated thinking
586
+ // Animated thinking + redraw input box
580
587
  var dots = 0;
581
588
  var thinkFrames = ["thinking", "thinking.", "thinking..", "thinking..."];
589
+ console.log(""); // space for thinking text
582
590
  var thinkTimer = setInterval(function() {
583
591
  process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " " + thinkFrames[dots % 4] + " " + C.reset);
584
592
  dots++;
585
593
  }, 300);
586
-
587
594
  var resp = await apiCall("POST", "/chat", {
588
595
  message: message,
589
596
  history: chatHistory.slice(-10)
@@ -1510,12 +1517,12 @@ async function cmdAgent(args) {
1510
1517
  var context = [];
1511
1518
  var workdir = config.workdir;
1512
1519
 
1513
- // Show thinking animation
1520
+ // Show thinking animation + keep input box
1521
+ console.log(""); // space for status
1514
1522
  var thinkTimer = setInterval(function() {
1515
1523
  var phase = loop === 0 ? "planning" : "step " + loop + "/" + maxLoops;
1516
1524
  process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " [" + phase + "] working..." + C.reset);
1517
1525
  }, 300);
1518
-
1519
1526
  while (loop < maxLoops) {
1520
1527
  loop++;
1521
1528
 
@@ -2770,6 +2777,7 @@ async function main() {
2770
2777
  }
2771
2778
 
2772
2779
  function drawPrompt() {
2780
+ _globalDrawPrompt = drawPrompt; // expose globally
2773
2781
  if (processing) return;
2774
2782
  console.log(""); // spacing
2775
2783
  uiStartRow = -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "BLUN King CLI — Premium KI Console",
5
5
  "bin": {
6
6
  "blun": "./bin/blun.js"