kovence-cli 1.0.3 → 1.3.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/tui.js CHANGED
@@ -25,8 +25,46 @@ const {
25
25
  parseSettingValue,
26
26
  } = require("./src/tui/settings_panel");
27
27
 
28
- function copyToClipboardOsc52(text, stdout = process.stdout) {
28
+ const { spawnSync } = require("node:child_process");
29
+
30
+ /**
31
+ * Copy text to system clipboard.
32
+ * Strategy (in order):
33
+ * 1. wl-copy (Wayland)
34
+ * 2. xclip (X11)
35
+ * 3. xsel (X11 fallback)
36
+ * 4. pbcopy (macOS)
37
+ * 5. OSC 52 (terminal escape — only works in Kitty / iTerm2 / WezTerm)
38
+ */
39
+ function copyToClipboard(text, stdout = process.stdout) {
29
40
  if (!text) return false;
41
+
42
+ // Try system clipboard tools silently (no shell, no PATH-injection risk).
43
+ const candidates = [];
44
+ if (process.env.WAYLAND_DISPLAY) {
45
+ candidates.push({ cmd: "wl-copy", args: [] });
46
+ }
47
+ if (process.env.DISPLAY) {
48
+ candidates.push({ cmd: "xclip", args: ["-selection", "clipboard"] });
49
+ candidates.push({ cmd: "xsel", args: ["--clipboard", "--input"] });
50
+ }
51
+ candidates.push({ cmd: "pbcopy", args: [] }); // macOS
52
+
53
+ for (const { cmd, args } of candidates) {
54
+ try {
55
+ const result = spawnSync(cmd, args, {
56
+ input: text,
57
+ encoding: "utf8",
58
+ stdio: ["pipe", "ignore", "ignore"],
59
+ timeout: 1000,
60
+ });
61
+ if (result.status === 0) return true;
62
+ } catch {
63
+ // Not found or failed — try next.
64
+ }
65
+ }
66
+
67
+ // OSC 52 fallback (terminal must support it).
30
68
  const b64 = Buffer.from(text, "utf8").toString("base64");
31
69
  stdout.write(`\x1b]52;c;${b64}\x07`);
32
70
  return true;
@@ -38,7 +76,7 @@ function styleInlineMarkdown(line, ansi) {
38
76
  .replace(/\*\*([^*]+)\*\*/g, `${ansi.bold}${ansi.amber}$1${ansi.reset}${ansi.white}`);
39
77
  }
40
78
 
41
- function formatAssistantLines(text, innerW, ansi, isStreaming = false) {
79
+ function formatAssistantLines(text, innerW, ansi, isStreaming = false, animTick = 0) {
42
80
  const out = [];
43
81
  const rawLines = String(text || "").split(/\r?\n/);
44
82
  let inCode = false;
@@ -76,10 +114,16 @@ function formatAssistantLines(text, innerW, ansi, isStreaming = false) {
76
114
  }
77
115
 
78
116
  if (isStreaming) {
117
+ // Animated braille spinner — 6 frames cycling every render tick.
118
+ const SPIN = ["⠇", "⠋", "⠙", "⠸", "⠴", "⠦"];
119
+ const dot = SPIN[animTick % SPIN.length];
79
120
  if (inCode) {
80
- out.push(` ${ansi.gray}│ ${ansi.amber}${ansi.dim}writing... ▌${ansi.reset}`);
121
+ out.push(` ${ansi.gray}│ ${ansi.amber}${ansi.dim}${dot} writing...${ansi.reset}`);
81
122
  } else if (!text || text.endsWith("\n")) {
82
- out.push(` ${ansi.orange}┃ ${ansi.amber}${ansi.dim}writing... ▌${ansi.reset}`);
123
+ out.push(` ${ansi.orange}┃ ${ansi.amber}${ansi.dim}${dot} writing...${ansi.reset}`);
124
+ } else {
125
+ // Mid-line: append animated dot inline
126
+ out[out.length - 1] = (out[out.length - 1] || "") + ` ${ansi.dim}${dot}${ansi.reset}`;
83
127
  }
84
128
  }
85
129
 
@@ -209,6 +253,7 @@ class KovenceTUI {
209
253
  provider: "default",
210
254
  providerType: "openai",
211
255
  model: "",
256
+ reasoning: "off",
212
257
  ctxText: "",
213
258
  agentMode: "default",
214
259
  colorScheme: "amber",
@@ -232,6 +277,10 @@ class KovenceTUI {
232
277
  this.onKey = this.onKey.bind(this);
233
278
  this.onRawData = this.onRawData.bind(this);
234
279
  this.onResize = () => this.scheduleRender();
280
+
281
+ // Spinner/animation tick — increments every 150 ms while active.
282
+ this.animTick = 0;
283
+ this._animTimer = null;
235
284
  }
236
285
 
237
286
  getPalette() {
@@ -266,7 +315,7 @@ class KovenceTUI {
266
315
  this.flashNotice("No AI response to copy yet");
267
316
  return false;
268
317
  }
269
- copyToClipboardOsc52(lastAi.text, this.stdout);
318
+ copyToClipboard(lastAi.text, this.stdout);
270
319
  this.flashNotice(`Copied last response (${lastAi.text.length} chars)`);
271
320
  return true;
272
321
  }
@@ -392,7 +441,7 @@ class KovenceTUI {
392
441
  }
393
442
  const text = this.extractSelectedText();
394
443
  if (text) {
395
- copyToClipboardOsc52(text, this.stdout);
444
+ copyToClipboard(text, this.stdout);
396
445
  this.flashNotice(`Copied ${text.length} chars to clipboard`);
397
446
  }
398
447
  this.scheduleRender();
@@ -526,6 +575,23 @@ class KovenceTUI {
526
575
  this.stdin.on("data", this.onRawData);
527
576
  }
528
577
  this.stdout.on("resize", this.onResize);
578
+ // Start animation timer for spinner/dot animation.
579
+ this._animTimer = setInterval(() => {
580
+ this.animTick++;
581
+ // Re-render if there is an active write block OR a streaming assistant block.
582
+ const hasActive = this.blocks.some((b) => (b.writeStats && !b.writeStats.done) || b._streaming);
583
+ if (hasActive) {
584
+ // Invalidate cache for all animated blocks so spinner dots re-render.
585
+ for (const b of this.blocks) {
586
+ if ((b.writeStats && !b.writeStats.done) || b._streaming) {
587
+ b._ver = (b._ver || 0) + 1;
588
+ b._cache = null;
589
+ }
590
+ }
591
+ this.scheduleRender();
592
+ }
593
+ }, 150);
594
+ this._animTimer.unref?.();
529
595
  this.render();
530
596
  }
531
597
 
@@ -545,6 +611,10 @@ class KovenceTUI {
545
611
  this.stdin.setRawMode(false);
546
612
  } catch {}
547
613
  }
614
+ if (this._animTimer) {
615
+ clearInterval(this._animTimer);
616
+ this._animTimer = null;
617
+ }
548
618
  this.stdout.write(CONTROL_SEQ.keysOff + CONTROL_SEQ.mouseOff + CONTROL_SEQ.showCur + CONTROL_SEQ.altOff);
549
619
  }
550
620
 
@@ -632,14 +702,31 @@ class KovenceTUI {
632
702
  return true;
633
703
  }
634
704
 
635
- openPicker(title, items, { initialIdx = 0, hint = "↑/↓ select · Enter open · d delete · Esc close" } = {}) {
705
+ openPicker(
706
+ title,
707
+ items,
708
+ {
709
+ initialIdx = 0,
710
+ hint = "↑/↓ select · Enter open · d delete · Esc close",
711
+ multiSelect = false,
712
+ selectedIds = null,
713
+ } = {}
714
+ ) {
636
715
  return new Promise((resolve) => {
637
716
  let safeIdx = Math.max(0, Math.min(Number(initialIdx) || 0, Math.max(0, items.length - 1)));
638
717
  if (items[safeIdx]?.type === "header") {
639
718
  const nextSelectable = items.findIndex((x) => x.type !== "header");
640
719
  if (nextSelectable >= 0) safeIdx = nextSelectable;
641
720
  }
642
- this.picker = { title, items, selIdx: safeIdx, hint, resolve };
721
+ this.picker = {
722
+ title,
723
+ items,
724
+ selIdx: safeIdx,
725
+ hint,
726
+ multiSelect: Boolean(multiSelect),
727
+ selectedIds: selectedIds instanceof Set ? new Set(selectedIds) : new Set(),
728
+ resolve,
729
+ };
643
730
  this.scheduleRender();
644
731
  });
645
732
  }
@@ -693,7 +780,9 @@ class KovenceTUI {
693
780
  blockLines.push("");
694
781
  } else if (b.kind === "assistant") {
695
782
  blockLines.push(` ${ansi.orange}${ansi.bold}◆ KOVENCE CLI${ansi.reset}`);
696
- blockLines.push(...formatAssistantLines(b.text, innerW, ansi, Boolean(b._streaming)));
783
+ blockLines.push(
784
+ ...formatAssistantLines(b.text, innerW, ansi, Boolean(b._streaming), this.animTick)
785
+ );
697
786
  } else if (b.kind === "thinking") {
698
787
  blockLines.push(` ${ansi.orange}${ansi.bold}◆ KOVENCE CLI${ansi.reset}`);
699
788
  for (const wl of wrapped) {
@@ -701,8 +790,27 @@ class KovenceTUI {
701
790
  }
702
791
  } else if (b.kind === "tool") {
703
792
  if (b.collapsible) {
793
+ const ws = b.writeStats;
794
+ // Show write stats always (even after done) as a summary.
795
+ // isActiveWrite controls the spinner animation only.
796
+ const hasWriteStats = Boolean(ws);
797
+ const isActiveWrite = ws && !ws.done;
798
+
799
+ // --- Animated write indicator dots ---
800
+ // DOT_FRAMES cycles through 4 states every 150 ms (animTick steps each interval).
801
+ const DOT_FRAMES = ["⠇", "⠋", "⠙", "⠸", "⠴", "⠦"];
802
+ const dot = DOT_FRAMES[this.animTick % DOT_FRAMES.length];
803
+
704
804
  const arrow = b.expanded ? "▾" : "▸";
705
- const hint = b.expanded ? " (click to hide)" : " (click for live details)";
805
+ // For active writes, show expand toggle; for others, show generic hint.
806
+ const hint = hasWriteStats
807
+ ? b.expanded
808
+ ? " (click or Ctrl+O to collapse)"
809
+ : " ▸ expand for live preview"
810
+ : b.expanded
811
+ ? " (click or Ctrl+O to hide)"
812
+ : " (click for live details)";
813
+
706
814
  for (let i = 0; i < wrapped.length; i++) {
707
815
  const wl = wrapped[i];
708
816
  if (i === 0) {
@@ -714,7 +822,66 @@ class KovenceTUI {
714
822
  }
715
823
  }
716
824
  const detailW = Math.max(12, innerW - 6);
717
- if (b.expanded) {
825
+
826
+ if (hasWriteStats) {
827
+ // --- Stats line: animated real-time counter during write, ✓ summary when done ---
828
+ // Use firstChunkAt for accurate tok/s (excludes LLM think time before streaming)
829
+ const t0 = ws.firstChunkAt || ws.startTime;
830
+ const elapsedSec = Math.max(0.05, (Date.now() - t0) / 1000);
831
+ // Rough token estimate: ~4 chars per token (show at least 1 token as soon as chars stream)
832
+ const tokEst = ws.totalChars > 0 ? Math.max(1, Math.round(ws.totalChars / 4)) : 0;
833
+ const rawTokSec = tokEst / elapsedSec;
834
+ // Smooth: only show speed once we have at least a little data
835
+ const tokSec = tokEst > 8 ? Math.round(rawTokSec) : 0;
836
+ // Count current partial line (lineBuf) as a line in progress
837
+ const displayLines = ws.totalLines + (ws.lineBuf ? 1 : 0);
838
+ const statusIcon = isActiveWrite ? dot : "✓";
839
+ // During active write: show incrementing counters live
840
+ // When done: show final summary
841
+ let statsLine;
842
+ if (isActiveWrite) {
843
+ const speedStr = tokSec > 0 ? ` · ${tokSec} tok/s` : "";
844
+ statsLine = `${statusIcon} ${displayLines} lines · ~${tokEst} tokens${speedStr}`;
845
+ } else {
846
+ // Final state — use precise elapsed from first chunk to done
847
+ const finalElapsed = ws.doneAt
848
+ ? Math.max(0.05, (ws.doneAt - t0) / 1000)
849
+ : elapsedSec;
850
+ const finalSpeed = tokEst > 8 ? Math.round(tokEst / finalElapsed) : 0;
851
+ const speedStr = finalSpeed > 0 ? ` · ${finalSpeed} tok/s` : "";
852
+ statsLine = `${statusIcon} ${ws.totalLines} lines · ~${tokEst} tokens${speedStr}`;
853
+ }
854
+ blockLines.push(
855
+ ` ${ansi.gray}│ ${ansi.amber}${clipToWidth(statsLine, detailW)}${ansi.reset}`
856
+ );
857
+
858
+ if (b.expanded) {
859
+ // Live Path line
860
+ const livePath = ws.filePath || (ws.dir ? `${ws.dir}/` : "");
861
+ if (livePath) {
862
+ const pathLine = `📄 Live Path: ${livePath}`;
863
+ blockLines.push(
864
+ ` ${ansi.gray}│ ${ansi.dim}${ansi.gray}${clipToWidth(pathLine, detailW)}${ansi.reset}`
865
+ );
866
+ }
867
+ // 5-line window of last written code (auto-scroll: always last 5 lines)
868
+ const preview = (ws.currentPreview || ws.previewLines || []).slice(-5);
869
+ if (preview.length) {
870
+ blockLines.push(
871
+ ` ${ansi.gray}│ ${ansi.dim}${ansi.gray}${"─".repeat(Math.min(detailW, 40))}${ansi.reset}`
872
+ );
873
+ for (const pl of preview) {
874
+ blockLines.push(
875
+ ` ${ansi.gray}│ ${ansi.dim}${ansi.gray}${clipToWidth(pl, detailW)}${ansi.reset}`
876
+ );
877
+ }
878
+ } else {
879
+ blockLines.push(
880
+ ` ${ansi.gray}│ ${ansi.dim}${ansi.gray}${clipToWidth("… waiting for written tokens …", detailW)}${ansi.reset}`
881
+ );
882
+ }
883
+ }
884
+ } else if (b.expanded) {
718
885
  const visDetails = (b.details || []).slice(-16);
719
886
  if (!visDetails.length) {
720
887
  const emptyMsg = b.statusLine || "… waiting for live command output …";
@@ -834,7 +1001,7 @@ class KovenceTUI {
834
1001
 
835
1002
  const pickerRows = this.picker ? Math.min(10, this.picker.items.length) + 2 : 0;
836
1003
  const sugRows = suggestions.length;
837
- const composerRows = 3 + modalLines.length + visCompLines.length;
1004
+ const composerRows = 5 + modalLines.length + visCompLines.length; // +1 blank sep, +2 boxPad, +2 footer lines
838
1005
  const headerRows = 2;
839
1006
  const viewHeight = Math.max(4, rows - headerRows - sugRows - pickerRows - composerRows);
840
1007
 
@@ -910,6 +1077,19 @@ class KovenceTUI {
910
1077
  out.push(
911
1078
  `${ansi.topBg}${ansi.orange}${ansi.bold}${padRight(titleText, displayWidth(titleText), cols)}${ansi.reset}\x1b[K\n`
912
1079
  );
1080
+ const visPickerItems = this.picker.items.slice(pStart, pStart + maxVisible);
1081
+ const maxDescW = Math.min(30, Math.max(0, ...visPickerItems.map((x) => displayWidth(x?.desc || ""))));
1082
+ const availLeftW = Math.max(24, cols - (maxDescW > 0 ? maxDescW + 3 : 2));
1083
+ const formatPickerLabel = (it) => {
1084
+ if (this.picker.multiSelect && it.type !== "header" && it.type !== "skip" && it.type !== "action") {
1085
+ const mark = this.picker.selectedIds?.has(it.id) ? "[✓] " : "[ ] ";
1086
+ return ` ${mark}${it.label}`;
1087
+ }
1088
+ return ` ${it.label}`;
1089
+ };
1090
+ const naturalLeftW = Math.max(22, ...visPickerItems.map((x) => displayWidth(formatPickerLabel(x))));
1091
+ const leftColW = Math.min(availLeftW, naturalLeftW);
1092
+
913
1093
  for (let i = 0; i < maxVisible; i++) {
914
1094
  const idx = pStart + i;
915
1095
  const it = this.picker.items[idx];
@@ -921,7 +1101,9 @@ class KovenceTUI {
921
1101
  continue;
922
1102
  }
923
1103
  const active = idx === this.picker.selIdx;
924
- const left = clipToWidth(` ${it.label.padEnd(22)}`, Math.min(24, cols));
1104
+ const rawLeftLabel = formatPickerLabel(it);
1105
+ const clippedLeft = clipToWidth(rawLeftLabel, leftColW);
1106
+ const left = padRight(clippedLeft, displayWidth(clippedLeft), leftColW);
925
1107
  const right = clipToWidth(it.desc || "", Math.max(0, cols - displayWidth(left) - 1));
926
1108
  const plainLen = displayWidth(left) + 1 + displayWidth(right);
927
1109
  const line = active
@@ -945,6 +1127,8 @@ class KovenceTUI {
945
1127
  }
946
1128
 
947
1129
  // 4) Multi-Line Bottom Composer Box
1130
+ // Blank separator line between viewport content and the composer box for breathing room.
1131
+ out.push(`\x1b[K\n`);
948
1132
  const boxPad = `${ansi.barBg}${ansi.orange}┃${" ".repeat(Math.max(0, cols - 1))}${ansi.reset}\x1b[K\n`;
949
1133
  out.push(boxPad);
950
1134
 
@@ -961,8 +1145,10 @@ class KovenceTUI {
961
1145
  const pfx = i === 0 && compStart === 0 ? promptPrefix : prefixSpace;
962
1146
  const txt = visCompLines[i];
963
1147
  const isBusy = Boolean(this.status.isBusy || this.status.busyLabel);
1148
+ // When busy: show NO placeholder text — just an empty input with cursor.
1149
+ // The busy label is already visible in the top-right header corner.
964
1150
  const defaultPh = "Type message · Shift+Enter newline · / commands...";
965
- const phText = isBusy && this.status.busyLabel ? `⏳ ${this.status.busyLabel}` : defaultPh;
1151
+ const phText = isBusy ? "" : defaultPh;
966
1152
  const showPh =
967
1153
  i === 0 &&
968
1154
  compStart === 0 &&
@@ -970,7 +1156,8 @@ class KovenceTUI {
970
1156
  !this.input &&
971
1157
  this.status.showTips !== false &&
972
1158
  cols >= 2 + displayWidth(pfx) + displayWidth(phText);
973
- const placeholder = showPh ? `${isBusy ? ansi.amber : ansi.gray}${phText}${ansi.reset}` : "";
1159
+ // Keep ansi.barBg continuous across the entire input line (never emit inner ansi.reset before padding)
1160
+ const placeholder = showPh ? `${isBusy ? ansi.amber : ansi.gray}${phText}` : "";
974
1161
  const phLen = showPh ? displayWidth(phText) : 0;
975
1162
  const linePlainLen = 2 + displayWidth(pfx) + displayWidth(txt);
976
1163
  const padComposer = Math.max(0, cols - linePlainLen - phLen);
@@ -980,8 +1167,10 @@ class KovenceTUI {
980
1167
  }
981
1168
  out.push(boxPad);
982
1169
 
983
- // 5) Bottom Footer Status & Keybinds
984
- const shortModel = this.status.model.length > 20 ? `...${this.status.model.slice(-17)}` : this.status.model;
1170
+ // 5) Bottom Footer Status & Dedicated Keyboard Shortcuts Line
1171
+ const fullModel = this.status.model || "";
1172
+ const reasoningTag =
1173
+ this.status.reasoning && this.status.reasoning !== "off" ? ` (${this.status.reasoning})` : "";
985
1174
  const apiTag = `${this.status.provider}(${this.status.providerType})`;
986
1175
  const ctxSeg = this.status.ctxText ? ` · ${this.status.ctxText}` : "";
987
1176
  const modeTag = this.status.agentMode || (this.status.auto ? "auto" : "default");
@@ -991,26 +1180,46 @@ class KovenceTUI {
991
1180
  if (this.status.activeTodos > 0) taskParts.push(`Todos:${this.status.activeTodos}`);
992
1181
  }
993
1182
  const taskSeg = taskParts.length ? ` · ${taskParts.join(" ")}` : "";
994
- const rawLeft = `Kovence CLI · Mode: ${modeTag} · ${apiTag} · ${shortModel}${ctxSeg}${taskSeg} · Tools ${this.status.tools ? "ON" : "OFF"}`;
995
- const maxLeftW = Math.max(20, cols - 2);
996
- const clampedLeft = clipToWidth(rawLeft, maxLeftW);
997
- const fullHints =
998
- this.scrollOffset > 0
999
- ? `[Scrolled +${this.scrollOffset}] Shift+Tab mode · Ctrl+Y copy · F2 select`
1000
- : `Shift+Tab mode · Ctrl+S sessions · Ctrl+, settings · Ctrl+Y copy · F2 select`;
1001
- const maxHintW = Math.max(0, cols - displayWidth(clampedLeft) - 3);
1002
- const hintsRight = maxHintW >= 12 ? clipToWidth(fullHints, maxHintW) : "";
1003
- const footerGap = hintsRight ? Math.max(1, cols - displayWidth(clampedLeft) - displayWidth(hintsRight) - 2) : 0;
1004
- const footerBrand = clampedLeft.startsWith("Kovence CLI")
1005
- ? `${ansi.orange}${ansi.bold}Kovence CLI${ansi.reset}${ansi.gray}${clampedLeft.slice(11)}`
1006
- : `${ansi.gray}${clampedLeft}`;
1007
- out.push(` ${footerBrand}${hintsRight ? `${" ".repeat(footerGap)}${hintsRight}` : ""}${ansi.reset}\x1b[K`);
1183
+ const rawStatusLine = `Kovence CLI · Mode: ${modeTag} · ${apiTag} · ${fullModel}${reasoningTag}${ctxSeg}${taskSeg} · Tools ${this.status.tools ? "ON" : "OFF"}`;
1184
+ const maxFooterW = Math.max(20, cols - 2);
1185
+ const clampedStatus = clipToWidth(rawStatusLine, maxFooterW);
1186
+ const footerBrand = clampedStatus.startsWith("Kovence CLI")
1187
+ ? `${ansi.orange}${ansi.bold}Kovence CLI${ansi.reset}${ansi.gray}${clampedStatus.slice(11)}`
1188
+ : `${ansi.gray}${clampedStatus}`;
1189
+ out.push(` ${footerBrand}${ansi.reset}\x1b[K\n`);
1190
+
1191
+ // Line 2 of footer: dedicated keyboard shortcuts bar (never hidden by long model/context status)
1192
+ const priorityShortcuts = [
1193
+ "Shift+Tab mode",
1194
+ "Ctrl+S sessions",
1195
+ "Ctrl+, settings",
1196
+ "Ctrl+Y copy",
1197
+ "F2 select",
1198
+ "Ctrl+N new",
1199
+ "Ctrl+O details",
1200
+ ];
1201
+ const scrollPrefix = this.scrollOffset > 0 ? `[Scrolled +${this.scrollOffset}] · ` : "";
1202
+ let hintText = scrollPrefix;
1203
+ for (const sc of priorityShortcuts) {
1204
+ const candidate = hintText ? `${hintText}${hintText === scrollPrefix ? "" : " · "}${sc}` : sc;
1205
+ if (displayWidth(candidate) <= maxFooterW) {
1206
+ hintText = candidate;
1207
+ }
1208
+ }
1209
+ if (!hintText || hintText === scrollPrefix) {
1210
+ hintText = clipToWidth(`${scrollPrefix}${priorityShortcuts[0]}`, maxFooterW);
1211
+ }
1212
+ const renderedHints =
1213
+ this.scrollOffset > 0 && hintText.startsWith(scrollPrefix)
1214
+ ? `${ansi.amber}${scrollPrefix.slice(0, -3)}${ansi.gray} · ${hintText.slice(scrollPrefix.length)}`
1215
+ : `${ansi.gray}${hintText}`;
1216
+ out.push(` ${renderedHints}${ansi.reset}\x1b[K`);
1008
1217
 
1009
1218
  // Exact cursor placement (accounts cleanly for wrapped modal header lines)
1010
1219
  const curLineText = compLayout.lines[compLayout.curRow] || "";
1011
1220
  const curColVis = displayWidth(curLineText.slice(0, compLayout.curCol));
1012
1221
  const inputRow =
1013
- headerRows + viewHeight + pickerRows + sugRows + 2 + modalLines.length + (compLayout.curRow - compStart);
1222
+ headerRows + viewHeight + pickerRows + sugRows + 3 + modalLines.length + (compLayout.curRow - compStart);
1014
1223
  const inputCol = Math.min(cols, 2 + displayWidth(promptPrefix) + curColVis + 1);
1015
1224
  out.push(`\x1b[${inputRow};${inputCol}H`, ansi.showCur);
1016
1225
 
@@ -1103,12 +1312,44 @@ class KovenceTUI {
1103
1312
  this.scheduleRender();
1104
1313
  return;
1105
1314
  }
1315
+ if (this.picker.multiSelect && (key.name === "space" || str === " ")) {
1316
+ const chosen = items[this.picker.selIdx];
1317
+ if (chosen && chosen.type !== "header" && chosen.type !== "skip" && chosen.type !== "action") {
1318
+ if (this.picker.selectedIds.has(chosen.id)) this.picker.selectedIds.delete(chosen.id);
1319
+ else this.picker.selectedIds.add(chosen.id);
1320
+ this.scheduleRender();
1321
+ }
1322
+ return;
1323
+ }
1324
+ if (this.picker.multiSelect && str === "a") {
1325
+ const toggleable = items.filter((x) => x.type !== "header" && x.type !== "skip" && x.type !== "action");
1326
+ const allSelected = toggleable.length > 0 && toggleable.every((x) => this.picker.selectedIds.has(x.id));
1327
+ if (allSelected) {
1328
+ this.picker.selectedIds.clear();
1329
+ } else {
1330
+ for (const it of toggleable) this.picker.selectedIds.add(it.id);
1331
+ }
1332
+ this.scheduleRender();
1333
+ return;
1334
+ }
1106
1335
  if (key.name === "return" || key.name === "enter") {
1107
1336
  const chosen = items[this.picker.selIdx];
1108
1337
  if (!chosen || chosen.type === "header") return;
1338
+ const pickedIds = this.picker.multiSelect ? [...this.picker.selectedIds] : null;
1339
+ const isMulti = this.picker.multiSelect;
1109
1340
  this.picker = null;
1110
1341
  this.scheduleRender();
1111
- resolve({ action: "select", item: chosen });
1342
+ if (isMulti) {
1343
+ if (chosen.type === "skip") {
1344
+ resolve({ action: "multi", ids: [] });
1345
+ } else if (pickedIds && pickedIds.length > 0) {
1346
+ resolve({ action: "multi", ids: pickedIds });
1347
+ } else {
1348
+ resolve({ action: "select", item: chosen });
1349
+ }
1350
+ } else {
1351
+ resolve({ action: "select", item: chosen });
1352
+ }
1112
1353
  return;
1113
1354
  }
1114
1355
  if (key.name === "delete" || str === "d") {
package/ui.js CHANGED
@@ -24,7 +24,10 @@ const SLASH_COMMANDS = [
24
24
  { cmd: "/settings", desc: "Open interactive Settings panel (Ctrl+,)" },
25
25
  { cmd: "/set", desc: "Update persisted setting (/set <key> <val>)", hasArg: true },
26
26
  { cmd: "/api", desc: "Switch/add OpenAI or Anthropic custom APIs" },
27
- { cmd: "/model", desc: "Pick or switch active model (/model [name])" },
27
+ { cmd: "/model", desc: "Pick or switch active model & reasoning (/model [name])" },
28
+ { cmd: "/reasoning", desc: "Select reasoning effort (off|low|medium|high)" },
29
+ { cmd: "/skills", desc: "Manage stored markdown skills (list|add|show|rm)", hasArg: true },
30
+ { cmd: "/browser", desc: "Check/install/close headless Playwright browser runtime", hasArg: true },
28
31
  { cmd: "/sessions", desc: "Session picker / manage (list|new|switch|delete) (Ctrl+S)" },
29
32
  { cmd: "/new", desc: "Open a new isolated session (Ctrl+N)" },
30
33
  { cmd: "/retry", desc: "Retry the last failed/aborted user turn" },
@@ -76,13 +79,31 @@ const SUBCOMMAND_HINTS = {
76
79
  { fill: "/memory global rm ", desc: "Remove global memory item" },
77
80
  { fill: "/memory global clear", desc: "Clear all global memory" },
78
81
  ],
82
+ "/reasoning": [
83
+ { fill: "/reasoning off", desc: "Disable extended reasoning/thinking budget" },
84
+ { fill: "/reasoning low", desc: "Light reasoning effort" },
85
+ { fill: "/reasoning medium", desc: "Balanced reasoning effort" },
86
+ { fill: "/reasoning high", desc: "Deep reasoning effort" },
87
+ ],
88
+ "/skills": [
89
+ { fill: "/skills list", desc: "List all saved markdown skills" },
90
+ { fill: "/skills add ", desc: "<file.md> [--project] Save a markdown skill" },
91
+ { fill: "/skills new ", desc: "[title] Create a new skill interactively" },
92
+ { fill: "/skills show ", desc: "<name> View stored skill details" },
93
+ { fill: "/skills rm ", desc: "<name> Remove a stored skill" },
94
+ ],
95
+ "/browser": [
96
+ { fill: "/browser status", desc: "Show Playwright runtime & browser executable status" },
97
+ { fill: "/browser install", desc: "Pre-install isolated playwright-core (+ Chromium if needed)" },
98
+ { fill: "/browser close", desc: "Close active headless browser session" },
99
+ ],
79
100
  "/set": [
80
101
  { fill: "/set agentMode ", desc: "default | accept-edits | plan | auto" },
81
102
  { fill: "/set toolPermission ", desc: "ask | allow-reads | allow-edits | always-proceed" },
82
103
  { fill: "/set nonWorkspaceAccess ", desc: "ask | allow | deny" },
83
104
  { fill: "/set toolsEnabled ", desc: "true | false" },
84
105
  { fill: "/set autoSummarize ", desc: "true | false" },
85
- { fill: "/set maxToolSteps ", desc: "integer 1-100 (default 25)" },
106
+ { fill: "/set maxToolSteps ", desc: "integer 1-1000 (default 100)" },
86
107
  { fill: "/set maxHistoryMessages ", desc: "integer 2-500 (default 24)" },
87
108
  { fill: "/set contextWindow ", desc: "integer >= 1024 (default 128000)" },
88
109
  { fill: "/set temperature ", desc: "0.0-2.0 | null" },