Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(cloud): live founding-wave seat count in the intro popup

purplea8d51b5b41e4
diff --git a/src/api/cloud/__tests__/launch.test.ts b/src/api/cloud/__tests__/launch.test.ts
new file mode 100644
index 00000000..cdd54b95
--- /dev/null
+++ b/src/api/cloud/__tests__/launch.test.ts
@@ -0,0 +1,72 @@
+import { describe, it, expect } from 'vitest'
+import { waveDays, launchCopy } from '../launch'
+
+// Anchored to the live sample moment (endpoint Date header 2026-07-14T09:31Z,
+// wave 2026-07-20T19:00Z) so the day math matches what the real popup shows.
+const NOW = Date.parse('2026-07-14T09:31:54Z')
+
+describe('waveDays', () => {
+ it('ceils whole days to the wave (spec: Math.ceil((t - now)/86400000))', () => {
+ expect(waveDays('2026-07-20T19:00:00Z', NOW)).toBe(7)
+ })
+ it('is null with no date', () => {
+ expect(waveDays(null, NOW)).toBeNull()
+ })
+ it('is null once the wave has already passed', () => {
+ expect(waveDays('2026-07-14T00:00:00Z', NOW)).toBeNull()
+ })
+ it('is null for an unparseable date', () => {
+ expect(waveDays('not-a-date', NOW)).toBeNull()
+ })
+})
+
+describe('launchCopy', () => {
+ it('normal state: remaining / cap / days', () => {
+ const c = launchCopy(
+ { cap: 50, taken: 2, remaining: 48, soldOut: false, nextWaveAt: '2026-07-20T19:00:00Z' },
+ NOW,
+ )
+ expect(c.title).toBe('LU Cloud is here')
+ expect(c.detail).toBe('48 of 50 founding spots left this week. Opens to everyone in 7 days.')
+ })
+
+ it('sold-out: no buy pitch, cap in the title', () => {
+ const c = launchCopy(
+ { cap: 50, taken: 50, remaining: 0, soldOut: true, nextWaveAt: '2026-07-20T19:00:00Z' },
+ NOW,
+ )
+ expect(c.title).toBe('Founding wave full (50 spots)')
+ expect(c.detail).toBe('Opens to everyone in 7 days.')
+ })
+
+ it('uncapped: omits the spots copy entirely (never "null spots")', () => {
+ const c = launchCopy(
+ { cap: null, taken: null, remaining: null, soldOut: false, nextWaveAt: '2026-07-20T19:00:00Z' },
+ NOW,
+ )
+ expect(c.title).toBe('LU Cloud is here')
+ expect(c.detail).toBe('Opens to everyone in 7 days.')
+ })
+
+ it('singular day', () => {
+ const c = launchCopy(
+ { cap: 50, taken: 2, remaining: 48, soldOut: false, nextWaveAt: '2026-07-15T00:00:00Z' },
+ NOW,
+ )
+ expect(c.detail).toBe('48 of 50 founding spots left this week. Opens to everyone in 1 day.')
+ })
+
+ it('no wave date: drops the "opens in" clause', () => {
+ const c = launchCopy(
+ { cap: 50, taken: 2, remaining: 48, soldOut: false, nextWaveAt: null },
+ NOW,
+ )
+ expect(c.detail).toBe('48 of 50 founding spots left this week.')
+ })
+
+ it('fetch failed (null) → numberless fallback, never a guess', () => {
+ const c = launchCopy(null, NOW)
+ expect(c.title).toBe('LU Cloud is here')
+ expect(c.detail).toBe('Limited founding spots available.')
+ })
+})
diff --git a/src/api/cloud/launch.ts b/src/api/cloud/launch.ts
new file mode 100644
index 00000000..6eb3ea60
--- /dev/null
+++ b/src/api/cloud/launch.ts
@@ -0,0 +1,66 @@
+// GET /api/launch/seats — the public, unauthenticated founding-wave seat count
+// behind the one-time "LU Cloud is here" popup. The server sends `no-store`, so
+// we read it LIVE on every popup open and deliberately never cache it: a
+// dismissed-then-reshown popup (or a later build) always reflects the real
+// remaining seats, never a stale or guessed number. Same origin as the rest of
+// the cloud API, so the desktop CSP connect-src + CORS already cover it.
+
+import { CLOUD_BASE } from './config'
+
+export interface LaunchSeats {
+ /** Founding-wave seat cap. null once the wave is uncapped/open to all. */
+ cap: number | null
+ taken: number | null
+ /** Seats left. null when uncapped — then the spots copy is omitted entirely. */
+ remaining: number | null
+ soldOut: boolean
+ /** ISO timestamp the wave opens to everyone, or null. */
+ nextWaveAt: string | null
+}
+
+/** Live fetch, no cache (the server sets `no-store`). Throws on any non-2xx or
+ * network error so the caller falls back to numberless copy — never a guess. */
+export async function getLaunchSeats(signal?: AbortSignal): Promise<LaunchSeats> {
+ const res = await fetch(`${CLOUD_BASE}/api/launch/seats`, { cache: 'no-store', signal })
+ if (!res.ok) throw new Error(`launch/seats ${res.status}`)
+ return (await res.json()) as LaunchSeats
+}
+
+/** Whole days until the wave opens, ceil'd (spec: Math.ceil((t - now)/86400000)).
+ * null when there's no date or it has already passed, so the caller drops the
+ * "opens in …" clause instead of showing "0 days" or a negative count. */
+export function waveDays(nextWaveAt: string | null, now: number): number | null {
+ if (!nextWaveAt) return null
+ const t = Date.parse(nextWaveAt)
+ if (Number.isNaN(t)) return null
+ const days = Math.ceil((t - now) / 86_400_000)
+ return days > 0 ? days : null
+}
+
+export interface LaunchCopy {
+ title: string
+ detail: string
+}
+
+/** Popup copy for a seat state. `null` seats = the fetch failed → a numberless
+ * fallback ("Limited founding spots available."), never a guessed or cached
+ * number. Pure and exported so the state matrix is unit-tested. */
+export function launchCopy(seats: LaunchSeats | null, now: number): LaunchCopy {
+ if (!seats) {
+ return { title: 'LU Cloud is here', detail: 'Limited founding spots available.' }
+ }
+ const days = waveDays(seats.nextWaveAt, now)
+ const opens = days !== null ? `Opens to everyone in ${days} ${days === 1 ? 'day' : 'days'}.` : ''
+
+ if (seats.soldOut) {
+ // Sold-out: no purchase pitch, just the notice + when it opens to all.
+ const cap = seats.cap != null ? ` (${seats.cap} spots)` : ''
+ return { title: `Founding wave full${cap}`, detail: opens }
+ }
+ if (seats.cap != null && seats.remaining != null) {
+ const spots = `${seats.remaining} of ${seats.cap} founding spots left this week.`
+ return { title: 'LU Cloud is here', detail: opens ? `${spots} ${opens}` : spots }
+ }
+ // Uncapped → omit the spots copy entirely (never "null spots").
+ return { title: 'LU Cloud is here', detail: opens }
+}
diff --git a/src/components/cloud/CloudGateModal.tsx b/src/components/cloud/CloudGateModal.tsx
index 0469cec5..20051afc 100644
--- a/src/components/cloud/CloudGateModal.tsx
+++ b/src/components/cloud/CloudGateModal.tsx
@@ -9,7 +9,7 @@
// deriveCloudAvailable passes, the mode flips (via the one-time onboarding on
// the first flip). Payment stays on lu-labs.ai — the app never touches Stripe.
-import { useEffect, useRef, useState } from 'react'
+import { useEffect, useState } from 'react'
import { ExternalLink, HardDrive, RefreshCw, ArrowLeft, ArrowRight } from 'lucide-react'
import { Modal } from '../ui/Modal'
import { useUIStore } from '../../stores/uiStore'
@@ -21,12 +21,14 @@ import { CLOUD_BASE } from '../../api/cloud/config'
import { openExternal } from '../../api/backend'
const PLANS = [
- { anchor: 'hosted', name: 'Hosted' },
- { anchor: 'pro', name: 'Pro' },
- { anchor: 'max', name: 'Max' },
+ { anchor: 'hosted', name: 'Hosted', price: '€19' },
+ { anchor: 'pro', name: 'Pro', price: '€49' },
+ { anchor: 'max', name: 'Max', price: '€99' },
] as const
-/** Three plan buttons → pricing in the browser. */
+/** Three plan buttons → pricing in the browser. Price shown up front (monthly,
+ * EUR — mirrors lib/pricing on lu-labs.ai); the click still leaves for the
+ * browser to actually subscribe. */
function PlanGrid() {
return (
<div className="grid grid-cols-3 gap-2">
@@ -37,8 +39,8 @@ function PlanGrid() {
className="flex flex-col items-center gap-0.5 px-2 py-3 rounded-lg border border-[#7c3aed]/40 bg-[#7c3aed]/5 hover:bg-[#7c3aed]/15 transition-colors"
>
<span className="text-[0.8rem] font-semibold text-[#7c3aed] dark:text-[#a78bfa]">{p.name}</span>
- <span className="flex items-center gap-1 text-[0.55rem] text-gray-500">
- <ExternalLink size={8} /> lu-labs.ai
+ <span className="text-[0.62rem] font-medium text-gray-500 dark:text-gray-400">
+ {p.price}<span className="text-gray-400 dark:text-gray-500">/mo</span>
</span>
</button>
))}
@@ -101,18 +103,23 @@ export function CloudGateModal() {
const [step, setStep] = useState<Step>('intro')
useEffect(() => { if (open) setStep('intro') }, [open])
- // The moment the account clears every gate (fresh login, re-check after
- // subscribing), flip the global switch and get out of the way — via the
- // one-time cloud onboarding when this is the first successful flip.
- const wasOpen = useRef(false)
- useEffect(() => { wasOpen.current = open }, [open])
+ // The moment the account clears every gate — already provisioned when the
+ // gate opens, a fresh login, or a re-check after subscribing — flip the
+ // global switch and get out of the way, via the one-time cloud onboarding on
+ // the first successful flip. `open` MUST be a dependency (not the old wasOpen
+ // ref): the one-time intro popup's "Check out the Cloud" can open this gate
+ // for a signed-in, fully provisioned user who's still in local mode. In that
+ // case `available` was already true before the gate opened, so an effect
+ // keyed only on `available` never re-runs — and the gate hangs forever on the
+ // terminal "Checking your account…" state. Keying on `open` fires the flip
+ // the instant the gate opens on an already-available account.
useEffect(() => {
- if (wasOpen.current && available) {
+ if (open && available) {
setOpen(false)
if (!cloudOnboardingSeen) setCloudOnboardingOpen(true)
else updateSettings({ appMode: 'cloud' })
}
- }, [available, cloudOnboardingSeen, setCloudOnboardingOpen, setOpen, updateSettings])
+ }, [open, available, cloudOnboardingSeen, setCloudOnboardingOpen, setOpen, updateSettings])
const stayLocal = () => {
updateSettings({ appMode: 'local' })
diff --git a/src/components/cloud/CloudIntroPopup.tsx b/src/components/cloud/CloudIntroPopup.tsx
index 455d72ae..80ae488e 100644
--- a/src/components/cloud/CloudIntroPopup.tsx
+++ b/src/components/cloud/CloudIntroPopup.tsx
@@ -1,15 +1,20 @@
// One-time "LU Cloud is here" hello (David 2026-07-13, shipped with 2.5.7).
// Every install sees this exactly once on its first launch after onboarding,
-// auto-updaters and fresh installs alike, then never again: any way of
-// closing it writes the localStorage flag, and that flag rides the
-// store-backup list so even an NSIS localStorage wipe can't resurrect it.
-// Deliberately tiny and angular: the monogram, one line, two buttons. "Check
-// out the Cloud" opens the same CloudGateModal the header switch uses.
+// auto-updaters and fresh installs alike, then never again: any way of closing
+// it writes the localStorage flag, and that flag rides the store-backup list so
+// even an NSIS localStorage wipe can't resurrect it.
+//
+// It reads the founding-wave seat count LIVE from /api/launch/seats each time it
+// opens (the server sends no-store) — never a cached or guessed number. Copy
+// splits the spec's line into a bold title + gray detail (same words, no
+// em-dash). "Check out the Cloud" opens the normal in-app gate (Get LU Cloud /
+// Stay on Local); payment leaves for the browser from the plan buttons there.
import { useEffect, useState } from 'react'
import { Modal } from '../ui/Modal'
import { useUIStore } from '../../stores/uiStore'
import { useSettingsStore } from '../../stores/settingsStore'
+import { getLaunchSeats, launchCopy, type LaunchSeats } from '../../api/cloud/launch'
export const CLOUD_INTRO_KEY = 'lu_cloud_intro_seen'
@@ -19,10 +24,16 @@ export function shouldShowCloudIntro(alreadySeen: boolean, appMode: string): boo
return !alreadySeen && appMode !== 'cloud'
}
+type SeatState =
+ | { phase: 'loading' }
+ | { phase: 'ready'; seats: LaunchSeats }
+ | { phase: 'error' }
+
export function CloudIntroPopup() {
const appMode = useSettingsStore((s) => s.settings.appMode)
const setCloudGateOpen = useUIStore((s) => s.setCloudGateOpen)
const [open, setOpen] = useState(false)
+ const [seatState, setSeatState] = useState<SeatState>({ phase: 'loading' })
useEffect(() => {
let seen = false
@@ -44,18 +55,42 @@ export function CloudIntroPopup() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
+ // Live seat count, fetched fresh the moment the popup opens — no caching, per
+ // the endpoint's no-store. A failure falls back to numberless copy; an abort
+ // (popup closed mid-flight) is swallowed.
+ useEffect(() => {
+ if (!open) return
+ const ac = new AbortController()
+ setSeatState({ phase: 'loading' })
+ getLaunchSeats(ac.signal)
+ .then((seats) => setSeatState({ phase: 'ready', seats }))
+ .catch(() => { if (!ac.signal.aborted) setSeatState({ phase: 'error' }) })
+ return () => ac.abort()
+ }, [open])
+
const close = () => {
try { localStorage.setItem(CLOUD_INTRO_KEY, '1') } catch { /* ignore */ }
setOpen(false)
}
const checkOut = () => {
+ // Open the normal in-app onboarding gate (Get LU Cloud / Stay on Local),
+ // not the website directly — payment leaves for the browser from there.
close()
setCloudGateOpen(true)
}
+ // Loading shows the headline alone (no flash of wrong numbers); ready uses the
+ // live seats; error uses the numberless fallback.
+ const copy =
+ seatState.phase === 'ready'
+ ? launchCopy(seatState.seats, Date.now())
+ : seatState.phase === 'error'
+ ? launchCopy(null, Date.now())
+ : { title: 'LU Cloud is here', detail: '' }
+
return (
- <Modal open={open} onClose={close} hideHeader maxWidth="max-w-[260px]" panelRadius="rounded-lg" panelPad="p-5">
+ <Modal open={open} onClose={close} hideHeader maxWidth="max-w-[280px]" panelRadius="rounded-lg" panelPad="p-5">
<div className="flex flex-col items-center text-center gap-3">
<img
src="/LU-monogram-bw.png"
@@ -66,9 +101,14 @@ export function CloudIntroPopup() {
draggable={false}
/>
<div className="text-[0.8rem] font-semibold tracking-tight text-gray-900 dark:text-gray-100">
- LU Cloud is live.
+ {copy.title}
</div>
- <div className="w-full flex flex-col gap-1.5">
+ {copy.detail && (
+ <div className="text-[0.68rem] leading-relaxed text-gray-600 dark:text-gray-400">
+ {copy.detail}
+ </div>
+ )}
+ <div className="w-full flex flex-col gap-1.5 pt-1">
<button
onClick={checkOut}
className="w-full px-3 py-2 rounded-md text-[0.7rem] font-medium text-white bg-[#7c3aed] hover:bg-[#6d31d6] transition-colors"