Three deterministic stages. Zero generative guesswork.
LLMs take seconds, cost tokens, and quietly hallucinate URLs or run IDs. Regexes shatter on the first unseen CLI. TermPrism runs a 2.88 MB encoder locally in WebAssembly to emit strict structural annotations while keeping every character verbatim.
Ingest raw terminal chaos
Accepts live PTY streams, copy-pasted scrollback, 256-color/truecolor ANSI escapes, smashed carriage-return progress frames, and hard-wrapped paths or URLs.
Compile to Structured IR
Like a compiler's Intermediate Representation (IR), one non-autoregressive pass emits typed semantic blocks, CR pruning, splits, folding, and exact spans — decoupled from any UI.
Render into any UI surface
Drive a mobile/chat Feed, dense Ops Table, enhanced Clean TUI, or portable Markdown from the same lossless Structured IR — with 100% verbatim inspection.
TermPrism Primitives
5 Neural Heads + Exact Spans → Structured IR@roles in one pass. Click any card or role below to inspect live Before → IR examples right here (without jumping your scroll).Fast enough for live streams. Small enough for mobile web.
Evaluated zero-shot across 20 held-out real terminal & interactive TUI captures (Gate-0, Gate-2, Gate-3) with zero Python↔JS WASM parity drift across 16,074 tokens.
| Metric | v4-Tiny Hardened (4L) | v3-Tiny Distilled (4L) |
|---|---|---|
| ONNX Footprint (FP16+INT8) | 2.88 MB | 2.88 MB |
| WASM Median Latency (Gate-3 / Stream Tail) | 33.7 / 32.1 ms | 33.3 / 34.4 ms |
| Blind Gate-4 Raw NL / Role F1 (32–240+ cols) | 0.959 / 0.894 | 0.630 / 0.526 |
| Gate-4 False Widgets / 100 Prose Bullets | 0.0 (0/41) | 12.2 (5/41) |
| Gate-4 Sibling List-Boundary F1 | 1.000 (41/41) | 0.815 |
| Gate-3 Interactive NL / Role F1 | 0.855 / 0.985 | 0.814 / 0.972 |
| Composer Rail Leaks & Destructive Strips | 0 / 0 | 0 / 0 |
import * as ort from "onnxruntime-web"; import { TermPrismEngineV2, TermPrismStream } from "termprism-runtime"; // 1. Load 2.88 MB hardened v4 ONNX once in the browser const sess = await ort.InferenceSession.create("./termprism_v4_tiny_int8.onnx"); const engine = new TermPrismEngineV2(ort, sess, tokenizerJson); // 2. Incremental tail-only inference (~32 ms tail, bit-exact on redraw/resize) const stream = new TermPrismStream(engine); const { blocks, irText, inferMs } = await stream.setText(rawPtyOutput); // blocks[] → typed @roles, progress gauges, tables, exact spans