Commit 03663fd
committed
feat(agent): foldable Vue terminal with Ctrl+O toggle
Replaces the xterm.js scrollback with a Vue-native terminal that can
fold tool-call output. Tool calls collapse to a one-line summary by
default — "$ <cmd> N lines, exit M" with green/red exit-code
colour — and Ctrl+O (or ⌘+O) toggles fold/unfold across every block at
once. Click the block header to toggle a single tool call.
Why this trade-off:
- xterm.js is a character grid; folding requires a parallel logical
model and a full re-render on every toggle. Vue components track
semantic blocks natively, so fold state is just reactive data.
- Side benefits: per-block text selection/copy, native theming via
Tailwind tokens, no ANSI cursor math, no @xterm/* deps in the agent
bundle, easier to extend (per-tool icons, inline images, links).
Implementation notes:
- store.AgentMessage gains an optional 'tool' meta field carrying
script/stdout/stderr/exitCode so the renderer doesn't have to parse
the synthesized text summary back into structure.
- Global keydown listener with capture:true preempts the browser's
default Open-File dialog before Ctrl+O reaches it.
- Drops src/agent/ui/XtermPanel.vue, useXtermReadline.ts, and
shell/useCompletion.ts. The xterm package is still used elsewhere
in the codebase (logs/CommandTerminal), so no dep removal.1 parent 359395a commit 03663fd
8 files changed
Lines changed: 756 additions & 1176 deletions
File tree
- src
- agent
- composables
- shell
- stores
- ui
- locales/en
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
191 | 200 | | |
192 | 201 | | |
193 | 202 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
25 | 38 | | |
26 | 39 | | |
27 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments