TermSurf Protocol
One shared language so a real browser engine and graphical apps can run in terminal panes—without each tool inventing its own wire format.
What it enables
When you open a URL or a TermSurf app inside a pane, something must coordinate layout, processes, input, and page or app state. TermSurf is that language. Astrohacker TermSurf is the product host that ships today.
This page is for protocol and app implementers. It explains the design first. Full field-level message tables are on Messages. UDS framing detail is on Wire.
One happy path
Example: open example.com with a client such as ahweb.
- The client finds the host over a local Unix domain socket and asks for browser work on a pane.
- The host talks to an engine helper (Chromium as shipped): create or reuse a tab, size it, drive load and input.
- The engine reports surface context, URL, title, and load state. The host composites the page into the pane.
Clients usually address work by pane. Engines usually address work by tab. The host binds the two.
Concepts
- Pane — a region in the host UI (what the user sees).
- Tab — a browser document instance inside an engine process.
- Host — panes, compositing, TermSurf routing.
- Client / TermSurf app — tools that request pane work without embedding an engine.
- Engine helper — process that owns tabs and render surfaces.
- Envelope — frames use protobuf
TermSurfMessagevariants.
Multi-process architecture
client (ahweb / app)
│ Unix domain socket + protobuf
▼
host (ahterm)
│
▼
engine helper (ah-chromiumd, …)Multi-process isolation is intentional: real engines are large and crashable. Clients stay thin. The protocol is the contract—not a private in-process WebView API.
Build paths
- TermSurf appBuild a full-pane client (like ahcalc or ahhelp) that opens work on a pane through the host.
- Engine helperImplement a browser-engine process that owns tabs and surfaces and speaks host↔engine messages.
- Terminal hostImplement a host that owns panes, compositing, and routing between clients and engines.
Wire transport (sockets and framing) is under Wire.
Key sequences
- Hello — client
HelloRequest→ hostHelloReply; laterBrowserReadywhen a browser connection is up for the pane. - Open a page — client
SetOverlay→ hostCreateTab/Navigate→ engineTabReady, surface,UrlChanged/LoadingState. - Back / refresh — client
NavigationAction→ host forwards to engine; engineNavigationStatekeeps chrome honest.
Message reference
Full field-level catalog of every top-level message in live termsurf.proto:
Runtime discovery
Source
Schema: rust/proto/termsurf.proto in the Astrohacker monorepo / public TermSurf source tree. Product install docs and open-source README cover how to rebuild from patches; this section is protocol identity only.
