Skip to content

Conversation

@remorses
Copy link
Owner

Stacked on sst#439 (Zig 0.15 upgrade with ghostty-vt dependency).

This PR adds support for terminal rendering using ghostty-vt:

New renderables:

  • TerminalRenderable - Stateful terminal emulator that maintains terminal state across updates, suitable for interactive terminal sessions
  • StatelessTerminalRenderable - Lightweight terminal renderer optimized for rendering the first few lines of terminal output. Renders in a few milliseconds, designed for opencode chat bash previews

Features:

  • Parse ANSI escape sequences and render styled terminal output
  • Support for colors, bold, italic, underline, strikethrough, dim, and inverse styles
  • VTerm FFI functions for high-performance native parsing via ghostty-vt
  • Registered in React, Solid, and Vue frameworks

Technical details:

  • Uses ghostty-vt for terminal emulation (via Zig FFI)
  • vtermPtyToJson for stateless parsing with pagination support
  • Persistent terminal instances for stateful rendering with vtermCreateTerminal, vtermFeedTerminal, etc.

- Add vterm.zig with ghostty-vt integration for terminal emulation
- Add VTerm FFI functions to lib.zig and zig.ts
- Add StatelessTerminalRenderable and TerminalRenderable classes
- Fix renderer.zig to skip stdout writes in testing mode (fixes hanging tests)
- Fix circular dependency by moving VTerm types to lib/vterm-ffi.ts
@remorses remorses closed this Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants