Skip to content

feat: run agents on a Gentle Shell server (native thin client of gentle-shell serve) - #255

Draft
ismaelosuna7824 wants to merge 74 commits into
mainfrom
feat/remote-serve-backend
Draft

ismaelosuna7824 wants to merge 74 commits into
mainfrom
feat/remote-serve-backend

Conversation

@ismaelosuna7824

@ismaelosuna7824 ismaelosuna7824 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #247

Depends on Gentleman-Programming/gentle-shell#3529 (RFC #3527): the gentle-shell serve server, its protocol gentle-shell.serve/v1, Desktop RPC additions and the terminal host protocol. Every feature here is gated on the capabilities that server advertises; against a server without them the app says upgrade Gentle Shell there and never falls back to this computer.

Summary

The app can now use a Gentle Shell server (gentle-shell serve on another computer: a Linux box, a Mac mini, a Windows PC) as a machine where agents run, side by side with this computer. The server owns the agent sessions, the project folders, git and the terminals, and they keep running while the app is closed. The app is a native thin client: it pairs with one short code over pinned TLS, opens the server's folders in workspaces of their own, shows their files, diffs, branches and terminals, configures the server's Gentle Shell, and on relaunch reattaches every agent tab and terminal pane to the session and shell it had. The tools that need this computer (in-app browser, screen control, simulators and emulators, Maestro, themes, canvas, Agent UI) keep working for agents on the server: they run here as host tools the server's agent calls.

Nothing changes for workspaces on this computer, WSL or a command backend, except where noted in Impact on existing users.

Size: 72 commits, 194 files, +41.9k / −1.5k lines. Every commit builds on its own (cargo check --workspace --all-targets --locked, checked commit by commit).

Contents

Architecture

flowchart LR
  subgraph Here["This computer: Gentle Shell GPUI"]
    direction TB
    WS["Workspaces<br/>(each keeps its machine)"]
    Views["Tabs, Files, editor, Changes,<br/>Branches, Git pane, terminals,<br/>Configuration"]
    Choke["Choke points:<br/>backend::fs · backend::git ·<br/>terminal/remote.rs · PiProcess"]
    Tools["Host tools: open_page, browser, screen,<br/>device, maestro, app_theme, canvas_*, gentle_ui"]
    Proxy["Local pinned proxy<br/>127.0.0.1:random"]
    Client["pi_rpc::serve (ServeClient)<br/>pinned TLS / relay"]
    WS --> Views --> Choke --> Client
    Tools <--> Client
    Views -. web cards .-> Proxy --> Client
  end
  subgraph Relay["optional: gentle-shell relay"]
    R["splices ciphertext"]
  end
  subgraph There["Server: gentle-shell serve"]
    Api["HTTP API + SSE<br/>gentle-shell.serve/v1"]
    Pi["gentle-shell --mode rpc<br/>sessions + Desktop RPC"]
    Term["gentle-term-host<br/>(persistent PTYs)"]
    Fwd["Forwards to the<br/>server's loopback"]
    Disk[("Folders, git, uploads,<br/>config, Engram, Tower")]
    Api --> Pi & Term & Fwd & Disk
  end
  Client -- "Bearer token, HTTPS pinned to the certificate" --> Api
  Client -. "same pinned TLS, end to end" .-> R -.-> Api
Loading

Where a request goes. Every view that touches a project's files, git or a shell asks one of three choke points (backend::fs, backend::git, terminal/remote.rs) which side to use, and agent tabs are a PiProcess like any other (child process, WSL, command, or now a server session). The answer comes from the workspace the path belongs to (backend::for_tab, gentle_core::machines::owner), so a window can hold a workspace on this computer and one on a server at the same time.

flowchart TD
  P["path / tab / pane"] --> O{"machines::owner:<br/>workspace whose folder<br/>holds the path"}
  O -->|"this computer / WSL / command"| L["Fs::Local · git child · local PTY ·<br/>PiProcess child (unchanged code)"]
  O -->|"server id"| S["Fs::Server · POST /api/git ·<br/>server terminal · PiProcess::serve"]
  S --> C{"server offers it?<br/>(capabilities + scopes)"}
  C -->|yes| API["ServeClient → serve"]
  C -->|no| U["“upgrade Gentle Shell there” /<br/>“Do this on the server: run …”"]
Loading

What ships, by area

1. Pairing and reaching the server

sequenceDiagram
  participant U as User
  participant S as Server (gentle-shell serve)
  participant A as App
  U->>S: gentle-shell serve share
  S-->>U: XXXX-XXXX (5 min, single use) + long gsc1.… code
  U->>A: Code → Connect
  alt short code
    A->>S: UDP discover → broadcast, ports 8787–8796
    S-->>A: {id, name, port, tls, fp} (hint only)
    A->>S: GET /.well-known/gentle-shell (serverId must match)
    A->>S: POST /api/pair/proof {nonce}
    S-->>A: proofs — one must equal HMAC(scrypt(code, salt‖fp), fp‖nonce)
  else long code gsc1.…
    Note over A: id, name, port, addresses, fp, relay
    A->>S: /.well-known at every address and through the relay, pinned to fp
  end
  A->>S: POST /api/pair {code, name} (pinned connection)
  S-->>A: device id + token
  Note over A: settings.json: address, device, name<br/>server-tokens.json (0600): token, fp, relay, serverId, addresses, home
Loading
Piece What it does Commit(s)
Short code Configuration › Where agents run (or the first-run screen) has one Code field. The 8-character code (XXXX-XXXX, Crockford base32; case, spaces, dashes, O/0, I/L/1 forgiven) finds the server by UDP broadcast on the LAN, verifies every answer at /.well-known/gentle-shell, and pairs with the one found or lists several to pick from. Interface broadcast addresses come from sysinfo's network feature. 2154227, 54c9099
Long code gsc1.… (base64url JSON: server id, name, port, addresses, pairing code, certificate fingerprint, relay) connects by itself when pasted: every address is tried at once (1.5 s each, 4 s overall). 2154227
Address Enter address manually keeps address + serve pair code; a typed http:// address moves to https:// once the server says it speaks TLS. 4b575c0
Pinned TLS The server's certificate is self-signed; the client pins its SHA-256 fingerprint with its own rustls verifier (no CA, no host name; the handshake signature is still checked). A different certificate stops the connection before a byte of the request (or token) is sent: pair again. Plain HTTP only for servers paired without TLS (same computer, or --no-tls). 4b575c0
Pairing proof Before a code found through discovery or a typed address goes out, the server proves it knows the code: HMAC-SHA256 over fp ‖ nonce keyed by scrypt(code, "gentle-shell/pair-proof/v1" ‖ fp; N=2^15, r=8, p=1). A machine that merely answers discovery never sees the code. Known-answer vector shared with the server's tests. 4b575c0
Relay A gsr://host:port relay (in the long code, or remembered when the paired addresses stop answering) reaches a server outside the LAN: one hello line naming the server by fingerprint, then the same pinned TLS end to end; the relay only sees ciphertext. ec6a032
Address changes Pairing keeps the server id, host name and every address it was reached at. A request that can't connect rediscovers the server (broadcast, known addresses, <host>, <host>.local), checks /.well-known names the same serverId and pinned certificate, saves where it answers now and retries there; every clone of the client follows. 839ad25
Keyed by server id Workspaces and saved tabs name a server by its id, not its URL (older saves migrate when a pairing knows the id), so a server reached at a new address keeps its workspaces and restored tabs reattach their sessions. 69cfbbc
Re-pair in place Pairing a known server again (by id, or by pinned certificate for older pairings) replaces the pairing in place (new token, address; old addresses kept); the server replaces the old device (POST /api/devices/self/replace) so its terminals belong to the new pairing; open agents and terminals follow. 69cfbbc
Unpair Asks the server to remove this device (DELETE /api/devices/self), then forgets the token. Tabs let go of their sessions (left running there for a later pairing). Unreachable or older server: forgotten here, and Configuration says the server still lists the device and how to remove it. 69cfbbc

2. Sessions over serve

Piece What it does Commit(s)
Transport PiProcess::serve: commands POST /api/sessions/:id/rpc in order (one unanswered after 2 s lets the next go, so abort never waits behind bash), answers read as stdout, 202 pending settled from the stream; events on SSE resumed by seq, 45 s silence limit, backoff reconnect; snapshot-required → the tab reads its state again. 081950c, f07578c, 9bccb99
Reattach Closing a tab stops its session; quitting detaches. The pane saves its server session (the server and the session id); relaunch reattaches (GET /api/sessions/:id, then get_messages rebuilds the conversation without replay), or starts a new session resuming the Pi conversation by exact id. A canvas's floating agent reattaches the same way. 9bccb99, c9eb20b
Desktop RPC epoch The server's Desktop RPC numbering restarts at 1 after a reload (a package install). Events and snapshots now carry an epoch; a new epoch is a restart, not a replay, so events after an install are no longer dropped as duplicates. Within one epoch (and with servers without one) duplicates and stale snapshots are still refused. cd0bef2
Dialogs across devices Every device following a session shows its dialogs; the first answer wins. serve_dialog_resolved and 409 dialog_answered close the dialog everywhere else with a quiet note. 0f7fe40
Disconnected / Start again A tab whose session ended reads Disconnected from <server> with Start again, which reattaches when the session is still there, else resumes the conversation in a new one. 0c0447f, 69cfbbc
sequenceDiagram
  participant A as App
  participant S as gentle-shell serve
  participant T as gentle-term-host
  Note over A: ⌘Q: detach (nothing stopped)
  Note over S,T: agent session and shell keep running
  A->>S: GET /api/sessions/:id
  alt still running
    A->>S: events?after=seq · get_state · get_messages
  else gone (stopped, server restarted)
    A->>S: POST /api/sessions {cwd, sessionId} (resumes the conversation)
  end
  A->>S: GET /api/terminals/:t/stream
  S->>T: attach
  T-->>A: snapshot (screen as it is), then output from the offset
Loading

3. Several machines side by side

Piece What it does Commit(s)
Per-workspace machine Each workspace saves its machine (server id, or its WSL/command backend; workspaces.json version 2, migrated from version 1 to where the default ran then). Its tabs, terminals, files and git follow it. Agents run on is only the default for new workspaces; changing it moves nothing. 9697822, f600c9c
Paired servers list Where agents run lists every pairing (name, address, status, Unpair each) and Pair another server; choosing this computer forgets none. f600c9c
Settings for Configuration opens with a Settings for selector (this computer, its environment, every paired server; the active workspace's first). Every page reads and writes that machine; switching reopens Configuration on the same page. f600c9c
Open folder per machine ⌘O / Open folder… / Open folder on <server>… browse a chosen machine (a machine row in the explorer); a typed /path in ⌘K is offered on each server. The folder opens as a workspace on that machine; Open Gentle Shell here opens an agent tab there. f600c9c, 323097b, e382e6d
Server folders Server paths are never canonicalized on this computer (normalized by text, folder_key); a workspace matches by machine and root. Pairing on first run opens the server's home as its own workspace named after that folder. 17a7fd7, 323097b, f600c9c

4. Host tools

The tools that need this computer are offered to the agent as host tools (set_host_tools); the server routes each call only to the device that registered it.

Tool Runs here Commit(s)
open_page a card shown at once in the window (or the user's browser per Devices › Browser); server-loopback URLs through a forward. The result says where it opened. e32bfbd, c8014b0
browser, screen the window's browser driver; gentle-screen in-process e32bfbd
canvas_read/edit/shot the open canvas, in-process e32bfbd
device, app_theme the device panel / agent-device; the app's themes folder 8a43438, 007f413
maestro Maestro CLI on the panel's simulator/emulator (no Maestro MCP on the server) e993901
gentle_ui Agent UI's extension logic ported to Rust (gentle_core::genui::host): specs, patches, summaries, reviews that wait, events, host context 78d9e74, 007f413
  • List and capability gating. Each tool is offered only when its condition holds (devices on, a canvas beside the agent, Agent UI not Off, the server advertising set_host_tools/host_message/set_host_context), and offered again after a reconnect, a session switch or an Agent UI mode change. Pi-rpc carries the contract's limits (names, schemas, 8 MiB result content, per-method request caps). dc5ce85
  • Local mode via probe. A Gentle Shell on this computer (or WSL, or through a command) new enough to have serve gets the same host tools over stdio instead of the app's --append-system-prompt/--extension arguments. Detected with <launcher> serve --help only (5 s, cached per launcher build), because an older launcher would forward any other serve … to the model. Older launchers keep the instructions and extensions. 1593b31
  • Progress heartbeat. A server fails an unanswered host tool call after 10 minutes. When it advertises host_tool_progress, each tab sends a beat every 60 s for each call still running (a gentle_ui review waiting for decisions, a browser wait, a Maestro flow); stops on answer, cancel, unknown_call/already_answered, or backend exit. Older servers keep the 9-minute review fallback. 13f0cef

5. Forwarded pages, local pinned proxy, Tower

sequenceDiagram
  participant W as Web card / browser
  participant P as Local proxy 127.0.0.1:random
  participant S as serve forward listener
  participant D as Dev server on the server's loopback
  W->>P: GET /?gs_ticket=… (Host must be 127.0.0.1/localhost:port)
  P->>S: same request over pinned TLS (or relay), Host rewritten
  S-->>P: 303 + gs_fwd cookie (ticket traded once)
  P-->>W: Location rewritten back to the proxy
  W->>P: page, SSE, WebSocket bytes as they come
  P->>S: … → D
  Note over W,P: last card closes → proxy closes →<br/>DELETE /api/forwards/:id
Loading
  • Pages a server agent names on its own loopback (dev servers, the design canvas, open_page, /web, a URL in tool output) open through the server's authenticated forward, never as this computer's localhost. 46a6425, 302a955
  • The web view can't trust the pinned, self-signed certificate, so each forward is opened through a local proxy on 127.0.0.1:<random> that carries every connection over the pinned TLS (or the relay). HTTP/1.1 keep-alive, SSE and WebSocket pass through; a foreign Host gets 421 (DNS rebinding); a changed certificate gets a 502 with the message. ebf36f8
  • open_page shows at once. An explicit open (open_page, gentle-open) shows its card immediately instead of hiding it in the tray (a hidden card has no web view, so nothing reached the forward); the tool result says "in the Gentle Shell app's browser", "in their own web browser", or the server's reason. c8014b0
  • Closing closes. When the last card holding a proxy lets go, the proxy closes and asks the server to close the forward. ea25344
  • The single-use gs_ticket is never shown: not in the card header, not in the Pages menu. e5bab57, 9785d9b
  • Gentle Tower on a server runs there (POST /api/tower) and opens through the same proxy; Integrations › Gentle Tower says whether the server offers it. 46a6425, 302a955, f600c9c

6. Files, git and terminals

Piece What it does Commit(s)
Files backend::fs choke point: tree (with /api/fs/watch live updates, ignored files dimmed via server git), editor with etag-guarded saves (Changed on the server), new/rename/delete/copy, ⌘K Files, search, Markdown images, folder browser. 5130038, 04f1007
Git backend::git sends POST /api/git {cwd, args, env}: Changes, Branches, Git pane and actions, palette branches, Review. Commit messages are written on the server (POST /api/print). 04f1007, c62be1d
Terminals Persistent server terminals: attach with a screen snapshot, resume by byte offset, survive app quit and serve restarts; closing deletes. Opened once the pane's size holds (no garbled 80×24 reattach). 04f1007, 75e20ec
gentle-term-host crate New binary crate run by the server: PTYs kept alive with a headless alacritty Term per PTY for snapshots, 2 MiB replay ring, 8 MiB per-connection backpressure, idle exit. Unix socket on Unix; loopback TCP with a random token (owner-only token file: 0600 / protected DACL) everywhere, the only transport on Windows (ConPTY). 72b001a, 1908861, ea53fa4
Install without releases Install terminal support on <server> offers the app's own gentle-term-host when the server's platform/arch match this build (beside the executable, in the macOS bundle, or a dev build's target folder), a file the user picks, or the build command. The pane shows the SHA-256; the upload carries it and the server checks it. Nothing is downloaded. f808f39

7. Uploads, downloads, export

  • Non-image attachments in a server tab upload (POST /api/uploads) and the server path goes into the prompt; images stay inline. 903eda0
  • Drop files or folders on a server's Files tree to upload them (PUT /api/fs/write, folders recursively, links skipped, the server's 64 MiB per-file limit respected); existing names ask once: Replace (folders merge), Keep Both, Skip. Download… saves a server file or folder here, with progress and Cancel. /export in a server tab writes the HTML there and downloads it. 78a95d0
  • The Sessions browser lists the server's conversations; Memories read the server's Engram through a forward. 903eda0

8. Configuration on a server

All through Desktop RPC, each method only when the server advertises it; anything without a remote method says Do this on <server>: run ….

Piece What it does Commit(s)
Reads/writes the server Configuration, Profiles and Usage never touch this computer's Gentle Shell home for a server. 302a955
/api/desktop On servers with the desktop capability these screens use the session-less POST /api/desktop + GET /api/desktop/events instead of a hidden control session; models come from the new list_available_models method. Older servers keep the hidden session. 21d16c4
Model defaults Default model, effort, Use all models, written over the read revision (a concurrent change is refused and re-read); a pick sends only the keys it changes, so nothing set by the project is copied into the global settings. 2d121a1, b14ef63, f1207fe
Custom models / MCP servers models.json and mcp.json (global, and a trusted project's) edited as JSON over the Desktop RPC config stores for MCP servers, model defaults and custom models; the MCP card lists the servers Pi actually loads; secrets stay •••; Pi's validation errors show. 2d121a1, b14ef63, f1207fe, 2565147
Sign-in Per provider by loginKinds: OAuth/device login runs on the server; its page opens in a browser card that catches the loopback redirect (redirectPrefix) and hands it to the server instead of loading it; device codes with Copy; API key (masked, cleared at once); Remove. e981822, adb2830, e981822
Packages List, install (any source the CLI takes), remove, with the job's output live. e981822
Setup Run setup on <server> (setup capability + admin scope), output streamed, then checked again. 2d121a1, 2a19a26
Upgrade Update Gentle Shell on <server> (upgrade capability + admin scope), streamed output, reconnects after the server restarts on the new version; the permission is asked again on every reload. f67bb95, e981822, 1c02f4b

9. First run and Setup on a server

  • Welcome and Setup show Connect to a Gentle Shell server (the same Code field). Pairing there makes the server the default machine, opens its home as a workspace, and Setup checks only the server: nothing is installed on this computer. 302a955, f600c9c
  • On a server, what Setup can't check from here reads a neutral Not checked instead of a green Ready. 4736e4f

10. UI fixes from the live tests

Found Fix Commit
Horizontal tab titles read "…" or "Te…" next to a server terminal Tabs share the room evenly, never narrower than their parts plus 8 letters of title; they scroll sideways when they don't fit; close button floats on hover a54733c, 2023a85
Forwarded page address showed its gs_ticket Card header and Pages menu share one address rule e5bab57, 9785d9b
Diff row backgrounds only ~300 px wide on first render Redraw once after the diff measures itself (GPUI drops the frame it asks for mid-paint), shared by the file viewer and the Agent UI review panel bfe4ff7, f44fd02
Setup said Ready for things it didn't check on the server Not checked status 4736e4f
Configuration › General showed another machine's paths Settings for reads the selected machine only f600c9c
This Mac's General lacked Runs on / Version Same rows as a server's card 8e3d9db
Workspace on the server's home was named after a local folder Pairing opens the home as its own workspace named after the folder f600c9c
A config save notice showed on every card Only on its own card 29a61ee
⌘↵ in the folder explorer, keyboard focus in an empty workspace Opens the folder shown; the workspace takes the keyboard 5f4585f, 94b4ec6

Design decisions and alternatives

Decision Chosen Alternatives considered Why
Remote model Native thin client of gentle-shell serve (server owns sessions, folders, git, PTYs) (a) sync files to this computer; (b) the existing command backend over SSH; (c) a web UI Sessions must survive the app closing; (b) can't keep sessions or terminals and ssh joins its arguments into one remote command line; (c) loses the native tools (screen, simulators, canvas).
Where the split lives Three choke points + PiProcess Branch in every view One place per concern; local code paths stay byte-for-byte the same calls.
Which machine Per workspace (machines::owner) One global backend The live test needed a Mac project and a server project open together; a global switch moved everything.
App tools for remote agents Host tools over Desktop RPC, run here Install the app's extensions on the server The tools need this computer's window, screen and devices; host tools also replace the extension args locally when the launcher supports them.
gentle_ui Port the extension's logic to Rust (gentle_core::genui::host) Run the TS extension on the server and stream UI The surface is drawn here; keeping the logic beside the renderer avoids a second runtime and round trips per event.
Transport security Self-signed certificate pinned by fingerprint + scrypt/HMAC pairing proof Plain HTTP (first draft); a CA/ACME certificate; SSH tunnels only Home servers have no public name; pinning gives TLS without a CA, and the proof keeps the code from anyone who merely answers discovery.
Finding the server UDP broadcast + verification at /.well-known mDNS/DNS-SD; QR codes No new crates (sysinfo's network feature lists interfaces); the long code covers networks where broadcast doesn't reach.
Outside the LAN Relay that splices ciphertext Relay terminating TLS; cloud account The relay never sees tokens or content; no account needed.
Forwarded pages Local pinned proxy on 127.0.0.1 Trust the certificate in each web view; open the forward link directly Web views on three systems can't be given a pinned self-signed certificate; the proxy also hides a relay's host and keeps tickets single-use.
Persistent terminals Separate gentle-term-host binary with snapshot + offset resume PTYs inside the Node server Terminals must outlive serve restarts and upgrades; alacritty's headless Term gives a correct screen snapshot to reattach.
Term-host distribution From the app's own build, a chosen file, or the build command; release assets published but never downloaded Download from GitHub releases on demand No network fetch of executables by the app; the user sees the SHA-256 the server verifies.
Server identity Server id (and pinned certificate) URL Addresses change (DHCP, Wi-Fi); keying by URL orphaned workspaces and sessions in the live test.
Event numbering restarts Server-sent epoch Client rule "seq 1 means restart" A client rule can't tell a restart from a replayed first event; existing replay tests stay valid.
Configuration on a server Session-less /api/desktop Hidden control session per screen No Pi session started just to read config; the hidden session remains for older servers.
Diff width DiffFit redraw in the app Patch the gpui-component diff The fix lives where the frame is dropped (GPUI ignores mid-frame invalidations) and needs no fork of the dependency.

Impact on existing users

  • Local, WSL and command workspaces go through the same code as before: every server branch is gated on the workspace's machine being a server.
  • Local host tools (behaviour change). If the local Gentle Shell launcher supports serve (probe: <launcher> serve --help, 5 s, cached per build), local tabs start without the app's --append-system-prompt/--extension arguments and get the same tools as host tools. Older launchers are unaffected. Maestro is then a host tool, not an MCP server (a previously registered maestro MCP still shows so Disconnect can remove it).
  • open_page / gentle-open now show their card at once (or open the user's browser per Devices › Browser) instead of hiding it in the tray; URLs merely mentioned in tool output still wait in the tray.
  • Migrations (automatic, one-way): workspaces.json v1 → v2 (each workspace gets the machine the default ran on then); a pairing's name moves from settings.json beside the token; URL-keyed server references become server ids once known.
  • Horizontal tabs keep at least their first letters and scroll instead of shrinking to "…"; the close button floats on hover (no empty slot).
  • Configuration gains Settings for (machine selector) and a paired-servers list in Where agents run.
  • macOS bundle contains gentle-term-host next to the app binary (never run by the app; only offered for upload to a server of the same platform).
  • CI runs every test binary (--no-fail-fast); releases gain five gentle-term-host-* assets.

Code Owner review: Cargo, CI, release, packaging

Cargo (Cargo.lock: +41 lines; only scrypt and salsa20 are new downloads):

Crate Change New to the lockfile?
workspace Cargo.toml member crates/term-host —
crates/core scrypt 0.11 (default-features = false) yes: scrypt 0.11.0, salsa20 0.10.2
crates/core hmac 0.12, sha2 0.10, base64 0.23 no (already locked; hmac/sha2 0.10 via pbkdf2)
crates/pi-rpc rustls 0.23 (ring, std, tls12; no default features) no (locked through ureq)
crates/pi-rpc ureq 3 (default-features = false), sha2 0.11, base64 0.23, gentle-core (path) no
crates/app sysinfo 0.31: feature network added to system no (same version; one more feature)
new crates/term-host (gentle-term-host, binary only, not linked into the app) alacritty_terminal 0.26, base64 0.23, serde_json, polling 3; libc 0.2 (unix); windows-sys 0.59 (windows; Foundation, Security, Authorization, Cryptography, FileSystem, Threading) no (all versions already locked)

CI (.github/workflows/ci.yml): cargo test --workspace --locked → cargo test --workspace --locked --no-fail-fast, so the term-host's tests (TCP + ConPTY on Windows, Unix socket on Linux/macOS) report on all three systems even when another binary fails. Actions, pins and the read-only token unchanged.

Release (.github/workflows/release.yml): a new term-host job (matrix: linux-x64 and linux-arm64 static musl, macos-arm64, macos-x64 cross-compiled, windows-x64 static CRT via packaging/windows/cargo-config.toml), each checked for --version == gentle-term-host $VERSION (when not cross-compiled) and static linking on Linux, uploaded as artifacts; release now needs: [version, build, term-host] and requires the five gentle-term-host-<os>-<arch>[.exe] assets (listed in SHA256SUMS). Actions pinned by SHA, persist-credentials: false, no Rust cache for these builds.

Packaging (packaging/macos/bundle.sh): builds -p gentle-term-host with the app and copies it to Contents/MacOS/gentle-term-host when present (GENTLE_TERM_HOST_BIN overrides when GENTLE_BIN is given; left out when neither exists). Nothing else under packaging/ changes.

Security review checklist

  • Token at rest: the device token is only in server-tokens.json (0600, written beside and renamed in), never in settings.json, logs or Debug output.
  • Secrets in requests: set_api_key and login_complete payloads are left out of Debug; the API key field is masked and cleared at once.
  • Pinned TLS: exact-fingerprint verifier, handshake signature verified; a changed certificate fails before any byte is sent and is never treated as a relocation.
  • Pairing proof: the code is sent only after the server proves knowledge of it (scrypt + HMAC bound to the certificate and a 32-byte nonce); known-answer vector tested on both sides.
  • Discovery: announces are hints (≤512 bytes, unknown fields dropped); every answer is verified at /.well-known (same serverId; pinned certificate on rediscovery).
  • Relay: sees only ciphertext; TLS terminates at the server, pinned.
  • Local proxy: binds 127.0.0.1 on a random port; requests whose Host isn't 127.0.0.1:<port>/localhost:<port> get 421 (DNS rebinding); foreign Origin passed through so the server refuses it; closes with its last holder, when the forward is gone, or after 12 h idle.
  • Forward tickets: single-use, traded for a cookie on first visit, never displayed (header and Pages menu).
  • Host tool routing: a call runs only if its provider is this device's id; each callId once; results capped (8 MiB), requests capped (1 MiB / 9 MiB).
  • Sign-in redirect catching: only navigations matching the login's redirectPrefix (scheme/host case-insensitive) are caught and handed to the server; open_url prompts must be http(s).
  • Admin-only actions: upgrade, setup and term-host install require the admin scope and the server capability; terminals need the terminal scope.
  • Term-host install: no download; the user sees the binary's SHA-256, which the server verifies on upload.
  • Term-host transports: Unix socket in an owner-only (0700) directory, bound under umask 077; TCP on loopback only, random token in an owner-only file (0600 / protected DACL), first line must authenticate or the connection closes.
  • Server paths are never resolved or canonicalized on this computer; nothing falls back to local files, Engram or ENGRAM_URL for a server workspace.
  • Uploads/downloads: respect the server's 64 MiB per-file limit; links skipped; downloads write through a temporary sibling.
  • Unpair removes the device on the server, not only locally.
  • CI/release: actions pinned by SHA, read-only token, no cache in the term-host builds, static binaries checked.

Tests

cargo fmt --all -- --check ✔ · cargo clippy --workspace --all-targets --locked -- -D warnings ✔ · cargo test --workspace --locked: 1,598 passed, 0 failed, 8 ignored

Suite Passed Ignored
gentle-core unit 576 0
gentle-shell-gpui unit (incl. GPUI headless view tests) 746 4
gentle-term-host unit 9 0
gentle-term-host tests/protocol.rs (real PTYs, Unix socket) 8 0
gentle-term-host tests/tcp.rs (loopback TCP + token) 2 0
pi-rpc unit 51 0
pi-rpc tests/desktop_rpc.rs 152 0
pi-rpc tests/desktop_rpc_accounts.rs (sign-in, packages) 7 0
pi-rpc tests/desktop_rpc_live.rs 4 2
pi-rpc tests/desktop_stdio.rs (host tools over stdio) 2 0
pi-rpc tests/serve.rs (+ serve/relay.rs, serve/local_pages.rs) 30 0
pi-rpc tests/serve_api.rs 11 0
pi-rpc tests/serve_live.rs (needs a real server) 0 2

Ignored tests need a running server: serve_live.rs (GENTLE_SHELL_CHECKOUT=… cargo test -p pi-rpc --test serve_live -- --ignored: real serve --relay and relay in a temp home; pairing over pinned TLS with the proof; a wrong fingerprint refused; sessions and a forwarded python3 -m http.server page through the local proxy, directly and through the relay) and live_registration_on_a_server (registers every host tool on a real serve).

Stand-ins: tests/serve.rs runs the session transport against a fake server behind a TLS front made with the server's own certificate code; tests/serve/relay.rs adds a fake relay; tests/serve/local_pages.rs checks the proxy (keep-alive, ticket → cookie, redirects, HEAD, chunked, SSE, WebSocket, Host/Origin, changed certificate, relay, closed forward, cleanup); tests/serve_api.rs files, git, uploads, forwards, terminals; tests/desktop_stdio.rs local host tools over stdio; term-host tests/protocol.rs (real PTYs over the Unix socket) and tests/tcp.rs (TCP + token, ConPTY on Windows).

Live evidence

All runs used temporary app homes and data dirs; the maintainer's own data and apps were not touched. Screenshots and API dumps were kept for every step.

macOS ↔ macOS, end to end (server from #3529 in a temp home)

# Check Result
1 Pair by short code over TLS Pass — 68QK-WPHD paired; https://…:8791 with the certificate fingerprint pinned; Configuration shows the https address
2 Files, open file, Changes diff, Branches Pass
3 Agent tab connects; terminal runs top Pass — session running with 1 subscriber
4 Restart serve with tabs open Pass — same session id (reattached (seq 44, running)) and same terminal id, output offset still growing; top kept updating
5 ⌘Q and relaunch Pass — same session (seq 46 → 74), same terminal (same top pid)
6 Forwarded page (/web http://127.0.0.1:18920/) Pass — loads from a local proxy port; no certificate warning
7 Through the relay Pass — a gsc1. code with decoy addresses paired through the relay (gsr://…), session opened; relay log shows spliced connections
8 Packages Pass — list, invalid source refused, local package installed and removed (after the epoch fix cd0bef2 and a server-side fix in #3529)
9 Upgrade button Pass for scope gating (shown for admin, hidden otherwise); the concurrent-upgrade 409 is covered by the server's tests; no real upgrade run
10 Host tools in local mode Covered by tests (desktop_stdio.rs, probe and args-stripping tests); not run live
11 host_tool_progress advertised and used Pass

Earlier macOS runs: pairing by short and long code (invalid code, no computer found, damaged code, unreachable server messages), quit/relaunch with the same session (seq 138) and terminal (offset 159,941 → 193,120 while the app was closed), Disconnected + Start again after stopping the server.

Issues found there and fixed in this PR: Desktop RPC events dropped after a server reload (cd0bef2), re-pairing at a new address orphaning work and unpair only forgetting locally (69cfbbc), Open Gentle Shell here opening no agent (e382e6d), upgrade permission cached per screen (1c02f4b).

macOS app ↔ the maintainer's Omarchy server (Arch Linux x86_64, real LAN)

# Check Result
1 Paired over TLS Pass — https://192.168.100.92:8787, identity fingerprint equals the pinned one; non-admin device gets 403 on /api/devices as expected
2 Open a server folder Pass — New folder in the tree; ⌘K Open folder on ismael (server)…; Open Gentle Shell here started a session
3 Files, Changes, Branches Pass — file created and saved on the server; M hello.txt +2 −1 with its diff; branch master
4 Server terminal Pass — uname -a → Linux ismael 7.2.15-1-omarchy … x86_64; top live
5 Upload and download Pass — Finder drop → Uploaded 1 file; Download… saved the file byte-identical
6 Agent tab and models Pass — the server's models listed; prompt answered with the server folder's listing
7 Host tools Pass — open_page → server forward + local proxy, page loaded; gentle_ui checklist round trip without another prompt
8 App relaunch Pass — same session and both terminal ids; transcript back; top kept updating
9 Server configuration Pass — General (/home/ismaelo, 5.0.0), model defaults, sign-ins, models.json/mcp.json editors, packages; Setup/Upgrade hidden for a non-admin device
10 Server restart Ids recorded for the maintainer's after-check

Issues found on Omarchy, and their fixes in this PR:

Issue Fix
A. open_page didn't show the page until the eye was clicked c8014b0
B. Closing a page left its server forward open ea25344
C. Horizontal tab titles mangled a54733c, 2023a85
D. Ready for things not checked 4736e4f
E. Gentle Tower said not found on a server f600c9c
F. Configuration showed the Mac's paths f600c9c
G. Diff rows ~300 px on first render bfe4ff7, f44fd02 (the \ LF row is the diff library's marker for a line-ending-only change)
H. Server home workspace named after a local folder f600c9c (new pairings; an existing workspace keeps its saved name until renamed)

Re-verification on Omarchy (build at c011ded): Settings for, Where agents run, ⌘O on both machines (Mac and server folders in one window: Files, terminal, Changes), Not checked, diff full width ~0.3 s after opening, open_page shown at once ("Opened … in the Gentle Shell app's browser"; one GET / 200 on the server), closing the card emptied /api/forwards within 2 s and stopped the local proxy — pass. Horizontal tabs still read "…" in a 747 pt window and the Pages menu still showed the ticket: fixed afterwards in 2023a85 and 9785d9b and checked on screen in an isolated copy (titles readable, active tab scrolled into view, wheel scrolls the strip).

Limits and follow-ups

  • Discovery is one LAN: broadcast doesn't cross subnets, Tailscale or Wi-Fi client isolation; use the long code or the relay there. macOS may ask for Local Network access on the first search.
  • Linux/Windows app packages don't bundle gentle-term-host yet (only bundle.sh does); a Linux/Windows server takes a chosen file or the build command.
  • gentle_ui waiting reviews on servers without host_tool_progress give up after 9 minutes.
  • Ctrl+C twice doesn't close a server terminal; exit or ⌘W does.
  • Server-side retention: forwards close after 12 h unused, uploads kept 7 days, editor files up to 64 MiB, git network commands stop after 10 minutes.
  • Orchestration across machines (agents on one machine driving another) is out of scope; the server PR carries its plan.

Questions for reviewers

  1. Local host tools: is replacing the app's --extension/--append-system-prompt arguments with host tools for launchers that support serve the right default, or should it sit behind a setting for one release?
  2. gentle-term-host in the macOS bundle: acceptable size/signing cost, or should it only be offered as a chosen file?
  3. Release assets: publish gentle-term-host-* (the app never downloads them; they serve servers installed by hand), or drop the job?
  4. sysinfo network feature for interface broadcast addresses vs. a small dedicated crate (the feature adds no new crate).
  5. scrypt cost (N=2^15, ~32 MiB once per pairing on the client) matches the server; OK?
  6. Per-workspace machine semantics: should a workspace's machine be changeable after creation, or stay fixed (current)?
  7. History: 72 commits, each building on its own; squash-merge or keep them?

How to try

  1. On the server machine, install Gentle Shell from #3529, sign in a provider, then run gentle-shell serve share (firewall: sudo ufw allow 8787 and 8800:8899/tcp for forwarded pages). Add --relay gsr://host:port to reach it through gentle-shell relay.
  2. For terminals on a Linux server: cargo build --release -p gentle-term-host from this branch on the server and pick it under Install terminal support, or put it in <agent home>/serve/bin. A Mac server of the same architecture can take the app's own build.
  3. Run this branch: cargo run -p gentle-shell-gpui (use a fresh GENTLE_SHELL_GPUI_DATA_DIR to keep your data apart).
  4. Configuration › General › Where agents run › Pair another server, type the code, Connect.
  5. ⌘O, pick the server in the machine row, open a folder: try Files, Changes, Branches, a terminal, an agent tab, open_page / /web on a dev server, uploads by drag and drop.
  6. ⌘Q and relaunch: tabs and terminals reattach. Restart serve: they reconnect.
  7. Configuration › Settings for <server>: model defaults, custom models, MCP servers, sign-ins, packages, Setup and Updates (admin device).

Address normalization, server error wording, SSE framing, the stream cursor (seq, snapshot-required, resync, dialogs shown once) and the dedupe of the stream's serve-rpc responses, with tests.
PiProcess::serve follows a server session over HTTP and SSE: commands POST to /rpc in order, answers read as stdout, 202 pending settled from the stream, reconnects after the last seq with backoff and a 45 s silence limit, snapshot-required as Incoming::Resync (the tab reads its state again). shutdown stops the session (DELETE); detach leaves it running. pid() is None for a server session. Cargo: pi-rpc now uses gentle-core and ureq 3 (already locked by the app).
Configuration pairs with a server (POST /api/pair) and keeps its device token in an owner-only server-tokens.json. Server tabs start or reattach to sessions, persist the server session with the pane and stay running when the app quits; closing a tab stops its session. Files, git, terminals, Tower, Setup installs and Providers' terminal say they're not available on a server yet; the palette opens a typed server folder.
A server tab whose session ended (the server stopped, or the session was stopped there) only read 'gentle-shell stopped, Exit code 0' with no way back short of reopening the tab. It now reads 'Disconnected from <server>' and offers Start again, which opens a new session there on the same conversation; a start that couldn't reach the server offers it too. The stopped card also fits a pane narrower than 560px instead of being cut off.
Configuration's Gentle Shell server option takes the connection code
gentle-shell serve share prints (gsc1.…): pasting it looks for the server
at every address in the code at once (GET /.well-known/gentle-shell), pairs
with the first that answers as that server and saves that address. The
address and pairing code fields stay under Enter address manually.

- gentle_core::serve: decode_connection_code (CodeError), identity, search
- pi_rpc::serve: locate (1.5 s per address, 4 s in all), pair_code;
  ServeError carries the server's error code
- tests: decoder and search in core; locate and pair_code against the
  fake server in pi-rpc
…ough

Configuration's Gentle Shell server field is now Code (XXXX-XXXX): it takes
the 8-character pairing code gentle-shell serve share shows, or the long
gsc1. code it prints as a fallback. For the short code the app broadcasts
{"t":"gentle-shell/discover","v":1} over UDP (255.255.255.255 and each
interface's directed broadcast, ports 8787-8796), checks every answer at
/.well-known/gentle-shell on the address it came from, then pairs with the
one server found, lists several to pick from (name and address), or says
to check the Wi-Fi and firewall (sudo ufw allow 8787) or paste the long code.

- gentle_core::serve: read_code (Entered), short_code, discover_query,
  read_announce, directed_broadcast, discovery_targets, Nearby, pick
- pi_rpc::serve: nearby (one ephemeral UDP socket, 1.5 s, verified),
  pair_nearby
- app: interfaces from sysinfo's network feature (no new crates)
- tests: core rules; nearby and pairing against a UDP responder on 127.0.0.1
- set_host_tools and host_tool_result requests with the contract's limits (names, labels, descriptions, schemas, guidelines; 8 MiB result content), per-method request caps (1 MiB / 9 MiB)
- host_tool_call / host_tool_cancel event decoders, and their answers
- PiProcess::desktop: a server session sends both through POST /api/sessions/:id/desktop
- the serve stream reads a re-sent host_tool_call frame as a record
- a tab on a Gentle Shell server that takes set_host_tools offers open_page, browser, screen and (beside a canvas) canvas_read/edit/shot, with the guidance from the app's instructions and extensions as each tool's description and guidelines; again after a reconnect
- calls run where the app's commands run them (window browser driver, gentle-screen in-process, the open canvas in-process) and answer through the server's /desktop; cancels drop the call, failures answer isError
- local, WSL and command tabs keep their instructions and extensions
- gentle-device, themes and gentle_ui stay out (docs/integrations.md says why)
gentle_core::genui::host runs what the app's gentle-ui.ts extension does, for an agent on a Gentle Shell server, which doesn't load the app's extensions:

- normalize: each kind's spec through its own gentle_core parser and wire JSON (the rules the extension mirrors), in the extension's 'invalid <noun> spec' list; absolute refs inside the session folder made relative, ones outside it refused; review before/after texts diffed into hunks (Myers, 3 lines of context); html checked as normalizeHtml.
- patch: the extension's per-kind patch merges.
- summary: what the model reads of each kind, run-plan and dispatch instructions, review decisions, page context.
- guide: the tool's description, parameters (examples in the spec description) and per-mode rules packed into 16 x 512 guidelines.
- Engine: ids, versions, show/update/close, wait-for-decisions reviews, the /gentle-ui:event handling (edits, inserts, docs, html messages and context, mode), outcome lines, host context, state rebuilt from the conversation's details.
A server tab whose Gentle Shell takes host_message and set_host_context offers gentle_ui (with the Agent UI mode's rules; re-offered on a mode change, withdrawn when Off) and runs it with gentle_core::genui::host:

- pi-rpc: host_tool_result carries details; host_message and set_host_context requests and answers, capability-gated (unknown capability methods such as set_host_activity are ignored).
- The result's details are the surface, so the transcript draws it unchanged; the surfaces' /gentle-ui:event commands are answered in-app and reach the agent as host.gentle-ui.event messages (drawn as gentle-ui.event), with the outcome fed to the surface as the extension's widget would.
- Html pages' shared context and the Off rule go as the host context, cleared once a run starts.
- A wait: true review shows on its running call and is answered with the decisions.
- State follows the transcript: rebuilt when it is replaced.

Also registers the device and app_theme host tools (Call::Device/Theme, HostToolRequest::Device, the device panel request) next to them.
integrations.md: gentle_ui among the host tools, host_tool_result details, host_message and set_host_context in the method table, and how the app runs gentle_ui for a server session (tool, calls, events, context, waiting reviews, state). README: Agent UI works on a server.
ServeClient::forward (POST /api/sessions/:id/forwards) and ::tower (POST /api/tower), ServerInfo.home; gentle_core::serve::server_page sorts a server's URLs (loopback → forward), tab_folder picks a new tab's folder on a server, and error_text reads the forward and tower errors. Fake-server tests.
…les and Usage read its Gentle Shell

Server pages on its loopback (design canvas, open_page, dev-server URLs, /web, browser open/goto) open through forwards, with a refused card showing the server's words; Tower tabs run Tower on the server; first run offers Connect to a Gentle Shell server and skips installs; new tabs and workspaces start in the server's home, Open folder on <server>… in ⌘K All, and a missing folder offers the home. Docs.

On a server, Configuration, Profiles and Usage never touch this computer's Gentle Shell home: they ask the server over Desktop RPC (through a tab on that server, or a hidden control session in its home, stopped when the screen closes), and say 'Do this on <server>: run …' for what has no RPC. Where agents run's code field becomes ServerConnect, shared with onboarding.
gentle-term-host keeps PTYs alive for a Gentle Shell server: a Unix socket speaking JSON Lines (open, list, write, resize, close, forget, attach/detach with replay from an offset or an ANSI snapshot, shutdown), a headless alacritty Term per PTY for the snapshot, a 2 MiB replay ring, per-connection 8 MiB backpressure, and idle exit.
…hell server

- Git and the file-system choke point (backend::git, backend::fs) go through
  the server for its folders.
- Files tree, editor, search and folder browser on a Gentle Shell server.
- Persistent server terminals that reattach after a relaunch.
A server terminal opened (or reattached) at the emulator's initial 80x24, or at the size of a window still taking its saved bounds: a new shell drew zsh's partial-line mark and a reattached full-screen program (top) kept a shifted, garbled screen. It now opens once the laid-out size has held for the resize settle time.
… when nothing is highlighted

The explorer highlighted its first entry on every listing, so Cmd+Enter opened that subfolder rather than the folder shown. Nothing is highlighted now until the arrows, a click or the filter pick an entry (going up still highlights the folder left), matching a folder picker's Open; the folder being read is the one shown from the start, so a slow server's listing doesn't open the previous folder.
…er resolved locally

Cmd+O (and the other workspace keys) did nothing when no pane had focus: the workspace now takes the keyboard when nothing in the window has it. Workspace roots, find_root and gsd <folder> canonicalized server paths on this computer; a server's folder is now normalized by its text alone (gentle_core::serve::folder_key) and marks its workspace as the server's.
…pace for the folder

- The typed server folder went through create_server_workspace and made a
  new workspace every time; it now opens like a browsed folder
  (show_server_folder → space_for) and switches to the existing one.
- space_for / workspaces::find_root match a workspace by server and root
  (folder_key on a server, canonical here): a workspace of this computer or
  of another server at the same path is no longer taken over.
- PaletteAction::CreateWorkspaceAt → ShowServerFolder.
Switching (⌘K, the sidebar, a menu) to a workspace with no tabs left the keyboard on the previous workspace's hidden pane, so the nothing-focused fallback never ran and ⌘K, ⌘O and ⌘T did nothing until a click. focus_active now focuses the workspace itself when the shown workspace has no pane, and switch_workspace calls it for an empty target.
integrations.md's Gentle Shell server section becomes a reference by area (pairing, transport, sessions and reattach, host tools with a table, forwards, Tower, folders, files, git, terminals, attachments, sessions, memories, Configuration, first run, limits) with diagrams of the pieces, pairing and reattach. architecture.md describes the server boundary (backend::fs, backend::git, terminal/remote.rs, pi_rpc::serve, crates/term-host). The README gets the steps to connect with serve share and a code.
A server session's serve_dialog_resolved record, and the 409 dialog_answered the server gives an answer that came second, close the dialog in every other tab following the session, with a quiet note in the conversation.

The live Desktop RPC test pumps skip dialog-resolved records.
The host now builds and runs on Windows: ConPTY through alacritty_terminal's tty, and a --tcp transport (127.0.0.1, a system-picked port) whose port and random token go to <state-dir>/term-host.json, owner-only (0600 / a protected owner-only DACL). Over TCP a connection's first line must be {"op":"auth","token"}; anything else is refused with unauthorized and the connection closes. --tcp works on Unix too, which is how its tests run everywhere.
A server folder's commit message goes to POST /api/print { cwd, prompt } when the server offers print: the server's gentle-shell --print runs the same prompt a local folder gets, and its text is read the same way.
…ents

- `DesktopEvent` and `Snapshot` decode the server's optional `epoch` (a non-empty string; absent
  from older servers).
- `DesktopSession` keeps the epoch its baseline counts in. An event of another epoch is a
  numbering that restarted at 1 (a reload or a switch on the server), not a replay: seq 1 is
  accepted, a later first seq is a gap that resyncs from a snapshot. A snapshot of another
  epoch is the new baseline even when its sequence is smaller.
- Within one epoch, and for servers without one, duplicates and stale snapshots are still
  refused. Before this, after a server-side reload (a package install) every event of the tab
  was dropped as a duplicate and `package_finished` never arrived.
…pair it on the server

- Workspaces and saved tabs name a Gentle Shell server by its server id (server::key; an address saved before ids were kept reads as the id once a pairing knows it, migrated at load), so pairing the same server again at another address keeps its workspaces and lets restored tabs reattach their sessions.
- Pairing a known server again (by id, or by pinned certificate for a pairing older than ids) replaces the earlier pairing in place: new token and address, old addresses kept; the server replaces the earlier device (POST /api/devices/self/replace) so its terminals are the new pairing's, and the window's agents and terminals on it follow the new pairing.
- Unpair asks the server to remove this device first (DELETE /api/devices/self), then forgets the token; the window's tabs let go of their sessions (left running there, picked up by a later pairing) and terminals say what became of them. An unreachable or older server: forgotten here, and Configuration says the server still lists the device with the command to remove it.
- A server tab keeps its session while starting and after losing its stream, so Start again reattaches instead of opening a new one.
- core: ServerSession.server_id, without_ticket; pi-rpc: ServeClient::unpair/replace. Tests for the keying, in-place pairing, unpair wording and the client calls.
- The card header shows the local proxy address without the single-use gs_ticket the forward trades for a cookie (it answers with a 303 to that address).
- The folder explorer's Open Gentle Shell here (⌘↵) showed the folder's workspace but opened no agent, on a server's folders too: it now opens an agent tab there, as its terminal counterpart opens a terminal tab.
- Desktop RPC config stores model_defaults, custom_models and mcp_servers (global and project, ConfigWriteTarget::Project), with their typed writes.
- ServeClient::setup/setup_stream: POST /api/setup and its stream, the upgrade's events.
- serve::WRITE_LIMIT: the server's 64 MiB per file write.
- Models › Model defaults on a server reads and writes the model_defaults store: default model (from the control session's models), effort, all models; refused writes say why.
- Models › Custom models and Integrations › MCP servers list and edit the server's models.json and mcp.json (global, and a trusted project's) as JSON over Desktop RPC, saved over the revision they were opened at; secrets stay as •••; Pi's validation shows.
- The Providers screen of a server folder opens Configuration › Models, whose Sign-ins sign in there.
- Older servers keep saying "Do this on <server>".
- With the setup capability and the admin scope, Setup (welcome, onboarding, Configuration) offers Run setup on <server>: POST /api/setup, its output streamed, then the server is checked again.
… there

- Drop files or folders from the file manager on a server's Files tree to upload them (PUT /api/fs/write, folders recursively, links and files over 64 MiB skipped); names already there ask once: Replace (folders merge), Keep Both, Skip.
- Download… saves a server file or folder here (files through a temporary sibling, folders copied recursively); a strip shows progress with Cancel, one transfer at a time.
- /export in a server tab writes the HTML there and downloads the file export_html names (gentle_core::transfer::server_file) to the chosen path, or to Downloads with a path given.
- gentle_core::transfer: upload plans, conflict choices, free names, local paths, progress words, with tests.
On a server that lists the capability desktop, Configuration, Profiles and Usage ask POST /api/desktop and follow GET /api/desktop/events (PiProcess::serve_desktop) instead of starting a hidden session; older servers keep the hidden session. Models come from the new Desktop RPC method list_available_models where there is no Pi RPC (and once advertised on a session's channel).
…ge says where

open_page (and gentle-open) put the page's card hidden in the tray, as a
URL an agent only mentions: a hidden card has no web view, so on a server
nothing reached the forward until the user clicked the eye. Its result
also said only "Opened … for the user", which agents turned into "in your
browser".

- An explicit open (open_page, gentle-open) shows its card at once inside
  the app, or opens the user's browser per Devices › Browser; URLs picked
  out of tool output and the design canvas still wait in the tray.
- The window answers open_page once it knows: "in the Gentle Shell app's
  browser", "in their own web browser", or the server's reason as an error.
…forward

Closing a forwarded page (× in the Pages menu, its card, a Tower tab)
closed this computer's proxy, but the server kept the forward listed in
GET /api/forwards until it went idle (12 h).

When the last web view holding a proxy lets go, the proxy now also asks
the server to close the forward (DELETE /api/forwards/:id, which covers
session, server-level and Tower forwards), off the UI thread. Another card
or tab still showing the page keeps its hold, and both stay open.
Tabs shrank in proportion to their whole width, so a tab with more of its
own parts (the pane count, the hidden close button) lost its title first:
next to a server terminal whose shell titles itself "user@host:~/folder",
an agent + editor tab showed only "…" or nothing beside its "2", and a
restored "Terminal · folder" read "Te…".

Each tab now starts at the width of its own parts and grows to at most its
whole title (measured in the interface font), so the room left goes to the
titles evenly and a long title ends in … before a short one loses its
letters. The pane count and close button no longer shrink, and on tabs
other than the active one the close button floats over the tab's end on
hover instead of keeping an invisible slot.
Setup on a Gentle Shell server only checks that the server answers, yet
Node.js, Companion setup, Git and Engram wore a green "Ready" badge while
their line said "not checked from here".

A new Status::Unchecked shows a neutral "Not checked" chip and an empty
circle, in faint color, and still holds nothing up (Continue, Install
everything and the first-run sequence treat it as nothing to do).
…iffs keep CRLF

The diff records its body size while painting and asks for a frame to
widen its rows to it, but GPUI drops a request made mid-frame, so rows
stayed as wide as their text until something else redrew (a hover).
The viewer now redraws once after the diff appears or changes size.

An untracked file's synthesized patch split lines with `str::lines`,
dropping the CR of CRLF lines; it keeps them now, as git's patches do.
… screen choices

gentle_core::machines: which workspace folder holds a path (owner), what a workspace saved before machines runs on (saved_machine, workspaces.json version 2), the machines Configuration and Open folder offer (choices, pick) and their names. Tested.
…achine, paired servers listed

- The default (Agents run on) only decides where a new workspace goes; each workspace saves its own machine (server id, or its WSL/command backend) and its tabs, terminals, files and git follow it (backend::set_workspaces, for_tab by folder). Mixed windows work; changing the default moves nothing. workspaces.json v1 migrates to where the default ran then.

- server::paired lists every pairing (name kept beside the token, migrated from settings.json); choosing this computer forgets none. Where agents run lists them (name, address, status, Unpair each) with Pair another server; Agents run on is the default for new workspaces.

- ⌘O / Open folder… / Open folder on <server>… browse a chosen machine (explorer machine row); the folder opens as a workspace there.

- Pairing on first run opens the server's home as its own workspace, named after that folder, instead of moving the shown one (fixes H).

- Onboarding/Setup act on an explicit machine (backend::on).

- Settings for at the top of Configuration (this computer, its environment, every paired server; the active workspace's first). Every page reads and writes that machine; its control session asks the active tab only when it runs there (fixes F: General showing another machine). Switching reopens Configuration for it on the same page.

- Integrations › Gentle Tower on a server says whether it offers Tower and opens it (fixes E).
…hen they don't fit

In a narrow window (747 pt, four tabs) every tab's own parts filled the title
bar's room, so each title read only "…", and the active tab kept an empty slot
for its hidden close button.

- A tab is never narrower than its parts and its title's first eight letters
  (the whole title when shorter); the room left grows the tabs evenly up to
  their whole titles. Tabs that still don't fit scroll sideways (the wheel
  scrolls the strip), and the active one scrolls into view when it is picked,
  opened, shown with another workspace or the strip's room changes.
- The close button floats over the end of every tab while the pointer is on it,
  the active tab's too: no tab keeps an empty slot for it.
- The new-tab button stays next to the tabs, outside the scrolling strip.
- The width bounds are one pure function (`tab_span`, `title_floor`), tested.
- The Pages (globe) menu listed a forwarded page as 127.0.0.1:<port>/?gs_ticket=…;
  it now shows the address the card header shows, without the single-use
  gs_ticket (same rule as the header, now one `BrowserPanel::address`).
…ts version

- The local Gentle Shell card lists Runs on (This Mac, This PC, WSL · …) and
  Version (from the launcher's existing `--version` probe) next to Home, as a
  server's card does, so both machines read Runs on / Home / Version alike.
The file viewer's fix (redraw once after the diff measures itself, since
GPUI drops the frame the diff asks for while painting) applies to every
gpui_kit diff: the Agent UI review panel's rows stayed as wide as their
text until a hover too, also after its hunks changed.

- shared::diff_fit::DiffFit: the size the diff had in the last frame and
  the canvas after it that redraws the owner once when it changes; reset
  for a new diff in the same place.
- The file viewer and the review panel use it (the review's viewer gets a
  new one each time it is rebuilt).
- Test: a view drawing a diff with the fit draws once more than one
  without after the diff shows and after new files, and not while its
  size holds.
Gentle Shell unified its config stores: `mcp` replaces `mcp_servers` and
`pi_settings` replaces `model_defaults`; `claude_bridge` is a read-only
display store.

- pi-rpc: ConfigStore speaks the thirteen stores (Mcp, PiSettings,
  ClaudeBridge); a `pi_settings` write is a PiSettingsPatch of the four
  model keys (`null` removes, omitted keeps, any other key refused); an
  `mcp` write stays `{ source, document }`; `project_untrusted` is a
  config error code.
- Model defaults send only the keys a pick changed, so a value from the
  project's settings.json is never copied into the global file.
- MCP servers list the `servers` Pi loads (disabled ones marked off, a
  cut list marked); each layer's document comes from `documents`, and the
  project file is offered only when the store lists a project layer.
Configuration on a server names the `pi_settings` and `mcp` stores and
the patch write; Limits replaces "Trusted network only" (plain HTTP) with
pinned HTTPS and the pairing proof on the network, `--no-tls` only for a
network that encrypts by itself, and the relay from outside.
@ismaelosuna7824
ismaelosuna7824 force-pushed the feat/remote-serve-backend branch from b6fc4aa to 2565147 Compare November 26, 2026 06:57
@ismaelosuna7824 ismaelosuna7824 changed the title feat: run agents on a Gentle Shell server (thin client of gentle-shell serve) feat: run agents on a Gentle Shell server (native thin client of gentle-shell serve) Nov 26, 2026
- Profiles and Usage headers name the machine shown (machines::screen_label, ui::screen_machine) and, with more than one, switch it with the same picker as Configuration's "Settings for" (ui::machine_picker, now shared with it). They open on the workspace's machine, or the "Settings for" one; switching reopens the screen for it (Usage keeps its tab, Profiles asks to save unsaved edits first).
- Use in this repo, Publish to repo, Clear session binding and Use in this session name what they act on ("<folder> on <machine>", machines::project_target) and are off, with the reason, on any machine but the open workspace's.
- machines::Shown holds the choice; tests cover the default, switching and which actions are on per machine.
- Profiles takes its route pickers' models from the session it asks on the machine shown (ControlSession: a tab there, else a server's /api/desktop list_available_models or hidden session), following its models_rev, never the active tab's from another machine.
- Profiles and Usage ask a tab on the machine shown (remote::ask_tab: the active one when it runs there, else another tab there), so This Mac's lists come from a tab here while the active one is on a server.
- "Used in this session" only for the open workspace's machine.
- Tests: the source per machine (tab there, server without one, This Mac with or without a tab here).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(backend): run agents on a remote gentle-shell serve

1 participant