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): example video popup between teaser sheet and plans gate

purple2013daf92411
diff --git a/.gitignore b/.gitignore
index 76ddbae3..b643878d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,3 +73,7 @@ SETUP_REPORT.md
/playwright-report/
/blob-report/
/playwright/.cache/
+
+# Teaser raw takes + render scratch (scripts/teasers) - only the encoded
+# webm/poster assets in public/teasers ship
+/assets-src/
diff --git a/package.json b/package.json
index ca6d2091..6dc91b13 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,9 @@
"tauri": "tauri",
"tauri:dev": "tauri dev",
"tauri:build": "tauri build",
- "test:e2e": "playwright test"
+ "test:e2e": "playwright test",
+ "teasers:record": "node scripts/teasers/record.mjs",
+ "teasers:build": "node scripts/teasers/build-all.mjs"
},
"dependencies": {
"@react-three/drei": "^10.7.7",
diff --git a/scripts/teasers/build-all.mjs b/scripts/teasers/build-all.mjs
new file mode 100644
index 00000000..aa8277ab
--- /dev/null
+++ b/scripts/teasers/build-all.mjs
@@ -0,0 +1,22 @@
+// Regenerate every teaser clip that has a manifest. Serial on purpose: the
+// two-pass encoder and the frame-step capture are CPU-bound anyway.
+// Usage: node scripts/teasers/build-all.mjs [--fn=music]
+import fs from 'node:fs'
+import path from 'node:path'
+import { spawnSync } from 'node:child_process'
+import { fileURLToPath } from 'node:url'
+
+const HERE = path.dirname(fileURLToPath(import.meta.url))
+const only = process.argv.find((a) => a.startsWith('--fn='))?.split('=')[1]
+const manifests = fs.readdirSync(path.join(HERE, 'manifests'))
+ .filter((f) => f.endsWith('.json'))
+ .map((f) => f.replace(/\.json$/, ''))
+ .filter((fn) => !only || fn === only)
+
+let failed = 0
+for (const fn of manifests) {
+ console.log(`\n=== ${fn} ===`)
+ const r = spawnSync(process.execPath, [path.join(HERE, 'render.mjs'), `--fn=${fn}`], { stdio: 'inherit' })
+ if (r.status !== 0) { failed += 1; console.error(`FAILED: ${fn}`) }
+}
+process.exit(failed ? 1 : 0)
diff --git a/scripts/teasers/record.mjs b/scripts/teasers/record.mjs
new file mode 100644
index 00000000..dba91dd0
--- /dev/null
+++ b/scripts/teasers/record.mjs
@@ -0,0 +1,99 @@
+// Teaser take recorder: attaches to the running desktop exe over CDP
+// (WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222),
+// captures a JPEG frame stream via Page.startScreencast and drives the
+// requested Create flow. Output contract per take (consumed by render.mjs):
+// assets-src/teasers-raw/<fn>/take-NN/
+// f_000001.jpg ... repaint-driven frames
+// frames.json { frames:[{i,t}], markers:[{name,t}], viewport }
+// input.* / result.* the media that went in / came out
+//
+// Usage: node scripts/teasers/record.mjs --fn=music [--take=01] [--no-drive]
+// Flow drivers live in flows.mjs; --no-drive just records until Ctrl+C.
+
+import fs from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { createRequire } from 'node:module'
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..')
+const require = createRequire(path.join(ROOT, 'package.json'))
+const { chromium } = require('@playwright/test')
+
+const arg = (name, fallback) => {
+ const hit = process.argv.find((a) => a.startsWith(`--${name}=`))
+ return hit ? hit.split('=')[1] : fallback
+}
+const FN = arg('fn')
+if (!FN) { console.error('need --fn=<intent>'); process.exit(1) }
+const TAKE = arg('take', '01')
+const DRIVE = !process.argv.includes('--no-drive')
+
+const takeDir = path.join(ROOT, 'assets-src', 'teasers-raw', FN, `take-${TAKE}`)
+fs.mkdirSync(takeDir, { recursive: true })
+
+const browser = await chromium.connectOverCDP('http://127.0.0.1:9222')
+const ctx = browser.contexts()[0]
+const page = ctx.pages().find((p) => p.url().includes('tauri.localhost'))
+if (!page) { console.error('app page not found on :9222'); process.exit(1) }
+const cdp = await ctx.newCDPSession(page)
+
+// The Tauri window is transparent:true; force an opaque app-canvas background
+// so JPEG frames never composite garbage into the rounded corners.
+await cdp.send('Emulation.setDefaultBackgroundColorOverride', {
+ color: { r: 32, g: 32, b: 32, a: 255 },
+})
+
+const meta = {
+ frames: [],
+ markers: [],
+ viewport: await page.evaluate(() => ({
+ w: window.innerWidth, h: window.innerHeight, dpr: window.devicePixelRatio,
+ })),
+}
+let i = 0
+cdp.on('Page.screencastFrame', ({ data, metadata, sessionId }) => {
+ i += 1
+ fs.writeFileSync(path.join(takeDir, `f_${String(i).padStart(6, '0')}.jpg`), Buffer.from(data, 'base64'))
+ meta.frames.push({ i, t: metadata.timestamp })
+ cdp.send('Page.screencastFrameAck', { sessionId }).catch(() => {})
+})
+await cdp.send('Page.startScreencast', {
+ format: 'jpeg', quality: 85, maxWidth: 2560, maxHeight: 1600, everyNthFrame: 1,
+})
+const mark = (name) => {
+ meta.markers.push({ name, t: Date.now() / 1000 })
+ console.log(`[mark] ${name}`)
+}
+
+const finalize = async () => {
+ try { await cdp.send('Page.stopScreencast') } catch { /* already gone */ }
+ fs.writeFileSync(path.join(takeDir, 'frames.json'), JSON.stringify(meta))
+ console.log(`take done: ${meta.frames.length} frames -> ${takeDir}`)
+ await browser.close()
+ process.exit(0)
+}
+process.on('SIGINT', finalize)
+
+if (DRIVE) {
+ const { FLOWS } = await import('./flows.mjs')
+ const flow = FLOWS[FN]
+ if (!flow) { console.error(`no flow driver for ${FN} (flows.mjs)`); await finalize() }
+ try {
+ const out = await flow({ page, mark, takeDir })
+ if (out?.resultUrl) {
+ const res = await fetch(out.resultUrl)
+ const buf = Buffer.from(await res.arrayBuffer())
+ const ext = out.resultExt ?? path.extname(new URL(out.resultUrl).pathname) ?? '.bin'
+ fs.writeFileSync(path.join(takeDir, `result${ext.startsWith('.') ? ext : `.${ext}`}`), buf)
+ console.log(`result saved (${buf.length} bytes)`)
+ }
+ if (out?.inputCopy) {
+ fs.copyFileSync(out.inputCopy, path.join(takeDir, `input${path.extname(out.inputCopy)}`))
+ }
+ } catch (err) {
+ console.error('flow failed:', err)
+ }
+ await finalize()
+} else {
+ console.log('recording... Ctrl+C to stop')
+}
diff --git a/scripts/teasers/render.mjs b/scripts/teasers/render.mjs
new file mode 100644
index 00000000..5cc7506b
--- /dev/null
+++ b/scripts/teasers/render.mjs
@@ -0,0 +1,220 @@
+// Teaser renderer: takes a recorded take (frames.json + JPEGs + result media),
+// composes the 12s motion template deterministically (frame-stepped __SEEK in
+// a Playwright-launched chromium, viewport 640x360 @2x = 1280x720 masters)
+// and encodes the final VP9/Opus webm + webp poster into public/teasers/.
+//
+// Usage: node scripts/teasers/render.mjs --fn=music
+// Manifest: scripts/teasers/manifests/<fn>.json
+
+import fs from 'node:fs'
+import path from 'node:path'
+import { spawnSync } from 'node:child_process'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+import { createRequire } from 'node:module'
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..')
+const require = createRequire(path.join(ROOT, 'package.json'))
+const { chromium } = require('@playwright/test')
+
+const FFMPEG = process.env.FFMPEG ?? 'C:\\ffmpeg\\bin\\ffmpeg.exe'
+const FPS = 30
+const FRAMES = 360 // 12.0s
+const S1 = { from: 1.4, to: 6.8, splitA: 3.2 } // virtual flow window, A=pre-click
+const S2 = { from: 6.6, to: 10.8, playFrom: 6.9 }
+
+const arg = (name, fallback) => {
+ const hit = process.argv.find((a) => a.startsWith(`--${name}=`))
+ return hit ? hit.split('=')[1] : fallback
+}
+const FN = arg('fn')
+if (!FN) { console.error('need --fn=<intent>'); process.exit(1) }
+
+const manifest = JSON.parse(fs.readFileSync(path.join(ROOT, 'scripts', 'teasers', 'manifests', `${FN}.json`), 'utf8'))
+const takeDir = path.join(ROOT, manifest.flow.take)
+const scratch = path.join(ROOT, 'assets-src', 'teasers-scratch', FN)
+const framesOut = path.join(scratch, 'frames')
+fs.mkdirSync(framesOut, { recursive: true })
+const outDir = path.join(ROOT, 'public', 'teasers')
+fs.mkdirSync(outDir, { recursive: true })
+
+const ff = (args) => {
+ const r = spawnSync(FFMPEG, ['-hide_banner', '-loglevel', 'error', ...args], { stdio: ['ignore', 'pipe', 'inherit'] })
+ if (r.status !== 0) throw new Error(`ffmpeg failed: ${args.join(' ')}`)
+ return r
+}
+const furl = (p) => pathToFileURL(p).href
+const findFile = (dir, base) => {
+ const hit = fs.readdirSync(dir).find((f) => f.startsWith(base + '.'))
+ return hit ? path.join(dir, hit) : null
+}
+
+// ── 1. flow mapping (virtual t -> source JPEG) ──────────────────────────────
+const meta = JSON.parse(fs.readFileSync(path.join(takeDir, 'frames.json'), 'utf8'))
+const srcFrames = meta.frames
+const markers = Object.fromEntries(meta.markers.map((m) => [m.name, m.t]))
+const tClick = markers['create-clicked'] ?? srcFrames[Math.floor(srcFrames.length / 2)].t
+const tDone = markers['render-done'] ?? srcFrames[srcFrames.length - 1].t
+const preClick = manifest.flow.preClick ?? 6
+const postDone = manifest.flow.postDone ?? 2
+
+const frameAt = (t) => {
+ // last source frame with timestamp <= t (screencast frames are sparse)
+ let lo = 0, hi = srcFrames.length - 1, ans = srcFrames[0]
+ while (lo <= hi) {
+ const mid = (lo + hi) >> 1
+ if (srcFrames[mid].t <= t) { ans = srcFrames[mid]; lo = mid + 1 } else hi = mid - 1
+ }
+ return path.join(takeDir, `f_${String(ans.i).padStart(6, '0')}.jpg`)
+}
+const flowSrcByFrame = Array.from({ length: FRAMES }, (_, f) => {
+ const t = f / FPS
+ if (t < S1.from - 0.1 || t > S1.to + 0.1) return null
+ const v = t - S1.from
+ if (v <= S1.splitA) {
+ const srcT = tClick - preClick + (v / S1.splitA) * preClick
+ return furl(frameAt(Math.max(srcFrames[0].t, srcT)))
+ }
+ const vb = v - S1.splitA
+ const spanB = S1.to - S1.from - S1.splitA
+ const srcT = tDone - 0.5 + (vb / spanB) * (0.5 + postDone)
+ return furl(frameAt(Math.min(srcFrames[srcFrames.length - 1].t, srcT)))
+})
+
+// ── 2. S2 assets ────────────────────────────────────────────────────────────
+const s2cfg = manifest.result
+const s2 = { type: s2cfg.type }
+const prepImage = (name) => {
+ const src = path.join(takeDir, s2cfg[name])
+ const out = path.join(scratch, `${name}.jpg`)
+ if (!fs.existsSync(out) || fs.statSync(out).mtimeMs < fs.statSync(src).mtimeMs) {
+ ff(['-y', '-i', src, '-vf', 'scale=1280:-2', '-q:v', '3', out])
+ }
+ return furl(out)
+}
+const extractSeq = (srcName, sub) => {
+ const src = path.join(takeDir, srcName)
+ const dir = path.join(scratch, sub)
+ const stamp = path.join(dir, '.stamp')
+ if (!fs.existsSync(stamp) || fs.statSync(stamp).mtimeMs < fs.statSync(src).mtimeMs) {
+ fs.rmSync(dir, { recursive: true, force: true })
+ fs.mkdirSync(dir, { recursive: true })
+ ff(['-y', '-i', src, '-vf', `fps=${FPS},scale=1280:-2`, '-q:v', '3', path.join(dir, 'r_%05d.jpg')])
+ fs.writeFileSync(stamp, '')
+ }
+ return fs.readdirSync(dir).filter((f) => f.endsWith('.jpg')).sort().map((f) => furl(path.join(dir, f)))
+}
+const seqByFrame = (seq) =>
+ Array.from({ length: FRAMES }, (_, f) => {
+ const t = f / FPS
+ if (t < S2.from || t > S2.to) return null
+ const idx = Math.max(0, Math.round((t - S2.playFrom) * FPS))
+ return seq[seq.length ? idx % seq.length : 0] ?? seq[0]
+ })
+
+if (s2.type === 'image-compare') {
+ s2.before = prepImage('before')
+ s2.after = prepImage('after')
+ s2.beforeTag = s2cfg.beforeTag
+ s2.afterTag = s2cfg.afterTag
+} else if (s2.type === 'image-crossfade') {
+ s2.before = prepImage('before')
+ s2.after = prepImage('after')
+} else if (s2.type === 'image-cuts') {
+ const span = S2.to - S2.playFrom
+ const n = s2cfg.cuts.length
+ s2.cuts = s2cfg.cuts.map((file, i) => {
+ const src = path.join(takeDir, file)
+ const out = path.join(scratch, `cut${i}.jpg`)
+ if (!fs.existsSync(out) || fs.statSync(out).mtimeMs < fs.statSync(src).mtimeMs) {
+ ff(['-y', '-i', src, '-vf', 'scale=1280:-2', '-q:v', '3', out])
+ }
+ return { src: furl(out), from: S2.playFrom + (span * i) / n, to: S2.playFrom + (span * (i + 1)) / n }
+ })
+} else if (s2.type === 'video' || s2.type === 'video-extend' || s2.type === 'video-pip') {
+ s2.imgsByFrame = seqByFrame(extractSeq(s2cfg.video, 'result-seq'))
+ if (s2.type === 'video-extend') s2.boundaryPct = s2cfg.boundaryPct ?? 50
+ if (s2.type === 'video-pip') s2.pipByFrame = seqByFrame(extractSeq(s2cfg.pip, 'pip-seq'))
+} else if (s2.type === 'audio-waveform') {
+ const audio = path.join(takeDir, s2cfg.audio)
+ const raw = spawnSync(FFMPEG, ['-hide_banner', '-loglevel', 'error', '-i', audio, '-ac', '1', '-ar', '8000', '-f', 's16le', 'pipe:1'], { maxBuffer: 1 << 28 })
+ if (raw.status !== 0) throw new Error('ffmpeg pcm decode failed')
+ const pcm = raw.stdout
+ const n = Math.floor(pcm.length / 2)
+ const BUCKETS = 200
+ const peaks = Array.from({ length: BUCKETS }, (_, b) => {
+ const from = Math.floor((b * n) / BUCKETS), to = Math.floor(((b + 1) * n) / BUCKETS)
+ let max = 0
+ for (let i = from; i < to; i += 4) max = Math.max(max, Math.abs(pcm.readInt16LE(i * 2)))
+ return max / 32768
+ })
+ s2.peaks = peaks
+ s2.title = s2cfg.title ?? manifest.tagline
+ // normalized 5.4s cut for the mux (starts at S2.from in the final clip)
+ const cut = path.join(scratch, 'audio.flac')
+ ff(['-y', '-ss', String(s2cfg.audioOffset ?? 0), '-t', '5.4', '-i', audio,
+ '-af', 'loudnorm=I=-16:TP=-1.5:LRA=11,afade=t=in:st=0:d=0.5,afade=t=out:st=4.2:d=1.2', '-ar', '48000', cut])
+ s2._audioCut = cut
+}
+
+// ── 3. frame-step capture ───────────────────────────────────────────────────
+const payload = {
+ title: manifest.title,
+ tagline: manifest.tagline,
+ caption: manifest.caption,
+ monogram: furl(path.join(ROOT, 'public', 'LU-monogram-white.png')),
+ flowSrcByFrame,
+ s2,
+}
+// Prefer whatever headless-shell revision is already on disk over forcing a
+// `playwright install` download; screenshot capture has no revision-sensitive
+// surface for this template.
+const findShell = () => {
+ const base = path.join(process.env.LOCALAPPDATA ?? '', 'ms-playwright')
+ try {
+ const revs = fs.readdirSync(base).filter((d) => d.startsWith('chromium_headless_shell-')).sort()
+ for (const rev of revs.reverse()) {
+ const exe = path.join(base, rev, 'chrome-headless-shell-win64', 'chrome-headless-shell.exe')
+ if (fs.existsSync(exe)) return exe
+ }
+ } catch { /* fall through to default resolution */ }
+ return undefined
+}
+const shell = findShell()
+const browser = await chromium.launch(shell ? { executablePath: shell } : {})
+const page = await browser.newPage({ viewport: { width: 640, height: 360 }, deviceScaleFactor: 2 })
+await page.goto(furl(path.join(ROOT, 'scripts', 'teasers', 'template', 'template.html')))
+await page.evaluate((p) => window.__INIT(p), payload)
+await page.waitForFunction(() => window.__READY === true, null, { timeout: 60_000 })
+for (let f = 0; f < FRAMES; f++) {
+ await page.evaluate((t) => window.__SEEK(t), f / FPS)
+ await page.screenshot({ path: path.join(framesOut, `f_${String(f).padStart(5, '0')}.png`) })
+ if (f % 60 === 0) console.log(`frame ${f}/${FRAMES}`)
+}
+await browser.close()
+
+// ── 4. encode ───────────────────────────────────────────────────────────────
+const outFile = path.join(outDir, `${FN}.webm`)
+const passlog = path.join(scratch, '2p')
+const encode = (bitrateK) => {
+ const vf = ['-framerate', String(FPS), '-i', path.join(framesOut, 'f_%05d.png')]
+ const venc = ['-c:v', 'libvpx-vp9', '-b:v', `${bitrateK}k`, '-maxrate', `${Math.round(bitrateK * 1.5)}k`,
+ '-minrate', `${Math.round(bitrateK / 4)}k`, '-crf', '36', '-deadline', 'good', '-row-mt', '1',
+ '-tile-columns', '1', '-g', '240', '-pix_fmt', 'yuv420p']
+ ff(['-y', ...vf, '-pass', '1', '-passlogfile', passlog, ...venc, '-an', '-f', 'null', '-'])
+ if (s2.type === 'audio-waveform') {
+ ff(['-y', ...vf, '-itsoffset', String(S2.from), '-i', s2._audioCut, '-pass', '2', '-passlogfile', passlog,
+ '-map', '0:v', '-map', '1:a', ...venc, '-c:a', 'libopus', '-b:a', '96k', '-shortest', outFile])
+ } else {
+ ff(['-y', ...vf, '-pass', '2', '-passlogfile', passlog, ...venc, '-an', outFile])
+ }
+ return fs.statSync(outFile).size
+}
+let size = encode(480)
+if (size > 870 * 1024) {
+ const scaled = Math.max(200, Math.floor((480 * 800 * 1024) / size))
+ console.log(`size ${Math.round(size / 1024)}KB over budget, retry at ${scaled}k`)
+ size = encode(scaled)
+}
+ff(['-y', '-framerate', String(FPS), '-i', path.join(framesOut, 'f_%05d.png'),
+ '-vf', "select=eq(n\\,20),scale=640:360", '-frames:v', '1', path.join(outDir, `${FN}-poster.webp`)])
+console.log(`OK ${FN}: ${Math.round(size / 1024)}KB -> ${outFile}`)
diff --git a/scripts/teasers/template/template.html b/scripts/teasers/template/template.html
new file mode 100644
index 00000000..c0d01db0
--- /dev/null
+++ b/scripts/teasers/template/template.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<!-- Teaser motion template. No CSS animations anywhere: render.mjs drives a
+ virtual clock frame by frame via window.__SEEK(t) and screenshots each
+ frame, so output is deterministic regardless of machine load. -->
+<html>
+<head>
+ <meta charset="utf-8" />
+ <link rel="stylesheet" href="theme.css" />
+</head>
+<body>
+ <div id="root">
+ <div id="glow"></div>
+
+ <section id="s0" class="seg">
+ <div class="inner">
+ <div class="micro">LU Cloud</div>
+ <div class="title"></div>
+ <div class="underline"></div>
+ <div class="tagline"></div>
+ </div>
+ </section>
+
+ <section id="s1" class="seg">
+ <div class="frame"><img alt="" /></div>
+ <div class="caption"></div>
+ </section>
+
+ <section id="s2" class="seg"><div class="stage"></div></section>
+
+ <section id="s3" class="seg">
+ <div class="mark">
+ <div class="ring"></div>
+ <img alt="" />
+ </div>
+ </section>
+ </div>
+ <script src="template.js"></script>
+</body>
+</html>
diff --git a/scripts/teasers/template/template.js b/scripts/teasers/template/template.js
new file mode 100644
index 00000000..57928af8
--- /dev/null
+++ b/scripts/teasers/template/template.js
@@ -0,0 +1,158 @@
+// Deterministic teaser timeline. render.mjs calls __INIT(payload) once, waits
+// for __READY, then steps __SEEK(t) per output frame. All per-frame media
+// decisions (which source JPEG shows when) are precomputed in Node and arrive
+// as arrays indexed by output frame; this file only eases opacities and
+// transforms and swaps <img>.src.
+//
+// Timeline (12.0s @30fps): S0 title 0-1.6 · S1 flow 1.4-6.8 · S2 result
+// 6.6-10.8 · S3 outro 10.6-12.0; frame 359 matches frame 0 for a clean loop.
+
+/* global window, document */
+const $ = (sel) => document.querySelector(sel)
+const clamp01 = (x) => Math.max(0, Math.min(1, x))
+const easeOut = (x) => 1 - Math.pow(1 - clamp01(x), 3)
+const easeInOut = (x) => { const t = clamp01(x); return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2 }
+// fade helper: in over [a,b], out over [c,d]
+const window01 = (t, a, b, c, d) => clamp01((t - a) / (b - a)) * (1 - clamp01((t - c) / (d - c)))
+
+let P = null // payload
+
+window.__INIT = async (payload) => {
+ P = payload
+ $('#s0 .title').textContent = payload.title
+ $('#s0 .tagline').textContent = payload.tagline || ''
+ $('#s1 .caption').textContent = payload.caption || ''
+ $('#s3 img').src = payload.monogram
+
+ const stage = $('#s2 .stage')
+ stage.innerHTML = ''
+ const s2 = payload.s2
+ if (s2.type === 'image-compare') {
+ stage.innerHTML = `
+ <img class="fill before" /><img class="fill after" />
+ <div class="divider"></div>
+ <span class="tag" style="left:12px"></span>
+ <span class="tag" style="right:12px"></span>
+ <span class="pill">Generated with LU Cloud</span>`
+ stage.querySelector('.before').src = s2.before
+ stage.querySelector('.after').src = s2.after
+ stage.querySelectorAll('.tag')[0].textContent = s2.beforeTag || 'Before'
+ stage.querySelectorAll('.tag')[1].textContent = s2.afterTag || 'After'
+ } else if (s2.type === 'image-crossfade') {
+ stage.innerHTML = `
+ <img class="fill before" /><img class="fill after" />
+ <span class="pill">Generated with LU Cloud</span>`
+ stage.querySelector('.before').src = s2.before
+ stage.querySelector('.after').src = s2.after
+ } else if (s2.type === 'image-cuts') {
+ stage.innerHTML = `<img class="fill cut" /><span class="pill">Generated with LU Cloud</span>`
+ } else if (s2.type === 'video' || s2.type === 'video-extend' || s2.type === 'video-pip') {
+ stage.innerHTML = `<img class="fill vid" /><span class="pill">Generated with LU Cloud</span>`
+ if (s2.type === 'video-extend') {
+ stage.insertAdjacentHTML('beforeend', `
+ <div class="timeline"><div class="orig"></div><div class="ext"></div></div>`)
+ stage.querySelector('.orig').style.width = `${s2.boundaryPct}%`
+ stage.querySelector('.ext').style.left = `${s2.boundaryPct}%`
+ }
+ if (s2.type === 'video-pip') {
+ stage.insertAdjacentHTML('beforeend', `<div class="pip"><img /></div>`)
+ }
+ } else if (s2.type === 'audio-waveform') {
+ const bars = (s2.peaks || []).map((p) => `<span style="height:${Math.max(3, Math.round(p * 150))}px"></span>`).join('')
+ stage.innerHTML = `
+ <div class="wtitle"></div>
+ <div class="wave">${bars}</div>
+ <div class="wavehead"></div>
+ <span class="pill">Generated with LU Cloud</span>`
+ stage.querySelector('.wtitle').textContent = s2.title || ''
+ }
+
+ // Preload every image the timeline will touch so seeking never races decode.
+ const srcs = new Set()
+ ;(payload.flowSrcByFrame || []).forEach((s) => s && srcs.add(s))
+ ;(s2.imgsByFrame || []).forEach((s) => s && srcs.add(s))
+ ;(s2.pipByFrame || []).forEach((s) => s && srcs.add(s))
+ ;(s2.cuts || []).forEach((c) => srcs.add(c.src))
+ ;[s2.before, s2.after, payload.monogram].forEach((s) => s && srcs.add(s))
+ await Promise.all(
+ [...srcs].map(
+ (src) =>
+ new Promise((res) => {
+ const im = new Image()
+ im.onload = res
+ im.onerror = res
+ im.src = src
+ }),
+ ),
+ )
+ window.__READY = true
+}
+
+window.__SEEK = (t) => {
+ const f = Math.round(t * 30)
+ const s2 = P.s2
+
+ // S0 title card
+ const s0 = window01(t, 0.05, 0.45, 1.35, 1.6)
+ $('#s0').style.opacity = s0
+ $('#s0 .underline').style.transform = `scaleX(${easeOut((t - 0.25) / 0.6)})`
+ $('#s0 .title').style.transform = `translateY(${(1 - easeOut(t / 0.7)) * 8}px)`
+
+ // S1 flow
+ const s1 = window01(t, 1.4, 1.7, 6.55, 6.8)
+ $('#s1').style.opacity = s1
+ if (s1 > 0) {
+ const src = P.flowSrcByFrame[Math.min(f, P.flowSrcByFrame.length - 1)]
+ const img = $('#s1 img')
+ if (src && img.getAttribute('src') !== src) img.src = src
+ $('#s1 .frame').style.transform = `scale(${1 + 0.015 * easeInOut((t - 1.4) / 5.4)})`
+ }
+
+ // S2 result
+ const s2op = window01(t, 6.6, 6.9, 10.55, 10.8)
+ $('#s2').style.opacity = s2op
+ if (s2op > 0) {
+ const stage = $('#s2 .stage')
+ if (s2.type === 'image-compare') {
+ const x = 4 + 92 * easeInOut((t - 6.9) / 2.9)
+ stage.querySelector('.after').style.clipPath = `inset(0 0 0 ${x}%)`
+ stage.querySelector('.divider').style.left = `${x}%`
+ } else if (s2.type === 'image-crossfade') {
+ stage.querySelector('.before').style.opacity = 1 - easeInOut((t - 7.5) / 1.2)
+ } else if (s2.type === 'image-cuts') {
+ const cut = (s2.cuts || []).find((c) => t >= c.from && t < c.to) || s2.cuts[s2.cuts.length - 1]
+ const img = stage.querySelector('.cut')
+ if (img.getAttribute('src') !== cut.src) img.src = cut.src
+ img.style.transform = `scale(${1.03 + 0.04 * clamp01((t - cut.from) / (cut.to - cut.from))})`
+ } else if (s2.type === 'video' || s2.type === 'video-extend' || s2.type === 'video-pip') {
+ const src = s2.imgsByFrame[Math.min(f, s2.imgsByFrame.length - 1)]
+ const img = stage.querySelector('.vid')
+ if (src && img.getAttribute('src') !== src) img.src = src
+ if (s2.type === 'video-extend') {
+ const prog = clamp01((t - 6.9) / 3.6)
+ stage.querySelector('.ext').style.width = `${Math.max(0, prog * 100 - s2.boundaryPct) * (100 / (100 - s2.boundaryPct)) * ((100 - s2.boundaryPct) / 100)}%`
+ }
+ if (s2.type === 'video-pip') {
+ const psrc = s2.pipByFrame[Math.min(f, s2.pipByFrame.length - 1)]
+ const pimg = stage.querySelector('.pip img')
+ if (psrc && pimg.getAttribute('src') !== psrc) pimg.src = psrc
+ }
+ } else if (s2.type === 'audio-waveform') {
+ const prog = clamp01((t - 6.6) / 4.2)
+ const x = 40 + (640 - 80) * prog
+ stage.querySelector('.wavehead').style.left = `${x}px`
+ const bars = stage.querySelectorAll('.wave span')
+ const lit = Math.floor(prog * bars.length)
+ bars.forEach((b, i) => {
+ b.style.background = i <= lit ? '#a094f8' : 'rgba(255,255,255,0.22)'
+ })
+ }
+ }
+
+ // S3 outro
+ const s3 = window01(t, 10.6, 10.95, 11.65, 12.0)
+ $('#s3').style.opacity = s3
+ $('#s3 .mark').style.transform = `scale(${0.85 + 0.15 * easeOut((t - 10.6) / 0.5)})`
+ $('#s3 .ring').style.transform = `scale(${1 + 0.25 * easeInOut((t - 10.7) / 1.0)})`
+ $('#s3 .ring').style.opacity = 1 - clamp01((t - 11.2) / 0.7)
+}
diff --git a/scripts/teasers/template/theme.css b/scripts/teasers/template/theme.css
new file mode 100644
index 00000000..2552256d
--- /dev/null
+++ b/scripts/teasers/template/theme.css
@@ -0,0 +1,65 @@
+/* Teaser template theme: tokens copied from src/index.css so the clips look
+ * like the app (accent #a094f8, canvas #1b1b1b, Inter/system stack). */
+* { margin: 0; padding: 0; box-sizing: border-box; }
+html, body { width: 640px; height: 360px; overflow: hidden; background: #1b1b1b; }
+body {
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
+ color: #f3f4f6;
+ -webkit-font-smoothing: antialiased;
+}
+#root { position: relative; width: 640px; height: 360px; background: #1b1b1b; }
+#glow {
+ position: absolute; inset: 0;
+ background: radial-gradient(ellipse 420px 260px at 50% 42%, rgba(160, 148, 248, 0.10), transparent 70%);
+}
+.seg { position: absolute; inset: 0; opacity: 0; display: flex; align-items: center; justify-content: center; }
+
+/* S0 title card */
+#s0 .inner { text-align: center; }
+#s0 .micro { font-size: 10px; font-weight: 600; letter-spacing: 0.32em; color: #a094f8; text-transform: uppercase; }
+#s0 .title { margin-top: 10px; font-size: 34px; font-weight: 600; color: #ffffff; }
+#s0 .underline { margin: 14px auto 0; width: 120px; height: 2px; background: #a094f8; border-radius: 1px; transform-origin: 50% 50%; }
+#s0 .tagline { margin-top: 12px; font-size: 12.5px; color: #9ca3af; }
+
+/* S1 flow in a device frame */
+#s1 .frame {
+ width: 560px; height: 280px; border-radius: 14px; overflow: hidden;
+ background: #262626; border: 1px solid rgba(255, 255, 255, 0.08);
+ box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
+}
+#s1 img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
+#s1 .caption {
+ position: absolute; left: 0; right: 0; bottom: 12px; text-align: center;
+ font-size: 11px; color: #9ca3af; letter-spacing: 0.02em;
+}
+
+/* S2 result stage */
+#s2 .stage { position: relative; width: 640px; height: 360px; overflow: hidden; background: #101010; }
+#s2 img.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
+#s2 .divider { position: absolute; top: 0; bottom: 0; width: 2px; background: #a094f8; box-shadow: 0 0 12px rgba(160, 148, 248, 0.8); }
+#s2 .tag {
+ position: absolute; top: 12px; padding: 3px 8px; border-radius: 999px;
+ font-size: 10px; font-weight: 600; background: rgba(0, 0, 0, 0.55); color: #e5e7eb;
+}
+#s2 .pill {
+ position: absolute; left: 14px; bottom: 14px; padding: 4px 10px; border-radius: 999px;
+ font-size: 10px; font-weight: 500; color: #d6d0ff;
+ background: rgba(160, 148, 248, 0.14); border: 1px solid rgba(160, 148, 248, 0.35);
+}
+#s2 .timeline { position: absolute; left: 40px; right: 40px; bottom: 34px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
+#s2 .timeline .orig { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.35); }
+#s2 .timeline .ext { position: absolute; top: 0; bottom: 0; background: #a094f8; }
+#s2 .pip {
+ position: absolute; right: 14px; top: 14px; width: 128px; height: 72px; border-radius: 8px;
+ overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.25); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
+}
+#s2 .pip img { width: 100%; height: 100%; object-fit: cover; }
+#s2 .wave { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 40px; }
+#s2 .wave span { width: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.22); }
+#s2 .wavehead { position: absolute; top: 70px; bottom: 70px; width: 2px; background: #a094f8; box-shadow: 0 0 10px rgba(160, 148, 248, 0.9); }
+#s2 .wtitle { position: absolute; left: 0; right: 0; top: 44px; text-align: center; font-size: 13px; color: #e5e7eb; font-weight: 500; }
+
+/* S3 outro */
+#s3 .mark { position: relative; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; }
+#s3 img { width: 56px; height: 56px; }
+#s3 .ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(160, 148, 248, 0.55); }
diff --git a/src/components/cloud/CloudExampleModal.tsx b/src/components/cloud/CloudExampleModal.tsx
new file mode 100644
index 00000000..870f50d3
--- /dev/null
+++ b/src/components/cloud/CloudExampleModal.tsx
@@ -0,0 +1,124 @@
+// Example video popup (2.5.8): the step between a teaser sheet's "See plans"
+// and the CloudGateModal. Shows a short looping clip of the tool actually
+// doing its thing (real footage from recorded cloud runs, produced by
+// scripts/teasers and shipped in public/teasers/<intent>.webm with a webp
+// poster). Only intent surfaces have clips; model-row teasers keep the
+// direct path to the gate. A missing or broken asset skips straight to the
+// gate so the flow never dead-ends on a black box.
+
+import { useEffect, useRef, useState } from 'react'
+import { AnimatePresence, motion } from 'framer-motion'
+import { X, Cloud, Sparkles, Volume2, VolumeX } from 'lucide-react'
+import { useUIStore, type CloudTeaserTarget } from '../../stores/uiStore'
+
+type ExampleIntent = Extract<CloudTeaserTarget, { surface: 'intent' }>['intent']
+
+const TITLES: Record<ExampleIntent, string> = {
+ upscale: 'Upscale',
+ eraser: 'Erase Object',
+ character: 'Character Studio',
+ lipsync: 'Talking Character',
+ music: 'Music',
+ extend: 'Extend Video',
+ motion: 'Motion Control',
+}
+
+export function CloudExampleModal() {
+ const target = useUIStore((s) => s.cloudExampleVideo)
+ const setTarget = useUIStore((s) => s.setCloudExampleVideo)
+ const setCloudGateOpen = useUIStore((s) => s.setCloudGateOpen)
+ // The music clip carries the generated track; it still starts muted
+ // (autoplay policy + not startling anyone) with a tap-to-listen toggle.
+ const [muted, setMuted] = useState(true)
+ const videoRef = useRef<HTMLVideoElement | null>(null)
+ useEffect(() => { setMuted(true) }, [target?.intent])
+ // React's `muted` attribute is unreliable on re-renders; set the property.
+ useEffect(() => { if (videoRef.current) videoRef.current.muted = muted }, [muted, target])
+
+ const close = () => setTarget(null)
+ const toPlans = () => { setTarget(null); setCloudGateOpen(true) }
+
+ return (
+ <AnimatePresence>
+ {target && (
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ className="fixed inset-0 z-[90] flex items-center justify-center bg-black/60 backdrop-blur-sm"
+ onClick={close}
+ >
+ <motion.div
+ initial={{ opacity: 0, y: 10, scale: 0.97 }}
+ animate={{ opacity: 1, y: 0, scale: 1 }}
+ exit={{ opacity: 0, y: 10, scale: 0.97 }}
+ transition={{ duration: 0.15, ease: 'easeOut' }}
+ onClick={(e) => e.stopPropagation()}
+ className="w-[440px] max-w-[94vw] rounded-2xl bg-[#232323] border border-white/[0.08] shadow-2xl shadow-black/50 overflow-hidden"
+ >
+ {/* Clip stage: 16:9, poster paints instantly, clip loops. */}
+ <div className="relative aspect-video bg-[#1b1b1b] border-b border-white/[0.06]">
+ <video
+ ref={videoRef}
+ key={target.intent}
+ className="w-full h-full object-cover"
+ src={`/teasers/${target.intent}.webm`}
+ poster={`/teasers/${target.intent}-poster.webp`}
+ autoPlay
+ muted
+ loop
+ playsInline
+ onError={toPlans}
+ />
+ <button
+ onClick={close}
+ className="absolute top-2 right-2 p-1.5 rounded-md text-gray-400 hover:text-gray-100 bg-black/30 hover:bg-black/50 transition-colors"
+ title="Close"
+ aria-label="Close"
+ >
+ <X size={14} />
+ </button>
+ {target.intent === 'music' && (
+ <button
+ onClick={() => setMuted((m) => !m)}
+ className="absolute bottom-2 right-2 flex items-center gap-1.5 px-2 py-1.5 rounded-md text-[0.62rem] text-gray-200 bg-black/40 hover:bg-black/60 transition-colors"
+ aria-label={muted ? 'Unmute' : 'Mute'}
+ >
+ {muted ? <VolumeX size={13} /> : <Volume2 size={13} />}
+ {muted ? 'Hear it' : 'Mute'}
+ </button>
+ )}
+ </div>
+
+ <div className="p-4 space-y-3">
+ <div className="flex items-center gap-2">
+ <Cloud size={14} className="text-violet-500 dark:text-violet-200" />
+ <h3 className="text-[0.85rem] font-semibold text-white">{TITLES[target.intent]}</h3>
+ <span className="ml-auto text-[0.55rem] font-medium uppercase tracking-widest text-violet-300/80">
+ LU Cloud
+ </span>
+ </div>
+ <p className="text-[0.68rem] leading-relaxed text-gray-400">
+ Real output, straight from LU Cloud. This is what the tool makes.
+ </p>
+ <div className="flex items-center gap-2 pt-1">
+ <button
+ onClick={toPlans}
+ className="flex-1 flex items-center justify-center gap-1.5 h-8 rounded-lg bg-white text-black text-[0.7rem] font-semibold hover:bg-gray-200 transition-colors"
+ >
+ <Sparkles size={12} /> See plans
+ </button>
+ <button
+ onClick={close}
+ className="px-3 h-8 rounded-lg text-[0.7rem] text-gray-400 hover:text-gray-200 hover:bg-white/[0.06] transition-colors"
+ >
+ Not now
+ </button>
+ </div>
+ </div>
+ </motion.div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ )
+}
diff --git a/src/components/cloud/CloudTeaserModal.tsx b/src/components/cloud/CloudTeaserModal.tsx
index 1695f4c5..0d87bc07 100644
--- a/src/components/cloud/CloudTeaserModal.tsx
+++ b/src/components/cloud/CloudTeaserModal.tsx
@@ -19,11 +19,11 @@ interface TeaserCopy {
const INTENT_COPY: Record<Extract<CloudTeaserTarget, { surface: 'intent' }>['intent'], TeaserCopy> = {
upscale: {
title: 'Upscale',
- line: 'Blow any image up to crisp 2K-8K — no VRAM needed.',
+ line: 'Blow any image up to crisp 2K, 4K or 8K. No VRAM needed.',
},
eraser: {
title: 'Erase Object',
- line: 'Paint over anything and it’s gone — clean fill, no trace.',
+ line: 'Paint over anything and it’s gone. Clean fill, no trace.',
},
character: {
title: 'Character Studio',
@@ -35,11 +35,11 @@ const INTENT_COPY: Record<Extract<CloudTeaserTarget, { surface: 'intent' }>['int
},
music: {
title: 'Music',
- line: 'Describe a track, get a full song — up to four minutes.',
+ line: 'Describe a track, get a full song. Up to four minutes.',
},
extend: {
title: 'Extend Video',
- line: 'Keep a clip going — the cloud continues it seamlessly.',
+ line: 'Keep a clip going. The cloud continues it seamlessly.',
},
motion: {
title: 'Motion Control',
@@ -51,6 +51,7 @@ export function CloudTeaserModal() {
const target = useUIStore((s) => s.cloudTeaser)
const setCloudTeaser = useUIStore((s) => s.setCloudTeaser)
const setCloudGateOpen = useUIStore((s) => s.setCloudGateOpen)
+ const setCloudExampleVideo = useUIStore((s) => s.setCloudExampleVideo)
const { updateSettings } = useSettingsStore()
const close = () => setCloudTeaser(null)
@@ -62,8 +63,8 @@ export function CloudTeaserModal() {
title: cloudModelById(target.modelId)?.label ?? 'Hosted model',
line:
target.kind === 'video'
- ? 'Cinema-grade video models on datacenter GPUs — no download, no VRAM limit.'
- : 'Frontier image models on datacenter GPUs — no download, no VRAM limit.',
+ ? 'Cinema grade video models on datacenter GPUs. No download, no VRAM limit.'
+ : 'Frontier image models on datacenter GPUs. No download, no VRAM limit.',
}
: null
@@ -108,12 +109,20 @@ export function CloudTeaserModal() {
</div>
<p className="text-[0.7rem] leading-relaxed text-gray-400">{copy.line}</p>
<p className="text-[0.62rem] leading-relaxed text-gray-500">
- Runs on LU Cloud — your PC stays cool while datacenter GPUs do the
+ Runs on LU Cloud. Your PC stays cool while datacenter GPUs do the
heavy lifting. Part of the Max plan (closed beta).
</p>
<div className="flex items-center gap-2 pt-1">
<button
- onClick={() => { close(); setCloudGateOpen(true) }}
+ onClick={() => {
+ // Intent teasers detour through the example video popup
+ // (real footage of the tool); model rows go straight to
+ // the gate since there is no per model clip.
+ const t = target
+ close()
+ if (t.surface === 'intent') setCloudExampleVideo(t)
+ else setCloudGateOpen(true)
+ }}
className="flex-1 flex items-center justify-center gap-1.5 h-8 rounded-lg bg-white text-black text-[0.7rem] font-semibold hover:bg-gray-200 transition-colors"
>
<Sparkles size={12} /> See plans
diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx
index bb8a1254..c822e000 100644
--- a/src/components/layout/AppShell.tsx
+++ b/src/components/layout/AppShell.tsx
@@ -30,6 +30,7 @@ import { useCloudAuthStore, deriveCloudAvailable } from '../../stores/cloudAuthS
import { useCreateStore } from '../../stores/createStore'
import { CloudGateModal } from '../cloud/CloudGateModal'
import { CloudTeaserModal } from '../cloud/CloudTeaserModal'
+import { CloudExampleModal } from '../cloud/CloudExampleModal'
import { CloudIntroPopup } from '../cloud/CloudIntroPopup'
import { CloudOnboardingModal } from '../cloud/CloudOnboardingModal'
import { ShortcutsModal } from './ShortcutsModal'
@@ -812,6 +813,9 @@ export function AppShell() {
{/* Cloud discovery sheet: opened by the Local-mode teaser surfaces
(locked Create tabs, hosted model rows). */}
<CloudTeaserModal />
+ {/* Example video popup: teaser "See plans" detours here (intent
+ surfaces only) before the gate. */}
+ <CloudExampleModal />
{/* One-time cloud onboarding — first successful switch flip. */}
<CloudOnboardingModal />
{/* Once-ever "LU Cloud is live" hello on the first 2.5.7 launch. */}
diff --git a/src/stores/uiStore.ts b/src/stores/uiStore.ts
index 405dcdc1..4bdde099 100644
--- a/src/stores/uiStore.ts
+++ b/src/stores/uiStore.ts
@@ -25,12 +25,17 @@ interface UIState {
cloudOnboardingOpen: boolean
/** CloudTeaserModal — null = closed. */
cloudTeaser: CloudTeaserTarget | null
+ /** CloudExampleModal — the example video popup a teaser sheet's "See plans"
+ * detours through for intent surfaces (real footage of the tool). null =
+ * closed. Runtime only, never persisted. */
+ cloudExampleVideo: Extract<CloudTeaserTarget, { surface: 'intent' }> | null
setView: (view: View) => void
toggleSidebar: () => void
setSidebarOpen: (open: boolean) => void
setCloudGateOpen: (open: boolean) => void
setCloudOnboardingOpen: (open: boolean) => void
setCloudTeaser: (target: CloudTeaserTarget | null) => void
+ setCloudExampleVideo: (target: Extract<CloudTeaserTarget, { surface: 'intent' }> | null) => void
}
export const useUIStore = create<UIState>()((set) => ({
@@ -39,6 +44,7 @@ export const useUIStore = create<UIState>()((set) => ({
cloudGateOpen: false,
cloudOnboardingOpen: false,
cloudTeaser: null,
+ cloudExampleVideo: null,
// Sidebar visibility follows the view: it's the conversation list, which
// only makes sense in Chat. The hamburger toggle still works on other views;
@@ -49,4 +55,5 @@ export const useUIStore = create<UIState>()((set) => ({
setCloudGateOpen: (open) => set({ cloudGateOpen: open }),
setCloudOnboardingOpen: (open) => set({ cloudOnboardingOpen: open }),
setCloudTeaser: (target) => set({ cloudTeaser: target }),
+ setCloudExampleVideo: (target) => set({ cloudExampleVideo: target }),
}))