Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(phone): make relay remote access free — drop the Pro gate + monthly quota
enesb5c15217b8cc
diff --git a/docs/relay-quota.md b/docs/relay-quota.mddeleted file mode 100644index e886fda69..000000000--- a/docs/relay-quota.md+++ /dev/null@@ -1,23 +0,0 @@-# Relay quota — backend contract (free tier)--Client behavior shipped in this repo; the API must add:--- `POST /v1/relay/host-token` — accept `{ deviceId, hostPublicKeyB64 }` (no `entitlement`)- for free-tier hosts. Server enforces its own free-tier policy; non-OK ⇒ client keeps- hosting down (pre-feature behavior).-- `POST /v1/relay/device` — accept `{ deviceId, hostDeviceId, hostPublicKeyB64, label }`- (no `entitlement`) for free-tier provisioning. Non-OK ⇒ pairing degrades to LAN-only.--The client-side monthly meter (5 × peer×day) is advisory UX; the server should rate-limit-free-tier hosts independently — a patched client can skip the local meter.--## Client shape (as implemented)--- Pro sends the entitlement token unchanged (`{ entitlement, hostPublicKeyB64 }` /- `{ entitlement, hostPublicKeyB64, label, deviceId }`); only the free tier falls back to the- `deviceId` bodies above. See `mintHostToken` (`src/main/remote/standing-host.ts`) and the- device mint in `src/main/pairing-service.ts`.-- The local meter lives in `src/core/relay-quota.ts` (`RELAY_QUOTA_LIMIT = 5`, keyed by- `(peerKey, local-day)`, month anchored to `max(now, lastSeen)`), consumed at the standing- host's `onPeerReady`: 1st use of the month silent, 2nd+ an OS notification, the 6th refused- **before** approval so an exhausted host never serves a new pair. `isPremium()` bypasses.diff --git a/src/core/relay-quota.test.ts b/src/core/relay-quota.test.tsdeleted file mode 100644index eb1015610..000000000--- a/src/core/relay-quota.test.ts+++ /dev/null@@ -1,132 +0,0 @@-import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'-import { mkdtempSync, rmSync, readFileSync, writeFileSync } from 'fs'-import { tmpdir } from 'os'-import path from 'path'--const h = vi.hoisted(() => ({ premium: false }))-vi.mock('./license', () => ({ isPremium: () => h.premium }))--let userData = ''--async function boot() {- vi.resetModules()- const { initPlatform } = await import('./platform')- const { fakePlatform } = await import('./platform-fake')- const fake = fakePlatform({ userDataDir: userData, isPackaged: false })- initPlatform(fake)- const quota = await import('./relay-quota')- return { fake, quota }-}--describe('relay-quota', () => {- beforeEach(() => {- vi.useFakeTimers({ toFake: ['Date'] })- vi.setSystemTime(new Date('2026-07-15T12:00:00'))- h.premium = false- userData = mkdtempSync(path.join(tmpdir(), 'nt-relay-quota-'))- })- afterEach(async () => {- const { resetPlatformForTests } = await import('./platform')- resetPlatformForTests()- vi.useRealTimers()- rmSync(userData, { recursive: true, force: true })- })-- it('counts a fresh (peer, day) and stays silent-compatible on the first use', async () => {- const { quota } = await boot()- expect(quota.consumeRelayUse('phoneA')).toEqual({ kind: 'ok', used: 1, limit: 5 })- })-- it('same peer same local day never double-counts', async () => {- const { quota } = await boot()- quota.consumeRelayUse('phoneA')- expect(quota.consumeRelayUse('phoneA')).toEqual({ kind: 'already', used: 1, limit: 5 })- })-- it('same peer on a NEW day consumes a new slot', async () => {- const { quota } = await boot()- quota.consumeRelayUse('phoneA')- vi.setSystemTime(new Date('2026-07-16T12:00:00'))- expect(quota.consumeRelayUse('phoneA')).toEqual({ kind: 'ok', used: 2, limit: 5 })- })-- it('exhausts at the limit and refuses a 6th distinct pair', async () => {- const { quota } = await boot()- for (const p of ['a', 'b', 'c', 'd', 'e']) quota.consumeRelayUse(p)- expect(quota.consumeRelayUse('f')).toEqual({ kind: 'exhausted', used: 5, limit: 5 })- // …but a peer already counted today still gets in:- expect(quota.consumeRelayUse('a')).toEqual({ kind: 'already', used: 5, limit: 5 })- })-- it('month rollover resets the ledger', async () => {- const { quota } = await boot()- for (const p of ['a', 'b', 'c', 'd', 'e']) quota.consumeRelayUse(p)- vi.setSystemTime(new Date('2026-08-01T09:00:00'))- expect(quota.consumeRelayUse('f')).toEqual({ kind: 'ok', used: 1, limit: 5 })- })-- it('clock rollback cannot mint a fresh month (lastSeen anchor)', async () => {- const { quota } = await boot()- for (const p of ['a', 'b', 'c', 'd', 'e']) quota.consumeRelayUse(p)- vi.setSystemTime(new Date('2026-06-01T09:00:00')) // roll BACK before the ledger month- expect(quota.consumeRelayUse('f').kind).toBe('exhausted')- })-- it('premium bypasses without writing the ledger', async () => {- h.premium = true- const { quota } = await boot()- expect(quota.consumeRelayUse('phoneA')).toEqual({ kind: 'unlimited' })- expect(quota.relayQuotaStatus().unlimited).toBe(true)- })-- it('relayQuotaAvailable: true under limit, true when only a today-peer could enter, false when cold-exhausted', async () => {- const { quota } = await boot()- expect(quota.relayQuotaAvailable()).toBe(true)- for (const p of ['a', 'b', 'c', 'd', 'e']) quota.consumeRelayUse(p)- expect(quota.relayQuotaAvailable()).toBe(true) // entries today → an already-counted peer may return- vi.setSystemTime(new Date('2026-07-20T12:00:00')) // same month, later day: no entry is "today"- expect(quota.relayQuotaAvailable()).toBe(false)- })-- it('peek returns ok with the projected used but persists nothing', async () => {- const { quota } = await boot()- expect(quota.peekRelayUse('phoneA')).toEqual({ kind: 'ok', used: 1, limit: 5 })- // Nothing was charged: a real consume still counts and returns the same projected used.- expect(quota.consumeRelayUse('phoneA')).toEqual({ kind: 'ok', used: 1, limit: 5 })- })-- it("peek reports 'already' for a peer counted today", async () => {- const { quota } = await boot()- quota.consumeRelayUse('phoneA')- expect(quota.peekRelayUse('phoneA')).toEqual({ kind: 'already', used: 1, limit: 5 })- })-- it("peek reports 'exhausted' at the cap without charging", async () => {- const { quota } = await boot()- for (const p of ['a', 'b', 'c', 'd', 'e']) quota.consumeRelayUse(p)- expect(quota.peekRelayUse('f')).toEqual({ kind: 'exhausted', used: 5, limit: 5 })- // Still exhausted (peek didn't add an entry), and a fresh consume also refuses.- expect(quota.peekRelayUse('f')).toEqual({ kind: 'exhausted', used: 5, limit: 5 })- })-- it("peek reports 'unlimited' when premium", async () => {- h.premium = true- const { quota } = await boot()- expect(quota.peekRelayUse('phoneA')).toEqual({ kind: 'unlimited' })- })-- it('status handler + change broadcast go over CorePlatform', async () => {- const { fake, quota } = await boot()- quota.initRelayQuota()- quota.consumeRelayUse('phoneA')- await vi.waitFor(() => {- expect(fake.sent.some((s) => s.channel === 'relay-quota:changed')).toBe(true)- })- })-- it('a corrupt store file degrades to an empty ledger', async () => {- const { quota } = await boot()- writeFileSync(path.join(userData, 'relay-quota.json'), '{not json')- expect(quota.consumeRelayUse('a')).toEqual({ kind: 'ok', used: 1, limit: 5 })- })-})diff --git a/src/core/relay-quota.ts b/src/core/relay-quota.tsdeleted file mode 100644index 4aaabde7c..000000000--- a/src/core/relay-quota.ts+++ /dev/null@@ -1,129 +0,0 @@-// Monthly free-tier quota for relay remote access (spec docs/superpowers/specs/-// 2026-07-15-nodeterm-pro-mobile-paywall-design.md §4). Pro (license.ts isPremium)-// bypasses. Unit: (peerKey, local day) — the same phone re-bridging on the same local-// day never consumes a second use. The month derives from max(now, lastSeen), so a-// rolled-back clock can neither mint a fresh month nor revive a day.-import { readFileSync, writeFileSync } from 'fs'-import path from 'path'-import { platform } from './platform'-import { IPC } from '../shared/ipc'-import { isPremium } from './license'-import type { RelayQuotaStatus } from '../shared/types'--export const RELAY_QUOTA_LIMIT = 5--interface Stored {- month?: string // '2026-07'- entries?: { peer: string; day: string }[] // day: '2026-07-15' (local)- /** Largest unix-seconds timestamp this install has observed — the clock-rollback anchor. */- lastSeen?: number-}--function file(): string {- return path.join(platform().userDataDir, 'relay-quota.json')-}-function load(): Stored {- try {- return JSON.parse(readFileSync(file(), 'utf-8')) as Stored- } catch {- return {}- }-}-// Synchronous so consecutive consumeRelayUse() calls (a sync API) observe prior-// entries — a fresh readFileSync load in each call must see the previous write.-function save(s: Stored): void {- try {- writeFileSync(file(), JSON.stringify(s), 'utf-8')- } catch {- // best-effort persistence; a failed write must never crash a bridge admission- }-}--function effectiveNow(s: Stored): Date {- return new Date(Math.max(Date.now(), (s.lastSeen ?? 0) * 1000))-}-function dayOf(d: Date): string {- const m = String(d.getMonth() + 1).padStart(2, '0')- const day = String(d.getDate()).padStart(2, '0')- return `${d.getFullYear()}-${m}-${day}`-}--/** Load, roll into the current (anchored) month, and advance the anchor. */-function normalized(): Required<Stored> {- const s = load()- const day = dayOf(effectiveNow(s))- const month = day.slice(0, 7)- const lastSeen = Math.max(s.lastSeen ?? 0, Math.floor(Date.now() / 1000))- if (s.month !== month) return { month, entries: [], lastSeen }- return { month, entries: s.entries ?? [], lastSeen }-}--export type RelayConsume =- | { kind: 'unlimited' }- | { kind: 'ok'; used: number; limit: number }- | { kind: 'already'; used: number; limit: number }- | { kind: 'exhausted'; used: number; limit: number }--export function relayQuotaStatus(): RelayQuotaStatus {- const s = normalized()- return {- month: s.month,- used: s.entries.length,- limit: RELAY_QUOTA_LIMIT,- unlimited: isPremium()- }-}--/**- * True when a relay bridge could be admitted right now: Pro, a free slot left, or at- * least one peer already counted TODAY (that peer may reconnect for free). Used by the- * standing host's reconcile to decide whether hosting is worth running at all.- */-export function relayQuotaAvailable(): boolean {- if (isPremium()) return true- const s = normalized()- if (s.entries.length < RELAY_QUOTA_LIMIT) return true- const today = dayOf(effectiveNow(s))- return s.entries.some((e) => e.day === today)-}--export function broadcastRelayQuota(): void {- platform().broadcast(IPC.relayQuotaChanged, relayQuotaStatus())-}--/** Admit-or-refuse a relay bridge from `peerKey`, consuming a (peer, day) slot if fresh. */-export function consumeRelayUse(peerKey: string): RelayConsume {- if (isPremium()) return { kind: 'unlimited' }- const s = normalized()- const day = dayOf(effectiveNow(s))- if (s.entries.some((e) => e.peer === peerKey && e.day === day)) {- save(s) // persist the advanced anchor / month rollover- return { kind: 'already', used: s.entries.length, limit: RELAY_QUOTA_LIMIT }- }- if (s.entries.length >= RELAY_QUOTA_LIMIT) {- save(s)- return { kind: 'exhausted', used: s.entries.length, limit: RELAY_QUOTA_LIMIT }- }- s.entries.push({ peer: peerKey, day })- save(s)- broadcastRelayQuota()- return { kind: 'ok', used: s.entries.length, limit: RELAY_QUOTA_LIMIT }-}--/** Non-mutating admission check: what consumeRelayUse WOULD return, persisting nothing. */-export function peekRelayUse(peerKey: string): RelayConsume {- if (isPremium()) return { kind: 'unlimited' }- const s = normalized()- const day = dayOf(effectiveNow(s))- if (s.entries.some((e) => e.peer === peerKey && e.day === day)) {- return { kind: 'already', used: s.entries.length, limit: RELAY_QUOTA_LIMIT }- }- if (s.entries.length >= RELAY_QUOTA_LIMIT) {- return { kind: 'exhausted', used: s.entries.length, limit: RELAY_QUOTA_LIMIT }- }- return { kind: 'ok', used: s.entries.length + 1, limit: RELAY_QUOTA_LIMIT }-}--export function initRelayQuota(): void {- platform().handle(IPC.relayQuotaStatus, () => relayQuotaStatus())-}diff --git a/src/main/index.ts b/src/main/index.tsindex 84575a124..6497c1b24 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -99,7 +99,6 @@ import { initLicense, isPremium, getStoredEntitlement } from '../core/license'import { WhisperModelStore } from '../core/speech/whisper-models'import { SpeechService } from '../core/speech/speech-service'import { registerSpeechIpc } from '../core/speech/register-ipc'-import { initRelayQuota, broadcastRelayQuota, relayQuotaAvailable } from '../core/relay-quota'import { initClaudeAccounts } from './claude-accounts'import { claudeCliCaps, registerClaudeCliIpc, type ClaudeCliCaps } from '../core/claude-cli'import { claudeConfigDirFor } from '../core/claude-config-dir'@@ -631,8 +630,6 @@ app.whenReady().then(async () => {// window over `pairing:done` so the settings section can show the paired/timeout state.const pairingService = createPairingService({getSettings: () => settingsStore.get(),- isPremium,- quotaAvailable: relayQuotaAvailable,getEntitlement: getStoredEntitlement,loadHostKeyPair: loadOrCreateKeyPair,relayEndpoint: RELAY_URL,@@ -1609,16 +1606,7 @@ app.whenReady().then(async () => {buildMirrorUsage(usageService.snapshot(), settingsStore.get().claudeAccounts ?? [], Date.now()))initTelemetry(() => settingsStore.get())- // Declared before initLicense so its onChange hook can re-reconcile the standing host once the- // async launch-time entitlement refresh settles (fixes the boot race where Pro isn't yet valid- // when syncFromSettings first runs).- let standingHost: ReturnType<typeof initStandingHost> | undefined- initRelayQuota()- initLicense(() => {- standingHost?.syncFromSettings()- // A Pro flip changes `unlimited` in the quota status — push the fresh value.- broadcastRelayQuota()- })+ initLicense(() => {})// Lazy getter: sshProjectManager is created just below, so a remote account op (which only runs// after the user has connected an SSH project) always sees the live manager.initClaudeAccounts(() => sshProjectManager)@@ -1642,10 +1630,10 @@ app.whenReady().then(async () => {// Revocation reaches its sessions via `killRelayHostsByPeerKey` (peerRevoker, above).initRelayHost(win, corePlatform, {})// Standing (phone) relay host: keep a host connection registered so a paired phone can reach- // this Mac from anywhere. Honors settings.phoneAccessEnabled + the Pro gate internally.- standingHost = initStandingHost(win, ptyManager, () => settingsStore.get(), listProjectsOutput, hostBridge)- ipcMain.on(IPC.remoteStandingHostSet, (_e, enabled: boolean) => standingHost?.setEnabled(!!enabled))- // Reconcile from persisted settings on launch (starts hosting if enabled + Pro).+ // this Mac from anywhere. Honors settings.phoneAccessEnabled internally.+ const standingHost = initStandingHost(win, ptyManager, () => settingsStore.get(), listProjectsOutput, hostBridge)+ ipcMain.on(IPC.remoteStandingHostSet, (_e, enabled: boolean) => standingHost.setEnabled(!!enabled))+ // Reconcile from persisted settings on launch (starts hosting if enabled).standingHost.syncFromSettings()// Interactive relay CLIENT (Stage 4): connect OUT to another desktop's host. `connectRelayClient`// runs the client half of mutual SAS approval and, once BOTH humans confirm, exposes the raw rpc.tsdiff --git a/src/main/pairing-service.ts b/src/main/pairing-service.tsindex 5ca7ba3a3..425170685 100644--- a/src/main/pairing-service.ts+++ b/src/main/pairing-service.ts@@ -43,17 +43,14 @@ const execFileAsync = promisify(execFile)/*** Optional relay dependencies injected into the pairing service. When present AND phone access is- * enabled + Pro, a successful LAN pair ALSO provisions the phone for the relay (a device token ++ * enabled, a successful LAN pair ALSO provisions the phone for the relay (a device token +* the host's relay identity), so it can reach this Mac from anywhere. Injected (not imported) so* `pairing-core` stays pure and this stays testable. Absent / any failure ⇒ LAN-only (the phone* still pairs; it just won't get relay access).*/export interface PairingRelayDeps {getSettings(): Settings- isPremium(): booleangetEntitlement(): string | null- /** Free-tier relay taster: true while the monthly quota could still admit a bridge. */- quotaAvailable(): booleanloadHostKeyPair(): Promise<KeyPair>/** The relay WebSocket endpoint advertised to the phone. */relayEndpoint: string@@ -100,17 +97,15 @@ async function mintRelayDevice(/*** Compute this host's relay reachability block WITHOUT any network call (just the host key →- * hostId), so the QR renders instantly. Returns null (LAN-only) when phone access is off, not Pro- * and no free quota, blocked in dev, or (on Pro) no entitlement is stored.+ * hostId), so the QR renders instantly. Returns null (LAN-only) when phone access is off or+ * blocked in dev.*/async function buildRelayContext(deps: PairingRelayDeps | undefined): Promise<{ block: RelayPairingBlock; entitlement: string | null } | null> {if (!deps || !deps.relayAllowed()) return nullif (!deps.getSettings().phoneAccessEnabled) return null- if (!deps.isPremium() && !deps.quotaAvailable()) return nullconst entitlement = deps.getEntitlement() // null on free tier → mint by deviceId- if (deps.isPremium() && !entitlement) return nulltry {const keys = await deps.loadHostKeyPair()const hostPublicKeyB64 = publicKeyToB64(keys.publicKey)diff --git a/src/main/remote/standing-host.ts b/src/main/remote/standing-host.tsindex f4bd889d1..d17973bb4 100644--- a/src/main/remote/standing-host.ts+++ b/src/main/remote/standing-host.ts@@ -1,8 +1,7 @@// Standing (always-on) phone host — the desktop side of the iOS relay-client "reach my Mac from// anywhere" flow.//-// When Settings → phoneAccessEnabled is on AND the device is Pro **or has free-tier quota left**,-// this keeps a HOST relay+// When Settings → phoneAccessEnabled is on, this keeps a HOST relay// connection registered under the host's stable id (base64url(sha256(hostPublicKey)).slice(0,22)),// so a previously-paired phone can join over the relay at any time and attach to the host's tmux// sessions after approval. Unlike the interactive host (a single-use offer you hand out), the@@ -19,12 +18,11 @@// unit-tested `approved-devices-core`.import { randomUUID } from 'crypto'-import { dialog, ipcMain, Notification, type BrowserWindow } from 'electron'+import { dialog, ipcMain, type BrowserWindow } from 'electron'import { IPC } from '../../shared/ipc'import type { CanvasMutation, Settings } from '../../shared/types'import { PtyManager } from '../../core/pty-manager'-import { getStoredEntitlement, isPremium } from '../../core/license'-import { consumeRelayUse, peekRelayUse, relayQuotaAvailable } from '../../core/relay-quota'+import { getStoredEntitlement } from '../../core/license'import { getDeviceId } from '../../core/device-id'import { createPhonePresence, type PhonePresence } from './phone-presence'import { publicKeyToB64, type KeyPair } from './e2ee'@@ -113,15 +111,6 @@ function reportKeyLocked(err: Error): void {console.error('[standing-host] host identity is locked:', err.message)}-/** Quota notices surface as OS notifications: the standing host has no UI of its own. */-function notifyQuota(body: string): void {- try {- new Notification({ title: 'nodeterm — remote access', body }).show()- } catch {- // Notifications unavailable (headless/CI): the renderer banner still shows the state.- }-}-export interface StandingHost {/** Explicit toggle (from the Settings switch). Reconciles the connection immediately. */setEnabled(enabled: boolean): void@@ -133,7 +122,7 @@ export interface StandingHost {/*** Wire the standing phone host. Idempotent to construct once; `setEnabled` / `syncFromSettings`- * reconcile the live connection against (enabled && Pro && relay-allowed).+ * reconcile the live connection against (enabled && relay-allowed).*/export function initStandingHost(win: BrowserWindow,@@ -217,27 +206,6 @@ export function initStandingHost(if (running && pendingCount() < TARGET_PENDING) void connectOne()}- // Charge a (peer, day) slot at APPROVAL time (auto-approve for a pinned device, or the human's- // OK for an unknown one) — never at bridge time, so a declined/timed-out prompt costs nothing.- // Returns whether the peer is admitted. On an exhausted race (another peer took the last slot- // between the earlier peek and now) it drops the session and refuses; 2nd+ use of the month- // notifies; 1st use / already-counted / Pro (unlimited) is silent.- function chargeAndAdmit(pooled: Pooled, pub: string | null): boolean {- const q = consumeRelayUse(pub ?? 'unknown-peer')- if (q.kind === 'exhausted') {- notifyQuota(- `Remote access limit reached (${q.limit}/${q.limit} this month). Upgrade to Pro for unlimited access.`- )- removeFromPool(pooled)- ensurePool()- return false- }- if (q.kind === 'ok' && q.used >= 2) {- notifyQuota(`Remote access ${q.used}/${q.limit} this month`)- }- return true- }-function scheduleReconnect(): void {if (!running || reconnectTimer) returnconst delay = RECONNECT_DELAYS_MS[Math.min(reconnectAttempt, RECONNECT_DELAYS_MS.length - 1)]@@ -281,19 +249,6 @@ export function initStandingHost(}const s = pooled.sessionconst pub = s.peerPublicKeyB64()- // Free-tier admission GATE (non-mutating): refuse an over-limit free host a NEW pair before any- // approval, but DON'T charge yet — the slot is spent only when the pair is actually approved- // (pinned auto-approve, or the human's OK), never merely by bridging. A peer already counted- // today ('already') or Pro ('unlimited') falls straight through to the approval flow.- const q = peekRelayUse(pub ?? 'unknown-peer')- if (q.kind === 'exhausted') {- notifyQuota(- `Remote access limit reached (${q.limit}/${q.limit} this month). Upgrade to Pro for unlimited access.`- )- removeFromPool(pooled)- ensurePool()- return- }let storetry {store = await loadApprovedDevices()@@ -302,10 +257,7 @@ export function initStandingHost(}if (!pool.has(pooled)) return // torn down while the disk read was in flightif (pub && isPinned(store, pub)) {- // Auto-approve → this is the charge point for a pinned device. An exhausted race here drops- // the session inside the helper; only a genuine admission approves.- if (!chargeAndAdmit(pooled, pub)) return- s.approve()+ s.approve() // pinned device → auto-approve silentlyreturn}// Unknown device → require the host human's approval (shared SAS dialog). Remember the pubkey +@@ -327,11 +279,7 @@ export function initStandingHost(if (!running || opening || pendingCount() >= TARGET_PENDING) returnopening = truetry {- // Re-verify admission on every (re)connect: a lapsed Pro tears the host down; a- // free-tier host runs only while the monthly quota could still admit a bridge.- if (!isPremium() && !relayQuotaAvailable()) return stop()const entitlement = getStoredEntitlement() // null on free tier → mint by deviceId- if (isPremium() && !entitlement) return stop()// The host key is the identity every paired phone PINNED. If the OS keyring is locked we// cannot READ it (host-identity refuses to regenerate over it — that would rotate the// identity and force every phone to re-approve). There is nothing to advertise, so stop:@@ -416,7 +364,7 @@ export function initStandingHost(}function reconcile(): void {- const want = enabled && (isPremium() || relayQuotaAvailable()) && relayAllowed()+ const want = enabled && relayAllowed()if (want && !running) start()else if (!want && running) stop()}@@ -430,9 +378,6 @@ export function initStandingHost(// browse socket may have already closed. Prefer the live peer's key, else the remembered one.const pub = p.session.peerPublicKeyB64() ?? p.approvalPubclearApproval(p)- // Charge the slot at the human's OK (a reject/timeout never reaches here → costs nothing). An- // exhausted race drops the session inside the helper; don't pin or approve a refused peer.- if (!chargeAndAdmit(p, pub)) returnif (pub) {void loadApprovedDevices().then((store) => saveApprovedDevices(pinDevice(store, pub)))@@ -449,14 +394,6 @@ export function initStandingHost(ensurePool()})- // Month rollover / quota changes can re-admit a stopped free-tier host (or retire an exhausted- // one). reconcile() is idempotent, so a slow hourly tick is safe and cheap.- // NOT cleared in stop(): stop() also fires transiently (exhaustion, lapsed Pro), and this tick is- // exactly what must revive hosting later. The interval is unref'd and dies with the process, and- // initStandingHost is constructed once, so there is nothing to clean up.- const reconcileTimer = setInterval(() => reconcile(), 60 * 60 * 1000)- reconcileTimer.unref?.()-return {setEnabled(next) {enabled = nextdiff --git a/src/preload/index.ts b/src/preload/index.tsindex 68e8250b9..11ecac710 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -322,14 +322,6 @@ const api: NodeTerminalApi = {return () => ipcRenderer.removeListener(IPC.licenseChanged, handler)}},- relayQuota: {- getStatus: () => ipcRenderer.invoke(IPC.relayQuotaStatus),- onChange: (listener) => {- const h = (_e: unknown, s: Parameters<typeof listener>[0]) => listener(s)- ipcRenderer.on(IPC.relayQuotaChanged, h)- return () => ipcRenderer.removeListener(IPC.relayQuotaChanged, h)- }- },announcements: {fetch: () => ipcRenderer.invoke(IPC.announcementsFetch)},diff --git a/src/renderer/bridge/relay-api.test.ts b/src/renderer/bridge/relay-api.test.tsindex 08d44e5a0..014b549e8 100644--- a/src/renderer/bridge/relay-api.test.ts+++ b/src/renderer/bridge/relay-api.test.ts@@ -46,7 +46,6 @@ function fakeLocalApi() {settings: { NAME: 'local-settings' },dialog: { NAME: 'local-dialog' },license: { NAME: 'local-license' },- relayQuota: { NAME: 'local-relay-quota' },pty: { onData: ptyOnData },claude: { cliCaps: () => Promise.resolve({}), readTranscript: () => Promise.reject() },relayClient: { disconnect: vi.fn() }@@ -92,7 +91,6 @@ describe('buildRelayApi', () => {expect(api.clipboard).toBe(local.clipboard)expect(api.settings).toBe(local.settings)expect(api.license).toBe(local.license)- expect(api.relayQuota).toBe(local.relayQuota)})it('routes the folder/file picker to the HOST fs, not the local native dialog', () => {diff --git a/src/renderer/bridge/relay-api.ts b/src/renderer/bridge/relay-api.tsindex fd1aa347c..050f86d85 100644--- a/src/renderer/bridge/relay-api.ts+++ b/src/renderer/bridge/relay-api.ts@@ -12,7 +12,7 @@// the `onAgentStatus`/`onSubagentActivity` streams, `claude.cliCaps`, `userDataDir`) route over the// relay RpcClient → they hit the REMOTE core. This is what makes the tab actually remote: its// terminals, repos, files, canvas and presence all live on the host's machine.-// • APP-GLOBAL namespaces (`updates`, `license`, `relayQuota`, `clipboard`, `shell`, `dialog`, `media`,+// • APP-GLOBAL namespaces (`updates`, `license`, `clipboard`, `shell`, `dialog`, `media`,// `settings`, `pairing`, `announcements`, `usage`, `ssh*`, `remote*`, `relay*`, notifications, menu events)// stay LOCAL (`window.nodeTerminal.*`). Your update banner shows YOUR version, a file picker// browses YOUR disk, your UI settings/theme are yours, and the relay-tunnel machinery itself is@@ -73,7 +73,7 @@ export function buildRelayApi(connectionId: string, transport?: FrameTransport):const api: NodeTerminalApi = {// ── Base: every APP-GLOBAL namespace stays LOCAL. Spreading the whole preload gives the real- // desktop implementations (updates/license/relayQuota/clipboard/shell/dialog/media/settings/pairing/+ // desktop implementations (updates/license/clipboard/shell/dialog/media/settings/pairing/// announcements/usage/ssh*/remote*/relay*/notifications/menu events). The core-bound spreads// below override the handful that must hit the remote core....local,diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.tsindex 98fe130dd..4afd9115a 100644--- a/src/renderer/bridge/stubs.ts+++ b/src/renderer/bridge/stubs.ts@@ -208,12 +208,6 @@ export function buildStubApi(): Omit<getStatus: U('license.getStatus'),onChange: noopUnsub},- relayQuota: {- // Server Edition does not host the phone relay; report unlimited so every quota- // surface hides in the browser instead of showing a broken meter.- getStatus: async () => ({ month: '', used: 0, limit: 5, unlimited: true }),- onChange: noopUnsub- },contextLink: {setLinks: pnoop,info: U('contextLink.info')diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 6e8620e46..5fb30723a 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -90,7 +90,6 @@ import { BugReportDialog } from '../components/BugReportDialog'import { describeOs, REPO_URL } from '../lib/bugReport'import { UpdateCard } from '../components/UpdateCard'import { AnnouncementBanner } from '../components/AnnouncementBanner'-import { RelayQuotaBanner } from '../components/RelayQuotaBanner'import { TmuxBanner } from '../components/TmuxBanner'import { PhonePairPopover } from '../components/PhonePairPopover'import { ConflictBar } from '../components/ConflictBar'@@ -6993,7 +6992,6 @@ export function Canvas() {/><div className="top-banners">- <RelayQuotaBanner /><AnnouncementBanner /><TmuxBanner onInstall={runInTerminal} />{migrationNote && (diff --git a/src/renderer/components/PhonePairPopover.tsx b/src/renderer/components/PhonePairPopover.tsxindex 5c2e6c9ee..c770f7d9a 100644--- a/src/renderer/components/PhonePairPopover.tsx+++ b/src/renderer/components/PhonePairPopover.tsx@@ -2,8 +2,6 @@ import { useEffect } from 'react'import { createPortal } from 'react-dom'import { Switch } from '@renderer/ui/Switch'import { useSettings } from '@renderer/state/settings'-import { useEntitlement } from '@renderer/state/entitlement'-import { useUpgradeGate } from '@renderer/state/upgradeGate'import { usePhonePairing } from './settings/usePhonePairing'import { IOS_APP_STORE_URL } from '@renderer/lib/links'@@ -27,13 +25,12 @@ export function PhonePairPopover({}): React.JSX.Element {const { phase, qr, sshOpen, sshHealed, error, busy, start } = usePhonePairing()- const isPremium = useEntitlement((s) => s.isPremium)const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)const updateSettings = useSettings((s) => s.update)const togglePhoneAccess = (next: boolean): void => {updateSettings({ phoneAccessEnabled: next })- // Start/stop the standing relay host immediately (main also honors the Pro gate).+ // Start/stop the standing relay host immediately.window.nodeTerminal.remoteHost.setPhoneAccess(next)}@@ -109,21 +106,12 @@ export function PhonePairPopover({<div className="phone-pair__row"><div className="phone-pair__row-text">- <div className="phone-pair__row-title">- Reach this Mac from anywhere- {!isPremium && <span className="phone-pair__pro">PRO</span>}- </div>+ <div className="phone-pair__row-title">Reach this Mac from anywhere</div><div className="phone-pair__row-sub">E2E encrypted over the relay — not just your LAN.</div></div><Switch- checked={isPremium && phoneAccessEnabled}- onChange={(next) => {- if (!isPremium) {- useUpgradeGate.getState().show('Remote access from your phone')- return- }- togglePhoneAccess(next)- }}+ checked={phoneAccessEnabled}+ onChange={togglePhoneAccess}ariaLabel="Reach this Mac from anywhere"/></div>diff --git a/src/renderer/components/RelayQuotaBanner.tsx b/src/renderer/components/RelayQuotaBanner.tsxdeleted file mode 100644index c9e20f473..000000000--- a/src/renderer/components/RelayQuotaBanner.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { useEffect } from 'react'-import { useRelayQuota } from '../state/relayQuota'-import { useEntitlement } from '../state/entitlement'--/**- * Free-tier remote-access meter (spec 2026-07-15 §4): hidden for Pro and below 2 uses- * (the 1st use of a month is deliberately silent), informative from 2/5, and an upgrade- * CTA once the month is exhausted.- *- * Reuses the `.announce-banner` styles: the base (accent) style is the informative state,- * `--warning` is the exhausted state.- */-export function RelayQuotaBanner(): JSX.Element | null {- const status = useRelayQuota((s) => s.status)- const hydrate = useRelayQuota((s) => s.hydrate)- const upgrade = useEntitlement((s) => s.upgrade)- useEffect(() => {- void hydrate()- }, [hydrate])- if (!status || status.unlimited || status.used < 2) return null- const exhausted = status.used >= status.limit- return (- <div className={`announce-banner ${exhausted ? 'announce-banner--warning' : ''}`}>- <span className="announce-banner__dot" />- <div className="announce-banner__content">- {exhausted- ? `Remote access limit reached — ${status.used}/${status.limit} this month. Pro is unlimited.`- : `Remote access ${status.used}/${status.limit} this month.`}- </div>- {exhausted ? (- <button className="announce-banner__btn" onClick={() => void upgrade()}>- Upgrade- </button>- ) : null}- </div>- )-}diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsxindex bc640cf28..e2d2f0479 100644--- a/src/renderer/components/settings/sections/PhoneSection.tsx+++ b/src/renderer/components/settings/sections/PhoneSection.tsx@@ -6,14 +6,13 @@ import { ConfirmDialog } from '../../ConfirmDialog'import { Button } from '@renderer/ui/Button'import { Switch } from '@renderer/ui/Switch'import { useSettings } from '@renderer/state/settings'-import { useEntitlement } from '@renderer/state/entitlement'import { usePhonePairing } from '../usePhonePairing'import { IOS_APP_STORE_URL } from '@renderer/lib/links'const ROWS = {remote: {title: 'Remote access from your phone',- keywords: ['phone', 'remote', 'anywhere', 'relay', 'encrypted', 'pro', 'access', 'cellular']+ keywords: ['phone', 'remote', 'anywhere', 'relay', 'encrypted', 'access', 'cellular']},pair: {title: 'Pair phone',@@ -43,13 +42,12 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Eleconst [devices, setDevices] = useState<PairedDevice[]>([])const [pendingRevoke, setPendingRevoke] = useState<PairedDevice | null>(null)- const isPremium = useEntitlement((s) => s.isPremium)const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)const updateSettings = useSettings((s) => s.update)const togglePhoneAccess = (next: boolean): void => {updateSettings({ phoneAccessEnabled: next })- // Start/stop the standing relay host immediately (main also honors the Pro gate).+ // Start/stop the standing relay host immediately.window.nodeTerminal.remoteHost.setPhoneAccess(next)}@@ -100,20 +98,12 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Eleverified with a code the first time.</p></div>- {isPremium ? (- <Switch- checked={phoneAccessEnabled}- onChange={togglePhoneAccess}- ariaLabel="Remote access from your phone"- />- ) : null}+ <Switch+ checked={phoneAccessEnabled}+ onChange={togglePhoneAccess}+ ariaLabel="Remote access from your phone"+ /></div>- {!isPremium ? (- <p className="text-sm text-muted">- Remote access from anywhere requires nodeterm Pro. Pairing over your local network is- free — set it up below.- </p>- ) : null}</div></SearchableRow>diff --git a/src/renderer/components/settings/sections/ProCompare.tsx b/src/renderer/components/settings/sections/ProCompare.tsxindex 3d86bdb09..1b182a84a 100644--- a/src/renderer/components/settings/sections/ProCompare.tsx+++ b/src/renderer/components/settings/sections/ProCompare.tsx@@ -1,27 +1,18 @@-import { useEffect } from 'react'-import { useRelayQuota } from '../../../state/relayQuota'-const CORE = ['Unlimited local terminals & canvas','Unlimited SSH projects','Groups, worktrees, git & diff','Agent nodes (Claude / Codex / Gemini)',- 'QR phone pairing on your LAN'+ 'QR phone pairing on your LAN',+ 'Remote access from your phone (relay, E2E encrypted)']const PRO = [- 'Unlimited remote access from your phone',- 'Standing phone host (reachable anywhere)','nodeterm mobile Pro included','3 team seats included (extra seats $5/seat/mo)']-/** Core vs Pro comparison + the live free-tier remote-access meter. */+/** Core vs Pro comparison. */export function ProCompare(): React.JSX.Element {- const status = useRelayQuota((s) => s.status)- const hydrate = useRelayQuota((s) => s.hydrate)- useEffect(() => {- void hydrate()- }, [hydrate])return (<div className="grid grid-cols-2 gap-4 text-sm"><div className="space-y-2">@@ -31,11 +22,6 @@ export function ProCompare(): React.JSX.Element {✓ {f}</p>))}- {status && !status.unlimited ? (- <p className="text-muted">- ✓ Remote access — {status.used}/{status.limit} used this month- </p>- ) : null}</div><div className="space-y-2"><h4 className="text-[13px] font-medium" style={{ color: 'var(--accent)' }}>diff --git a/src/renderer/state/relayQuota.ts b/src/renderer/state/relayQuota.tsdeleted file mode 100644index 791a40465..000000000--- a/src/renderer/state/relayQuota.ts+++ /dev/null@@ -1,18 +0,0 @@-import { create } from 'zustand'-import type { RelayQuotaStatus } from '@shared/types'--interface RelayQuotaState {- status: RelayQuotaStatus | null- hydrate(): Promise<void>-}--/** Mirror of the main-process relay quota (free-tier remote-access meter). */-export const useRelayQuota = create<RelayQuotaState>((set) => {- window.nodeTerminal.relayQuota.onChange((status) => set({ status }))- return {- status: null,- async hydrate() {- set({ status: await window.nodeTerminal.relayQuota.getStatus() })- }- }-})diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 7a0a4c0b4..c6784a038 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -6653,15 +6653,6 @@ body,align-items: center;gap: 6px;}-.phone-pair__pro {- font-size: 9px;- font-weight: 700;- letter-spacing: 0.5px;- padding: 1px 5px;- border-radius: 999px;- color: var(--accent, #0a84ff);- border: 1px solid var(--accent, #0a84ff);-}.phone-pair__row-sub {font-size: 11px;color: var(--muted, rgba(255, 255, 255, 0.55));diff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex 600612a7e..4ec8eed3f 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -100,8 +100,6 @@ export const IPC = {licenseStatus: 'license:status',licenseChanged: 'license:changed',licenseUpgrade: 'license:upgrade',- relayQuotaStatus: 'relay-quota:status',- relayQuotaChanged: 'relay-quota:changed',appRestartToUpdate: 'app:restart-to-update',announcementsFetch: 'announcements:fetch',usageFetch: 'usage:fetch',diff --git a/src/shared/types.ts b/src/shared/types.tsindex 07c7b4b72..26ae94839 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -734,7 +734,7 @@ export interface Settings {* install count also rides the /v1/check call and is NOT gated on this toggle — see core/check.ts. */telemetryEnabled: boolean/** Keep a standing relay host connection so a paired phone can reach this Mac from anywhere- * (end-to-end encrypted). Pro-only; default off. Toggle in Settings → Phone. */+ * (end-to-end encrypted). Default off. Toggle in Settings → Phone. */phoneAccessEnabled: boolean/** Send APNs push notifications to relay-paired phones when an agent needs approval, asks a* question, or finishes a turn (spec: apns-push). Default on — it only fires for users who@@ -1525,19 +1525,6 @@ export interface LicenseApi {onChange(listener: (s: LicenseStatus) => void): () => void}-/** Free-tier relay remote-access quota (spec 2026-07-15). Pro reports `unlimited: true`. */-export interface RelayQuotaStatus {- month: string // '2026-07'- used: number // distinct (peer, local day) pairs consumed this month- limit: number // RELAY_QUOTA_LIMIT- unlimited: boolean // true when Pro-}--export interface RelayQuotaApi {- getStatus(): Promise<RelayQuotaStatus>- onChange(listener: (s: RelayQuotaStatus) => void): () => void-}-export interface RemoteHostApi {/*** Enter host mode: mint a pairing token, connect to the relay as the host, and return the@@ -1739,7 +1726,6 @@ export interface NodeTerminalApi {updates: UpdateApiannouncements: AnnouncementsApilicense: LicenseApi- relayQuota: RelayQuotaApicontextLink: ContextLinkApiboardLog: BoardLogApiusage: UsageApi