The web terminal cannot render full-screen terminal applications (TUI apps like vim, htop, top, less, nano). These apps use alternate screen buffer escape sequences to take over the terminal, which the web terminal's line-based rendering cannot display. This results in garbled output that confuses users and can freeze the terminal.
Two scenarios exist:
allowedCommands) — TUI output is captured and rendered as garbled textallowAllCommands) — full-screen detection exists but renders a degraded, confusing viewDetect alternate screen buffer escape sequences in command output and replace garbled output with a clear red error message. Suggest non-interactive alternatives when known.
A TuiDetector class scans raw output for alternate screen buffer sequences — the definitive signal that an app is trying to take over the terminal:
ESC[?1049h / ESC[?1049l — Standard alternate screen bufferESC[?47h / ESC[?47l — Older variantESC[?1047h / ESC[?1047l — Another older variantNot detected (these are harmless or degrade gracefully):
ESC[...m) — Colors/styles, handled by AnsiToHtmlESC[A/B/C/D, ESC[H) — Used by progress bars, clearESC[K) — Used by spinners/progressESC[?25h/l) — IgnorableESC[2J) — Used by clear command, harmlessTuiDetector (src/Terminal/TuiDetector.php):
containsTuiSequences(string $output): boolgetSuggestion(string $command): ?stringSuggestion map:
| Command | Suggestion |
|---|---|
top |
top -b -n 1 |
htop |
top -b -n 1 |
vim/vi |
cat <file> |
nano |
cat <file> |
less |
cat <file> |
more |
cat <file> |
man |
Generic message (pipe alternative depends on shell operator config) |
Error message format:
⚠ This command requires a full-screen terminal (TUI) which is not supported in this web terminal.
→ Try instead: top -b -n 1
WebTerminal::addCommandResultOutput() — Check output before processing. If TUI detected, replace with error.WebTerminal::pollOutput() — When full_screen === true, kill process and show error with suggestion.AnsiToHtml — No changes. TUI output never reaches it.TuiDetector: detection accuracy, no false positives, suggestion mapWebTerminal integration: synchronous and interactive pathsHow can I help you explore Laravel packages today?