agen-vektor 0.3.1 → 0.3.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.
package/dist/cli/index.js CHANGED
@@ -250,7 +250,13 @@ async function runTui(opts) {
250
250
  const onResize = () => doRender();
251
251
  process.stdout.on('resize', onResize);
252
252
  process.on('SIGINT', () => {
253
- // Ctrl+C is handled via raw mode keys; SIGINT may still fire
253
+ // In raw mode Ctrl+C arrives as a key event (0x03), but some terminals
254
+ // (web/embedded, some SSH clients) deliver it as SIGINT instead.
255
+ // Never swallow it: request a clean exit so the user is not forced to kill.
256
+ if (app)
257
+ app.requestExit();
258
+ else
259
+ process.exit(0);
254
260
  });
255
261
  process.on('SIGWINCH', onResize);
256
262
  const keyHandler = (ev) => {
package/dist/tui/app.js CHANGED
@@ -117,6 +117,7 @@ class App {
117
117
  this.status = 'Stopping…';
118
118
  this.statusColor = terminal_1.ANSI.yellow;
119
119
  this.running = false;
120
+ this.addSystem('⏹ Stopped. Press Ctrl+C again to quit.');
120
121
  }
121
122
  return;
122
123
  }
@@ -211,6 +212,17 @@ class App {
211
212
  await this.shutdown();
212
213
  }
213
214
  }
215
+ /**
216
+ * Abort any running task and request a clean exit.
217
+ * Used by Ctrl+C and SIGINT so the TUI never needs to be killed.
218
+ */
219
+ requestExit() {
220
+ if (this.running) {
221
+ this.abortController?.abort();
222
+ this.running = false;
223
+ }
224
+ this.exitRequested = true;
225
+ }
214
226
  // ─── Submission ───────────────────────────────────────────────
215
227
  async submit(text) {
216
228
  if (text.startsWith('/')) {
@@ -486,6 +498,11 @@ class App {
486
498
  if (ev.name === 'escape' || ev.name === 'enter' || ev.name === 'ctrl_c' || (ev.name === 'char' && ev.char === '?')) {
487
499
  this.modal = { type: 'none' };
488
500
  }
501
+ else if (ev.name === 'char' && ev.char) {
502
+ // Typing while an info modal is open: close it and insert the char
503
+ this.modal = { type: 'none' };
504
+ this.input.insert(ev.char);
505
+ }
489
506
  else if (ev.name === 'pageup') {
490
507
  this.scroll = (0, chat_1.clampScroll)(this.scroll - 10, this.messages, this.cols(), this.chatHeight());
491
508
  }
@@ -689,7 +706,7 @@ class App {
689
706
  return (0, terminal_1.getTerminalSize)().cols;
690
707
  }
691
708
  chatHeight() {
692
- return Math.max(1, (0, terminal_1.getTerminalSize)().rows - 6);
709
+ return Math.max(1, (0, terminal_1.getTerminalSize)().rows - 7);
693
710
  }
694
711
  render() {
695
712
  const { rows, cols } = (0, terminal_1.getTerminalSize)();
@@ -704,32 +721,41 @@ class App {
704
721
  spinner: this.spinner.frame(),
705
722
  running: this.running,
706
723
  };
724
+ const frame = theme_1.THEME.borderBright;
725
+ const innerW = Math.max(4, cols - 2);
707
726
  const parts = [];
708
- parts.push((0, statusbar_1.renderHeader)(cols, info));
709
- parts.push((0, statusbar_1.renderProjectBar)(cols, info));
710
- // Chat area
727
+ // Row 1-2: framed header + project bar
728
+ parts.push((0, terminal_1.cursorTo)(1, 1) + terminal_1.ANSI.clearLineEnd + (0, statusbar_1.renderHeader)(cols, info));
729
+ parts.push((0, terminal_1.cursorTo)(2, 1) + terminal_1.ANSI.clearLineEnd + (0, statusbar_1.renderProjectBar)(cols, info));
730
+ // Row 3: separator
731
+ parts.push((0, terminal_1.cursorTo)(3, 1) + terminal_1.ANSI.clearLineEnd + frame + terminal_1.BOX.teeRight + terminal_1.BOX.h.repeat(innerW) + terminal_1.BOX.teeLeft + theme_1.THEME.reset);
732
+ // Chat area (rows 4..) — each line wrapped in the frame
711
733
  const chatH = this.chatHeight();
712
- const chatW = cols;
734
+ const chatW = innerW;
713
735
  const all = (0, chat_1.renderMessages)(this.messages, chatW);
714
736
  const maxScroll = Math.max(0, all.length - chatH);
715
737
  this.scroll = Math.min(this.scroll, maxScroll);
716
738
  const visible = all.slice(this.scroll, this.scroll + chatH);
717
- const chatTop = 3;
739
+ const chatTop = 4;
740
+ const empty = ' '.repeat(innerW);
718
741
  for (let i = 0; i < chatH; i++) {
719
- const content = visible[i] !== undefined ? visible[i] : '';
720
- parts.push((0, terminal_1.cursorTo)(chatTop + i, 1) + terminal_1.ANSI.clearLineEnd + content);
742
+ const content = visible[i] !== undefined ? visible[i] : empty;
743
+ parts.push((0, terminal_1.cursorTo)(chatTop + i, 1) + terminal_1.ANSI.clearLineEnd + frame + terminal_1.BOX.v + theme_1.THEME.reset + ' ' + content + ' ' + frame + terminal_1.BOX.v + theme_1.THEME.reset);
721
744
  }
722
- // Separator
745
+ // Separator between chat and input
723
746
  const sepRow = chatTop + chatH;
724
- parts.push((0, terminal_1.cursorTo)(sepRow, 1) + terminal_1.ANSI.clearLineEnd + theme_1.THEME.border + terminal_1.BOX.h.repeat(Math.min(cols, 120)) + theme_1.THEME.reset);
725
- // Input
747
+ parts.push((0, terminal_1.cursorTo)(sepRow, 1) + terminal_1.ANSI.clearLineEnd + frame + terminal_1.BOX.teeRight + terminal_1.BOX.h.repeat(innerW) + terminal_1.BOX.teeLeft + theme_1.THEME.reset);
748
+ // Input row
726
749
  const inputRow = sepRow + 1;
727
- const rendered = this.input.render(cols);
728
- parts.push((0, terminal_1.cursorTo)(inputRow, 1) + terminal_1.ANSI.clearLineEnd + rendered.line);
729
- const cursorCol = rendered.cursorCol + 1;
730
- // Status bar
750
+ const rendered = this.input.render(innerW);
751
+ parts.push((0, terminal_1.cursorTo)(inputRow, 1) + terminal_1.ANSI.clearLineEnd + frame + terminal_1.BOX.v + theme_1.THEME.reset + ' ' + rendered.line + ' ' + frame + terminal_1.BOX.v + theme_1.THEME.reset);
752
+ const cursorCol = rendered.cursorCol + 3;
753
+ // Status bar row
731
754
  const statusRow = inputRow + 1;
732
755
  parts.push((0, terminal_1.cursorTo)(statusRow, 1) + terminal_1.ANSI.clearLineEnd + (0, statusbar_1.renderStatusBar)(cols, info));
756
+ // Bottom border
757
+ const bottomRow = statusRow + 1;
758
+ parts.push((0, terminal_1.cursorTo)(bottomRow, 1) + terminal_1.ANSI.clearLineEnd + frame + terminal_1.BOX.bl + terminal_1.BOX.h.repeat(innerW) + terminal_1.BOX.br + theme_1.THEME.reset);
733
759
  // Modal overlay
734
760
  if (this.modal.type !== 'none') {
735
761
  const overlay = this.renderModal(rows, cols);
@@ -5,11 +5,15 @@ exports.renderProjectBar = renderProjectBar;
5
5
  exports.renderStatusBar = renderStatusBar;
6
6
  /**
7
7
  * Status bar — top header + project bar + bottom hint bar.
8
- * Uses the VectorHead theme with a live spinner while busy.
8
+ * Renders inside the VectorHead frame (Freebuff-style borders):
9
+ * ╭─ VectorHead ● status ─── provider · model ─╮
10
+ * │ Project: ~/x Mode: ask │
11
+ * │ ENTER Send · TAB Commands · ? Help ● ask │
9
12
  */
10
13
  const terminal_1 = require("../utils/terminal");
11
14
  const theme_1 = require("./theme");
12
- /** Render the top header line: VectorHead ● status .... provider · model */
15
+ const frame = theme_1.THEME.borderBright;
16
+ /** Render the top framed header line: ╭─ VectorHead ● status ... provider · model ─╮ */
13
17
  function renderHeader(width, info) {
14
18
  const brand = `${theme_1.THEME.bold}${theme_1.THEME.accent}VectorHead${theme_1.THEME.reset}`;
15
19
  const dot = info.connected ? `${theme_1.THEME.success}●${theme_1.THEME.reset}` : `${theme_1.THEME.error}○${theme_1.THEME.reset}`;
@@ -18,20 +22,20 @@ function renderHeader(width, info) {
18
22
  const provider = `${theme_1.THEME.dim}${info.provider}${theme_1.THEME.reset}`;
19
23
  const model = `${theme_1.THEME.accentDim}${info.model}${theme_1.THEME.reset}`;
20
24
  const right = `${provider} · ${model}`;
21
- const rightWidth = (0, terminal_1.stripAnsi)(right).length;
22
- const leftWidth = Math.max(0, width - rightWidth - 2);
23
- const line = (0, terminal_1.pad)(left, leftWidth) + ' ' + right;
24
- return theme_1.THEME.bgBar + (0, terminal_1.pad)(line, width) + theme_1.THEME.reset;
25
+ const inner = Math.max(2, width - 2);
26
+ const mid = Math.max(1, inner - (0, terminal_1.stripAnsi)(left).length - (0, terminal_1.stripAnsi)(right).length - 3);
27
+ return `${frame}${terminal_1.BOX.tl}${theme_1.THEME.reset} ${left}${' '.repeat(mid)}${right} ${frame}${terminal_1.BOX.tr}${theme_1.THEME.reset}`;
25
28
  }
26
- /** Render the project line: Project: <path> .... Mode: ask|yolo */
29
+ /** Render the framed project line: Project: <path> ... Mode: ask */
27
30
  function renderProjectBar(width, info) {
28
31
  const label = `${theme_1.THEME.dim}Project:${theme_1.THEME.reset} ${theme_1.THEME.text}${info.project}${theme_1.THEME.reset}`;
29
32
  const modeColor = info.mode === 'yolo' ? theme_1.THEME.warn : theme_1.THEME.muted;
30
33
  const mode = `${theme_1.THEME.dim}Mode:${theme_1.THEME.reset} ${modeColor}${info.mode}${theme_1.THEME.reset}`;
31
- const line = `${label} ${mode}`;
32
- return theme_1.THEME.bgBar + (0, terminal_1.pad)(line, width) + theme_1.THEME.reset;
34
+ const inner = Math.max(2, width - 2);
35
+ const mid = Math.max(1, inner - (0, terminal_1.stripAnsi)(label).length - (0, terminal_1.stripAnsi)(mode).length - 3);
36
+ return `${frame}${terminal_1.BOX.v}${theme_1.THEME.reset} ${label}${' '.repeat(mid)}${mode} ${frame}${terminal_1.BOX.v}${theme_1.THEME.reset}`;
33
37
  }
34
- /** Render the bottom hint/status bar with live spinner. */
38
+ /** Render the framed bottom hint/status bar with live spinner. */
35
39
  function renderStatusBar(width, info) {
36
40
  const left = `ENTER ${theme_1.THEME.accent}Send${theme_1.THEME.reset} TAB ${theme_1.THEME.accent}Commands${theme_1.THEME.reset} CTRL+C ${theme_1.THEME.accent}Stop${theme_1.THEME.reset} ? ${theme_1.THEME.accent}Help${theme_1.THEME.reset}`;
37
41
  let right = '';
@@ -41,7 +45,7 @@ function renderStatusBar(width, info) {
41
45
  const conn = info.connected ? `${theme_1.THEME.success}●${theme_1.THEME.reset}` : `${theme_1.THEME.error}○${theme_1.THEME.reset}`;
42
46
  const mode = info.mode === 'yolo' ? `${theme_1.THEME.warn}YOLO${theme_1.THEME.reset}` : `${theme_1.THEME.muted}ask${theme_1.THEME.reset}`;
43
47
  right += `${conn} ${mode}`;
44
- const rightWidth = (0, terminal_1.stripAnsi)(right).length;
45
- const leftWidth = Math.max(0, width - rightWidth - 1);
46
- return theme_1.THEME.bgBar + (0, terminal_1.pad)(left, leftWidth) + ' ' + right + theme_1.THEME.reset;
48
+ const inner = Math.max(2, width - 2);
49
+ const mid = Math.max(1, inner - (0, terminal_1.stripAnsi)(left).length - (0, terminal_1.stripAnsi)(right).length - 3);
50
+ return `${frame}${terminal_1.BOX.v}${theme_1.THEME.reset} ${left}${' '.repeat(mid)}${right} ${frame}${terminal_1.BOX.v}${theme_1.THEME.reset}`;
47
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agen-vektor",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "VectorHead (agen-vektor) — AI Coding Agent CLI/TUI for Linux & Termux. Multi-provider, tool calling, session, permission system.",
5
5
  "type": "commonjs",
6
6
  "bin": {