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(license): never print the token TTL as the subscription end date (#800)

enesca9b4938a727
diff --git a/src/core/license.test.ts b/src/core/license.test.ts
index 1dece6df5..fff60bd89 100644
--- a/src/core/license.test.ts
+++ b/src/core/license.test.ts
@@ -376,6 +376,122 @@ describe('license seats entitlement', () => {
})
})
+describe('license subscription term (issue #800)', () => {
+ let fetchMock: ReturnType<typeof vi.fn>
+ let fake: import('./platform-fake').FakePlatform
+ const sent = (): LicenseStatus[] =>
+ fake.sent.filter((s) => s.channel === IPC.licenseChanged).map((s) => s.args[0] as LicenseStatus)
+ const status = (): Promise<LicenseStatus> =>
+ fake.handlers[IPC.licenseStatus]() as Promise<LicenseStatus>
+ const stored = (): { token?: string; termEndsAt?: number } =>
+ JSON.parse(readFileSync(path.join(h.userData, 'license.json'), 'utf-8'))
+
+ const WEEK_S = 7 * 24 * 60 * 60
+ /** A yearly App Store term: what the reporter bought, ~51 weeks past the token's own expiry. */
+ const yearly = (): number => Math.floor(Date.now() / 1000) + 365 * 24 * 60 * 60
+
+ beforeEach(async () => {
+ vi.useFakeTimers({ toFake: ['setInterval', 'Date'] })
+ h.userData = mkdtempSync(path.join(tmpdir(), 'nt-license-term-'))
+ writeFileSync(path.join(h.userData, 'device-id'), 'test-device')
+ delete process.env.DO_NOT_TRACK
+ delete process.env.NODETERM_TELEMETRY_DISABLED
+ process.env.NODETERM_API_BASE = 'http://127.0.0.1:1'
+ fetchMock = vi.fn()
+ vi.stubGlobal('fetch', fetchMock)
+ vi.resetModules()
+ const { initPlatform } = await import('./platform')
+ const { fakePlatform } = await import('./platform-fake')
+ fake = fakePlatform({ userDataDir: h.userData, isPackaged: false })
+ initPlatform(fake)
+ })
+
+ afterEach(async () => {
+ vi.unstubAllGlobals()
+ vi.useRealTimers()
+ const { resetPlatformForTests } = await import('./platform')
+ resetPlatformForTests()
+ rmSync(h.userData, { recursive: true, force: true })
+ })
+
+ it('a reply with no term states NONE — the token expiry is never promoted to one', async () => {
+ // Exactly what every server in the field answers today: token + its own 7-day expiresAt.
+ const token = mint(WEEK_S)
+ fetchMock.mockResolvedValue(
+ jsonResponse({ active: true, token, tier: 'pro', expiresAt: Math.floor(Date.now() / 1000) + WEEK_S })
+ )
+ const { initLicense } = await import('./license')
+ initLicense()
+ await refreshed()
+
+ expect(sent().at(-1)!.active).toBe(true)
+ expect(sent().at(-1)!.termEndsAt).toBeNull()
+ expect((await status()).termEndsAt).toBeNull()
+ })
+
+ it('carries the stated term beside the token, persists it, and keeps it through offline grace', async () => {
+ const term = yearly()
+ fetchMock.mockResolvedValue(jsonResponse({ active: true, token: mint(WEEK_S), termEndsAt: term }))
+ const { initLicense } = await import('./license')
+ initLicense()
+ await refreshed()
+
+ expect(sent().at(-1)!.termEndsAt).toBe(term)
+ expect(stored().termEndsAt).toBe(term)
+ // …and the token's expiry stays what it is: the grace window, not the term.
+ expect(sent().at(-1)!.expiresAt).toBeLessThan(term)
+
+ fetchMock.mockRejectedValue(new Error('offline'))
+ await vi.advanceTimersByTimeAsync(6 * HOUR)
+ await refreshed()
+ expect(sent().at(-1)!.active).toBe(true)
+ expect(sent().at(-1)!.termEndsAt).toBe(term)
+ })
+
+ it('a later reply without a term clears the old one — a term belongs to its token', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ active: true, token: mint(WEEK_S), termEndsAt: yearly() }))
+ const { initLicense } = await import('./license')
+ initLicense()
+ await refreshed()
+ expect(stored().termEndsAt).toBeTypeOf('number')
+
+ fetchMock.mockResolvedValue(jsonResponse({ active: true, token: mint(WEEK_S) }))
+ await vi.advanceTimersByTimeAsync(6 * HOUR)
+ await refreshed()
+ expect(sent().at(-1)!.termEndsAt).toBeNull()
+ expect(stored().termEndsAt).toBeUndefined()
+ })
+
+ it.each([
+ ['null (a lifetime entitlement)', null],
+ ['zero', 0],
+ ['negative', -5],
+ ['a string', '2027-09-13'],
+ ['NaN-ish', 'NaN']
+ ])('a term that is %s reads as no term, never as a date', async (_label, termEndsAt) => {
+ fetchMock.mockResolvedValue(jsonResponse({ active: true, token: mint(WEEK_S), termEndsAt }))
+ const { initLicense } = await import('./license')
+ initLicense()
+ await refreshed()
+ expect(sent().at(-1)!.active).toBe(true)
+ expect(sent().at(-1)!.termEndsAt).toBeNull()
+ expect((await status()).termEndsAt).toBeNull()
+ })
+
+ it('a device the server no longer entitles loses its term with its token', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ active: true, token: mint(WEEK_S), termEndsAt: yearly() }))
+ const { initLicense } = await import('./license')
+ initLicense()
+ await refreshed()
+
+ fetchMock.mockResolvedValue(jsonResponse({ active: false }))
+ await vi.advanceTimersByTimeAsync(6 * HOUR)
+ await refreshed()
+ expect(sent().at(-1)!.termEndsAt).toBeNull()
+ expect(stored().termEndsAt).toBeUndefined()
+ })
+})
+
describe('license detail + release', () => {
let fake: import('./platform-fake').FakePlatform
diff --git a/src/core/license.ts b/src/core/license.ts
index 8ace406e1..50dae440f 100644
--- a/src/core/license.ts
+++ b/src/core/license.ts
@@ -41,6 +41,10 @@ interface Stored {
token?: string
/** Largest unix-seconds timestamp this install has observed — the clock-rollback anchor. */
lastSeen?: number
+ /** The subscription term the server stated BESIDE `token` (unix seconds), for display only.
+ * It belongs to that token: written and replaced together with it (`withToken`), so a reply
+ * that states no term clears an old one instead of leaving it to describe a newer token. */
+ termEndsAt?: number
}
function file(): string {
@@ -125,11 +129,37 @@ function isCount(v: unknown): v is number {
return typeof v === 'number' && Number.isFinite(v)
}
-function statusFrom(token: string | undefined, error: string | null = null): LicenseStatus {
+/**
+ * The subscription term a server reply stated, or null. NOT the token's `exp`: that is a 7-day offline
+ * grace window re-minted every refresh, and printing it as "active until" told a yearly subscriber
+ * they were a week from losing Pro (issue #800). The term is its own field (`termEndsAt`), and null
+ * is a real answer — a lifetime entitlement, a license with no expiry, or a server that predates the
+ * field. Anything that is not a positive, finite number is null too: a 0 would render as 1970.
+ * Unsigned and display-only; nothing gates on it.
+ */
+function termFrom(v: unknown): number | null {
+ return typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : null
+}
+
+/** The stored state after a reply that minted `r.token`: the token and ITS term, replaced together. */
+function withToken(stored: Stored, r: { token?: string; termEndsAt?: unknown }): Stored {
+ return { ...stored, token: r.token, termEndsAt: termFrom(r.termEndsAt) ?? undefined }
+}
+
+function statusFrom(
+ token: string | undefined,
+ error: string | null = null,
+ termEndsAt: number | null = null
+): LicenseStatus {
const p = verify(token)
return p
- ? { tier: p.tier, active: true, expiresAt: p.exp, seats: seatsFrom(p), error: null }
- : { tier: null, active: false, expiresAt: null, seats: 0, error }
+ ? { tier: p.tier, active: true, expiresAt: p.exp, termEndsAt, seats: seatsFrom(p), error: null }
+ : { tier: null, active: false, expiresAt: null, termEndsAt: null, seats: 0, error }
+}
+
+/** Status of what is on disk, the stored token's term included. */
+function statusOf(stored: Stored, error: string | null = null): LicenseStatus {
+ return statusFrom(stored.token, error, termFrom(stored.termEndsAt))
}
/**
@@ -152,7 +182,14 @@ export function licensedSeats(): number {
*/
const REQUEST_TIMEOUT_MS = 8000
-async function call(path: string, body: unknown): Promise<{ token?: string; error?: string }> {
+/** What a minting route answers. `termEndsAt` is optional on the wire: older servers never send it. */
+interface MintReply {
+ token?: string
+ error?: string
+ termEndsAt?: unknown
+}
+
+async function call(path: string, body: unknown): Promise<MintReply> {
if (!allowed()) return { error: 'disabled' }
const ctrl = new AbortController()
const t = setTimeout(() => ctrl.abort(), REQUEST_TIMEOUT_MS)
@@ -164,7 +201,7 @@ async function call(path: string, body: unknown): Promise<{ token?: string; erro
signal: ctrl.signal
})
if (res.status === 204) return {}
- const json = (await res.json().catch(() => ({}))) as { token?: string; error?: string }
+ const json = (await res.json().catch(() => ({}))) as MintReply
if (!res.ok) return { error: json.error ?? 'network' }
return json
} catch {
@@ -175,13 +212,13 @@ async function call(path: string, body: unknown): Promise<{ token?: string; erro
}
// GET helper for the device-bound status poll.
-async function getJson(path: string): Promise<{ active?: boolean; token?: string; error?: string }> {
+async function getJson(path: string): Promise<MintReply & { active?: boolean }> {
if (!allowed()) return { error: 'disabled' }
const ctrl = new AbortController()
const t = setTimeout(() => ctrl.abort(), REQUEST_TIMEOUT_MS)
try {
const res = await fetch(`${API_BASE}${path}`, { signal: ctrl.signal })
- const json = (await res.json().catch(() => ({}))) as { active?: boolean; token?: string; error?: string }
+ const json = (await res.json().catch(() => ({}))) as MintReply & { active?: boolean }
if (!res.ok) return { error: json.error ?? 'network' }
return json
} catch {
@@ -239,7 +276,7 @@ export function initLicense(onChange?: () => void): void {
onChange?.()
}
- platform().handle(IPC.licenseStatus, () => statusFrom(load().token))
+ platform().handle(IPC.licenseStatus, () => statusOf(load()))
// Both routes are authorized by the stored entitlement token. Sending a deviceId instead would
// hand a key — which works on ANY machine — to whoever learned an id that rides query strings,
@@ -327,8 +364,9 @@ export function initLicense(onChange?: () => void): void {
}
const r = await getJson(`/v1/license/status?deviceId=${encodeURIComponent(deviceId)}`)
if (r.active && r.token) {
- await save({ ...load(), token: r.token })
- broadcast(statusFrom(r.token))
+ const next = withToken(load(), r)
+ await save(next)
+ broadcast(statusOf(next))
polling = false
return
}
@@ -336,13 +374,19 @@ export function initLicense(onChange?: () => void): void {
}
setTimeout(() => void poll(), 4000)
}
- return statusFrom(load().token)
+ return statusOf(load())
})
platform().handle(IPC.licenseActivate, async (key: string) => {
const r = await call('/v1/license/activate', { key: String(key).trim(), deviceId })
- if (r.token) await save({ ...load(), key: String(key).trim(), token: r.token })
- const status = statusFrom(r.token, r.error ?? null)
+ let status: LicenseStatus
+ if (r.token) {
+ const next = { ...withToken(load(), r), key: String(key).trim() }
+ await save(next)
+ status = statusOf(next, r.error ?? null)
+ } else {
+ status = statusFrom(undefined, r.error ?? null)
+ }
broadcast(status)
return status
})
@@ -371,25 +415,27 @@ export function initLicense(onChange?: () => void): void {
// Key-paste flow: refresh against the stored key.
const r = await call('/v1/license/refresh', { key: stored.key, deviceId })
if (r.token) {
- await save({ ...stored, token: r.token })
- broadcast(statusFrom(r.token))
+ const next = withToken(stored, r)
+ await save(next)
+ broadcast(statusOf(next))
} else {
- broadcast(statusFrom(stored.token, r.error ?? null)) // offline grace
+ broadcast(statusOf(stored, r.error ?? null)) // offline grace
}
} else {
// Device-bound flow (no key): re-poll status by deviceId. Covers a purchase that completed
// after the in-app Upgrade poll window, and every later relaunch.
const r = await getJson(`/v1/license/status?deviceId=${encodeURIComponent(deviceId)}`)
if (r.active && r.token) {
- await save({ ...stored, token: r.token })
- broadcast(statusFrom(r.token))
+ const next = withToken(stored, r)
+ await save(next)
+ broadcast(statusOf(next))
} else if (r.error === 'offline' || r.error === 'network' || r.error === 'disabled') {
// Couldn't reach the server → offline grace: keep the last valid token.
- if (stored.token) broadcast(statusFrom(stored.token))
+ if (stored.token) broadcast(statusOf(stored))
} else {
// Server responded: this device is no longer entitled (canceled / suspended / expired)
// → drop Pro and clear the cached token, even though it hasn't expired yet.
- if (stored.token) await save({ ...stored, token: undefined })
+ if (stored.token) await save({ ...stored, token: undefined, termEndsAt: undefined })
broadcast(statusFrom(undefined))
}
}
diff --git a/src/renderer/components/settings/sections/LicenseSection.test.tsx b/src/renderer/components/settings/sections/LicenseSection.test.tsx
index 6760fff9b..1d9944ef0 100644
--- a/src/renderer/components/settings/sections/LicenseSection.test.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.test.tsx
@@ -12,8 +12,22 @@ import type { LicenseDetail, LicenseStatus } from '@shared/types'
;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
-const PRO: LicenseStatus = { tier: 'pro', active: true, expiresAt: null, seats: 3, error: null }
-const FREE: LicenseStatus = { tier: null, active: false, expiresAt: null, seats: 0, error: null }
+const PRO: LicenseStatus = {
+ tier: 'pro',
+ active: true,
+ expiresAt: null,
+ termEndsAt: null,
+ seats: 3,
+ error: null
+}
+const FREE: LicenseStatus = {
+ tier: null,
+ active: false,
+ expiresAt: null,
+ termEndsAt: null,
+ seats: 0,
+ error: null
+}
/** A healthy keygen read with room to spare. */
const KEYGEN: LicenseDetail = { key: 'NT-KEY-1', used: 2, seats: 3, source: 'keygen', error: null }
@@ -100,6 +114,45 @@ afterEach(() => {
// See testMachineNoun.ts: the rendered copy names the machine, so the host OS is pinned.
pinNeutralMachineNoun()
+describe('LicenseSection — the Pro line prints the subscription term, never the token TTL (#800)', () => {
+ const WEEK_S = 7 * 24 * 60 * 60
+ const APPLE: LicenseDetail = { key: null, used: 0, seats: 0, source: 'apple', error: null }
+ /** The paragraph that carries the Pro status, read on its own so another line's date cannot pass for it. */
+ const proLine = (): string =>
+ [...document.body.querySelectorAll('p')].map((p) => p.textContent ?? '').find((t) => t.startsWith('Pro —')) ??
+ ''
+
+ it('a 7-day token expiry with no stated term shows NO date', async () => {
+ // The reported screen: an App Store yearly subscriber, a token minted with the server's 7-day TTL.
+ const tokenExp = Math.floor(Date.now() / 1000) + WEEK_S
+ await mount({ ...PRO, expiresAt: tokenExp, termEndsAt: null }, APPLE)
+ expect(proLine()).toBe('Pro — active.')
+ expect(screenText()).not.toContain(new Date(tokenExp * 1000).toLocaleDateString())
+ expect(screenText()).not.toMatch(/active until/)
+ })
+
+ it('a null term renders no date — never the epoch', async () => {
+ await mount({ ...PRO, expiresAt: null, termEndsAt: null }, APPLE)
+ expect(proLine()).toBe('Pro — active.')
+ expect(screenText()).not.toContain(new Date(0).toLocaleDateString())
+ expect(screenText()).not.toMatch(/1970|1969/)
+ })
+
+ it('renders the term when the server states one, and not the token date beside it', async () => {
+ const tokenExp = Math.floor(Date.now() / 1000) + WEEK_S
+ const term = Math.floor(Date.now() / 1000) + 363 * 24 * 60 * 60
+ await mount({ ...PRO, expiresAt: tokenExp, termEndsAt: term }, APPLE)
+ expect(proLine()).toBe(`Pro — active. Current term runs through ${new Date(term * 1000).toLocaleDateString()}.`)
+ expect(screenText()).not.toContain(new Date(tokenExp * 1000).toLocaleDateString())
+ })
+
+ it('tells an App Store subscriber where the renewal is managed', async () => {
+ await mount(PRO, APPLE)
+ expect(screenText()).toMatch(/managed by Apple, not by nodeterm/)
+ expect(screenText()).toMatch(/open the App Store on that phone/)
+ })
+})
+
describe('LicenseSection — a release that did not land', () => {
it('reports the RELEASE, and keeps saying the truth about the license', async () => {
await mount(PRO)
diff --git a/src/renderer/components/settings/sections/LicenseSection.tsx b/src/renderer/components/settings/sections/LicenseSection.tsx
index 0ce24bbe1..05ad268be 100644
--- a/src/renderer/components/settings/sections/LicenseSection.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.tsx
@@ -10,6 +10,7 @@ import { machineNoun, otherMachines, thisMachine } from '@renderer/lib/machineNa
import { Input } from '@renderer/ui/Input'
import {
licenseSentence,
+ proStatusLine,
canReleaseDevices,
canUseKeyElsewhere,
releaseFailureSentence,
@@ -115,13 +116,7 @@ export function LicenseSection({ isActive }: { isActive: boolean }): React.JSX.E
{ent.isPremium ? (
<div className="space-y-3">
<ProCompare />
- <p className="text-sm text-muted">
- Pro — active
- {ent.status.expiresAt
- ? ` until ${new Date(ent.status.expiresAt * 1000).toLocaleDateString()}`
- : ''}
- .
- </p>
+ <p className="text-sm text-muted">{proStatusLine(ent.status)}</p>
{detail ? (
<>
{/* No key ⇒ no field. A row reading "not available" beside a sentence saying there
diff --git a/src/renderer/lib/licenseCopy.test.ts b/src/renderer/lib/licenseCopy.test.ts
index f63a4d73d..74e31a55b 100644
--- a/src/renderer/lib/licenseCopy.test.ts
+++ b/src/renderer/lib/licenseCopy.test.ts
@@ -1,7 +1,8 @@
import { describe, it, expect } from 'vitest'
import { pinNeutralMachineNoun } from './testMachineNoun'
-import type { LicenseDetail } from '@shared/types'
+import type { LicenseDetail, LicenseStatus } from '@shared/types'
import {
+ proStatusLine,
licenseSentence,
canReleaseDevices,
canUseKeyElsewhere,
@@ -68,7 +69,7 @@ describe('licenseSentence — sources that have no key and no device count', ()
it('says an App Store subscription bridged Pro here, and prints no counts', () => {
const s = licenseSentence({ key: null, used: 0, seats: 0, source: 'apple', error: null })
expect(s).toBe(
- 'Pro on this computer comes from the App Store subscription on your paired phone, so there is no license key or device count to show here.'
+ 'Pro on this computer comes from the App Store subscription on your paired phone, so there is no license key or device count to show here. That subscription is managed by Apple, not by nodeterm: to see when it renews or to cancel it, open the App Store on that phone and go to Subscriptions in your account.'
)
// The zeros are "not applicable", not a measurement. Rendering them here is the exact
// misdirection this branch exists to prevent.
@@ -367,3 +368,40 @@ describe('activationErrorSentence', () => {
expect(s).not.toContain('gremlins')
})
})
+
+describe('proStatusLine — the date is the subscription term or nothing (issue #800)', () => {
+ const NOW = Date.UTC(2026, 8, 15, 12) // the day the reporter opened the page
+ const WEEK_S = 7 * 24 * 60 * 60
+ const pro = (over: Partial<LicenseStatus>): LicenseStatus => ({
+ tier: 'pro',
+ active: true,
+ expiresAt: Math.floor(NOW / 1000) + WEEK_S,
+ termEndsAt: null,
+ seats: 3,
+ error: null,
+ ...over
+ })
+
+ it('prints no date from the token TTL', () => {
+ // The reported screen: a 7-day token beside no stated term used to read "active until 9/22/2026".
+ expect(proStatusLine(pro({}), NOW)).toBe('Pro — active.')
+ })
+
+ it('prints the term when the server stated one', () => {
+ const term = Date.UTC(2027, 8, 13) / 1000
+ expect(proStatusLine(pro({ termEndsAt: term }), NOW)).toBe(
+ `Pro — active. Current term runs through ${new Date(term * 1000).toLocaleDateString()}.`
+ )
+ })
+
+ it.each([
+ ['null', null],
+ ['zero', 0],
+ ['NaN', Number.NaN],
+ ['in the past', Math.floor(NOW / 1000) - 60]
+ ])('a term that is %s prints no date — never an epoch', (_label, termEndsAt) => {
+ const line = proStatusLine(pro({ termEndsAt }), NOW)
+ expect(line).toBe('Pro — active.')
+ expect(line).not.toContain(new Date(0).toLocaleDateString())
+ })
+})
diff --git a/src/renderer/lib/licenseCopy.ts b/src/renderer/lib/licenseCopy.ts
index 4d411eaea..c28f4e064 100644
--- a/src/renderer/lib/licenseCopy.ts
+++ b/src/renderer/lib/licenseCopy.ts
@@ -1,4 +1,4 @@
-import type { LicenseDetail } from '@shared/types'
+import type { LicenseDetail, LicenseStatus } from '@shared/types'
import { machineNoun, thisMachine, thisMachineCap } from './machineName'
/**
@@ -76,7 +76,9 @@ export function licenseSentence(detail: LicenseDetail | null): string {
if (detail.source === 'apple') {
// No keygen call was made for this license, so `used`/`seats` are zeros meaning "not
// applicable". Printing them would read as a cap that is somehow both empty and full.
- return `Pro on ${thisMachine()} comes from the App Store subscription on your paired phone, so there is no license key or device count to show here.`
+ // Say where the term actually lives. We can neither renew, extend nor cancel an App Store
+ // subscription, and a user who wants to know when it renews has only one place to look.
+ return `Pro on ${thisMachine()} comes from the App Store subscription on your paired phone, so there is no license key or device count to show here. That subscription is managed by Apple, not by nodeterm: to see when it renews or to cancel it, open the App Store on that phone and go to Subscriptions in your account.`
}
if (detail.source === 'free') {
// A defensive value. Say only what is certain — where it came from is not.
@@ -103,6 +105,27 @@ export function licenseSentence(detail: LicenseDetail | null): string {
return ''
}
+/**
+ * The one-line Pro status at the top of Settings → License.
+ *
+ * It prints a date ONLY from `termEndsAt` — the subscription term the server stated — and never from
+ * `expiresAt`. That field is the entitlement token's expiry: a 7-day offline grace window re-minted
+ * every 6 h. Rendered as "active until", it told a customer on a yearly App Store subscription that
+ * Pro ended a week later (issue #800). No other date may stand in for a missing term: not the token's,
+ * not one computed from the tier, not the grace window under another label.
+ *
+ * No term ⇒ no date. That covers null (a lifetime entitlement, a license without an expiry, a server
+ * that predates the field) and a term already in the past (a stored term from before an offline
+ * stretch; the renewal it missed is real, the date it would print is not).
+ */
+export function proStatusLine(status: LicenseStatus, now: number = Date.now()): string {
+ const term = status.termEndsAt
+ if (typeof term !== 'number' || !Number.isFinite(term) || term <= 0 || term * 1000 <= now) {
+ return 'Pro — active.'
+ }
+ return `Pro — active. Current term runs through ${new Date(term * 1000).toLocaleDateString()}.`
+}
+
/**
* Whether to offer "Release other devices".
*
diff --git a/src/renderer/state/entitlement.ts b/src/renderer/state/entitlement.ts
index 767737f69..0a2c703b0 100644
--- a/src/renderer/state/entitlement.ts
+++ b/src/renderer/state/entitlement.ts
@@ -55,7 +55,14 @@ interface EntitlementState {
releaseOthers(): Promise<string | null>
}
-const EMPTY: LicenseStatus = { tier: null, active: false, expiresAt: null, seats: 0, error: null }
+const EMPTY: LicenseStatus = {
+ tier: null,
+ active: false,
+ expiresAt: null,
+ termEndsAt: null,
+ seats: 0,
+ error: null
+}
const EMPTY_DETAIL: LicenseDetail = {
key: null,
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 9f4f84ef7..018a81fcd 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -2998,8 +2998,14 @@ export interface LicenseStatus {
/** 'pro' when entitled, else null. */
tier: string | null
active: boolean
- /** Unix seconds when the entitlement expires, or null. */
+ /** Unix seconds when the entitlement TOKEN expires, or null — the offline grace window (the server
+ * mints 7-day tokens and the app re-mints every 6 h, so this rolls forward forever). It is NOT
+ * when the subscription ends and must never be shown as that; see `termEndsAt` (issue #800). */
expiresAt: number | null
+ /** Unix seconds when the current subscription term ends, as the server stated it beside the token,
+ * or null. Null is a first-class answer — a lifetime entitlement, a license with no expiry, or a
+ * server that does not send the field yet — and renders as no date at all. Display only. */
+ termEndsAt: number | null
/** Seat cap for the relay host (Team Access): premium → the token's seats (absent → 1), free/inactive → 0. */
seats: number
/** Last activation/refresh error reason code, or null. */