TypeScript primitives for terminal protocols, streaming, rendering, and WebSocket bridges across browsers, Node.js, and Cloudflare Workers.
pnpm add @openclaw/libterminalThe Node.js adapters require Node.js ^22.18.0 || >=24.11.0.
Install the optional PTY driver when using spawnLocalPty():
pnpm add node-ptyImport the entry point for your runtime. Browser and Worker entry points do not
import Node.js built-ins. Subpaths below extend @openclaw/libterminal.
| Entry point | Provides |
|---|---|
@openclaw/libterminal |
Shared terminal types and errors |
/protocol |
Protocol v2 codecs and validation |
/stream |
Bounded replay, fanout, and batching |
/browser |
Ghostty WASM terminals and terminal hub client |
/node |
Local PTYs, raw stdio, and Ghostty assets |
/worker |
WebSocket bridging and control checks |
/worker-assets |
Embedded Ghostty assets and HTTP responses |
/testing |
Deterministic terminal test doubles |
For example:
import { decodeTerminalFrame } from "@openclaw/libterminal/protocol";
import { BoundedReplayBuffer } from "@openclaw/libterminal/stream";Replay buffers, fanout subscriptions, and batch publishers copy incoming bytes. Queues are bounded. See streaming and byte ownership.
Create a read-only Ghostty terminal or connect a multiplexed terminal WebSocket. See browser integration for assets, cancellation, and color queries.
Spawn a local PTY, attach stdio, or serve Ghostty assets. See Node.js integration for setup and teardown behavior.
Bridge authenticated WebSockets or serve embedded Ghostty assets. See Worker integration for control checks and asset routes.
Wire-protocol versions and package versions are independent. See protocol compatibility and the protocol v2 specification.
Applications own authentication, authorization, public listeners, storage, and transcripts. The package does not log or persist terminal bytes. See the integration boundaries and security policy.
Use the pinned pnpm version and a supported development runtime. See CONTRIBUTING.md for setup, validation, review, and release steps. The Ghostty validation guide explains browser e2e coverage and performance measurements.