tress

Production

View .md

Private machine workspace

For a personal laptop or VM workspace, follow Run on your machine. The standalone host binds to 127.0.0.1. On a VM, keep its project disk and state directory persistent, then forward the actual port printed by Tress:

# Replace 5311 with the printed port on both sides.
ssh -L 5311:127.0.0.1:5311 user@your-server

Open the printed private browser URL on your laptop with the forwarded port. Preserve 127.0.0.1 and the port because this host validates Host and Origin. The host remains on the VM; closing a browser does not move its files or agent. The preview is single-owner and has no public multi-user deployment flow. Managed Harness stores conversations, not a backup of the VM disk.

Existing application deployment

The rest of this guide applies to your application's authorized Harness host, not to exposing the standalone loopback listener directly on the internet.

The initial self-hosting topology is one long-running thread owner behind an HTTPS reverse proxy. Reuse an existing durable Harness deployment when your application already has one.

browser ──┐                      ┌─ durable conversation storage
          ├─ HTTPS app address ── thread owner ── existing agent
terminal ─┘                      └─ workspace / tools

Configure the owner

Use your application's canonical public origin when creating connection commands and browser links. The deployment platform or DNS points that domain to the app. Tress learns the address from the connection command; it does not guess where you deployed the server.

const appOrigin = "https://chat.example.com";
const endpoint = new URL(`/api/threads/${encodeURIComponent(threadId)}`, appOrigin).href;
const browserUrl = new URL(`/chat/${encodeURIComponent(threadId)}`, appOrigin).href;

Use your application's actual route paths. Keep its session/access checks on the host. createTressAccess is optional; if you use it, pass this same appOrigin as its origin. Access options explains native Harness authorization and the additional connection-lifetime checks.

Provide durable snapshots and storage for the access records your app uses, a process supervisor, and a shutdown path that flushes the thread host. Snapshot persistence can restore completed conversations; it does not make an in-flight external side effect exactly once. Surface interruptions and use your agent's recovery policy.

Forward streaming requests

For an Nginx reverse proxy in front of a host listening on port 3000, the thread route needs streaming and a long enough idle timeout:

location /api/threads/ {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 3600s;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
}

This location belongs in your existing HTTPS server configuration. TLS, certificates, and the app's remaining routes still come from your deployment. Keep the host's heartbeat shorter than the proxy's idle timeout.

Connect from any terminal

Build the compatible source-preview client and expose the app's discovery manifest, authorized thread list, and per-thread endpoints. For bearer access:

tress attach https://chat.example.com --api-key-env MY_APP_API_KEY

Tress lists all conversations that credential may access. An explicitly anonymous app can omit the flag. Custom authentication can use a private --headers-file; see access options.

There is no software to install on every user's browser. The app serves its existing assistant-ui interface. The integration runs on the thread host.

Verify before rollout

  1. Join the same private thread from a browser and another machine's terminal.
  2. Send from each. Check shared history, streaming, and one execution per prompt.
  3. Disconnect during a run. Reconnect without replaying the prompt.
  4. Try a different user's credential. Deny both reads and commands.
  5. Verify your session expiry/revocation policy on open connections and later commands. With separate grants and the optional adapter, revoking the terminal closes its connection while the browser continues.
  6. Restart after a completed turn. Restore history and keep revoked credentials denied.
  7. Repeat through the actual HTTPS proxy (it must forward WebSocket upgrades) and test an expired credential.

Scaling and serverless

Multiple hosts do not become a shared thread owner merely by sharing a database. Route a thread's WebSockets to one owner, or use the existing Harness routing infrastructure. If your access policy supports live revocation, broadcast it to every owner holding an affected connection.

A request-limited frontend can serve the UI, but it needs a durable worker or thread service for long-running agents. Do not assume an in-memory host inside a request handler will survive after the request or deployment ends.