blun-king-cli 7.2.0 → 7.2.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/lib/chat.js +13 -12
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -40,7 +40,7 @@ var SLASH_COMMANDS = [
|
|
|
40
40
|
var slashNames = SLASH_COMMANDS.map(function (c) { return c[0]; });
|
|
41
41
|
|
|
42
42
|
// ── Layout Constants ─────────────────────────────────────
|
|
43
|
-
var INPUT_PANEL_HEIGHT =
|
|
43
|
+
var INPUT_PANEL_HEIGHT = 7; // 2 gap + top-frame + input + blank + status + bottom-frame
|
|
44
44
|
|
|
45
45
|
function getRows() { return process.stdout.rows || 24; }
|
|
46
46
|
function getCols() { return process.stdout.columns || 80; }
|
|
@@ -102,8 +102,8 @@ function startChat() {
|
|
|
102
102
|
var rows = getRows();
|
|
103
103
|
var cols = getCols();
|
|
104
104
|
var t = ui.getTheme();
|
|
105
|
-
var panelTop = rows - INPUT_PANEL_HEIGHT +
|
|
106
|
-
var inner =
|
|
105
|
+
var panelTop = rows - INPUT_PANEL_HEIGHT + 3; // +3 to leave 2 empty rows at top of panel area
|
|
106
|
+
var inner = cols - 2;
|
|
107
107
|
|
|
108
108
|
// Permission label
|
|
109
109
|
var perm = settings.permissionMode || "normal";
|
|
@@ -144,9 +144,10 @@ function startChat() {
|
|
|
144
144
|
process.stdout.write(cursorTo(panelTop + 2, 1) + clearLine());
|
|
145
145
|
process.stdout.write(t.frame("│") + " ".repeat(inner) + t.frame("│"));
|
|
146
146
|
|
|
147
|
-
// Row 4: Status line
|
|
147
|
+
// Row 4: Status line — pad to right border
|
|
148
148
|
process.stdout.write(cursorTo(panelTop + 3, 1) + clearLine());
|
|
149
149
|
process.stdout.write(t.frame("│ ") + statusLine);
|
|
150
|
+
process.stdout.write(cursorTo(panelTop + 3, cols) + t.frame("│"));
|
|
150
151
|
|
|
151
152
|
// Row 5: Bottom frame
|
|
152
153
|
process.stdout.write(cursorTo(panelTop + 4, 1) + clearLine());
|
|
@@ -183,6 +184,8 @@ function startChat() {
|
|
|
183
184
|
// ── Process command ──────────────────────────────────
|
|
184
185
|
function processCommand(input) {
|
|
185
186
|
if (!input) return;
|
|
187
|
+
// Case-insensitive commands
|
|
188
|
+
if (input.startsWith("/")) input = input.toLowerCase();
|
|
186
189
|
|
|
187
190
|
// ── Commands ───────────────────────────────────
|
|
188
191
|
if (input === "/exit" || input === "/quit") {
|
|
@@ -387,13 +390,7 @@ function startChat() {
|
|
|
387
390
|
output.push(" " + lines[i]);
|
|
388
391
|
}
|
|
389
392
|
|
|
390
|
-
|
|
391
|
-
var metaParts = [];
|
|
392
|
-
metaParts.push(chalk.bgCyan.black(" " + (settings.model || "auto") + " "));
|
|
393
|
-
if (tokTotal) metaParts.push(chalk.dim("tokens:" + ui.formatNumber(tokTotal)));
|
|
394
|
-
metaParts.push(chalk.dim("total:" + ui.formatNumber(ui.getStats().tokens)));
|
|
395
|
-
if (settings.costVisibility !== false) metaParts.push(chalk.dim(ui.estimateCost(ui.getStats().tokens, settings.model)));
|
|
396
|
-
output.push(" " + metaParts.join(chalk.dim(" │ ")));
|
|
393
|
+
output.push("");
|
|
397
394
|
output.push("");
|
|
398
395
|
|
|
399
396
|
printToScrollArea(output.join("\n"));
|
|
@@ -460,8 +457,12 @@ function startChat() {
|
|
|
460
457
|
// Reset scroll region for inquirer to work properly
|
|
461
458
|
var rows = getRows();
|
|
462
459
|
process.stdout.write(setScrollRegion(1, rows));
|
|
463
|
-
process.
|
|
460
|
+
process.stdout.write(cursorTo(rows - INPUT_PANEL_HEIGHT, 1));
|
|
461
|
+
process.stdout.write(showCursor());
|
|
462
|
+
try { process.stdin.setRawMode(false); } catch (e) {}
|
|
464
463
|
process.stdin.removeAllListeners("data");
|
|
464
|
+
process.stdin.pause();
|
|
465
|
+
process.stdin.resume();
|
|
465
466
|
|
|
466
467
|
fn(function () {
|
|
467
468
|
// Re-enter TUI mode
|