# jackin-term (https://jackin.tailrocks.com/reference/crates/jackin-term/)



{/* GENERATED from crates/jackin-term/README.md — edit the README, not this file */}

Owned terminal model for the `jackin-capsule` re-emitting PTY multiplexer — the grid, parser-perform sink, damage tracking, passthrough events, and snapshot/observation APIs behind the [Capsule Terminal Model](/reference/capsule/terminal-model/).

The full design record — why `vt100` was retired, the candidate survey, the borrow/re-implement ledger, the current Ratatui/emit contract, scrollback-retention semantics, and the correctness guarantees — lives in that doc. This README is the current-state map of the crate.

## What this crate owns [#what-this-crate-owns]

* The VT/ANSI parser-perform sink over `vte`: bytes → grid mutation + typed passthrough events.
* The `DamageGrid` cell model: cursor, modes, styles, alternate screen, scrollback, wide-cell/grapheme-cluster handling, and dirty-row damage recorded at mutation time.
* Snapshot/observation APIs (`GridView`, `GridSnapshot`) the capsule renders from, plus width and passthrough helpers.

## Architecture tier and allowed dependencies [#architecture-tier-and-allowed-dependencies]

L2 infrastructure crate. Allowed workspace dependencies: `jackin-core`, `jackin-diagnostics`. No presentation, no `ratatui`, no host effects — only the model + diff/emit surface the capsule consumes.

## Structure [#structure]

| Module                                                                                                                                                    | Owns                                           | Tests                                                                           |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------- |
| <RepoFile path="crates/jackin-term/src/lib.rs">`lib.rs`</RepoFile>                                                                                        | crate root, re-exports                         | —                                                                               |
| <RepoFile path="crates/jackin-term/src/grid.rs">`grid.rs`</RepoFile> · <RepoFile path="crates/jackin-term/src/grid.rs">`grid/`</RepoFile>                 | `DamageGrid` cell model, scrollback, damage    | <RepoFile path="crates/jackin-term/src/grid/tests.rs">`tests.rs`</RepoFile>     |
| <RepoFile path="crates/jackin-term/src/damage.rs">`damage.rs`</RepoFile> · <RepoFile path="crates/jackin-term/src/damage.rs">`damage/`</RepoFile>         | dirty-row tracking                             | <RepoFile path="crates/jackin-term/src/damage/tests.rs">`tests.rs`</RepoFile>   |
| <RepoFile path="crates/jackin-term/src/cell.rs">`cell.rs`</RepoFile>                                                                                      | packed cell (`CompactString` grapheme storage) | —                                                                               |
| <RepoFile path="crates/jackin-term/src/passthrough.rs">`passthrough.rs`</RepoFile>                                                                        | typed `PassthroughEvent` stream                | —                                                                               |
| <RepoFile path="crates/jackin-term/src/snapshot.rs">`snapshot.rs`</RepoFile> · <RepoFile path="crates/jackin-term/src/snapshot.rs">`snapshot/`</RepoFile> | snapshot/observation APIs                      | <RepoFile path="crates/jackin-term/src/snapshot/tests.rs">`tests.rs`</RepoFile> |
| <RepoFile path="crates/jackin-term/src/width.rs">`width.rs`</RepoFile> · <RepoFile path="crates/jackin-term/src/width.rs">`width/`</RepoFile>             | width helpers                                  | <RepoFile path="crates/jackin-term/src/width/tests.rs">`tests.rs`</RepoFile>    |

Out-of-tree: <RepoFile path="crates/jackin-term/tests/conformance.rs">`tests/conformance.rs`</RepoFile> + `tests/fixtures/` (conformance replay harness + corpus), `fuzz/`, `benches/`, `examples/`.

## Public API [#public-api]

`DamageGrid`, the parser-perform entry point, `GridView` / `GridSnapshot` observation APIs, `PassthroughEvent`, and the width/snapshot helpers — consumed by `jackin-capsule`. The crate is pure-Rust: no `unsafe`, no FFI, no host-side effects (all mutation is in-memory).

## How to verify [#how-to-verify]

```sh
cargo nextest run -p jackin-term
cargo clippy -p jackin-term --all-targets -- -D warnings
cargo bench --bench resize_storm -p jackin-term -- --quick
cargo bench --bench scroll_throughput -p jackin-term -- --quick
cargo bench --bench present_frame -p jackin-term -- --quick
```

Design rationale and prior art: [Capsule Terminal Model](/reference/capsule/terminal-model/).
