Skip to content

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.

feat(pro): copy follows the project limit; list live links and dictation

review5b423507f101
diff --git a/src/renderer/components/UpgradeDialog.test.tsx b/src/renderer/components/UpgradeDialog.test.tsx
new file mode 100644
index 000000000..cf7849dcc
--- /dev/null
+++ b/src/renderer/components/UpgradeDialog.test.tsx
@@ -0,0 +1,86 @@
+// @vitest-environment jsdom
+//
+// The Pro upgrade prompt. Only live links open it today, yet its body never mentioned them, and it
+// still promised "unlimited remote access from your phone" months after the relay quota was removed
+// (spec §8). The body is pinned verbatim, and it names unlimited open projects only while the
+// free-tier limit is on (spec §2: no "unlimited" claim the limit would contradict — and, inactive,
+// no claim about a limit that does not exist).
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
+import { pinNeutralMachineNoun } from '@renderer/lib/testMachineNoun'
+import { INACTIVE_PROJECT_LIMIT, type ProjectLimitState } from '@shared/project-limit'
+
+// The project-limit store subscribes to `window.nodeTerminal.projectLimit.onChange` when it is
+// created, so the bridge must exist before any import runs.
+vi.hoisted(() => {
+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {
+ projectLimit: { state: vi.fn(), claim: vi.fn(), onChange: () => () => {} }
+ }
+})
+// The real entitlement store pulls in the license bridge; the dialog only reads `isPremium` and
+// calls `upgrade`.
+vi.mock('../state/entitlement', async () => {
+ const { create } = await import('zustand')
+ return { useEntitlement: create(() => ({ isPremium: false, upgrade: async () => {} })) }
+})
+
+import { UpgradeDialog } from './UpgradeDialog'
+import { useUpgradeGate } from '../state/upgradeGate'
+import { useProjectLimit } from '../state/projectLimit'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+pinNeutralMachineNoun()
+
+const ACTIVE: ProjectLimitState = { active: true, pro: false, free: 5, allowance: null, dnt: false }
+
+const INACTIVE_BODY =
+ 'Pro adds live links to a terminal (watch, chat, or let people type), 3 team seats to share this computer, the larger on-device dictation models, and nodeterm mobile Pro. Complete your purchase in the browser — Pro unlocks here automatically.'
+const ACTIVE_BODY =
+ 'Pro adds unlimited open projects, live links to a terminal (watch, chat, or let people type), 3 team seats to share this computer, the larger on-device dictation models, and nodeterm mobile Pro. Complete your purchase in the browser — Pro unlocks here automatically.'
+
+let root: Root
+let host: HTMLElement
+
+beforeEach(() => {
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+})
+
+afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ useUpgradeGate.setState({ open: false, feature: '' })
+ useProjectLimit.setState({ state: INACTIVE_PROJECT_LIMIT })
+})
+
+/** Open the dialog for a live link (the one feature that opens it) and return its two lines. */
+function render(state: ProjectLimitState): string[] {
+ useProjectLimit.setState({ state })
+ useUpgradeGate.setState({ open: true, feature: 'Live links' })
+ act(() => root.render(<UpgradeDialog />))
+ // The dialog portals into document.body, not into `host`.
+ return [...document.body.querySelectorAll('.confirm__msg')].map((p) => p.textContent ?? '')
+}
+
+describe('UpgradeDialog', () => {
+ it('names the gated feature', () => {
+ expect(render(INACTIVE_PROJECT_LIMIT)[0]).toBe('Live links is a Pro feature')
+ })
+
+ it('limit inactive: lists live links and dictation, and says nothing about projects', () => {
+ const [, body] = render(INACTIVE_PROJECT_LIMIT)
+ expect(body).toBe(INACTIVE_BODY)
+ expect(body).toContain('live links')
+ expect(body).not.toContain('unlimited open projects')
+ expect(body).not.toContain('remote access')
+ })
+
+ it('limit active: leads with unlimited open projects, then the same list', () => {
+ const [, body] = render(ACTIVE)
+ expect(body).toBe(ACTIVE_BODY)
+ expect(body).toContain('live links')
+ })
+})
diff --git a/src/renderer/components/UpgradeDialog.tsx b/src/renderer/components/UpgradeDialog.tsx
index c0df264e9..f3c90c459 100644
--- a/src/renderer/components/UpgradeDialog.tsx
+++ b/src/renderer/components/UpgradeDialog.tsx
@@ -2,6 +2,7 @@ import { createPortal } from 'react-dom'
import { useEntitlement } from '../state/entitlement'
import { useUpgradeGate } from '../state/upgradeGate'
import { thisMachine } from '../lib/machineName'
+import { useProjectLimit } from '../state/projectLimit'
/**
* Pro upgrade prompt shown when a free user triggers a gated feature. Closes automatically
@@ -11,15 +12,19 @@ export function UpgradeDialog() {
const { open, feature, hide } = useUpgradeGate()
const isPremium = useEntitlement((s) => s.isPremium)
const upgrade = useEntitlement((s) => s.upgrade)
+ // While the free-tier project limit is on, unlimited open projects is part of what Pro adds
+ // (spec §8); while it is off there is no limit to lift, so the sentence does not mention one.
+ const limitActive = useProjectLimit((s) => s.state.active)
if (!open || isPremium) return null
return createPortal(
<div className="confirm-overlay" onClick={hide}>
<div className="confirm" onClick={(e) => e.stopPropagation()}>
<p className="confirm__msg">{feature} is a Pro feature</p>
<p className="confirm__msg">
- Pro unlocks unlimited remote access from your phone (free plan: 5 connections/month),
- 3 team seats to share {thisMachine()}, and nodeterm mobile Pro. Complete your purchase
- in the browser — Pro unlocks here automatically.
+ Pro adds {limitActive ? 'unlimited open projects, ' : ''}live links to a terminal (watch,
+ chat, or let people type), 3 team seats to share {thisMachine()}, the larger on-device
+ dictation models, and nodeterm mobile Pro. Complete your purchase in the browser — Pro
+ unlocks here automatically.
</p>
<div className="confirm__actions">
<button className="confirm__btn" onClick={hide}>
diff --git a/src/renderer/components/settings/sections/LicenseSection.test.tsx b/src/renderer/components/settings/sections/LicenseSection.test.tsx
index 7d617e52a..d76292043 100644
--- a/src/renderer/components/settings/sections/LicenseSection.test.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.test.tsx
@@ -74,7 +74,10 @@ async function mount(
upgrade: vi.fn(async () => status)
},
clipboard: { writeText },
- shell: { openExternal }
+ shell: { openExternal },
+ // ProCompare reads the open-project limit store, which subscribes at import time too. Its
+ // initial state is the inactive one, so the comparison renders the pre-limit copy here.
+ projectLimit: { state: vi.fn(), claim: vi.fn(), onChange: vi.fn(() => () => undefined) }
}
const { useEntitlement } = await import('../../../state/entitlement')
const { LicenseSection } = await import('./LicenseSection')
diff --git a/src/renderer/components/settings/sections/ProCompare.test.tsx b/src/renderer/components/settings/sections/ProCompare.test.tsx
index d5ec40057..08d83d572 100644
--- a/src/renderer/components/settings/sections/ProCompare.test.tsx
+++ b/src/renderer/components/settings/sections/ProCompare.test.tsx
@@ -1,7 +1,31 @@
-import { describe, expect, it } from 'vitest'
-import { renderToStaticMarkup } from 'react-dom/server'
-import { ProCompare } from './ProCompare'
+// @vitest-environment jsdom
+//
+// The Core vs Pro comparison follows the free-tier open-project limit (spec §8, and the §2
+// anti-goal: the app must not say "unlimited / free forever" while the limit is on). Inactive — the
+// Server Edition's permanent answer, and every install until the flip — it is byte-identical to the
+// copy that shipped before the limit existed. Rendered through a real root, not
+// `renderToStaticMarkup`: a zustand hook reads the store's INITIAL state on the server render, so a
+// static render would never see the active state at all.
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
import { AGENT_CONFIG, BUILTIN_AGENT_IDS } from '@shared/agents/config'
+import { INACTIVE_PROJECT_LIMIT, type ProjectLimitState } from '@shared/project-limit'
+
+// The project-limit store subscribes to `window.nodeTerminal.projectLimit.onChange` when it is
+// created, so the bridge must exist before any import runs.
+vi.hoisted(() => {
+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {
+ projectLimit: { state: vi.fn(), claim: vi.fn(), onChange: () => () => {} }
+ }
+})
+
+import { ProCompare } from './ProCompare'
+import { useProjectLimit } from '../../../state/projectLimit'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+const ACTIVE: ProjectLimitState = { active: true, pro: false, free: 5, allowance: null, dnt: false }
const column = (html: string, heading: string): string[] => {
const at = html.indexOf(heading)
@@ -10,21 +34,89 @@ const column = (html: string, heading: string): string[] => {
return [...rest.slice(0, end).matchAll(/<p class="text-text">✓ ([^<]*)<\/p>/g)].map((m) => m[1].replace(/&amp;/g, '&'))
}
-describe('ProCompare', () => {
- const html = renderToStaticMarkup(<ProCompare />)
+const AGENT_NODES = `Agent nodes (${BUILTIN_AGENT_IDS.map((id) => AGENT_CONFIG[id].label).join(' / ')})`
+const LIVE_LINKS = 'Live links to a terminal: watch, chat, or let people type — viewers need nothing installed'
+const DICTATION = 'Larger on-device dictation models (base, small, large-v3-turbo)'
+
+let root: Root
+let host: HTMLElement
+beforeEach(() => {
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+})
+
+afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ useProjectLimit.setState({ state: INACTIVE_PROJECT_LIMIT })
+})
+
+function render(state: ProjectLimitState): string {
+ useProjectLimit.setState({ state })
+ act(() => root.render(<ProCompare />))
+ return host.innerHTML
+}
+
+describe('ProCompare — limit inactive', () => {
it('lists live links under Pro', () => {
- expect(column(html, 'Pro<')).toContain('Live links to a terminal: watch, chat, or let people type — viewers need nothing installed')
+ expect(column(render(INACTIVE_PROJECT_LIMIT), 'Pro<')).toContain(LIVE_LINKS)
})
it('leaves the free Core list exactly as it was', () => {
- expect(column(html, 'Core — free forever')).toEqual([
+ // Today's array, captured from the source before the limit touched it.
+ expect(column(render(INACTIVE_PROJECT_LIMIT), 'Core — free forever')).toEqual([
'Unlimited local terminals & canvas',
'Unlimited SSH projects',
'Groups, worktrees, git & diff',
- `Agent nodes (${BUILTIN_AGENT_IDS.map((id) => AGENT_CONFIG[id].label).join(' / ')})`,
+ AGENT_NODES,
'QR phone pairing on your LAN',
'Remote access from your phone (relay, E2E encrypted)'
])
})
+
+ it('lists the larger dictation models right after live links, and nothing about projects', () => {
+ expect(column(render(INACTIVE_PROJECT_LIMIT), 'Pro<')).toEqual([
+ 'Everything in Core',
+ 'nodeterm mobile Pro included',
+ '3 team seats included (extra seats $5/seat/mo)',
+ LIVE_LINKS,
+ DICTATION
+ ])
+ })
+})
+
+describe('ProCompare — limit active', () => {
+ it('shows the free allowance and drops "free forever" and the unqualified "unlimited"', () => {
+ const html = render(ACTIVE)
+ expect(html).not.toContain('free forever')
+ expect(html).not.toContain('Unlimited local terminals')
+ expect(html).not.toContain('Unlimited SSH projects')
+ expect(column(html, 'Core — free<')).toEqual([
+ 'Up to 5 open projects',
+ 'Unlimited terminals & canvas in each project',
+ 'SSH projects',
+ 'Groups, worktrees, git & diff',
+ AGENT_NODES,
+ 'QR phone pairing on your LAN',
+ 'Remote access from your phone (relay, E2E encrypted)'
+ ])
+ })
+
+ it("shows the user's own allowance when it is above FREE", () => {
+ const html = render({ ...ACTIVE, allowance: 30 })
+ expect(column(html, 'Core — free<')[0]).toBe('Up to 30 open projects')
+ })
+
+ it('leads the Pro list with unlimited open projects and still lists dictation', () => {
+ expect(column(render(ACTIVE), 'Pro<')).toEqual([
+ 'Everything in Core',
+ 'Unlimited open projects',
+ 'nodeterm mobile Pro included',
+ '3 team seats included (extra seats $5/seat/mo)',
+ LIVE_LINKS,
+ DICTATION
+ ])
+ })
})
diff --git a/src/renderer/components/settings/sections/ProCompare.tsx b/src/renderer/components/settings/sections/ProCompare.tsx
index 5eb94d7de..4b7cf5647 100644
--- a/src/renderer/components/settings/sections/ProCompare.tsx
+++ b/src/renderer/components/settings/sections/ProCompare.tsx
@@ -1,26 +1,44 @@
import { AGENT_CONFIG, BUILTIN_AGENT_IDS } from '@shared/agents/config'
+import { effectiveLimit } from '@shared/project-limit'
+import { useProjectLimit } from '../../../state/projectLimit'
-const CORE = [
- 'Unlimited local terminals & canvas',
- 'Unlimited SSH projects',
+const AGENT_NODES = `Agent nodes (${BUILTIN_AGENT_IDS.map((id) => AGENT_CONFIG[id].label).join(' / ')})`
+const CORE_REST = [
'Groups, worktrees, git & diff',
- `Agent nodes (${BUILTIN_AGENT_IDS.map((id) => AGENT_CONFIG[id].label).join(' / ')})`,
+ AGENT_NODES,
'QR phone pairing on your LAN',
'Remote access from your phone (relay, E2E encrypted)'
]
+/** The Core list while the free-tier project limit is off: exactly the copy that shipped before it
+ * existed (and the Server Edition's permanent list — its limit is never on). */
+const CORE = ['Unlimited local terminals & canvas', 'Unlimited SSH projects', ...CORE_REST]
const PRO = [
'nodeterm mobile Pro included',
'3 team seats included (extra seats $5/seat/mo)',
- 'Live links to a terminal: watch, chat, or let people type — viewers need nothing installed'
+ 'Live links to a terminal: watch, chat, or let people type — viewers need nothing installed',
+ 'Larger on-device dictation models (base, small, large-v3-turbo)'
]
-/** Core vs Pro comparison. */
+/** Core vs Pro comparison. While the open-project limit is on, Core must not read "free forever" or
+ * an unqualified "unlimited" (spec §2/§8): it names the user's allowance, and Pro gains unlimited
+ * open projects. */
export function ProCompare(): React.JSX.Element {
+ const limitState = useProjectLimit((s) => s.state)
+ const active = limitState.active
+ const core = active
+ ? [
+ `Up to ${effectiveLimit(limitState)} open projects`,
+ 'Unlimited terminals & canvas in each project',
+ 'SSH projects',
+ ...CORE_REST
+ ]
+ : CORE
+ const pro = active ? ['Unlimited open projects', ...PRO] : PRO
return (
<div className="grid grid-cols-2 gap-4 text-sm">
<div className="space-y-2">
- <h4 className="text-[13px] font-medium text-muted">Core — free forever</h4>
- {CORE.map((f) => (
+ <h4 className="text-[13px] font-medium text-muted">{active ? 'Core — free' : 'Core — free forever'}</h4>
+ {core.map((f) => (
<p key={f} className="text-text">
✓ {f}
</p>
@@ -31,7 +49,7 @@ export function ProCompare(): React.JSX.Element {
Pro
</h4>
<p className="text-text">✓ Everything in Core</p>
- {PRO.map((f) => (
+ {pro.map((f) => (
<p key={f} className="text-text">
✓ {f}
</p>