Files
tty7/Cargo.toml
T
l0ng-aiandClaude 24cf458e3b feat(mobile): a phone app to watch and drive tty7 panes (#983)
* feat(mobile): a gateway that lets a paired phone reach this machine over iroh

The first half of the mobile app: everything on the desktop side, plus the
client library the app will link.

- tty7-mobile-proto: the phone<->gateway wire protocol. One stream per purpose
  (pair, control, pane), framed like the daemon's frames, with raw terminal
  bytes kept out of JSON. No tty7-core, so it cross-compiles for iOS/Android.
- tty7-gateway: dials nothing, accepts phones over iroh (hole punching, relay
  fallback, end-to-end encrypted), checks the peer's key against the paired
  device list, and bridges to the daemon. Panes are observed, not attached,
  and keystrokes go in through SendInput, so a phone never resizes a pane or
  takes it away from the desktop window. `pair` prints a one-time QR code.
- tty7-mobile-client: the phone side (pair, tree, pane streams, direct/relay
  and RTT for the link), plus a `probe` example that stands in for a phone.

Verified against a real, isolated daemon: pair, tree, and typing into a pane
over a direct path, ~0.8 ms median echo on loopback.

* feat(mobile): the Tauri app — pair, browse the machine, drive a pane

The phone half, as a Tauri 2 app in mobile/ (its own cargo workspace, so the
desktop build and CI never compile a WebView stack).

- Rust side: the phone's iroh endpoint and key, paired machines, and every
  live stream, behind eight commands. Terminal output crosses to the WebView
  as raw ArrayBuffers on a Tauri channel, batched per frame, in order with the
  pane's JSON events.
- Frontend: vanilla TS + xterm.js. Paired machines and pairing; one machine's
  workspaces, tabs and panes with agents that need you pinned on top and the
  link's direct/relay path and RTT in the header; a terminal that fits the
  desktop pane's width, with an esc/tab/ctrl/arrows key bar. Coming back from
  the background re-watches and re-opens, relying on the daemon's replay.

Verified as a macOS build against a live gateway and an isolated daemon:
paired from the app, tree rendered on a direct path, keystrokes and key-bar
arrows reached the pane. iOS/Android builds need Xcode / the Android NDK,
neither of which is on this machine; mobile/README.md has the steps.

* fix(gateway): one serve per machine, and say how to start a missing server

- `serve` takes an exclusive lock on <config dir>/mobile/serve.lock. A second
  gateway on the same key is a second endpoint answering to one address, so a
  phone reached whichever the network picked. It is now refused, naming the
  pid that holds the lock.
- With no tty7 server running, phones and the terminal both hear "tty7 isn't
  running on <host> — open tty7 there, or run `tty7 server start`" instead of
  "lost the tty7 server: No such file or directory". `serve` checks once at
  startup, and still starts, since tty7 may be opened after it.

* feat(mobile): redesign the app as a native-feeling, minimal UI

The first cut read as a web page of bordered boxes. This rebuilds it the way a
phone app moves and reads, in the desktop tty7's own look:

- Screens push and pop with View Transitions; large titles fold into the bar.
- Grouped inset lists on a tinted canvas, following the system Light/Dark with
  the desktop presets, accent and ANSI palettes. Hack for code and terminal.
- Panes are listed by tab, one card per workspace, with the desktop's agent
  avatars and status badges (Waiting hollow, Working blinking) and its words.
- Pairing is its own screen, with steps, a Paste button and inline errors.
- A machine that stays silent for 10 s says so and offers to pair again; an
  offline notice says what to check.
- The terminal header shows live/offline in words. A pane too wide to read is
  shown at a readable size and pans to follow the cursor, with a toggle to fit
  the whole width. The key bar has drawn icons, puts left/right first, and
  has a keyboard toggle.

PRODUCT.md and DESIGN.md record the product facts and the design system.

* feat(mobile): open a new tab from the phone

Each workspace on a machine's screen gets a "New tab" action. It starts a
shell at the end of that workspace, in the directory its last tab is in, and
opens it straight away.

- Protocol: a one-shot `Open::NewTab { workspace_id, cwd, size }` stream,
  answered with `Ok` and a `TabCreated { tab_id, pane_id }`, or `Denied`.
  It is additive, so the protocol version stays. A gateway from before this
  drops the stream unanswered, and the app says to update it.
- Gateway: takes the same two steps as `tty7 tab new`, spawning a shell owned
  by the workspace and then TabCreate. The shell starts at the grid the phone
  asked for, because no desktop window is showing it yet. Sizes are clamped.
- App: a `tab_new` command, with the size worked out from the screen at the
  readable font size.
- probe: `newtab <workspace-id> [cwd]`.

* feat(mobile): reach the machines the desktop is linked to over SSH

A machine's screen now lists, under its own workspaces, every machine its
tty7 holds an SSH link to, with that machine's workspaces. Panes there open,
take input and get new tabs like local ones. "Needs you" gathers panes from
all of them.

- The gateway routes through the local server over links it already holds,
  the same way `tty7 -m <machine>` does. It never dials a down link, because
  that would guess at credentials the phone does not have. A down link
  shows as "Link down", with a note to reconnect it on the desktop.
- Protocol, additive: `Tree.remotes`, and an optional `machine` (the link
  key) on `Open::Pane` and `Open::NewTab`. A local pane is asked for exactly
  as before, so older gateways still understand it.
- Rebuilding a route target from a link key moves from the CLI into
  tty7-core as `RouteInfo::target` / `RouteInfo::host`, so the CLI and the
  gateway share one rule. The CLI now calls it.

* perf(gateway): read linked machines in parallel, never waiting on a slow one

Linked machines were read one after another on every tree poll. One slow
SSH link, whose requests can take 10 s, stalled the whole tree for every
phone, local workspaces included. It also held a lock that queued pane
opens, input and new tabs on every other link.

- Each linked machine is read on its own thread (`poller::Poller`). A poll
  waits at most 250 ms. A machine that has not answered is reported as it
  last was, and its read lands for the next poll. Only one read is in flight
  per machine, however many phones are watching. A machine that drops off and
  comes back cannot receive a stale read, because each slot has a generation.
- Routed control connections are locked per machine, not all together.
- A link that is up but has not answered its first read is sent as
  `RemoteView.pending` (additive). The app shows "Reading…" with skeleton
  rows instead of claiming the machine has no workspaces.

* fix(mobile): keep reaching the computer after the gateway restarts

Every `serve` bound a random port, so a restart left each phone holding
addresses that no longer answered. Where the n0 relays are unreachable, which
is common behind the Great Firewall, the phone had no other way to find the
gateway until it was paired again.

- `serve` listens on the same UDP port every time. It picks one on first run,
  keeps it in `<config dir>/mobile/port`, and moves only if the port is taken.
  IPv6 binding may fail, as in iroh's own defaults.
- Both ends add mDNS lookup (`iroh-mdns-address-lookup`, service `_tty7._udp`).
  On the same network a phone finds the gateway by key when its addresses are
  stale, such as after a new DHCP lease or a new IPv6 prefix. The gateway
  advertises and the phone only listens. If multicast is refused, each side
  starts without it and says so, rather than failing.
- iOS: `Info.ios.plist` declares the local-network use and the Bonjour
  service, without which iOS blocks multicast.
- An ignored test (`--test mdns`) connects by key alone over mDNS, for a
  machine that allows multicast.

* feat(mobile): run the gateway in the desktop daemon, paired from Settings

Phone access no longer needs `tty7-gateway serve` in a terminal.
Settings → Mobile switches it on, and the local daemon runs the gateway from
then on, with every window closed as well. That is where the panes a phone
reaches live anyway.

- Settings → Mobile, in all three locales:
  - an "Allow phone access" switch;
  - a status line (running, starting, off, or why it failed);
  - "Show code", which draws the QR code and the tty7pair: code with a
    Copy button, and closes on its own once a phone uses it;
  - the paired phones, each with Unpair.
  The section is in search, including by its config key `mobile_access`.
- The daemon (`tty7-app --daemon`) runs a supervisor (`core::mobile`). It
  watches `mobile_access` in config.json, re-reading only when the file
  changes, and starts or stops the gateway. A failed start is retried every
  30 s and logged once.
- tty7-gateway grows a `service` module: `start()` returns a stoppable
  handle, and `pair_code()` makes a code. The CLI's `serve` and `pair` are
  thin wrappers over them now. The gateway logs through `log`, so the
  daemon's output lands in its log file, and it reports itself in
  `mobile/status.json`. `State::serving()` checks the lock, which a crash
  cannot leave stale. A gateway that cannot take the lock leaves the
  status alone, because it belongs to the one holding the lock.
- iroh is linked into the GUI binary only. tty7-server stays the lean static
  binary pushed to remote machines.

* feat(mobile): serve phones whichever daemon is running

A daemon started by `tty7 server start` is the lean tty7-server, which
carries no gateway. With phone access on, the Settings status stayed on
"Starting…" and no phone could connect.

The GUI now checks, 5 s after it starts and whenever phone access is
switched on. If nothing is serving, it starts `tty7-app --mobile-gateway`,
detached the same way as the daemon (`spawn::detach_helper`). The helper
serves until the switch goes off, and exits at once if another process
already holds the gateway lock. When the daemon's own gateway is up, no
helper is started. The helper logs under its own role, "mobile".

* refactor(mobile): the daemon owns the gateway, as a child, whoever started it

There were two ways of running the gateway: a thread inside `tty7-app
--daemon`, and a detached helper the GUI started when the daemon could not.
That is now one way.

Every daemon, whether `tty7-app --daemon` or `tty7-server`, runs
`tty7_core::daemon::mobile::supervise` from `run_with`. While
`mobile_access` is on it keeps the gateway running as a child process, and
stops it when the switch goes off.

- Which program: `tty7-app` runs itself as `--mobile-gateway`. `tty7-server`
  runs a `tty7-gateway serve --exit-with-stdin` from beside it or on PATH,
  and links nothing new. Without one, it writes the reason into
  `mobile/status.json` for Settings to show, instead of "Starting…" forever.
- Lifetime: the child's stdin is a pipe from the daemon, and the gateway
  exits when it closes. A stopped, crashed or handed-off daemon (the pipe
  is close-on-exec) takes its gateway with it, and the next daemon starts
  one from its own binary. No gateway from an older build survives an
  update.
- Isolation: iroh no longer runs inside the process that holds every pane.
- `Status` moves to tty7-core, the one definition that the daemon, the
  gateway and the GUI all share.
- Gone: the GUI's helper check (`core::mobile` in the app) and the in-daemon
  gateway thread.

* fix(mobile): stop and reap the gateway before a daemon handoff

Found by running a real `tty7 server restart`. The old gateway did exit,
because the new image's supervisor started its own gateway and the old one
lost the lock. But it was left as a zombie: the image after the exec never
reaps a child it did not start, so each handoff leaked a process entry.

`hand_over` now calls `daemon::mobile::stop_for_handoff` before the exec,
which closes the gateway's stdin and waits for it. A flag keeps the
supervisor from starting another in the moments before the exec, and
`handoff_failed` clears the flag if the exec never happens, so the daemon
goes on serving.

Checked with two handoffs in a row (tty7-app → tty7-server → tty7-server):
- each old gateway was reaped, with no zombies system-wide;
- exactly one fresh gateway was running after each handoff;
- the pane's shell and its environment survived;
- the probe phone kept working.

* feat(mobile): the switch shows whether phones can reach you, not a status row

Settings → Mobile had an "Allow phone access" switch that showed intent and a
separate Status row that showed reality. That is one thing shown twice, and
the switch could sit on while nothing was running.

- The switch is the state. Switching on holds it at "Starting…", disabled,
  until a gateway is actually serving. If the daemon reports a failure, or
  nothing comes up within 15 s, the switch goes back off, `mobile_access`
  is reverted, and a notification says why.
- If the page opens on a failure the daemon is still retrying, the switch
  shows off with the reason in its description, and switching it on
  retries.
- The Status row is removed, with its four strings. There are two new
  strings for the failure, in en, zh and ja.

Also fixes the Settings window never showing notifications. It is a `Root`
like the workspace window but did not draw the notification layer, so any
toast pushed from Settings was queued and never shown. That included the
existing "Set as Default Terminal" result.

Checked in a dev instance. On a tty7-server daemon with no tty7-gateway:
Starting… first, then off, with "Phone access could not start: … no
tty7-gateway beside it or on PATH". On a tty7-app daemon: on, with Show
code enabled and no toast.

* feat(mobile): drop the "Needs you" section

The machine screen gathered every pane whose agent was waiting or done into
a "Needs you" section above the workspaces. Done lasts until the next prompt,
so the section grew with every finished agent and mostly held panes that
needed nothing.

Panes now appear once, in their own workspace. Each keeps its status badge
and words ("Needs input", "Working", "Done") and the agent's message.
PRODUCT.md and the design sidecar are updated to match.

* fix(mobile): say when typing doesn't reach the pane

The gateway's input thread gave up silently on a failed send_input, and
the app's input task did the same on a failed write, so the phone kept
showing a live pane while keystrokes went nowhere. Both now report the
failure as a pane error. Keys after it are dropped rather than ending
the stream, which the phone would read as the pane closing.

* feat(mobile): a compose box, paste and Shift+Tab on the terminal

Replying to an agent meant typing into xterm a character at a time,
without autocorrect, dictation or a usable IME. The compose box is a
real text field: Send types the text and then Enter, as its own write,
and several lines go in as one bracketed paste when the program asked
for it. Drafts survive leaving the pane and a send that failed. An
agent's pane opens on the box with the keyboard down.

The key bar gains Shift+Tab (Claude Code's mode switch) and a paste key.
A failed keystroke now takes the pane offline with a Reconnect banner
instead of being swallowed.

* feat(mobile): reconnect on its own, and select text to copy

A dropped pane or machine stream is retried with backoff (1s, 2s, 4s …
15s) and at once when the network comes back, rather than waiting for a
tap on Reconnect. The pane keeps its last screen up until the new
replay starts, and output or errors from a replaced stream are ignored.

Touch selection does not work in xterm, so a copy key lays the whole
buffer out as plain text over the pane, wrapped to the phone and joined
where the terminal wrapped, for the phone's own selection and Copy.

* feat(daemon): size leases, and Take Back on the desktop

An observer can now run a pane at its own size (ClientMsg::Lease, feature
size-lease). The pty and every observer go to that size. The controller
keeps its grid, its resizes are remembered rather than applied, and the
pane goes back to the last of them when the lease ends: the observer lets
go, its connection closes, or the controller takes it back.

A controller hears about leases only after asking (Watch), since an older
client cannot decode DaemonMsg::Lease. The desktop asks on every attach,
spawn and relink where the daemon advertises the feature, locally or
through the host hello for remote workspaces, and shows the pane as in
use on the phone with a Take Back button.

* feat(mobile): take a pane over at the phone's size

The terminal's phone button asks the gateway to run the pane at the
phone's grid (PaneRequest::TakeOver), which it turns into a size lease on
the observer connection, named after the paired device. The grid follows
the keyboard and rotation; leaving the pane, or the connection dropping,
gives it back. When the desktop takes it back the app says so and offers
to take it over again, never doing it on its own. A daemon too old for
leases is reported, and the pane keeps working.

* fix(mobile): link SystemConfiguration and install a rustls provider on iOS

The first iOS build failed to link: netdev and system-configuration, pulled
in by iroh, need SystemConfiguration.framework, which the generated Xcode
project does not list. bundle.iOS.frameworks adds it on `tauri ios init`.

Once linked, the app panicked at launch: iroh builds its reqwest client with
`rustls-no-provider`, so a process-wide crypto provider must be installed
before any client is built. Install ring's, which is already in the tree.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(mobile): keep the terminal's scrollbar on screen while panning

Panning a pane wider than the phone scrolled xterm's own box sideways with
the text. The box was only the view's width, so its vertical scrollbar
panned off with the columns and its scrollback stopped taking touches past
the first screen. The box now spans every column, and the bar is shifted
to the visible right edge as the view pans.

The bar is also drawn like the indicator WebKit shows for the pan, thin,
rounded and translucent, instead of VS Code's 14px square slider, so the
two axes match.

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(mobile): pair by scanning the QR code, and Enter and quick-answer keys

Pairing took a pasted `tty7pair:` code, which on a real phone means getting
text off the desktop somehow. A Scan button next to Paste now reads the QR
code tty7 shows, through tauri-plugin-barcode-scanner, and pairs straight
away. The camera runs behind the WebView with our own viewfinder and Cancel,
since the plugin's full-screen view has no way out. The plugin is registered
on phones only, so the desktop dev build is unchanged.

The key bar gains Enter, so an agent's highlighted choice can be confirmed
without raising the keyboard, and 1 2 3 y n for numbered choices and y/n
prompts.

Co-Authored-By: Claude <noreply@anthropic.com>

* chore(mobile): sign for the App Store and declare exempt encryption

Sets the development team so `tauri ios init` writes it into the Xcode
project, and marks the app's encryption (standard TLS/QUIC only) as exempt
so TestFlight uploads skip the export-compliance question.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(mobile): count the iOS safe areas once

The WKWebView's scroll view inset its content by the safe areas, and the
page, laid out with viewport-fit=cover, padded by env(safe-area-inset-*)
as well. The viewport came out 778pt tall on an 874pt screen: everything
sat a status bar's height too low, with a blank band under it. The scroll
view's automatic inset adjustment is now off, so the page runs edge to
edge and its CSS alone keeps clear of the status bar and home indicator.

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(mobile): the Terminal Mobile redesign

The app takes the desktop's neutral greys, light and dark, with ink rather
than a system blue for what is pressed or chosen.

- Machines: pairing's "+" moves to a floating bar at the bottom beside a
  search field. Each machine shows its link, round trip and tab count as
  last seen.
- A machine: tabs grouped by workspace with a count; round agent glyphs;
  a dot on the right for running or waiting on you. The per-group New tab
  buttons give way to one "+" in the same floating bar, beside tab search.
- New tab: a sheet to pick Claude Code, Codex or a shell, and the
  workspace. An agent's command is typed into the new tab once it is live.
- A pane: the bar keeps only back, the title with its state, and a menu
  for selecting text, the fit and the phone's size. Under it, one row of
  equal keys, a page at a time, and a message box that is always there;
  its round button sends, or when empty hands the keyboard to the
  terminal.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(mobile): the tty7 mark as the iOS app icon

The phone showed Tauri's default icon: `tauri ios init` filled the Xcode
project with it. The committed icons/ios set was drawn on the macOS grid,
a rounded tile inset on transparency, which iOS would shrink inside its own
mask with a pale border. icons/app-icon-ios.svg is the same Duo mark full
bleed, rendered without alpha as the App Store requires.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* fix(mobile): typing, scrolling and pairing on a real phone

- Typing into a pane: an input method's text never reached it, since iOS
  never commits a candidate into xterm's hidden textarea. Tapping the
  terminal now focuses a plain field of our own, whose committed text goes
  to the pane as it is committed. Backspace on the empty field, Enter, Tab
  and the arrows go as the terminal's keys.
- xterm sends nothing itself any more (disableStdin). That also stops the
  phone answering a program's colour and device queries: the desktop
  answers those, and the phone's late second answer landed in the shell as
  typed text.
- Scrolling the scrollback: xterm 6 has no working touch scrolling. A
  mostly vertical swipe now scrolls the buffer a row at a time and coasts;
  a sideways one is left to the native pan.
- Pairing: the steps name the desktop's Settings -> Mobile, Allow phone
  access and Show code, not a command-line gateway, and so do the notices
  when a machine cannot be reached.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* fix(mobile): room for the keyboard, and smoother vertical scrolling

- The keyboard: the WebView runs edge to edge and is not resized for it,
  so it covered the dock and the pane's last lines. The app now takes the
  size of the visual viewport, drops the home indicator's gap while the
  keyboard is up, and keeps the cursor's line in sight.
- Scrolling: the terminal draws with xterm's WebGL renderer, which a
  scroll does not make lay every row out again. A swipe is applied once a
  frame, and moves the view by pixels: xterm scrolls whole rows, and the
  rest of a row is a GPU shift of the drawn screen, put on together with
  the rows it goes with.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* feat(mobile): settings, message history, and a tighter home screen

- Settings, from beside the Machines title: appearance (automatic, light,
  dark; the status bar and keyboard follow through the window's interface
  style), terminal text size, how a pane wider than the phone first shows,
  clearing the message history, and the version.
- The message box keeps what it sends on the phone. As a message is
  written, past ones that match take the key row's place; with the box
  empty, a History button opens them all, searchable. A line that asks for
  a password is sent but not kept.
- ^R on the third key page, for the shell's own history search.
- A top-level screen's bar floats over the list, clear until the title
  scrolls under it, so the large title sits just under the status bar.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* fix(mobile): a fitted pane fills the view, and its scrollbar drags

- A pane shorter than the view (a wide one, fitted) no longer leaves the
  bottom of the screen blank: the terminal here runs as many rows as fill
  the view, the extra ones holding the pane's earlier lines, and what is
  left over goes above so the prompt stays next to the keys. The pane on
  the desktop keeps its size.
- A drag that starts on the scrollbar is left to xterm. The swipe handler
  took it too, the other way round, and the two cancelled out.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* fix(mobile): errors say what to do in the app, not on the command line

The messages a phone shows, and the two Settings → Mobile can, named the
gateway process, the CLI's `tty7 server start`, the transport and a lock
file's path. They now speak of tty7 on the computer and of pairing: open
it there, update it, pair again, quit the other copy.

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

* style: rustfmt the gateway and mobile client

Claude-Session: https://claude.ai/code/session_01HVosmYyVSH3BrsLYx3tcSS

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 19:09:32 +08:00

453 lines
23 KiB
TOML

[package]
name = "tty7"
version.workspace = true
edition = "2024"
description = "A terminal workbench: shells, persistent sessions, SSH, coding agents — GPU-rendered on Zed's gpui, pure Rust"
repository = "https://github.com/l0ng-ai/tty7"
license = "Apache-2.0"
readme = "README.md"
publish = false
default-run = "tty7-app"
[[bin]]
name = "tty7-app"
path = "src/main.rs"
[[bin]]
name = "tty7-updater"
path = "src/bin/tty7-updater.rs"
required-features = ["updater"]
[dependencies]
# The framework-free half of tty7: wire protocol, session daemon, PTY, the
# native SSH engine, and the domain model the headless `tty7-server` shares with
# this GUI. Everything that does *not* need gpui lives there.
# `gssapi` is off in tty7-core's defaults (a static musl `tty7-server` cannot
# link the system krb5 it binds); the GUI, which builds against a real desktop
# toolchain, turns it on so managed SSH connections keep offering
# `gssapi-with-mic` exactly as before.
#
# `remote-install` is off there for the same shape of reason: it pulls an HTTPS
# client used only to *download* a `tty7-server` onto a remote machine
# (decision D5). The server binary is the thing being downloaded, so it can
# never take that path; the GUI, which is the client that pushes it, can.
#
# `github` is the right panel's GitHub tab: the same HTTPS client, pointed at
# api.github.com.
tty7-core = { path = "crates/tty7-core", features = ["gssapi", "remote-install", "github"] }
# The mobile gateway, run by the local daemon while mobile access is on
# (`core::mobile`). Lives in the GUI binary only: tty7-server is the lean static
# binary pushed to remote machines, and must not grow iroh.
tty7-gateway = { path = "crates/tty7-gateway" }
# Draws the pairing code in Settings → Mobile.
qrcode = { version = "0.14", default-features = false }
gpui = { workspace = true }
gpui_platform = { workspace = true }
gpui-component = { workspace = true }
gpui-component-assets = { workspace = true }
anyhow.workspace = true
log.workspace = true
# Smart double-click selection patterns (URL/email/path). Already in the tree
# transitively, so pinning it here adds no new native code.
regex = "1"
# SIMD byte search for `ParkedCursorScanner`'s fast path
# (`terminal::parked_cursor`), which scans every output batch the client
# receives — the same skip-ahead the
# tokenizers in `tty7-core` already use. Already in the tree via `tty7-core`,
# so this pins no new code.
memchr = "2"
# Grapheme-cluster boundaries for the sidebar's label elision
# (`ui::tab_strip`). Cutting a label by `char` tears emoji apart: a ZWJ
# sequence loses its joiner, `❤️` loses the variation selector that makes it an
# emoji, and half a flag renders as a bare letter. Already in the tree via
# gpui, so this pins no new code.
unicode-segmentation = "1"
# Column widths for the input bar (`terminal::view`). The bar has to lay text
# out the way the terminal grid will, and the grid gets its widths from this
# same crate by way of `alacritty_terminal` — a hand-rolled code-point table
# drifts from it the moment Unicode adds a block. Already in the tree via
# `tty7-cli`, so this pins no new code.
unicode-width = "0.2"
smol.workspace = true
smallvec.workspace = true
serde = { workspace = true }
serde_json.workspace = true
tempfile = "3"
# LaunchServices sends files and custom URL schemes through gpui's unified
# open-URL callback. `url` keeps the decoding and SSH authority parsing here
# standards-compliant rather than treating percent escapes as literal paths,
# and `percent-encoding` — already in the tree under `url` — spells the
# userinfo and man-page names back out.
url = "2"
percent-encoding = "2"
# The code editor's language-server client (`ui::lsp`). The same version
# gpui-component's LSP hooks take their types from.
lsp-types = { version = "0.97.0", features = ["proposed"] }
# The code editor's file loading and saving (`ui::editor_text`). `encoding_rs`
# decodes legacy-encoded text (GB18030, Windows-1252) and writes it back in the
# same encoding, and `globset` matches `.editorconfig` section globs. Both are
# already in the tree (via gpui's HTTP stack and its `ignore` walker), so they
# pin no new code.
encoding_rs = "0.8.35"
globset = "0.4.20"
# SSH profile ids in the connection manager UI (`ui::ssh_connect`,
# `ui::settings`, the command palette). The profiles themselves — and the
# secret-free `CredentialRef` they carry — live in `tty7-core`, which `Config`
# needs to parse `config.json` without gpui.
uuid = { version = "1", features = ["v4", "serde"] }
# The credential vault's storage half (`core::keychain`). `keyring` 4.x's default
# `v1` feature auto-selects the platform store (macOS Keychain / Windows
# Credential Manager / Linux Secret Service), so no per-platform guards are
# needed.
#
# It sits here rather than in `tty7-core` on purpose: every caller is in `ui::`
# (`ssh_prompt`, `ssh_connect`, `settings`, `app`), and leaving it downstairs made
# the headless `tty7-server` — a static binary pushed onto machines that have no
# keychain at all — link `zbus`/`secret-service` and thirty-odd crates behind them
# for code it can never reach. Only the secret-free naming half (`CredentialRef`,
# the account scheme) stays in core, where `config.json` parsing needs it.
keyring = "4"
# Theme files. tty7 themes are authored as YAML (`~/.config/tty7/themes/*.yaml`,
# our own schema); `plist` parses imported iTerm2 `.itermcolors` schemes (XML
# plist) so the large iTerm color-scheme ecosystem drops straight in. serde_yaml
# is already in the tree transitively, so it pins no new code; plist is pure Rust.
serde_yaml = "0.9"
plist = "1"
# Clipboard-image paste (`terminal::view`). When the clipboard holds a screenshot
# and a coding-agent TUI (Claude Code &co.) is in the pane, off macOS we stage the
# image to a temp file and paste its path — agents attach an image path the same way
# they do a drag-drop. Windows screenshots arrive as BMP (`CF_DIB`), which agent
# vision won't accept, so we transcode to PNG. `image` is already in the tree via
# gpui's own clipboard code, so pinning it here adds no new native code.
image = "0.25"
# HTTP client for the startup update check (`core::update`): one GET to the
# GitHub releases API to see if a newer version has shipped. `reqwest_client`
# wraps Zed's `zed-reqwest` fork behind gpui's `http_client` trait (re-exported
# as `gpui::http_client`) and manages its own tokio runtime. That reqwest+rustls
# stack is *already* compiled into the tree via `gpui-component-assets`, so this
# pins no new native code — it only exposes what we're already building. Pinned
# to gpui's rev so the shared `http_client`/`zed-reqwest` versions stay aligned.
reqwest_client = { git = "https://github.com/zed-industries/zed", rev = "1d217ee39d381ac101b7cf49d3d22451ac1093fe" }
# See `[workspace.dependencies]`: the pin is shared with tty7-cli, which parses
# `capture` output through the same grid.
alacritty_terminal.workspace = true
# Desktop notifications driven by OSC 9 / OSC 777 escape sequences, on Linux and
# Windows. On macOS only its `set_application` is used — never `show`; see
# `terminal::remote::macos_notify` for why.
notify-rust = "4"
# Filesystem watcher for live config reload: watches `config.json` and reloads
# `Config` + re-applies the theme without a restart. The code panel (file tree /
# editor, `ui::code`) reuses it to refresh the tree and detect external edits.
notify = "8"
# System tray / menu bar status item (`ui::tray`). Rasterizes the bundled SVG
# logo into the tray bitmap at runtime — gpui's own SVG path only yields a
# tinted alpha mask, not raw RGBA. The gpui and gpui-component forks both pin
# the same 0.47, so the whole tree shares a single resvg/usvg/tiny-skia stack;
# default features off drops the text/font machinery our icon SVGs don't use.
resvg = { version = "0.47", default-features = false }
# The tray icon itself, macOS + Windows: tauri's `tray-icon` (NSStatusItem /
# Shell_NotifyIcon via objc2 / windows-sys, both already in the tree). Linux is
# deliberately NOT on this crate — its Linux backend needs GTK + libappindicator,
# which tty7's AppImage doesn't bundle and the x11/wayland gpui backends don't
# pull. Linux instead uses `ksni` below.
[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
tray-icon = "0.24"
# The pty-size ioctl in `terminal::generator` is the only libc user left in the
# GUI (the daemon's own libc calls went to tty7-core), and it is Unix-only — so
# the dep is Unix-only too.
[target.'cfg(unix)'.dependencies]
libc = "0.2"
# `core::cli_install` edits HKCU\Environment to put the bundled CLI on PATH.
# `setx` is not an option there: it truncates at 1024 characters, so a long user
# PATH comes back mangled. 0.61 is already in the tree (tray-icon pulls it), so
# this pins no new code.
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
# ConvertStringSecurityDescriptorToSecurityDescriptorW + SECURITY_ATTRIBUTES:
# the elevated updater's %ProgramData% staging directory gets an explicit
# admin-only DACL (see `create_dir_admin_only` in tty7-updater).
"Win32_Security",
"Win32_Security_Authorization",
"Win32_System_Registry",
"Wdk_System_SystemServices",
"Win32_System_SystemInformation",
# `MessageBeep` (the terminal bell in `terminal::view`) is a user32 export,
# but the Win32 metadata files it under Diagnostics::Debug, so that is the
# module the binding needs — nothing here pulls in dbghelp.
"Win32_System_Diagnostics_Debug",
"Win32_System_Threading",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
] }
# The standalone updater extracts only Windows release ZIPs. Reuse the async
# reader already present in Cargo.lock and enable only the Deflate codec emitted
# by PowerShell's Compress-Archive.
async_zip = { version = "0.0.19", default-features = false, features = ["deflate"], optional = true }
# COM for toast branding (`core::aumid`): IShellLinkW + IPropertyStore stamp
# System.AppUserModel.ID onto the Start Menu shortcut, which Windows requires
# before it honors an unpackaged app's toast identity (otherwise the toast
# backend falls back to PowerShell's). 0.58 is already in the tree via gpui.
windows = { version = "0.58", features = [
"Data_Xml_Dom",
"Foundation",
"UI_Notifications",
"Win32_Foundation",
"Win32_Storage_EnhancedStorage",
# IShellLinkW::GetPath takes a WIN32_FIND_DATAW, so reading an existing
# shortcut's target back — which is how `aumid` decides whether it has to
# write at all — needs the file-system bindings too.
"Win32_Storage_FileSystem",
"Win32_System_Com",
"Win32_System_Com_StructuredStorage",
"Win32_System_Variant",
"Win32_UI_Shell",
"Win32_UI_Shell_PropertiesSystem",
] }
# Embeds `assets/favicon.ico` into the `.exe` so Windows shows the tty7 logo in
# the taskbar / window / Explorer (macOS gets its icon from the `.app` bundle via
# bundle.sh instead). Only needed at build time on Windows — see build.rs.
[target.'cfg(windows)'.build-dependencies]
winresource = "0.1"
# gpui only *reads* the macOS window appearance; it never sets it. We force the
# app appearance to match the active theme (see `ui::theme::sync_native_appearance`)
# so the native traffic-light buttons render in the right light/dark style.
[target.'cfg(target_os = "macos")'.dependencies]
# CFStringTokenizer FFI for dictionary-based CJK word segmentation on
# double-click (`terminal::smart_select`). Already in the tree transitively,
# and it makes jieba unnecessary here — see the non-macos section below.
core-foundation = "0.10"
objc2 = "0.6"
objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSResponder", "NSAppearance", "NSGraphics", "NSImage"] }
# NSData feeds the runtime Dock icon for bare (non-bundled) binaries — see
# `set_dock_icon_for_bare_binary` in main.rs.
# NSUserNotification is the click-to-reveal notification path — see
# `terminal::remote::macos_notify` for why it is driven directly.
# NSUserDefaults (with NSDictionary / NSValue for the domain it takes) pins
# `AppleFontSmoothing` for this process when `font_thicken` is off — see
# `apply_font_thicken` in main.rs.
objc2-foundation = { version = "0.3", features = ["NSData", "NSDictionary", "NSString", "NSUserDefaults", "NSUserNotification", "NSValue"] }
# Dictionary-based Chinese word segmentation for double-click selection
# (`terminal::smart_select`), as a *fallback* where the OS has no tokenizer of
# its own. macOS is excluded on purpose: CFStringTokenizer segments Chinese
# about as well (and Japanese/Korean far better) at zero cost, while jieba's
# table costs ~55 MB resident once built and ~2 MB of binary for the embedded
# dictionary. Keeping the dep off macOS means that dictionary isn't even
# linked into the build that can't use it.
[target.'cfg(not(target_os = "macos"))'.dependencies]
jieba-rs = "0.10"
# x11/wayland are the Linux windowing backends; only pull them on Linux. The
# Windows backend (`gpui_windows`) and macOS backend are selected by gpui_platform
# itself via `cfg`, so no feature is needed for them.
[target.'cfg(target_os = "linux")'.dependencies]
gpui_platform = { workspace = true, features = ["x11", "wayland"] }
# Linux tray (`ui::tray`): pure-Rust StatusNotifierItem over DBus (zbus — already
# in the tree). `blocking` + `async-io` gives a synchronous handle without
# requiring the app to own a tokio runtime; ksni runs its own service thread. On
# desktops without an SNI host (bare GNOME without the AppIndicator extension)
# spawning fails and the tray is silently absent — the app is unaffected.
ksni = { version = "0.3.6", default-features = false, features = ["blocking", "async-io"] }
# gpui's `test-support` unlocks `#[gpui::test]` + `TestAppContext`, the headless
# App/Window harness the view/event tests run on. Dev-only: the feature merges
# into test builds and never reaches a release binary.
[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
[lints]
workspace = true
[features]
default = []
updater = ["dep:async_zip"]
# ---- Standalone workspace mirroring gpui-component's pins so the git/source
# ---- caches are shared and versions stay aligned. ----
[workspace]
members = ["crates/*"]
# The root `tty7` package is a member implicitly; naming every crate here is
# what makes a bare `cargo build` / `cargo test` at the root cover the whole
# workspace, which is how CI invokes them.
default-members = [".", "crates/tty7-core", "crates/tty7-server", "crates/tty7-cli"]
[workspace.package]
edition = "2024"
# The single version for all three crates — `tty7`, `tty7-core`, `tty7-server`
# all inherit it with `version.workspace = true`. They ship together and a
# client talking to a server of a different build has to be able to say so, so
# they must never drift apart. This is the line a release bump edits (and the
# one nightly's `awk '/^version = /'` stamps: it is the first such line in the
# file, since the package entries above are all `version.workspace = true`).
version = "26.9.4"
[workspace.dependencies]
# Our fork's `tty7` branch carries the local customizations tty7 relies on:
# `PopupMenu::with_size`, the 1px hairline menu separator, and the custom-button
# label color the chrome tiles need. The exact commit is still pinned by
# Cargo.lock. For co-developing the UI crate, point these back at a sibling
# checkout: `path = "../gpui-component/crates/{ui,assets}"` — but never commit
# that, since a path dependency can't resolve on CI.
#
# `tree-sitter-languages` compiles the grammars the code editor highlights with.
gpui-component = { git = "https://github.com/l0ng-ai/gpui-component", branch = "tty7", version = "0.5.2", features = [
"tree-sitter-languages",
] }
gpui-component-assets = { git = "https://github.com/l0ng-ai/gpui-component", branch = "tty7", version = "0.5.1" }
gpui = { git = "https://github.com/zed-industries/zed", rev = "1d217ee39d381ac101b7cf49d3d22451ac1093fe" }
# Base features are cross-platform (`font-kit`, `runtime_shaders` only map to the
# macOS backend; they're no-ops elsewhere). The Linux-only `x11`/`wayland`
# backends are added by the `cfg(target_os = "linux")` dependency entry in the
# package manifest, so they never reach the Windows/macOS builds.
gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "1d217ee39d381ac101b7cf49d3d22451ac1093fe", features = ["font-kit", "runtime_shaders"] }
# Our fork of Zed's alacritty_terminal fork: the VT parser + grid
# (`Term`/`ansi::Processor`). Two packages read it and they must agree, hence
# this being a workspace pin rather than one each — the GUI (`terminal::remote`)
# to render the live mirror, and tty7-cli to turn a captured pane back into text
# (`tty7 capture --plain`). The daemon parses nothing; it is a byte pipe, and its
# PTY is driven by `portable-pty`.
#
# The `tty7` branch is Zed's `fcf32fe` (the rev Zed pins) plus two commits, both
# still missing from alacritty master as of 852e971:
#
# 1. `push_keyboard_mode` capped its stack by removing from `title_stack` instead
# of `keyboard_mode_stack` — a copy-paste slip from `push_title` that compiles
# because both are `Vec`s. With `kitty_keyboard` on (see
# `terminal_config_from_user`) every overflowing push silently drops a saved
# title, and once the title stack is empty `Vec::remove(0)` panics — 4097
# unpopped `CSI > 1 u` pushes, about 20KB of output, kill the reader thread and
# freeze the pane.
# 2. `input` reserves columns per `char`, so an emoji written as base + U+FE0F
# (`❤️`, `🗂️`, `⚠️` — any base whose East Asian Width is Neutral) gets one
# column instead of two and shifts the rest of the line left by one. The fork
# re-scores the sequence with `UnicodeWidthStr` and widens the cell (issue
# #203).
#
# Each patch has a guard test in `src/terminal/remote.rs`; drop this fork once
# both land upstream.
alacritty_terminal = { git = "https://github.com/l0ng-ai/alacritty", rev = "1276f128fbaa8832cbc66210675cbe8aeb570499" }
anyhow = "1"
log = "0.4"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1"
smallvec = "1"
smol = "2"
[patch.crates-io]
# Our fork (l0ng-ai/russh, branch `tty7`): ayamir's gssapi-with-mic client auth
# (0d1d073) plus Eugeny/russh 58886f4d + 24e2c374, which stop zlib from
# truncating packets that inflate past 2x — without them a host with
# `Compression yes` connects and never prints a byte (#997). GSSAPI has since
# landed upstream (#738, in 0.62.7 / 0.63), but 0.62.7 lacks 24e2c374 and 0.63
# changes `check_server_key`; drop this patch when moving to 0.63.2+. Pinned
# to an exact rev (never a branch): russh is the SSH protocol layer handling
# user credentials, and `cargo update` must not change what it builds.
russh = { git = "https://github.com/l0ng-ai/russh", rev = "34f73e68d875b6fc2529654102ee65bafc691c59" }
[workspace.lints.clippy]
dbg_macro = "deny"
todo = "deny"
type_complexity = "allow"
[profile.dev]
codegen-units = 16
debug = "limited"
split-debuginfo = "unpacked"
[profile.dev.package]
resvg = { opt-level = 3 }
rustybuzz = { opt-level = 3 }
taffy = { opt-level = 3 }
ttf-parser = { opt-level = 3 }
smol = { opt-level = 3 }
gpui = { opt-level = 3 }
gpui_platform = { opt-level = 3 }
gpui_macros = { opt-level = 3 }
# The VT parser + grid run on every PTY byte; at opt-level 0 a `cat bigfile`
# crawls under `cargo dev`.
alacritty_terminal = { opt-level = 3 }
# The render/parse hot path crosses the tty7 ↔ alacritty_terminal ↔ gpui crate
# boundaries, so cross-crate inlining (thin LTO, like Zed ships) buys real
# throughput there; single codegen unit for the same reason.
[profile.release]
lto = "thin"
codegen-units = 1
# ---- gpui fork ------------------------------------------------------------
# Our `tty7` branch (cut from the pinned upstream rev) carries:
#
# 1. `prefers_ime_for_printable_keys` takes the keystroke, so an input handler can
# answer per key instead of per view. tty7 needs it for Option-as-Meta — macOS
# routes ⌥-chords to the IME whenever a CJK input source is active, and without
# the keystroke there is no way to decline just those chords (see
# `terminal::input::prefers_ime_for_printable_keys`, issue #177).
#
# 2. gpui's Windows backend rasterizes a font-fallback run with the face
# DirectWrite actually shaped it with, instead of re-deriving one from the
# face's family/weight/style. The round trip mapped DirectWrite's italic to
# oblique, so italic CJK — which every pane reaches through the fallback chain,
# Hack having no CJK — drew a *different* face's outlines at the shaped glyph
# indices. Every character rendered as an unrelated character, one for one,
# which reads as mojibake rather than as a font bug.
#
# 3. resvg/usvg bumped 0.45 → 0.47 so gpui's SVG stack unifies with the resvg
# tty7 pins directly above (follow-up to the #227 dependabot bump).
#
# 4. `ListState::with_size_hint`. A list counts an item it has not laid out yet
# as zero tall, so a long document reports itself as about one viewport and
# a scrollbar reading that height drags one viewport and stops — the diff
# overlay scrolls a whole working tree through one of these. The hint counts
# the unmeasured items at an estimate instead, which `measure_all` would
# settle exactly at the price of laying out the whole document on the first
# frame (see `ui::diff_overlay::DIFF_LINE_H`).
#
# 5. A text layout remembers the width it was truncated to, and a size measured
# under truncation no longer answers a later measure that asks for the whole
# text. A flex item is measured against a squeezed width first and for its
# content size after; answering the second from the first laid every
# truncating name out as just its ellipsis (see the switcher's
# `a_truncating_name_beside_its_number_takes_the_room_it_has`).
#
# 6. `enter` and `tab` map to their native key equivalents in macOS menus.
# Without them NSMenuItem got the literal string "enter" and took its first
# character, so a `secondary-enter` item (ToggleFullscreen) read as ⌘E.
#
# Patching by source rather than editing the `gpui`/`gpui_platform` pins above is
# deliberate: `gpui-component` declares its own `gpui` from the upstream URL, and
# a plain pin swap would put two incompatible copies of gpui in the tree. `[patch]`
# rewrites the source for every dependent at once, so the fork's sibling crates
# (`gpui_macos`, `gpui_web`, …) come along through their in-repo path deps.
#
# When bumping the upstream rev: rebase the fork's `tty7` branch onto the new rev,
# push, then update the `rev` pins above — the branch here follows automatically.
[patch."https://github.com/zed-industries/zed"]
gpui = { git = "https://github.com/l0ng-ai/zed", branch = "tty7" }
gpui_platform = { git = "https://github.com/l0ng-ai/zed", branch = "tty7" }
gpui_macros = { git = "https://github.com/l0ng-ai/zed", branch = "tty7" }
gpui_web = { git = "https://github.com/l0ng-ai/zed", branch = "tty7" }
reqwest_client = { git = "https://github.com/l0ng-ai/zed", branch = "tty7" }