Terminal runtime and interaction
The terminal runtime gives each workspace terminal a live shell through a pseudo-terminal (PTY). A host owns the shell and its process tree while desktop, mobile, and remote clients attach views to it. The runtime keeps process identity, terminal state, input, output, recovery, scrollback, and host-specific behavior aligned so a view can disappear without losing the session.
Runtime model
PTY sessions
A PTY session is the unit of terminal work. Its owner controls the shell, child processes, working directory, size, and byte stream. A client view attaches to that session but does not own its process.
Stable session, pane, and process-incarnation identities fence late results from an older shell. The runtime treats an unreachable owner as unknown rather than absent. It waits for proof before it starts, retires, or reuses a session.
The local daemon hosts PTYs behind authenticated control and stream connections. Remote runtimes expose the same session idea through a host terminal handle and a multiplexed stream. Both paths preserve the owner's identity across reconnects.
References: src/…/session.ts• L23-41 src/…/daemon-hello-protocol.ts• L1-30 src/…/runtime-terminal-pane-identity.ts• L7-39 src/…/pty-transport-types.ts• L94-131 src/…/remote-runtime-pty-transport.ts• L244-333
Terminal surfaces
A terminal surface is the user-facing tab or pane that points to a PTY. Its layout identity lets a surface detach, move, park, or return without changing the shell behind it.
The runtime can mount a view before a PTY exists and wait for its handle. It can also recover a live PTY whose surface publication was delayed. This separates surface placement from process ownership and prevents slow startup or reload from creating duplicate shells.
References: src/…/pty-terminal-summary.ts• L38-90 src/…/terminal-create.ts• L228-289 src/…/unshown-live-terminal-placement.ts• L68-155 src/…/pty-connection-deps.ts• L19-43 src/…/terminal-surface-index.ts• L104-150
Terminal topology
Terminal topology is the durable map of workspaces, tabs, panes, and PTY bindings. It gives a terminal a stable place when no window is mounted and blocks new work against a pane that the user already closed.
Creation, split, close, move, and rename use this map. Admission and binding settle as one lifecycle, so a late spawn cannot create a live-looking pane without a valid owner. A failed shell start can remain visible as a failure instead of silently becoming a new shell.
References: src/…/terminal-topology-commit.ts• L43-153 src/…/terminal-close-write-failure.ts• L1-37 src/…/terminal-pane-placement-graft.ts• L12-35 src/…/terminal-pty-bindings.ts• L1-180 src/…/workspace-session-terminal-membership-authority.ts• L154-303
Activation admission
Activation admission controls when terminal tabs become live views during workspace startup. It waits for workspace hydration and host answers before passive shell seeding, then allows active work to mount without creating a stray shell beside a pending chat or agent launch.
Cold activation can defer hidden tabs when a provider has an authoritative snapshot. Unknown provider capability keeps a safe mount path because the renderer cannot recover the tab from an unverified snapshot. The startup pass also checks durable closes and pending launches before it seeds a default shell.
References: src/…/use-terminal-startup-activation.ts• L24-101 src/…/background-terminal-worktree-mount.ts• L1-180 src/…/terminal-provider-snapshot-capability.ts• L1-130 src/…/terminal-provider-gone-sessions.ts• L1-150
Session creation and shell startup
Creation flow
Terminal creation resolves the workspace, execution host, working directory, shell, environment, grid size, and launch context before it asks a provider to adopt or spawn a PTY. Adoption of a live session and fresh creation are different outcomes.
Stable request identities make concurrent and retried creates join one operation. The host checks admission and shutdown fences again after slow preparation. A creation record keeps physical cleanup alive after a request is canceled or fails before publication.
This diagram shows how a terminal request becomes a usable surface.
flowchart TD
A[Terminal request] --> B[Resolve workspace and execution host]
B --> C[Resolve cwd shell environment and size]
C --> D{Live owner or stable pane?}
D -->|Yes| E[Attach or adopt the PTY]
D -->|No| F[Reserve admission and pane]
F --> G[Spawn the shell PTY]
E --> H[Check process incarnation]
G --> H
H --> I[Bind owner and seed terminal state]
I --> J[Publish surface and open input/output]
The reservation covers provider preparation, spawn, and binding. A canceled request retains cleanup ownership until the child has stopped, so a replacement cannot reuse the session identity while the old process is still live.
References: src/…/daemon-pty-session-spawn.ts• L26-69 src/…/terminal-host-session-create.ts• L33-147 src/…/terminal-host-session-publish.ts• L33-91 src/…/terminal-creation-work.ts• L11-89 src/…/fresh-spawn-start.ts• L35-120 src/…/spawn-options.ts• L19-104 src/…/spawn-commit-publication.ts• L35-79
Spawn admission
Spawn admission controls how many terminals and automatic tasks a host can start at once. It protects the host from PTY exhaustion and process growth while keeping an interactive terminal distinct from background work.
The gate reserves capacity before a fork, then commits or abandons that reservation when the session is known to be published or physically gone. Automatic work can defer or pause under pressure. Interactive work follows a separate admission path.
References: src/…/terminal-spawn-gate.ts• L40-203 src/…/host-terminal-policy.ts• L122-205 src/…/system-pty-limit.ts• L12-63 src/…/daemon-automatic-work-guard.ts• L28-79
Shell startup
Shell startup prepares an interactive shell and then delivers the requested command or agent launch. When the shell supports a readiness marker, the host holds automatic startup input until startup has completed. Human input can still answer a prompt in a startup file.
Readiness has a timeout path. If the marker never arrives, the runtime releases held output and input once and continues rather than leaving the terminal blocked. The startup operation remains single-use when the shell replaces itself with another shell or program.
Startup preserves user shell behavior while adding managed features. Shell families, launchers, profiles, history, hooks, and working-directory repair are selected for the owning host. A managed launch must not be redirected by a profile alias or a rewritten path. Local Codex launches can add --no-daemon only when the local executable supports it, and Windows Git Bash selection accepts only a verified Git for Windows installation.
References: src/…/session-shell-ready-barrier.ts• L33-187 src/…/shell-ready-marker-scanner.ts• L1-160 src/…/shell-launch-plan.ts• L56-187 src/…/codex-no-daemon-launch-command.ts• L26-65 src/…/git-bash.ts• L95-199 src/…/omp-shell-wrapper-alias-safety.test.ts• L57-113 src/…/zsh-startup-hook-user-config-equivalence.live-shell.test.ts• L32-111
Terminal environment
Each PTY receives an environment for its selected host and launch. The runtime removes inherited pane, nested-agent, history, runtime, and daemon ownership state before it applies the current request.
The selected host adds its shell, account, agent, hook, and path rules. Host-local paths and loopback endpoints do not cross into WSL or SSH shells. A nested terminal receives the requested agent overlay rather than the parent pane's control state. Image support and remote browser or clipboard routing are also scoped to the launch host.
References: src/…/spawn-environment.ts• L34-45 src/…/spawn-environment.ts• L175-250 src/…/shell-launch-plan.ts• L139-238 src/…/wsl-orca-env.ts• L59-155 src/…/assembly.ts• L40-67 src/…/assembly.ts• L119-160 src/…/terminal-image-environment.ts• L1-120
Initial geometry
The first PTY size controls early line wrapping and the first screen state. The runtime seeds that size before early output can arrive, then commits the applied size with the PTY binding. It uses the most specific measured size available and falls back to a safe size when no layout measurement exists.
Later resize requests belong to the current input and resize owner. The runtime reports the size that the PTY applied so a client can repair a dropped resize. Hidden layout churn does not own the grid, and mobile or remote viewport ownership can suppress desktop resize.
References: src/…/pty-first-size.ts• L1-32 src/…/spawn-options-assembly.ts• L269-319 src/…/spawn-commit-publication.ts• L67-79 src/…/session.ts• L158-164 src/…/pty-resize-forward.ts• L16-65 src/…/resize-visibility.ts• L45-72
PTY ownership and interaction
Process ownership
The provider that creates a PTY owns its process tree. The host records the provider, session, pane, execution host, and process incarnation as one ownership record. Physical ownership remains responsible for an unpublished or canceled child until it exits.
Stopping first claims termination and then performs asynchronous cleanup. A refused signal, I/O failure, unavailable process scan, or closed PTY master is not proof of process exit. POSIX cleanup uses PTY and process-group evidence. Windows cleanup uses verified application ownership and the process job when available.
References: src/…/subprocess-handle.ts• L44-245 src/…/session-termination-controller.ts• L19-91 src/…/pty-descendant-termination.ts• L1-180 src/…/windows-pty-root-identity.ts• L18-111 src/…/windows-process-tree-kill.ts• L5-35
Foreground process observation
Foreground observation identifies the process group that currently owns a PTY and classifies its work. The result supports resize delivery, running-work checks, and close decisions without treating a shell wrapper or an unreadable command line as proof of an agent.
On supported POSIX PTYs, the runtime checks the live master, process group, terminal, process rows, and session ownership as one set. A changed group, retired master, failed scan, stopped process, or stale session returns an unverifiable result. Windows uses its own process model.
References: src/…/pty-master-foreground-observation.ts• L20-179 src/…/posix-pty-foreground-group.ts• L90-168 src/…/posix-pty-process-groups.test.ts• L90-171 src/…/terminal-pane-status-lifecycle.ts• L117-199
Input delivery
Keyboard input, paste, pointer actions, query replies, and agent actions all address the current PTY owner. The runtime keeps automatic startup input behind the shell-ready barrier while live user input can reach a startup prompt.
Input has a delivery result. A refused write can be retried. An unknown write is not replayed because the bytes may already have reached the shell. Query replies bypass normal debounce when a raw-mode program needs an immediate response. Remote recovery can hold typed input until the new attachment is proven, then discard it when its safety window expires.
Paste and file drops resolve the PTY's real host before they choose newline, bracket, path, copy, upload, and quoting rules. Client-local paths are not sent unchanged to a remote host.
References: src/…/pty-transport-types.ts• L208-230 src/…/pty-input-forward.ts• L1-180 src/…/pty-input-recovery.ts• L11-67 src/…/remote-runtime-pty-transport.ts• L375-450 src/…/terminal-clipboard-copied-files.ts• L13-40 src/…/pty-api.ts• L122-147
Output streaming
The PTY produces one ordered output stream. The host and renderer carry stream position, output data, snapshots, gaps, side-effect facts, and recovery state as related parts of that stream. The renderer gives flow-control credit when the output scheduler consumes or discards data rather than when the IPC listener receives it.
Hidden panes can drop screen bytes after the runtime has updated its model. The runtime sends a throttled activity notice and a restore marker, then repaints the pane from a snapshot when it becomes visible. A hidden pane may retain graphics or declare raw-byte interest, in which case delivery continues for that consumer. A pending-cap or delivery failure also creates a restore boundary instead of replaying uncertain bytes.
Pre-mount output is kept in a bounded eager buffer so early prompts and messages can reach the first pane. A stalled delivery path can reattach its push listeners or ask a remote host for a snapshot. A delivery after lost bytes is not treated as a safe continuation.
See PTY streaming and recovery for ordered delivery, replay, gaps, and backpressure. See Terminal presentation contracts for renderer screen state and terminal side effects.
References: src/…/pty-dispatcher.ts• L37-162 src/…/terminal-pty-ack-gate.ts• L69-95 src/…/remote-runtime-pty-transport.ts• L162-177 src/…/remote-runtime-terminal-multiplexer.ts• L19-190 src/…/accept.ts• L62-207 src/…/flush.ts• L77-215 src/…/hidden-transition.ts• L53-149 src/…/pty-hidden-delivery-gate.ts• L132-185 src/…/payload.ts• L37-150
Terminal close confirmation
Interactive terminal close checks whether any pane still has running work before it removes the surface. The check distinguishes idle, busy, failed, and unanswered observations.
An idle shell closes at once. A busy local or remote process asks for confirmation. An unanswered remote probe remains unknown and does not authorize a kill. A remote stream exit does not remove a host-owned tab before host evidence settles it.
References: src/…/running-terminal-close-guard.ts• L17-121 src/…/terminal-tab-actions.ts• L68-197 src/…/pane-pty-exit.ts• L63-139 src/…/pty-exit-lifecycle.ts• L40-137
Restoration and scrollback
Live reattach
Live reattach binds a new view to a surviving PTY and restores its screen before it accepts new live output. The restored state can include the grid, cursor, modes, title, working directory, output position, alternate-screen state, and an incomplete escape sequence.
The renderer hydrates terminal state before it joins live writes to the queue. Live bytes that arrive during replay wait until the replay reset has parsed, then drain from the snapshot's stream position. A stale PTY or stream generation cancels the replay rather than letting old state overwrite a successor.
References: src/…/pty-transport-types.ts• L38-87 src/…/replay-data-drain.ts• L64-183 src/…/reattach-live-data-deferral.ts• L11-75 src/…/fresh-spawn-start.ts• L127-186 src/…/terminal-buffer-operations.ts• L111-143
Cold restoration
Cold restoration covers app, renderer, daemon, host, and WSL restarts. Durable session history provides the last usable screen, size, title, working directory, and bounded output. A live provider remains authoritative when it is reachable.
The history reader combines session metadata, a checkpoint, and newer output records. An open or host-lost session remains eligible for recovery. Unreadable history is quarantined or suspended rather than replaced by a fresh screen that could erase the only recovery copy. Scrollback snapshots use a bounded tail and can move from inline session data to profile storage without changing the pane identity.
References: src/…/history-reader.ts• L48-155 src/…/history-reader.ts• L219-315 src/…/cold-restore-payload-cache.ts• L33-99 src/…/cold-restore-resume-startup.ts• L1-180 src/…/web-runtime-worktree-terminal-after-wake.ts• L1-160 src/…/terminal-scrollback-snapshots.ts• L68-155 src/…/terminal-scrollback-snapshots.ts• L213-278
Orphan adoption
Orphan adoption gives a live PTY found in host inventory a durable pane and workspace owner. It is a recovery action, not a new spawn.
The runtime validates PTY identity, process incarnation, execution host, workspace, topology revision, and close records before it writes an adoption. An exact existing binding becomes a replay. A new binding is written durably and rolled back if the write fails.
References: src/…/adopt-terminal-orphans-from-inventory.ts• L1-200 src/…/runtime-terminal-orphan-adoption-plan.ts• L59-121 src/…/daemon-pty-inventory-observation.ts• L31-110 src/…/web-session-terminal-orphan-recovery-pane.ts• L1-180 src/…/terminal-resize-listeners.ts• L106-127
Scrollback bounds
Scrollback gives a view useful history without allowing one terminal to consume unbounded memory or transport space. The runtime keeps screen state, durable history, text tails, and transcript previews as separate bounded views.
Normal history and alternate-screen state remain distinct. A clear updates the headless mirror so a later restore cannot resurrect old rows. When continuity is lost, the runtime uses a snapshot or a clean boundary. The renderer keeps the user's scroll intent while it restores output and reapplies it after newer bytes settle.
References: src/…/cold-restore-payload-cache.ts• L33-99 src/…/daemon-durable-history-snapshot.ts• L18-83 src/…/terminal-history-manager.ts• L189-255 src/…/terminal-scrollback-snapshots.ts• L121-210 src/…/live-terminal-buffer.ts• L4-12 src/…/terminal-scroll-intent.ts• L1-180
Windows resize model
Windows ConPTY repaints its own viewport after a resize. Its row movement differs from the Unix PTY model, so the emulator and history replay must use the model of the daemon that recorded the live session.
The pane resolves the model from the machine that owns the PTY, not from the client that displays it. A paired server can mirror an SSH target, so late owner metadata can replace the client-side guess. Until the owner is known, the pane keeps its creation-time model.
References: src/…/conpty-reflow-viewport.ts• L109-172 src/…/daemon-history-replay-pty.ts• L6-29 src/…/pane-windows-pty-model.ts• L1-120 src/…/pty-transport-types.ts• L263-274 src/…/pty-repaint-request.ts• L4-23
Mobile and platform behavior
Mobile session terminals
Mobile terminals use the same PTY ownership and terminal handle model as desktop terminals. A mobile request can attach to a desktop view, create a runtime-owned surface when no window is available, or recover a live PTY whose surface publication was delayed.
Mobile subscriptions observe a terminal surface and do not take process ownership. Retried creates use a stable mutation identity so a retry joins the existing operation instead of spawning a second shell. If a desktop surface is available, the mobile request waits for publication and rescues a live-backed tab rather than rolling it back on a client timeout.
References: src/…/mobile-terminal-create.ts• L33-112 src/…/mobile-terminal-renderer-create.ts• L72-167 src/…/mobile-terminal-renderer-create.ts• L229-317 src/…/mobile-terminal-tab-mount.ts• L1-160 mobile/…/use-mobile-session-terminal-subscription.ts• L1-180
Mobile input floor
The input floor is the client currently allowed to drive terminal input and fit geometry. Mobile, desktop, and remote-desktop viewers can subscribe to the same PTY, but only the floor owner controls active input and size claims.
While mobile owns the floor, desktop input and layout changes are suppressed. A desktop take-back restores a measured desktop size when possible. Passive mobile subscriptions do not immediately take control again.
References: src/…/terminal-driver-resources.ts• L117-133 src/…/mobile-terminal-subscribe-internal.ts• L20-159 src/…/terminal-desktop-reclaim.ts• L38-97 src/…/pty-resize-forward.ts• L16-44 src/…/resize-visibility.ts• L47-59
Terminal subscriptions
The subscription interface lets desktop, mobile, and remote clients receive a live view. It registers the client before waiting for a PTY so unsubscribe, replacement, and socket close can end a pending stream.
The first snapshot establishes the screen baseline. The client then receives only output not covered by that snapshot. A subscription can mount a renderer tab before the PTY exists, wait for the PTY handle, or return a bounded read when no live PTY is available. A subscriber can also attach a daemon session that was never activated by a window; concurrent subscribers share one attach and keep ingestion alive when one releases it.
References: src/…/terminal-subscribe-method.ts• L12-123 src/…/terminal-multiplex-initial-snapshot.ts• L21-117 src/…/terminal-subscribe-binary-snapshot.ts• L20-83 src/…/remote-runtime-terminal-multiplexer.ts• L19-190 src/…/terminal-subscriber-driven-daemon-attach.test.ts• L291-371
Platform PTYs
One terminal contract maps to different execution hosts. POSIX uses native process groups. Windows uses ConPTY and a Windows process job. WSL adds a Windows-to-guest boundary for paths, environment, shell startup, hooks, and distro state. SSH and paired hosts keep their own host rules and PTY ownership.
The selected PTY host decides shell choice, path form, account environment, and hook endpoint. Input and resize behavior use the PTY owner's platform rather than the viewer's platform. Passive WSL restore does not boot a stopped distro; it waits for a settled running-state proof. Windows and WSL launch preparation also keeps host image, browser, clipboard, and agent paths on the side that owns the process.
References: src/…/native-pty-spawn.ts• L46-179 src/…/conpty-startup-input-reader.ts• L152-245 src/…/shell-launch-plan.ts• L56-187 src/…/wsl-orca-env.ts• L59-155 src/…/osc7-file-uri.ts• L15-81 src/…/daemon-wsl-passive-restore-hold.ts• L15-54 src/…/assembly.ts• L119-160 src/…/spawn-host-env.ts• L104-117
Daemon lifecycle
The daemon is detached from the UI and can outlive a window, app restart, or client replacement. It starts with a private endpoint, an authentication token, and a published identity. A replacement must prove that the incumbent is dead; uncertainty leaves the incumbent in place.
The server admits control and stream clients as an authenticated pair. Replacing a client cancels pending preparation and clears stream debt. Idle daemons retire only after they have no live PTYs and no pending work. A clean client disconnect can leave PTYs and history alive for warm reattach. On a reconnect, the runtime reattaches sessions that need ingestion and holds input until the new attachment is proven.
References: src/…/daemon-server.ts• L31-63 src/…/daemon-server-lifecycle.ts• L43-85 src/…/daemon-server-lifecycle.ts• L203-249 src/…/daemon-generation-liveness.ts• L51-113 src/…/daemon-pty-router.ts• L26-87 src/…/terminal-subscriber-driven-daemon-attach.test.ts• L436-527
Change checklist
When these files or sections are changed, remember to consider these:
- Keep session, pane, workspace, execution-host, PTY, and process-incarnation identity aligned across spawn, attach, input, resize, exit, recovery, and close.
- Keep adoption, fresh spawn, warm reattach, cold restore, host replacement, sleep, and close as separate outcomes. Recovery must not create a second shell.
- Keep shell readiness, startup command delivery, prompt handling, profile behavior, and launcher resolution paired across POSIX, Windows, WSL, SSH, remote runtime, and mobile paths.
- Keep inherited environment scrub, agent overlays, history paths, hook endpoints, image support, and path translation scoped to the selected host.
- Keep output sequence, snapshot boundary, parser state, replay generation, ACK credit, pause state, hidden-drop episode, and recovery state aligned. A gap or hidden drop must force a new recovery anchor.
- Keep refused input distinct from unknown input. Unknown bytes must never be replayed automatically.
- Keep owner-platform resolution tied to the PTY rather than the viewer. Do not use the paired client OS for Windows input or resize rules.
- Keep hidden or parked output, eager pre-attach buffering, scroll intent, alternate-screen state, and bounded scrollback consistent when a pane is revealed.
- Keep remote host handles, publication epochs, replacement policy, input sessions, and host liveness together. A stream exit alone must not retire a host-owned tab.
- Keep WSL distro state, boot identity, guest cwd, path flavor, and host-loss classification tied to the process incarnation.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| An unreachable owner is treated as absent | A second shell starts while the first still runs | Keep liveness unknown until the owner gives proof |
| A canceled create releases identity before physical exit | A replacement controls the old process or exceeds host capacity | Keep physical cleanup ownership until the child settles |
| Startup input bypasses shell readiness | A command becomes startup-file input or is lost | Hold automatic input behind readiness and use the timeout path |
| An unknown input write is retried | A command or paste can run twice | Report unknown delivery and do not replay it |
| A process result uses a stale PTY or incarnation | A replacement shell is closed or misclassified | Match the current PTY and process incarnation before accepting the result |
| Output is ACKed on receipt rather than scheduler consumption | Main releases more output than the renderer can parse | Give credit only when the scheduler consumes or discards the bytes |
| Hidden output is dropped without a restore marker | A revealed pane shows an old screen | Retain the drop episode until the painted restore is acknowledged |
| A stream gap is hidden from the renderer | The client shows a frozen or corrupted screen | Require exact continuation or snapshot recovery |
| Replay clears the screen after newer live bytes arrive | Current output disappears | Hold live bytes until replay and parser state settle |
| A remote stream exit closes the local mirror | A later host snapshot resurrects or incorrectly removes the tab | Let host publication decide lifecycle closure |
| A viewer OS selects terminal rules for a remote PTY | Input encoding or resize behavior is wrong | Resolve the PTY owner's platform |
| Passive WSL restore starts a stopped distro | A reload or background task changes host state | Require a settled running-state proof before launch |
| ConPTY history is replayed with the Unix resize model | Rows move, repeat, or disappear after resize | Stamp and reuse the hosting daemon's model |
| A mobile request rolls back after the client disconnects while a shell lives | A live shell loses its surface or becomes an orphan | Preserve a live-backed tab and let publication settle it |
Key files
| File | Why to read it |
|---|---|
| src/…/session.ts | Defines one PTY session's input, output, readiness, resize, snapshot, and termination contract |
| src/…/terminal-host-session-create.ts | Shows the boundary from launch preparation to a live session |
| src/…/terminal-host-session-publish.ts | Shows physical ownership, startup, publication, and initial attachment |
| src/…/shell-launch-plan.ts | Shows how host, shell family, cwd, and launch context are selected |
| src/…/assembly.ts | Shows host-scoped environment, hooks, paths, and launch features |
| src/…/spawn-options-assembly.ts | Shows the common launch contract and first-size seeding |
| src/…/spawn-commit-publication.ts | Shows when a PTY becomes a published owner and output source |
| src/…/pty-master-foreground-observation.ts | Defines safe foreground-group and process identity observation |
| src/…/history-reader.ts | Defines cold-restore eligibility and history replay |
| src/…/terminal-scrollback-snapshots.ts | Defines bounded durable scrollback storage and migration |
| src/…/conpty-reflow-viewport.ts | Explains the Windows resize model |
| src/…/use-terminal-startup-activation.ts | Shows startup admission and default terminal seeding |
| src/…/connect-pane-pty.ts | Assembles pane ownership, transport, input, resize, output, and recovery concerns |
| src/…/fresh-spawn-start.ts | Shows fresh spawn fencing, startup delivery, reattach choice, and binding |
| src/…/replay-data-drain.ts | Shows replay ordering, source-grid restore, reset, and focus handling |
| src/…/pty-transport-types.ts | Describes attach, spawn, input, replay, recovery, and owner metadata at the pane boundary |
| src/…/accept.ts | Shows output admission, hidden delivery decisions, sequence boundaries, and restore markers |
| src/…/flush.ts | Shows bounded output draining, flow control, and safe escape-frame splitting |
| src/…/pty-hidden-delivery-gate.ts | Defines hidden output drops, raw-byte interest, and painted restore episodes |
| src/…/pty-dispatcher.ts | Routes output and exit events while preserving bounded pre-attach delivery |
| src/…/remote-runtime-pty-transport.ts | Shows remote host binding, input hold, reconnect, and handle recovery |
| src/…/remote-runtime-terminal-multiplexer.ts | Defines remote terminal subscription, capabilities, input, resize, and output flow control |
| src/…/remote-runtime-terminal-snapshot-controller.ts | Defines remote gap repair and snapshot recovery |
| src/…/pty-resize-forward.ts | Shows resize authority, mobile suppression, and applied-size repair |
| src/…/terminal-subscriber-driven-daemon-attach.test.ts | Shows subscriber-driven attach, shared ingestion, and reconnect input safety |
| src/…/terminal-tab-actions.ts | Shows close intent, running-work confirmation, and host-owned close behavior |
| PTY streaming and recovery | Ordered delivery, replay, gaps, backpressure, and recovery contract |
| Terminal presentation contracts | Renderer-facing screen state and terminal side-effect contract |