Files
tty7/README.md
T
l0ng-aiandl0ng-ai cd9577c590 feat(agents): recognize CLI coding agents + git branch in the sidebar (#85)
* feat(agents): recognize CLI coding agents + show git branch in the sidebar

Observe (never wrap) third-party coding agents running in a pane — Claude
Code, Codex, Gemini CLI, Aider, Amp, OpenCode and ~10 more — and enrich the
UI around them, plus front each sidebar row with its git branch and diff.

Detection & identity
- Command-based detection over the foreground argv (launcher basename, and
  interpreter-wrapped `node …/cli.js` / `npx …` forms), with user rules via
  `agent_commands` in config. Brand avatars on the tab chip and sidebar row.

Rich status channel
- A per-pane state machine (idle / working / waiting-for-you / done) driven
  by agent-reported events over an OSC 777 sentinel channel
  (`tty7://cli-agent`, versioned JSON), sniffed daemon-side and streamed to
  the client (DaemonMsg::AgentStatus).
- `tty7 agent-hook claude <event>` + a palette installer wire Claude Code's
  lifecycle hooks up; the hook writes the sentinel to the controlling tty
  (with an ancestor-tty fallback for detached hook processes).
- Avatar status dot: working (blue) / waiting (amber) / done (green); an
  unread finished turn gets a crisp outer ring that clears on focus.

Notifications, resume, context feed
- "Needs your permission…" the moment an agent blocks; "finished after Ns"
  per turn, honoring the notify policy (rich turns suppress the coarse exit).
- Session resume: restored panes re-launch their conversation
  (`claude --resume …`), gated by `restore_agent_sessions` (default on).
- Palette commands send the current selection or the repo `git diff` to the
  running agent as a ready-made prompt.

Sidebar git line
- New `terminal::git_status`: off-thread `git` probe (branch, or short sha
  when detached; `git diff --numstat HEAD` line counts) with
  GIT_OPTIONAL_LOCKS=0, refreshed on cwd change or command finish, dropped
  on a stale cwd via a generation tag.
- Each row is avatar + title + `⎇ branch  +N −M` (green/red), sized to
  content; the redundant cwd/"Working…" lines and the aggregate rollup are
  gone — the status dot and branch line carry it.

672 tests pass.

* fix(agents): repair CI and refresh the git line when an agent turn ends

- The live PTY detection test used `sh -c 'exec -a codex cat'`, but
  `exec -a` is a bashism dash (Ubuntu's /bin/sh) rejects — spawn bash.
- cargo fmt over cli_agent.rs / view.rs / app.rs.
- An agent session is one long foreground command, so the back-to-prompt
  edge never refreshed the sidebar's branch/diff line while the agent
  worked — exactly when the working tree changes. poll_agent_status now
  reports a turn ending (transition into Done) and the poll reprobes git
  on that edge too.

---------

Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
2026-07-15 14:35:24 +08:00

8.3 KiB
Raw Blame History

tty7

tty7

A GPU-rendered terminal in pure Rust.

GPU rendering on Zed's gpui · VT core from Alacritty


CI Version License Discord

Why tty7 · Install · Features · Benchmarks · Keybindings

English · 简体中文

Why tty7

  • Fast — about 2× the throughput of Alacritty, Ghostty, or Kitty on the same hardware (benchmarks)
  • A modern prompt — completion, syntax highlighting, and history search built in; no plugins to assemble
  • Sessions that survive — close the window or quit the app, your shells keep running; no tmux
  • Zero config — zsh, bash, fish, and PowerShell work out of the box

Native builds for macOS, Windows, and Linux ship with every release.

Install

Download the build for your platform from Releases:

  • macOStty7-<version>-macos-arm64.dmg (Apple Silicon) or …-x86_64.dmg (Intel); open it and drag tty7.app into Applications.
  • Windows…-windows-x86_64-setup.exe (installer: Start Menu shortcut + uninstall entry), or …-windows-x86_64.zip (portable: unzip and run tty7.exe).
  • Linux…-linux-x86_64.AppImage (recommended: bundles the x11/wayland libraries, so it runs on Fedora / Arch / etc. with no extra packages — chmod +x and run), or …-linux-x86_64.tar.gz (bare binary; extract and run ./tty7, needs the usual x11/wayland runtime libraries installed).

Features

At the prompt

  • Ghost suggestions — your history completes the whole line as you type; to accept
  • Tab completion that explains — every flag and subcommand with its description, for ~100 common commands
  • Syntax highlighting — as you type, nothing to install
  • Fuzzy history search⌃ R shows what you ran, where, and whether it failed
  • History from day one — your existing shell history just works, and carries across sessions
  • Real line editing — selection, word motion, undo

In the window

  • Tabs & splits — always open in the current directory
  • Command palette ⌘ P · scrollback search ⌘ F
  • ⌘-click links · desktop notifications
  • Eight themes · CJK / IME input

CLI coding agents

tty7 recognizes third-party coding agents running in a pane (Claude Code, Codex, Gemini CLI, Aider, Amp, OpenCode, and ~10 more) and enriches them — it never wraps or replaces the agent.

  • Brand avatars — the tab chip / sidebar row shows which agent runs where; custom wrappers map in via agent_commands in config.json
  • Live status dot — working (blue) / needs your input (amber) / done (green), driven by agent-reported events over an OSC channel; run Agent: Install Claude Code Hooks from the palette to wire Claude Code up
  • Notifications that matter — "needs your permission…" the moment an agent blocks on you, and "finished after Ns" per turn, honoring your notification policy
  • Branch at a glance — each sidebar row shows its pane's git branch and working-tree diff (+N M), refreshed on cd and when a command finishes
  • Session resume — panes lost to a reboot re-launch their agent conversation (claude --resume …) on restore (restore_agent_sessions, on by default)
  • Context feed — palette commands send the current selection or the repo's git diff to the running agent as a ready-made prompt

SSH connection manager

A native Rust SSH stack (russh) is the only path — profiles, credentials, and SFTP without ever shelling out to ssh. There is no system-ssh compat mode.

  • QuickConnect — type user@host[:port] in the palette and connect; IPv6 [::1]:port supported
  • Saved profiles — full connection config with passwords / passphrases in the OS keychain, never on disk
  • ~/.ssh/config aliases — type one to connect (resolved natively — common fields, best-effort — over russh), or import them as profiles in Settings
  • GUI auth — in-pane sheets for password, key passphrase, 2FA, and host-key confirmation (new vs. changed)
  • Built-in SFTP — a slide-in file panel: browse, upload / download, rename / delete / chmod, drag to Finder
  • Port forwarding — Local / Remote / Dynamic, preconfigured or added live, plus ⌘-click localhost:PORT to auto-forward
  • Jump hosts & proxies — multi-hop via profile references or ProxyJump, ProxyCommand, SOCKS5 / HTTP
Entry point Connects via
Saved profiles · QuickConnect · typed user@host[:port] Native russh — SFTP · keychain · GUI auth · L/R/D forwards
~/.ssh/config aliases Resolved natively, then russh (Match/canonicalize/GSSAPI unsupported — no fallback)

Benchmarks

All four terminals measured back-to-back on the same machine, same day, same 155×40 grid — Apple M1 Pro, macOS 26.3.1, five-run averages (2026-07-04):

tty7 Alacritty Ghostty Kitty
Plaintext IO — 11 MB cat (lower = better) 95 ms 239 ms 179 ms 185 ms
DOOM-fire frame rate (higher = better) 888 fps 485 fps 552 fps 617 fps
Cold-launch memory 116 MB¹ 105 MB 128 MB 130 MB

¹ GUI 105 MB + the persistent daemon 11 MB.

Where the speed comes from:

  • The PTY is read at device speed and parsed in large batches, off the render path
  • Hot paths are lock-free — a big cat never waits on drawing
  • The daemon buffers up to 16 MiB ahead of the window before backpressure applies

Methodology (how each terminal is driven, grid fairness, known pitfalls) and one-command reproduction live in scripts/bench/ — run it yourself.

Keybindings

Keys are shown in macOS notation — on Windows and Linux, read as Ctrl. Open Settings with ⌘ , to browse or remap them all. The essentials:

⌘ T · ⌘ W · ⌘ ⇧ T new tab · close tab · reopen closed tab
⌘ 1⌘ 9 · ⌃ ⇥ · ⌃ ⇧ ⇥ jump to tab 19 · next tab · previous tab
⌘ D · ⌘ ⇧ D split right · split down
⌘ ] · ⌘ [ next pane · previous pane
⌘ ⌥ ←→↑↓ focus the pane in that direction
⌘ ⏎ · ⌘ ⇧ ⏎ toggle fullscreen · maximize / restore the pane
⌘ K clear the screen and scrollback
⌘ P command palette
⌘ F search the scrollback
⌃ R fuzzy-search shell history
⌘ + · · ⌘ 0 font size up · down · reset

Settings → Keybindings lists every shortcut. Click one, press the new keys (Esc cancels, Backspace resets to default), and it takes effect immediately. Pane resize and swap have no default keys — bind them here or run them from the command palette. Prefer tmux muscle memory? Flip the tmux preset to remap pane/tab actions onto a prefix (default ⌃ B): ⌃ B C opens a tab, ⌃ B % splits, ⌃ B then an arrow moves focus. A bare prefix reaches the shell after a brief pause, and prefix + an unbound key is passed straight through to the terminal.