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(ui): platform-neutral phone pairing and store copy via mobileStoreLinks
reviewab900b1d244a
diff --git a/src/renderer/components/MobileLaunchCard.test.tsx b/src/renderer/components/MobileLaunchCard.test.tsxnew file mode 100644index 000000000..2398d9c1d--- /dev/null+++ b/src/renderer/components/MobileLaunchCard.test.tsx@@ -0,0 +1,40 @@+// @vitest-environment jsdom+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { IOS_APP_STORE_URL } from '@renderer/lib/links'+import { MobileLaunchCard } from './MobileLaunchCard'+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++let root: Root+let host: HTMLElement+let openExternal: ReturnType<typeof vi.fn>++beforeEach(() => {+ openExternal = vi.fn()+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = { shell: { openExternal } }+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})++afterEach(() => {+ act(() => root.unmount())+ host.remove()+})++describe('MobileLaunchCard', () => {+ it('names the store generically and offers exactly the published store buttons', () => {+ act(() => root.render(<MobileLaunchCard onClose={() => {}} />))+ const text = document.body.textContent ?? ''+ expect(text).toContain('nodeterm mobile is now on the App Store')+ expect(text).not.toContain('iOS app')+ expect(text).not.toContain('Google Play') // not published yet+ const buttons = [...document.body.querySelectorAll('button')].map((b) => b.textContent?.trim())+ expect(buttons).toEqual(['Get it on the App Store', 'Close'])+ act(() => {+ ;[...document.body.querySelectorAll('button')][0].click()+ })+ expect(openExternal).toHaveBeenCalledWith(IOS_APP_STORE_URL)+ })+})diff --git a/src/renderer/components/MobileLaunchCard.tsx b/src/renderer/components/MobileLaunchCard.tsxindex 1c6881777..da044d5f1 100644--- a/src/renderer/components/MobileLaunchCard.tsx+++ b/src/renderer/components/MobileLaunchCard.tsx@@ -1,13 +1,13 @@import { useEffect } from 'react'import { createPortal } from 'react-dom'import { ScenePhone } from './onboarding/scenes'-import { IOS_APP_STORE_URL } from '@renderer/lib/links'+import { mobileStoreLinks, mobileStoreNames } from '@renderer/lib/links'// The seen-flag helpers live in lib/mobileLaunch: Canvas reads them on every launch, and importing// them from here would defeat this component's (and the onboarding scenes') code splitting.export { markMobileLaunchSeen, shouldShowMobileLaunch } from '@renderer/lib/mobileLaunch'/**- * One-time launch announcement for nodeterm mobile (App Store release): a centered card over+ * One-time launch announcement for nodeterm mobile (store release): a centered card over* the canvas in the promo style — dark, purple glow, the floating phone mockup from the setup* tour. Closes for good via the button, Esc, or the backdrop; every path persists the flag.*/@@ -25,13 +25,13 @@ export function MobileLaunchCard({ onClose }: { onClose: () => void }): React.JS<divclassName="mlaunch"role="dialog"- aria-label="nodeterm mobile is on the App Store"+ aria-label={`nodeterm mobile is on ${mobileStoreNames()}`}onClick={(e) => e.stopPropagation()}><h2 className="mlaunch__title">Your terminal, <span>everywhere</span></h2>- <p className="mlaunch__sub">nodeterm mobile is now on the App Store 🎉</p>+ <p className="mlaunch__sub">nodeterm mobile is now on {mobileStoreNames()} 🎉</p><div className="mlaunch__scene"><ScenePhone /></div>@@ -42,13 +42,16 @@ export function MobileLaunchCard({ onClose }: { onClose: () => void }): React.JSwhat fund that work. Your support means everything. ❤️</p><div className="mlaunch__actions">- <button- className="onb-btn onb-btn--primary"- autoFocus- onClick={() => window.nodeTerminal.shell.openExternal(IOS_APP_STORE_URL)}- >- Get the iOS app- </button>+ {mobileStoreLinks().map((store, i) => (+ <button+ key={store.id}+ className="onb-btn onb-btn--primary"+ autoFocus={i === 0}+ onClick={() => window.nodeTerminal.shell.openExternal(store.url)}+ >+ {store.label}+ </button>+ ))}<button className="onb-btn" onClick={onClose}>Close</button>diff --git a/src/renderer/components/PhonePairPopover.tsx b/src/renderer/components/PhonePairPopover.tsxindex d5613f2fc..ee0be3edb 100644--- a/src/renderer/components/PhonePairPopover.tsx+++ b/src/renderer/components/PhonePairPopover.tsx@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'import { Switch } from '@renderer/ui/Switch'import { useSettings } from '@renderer/state/settings'import { usePhonePairing } from './settings/usePhonePairing'-import { IOS_APP_STORE_URL } from '@renderer/lib/links'+import { mobileStoreLinks } from '@renderer/lib/links'import { hostOsFromNavigator, sshServerCopy } from '@shared/ssh-server'import {pairingEndedMessage,@@ -117,7 +117,7 @@ export function PhonePairPopover({) : (<><img src={qr} width={208} height={208} alt="Pairing QR code" className="phone-pair__qr" />- <div className="phone-pair__hint">Scan with the nodeterm iOS app · waiting (10 min)</div>+ <div className="phone-pair__hint">Scan with the nodeterm mobile app · waiting (10 min)</div>{!sshKey ? (<div className="phone-pair__hint">{relayOnlyExplanation(windowsKeyFile)}</div>) : relayPlan === 'dev' ? (@@ -188,12 +188,15 @@ export function PhonePairPopover({/></div>- <button- className="phone-pair__link phone-pair__footer"- onClick={() => window.nodeTerminal.shell.openExternal(IOS_APP_STORE_URL)}- >- Get the nodeterm iOS app ↗- </button>+ {mobileStoreLinks().map((store) => (+ <button+ key={store.id}+ className="phone-pair__link phone-pair__footer"+ onClick={() => window.nodeTerminal.shell.openExternal(store.url)}+ >+ {store.label} ↗+ </button>+ ))}<button className="phone-pair__link phone-pair__footer" onClick={onOpenSettings}>All phone settings…</button>diff --git a/src/renderer/components/onboarding/OnboardingFlow.tsx b/src/renderer/components/onboarding/OnboardingFlow.tsxindex 704ab31da..23ed272d3 100644--- a/src/renderer/components/onboarding/OnboardingFlow.tsx+++ b/src/renderer/components/onboarding/OnboardingFlow.tsx@@ -11,7 +11,7 @@ import {dictationBinding,effectiveBindings} from '../../lib/keybindingOverrides'-import { IOS_APP_STORE_URL } from '../../lib/links'+import { mobileStoreLinks, mobileStoreNames } from '../../lib/links'import { useSettings } from '../../state/settings'import { useEntitlement } from '../../state/entitlement'import { Switch } from '@renderer/ui/Switch'@@ -567,16 +567,19 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {terminal from anywhere.</p><p>- Grab it from the App Store, then pair in seconds: Settings → Phone (or the+ Grab it from {mobileStoreNames()}, then pair in seconds: Settings → Phone (or thephone button top-right) shows a QR — scan it and you're in.</p><div className="onb-notify-actions">- <button- className="onb-btn onb-btn--primary"- onClick={() => window.nodeTerminal.shell.openExternal(IOS_APP_STORE_URL)}- >- Get the iOS app- </button>+ {mobileStoreLinks().map((store) => (+ <button+ key={store.id}+ className="onb-btn onb-btn--primary"+ onClick={() => window.nodeTerminal.shell.openExternal(store.url)}+ >+ {store.label}+ </button>+ ))}</div></>)}diff --git a/src/renderer/components/settings/sections/LicenseSection.tsx b/src/renderer/components/settings/sections/LicenseSection.tsxindex d45bcfbef..5ae5a2eaf 100644--- a/src/renderer/components/settings/sections/LicenseSection.tsx+++ b/src/renderer/components/settings/sections/LicenseSection.tsx@@ -7,6 +7,7 @@ import { ConfirmDialog } from '../../ConfirmDialog'import { ProCompare } from './ProCompare'import { Button } from '@renderer/ui/Button'import { machineNoun, otherMachines, thisMachine } from '@renderer/lib/machineName'+import { mobileStoreNames } from '@renderer/lib/links'import { isBrowserRuntime } from '@renderer/bridge/runtime'import type { SettingsSectionId } from '../nav'import { Input } from '@renderer/ui/Input'@@ -42,6 +43,8 @@ const ROWS = {'copy key','app store','iphone',+ 'google play',+ 'android','pairing']}@@ -53,7 +56,7 @@ const ENTRIES = Object.values(ROWS)function AppStorePairingHint(): React.JSX.Element {return (<p className="text-sm text-muted">- Already have Pro from the App Store? Pairing the phone with that subscription can unlock Pro+ Already have Pro from {mobileStoreNames()}? Pairing the phone with that subscription can unlock Proin the desktop app without a license key.{' '}{isBrowserRuntime()? 'In the desktop app, open Settings → Phone to pair. Server Edition does not support this activation route. 'diff --git a/src/renderer/components/settings/sections/PhoneSection.platform.test.tsx b/src/renderer/components/settings/sections/PhoneSection.platform.test.tsxnew file mode 100644index 000000000..855418b40--- /dev/null+++ b/src/renderer/components/settings/sections/PhoneSection.platform.test.tsx@@ -0,0 +1,60 @@+// @vitest-environment jsdom+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import type { PairedDevice } from '@shared/types'+import { IOS_APP_STORE_URL } from '@renderer/lib/links'+import { PhoneSection } from './PhoneSection'+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const ANDROID: PairedDevice = { id: 'dev-b', name: 'Android', pairedAt: 1_700_000_000_000, lastSeenAt: 0 }++let root: Root+let host: HTMLElement+let openExternal: ReturnType<typeof vi.fn>++beforeEach(() => {+ openExternal = vi.fn()+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {+ pairing: {+ start: vi.fn(),+ stop: vi.fn(async () => undefined),+ onDone: vi.fn(() => () => undefined),+ probeSsh: vi.fn(async () => true),+ openRemoteLoginSettings: vi.fn(),+ listDevices: vi.fn(async () => [ANDROID]),+ revokeDevice: vi.fn(),+ webhookStatus: vi.fn(async () => ({ ok: true, value: null })),+ webhookEndpoint: vi.fn(async () => 'https://api.test')+ },+ remoteHost: { setPhoneAccess: vi.fn() },+ shell: { openExternal }+ }+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})++afterEach(() => {+ act(() => root.unmount())+ host.remove()+ vi.restoreAllMocks()+})++describe('PhoneSection copy is platform-neutral', () => {+ it('speaks of the nodeterm mobile app, lists the phone by the name it sent, links only the App Store', async () => {+ act(() => root.render(<PhoneSection isActive />))+ await act(async () => undefined) // mount-time listDevices+ const text = host.textContent ?? ''+ expect(text).toContain('Pair the nodeterm mobile app')+ expect(text).not.toContain('nodeterm iOS app')+ expect(text).toContain('Android') // the device list shows the phone-sent name+ expect(text).not.toContain('Google Play')+ const store = [...host.querySelectorAll('button')].find(+ (b) => b.textContent?.trim() === 'Get it on the App Store'+ )+ expect(store).toBeTruthy()+ act(() => store!.click())+ expect(openExternal).toHaveBeenCalledWith(IOS_APP_STORE_URL)+ })+})diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsxindex 673dc6237..b71440b78 100644--- a/src/renderer/components/settings/sections/PhoneSection.tsx+++ b/src/renderer/components/settings/sections/PhoneSection.tsx@@ -7,7 +7,7 @@ import { Button } from '@renderer/ui/Button'import { Switch } from '@renderer/ui/Switch'import { useSettings } from '@renderer/state/settings'import { usePhonePairing } from '../usePhonePairing'-import { IOS_APP_STORE_URL } from '@renderer/lib/links'+import { mobileStoreLinks } from '@renderer/lib/links'import { hostOsFromNavigator, sshServerCopy } from '@shared/ssh-server'import {pairingEndedMessage,@@ -26,11 +26,11 @@ const ROWS = {},pair: {title: 'Pair phone',- keywords: ['phone', 'pair', 'qr', 'ios', 'mobile', 'ssh', 'scan', 'nodeterm']+ keywords: ['phone', 'pair', 'qr', 'ios', 'android', 'mobile', 'ssh', 'scan', 'nodeterm']},devices: {title: 'Paired devices',- keywords: ['phone', 'device', 'devices', 'paired', 'revoke', 'ios', 'iphone', 'remove']+ keywords: ['phone', 'device', 'devices', 'paired', 'revoke', 'ios', 'iphone', 'android', 'remove']},webhook: {title: 'Push webhook',@@ -180,7 +180,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele<SettingsSectionid="phone"title="Phone"- description="Pair the nodeterm iOS app so it can connect to this machine over your local network — no terminal commands needed."+ description="Pair the nodeterm mobile app so it can connect to this machine over your local network — no terminal commands needed."isActive={isActive}searchEntries={showWebhook ? ENTRIES : BROWSER_ENTRIES}>@@ -209,17 +209,22 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele<div className="space-y-4"><h4 className="text-[13px] font-medium text-text">Pair phone</h4><p className="text-sm text-muted">- Pair the nodeterm iOS app: scan this QR with your phone. Your phone generates its own+ Pair the nodeterm mobile app: scan this QR with your phone. Your phone generates its ownkey on-device — nothing secret leaves this machine except a single-use pairing token.</p><p className="text-sm text-muted">Don't have the app yet?{' '}- <button- className="cursor-pointer underline hover:text-text"- onClick={() => window.nodeTerminal.shell.openExternal(IOS_APP_STORE_URL)}- >- Get nodeterm for iOS on the App Store- </button>+ {mobileStoreLinks().map((store, i) => (+ <span key={store.id}>+ {i > 0 ? ' · ' : null}+ <button+ className="cursor-pointer underline hover:text-text"+ onClick={() => window.nodeTerminal.shell.openExternal(store.url)}+ >+ {store.label}+ </button>+ </span>+ ))}</p>{phase === 'idle' || phase === 'timeout' ? (diff --git a/src/renderer/lib/links.ts b/src/renderer/lib/links.tsindex 0e6aad76e..3642898c6 100644--- a/src/renderer/lib/links.ts+++ b/src/renderer/lib/links.ts@@ -1,5 +1,5 @@/** nodeterm mobile on the App Store (live since 1.0). Render it through `mobileStoreLinks()` —- * a guard test (added with the component migration) will refuse a direct import anywhere else. */+ * `mobileStore.guard.test.ts` refuses a direct import anywhere else. */export const IOS_APP_STORE_URL = 'https://apps.apple.com/app/nodeterm/id6790581233'/**diff --git a/src/renderer/lib/mobileStore.guard.test.ts b/src/renderer/lib/mobileStore.guard.test.tsnew file mode 100644index 000000000..0b7767cfc--- /dev/null+++ b/src/renderer/lib/mobileStore.guard.test.ts@@ -0,0 +1,85 @@+import { readdirSync, readFileSync, statSync } from 'fs'+import { join, relative } from 'path'+import { describe, expect, it } from 'vitest'++/**+ * The mobile companion is no longer iOS-only, and the Android store listing does not exist yet.+ *+ * 1. No renderer file but `lib/links.ts` may name a store URL or constant — every surface goes+ * through `mobileStoreLinks()` / `mobileStoreNames()`, so the ONE `ANDROID_APP_PUBLISHED` flag+ * decides whether a Play link exists anywhere. A component importing the URL directly is how a+ * dead link would ship.+ * 2. iOS-only phrasings must not come back on the pairing / phone / launch / notification surfaces.+ * (Genuinely iPhone-specific copy — the iPhone Camera QR fallback in PhoneSection — is not in the+ * banned list.) Comments are not scanned for (2); they carry history.+ */+const REPO_ROOT = join(__dirname, '..', '..', '..')+const RENDERER = join(REPO_ROOT, 'src', 'renderer')+const LINKS_FILE = 'src/renderer/lib/links.ts'++function norm(p: string): string {+ return p.replace(/\\/g, '/')+}++function sourceFiles(dir: string, out: string[] = []): string[] {+ for (const entry of readdirSync(dir)) {+ const full = join(dir, entry)+ if (statSync(full).isDirectory()) {+ sourceFiles(full, out)+ continue+ }+ if (!/\.tsx?$/.test(entry) || /\.test\.tsx?$/.test(entry)) continue+ out.push(full)+ }+ return out+}++const STORE_TOKENS = [+ 'IOS_APP_STORE_URL',+ 'ANDROID_PLAY_STORE_URL',+ 'apps.apple.com',+ 'play.google.com'+]++/** file (repo-relative) → phrases that must not appear outside comments. */+const BANNED_COPY: Record<string, string[]> = {+ 'src/renderer/components/PhonePairPopover.tsx': ['nodeterm iOS app'],+ 'src/renderer/components/settings/sections/PhoneSection.tsx': [+ 'nodeterm iOS app',+ 'nodeterm for iOS'+ ],+ 'src/renderer/components/MobileLaunchCard.tsx': ['Get the iOS app', 'on the App Store'],+ 'src/renderer/components/onboarding/OnboardingFlow.tsx': [+ 'Get the iOS app',+ 'Grab it from the App Store'+ ]+}++function stripComments(src: string): string {+ return src+ .replace(/\/\*[\s\S]*?\*\//g, '')+ .replace(/\{\/\*[\s\S]*?\*\/\}/g, '')+ .replace(/(^|[^:])\/\/.*$/gm, '$1')+}++describe('mobile store guard', () => {+ it('only lib/links.ts names a store URL or store constant', () => {+ const offenders: string[] = []+ for (const file of sourceFiles(RENDERER)) {+ const rel = norm(relative(REPO_ROOT, file))+ if (rel === LINKS_FILE) continue+ const src = readFileSync(file, 'utf8')+ for (const token of STORE_TOKENS) if (src.includes(token)) offenders.push(`${rel}: ${token}`)+ }+ expect(offenders).toEqual([])+ })++ it('pairing / phone / launch / notification copy is platform-neutral', () => {+ const offenders: string[] = []+ for (const [rel, phrases] of Object.entries(BANNED_COPY)) {+ const src = stripComments(readFileSync(join(REPO_ROOT, rel), 'utf8'))+ for (const phrase of phrases) if (src.includes(phrase)) offenders.push(`${rel}: ${phrase}`)+ }+ expect(offenders).toEqual([])+ })+})