Commit c01ab93
authored
Feat markdown rendering (#135)
* feat: terminal markdown rendering for LLM output (--markdown / /md)
- Add marked + marked-terminal for ANSI-formatted markdown output
- New --markdown CLI flag and /markdown (/md) toggle command
- When enabled: LLM output is buffered (not streamed) and rendered
with proper headings, bold, code blocks, lists, tables, links
- When disabled (default): raw streaming as before
- markdownEnabled state field, wired through event handler to
suppress character-by-character streaming in markdown mode
- processMessage renders buffered output through marked-terminal
before displaying to user
- All 2342 tests pass
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix: wrap full error messages in C.err() for red styling
All error messages previously had only the label (e.g. '❌ Error:') styled
red, while the actual error text appeared unstyled after the ANSI reset.
Now the entire message including the error detail is wrapped in C.err().
- event-handler.ts: SDK-level tool failure error display
- slash-commands.ts: 11 error paths (models, sessions, history, audit,
modules) all consistently fully red
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* feat: extend markdown rendering to tool results and show-code blocks
- Tool result strings: render via marked-terminal when markdown mode is
enabled and text contains markdown patterns (headings, code blocks, etc.)
- register_handler show-code: wrap in ```javascript fence for syntax hl
- execute_bash show-code: wrap in ```bash fence for syntax hl
- Errors/warnings left untouched — keep C.err()/C.warn() ANSI coloring
- JSON objects left untouched — dim pretty-print is fine for structured data
- Bash stdout left untouched — too risky for false-positive markdown matches
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix: bash bundle node:module stub for just-bash 3.0.1
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* feat: SDK large output handling + markdown config tables
- Add wrapToolResult() helper returning proper ToolResultObject with
skipLargeOutputProcessing to bypass SDK VB() /tmp truncation
- Restructure execute_javascript/execute_bash thresholds: disk save
(20KB) and LLM context limit (50K chars) as independent concerns
- Add 50K char guards to read_input/read_output with sandbox guidance
- Render plugin config and startup/slash-command config as markdown
tables when markdown mode is enabled
- Render tool result strings with markdown patterns via renderMarkdown
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* feat: markdown default, verbose gating, /files + /open commands, file tracking
- Markdown rendering enabled by default (--no-markdown to disable)
- HYPERAGENT_MARKDOWN env default flipped (disable with =0)
- Startup config banner as markdown tables
- Plugin and sandbox config confirmations as markdown tables
- Tool execution: show tool name for all tools, not just sandbox
- Tool results gated behind verbose mode (non-verbose shows ✅ Done)
- Errors always shown regardless of verbose mode
- [plugins] and [mcp] discovery output gated behind --verbose
- File tracking: write_output and auto-save register produced files
- [[file:path]] markers in LLM output resolved via linkifyFiles()
- /files command: lists all produced files with numbered refs
- /open command: opens file by number (WSL/macOS/Linux)
- Dedup produced files by absPath to avoid double entries
- System message: conditional markdown/plain output instructions
- C.fileLink() returns raw paths for terminal auto-detection
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix: address PR #135 review feedback
- /markdown toggle: set sessionNeedsRebuild so system prompt updates
- Help text: fix wrong '(default)' label (ON is default, not OFF)
- /open: use spawnSync with argv arrays instead of shell interpolation
(prevents shell injection with special characters in paths)
- /open: validate input with /^\d+$/ regex (reject '1abc' etc.)
- Spinner: restart after tool name display so user sees activity
- Non-verbose errors: always show parsed.error even in non-verbose mode
(previously hidden behind '✅ Done' — regression)
- Gate 1 config: restore requested config display before plugin approval
- Truncated preview: skip markdown rendering on 300-char truncated content
(truncation can break mid-token producing garbled output)
- _userDisplayed: verified path through wrapToolResult JSON serialisation
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
---------
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>1 parent 4131af4 commit c01ab93
16 files changed
Lines changed: 1744 additions & 552 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
51 | 68 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| |||
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
113 | 130 | | |
114 | 131 | | |
115 | 132 | | |
| |||
242 | 259 | | |
243 | 260 | | |
244 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
245 | 279 | | |
246 | 280 | | |
247 | 281 | | |
| |||
0 commit comments