# Terminal size-accounting runtime proof

AI-assisted; verified with the tests and tools listed above.

This uses the real server, its WebSocket RPC transport, terminal manager, and a real shell PTY. There are no mocked services or test assertions. The scenario guide excludes performance regressions, so this uses the manual server-output route. No browser or model turn is needed for this server path.

Place drive.mjs and trace.mjs together in an evidence directory. From each isolated checkout, install dependencies with `vp i`. Pick a fresh home and unused port for each side. Set `T3CODE_DEV_SEED=0` and `EVIDENCE_STATS` to that side's output JSON path, then launch:

```
node --import <evidence>/trace.mjs apps/server/src/bin.ts serve --host 127.0.0.1 --port <port> --base-dir <fresh-home> --no-browser
```

Issue an isolated bearer session into a private file (never upload it):

```
node apps/server/src/bin.ts auth session issue --token-only --base-dir <fresh-home> > <evidence>/<side>-token
node <evidence>/drive.mjs <side> <port>
```

Use `base` and `head` as the side names. The driver creates a synthetic project and thread using RPC (the replay fixture selection is metadata only; no turn runs), attaches a real terminal at 100 x 30, sends `seq 1 100000` plus a completion marker, withholds ACKs, observes stalled delivery, then releases ACKs and captures output completion. It checks the received numeric sequence by inspection of all 100,000 lines, after removing shell ANSI controls. Runtime output is written into a new timestamped directory. Stop each server by its captured PID after collecting its stats.

The probe forwards original JSON.stringify and Buffer.byteLength arguments and return values. It records only terminal output Chunk serialization calls. Classification uses the immediate caller: OutputProtocol.ts is measurement, RpcSerialization.js is transport. Transport call stacks also contain OutputProtocol deeper down, so matching the entire stack would be wrong. First call stacks are included in the raw JSON artifacts. The byteLength count includes queue, window, and nested transport calls, and is not a throughput metric.

Final captured run: base made 20 measurement serialization calls plus 20 transport encoding calls; head made 0 measurement serialization calls plus 19 transport encoding calls. PTY batching varies, so absolute chunk counts are not a speed comparison. Both delivered eight chunks without ACKs, then no additional events in a second observation, and both completed all 100,000 numbers in order after ACKs resumed.

The PNG files are readable renderings of the captured runtime data, not application screenshots. The JSON files include the runtime transcript and observed call stacks. Paths in transcripts and stacks are redacted to symbolic workspace/instrumentation labels. No source changes are part of this proof.

Not established: elapsed-time speedup, CPU percentage, browser rendering, the 64 KiB byte threshold independently of the eight-chunk cap, or the 8 MiB overflow/resync path.
