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.

fix(announcements): the popup waits for every surface and keeps Escape

review20db2da9fb80
diff --git a/CLAUDE.md b/CLAUDE.md
index 72c5c3bb0..ed329e0e9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -10783,10 +10783,16 @@ Display → "popup (once)") — a separate key, so every build that reads only `
desktops, mobile) never receives one as a banner that would come back every launch.
`components/AnnouncementPopup.tsx` (pure rules in `lib/announcementPopup.ts`) shows the newest one
not shown before and records it in localStorage (`nodeterm.seenPopups`) the moment it is SHOWN, not
-when closed; it waits while another modal is on the dialog stack or a key was pressed in the last
-4 s, takes no focus, answers no Enter, and shows at most one per feed read. Its button opens `url`,
-or with `action: 'upgrade'` starts the Pro checkout — an upgrade popup is skipped for a Pro user and
-closes when Pro arrives. Server Edition: the bridge answers `[]` (it does not read the feed). Mobile:
+when closed, and shows at most one per feed read. It waits — re-reading the feed every 5 min, so a
+deactivated popup is dropped — until settings AND the license are known (`useEntitlement.known`:
+`isPremium` is a default `false` before that, and an upgrade popup must never reach a Pro user),
+nothing is open on the dialog stack OR among Canvas's own non-stack surfaces (`blocked`: setup
+tour, Settings, palette, dictation, …), and no key was pressed for 4 s. It then focuses its own box
+— never a button, so Enter/Space press nothing, and keys stop reaching the terminal under the scrim
+— and takes Escape in the CAPTURE phase: xterm stops propagation of Escape, so a bubble listener
+never hears it and the agent in the pane gets an ESC that interrupts its turn. Its button opens
+`url`, or with `action: 'upgrade'` starts the Pro checkout — an upgrade popup is skipped for a Pro
+user, dropped the moment the plan flips, and closes when Pro arrives. Server Edition: the bridge answers `[]` (it does not read the feed). Mobile:
N/A for v1 (follow-up in the iOS repo). The call no-ops under
`DO_NOT_TRACK`/`NODETERM_TELEMETRY_DISABLED` or in unpackaged builds (unless `NODETERM_API_BASE`
targets a local server). Schema example:
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index e9e645247..9d21d146e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -20736,7 +20736,25 @@ export function Canvas() {
)}
<UpgradeDialog />
- <AnnouncementPopup />
+ {/* The surfaces below are not on the dialog stack, so the popup is told about them here: it
+ must not land on the setup tour, Settings, the palette, a dictation in progress, …. The
+ kanban card modal registers on the stack itself; `cardModalOpen` is belt and braces. */}
+ <AnnouncementPopup
+ blocked={
+ onboardingOpen ||
+ mobileLaunchOpen ||
+ settingsOpen ||
+ paletteOpen ||
+ shortcutsOpen ||
+ scOpen ||
+ logPanelOpen ||
+ welcomeOpen ||
+ consentOpen ||
+ cloneDialogOpen ||
+ dictationOpen ||
+ cardModalOpen
+ }
+ />
{/* The free-tier limit moment (docs/project-limit.md). Close is the ordinary non-destructive close — never
`endSessions`: the limit only ever blocks a NEW open, it never ends anything. */}
<ProjectLimitDialog onCloseProject={(id) => performCloseProject(id)} />
diff --git a/src/renderer/components/AnnouncementPopup.test.tsx b/src/renderer/components/AnnouncementPopup.test.tsx
index ad14dd28f..3b9c81c4e 100644
--- a/src/renderer/components/AnnouncementPopup.test.tsx
+++ b/src/renderer/components/AnnouncementPopup.test.tsx
@@ -6,15 +6,19 @@ import type { PopupAnnouncement } from '@shared/types'
import { AnnouncementPopup } from './AnnouncementPopup'
import { popDialog, pushDialog, resetDialogStack } from './dialog-stack'
import { useEntitlement } from '../state/entitlement'
-import { KEY_QUIET_MS, loadSeenPopups } from '../lib/announcementPopup'
+import { useSettings } from '../state/settings'
+import { useUpgradeGate } from '../state/upgradeGate'
+import { KEY_QUIET_MS, PENDING_RECHECK_MS, loadSeenPopups } from '../lib/announcementPopup'
-// The real store subscribes to the license bridge when it is created; the popup reads the bit and
+// The real store subscribes to the license bridge when it is created; the popup reads the bits and
// calls the checkout.
vi.mock('../state/entitlement', async () => {
const { create } = await import('zustand')
- return { useEntitlement: create(() => ({ isPremium: false, upgrade: async () => {} })) }
+ return { useEntitlement: create(() => ({ isPremium: false, known: true, upgrade: async () => {} })) }
})
+const SIX_HOURS = 6 * 60 * 60 * 1000
+
const pop = (id: string, extra: Partial<PopupAnnouncement> = {}): PopupAnnouncement => ({
id,
title: `Title ${id}`,
@@ -33,10 +37,14 @@ function setFeed(...reads: PopupAnnouncement[][]): void {
;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = { announcements: { popups } }
}
-async function mount(): Promise<void> {
+async function mount(blocked = false): Promise<void> {
const el = document.createElement('div')
root = createRoot(el)
- await act(async () => root!.render(<AnnouncementPopup />))
+ await act(async () => root!.render(<AnnouncementPopup blocked={blocked} />))
+}
+
+async function rerender(blocked: boolean): Promise<void> {
+ await act(async () => root!.render(<AnnouncementPopup blocked={blocked} />))
}
async function unmount(): Promise<void> {
@@ -44,19 +52,22 @@ async function unmount(): Promise<void> {
root = null
}
-const dialog = () => document.body.querySelector('.announce-popup')
+const dialog = () => document.body.querySelector<HTMLElement>('.announce-popup')
const button = (label: string) =>
[...document.body.querySelectorAll('button')].find((b) => b.textContent === label) as HTMLButtonElement | undefined
beforeEach(() => {
vi.useFakeTimers()
resetDialogStack()
+ useSettings.setState({ hydrated: true })
})
afterEach(async () => {
await unmount()
vi.useRealTimers()
- useEntitlement.setState({ isPremium: false, upgrade: async () => {} })
+ useEntitlement.setState({ isPremium: false, known: true, upgrade: async () => {} })
+ useSettings.setState({ hydrated: false })
+ useUpgradeGate.setState({ open: false })
localStorage.clear()
vi.restoreAllMocks()
})
@@ -76,7 +87,6 @@ it('shows the newest popup once, and records it the moment it is shown', async (
})
it('closing one does not bring up the next until the next read of the feed', async () => {
- const SIX_HOURS = 6 * 60 * 60 * 1000
setFeed([pop('a'), pop('b')])
await mount()
expect(dialog()?.textContent).toContain('Title a')
@@ -93,7 +103,7 @@ it('closing one does not bring up the next until the next read of the feed', asy
expect(dialog()?.textContent).toContain('Title b')
})
-it('waits for another modal to close before taking the screen', async () => {
+it('waits for another modal on the dialog stack to close', async () => {
pushDialog('someone-else')
setFeed([pop('a')])
await mount()
@@ -106,16 +116,85 @@ it('waits for another modal to close before taking the screen', async () => {
expect(dialog()?.textContent).toContain('Title a')
})
-it('waits for the keyboard to go quiet', async () => {
- setFeed([])
+// The setup tour, Settings, the palette… are not on the stack; Canvas says so through `blocked`.
+it('waits while Canvas reports a surface of its own open', async () => {
+ setFeed([pop('a')])
+ await mount(true)
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(dialog()).toBeNull()
+ await rerender(false)
+ expect(dialog()?.textContent).toContain('Title a')
+})
+
+it('waits while the upgrade dialog is open', async () => {
+ useUpgradeGate.setState({ open: true })
+ setFeed([pop('a')])
+ await mount()
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(dialog()).toBeNull()
+ await act(async () => useUpgradeGate.setState({ open: false }))
+ expect(dialog()?.textContent).toContain('Title a')
+})
+
+// First launch decides the setup tour from settings; a popup that beat it would sit on the tour.
+it('waits for settings to load', async () => {
+ useSettings.setState({ hydrated: false })
+ setFeed([pop('a')])
+ await mount()
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(dialog()).toBeNull()
+ await act(async () => useSettings.setState({ hydrated: true }))
+ expect(dialog()?.textContent).toContain('Title a')
+})
+
+// `isPremium` is `false` until the license is read, so a pick before then would show an upgrade
+// popup to a Pro user — and record it.
+it('does not read the feed until the license is known', async () => {
+ useEntitlement.setState({ known: false })
+ setFeed([pop('upsell', { action: 'upgrade' })])
await mount()
- // The user is typing when the popup arrives (a plan change re-reads the feed).
- popups.mockResolvedValue([pop('a')])
- await act(async () => {
- window.dispatchEvent(new KeyboardEvent('keydown', { key: 'x' }))
- useEntitlement.setState({ isPremium: true })
- })
- await act(async () => useEntitlement.setState({ isPremium: false }))
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(popups).not.toHaveBeenCalled()
+ await act(async () => useEntitlement.setState({ known: true, isPremium: true }))
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(popups).toHaveBeenCalled()
+ expect(dialog()).toBeNull()
+ expect(loadSeenPopups().has('upsell')).toBe(false)
+})
+
+it('drops a waiting popup the moment the plan changes, before the re-read answers', async () => {
+ setFeed([pop('upsell', { action: 'upgrade' })])
+ let answer: (items: PopupAnnouncement[]) => void = () => {}
+ await mount(true)
+ // The purchase lands while it waits, and the re-read for Pro is slow (a plan change misses
+ // main's cache: a network read of up to 8 s). In that gap the old pick must already be gone.
+ popups.mockReturnValueOnce(new Promise<PopupAnnouncement[]>((r) => (answer = r)))
+ await act(async () => useEntitlement.setState({ isPremium: true }))
+ await rerender(false)
+ await act(async () => vi.advanceTimersByTime(10_000))
+ // Not even for a frame: shown, it would be recorded (and closed by the Pro rule) — gone for good.
+ expect(dialog()).toBeNull()
+ expect(loadSeenPopups().has('upsell')).toBe(false)
+ await act(async () => answer([pop('upsell', { action: 'upgrade' })]))
+ expect(dialog()).toBeNull()
+ expect(loadSeenPopups().has('upsell')).toBe(false)
+})
+
+it('drops a waiting popup the admin deactivated meanwhile', async () => {
+ setFeed([pop('a')], [])
+ await mount(true)
+ await act(async () => vi.advanceTimersByTime(PENDING_RECHECK_MS))
+ await rerender(false)
+ await act(async () => vi.advanceTimersByTime(10_000))
+ expect(dialog()).toBeNull()
+ expect(loadSeenPopups().has('a')).toBe(false)
+})
+
+it('waits for the keyboard to go quiet', async () => {
+ setFeed([pop('a')])
+ await mount(true)
+ await act(async () => window.dispatchEvent(new KeyboardEvent('keydown', { key: 'x' })))
+ await rerender(false)
expect(dialog()).toBeNull()
await act(async () => vi.advanceTimersByTime(KEY_QUIET_MS - 1000))
expect(dialog()).toBeNull()
@@ -123,22 +202,37 @@ it('waits for the keyboard to go quiet', async () => {
expect(dialog()?.textContent).toContain('Title a')
})
-it('closes on Escape and takes no focus from the user', async () => {
+it('takes focus into itself, not onto a button, and gives it back on close', async () => {
const input = document.createElement('input')
document.body.appendChild(input)
input.focus()
- setFeed([pop('a')])
+ setFeed([pop('a', { url: 'https://x.dev' })])
await mount()
+ expect(document.activeElement).toBe(dialog())
+ // Enter presses nothing.
+ await act(async () => dialog()!.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })))
expect(dialog()).not.toBeNull()
- expect(document.activeElement).toBe(input)
- // Enter answers nothing.
- await act(async () => window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' })))
- expect(dialog()).not.toBeNull()
- await act(async () => window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })))
+ await act(async () => dialog()!.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })))
expect(dialog()).toBeNull()
+ expect(document.activeElement).toBe(input)
input.remove()
})
+// xterm stops propagation of the keys it handles, Escape included: a bubble-phase listener never
+// hears it, and the agent in the pane gets an ESC that interrupts its turn.
+it('takes Escape before a terminal that still has focus can', async () => {
+ const term = document.createElement('textarea')
+ const seen = vi.fn((e: KeyboardEvent) => e.stopPropagation())
+ term.addEventListener('keydown', seen)
+ document.body.appendChild(term)
+ setFeed([pop('a')])
+ await mount()
+ await act(async () => term.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true })))
+ expect(dialog()).toBeNull()
+ expect(seen).not.toHaveBeenCalled()
+ term.remove()
+})
+
it('opens its link and closes', async () => {
const open = vi.spyOn(window, 'open').mockReturnValue(null)
setFeed([pop('a', { url: 'https://nodeterm.dev/news', ctaLabel: 'Read it' })])
diff --git a/src/renderer/components/AnnouncementPopup.tsx b/src/renderer/components/AnnouncementPopup.tsx
index df03bf784..baeac7eb8 100644
--- a/src/renderer/components/AnnouncementPopup.tsx
+++ b/src/renderer/components/AnnouncementPopup.tsx
@@ -2,7 +2,16 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import type { PopupAnnouncement } from '@shared/types'
import { useEntitlement } from '../state/entitlement'
-import { loadSeenPopups, markPopupSeen, pickPopup, popupCta, popupMayShow } from '../lib/announcementPopup'
+import { useSettings } from '../state/settings'
+import { useUpgradeGate } from '../state/upgradeGate'
+import {
+ PENDING_RECHECK_MS,
+ loadSeenPopups,
+ markPopupSeen,
+ pickPopup,
+ popupCta,
+ popupMayShow
+} from '../lib/announcementPopup'
import { confirmKeyAction } from './confirm-key'
import { openDialogCount, useDialogStack } from './dialog-stack'
@@ -15,35 +24,56 @@ const RETRY_MS = 1000
*
* At most one per feed read: closing a popup does not bring up the next one — that waits for the
* next read (launch, the six-hour tick, a plan change). And it waits its turn on screen: never over
- * another modal, never while the user is typing (`popupMayShow`).
+ * another modal, never while the user is typing (`popupMayShow`), never before settings and the
+ * license are known (the first-run tour is decided from settings, and an upgrade popup must not
+ * reach a Pro user on the default `isPremium: false`).
+ *
+ * `blocked`: Canvas's own surfaces that are not on the dialog stack (the setup tour, Settings, the
+ * command palette, the shortcuts panel, …). The upgrade gate is read here.
*/
-export function AnnouncementPopup(): React.JSX.Element | null {
+export function AnnouncementPopup({ blocked }: { blocked: boolean }): React.JSX.Element | null {
const isPremium = useEntitlement((s) => s.isPremium)
+ const licenseKnown = useEntitlement((s) => s.known)
+ const settingsKnown = useSettings((s) => s.hydrated)
+ const upgradeOpen = useUpgradeGate((s) => s.open)
const [pending, setPending] = useState<PopupAnnouncement | null>(null)
const [shown, setShown] = useState<PopupAnnouncement | null>(null)
const lastKeyAt = useRef(0)
+ // Only the latest read may set `pending`: a slow read for the plan this install just left must
+ // not land after the one for the plan it is on now.
+ const readSeq = useRef(0)
+ const premiumRef = useRef(isPremium)
+ premiumRef.current = isPremium
- // Main asks the feed with the current plan, so a plan change re-asks — a "try Pro" popup aimed at
- // free users must not come up for someone who has just paid.
- useEffect(() => {
- let cancelled = false
- const check = async (): Promise<void> => {
- let items: PopupAnnouncement[]
- try {
- items = await window.nodeTerminal.announcements.popups()
- } catch {
- return
- }
- if (cancelled) return
- setPending(pickPopup(items, loadSeenPopups(), isPremium))
- }
- void check()
- const timer = setInterval(() => void check(), SIX_HOURS)
- return () => {
- cancelled = true
- clearInterval(timer)
+ const read = useCallback(async (): Promise<void> => {
+ const seq = ++readSeq.current
+ let items: PopupAnnouncement[]
+ try {
+ items = await window.nodeTerminal.announcements.popups()
+ } catch {
+ return
}
- }, [isPremium])
+ if (seq !== readSeq.current) return
+ setPending(pickPopup(items, loadSeenPopups(), premiumRef.current))
+ }, [])
+
+ // Main asks the feed with the current plan, so a plan change re-asks — and drops what is waiting
+ // first: a "try Pro" popup picked for a free user must not come up for someone who has just paid.
+ useEffect(() => {
+ if (!licenseKnown) return
+ setPending(null)
+ void read()
+ const timer = setInterval(() => void read(), SIX_HOURS)
+ return () => clearInterval(timer)
+ }, [isPremium, licenseKnown, read])
+
+ // Unmounted: no read still in flight may set state.
+ useEffect(
+ () => () => {
+ readSeq.current += 1
+ },
+ []
+ )
// Capture phase, and nothing else: only WHEN the user last typed matters, never what.
useEffect(() => {
@@ -54,19 +84,26 @@ export function AnnouncementPopup(): React.JSX.Element | null {
return () => window.removeEventListener('keydown', onKey, true)
}, [])
+ const held = blocked || upgradeOpen || !settingsKnown
useEffect(() => {
if (!pending || shown) return
const tryShow = (): boolean => {
- if (!popupMayShow(Date.now(), lastKeyAt.current, openDialogCount())) return false
+ if (!popupMayShow(Date.now(), lastKeyAt.current, openDialogCount(), held)) return false
markPopupSeen(pending.id)
setShown(pending)
setPending(null)
return true
}
if (tryShow()) return
- const timer = setInterval(tryShow, RETRY_MS)
- return () => clearInterval(timer)
- }, [pending, shown])
+ const retry = setInterval(tryShow, RETRY_MS)
+ // A popup can wait a long time (a modal left open, a busy keyboard); ask again now and then,
+ // so one the admin deactivated meanwhile is dropped rather than shown.
+ const recheck = setInterval(() => void read(), PENDING_RECHECK_MS)
+ return () => {
+ clearInterval(retry)
+ clearInterval(recheck)
+ }
+ }, [pending, shown, held, read])
const close = useCallback(() => {
setShown(null)
@@ -87,8 +124,20 @@ function PopupDialog({ popup, onClose }: { popup: PopupAnnouncement; onClose():
const boxRef = useRef<HTMLDivElement>(null)
const shownAtRef = useRef(Date.now())
- // Escape closes. Enter answers nothing, and no button takes focus: the app raised this, so the
- // keyboard stays wherever the user left it (components/confirm-key).
+ // Focus moves to the box itself — no button, so neither Enter nor Space can press anything — and
+ // goes back where it was on close. Left in a terminal, every key would go into the pane hidden
+ // under the scrim.
+ useEffect(() => {
+ const before = document.activeElement
+ boxRef.current?.focus()
+ return () => {
+ if (before instanceof HTMLElement && before.isConnected) before.focus()
+ }
+ }, [])
+
+ // Escape closes, and is taken in the capture phase: a terminal that still had focus would
+ // otherwise consume it (xterm stops propagation) and hand the agent in it an ESC — interrupting
+ // its turn — while the popup stayed up. Enter answers nothing.
useEffect(() => {
const onKey = (e: KeyboardEvent): void => {
const action = confirmKeyAction({
@@ -101,10 +150,11 @@ function PopupDialog({ popup, onClose }: { popup: PopupAnnouncement; onClose():
})
if (action !== 'cancel') return
e.preventDefault()
+ e.stopPropagation()
onClose()
}
- window.addEventListener('keydown', onKey)
- return () => window.removeEventListener('keydown', onKey)
+ window.addEventListener('keydown', onKey, true)
+ return () => window.removeEventListener('keydown', onKey, true)
}, [isTop, onClose])
const cta = popupCta(popup)
@@ -124,6 +174,7 @@ function PopupDialog({ popup, onClose }: { popup: PopupAnnouncement; onClose():
role="dialog"
aria-modal="true"
aria-labelledby={titleId}
+ tabIndex={-1}
onClick={(e) => e.stopPropagation()}
>
<h2 className="announce-popup__title" id={titleId}>
diff --git a/src/renderer/lib/announcementPopup.test.ts b/src/renderer/lib/announcementPopup.test.ts
index ac252065b..f87b5c006 100644
--- a/src/renderer/lib/announcementPopup.test.ts
+++ b/src/renderer/lib/announcementPopup.test.ts
@@ -34,10 +34,11 @@ describe('pickPopup', () => {
describe('popupMayShow', () => {
it('waits for a quiet keyboard and for no other modal', () => {
- expect(popupMayShow(10_000, 0, 0)).toBe(true)
- expect(popupMayShow(10_000, 10_000 - KEY_QUIET_MS, 0)).toBe(true)
- expect(popupMayShow(10_000, 10_000 - KEY_QUIET_MS + 1, 0)).toBe(false)
- expect(popupMayShow(10_000, 0, 1)).toBe(false)
+ expect(popupMayShow(10_000, 0, 0, false)).toBe(true)
+ expect(popupMayShow(10_000, 10_000 - KEY_QUIET_MS, 0, false)).toBe(true)
+ expect(popupMayShow(10_000, 10_000 - KEY_QUIET_MS + 1, 0, false)).toBe(false)
+ expect(popupMayShow(10_000, 0, 1, false)).toBe(false)
+ expect(popupMayShow(10_000, 0, 0, true)).toBe(false)
})
})
diff --git a/src/renderer/lib/announcementPopup.ts b/src/renderer/lib/announcementPopup.ts
index cedaee6e7..9983e9f0a 100644
--- a/src/renderer/lib/announcementPopup.ts
+++ b/src/renderer/lib/announcementPopup.ts
@@ -12,6 +12,10 @@ export const SEEN_POPUPS_KEY = 'nodeterm.seenPopups'
/** No keystroke for this long before a popup may take the screen (see `popupMayShow`). */
export const KEY_QUIET_MS = 4000
+/** While a popup waits its turn, the feed is read again this often, so one the admin has
+ * deactivated in the meantime is dropped instead of shown hours later. */
+export const PENDING_RECHECK_MS = 5 * 60 * 1000
+
export function loadSeenPopups(): Set<string> {
try {
const raw = localStorage.getItem(SEEN_POPUPS_KEY)
@@ -47,11 +51,13 @@ export function pickPopup(
/**
* May a popup take the screen now? Not over another modal (it would bury the question the user is
- * answering), and not under typing hands: a modal that appears mid-keystroke catches the next
- * Enter or Space, and the user never reads what they just dismissed.
+ * answering) — one on the dialog stack (`openDialogs`) or one of the surfaces that are not
+ * (`blocked`: the setup tour, Settings, the command palette, …) — and not under typing hands: a
+ * modal that appears mid-keystroke catches the next keys, and the user never reads what they just
+ * dismissed.
*/
-export function popupMayShow(now: number, lastKeyAt: number, openDialogs: number): boolean {
- return openDialogs === 0 && now - lastKeyAt >= KEY_QUIET_MS
+export function popupMayShow(now: number, lastKeyAt: number, openDialogs: number, blocked: boolean): boolean {
+ return !blocked && openDialogs === 0 && now - lastKeyAt >= KEY_QUIET_MS
}
export type PopupCta = { kind: 'url'; label: string; url: string } | { kind: 'upgrade'; label: string }
diff --git a/src/renderer/state/entitlement.ts b/src/renderer/state/entitlement.ts
index 0a2c703b0..8e99d54d1 100644
--- a/src/renderer/state/entitlement.ts
+++ b/src/renderer/state/entitlement.ts
@@ -6,6 +6,10 @@ interface EntitlementState {
status: LicenseStatus
/** True when an active Pro entitlement is present — features gate on this. */
isPremium: boolean
+ /** True once a real license status has arrived (the first `hydrate()` or main's broadcast).
+ * Until then `isPremium` is only the default `false`, not an answer — wait on this before
+ * deciding something a Pro user must never see. */
+ known: boolean
/** Team seat cap (premium → max(3, N), premium-no-field → 3 = Pro's free seats, free/inactive
* → 0). Mirrors `status.seats` so the Team seats section can select it directly. */
seats: number
@@ -74,12 +78,13 @@ const EMPTY_DETAIL: LicenseDetail = {
export const useEntitlement = create<EntitlementState>((set, get) => {
const apply = (status: LicenseStatus) =>
- set({ status, isPremium: status.active, seats: status.seats })
+ set({ status, isPremium: status.active, seats: status.seats, known: true })
// Live updates from the main process (launch refresh, offline grace).
window.nodeTerminal.license.onChange(apply)
return {
status: EMPTY,
isPremium: false,
+ known: false,
seats: 0,
detail: null,
async hydrate() {
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 25f71036c..e3bbbacae 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -7183,6 +7183,11 @@ body,
border-top: 3px solid var(--accent);
}
+/* It takes focus itself (so keys stop reaching the terminal under the scrim); no ring for that. */
+.confirm.announce-popup:focus {
+ outline: none;
+}
+
.confirm.announce-popup--success {
border-top-color: var(--success);
}