blun-king-cli 3.0.0 → 3.0.2
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/bin/blun.js +11 -31
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -293,7 +293,6 @@ async function streamAnswer(answer, meta) {
|
|
|
293
293
|
function printUserMessage(msg) {
|
|
294
294
|
console.log("");
|
|
295
295
|
console.log(C.brightBlue + C.bold + " " + BOX.user + " Du" + C.reset);
|
|
296
|
-
console.log(C.brightBlue + " " + BOX.h.repeat(40) + C.reset);
|
|
297
296
|
console.log(C.brightWhite + " " + msg + C.reset);
|
|
298
297
|
}
|
|
299
298
|
|
|
@@ -577,23 +576,13 @@ async function handleCommand(input) {
|
|
|
577
576
|
async function sendChat(message) {
|
|
578
577
|
try {
|
|
579
578
|
printUserMessage(message);
|
|
580
|
-
// Animated thinking
|
|
579
|
+
// Animated thinking
|
|
581
580
|
var dots = 0;
|
|
582
581
|
var thinkFrames = ["thinking", "thinking.", "thinking..", "thinking..."];
|
|
583
|
-
console.log(""); // line for thinking text
|
|
584
582
|
var thinkTimer = setInterval(function() {
|
|
585
|
-
process.stdout.write("\x1b[s"); // save cursor
|
|
586
|
-
// Move to thinking line (above the UI)
|
|
587
|
-
if (uiStartRow > 0) process.stdout.write("\x1b[" + (uiStartRow + 1) + "A");
|
|
588
583
|
process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " " + thinkFrames[dots % 4] + " " + C.reset);
|
|
589
|
-
process.stdout.write("\x1b[u"); // restore cursor
|
|
590
584
|
dots++;
|
|
591
585
|
}, 300);
|
|
592
|
-
// Redraw input box below thinking line
|
|
593
|
-
processing = false;
|
|
594
|
-
uiStartRow = -1;
|
|
595
|
-
drawPrompt();
|
|
596
|
-
processing = true;
|
|
597
586
|
|
|
598
587
|
var resp = await apiCall("POST", "/chat", {
|
|
599
588
|
message: message,
|
|
@@ -601,10 +590,7 @@ async function sendChat(message) {
|
|
|
601
590
|
});
|
|
602
591
|
|
|
603
592
|
clearInterval(thinkTimer);
|
|
604
|
-
|
|
605
|
-
eraseUI();
|
|
606
|
-
// Clear thinking line
|
|
607
|
-
process.stdout.write("\x1b[1A\r\x1b[2K");
|
|
593
|
+
process.stdout.write("\r\x1b[2K");
|
|
608
594
|
|
|
609
595
|
if (resp.status !== 200) {
|
|
610
596
|
printError(resp.data.error || "API Error " + resp.status);
|
|
@@ -1524,19 +1510,11 @@ async function cmdAgent(args) {
|
|
|
1524
1510
|
var context = [];
|
|
1525
1511
|
var workdir = config.workdir;
|
|
1526
1512
|
|
|
1527
|
-
// Show thinking
|
|
1528
|
-
console.log("");
|
|
1513
|
+
// Show thinking animation
|
|
1529
1514
|
var thinkTimer = setInterval(function() {
|
|
1530
|
-
process.stdout.write("\x1b[s");
|
|
1531
|
-
if (uiStartRow > 0) process.stdout.write("\x1b[" + (uiStartRow + 1) + "A");
|
|
1532
1515
|
var phase = loop === 0 ? "planning" : "step " + loop + "/" + maxLoops;
|
|
1533
1516
|
process.stdout.write("\r\x1b[2K" + C.dim + " " + BOX.bot + " [" + phase + "] working..." + C.reset);
|
|
1534
|
-
process.stdout.write("\x1b[u");
|
|
1535
1517
|
}, 300);
|
|
1536
|
-
processing = false;
|
|
1537
|
-
uiStartRow = -1;
|
|
1538
|
-
drawPrompt();
|
|
1539
|
-
processing = true;
|
|
1540
1518
|
|
|
1541
1519
|
while (loop < maxLoops) {
|
|
1542
1520
|
loop++;
|
|
@@ -1550,8 +1528,7 @@ async function cmdAgent(args) {
|
|
|
1550
1528
|
|
|
1551
1529
|
if (resp.status !== 200) {
|
|
1552
1530
|
clearInterval(thinkTimer);
|
|
1553
|
-
|
|
1554
|
-
process.stdout.write("\x1b[1A\r\x1b[2K");
|
|
1531
|
+
process.stdout.write("\r\x1b[2K");
|
|
1555
1532
|
printError("Step " + loop + " failed: " + (resp.data.error || "Error"));
|
|
1556
1533
|
break;
|
|
1557
1534
|
}
|
|
@@ -1630,8 +1607,7 @@ async function cmdAgent(args) {
|
|
|
1630
1607
|
}
|
|
1631
1608
|
|
|
1632
1609
|
clearInterval(thinkTimer);
|
|
1633
|
-
|
|
1634
|
-
process.stdout.write("\x1b[1A\r\x1b[2K");
|
|
1610
|
+
process.stdout.write("\r\x1b[2K");
|
|
1635
1611
|
|
|
1636
1612
|
// Final summary
|
|
1637
1613
|
console.log("");
|
|
@@ -2879,8 +2855,12 @@ async function main() {
|
|
|
2879
2855
|
runHook("post", detected.split(/\s+/)[0].slice(1));
|
|
2880
2856
|
} else if (sessionMode === "agent") {
|
|
2881
2857
|
// Agent mode: detect if question or task
|
|
2882
|
-
var
|
|
2883
|
-
|
|
2858
|
+
var trimmed = input.trim();
|
|
2859
|
+
var isChat = trimmed.length < 15 || // short messages = chat
|
|
2860
|
+
/^(hi|hallo|hey|moin|servus|yo|sup|ok|ja|nein|danke|thanks|bye|tschüss|ciao)/i.test(trimmed) ||
|
|
2861
|
+
/^(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) ||
|
|
2862
|
+
/\?$/.test(trimmed);
|
|
2863
|
+
if (isChat) {
|
|
2884
2864
|
await sendChat(input);
|
|
2885
2865
|
} else {
|
|
2886
2866
|
await cmdAgent(input);
|