FrankenTerm integration
FrankenTUI and FrankenTerm are two projects that share a backend seam. FrankenTUI is the portable TUI kernel you are reading the docs for. FrankenTerm is a browser-facing terminal emulator that consumes FrankenTUI’s web backend. Historically they were planned to live in one workspace; today they do not, and the README is explicit on this.
The short, honest version. crates/frankenterm-core and
crates/frankenterm-web are not vendored in this repository. You
will not find them under crates/. They are developed separately and
integrated via external version pins on crates.io. Some older specs and
architecture documents still reference them by the crates/frankenterm-*
path, because the plan once was to co-locate. Treat those references as
pointing to an adjacent workspace, not an in-tree directory.
What is in-tree — right now, in this repo
| Crate | Role |
|---|---|
ftui-web | Web backend primitives: DeterministicClock, WebEventSource, WebOutputs, the patch format, the pointer-capture adapter, the JSON input parser. |
ftui-showcase-wasm | The WASM build target that packages the entire 46-screen demo showcase as a wasm-bindgen ShowcaseRunner. |
ftui-pty | Test-only PTY fixtures. The WebSocket bridge in ws_bridge.rs integrates with the external frankenterm-core streaming codec. |
Every one of those is self-contained. You can build, test, and ship the FrankenTUI workspace to crates.io without any FrankenTerm crate being present anywhere on your disk.
What is adjacent — and not in this workspace
| Name | Where it lives | What it does |
|---|---|---|
frankenterm-core | External crate published on crates.io (version = "0.2.0", features = ["ws-codec"]) | Terminal emulation core: ANSI/VT parser, scrollback, selection, WebSocket codec. Pulled in only by ftui-pty’s ws_bridge. |
frankenterm-web | External WASM bundle / package | Browser-facing terminal emulator. Consumes ftui-web’s patch format; consumes frankenterm-core’s codec for remote sessions. |
FrankenTermWeb bundle | Published separately | The JS/TS bundle that end users or apps embed in a web page. |
The build-wasm.sh script in this repo conditionally builds a
crates/frankenterm-web directory if it is present. In a stock FrankenTUI
checkout that directory is absent and the step is a no-op. In the
FrankenTerm monorepo that vendors both codebases as a single workspace,
both crates build together.
Why the README and specs still mention the absent names
Two reasons:
-
History. The original plan was a single workspace. The spec documents (
docs/spec/frankenterm-architecture.md,docs/spec/frankenterm-*.md, and others) were written against that plan and still referencecrates/frankenterm-core/crates/frankenterm-webas if they lived here. When you see those paths, read them as names, not as directory locations in this tree. -
Contract stability. Even though the crates live elsewhere, their contracts are authored and versioned alongside FrankenTUI. The WebSocket protocol, the VT support matrix, the remote threat model, the golden trace format — all of those specs live in
docs/spec/of this repo because FrankenTUI’s backend is the producer side of those contracts. Moving the specs out would de-link them from the code that enforces them.
The FrankenTUI README says it cleanly:
This checkout does not currently vendor local
crates/frankenterm-coreorcrates/frankenterm-webworkspace members. Those names still appear in specs and adjacent integration docs, but the in-tree browser surface today isftui-webplus theftui-showcase-wasmtarget.
How the two sides talk
┌──────────────────────┐ patch format ┌──────────────────────┐
│ ftui-web │ ──── u32 cell runs ──> │ frankenterm-web │
│ (this repo) │ dirty spans │ (adjacent, WASM) │
│ │ FNV-1a hash │ │
│ WebEventSource <── │ ──── JSON input ────── │ DOM/canvas renderer │
└──────────┬───────────┘ └──────────┬───────────┘
│ │
│ ws-codec framing
│ │
┌──────────▼───────────┐ WebSocket ┌──────────▼───────────┐
│ ftui-pty │ ─── binary frames ──── │ frankenterm-core │
│ ws_bridge (tests) │ │ (external crate) │
└──────────────────────┘ └──────────────────────┘- Patch format —
ftui-webemits cell runs;frankenterm-webrepaints. Documented in web-backend. - JSON input — browser DOM events are serialized to JSON and parsed
by
ftui-web::input_parserintoftui_core::event::Event. - WebSocket codec — remote-session framing.
ftui-pty::ws_bridgelinks againstfrankenterm-corefor the wire format.
The contracts are small, versioned, and documented in docs/spec/. The
three you are most likely to want:
docs/spec/frankenterm-web-api.md— the JS-side API surface.docs/spec/frankenterm-websocket-protocol.md— the binary wire format.docs/spec/wasm-showcase-runner-contract.md— theShowcaseRunnerJS API exposed byftui-showcase-wasm.
When you will and will not see these names
You will see frankenterm-* mentioned:
- In the
ftui-ptyCargo.tomlas a crates.io dependency. - In
build-wasm.sh, wrapped so the command no-ops when the adjacent crate is absent. - Throughout
docs/spec/anddocs/adr/where contract authorship lives. - In the README’s “Web/WASM Backend” and “FrankenTerm Integration” sections.
You will not see them:
- As directories in
crates/. - As members in the root
Cargo.toml[workspace].members. - As compile-time dependencies of any runtime-facing FrankenTUI crate
(
ftui-core,ftui-runtime,ftui-widgets, etc.).
If you are building FrankenTerm itself
The integration workflow from FrankenTerm’s side is:
- Depend on the latest
ftui-webfrom crates.io (or a git pin). - Consume the patch format documented on the web-backend page.
- Pipe JSON input through
ftui-web::input_parser’s JSON schema. - If you need remote sessions, bring in
frankenterm-coreand use thews-codecfeature.
The point of the seam is that FrankenTUI can ship new widgets, new render
optimizations, and new intelligence features without requiring coordinated
releases on the FrankenTerm side — you pick up the improvements by bumping
the ftui-web pin.
Pitfalls
- Do not file bugs in this repo for FrankenTerm rendering issues. If
the patch format is being applied incorrectly, that is an
frankenterm-webbug. If the patch format itself is wrong, that is anftui-webbug. The first thing to check is whether anotherShowcaseRunnerframe with the same input reproduces the glitch — if yes, it is on this side; if no, it is on the adjacent side. - Do not add
crates/frankenterm-coreorcrates/frankenterm-webas workspace members “to make the specs match.” The specs are correct; the workspace is correct; they just describe different topologies. - Do not assume the WebSocket bridge is a FrankenTUI runtime feature.
It lives in
ftui-ptyfor testing remote sessions. Production remote workflows use FrankenTerm directly.
See also
- Platforms overview — the backend seam
- Web backend — the producer side of the patch format
- WASM showcase — what
ftui-showcase-wasmbuilds - PTY utilities — where
frankenterm-coreintegration lives - Runtime overview · Demo showcase overview · Contributing — dev loop