Skip to content

feat(demo): Stage 2 PR-1 — Vercel-deployable + visual skeleton#221

Merged
luokerenx4 merged 1 commit into
masterfrom
feat/ui-demo-stage2-skeleton
May 29, 2026
Merged

feat(demo): Stage 2 PR-1 — Vercel-deployable + visual skeleton#221
luokerenx4 merged 1 commit into
masterfrom
feat/ui-demo-stage2-skeleton

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

First PR in the Stage 2 series (demo mode → marketing-grade). Lands the Vercel deployment surface + the visual signal that "this is a demo, not the real product". The richer pieces (PTY replay, flagship scenario, fixture depth) come in PR-2 / PR-3 / PR-4.

After this merges, you can wire the repo into Vercel and deploy directly — no per-platform tweaks needed.

What changed

Vercel wiring

vercel.json at repo root:

  • buildCommand: pnpm -F open-alice-ui build:demo
  • installCommand: pnpm install --frozen-lockfile --filter='!@traderalice/desktop' (skips Electron, ~1G saved)
  • outputDirectory: ui/dist
  • SPA rewrites: any unmatched route → /index.html (BrowserRouter hard-refresh works)

Demo banner

ui/src/demo/DemoBanner.tsx — sticky amber top bar shown ONLY in demo mode:

🟠 DEMO · You're looking at a snapshot of OpenAlice with recorded data. Mutations don't persist; the agent terminal is replayed. · Install →

Mounted in App.tsx next to the existing UpdateBanner, gated by import.meta.env.VITE_DEMO_MODE so production builds tree-shake it out. Persistent (no dismiss) — it's the "this is a demo, not real" signal.

Terminal stub polish

Replaces Stage 1's minimal "terminal disabled" message with product-tone copy:

Agent terminal

In a real OpenAlice install, this pane is a live PTY running Claude Code, Codex, or shell — the AI agent drives it directly: reads files, runs commands, reports back.

Demo mode shows the workspace structure without a live process.

[Install OpenAlice locally →]

Vite target bump

build.target: 'es2022' — unlocks top-level await (main.tsx's conditional demo-mode dynamic import). All evergreen browsers Chrome 89+ / Safari 15+ / Firefox 89+ support it; no legacy constraint.

Architecture notes (why client-side MSW on Vercel)

Vercel is hybrid (Functions / Edge), not static-only. We could run server code. We don't — by design:

  • Same bundle runs dev:demo locally and on Vercel ⇒ deployment ≡ dev
  • Host-portable: swap to Netlify / Cloudflare Pages / a CDN bucket with zero migration
  • Demo data is mocked anyway; Vercel Functions would just be a worse MSW

The principle is permanent: OpenAlice never proxies LLM calls. Workspace agents spawn local claude / codex CLI processes using the user's own login. There is no "Stage 3 unlock" where demo gets a live LLM Function — that path is structurally closed (broker-credentials-style BYO is the moat).

Verification

Check Result
pnpm -F open-alice-ui exec tsc -b clean
pnpm -F open-alice-ui build (no demo flag) — bundle audit 0 msw / VITE_DEMO_MODE / DemoBanner / DemoTerminalStub refs in dist/assets/*.js
pnpm -F open-alice-ui build:demo produces 277KB demo chunk + 2.82MB main, dynamic-imported under VITE_DEMO_MODE
pnpm install --frozen-lockfile --filter='!@traderalice/desktop' (Vercel installCommand) runs clean, ~750M install
pnpm -F open-alice-ui preview --port 5180 + Playwright deep-link to /workspaces/demo-ws/s/demo-session 0 console errors, SPA routing works, banner + terminal stub render

Test plan

  • npx tsc -b clean in ui/
  • Prod bundle has zero demo refs
  • Demo bundle builds, dynamic-import structure preserved
  • Vite preview deep-link works (= SPA rewrite story works)
  • Banner + stub render correctly in browser
  • Manual: deploy to Vercel and confirm preview URL works end-to-end (deferred to user; this PR just makes it deployable)

What's next (deferred to subsequent Stage 2 PRs)

  • PR-2DemoTerminalReplay + browser-side recording tool + first real transcript
  • PR-3 — Scripted SSE timelines + Inbox flagship report fixture + cross-references
  • PR-4 — Secondary fixture depth (multi-UTA, equity curves, news, cron, topology)

Boundary touch

None — no trading / auth / broker / migrations code modified.

🤖 Generated with Claude Code

vercel.json wires the repo to deploy as a static site from Vercel:
- buildCommand:    pnpm -F open-alice-ui build:demo
- installCommand:  pnpm install --frozen-lockfile --filter='!@traderalice/desktop'
- outputDirectory: ui/dist
- SPA rewrites:    all unmatched paths → /index.html (BrowserRouter hard-refresh)

Demo banner (DemoBanner.tsx) — sticky amber top bar shown only when
VITE_DEMO_MODE is on: "Demo · You're looking at a snapshot · Install →".
Mounted in App.tsx next to UpdateBanner; build-time gated so production
prod bundle is unchanged.

Terminal stub polish — "Agent terminal · live PTY running Claude Code /
Codex / shell" with install CTA. Replaces the earlier minimal "terminal
disabled" copy with product-tone framing for marketing-quality demo.

Vite build target bumped to ES2022 to unlock top-level await (main.tsx's
conditional demo-mode dynamic import). All evergreen browsers (Chrome 89+,
Safari 15+, Firefox 89+) support it; no legacy constraint.

Why client-side MSW even though Vercel runs functions: see
memory `project-demo-mode-vercel-target`. Same bundle runs locally and on
Vercel, zero vendor lock-in. memory `project-openalice-no-llm-proxy` also
captured: live LLM calls are PERMANENTLY excluded from demo (BYO-login is
structural to OpenAlice — workspace agents spawn local CLI processes using
the user's own credentials; never proxied).

Verified:
- pnpm -F open-alice-ui build (no demo flag): 0 msw / VITE_DEMO_MODE /
  DemoBanner refs in prod bundle (grep clean)
- pnpm -F open-alice-ui build:demo: produces 277KB demo chunk +
  2.82MB main, dynamic-imported under VITE_DEMO_MODE
- pnpm -F open-alice-ui preview --port 5180 + Playwright deep-link to
  /workspaces/demo-ws/s/demo-session: 0 console errors, SPA routing works
- Demo banner visible at top, terminal stub renders new product copy

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant