MCPcopy
hub / github.com/vercel-labs/wterm

github.com/vercel-labs/wterm @v0.2.1 sqlite

repository ↗ · DeepWiki ↗ · release v0.2.1 ↗
353 symbols 888 edges 125 files 3 documented · 1%
README

wterm

A terminal emulator for the web.

wterm ("dub-term") renders to the DOM — native text selection, copy/paste, find, and accessibility come for free. The core is written in Zig and compiled to WASM for near-native performance.

Packages

Package Description
@wterm/core Headless WASM bridge + WebSocket transport
@wterm/dom DOM renderer, input handler — vanilla JS terminal
@wterm/react React component + useTerminal hook (TypeScript)
@wterm/vue Vue 3 component + template ref API
@wterm/just-bash In-browser Bash shell powered by just-bash
@wterm/markdown Render Markdown in the terminal

Features

  • Zig + WASM core — VT100/VT220/xterm escape sequence parser compiled to a ~12 KB .wasm binary (release build)
  • DOM rendering — native text selection, clipboard, browser find, and screen reader support
  • Dirty-row tracking — only touched rows are re-rendered each frame via requestAnimationFrame
  • Themes — CSS custom properties with built-in Default, Solarized Dark, Monokai, and Light themes
  • Alternate screen buffervim, less, htop, and similar apps work correctly
  • Scrollback history — configurable ring buffer
  • 24-bit color — full RGB SGR support
  • Auto-resizeResizeObserver-based terminal resizing
  • WebSocket transport — connect to a PTY backend with binary framing and reconnection

Development

Prerequisites

Setup

pnpm install

Build the WASM binary

zig build

For a release build:

zig build -Doptimize=ReleaseSmall

Build all packages

pnpm build

Run the vanilla demo

Serve the web/ directory with any static file server:

cd web && python3 -m http.server 8000

Run the Next.js example

All dev servers use portless to avoid hardcoded ports. Each app is served at a .localhost URL (e.g. nextjs-example.wterm.localhost).

cp web/wterm.wasm examples/nextjs/public/
pnpm --filter nextjs dev

Run Zig tests

zig build test

License

Apache-2.0

Extension points exported contracts — how you extend this code

TerminalHandle (Interface)
(no doc) [1 implementers]
packages/@wterm/react/src/Terminal.tsx
CodeProps (Interface)
(no doc)
apps/docs/src/components/code.tsx
Theme (Interface)
(no doc)
examples/nextjs/app/page.tsx
ConnectParams (Interface)
(no doc)
examples/ssh/server.ts
MarkdownRendererOptions (Interface)
(no doc)
packages/@wterm/markdown/src/index.ts
ConnectionParams (Interface)
(no doc)
examples/ssh/app/page.tsx
WTermOptions (Interface)
(no doc)
packages/@wterm/dom/src/wterm.ts
TraceEntry (Interface)
(no doc)
packages/@wterm/dom/src/debug.ts

Core symbols most depended-on inside this repo

push
called by 77
packages/@wterm/markdown/src/index.ts
handleInput
called by 52
packages/@wterm/just-bash/src/index.ts
write
called by 46
packages/@wterm/vue/src/Terminal.ts
init
called by 29
packages/@wterm/core/src/wasm-bridge.ts
connect
called by 23
packages/@wterm/core/src/transport.ts
writeString
called by 20
packages/@wterm/core/src/wasm-bridge.ts
resize
called by 17
packages/@wterm/react/src/Terminal.tsx
focus
called by 17
packages/@wterm/react/src/Terminal.tsx

Shape

Function 153
Method 148
Class 32
Interface 19
Enum 1

Languages

TypeScript100%

Modules by API surface

packages/@wterm/core/src/wasm-bridge.ts59 symbols
packages/@wterm/dom/src/debug.ts22 symbols
apps/docs/src/components/docs-chat.tsx22 symbols
packages/@wterm/dom/src/wterm.ts18 symbols
packages/@wterm/dom/src/renderer.ts14 symbols
packages/@wterm/markdown/src/index.ts12 symbols
packages/@wterm/core/src/__tests__/websocket-transport.test.ts12 symbols
packages/@wterm/dom/src/input.ts11 symbols
packages/@wterm/just-bash/src/index.ts10 symbols
packages/@wterm/core/src/transport.ts10 symbols
packages/@wterm/react/src/Terminal.tsx9 symbols
examples/ssh/components/ui/select.tsx9 symbols

Dependencies from manifests, versioned

@ai-sdk/react3 · 1×
@base-ui/react1.4.0 · 1×
@internal/tsworkspace:* · 1×
@mdx-js/loader3 · 1×
@mdx-js/react3 · 1×
@next/mdx16.2.3 · 1×
@playwright/test1.59.1 · 1×
@tailwindcss/vite4.2.2 · 1×
@testing-library/jest-dom6.9.1 · 1×
@testing-library/react16.3.2 · 1×
@types/mdx2 · 1×

For agents

$ claude mcp add wterm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact