Repository navigation
Design mode v2 Phase 1a: one canvas per workspace, a page per chat - #894
sambitcreate wants to merge 23 commits into
Conversation
Spec for the next design mode: the workspace's running web app as live, interactive frames (localhost-only network), one canvas per workspace with a page per chat, an Aiden-controlled dev server, an Inspect tool with measure and drift checks, element chips, error frames with Fix with Aiden, live directions with Adopt, Google's DESIGN.md as the design-system source, React mock apps for non-web React projects, and later *.canvas.tsx component cards. Seven phases, no code yet.
Records the pre-build findings in spec §11 (design.md package, v1 design-system module, default-session webRequest, offline E2E fixture, React 19 source mapping, cleared v1 canvases, 3a security review), splits the build into reviewable PRs, fixes the decision numbering, and adds the Phase 1a implementation plan.
Plan amendments A1-A12 (origin chatId on updates, chat-filtered comment tray in 1a, per-window ordered views, immediate page change in main, attach merges hidden canvases, single workspace id per operation). Spec amendments S1-S15 (subframe redirects, dev-server start consent, fail-closed null-frame rule, file:// cookies, design job owner, install stamp, permission dispatcher, untrusted bridge output, loopback binding, resequenced PRs behind AIDEN_EXPERIMENTAL_DESIGN_LIVE).
Replace the seq scheme with main-issued focusIds and mount-time view reads; define page precedence; key views by chat (one main window); narrow the attach merge to copied files with path remapping and kept ids; a 'moved' save answer; first-entry page for a second chat; move workspace-remove cleanup and comment pruning into 1a; per-chat comment tools; S2 permission and fingerprint fixes; S7 non-chat job key.
Move each chat's view out of renderer localStorage into a main-owned, per-workspace views file (removes the two-copy races), reset viewports on page change, echo the highest focusId, one page resolver per turn, no duplicate pages on entry, exact attach path pairs, 'moved' carries the new workspace, workspace-checked view reports, race-proof cleanup, and a wider S2 fingerprint.
Round-3 amendments A17, A18, A24 and A26: DesignCanvasViews keeps each chat's page, per-page viewports and focusId, persisted per workspace under userData/design-canvas-views/ (written at most once a second, flushed on quit). showPage takes that page's own viewport. View reports name their workspace and are dropped when the chat has moved; a reload, crash or destroy of the window unmounts every view. designTurnPages resolves a turn's page in A4/A20 order.
Task 5 with A1, A14, A18 and A20: the tools resolve the turn's page through designTurnPages (a page Aiden showed this turn, the message's page, the chat's kept page, the first page), measured from where the chat last looked at that page. Showing a page changes only main's view of the chat and sends designCanvas:focus with the page and a focusId; it never writes the shared document. canvas_read lists and canvas_comment answers only the acting chat's comments. Every store call, broadcast and focus in a call names the one workspace it resolved.
Main owns each chat's view; the canvas reads it on mount and reports changes with its workspace and newest focusId. Pans, zooms and page switches never save the shared document or make undo steps. Updates are filtered by workspace, another chat's change is never an undo step here, and a moved save reopens the canvas on the chat's new workspace. Also refuses a canvas whose workspace record is gone (A25).
Artifact frames load through the chat that made them, within the workspace. Chat delete prunes the chat's comments and view instead of deleting a canvas; workspace remove deletes the canvas and views. A No workspace chat attached with its files copied brings its canvas pages along (canvasCarried: false and a toast when too large). E2E reads the v3 canvas and the views file.
- Managed-worktree delete and its startup recovery remove the worktree's canvas, corrupt copies and views file. - Attach carries comment anchors' source stamps to the copied files, dropping a stamp whose file stayed behind. - Attach brings the canvas along whenever the hidden folder is the chat's own, so trashing files no longer silently deletes notes, visuals and comments. - A canvas save must name its workspace. - Another chat's visual is read only through an attended chat. - Entry reads whether the chat had a view before reading its files, and a take-back also removes the empty page entry added. - Moving an empty chat clears its view and comments on the old workspace's canvas.
- A visual whose chat no longer has it shows a removable missing state instead of loading forever. - Queuing another chat's comment moves it to the queuing chat's tray. - A save answered moved applies only to the chat it was found for. - When the page on screen goes (an undone add or duplicate, or another chat's delete), the view goes back to the page shown before it. - A pan that ends after Aiden showed another page is not kept. - Main handles a chat's view reports in order, so an unmount is never overtaken by the last report. - Tests: early expired focus, A to B to A chat switch, cross-chat page delete; trimmed tests that covered unreachable paths.
There was a problem hiding this comment.
Important
Two asynchronous ordering gaps can restore state after workspace cleanup or replace a chat's latest focused page, so these should be fixed before merge.
Reviewed changes covered the complete 78-file Phase 1a diff that moves Design mode to a shared workspace canvas with per-chat views.
- Workspace document model: Introduces the v3 workspace-keyed canvas store, one-time layout reset, shared revisions, and workspace-aware broadcasts and saves.
- Per-chat view model: Adds main-owned persisted page/view state, focus sequencing, renderer reporting, page fallback, and workspace/chat remount behavior.
- Ownership and lifecycle: Associates artifacts and comments with chats, carries canvases during workspace attachment, and cleans canvas state on chat or workspace removal.
- Tooling and renderer synchronization: Resolves each turn's page consistently, replays local edits over shared conflicts, and preserves per-chat undo semantics across external updates.
- Coverage and documentation: Reviewed the expanded unit/E2E coverage and product, plan, spec, and project-memory updates;
npm run test:design-modepasses all 722 tests.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…ounted fits on screen - DesignChatCanvases asks whether the workspace still exists again on the workspace's store chain just before a save or update writes, so a write that saw the workspace live before its removal no longer recreates the deleted canvas file. - A focus without a focusId only fits frames on the page on screen; it no longer changes the page, so a late fit cannot bring back a page a later numbered page change left (and main never persists it). Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Important
One page-ordering path remains incomplete: an unversioned frame-only focus can still supersede a newer numbered page change.
Reviewed changes since the prior Pullfrog review at 3d6d9ded3, focusing on the follow-up fix in c5db7883d.
- Workspace cleanup ordering: Rechecked workspace liveness inside the canvas store's serialized write boundary and added a race test that proves deletion cannot be undone by a pending save.
- Focus ordering: Prevented late unversioned requests with an explicit stale page from moving the canvas and added renderer coverage for that variant.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
A focus without a focusId that names only frames no longer switches to the frames' page; only a counted focus may change the page. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at c5db7883d, focusing on the frame-only focus-ordering correction.
- Held uncounted fits to the visible page: Inferred a frame-only request's target page before deciding whether it may navigate, while preserving ordered page changes for counted requests.
- Strengthened behavioral coverage: Updated the cross-page focus test to use a counted request and verified that both explicit-page and frame-only late uncounted fits remain on the current page without stale reports.
- Validated the focused suite:
npm run test:design-modepasses all 724 tests at this head.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…pp-plan # Conflicts: # main/index.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review at 19d79bbb7, focusing on the merge of current main into the PR branch.
- Reconciled shutdown sequencing: Combined background follow-through shutdown with the Design view flush so background work settles before the final persisted canvas-view write.
- Retired model pace persistence: Removed the retired pace recorder's shutdown budget and flush while preserving the bounded shutdown sequence.
- Validated the focused suite:
npm run test:design-modepasses all 724 tests at this head.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

Phase 1a of Design mode v2: the live app canvas, following the 1a plan and its review amendments A1–A26. It also includes the spec and plan updates from three rounds of adversarial review (spec §11 "Resolved before build" and §12 S1–S15).
What changes
The canvas belongs to the workspace. Every chat in a workspace now shares one canvas document (version 3), stored per workspace. The first launch on this build moves canvases to the new layout with a one-time wipe, marked by
.layout-v3indesign-canvases/. Each No workspace chat keeps its own hidden workspace, so it still has a canvas of its own. Only legacy chats with noworkspaceIdsharedefault.Each chat has its own view. The page on screen and where the chat looks on each page are no longer stored in the document:
DesignCanvasViews, persisted touserData/design-canvas-views/<workspaceId>.json. The renderer reads its view on mount (designCanvas:view:get) and reports changes 250 ms after the last one (designCanvas:view).focusId, and main drops reports that haven't seen the newest. Every tool in a turn uses one page resolver (chatPageFor/designTurnPages), in this order: shown this turn, then the message, then the registry, then the first page.Who owns what.
canvas_readandcanvas_commentwork per chat, and queuing another chat's comment moves it to your tray.designCanvas:updatednow carries{workspaceId, chatId, revision}.{ok: false, reason: "moved", workspaceId}, and only that chat's canvas reopens on the new workspace.Lifecycle.
Page fallback. When the page on screen goes away (an undone add or duplicate, or another chat deleting it), the chat returns to the page it showed before, not to page 1. A pan that ends after Aiden switched pages isn't stored on the new page.
Screenshots
Chat A in the workspace is on Page 2, which it added:
Chat B, a new chat in the same workspace, opens the same canvas on its own page (Page 1, which has A's first note):
Chat B's page picker lists the workspace's shared pages:
There's no "before" pair: on
main, every chat had its own canvas, so chat B would open on an empty canvas.Review
d5b1b14e9, and all 10 renderer findings inf78a6b0ef. Each of those behavioral fixes has a test that fails without it.Tests
npx tsc --noEmit,npm run lintandnpm run test:ci-policypass.npm run test:design-modepasses 722 of 722.tests/e2e/design-canvas.spec.tsandtests/e2e/design-mode.spec.ts) passes 13 of 13 in a Cua Space.npm run test, 4 tests fail here, and they fail the same way on this branch's merge base, so this change doesn't cause them:guest-driver-install.test.ts:330;prompt-prefix-stability.test.ts:1068(three tests).Notes
AIDEN_EXPERIMENTAL_DESIGN_LIVEuntil Phase 7. This PR changes no Remote protocol, iOS, Android or CLI contract..layout-v3) when the version is cut.