an infinite-canvas terminal multiplexer using gpui

tarpd: keep terminals in holder processes #9

Closed eti.tf
targeting main from eti.tf/tarp:eti/tarpd-holders
Closed opened by and assigned to eti.tf
targeting main from eti.tf/tarp:eti/tarpd-holders

tarpd used to own every pty directly, so stopping or restarting the daemon hung up every terminal.

Each terminal now runs under a holder: the same executable started again in its own session. The holder opens the pty, spawns the command, keeps the master open, and reaps the child. It passes the master to tarpd over a unix socket in <state_dir>/held/, using SCM_RIGHTS.

  • On startup, tarpd connects to every holder it finds, so terminals come back with their ids, positions and processes.
  • Moves go to the holder as they happen. On SIGTERM, SIGINT and daemon.kill, tarpd also hands each holder the screen and title, so the next daemon restores the screen.
  • The systemd unit sets KillMode = "process" so a restart does not kill the holders.

Based on op/kmwmtpnqoxwu.

Tested on NixOS aarch64: tarpd, tarpc and sim tests, plus new tests: a terminal outlives one daemon and the next one takes it over, and a command that ends at once still reports its exit.

Commits 38

tarpd: keep terminals in holder processes
tarp: chat beside the cursor
tarp: follow the keyboard layout for option as alt
tarp: tighten readme wording and add recovery steps to warnings
readme: document mod gestures and macos window options
tarp: spawn terminals over the attached connection
tarp: add hover move gesture
tarp: add configurable resize gesture modifiers
flake: build packages with crane
tarp: keep the window on its space so macos restores focus
tarp: add macos transparent titlebar and window buttons options
tarp: add global new terminal shortcut on macos
tarp: autoconnect hosts at startup
bump hash
tarp: keep the newest cursor move of each person from any host
sim: number the cursor moves
tarpc: send a numbered cursor move
tarpd: keep the newest cursor move, and let the left event hide it
protocol: number each cursor move
tarp: lock the windows of a host that this client can only view
tarp: send the cursor when the camera moves or the window is focused again
tarp: send moves and resizes live, 30 times a second
tarp: bake in ibm plex mono
tarp: attach as one of many clients
flake: bump gpui-canvas and gpui-terminal
nix: run tarpd as a login agent on darwin
nix: add the policy and openRole options
sim: check a real daemon and its clients against a model
tarpc: attach as one of many clients
tarpd: let many clients attach, each with a role
transport: add peer_id and hostname
transport: give each paired client a role
protocol: send cursors between clients
protocol: type the events of the daemon
protocol: add client.focus and client.rename
protocol: let many clients attach at once
protocol: give each method the least role that can call it
protocol: describe the people on a canvas