blun-king-cli 2.8.0 → 2.9.0
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 +49 -0
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -2437,6 +2437,52 @@ async function main() {
|
|
|
2437
2437
|
printInfo("Run: blun setup — to configure");
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
|
+
// Mode selection at startup
|
|
2441
|
+
var sessionMode = "chat"; // chat or agent
|
|
2442
|
+
if (!process.argv.includes("--agent") && !process.argv.includes("--chat")) {
|
|
2443
|
+
console.log("");
|
|
2444
|
+
console.log(C.brightWhite + C.bold + " How do you want to work?" + C.reset);
|
|
2445
|
+
console.log("");
|
|
2446
|
+
var modeOptions = [
|
|
2447
|
+
{ label: "Chat — talk back and forth", mode: "chat" },
|
|
2448
|
+
{ label: "Agent — give a goal, I do the rest autonomously", mode: "agent" }
|
|
2449
|
+
];
|
|
2450
|
+
var modeSel = 0;
|
|
2451
|
+
var modeChoice = await new Promise(function(resolve) {
|
|
2452
|
+
function renderModeMenu() {
|
|
2453
|
+
process.stdout.write("\x1b[2A\r");
|
|
2454
|
+
modeOptions.forEach(function(opt, i) {
|
|
2455
|
+
var prefix = i === modeSel ? C.green + C.bold + " \u276F " : " ";
|
|
2456
|
+
var color = i === modeSel ? C.brightWhite + C.bold : C.gray;
|
|
2457
|
+
process.stdout.write("\x1b[2K" + prefix + color + (i + 1) + ". " + opt.label + C.reset + "\n");
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
console.log(""); console.log("");
|
|
2461
|
+
renderModeMenu();
|
|
2462
|
+
process.stdin.setRawMode(true);
|
|
2463
|
+
process.stdin.resume();
|
|
2464
|
+
process.stdin.setEncoding("utf8");
|
|
2465
|
+
function onKey(key) {
|
|
2466
|
+
if (key === "\x1b[A") { modeSel = 0; renderModeMenu(); return; }
|
|
2467
|
+
if (key === "\x1b[B") { modeSel = 1; renderModeMenu(); return; }
|
|
2468
|
+
if (key === "1") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("chat"); return; }
|
|
2469
|
+
if (key === "2") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("agent"); return; }
|
|
2470
|
+
if (key === "\r" || key === "\n") {
|
|
2471
|
+
process.stdin.removeListener("data", onKey);
|
|
2472
|
+
process.stdin.setRawMode(false);
|
|
2473
|
+
resolve(modeOptions[modeSel].mode);
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
process.stdin.on("data", onKey);
|
|
2478
|
+
});
|
|
2479
|
+
sessionMode = modeChoice;
|
|
2480
|
+
printSuccess("Mode: " + (sessionMode === "agent" ? "Agent (autonomous)" : "Chat (interactive)"));
|
|
2481
|
+
console.log("");
|
|
2482
|
+
} else {
|
|
2483
|
+
sessionMode = process.argv.includes("--agent") ? "agent" : "chat";
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2440
2486
|
var ALL_COMMANDS = [
|
|
2441
2487
|
"/help", "/clear", "/skills", "/skill", "/search", "/learn", "/learn-url",
|
|
2442
2488
|
"/generate", "/analyze", "/score", "/eval", "/settings", "/set",
|
|
@@ -2672,6 +2718,9 @@ async function main() {
|
|
|
2672
2718
|
runHook("pre", detected.split(/\s+/)[0].slice(1));
|
|
2673
2719
|
await handleCommand(detected);
|
|
2674
2720
|
runHook("post", detected.split(/\s+/)[0].slice(1));
|
|
2721
|
+
} else if (sessionMode === "agent") {
|
|
2722
|
+
// Agent mode: auto-route to autonomous agent
|
|
2723
|
+
await cmdAgent(input);
|
|
2675
2724
|
} else {
|
|
2676
2725
|
await sendChat(input);
|
|
2677
2726
|
}
|