blun-king-cli 3.0.1 → 3.0.3

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 +40 -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,17 +575,28 @@ 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);
594
+ // Redraw input box below thinking line so user sees the prompt
595
+ if (_globalDrawPrompt) {
596
+ processing = false;
597
+ _globalDrawPrompt();
598
+ processing = true;
599
+ }
586
600
 
587
601
  var resp = await apiCall("POST", "/chat", {
588
602
  message: message,
@@ -1510,11 +1524,17 @@ async function cmdAgent(args) {
1510
1524
  var context = [];
1511
1525
  var workdir = config.workdir;
1512
1526
 
1513
- // Show thinking animation
1527
+ // Show thinking animation + keep input box
1528
+ console.log(""); // space for status
1514
1529
  var thinkTimer = setInterval(function() {
1515
1530
  var phase = loop === 0 ? "planning" : "step " + loop + "/" + maxLoops;
1516
1531
  process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " [" + phase + "] working..." + C.reset);
1517
1532
  }, 300);
1533
+ if (_globalDrawPrompt) {
1534
+ processing = false;
1535
+ _globalDrawPrompt();
1536
+ processing = true;
1537
+ }
1518
1538
 
1519
1539
  while (loop < maxLoops) {
1520
1540
  loop++;
@@ -2770,6 +2790,7 @@ async function main() {
2770
2790
  }
2771
2791
 
2772
2792
  function drawPrompt() {
2793
+ _globalDrawPrompt = drawPrompt; // expose globally
2773
2794
  if (processing) return;
2774
2795
  console.log(""); // spacing
2775
2796
  uiStartRow = -1;
@@ -2855,8 +2876,12 @@ async function main() {
2855
2876
  runHook("post", detected.split(/\s+/)[0].slice(1));
2856
2877
  } else if (sessionMode === "agent") {
2857
2878
  // Agent mode: detect if question or task
2858
- var isQuestion = /^(wo |was |wie |wer |wann |warum |kannst|hast|ist |sind |where|what|how|who|when|why|can you|do you|is |are |\?$)/i.test(input.trim());
2859
- if (isQuestion) {
2879
+ var trimmed = input.trim();
2880
+ var isChat = trimmed.length < 15 || // short messages = chat
2881
+ /^(hi|hallo|hey|moin|servus|yo|sup|ok|ja|nein|danke|thanks|bye|tschüss|ciao)/i.test(trimmed) ||
2882
+ /^(wo |was |wie |wer |wann |warum |kannst|hast|ist |sind |where|what|how|who|when|why|can you|do you|is |are )/i.test(trimmed) ||
2883
+ /\?$/.test(trimmed);
2884
+ if (isChat) {
2860
2885
  await sendChat(input);
2861
2886
  } else {
2862
2887
  await cmdAgent(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "BLUN King CLI — Premium KI Console",
5
5
  "bin": {
6
6
  "blun": "./bin/blun.js"