Skip to content

th-c8816b: Big Smooth desktop — connect to a remote daemon over the tailnet - #334

Merged
brentrager merged 3 commits into
mainfrom
th-c8816b-remote-daemon
Aug 4, 2026
Merged

th-c8816b: Big Smooth desktop — connect to a remote daemon over the tailnet#334
brentrager merged 3 commits into
mainfrom
th-c8816b-remote-daemon

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

What

The Electron app could only talk to its bundled local daemon. Now the tray has a Connect submenu:

  • This Mac (local) — the bundled daemon (default, current behavior)
  • Any Big Smooth daemon on your Tailscale tailnet — e.g. smoo-hub, shown with its signed-in Smoo identity

Pick one and the window attaches to it. The title shows which (Big Smooth — smoo-hub).

Why it's simple

A remote daemon serves its own SPA with its own token injected (web_router_with_token), so pointing the window at the remote's tailnet URL is a complete, authenticated connection — nothing is passed by the client, exactly like the browser PWA.

How

  • discovery.ts — shells tailscale status --json, enumerates online peers, probes each on :443 and :8443 (the smoo-hub coexistence port) for the ungated /health (is a daemon here?) + /api/auth/status (whose daemon).
  • daemon.tsSMOOTH_REMOTE_URL drives baseUrl(); startDaemon() skips the spawn in remote mode, so the app never spawns or kills a local daemon while attached to a remote one. +3 unit tests.
  • config.ts — persists the chosen target in userData/config.json.
  • main.ts — reads the target at startup, builds the Connect submenu (radio-checked to the active one, with Refresh), relaunches on switch, and if the remote is unreachable offers a one-click "Switch to This Mac" instead of stranding the window. The Set Up (macOS TCC) submenu hides when remote, since those grants are the local daemon's.

Verification

  • pnpm typecheck clean, oxlint clean, oxfmt formatted.
  • pnpm test — 4/4 pass (2 new: remote-URL override + trailing-slash trim; local fallback).

Note

This is Electron-app code (in app.asar), so it needs a full desktop rebuild to appear in the installed app — pnpm install:bigsmooth only swaps the daemon binary. Follow-up: teach install:bigsmooth to also refresh the app bundle.

🤖 Generated with Claude Code

Tray gains a Connect submenu: 'This Mac (local)' + Big Smooth daemons
discovered on the Tailscale tailnet (e.g. smoo-hub). A remote daemon serves
its own token-injected SPA, so attaching = loading its tailnet URL; nothing is
passed by the client.

- discovery.ts: shell `tailscale status --json`, enumerate online peers, probe
  each on :443/:8443 for the ungated /health + /api/auth/status.
- daemon.ts: SMOOTH_REMOTE_URL drives baseUrl(); startDaemon() skips the spawn
  in remote mode (never spawns/kills a local daemon). +3 tests.
- config.ts: persist the chosen target in userData/config.json.
- main.ts: set the target from config at startup, build the Connect submenu,
  relaunch on switch, and offer a one-click fall-back to local if the remote
  is unreachable (instead of stranding the window). Set Up (TCC) hidden when remote.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L3xMBWMtMRNayBC2GjHntk
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dc60e28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

brentrager and others added 2 commits August 4, 2026 18:36
… /health

Tested against live smoo-hub: :443 runs the SmooHub dashboard (also 200 on
/health, serves SPA HTML at /api/auth/status) while the daemon is on :8443.
/health alone would mis-identify the dashboard as a daemon. Now require
/api/auth/status to parse as JSON with a `loggedIn` boolean (the daemon's
shape). Also fixes the field casing: the daemon returns camelCase
loggedIn/orgId, not snake_case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L3xMBWMtMRNayBC2GjHntk
…(carrying its daemon) to a remote Mac

The app is the install package: one bundle = GUI + the daemon it manages.
ditto-packs the .app, ships it, boots out the old standalone-daemon LaunchAgents
(com.smooai.smooth-daemon + com.smooai.smooth/th-up), backs up + swaps the app,
and installs a keep-alive LaunchAgent that launches the app with the ports that
dodge the SmooHub dashboard (:8788 local + :8443 serve) and the SAME
operator.db + workspace so history carries over. Verified live on smoo-hub:
Electron app + its daemon child running, /api/stats = 243 conversations,
survives reboot, dashboard untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L3xMBWMtMRNayBC2GjHntk
@brentrager
brentrager merged commit 28aefe2 into main Aug 4, 2026
3 checks passed
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.

1 participant