Skip to content

feat(core): add embedded terminal runtime - #1338

Open
jlongster wants to merge 4 commits into
mainfrom
embedded-terminal-runtime
Open

feat(core): add embedded terminal runtime#1338
jlongster wants to merge 4 commits into
mainfrom
embedded-terminal-runtime

Conversation

@jlongster

@jlongster jlongster commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #1317 pins Ghostty and makes its VT module available to OpenTUI, but OpenTUI still has no owned terminal state or mode-aware input boundary. The previous runtime PR (#1307) proved the behavior through a dynamic C loader; that implementation no longer matches the merged static Zig-module architecture.

This PR rebuilds only the internal runtime layer on the pinned Ghostty module. It deliberately excludes OpenTUI composition, native handles/FFI, TypeScript, and the public renderable so terminal ownership and input semantics can be reviewed independently.

Changes

  • Own a Ghostty Terminal and persistent TerminalStream across the complete runtime lifetime.
  • Preserve parser state across split CSI, OSC, and UTF-8 writes.
  • Bound parser-driven allocations at 1 MiB and report processing failures.
  • Support resize, viewport scrolling, keyboard, mouse, paste, and focus encoding from current terminal modes.
  • Suppress SGR-pixel mouse reports because OpenTUI currently receives cell coordinates rather than physical pixels.
  • Capture terminal-generated PTY responses with a 1 MiB bound, partial drains, and recoverable overflow reporting.
  • Preserve already queued responses when later output exceeds the bound.
  • Use growable owned encoder output rather than fixed native buffers.

Scope

This is the internal adapter/runtime layer. It does not add native handles, C/TypeScript FFI, OptimizedBuffer composition, cursor projection, EmbeddedTerminalRenderable, screen observation, benchmarks, or examples.

The next stack layer will port the proven compositor and renderable behavior from closed PR #1308 onto this runtime.

Testing

  • Focused embedded-terminal native suite (6 passed)
  • bun run test:native (1873 passed, 6 skipped)
  • bun run fmt:check
  • bun run lint

@jlongster jlongster changed the title embedded terminal runtime feat(core): add embedded terminal runtime Aug 5, 2026
@jlongster
jlongster marked this pull request as ready for review August 5, 2026 19:04
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.

1 participant