feat(demo): Stage 2 PR-3 — flagship scenario (Inbox ↔ workspace ↔ transcript)#223
Merged
luokerenx4 merged 3 commits intoMay 29, 2026
Merged
Conversation
…nscript) Wires three demo surfaces into a coherent story for the visitor: 1. Inbox: shows a single agent-written report from a workspace named "demo" timestamped 5 minutes ago — "AAPL Q1 — Hidden Deceleration Signal" with a fully-rendered markdown document (TL;DR + analysis table + recommendations) inline. 2. Workspace file handler: returns the markdown content for `research-AAPL-q1.md` from `demoWorkspaceFiles` map. Inbox's readWorkspaceFile() call pulls it live (no snapshot), matching real product behavior. 3. PTY replay (welcome.ts rewritten as `aaplResearchTranscript`): shows the session that produced the report — user asks "what jumped out from Apple's Q1 earnings?", agent reads filings, computes services-rev YoY across quarters, finds the three-quarter deceleration, writes the report, inbox_pushes. Cross-link is implicit and clean: the Inbox entry has `workspaceId: DEMO_WORKSPACE_ID`. Clicking opens the workspace, the session terminal plays the transcript that produced the entry. No explicit "this entry came from that session" pointer needed — the narrative reads itself. Also scripts the SSE event timeline (handlers/events.ts + fixtures/events.ts): 6 historical events spanning ~5 minutes covering agent.work.started → tool_calls → write_file → inbox.entry_created → agent.work.completed. Emitted as one burst on stream connect to populate the events feed. Tree-shaking fix (the necessary side-effect of this PR): Terminal.tsx now lazy-imports DemoTerminalReplay via React.lazy. With the prior static import, Rollup conservatively kept the transcript file in the prod main bundle because its top-level frame-building IIFE has module- scope side effects. Lazy import code-splits the demo terminal into its own 5.7KB chunk that is never fetched in prod (gated by import.meta.env.VITE_DEMO_MODE at the call site). Verified: - pnpm -F open-alice-ui exec tsc -b clean - pnpm -F open-alice-ui build (prod): main chunk has zero transcript / fixture / handler strings; only "DemoTerminalReplay" literal (the lazy-import module specifier) remains. Separate DemoTerminalReplay-*.js chunk (5.7KB / 2.5KB gz) exists but is never fetched in prod. - pnpm -F open-alice-ui build:demo: 279KB demo chunk + 2.82MB main, builds clean. - pnpm dev:demo + Playwright: Inbox shows demo entry, markdown report renders inline, navigating to workspace plays the AAPL research transcript end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fills out the long tail of fixture content so the demo doesn't look gutted once a visitor scrolls past the Inbox/workspace flagship flow from PR-3. **3 trading accounts (instead of 1)** — - Alpaca Paper: \$52,840 NL, 4 stock positions (AAPL/NVDA/GOOG/AMD) with realistic avg-cost vs market-price spreads - IBKR Demo: \$247,310 NL, mix of ETFs (SPY, QQQ, TLT) + an underwater AAPL options position to show non-trivial P&L - Binance Spot: \$15,032 NL (USDT base), BTC and ETH spot positions Equity curve generator uses a seeded random walk per UTA (30 daily points, distinct vol + drift per account) so the Portfolio chart shows plausible-looking lines without the numbers shifting on each page reload — visitors who refresh see consistent state. **6 news articles** — Reuters/Bloomberg/CNBC/WSJ/CoinDesk spread across the last 22 hours covering AAPL Q1, NVDA capex, Fed minutes, BTC, SPY, TLT. The AAPL article (timestamped 30m ago) ties to the Inbox AAPL research from PR-3 (timestamped 5m ago) — "news landed → agent dug in → wrote up the deceleration signal". **4 cron jobs** — Morning market prep (weekdays 8:30 AM), EOD snapshot + journal (weekdays 4:05 PM), Weekly position review (Fridays 5 PM, disabled), AAPL watch alert (every 15m). Mix of cron- schedule vs every-N-minutes formats; mix of enabled vs disabled. Skipped from this PR: topology graph fake (Dev page, low marketing value), populated agent-status log (the events SSE in PR-3 already carries the "system is alive" signal). Verified: - pnpm -F open-alice-ui exec tsc -b clean - pnpm -F open-alice-ui build (prod): zero fixture name leaks in main bundle (`Alpaca Paper`, `Binance Spot`, `Morning market prep`, `demoCronJobs`, `demoNewsArticles` — all absent) - pnpm dev:demo + Playwright: portfolio page renders chart with the random-walk curve + cumulative equity numbers, news page lists all 6 articles with badges, sidebar shows 3 trading accounts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
feat(demo): Stage 2 PR-4 — secondary fixture richness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires three demo surfaces into one coherent story for the visitor. After this lands, the demo answers "what does OpenAlice do" in under a minute via real-feeling interaction, not abstract feature copy.
Stacks on top of PR #221 and PR #222.
The scenario
Visitor lands on /inbox → sees a fresh entry, 5 minutes old, from a workspace named "demo":
Clicks the entry → reads the full markdown report inline (TL;DR + deceleration table + analysis + recommendation), backed by an actual file living "in" the demo workspace.
Opens the workspace → terminal replays the session that wrote the report: agent reads SEC filings + market data, computes services-rev YoY across quarters, finds the three-quarter deceleration, writes the report, pushes to Inbox.
The Inbox entry's
workspaceIdlinks to the workspace, and the workspace's only session plays a transcript that ends withinbox_push: "AAPL Q1 — Hidden Deceleration Signal". The cross-reference reads itself — no UI gymnastics needed.What changed
ui/src/demo/fixtures/inbox.ts(new)demoInboxEntry(the AAPL report entry) +demoWorkspaceFilesmap (research-AAPL-q1.md→ full markdown content)ui/src/demo/fixtures/events.tsagent.work.started→tool_call× 3 →inbox.entry_created→agent.work.completedui/src/demo/fixtures/transcripts/welcome.tsaaplResearchTranscript— the session that wrote the report. Same hand-crafted-frame style as PR-2's placeholder, but tells the AAPL story end-to-end (read filings → compute deceleration table → write file → inbox_push → done)ui/src/demo/handlers/inbox.ts/api/inbox/historyreturns[demoInboxEntry]ui/src/demo/handlers/workspaces.ts/api/workspaces/:id/file?path=…looks updemoWorkspaceFilesand returns{content}for matching pathsui/src/demo/handlers/events.ts/api/events/streamSSE bursts alldemoEventson connect, then stays idle./api/events+/api/events/recentreturn the same set as historyBonus: tree-shaking fix (necessary for this PR)
Terminal.tsxnow lazy-importsDemoTerminalReplayviaReact.lazy. With the prior static import (since PR-2), Rollup conservatively kept the transcript file in the prod main bundle because its top-level frame-building IIFE has module-scope side effects. Even though the call site is dead-code in prod, the transcript strings ("hey, what jumped out from Apple's Q1 earnings?","research-AAPL-q1.md", etc.) leaked intodist/assets/index-*.js.After the fix: the demo terminal is code-split into a separate
DemoTerminalReplay-*.jschunk (5.7KB / 2.5KB gz). Prod never fetches it (gated at the call site). Demo build inlines it via the existing dynamic-import boundary.Verification
pnpm -F open-alice-ui exec tsc -bpnpm -F open-alice-ui build(prod)"DemoTerminalReplay"module specifier remains. SeparateDemoTerminalReplay-*.jschunk (5.7KB / 2.5KB gz) exists but is never fetched in prod.pnpm -F open-alice-ui build:demopnpm dev:demo+ Playwright/inboxshows demo entry, markdown report renders inline, navigating to workspace plays the AAPL research transcript end-to-end with ANSI colors / bold / dim correctTest plan
What's left for Stage 2 PR-4
Secondary fixture richness — multi-UTA accounts with varied positions, realistic equity curves with random-walk-ish data, populated topology graph, news articles, cron jobs.
Boundary touch
None — no trading / auth / broker / migrations code modified.
🤖 Generated with Claude Code