@aitty/adaptive-terminal
v0.6.7
Published
Headless multi-viewport terminal projection for adaptive terminal sources.
Maintainers
Readme
@aitty/adaptive-terminal
Multi-viewport projection for compatible terminal sources.
@aitty/adaptive-terminal keeps one canonical terminal grid and projects it to
multiple client viewport sizes with termvision. It does not spawn a PTY by
itself. Use @aitty/node-pty, @aitty/bun-terminal, or @aitty/bun-pty when
you want a ready-made runtime adapter.
import { createAdaptiveTerminal, type AdaptiveTerminalSource } from "@aitty/adaptive-terminal";
const source: AdaptiveTerminalSource = createYourTerminalSource();
const terminal = await createAdaptiveTerminal({ source });
const desktop = terminal.attachViewport({ id: "desktop", cols: 144, rows: 36 });
const mobile = terminal.attachViewport({ id: "mobile", cols: 39, rows: 24 });
desktop.onFrame((frame) => {
console.log(frame.text);
});
mobile.onFrame((frame) => {
console.log(frame.text);
});
await terminal.write("echo hello\n");