Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c1ea0d3
docs(plan): design mode v2 Phase 2b (dev server) plan, reviewed
sambitcreate Nov 24, 2026
c0024ef
feat(design): live-app flag capabilities
sambitcreate Nov 24, 2026
39c861e
feat(jobs): a design job owner, argv spawning and a rotating log
sambitcreate Nov 24, 2026
04e49e2
feat(jobs): a design job's sockets with addresses, read fail-closed
sambitcreate Nov 24, 2026
eb4cc34
feat(design): launch plan, readiness and the live-app contract
sambitcreate Nov 24, 2026
7f6200e
feat(design): launch fingerprint, records and the canvas.json writer
sambitcreate Nov 24, 2026
8b341f0
feat(design): pick a free loopback port for the app
sambitcreate Nov 24, 2026
7cf187a
feat(design): report whether the canvas is visible
sambitcreate Nov 24, 2026
98790cf
feat(design): DesignAppServers runs one dev server per app root
sambitcreate Nov 24, 2026
5381108
test(design): dev-server lifecycle against a fake server and real Vite
sambitcreate Nov 24, 2026
885d557
feat(design): the run-app consent card
sambitcreate Nov 24, 2026
0c93b54
feat(design): design_app tool, a reviewed approval exception
sambitcreate Nov 24, 2026
5451e53
feat(design): wire live apps into design mode behind the flag
sambitcreate Nov 24, 2026
f329427
test(design): live app start and stop E2E
sambitcreate Nov 24, 2026
9860e8f
fix(design): lint the server fixtures and the hidden-character class
sambitcreate Nov 24, 2026
cf4aec4
docs(design): Phase 2b docs, spec amendments and memory
sambitcreate Nov 24, 2026
6b8dcd1
Merge remote-tracking branch 'origin/t3/design-mode-v2-dm' into t3/de…
sambitcreate Nov 24, 2026
8bdf659
fix(design): scrub the Bedrock token, escape default-ignorables, refu…
sambitcreate Nov 24, 2026
668faeb
fix(design): a missing /proc/net/tcp6 is an empty table on kernels wi…
sambitcreate Nov 24, 2026
ba06bbc
fix(design): a read-only workspace is no-access at every fresh re-rea…
sambitcreate Nov 24, 2026
69c37ee
fix(design): an app with no lockfile asks once and installs once
sambitcreate Nov 24, 2026
636a561
fix(design): app logs name their run, and a stale cursor reads the la…
sambitcreate Nov 24, 2026
d1f30fb
fix(design): design_app waits past the card's own time, so an unanswe…
sambitcreate Nov 24, 2026
215fe5c
fix(design): origin listeners hear every change to the served origins
sambitcreate Nov 24, 2026
10eff98
fix(design): configured app roots start together when design mode tur…
sambitcreate Nov 24, 2026
24ff954
test(design): the moved-chat case reaches a start path, and the tool'…
sambitcreate Nov 24, 2026
da6c34c
fix(design): canvas presence follows the window's own state, not docu…
sambitcreate Nov 24, 2026
36fd03e
fix(design): a crashed dev server's setsid children, and the last ses…
sambitcreate Nov 24, 2026
aebb60c
fix(design): the run-app card can't hide script lines, keeps its butt…
sambitcreate Nov 24, 2026
93ed5b0
docs(design): live apps in PRODUCT.md, the review fixes in the guide …
sambitcreate Nov 24, 2026
b46bdb2
test(design): the run-app card E2E shows a multi-line pre script, mar…
sambitcreate Nov 24, 2026
80cccbf
docs(plan): Phase 2b is in review as PR #916
sambitcreate Nov 24, 2026
62a4644
fix(design): lsof diagnostics fail the socket look closed, even next …
sambitcreate Nov 24, 2026
dce8fba
fix(design): choose always gets its own card, and an unsaved choice r…
sambitcreate Nov 24, 2026
459ad52
fix(design): a stop asked for after a choose drops the choose
sambitcreate Nov 24, 2026
093f4d3
fix(design): the Design toggle and the design-mode card use the desig…
sambitcreate Nov 24, 2026
8b31e81
fix(design): launch consent covers the checkout, not only its launch …
sambitcreate Nov 24, 2026
fd0160c
fix(design): installs and servers spawn in the checkout the consent c…
sambitcreate Nov 24, 2026
d1c353e
fix(design): spawns use the exact app and install folders the surface…
sambitcreate Nov 24, 2026
1649cd7
fix(design): right before a spawn, the validated folders must still b…
sambitcreate Nov 24, 2026
25abd8b
fix(design): folder identities use exact 64-bit device and inode numbers
sambitcreate Nov 24, 2026
4e7c54b
Merge remote-tracking branch 'origin/t3/design-mode-v2-dm' into t3/de…
sambitcreate Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .memory/design-mode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Design mode

v2 (2026-11-23): owner approved the live app canvas spec `docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md` (live dev-server routes as frames, localhost-only, one canvas per workspace with a page per chat, Aiden-controlled dev server, Inspect tool X, DESIGN.md as the design-system source, React mock apps for non-web React projects). Pre-build checks are in spec §11 (`@google/design.md` 0.4.0: Apache-2.0, `/linter` `lint(content)` offline; v1 `design-system*.ts` removed in 3d (S6), except the scanner, which moved to `design-md/style-scan.ts` (S37); no default-session `webRequest` listener exists; E2E fixture symlinks root `node_modules`). The PR split was revised in §8: 1a must move every `activePageId` reader at once (tools, placement, focus with `pageId`, renderer view store), and 1b only writes `chatPages` and handles lifecycle. Phase 1a plan: `docs/superpowers/plans/2026-11-23-design-mode-v2-p1a-workspace-canvas.md`, built 2026-11-23 on `t3/design-mode-live-app-plan`, PR #894 opened 2026-11-23 after code review fixes (main `d5b1b14e9`, renderer `f78a6b0ef`); see "v2 Phase 1a" below. Key 1a decisions: `DesignChatCanvases` adapter (chat → workspace) so callers keep chat ids; a `.layout-v3` marker in `design-canvases/` triggers the one-time wipe; `designCanvas:updated` carries `workspaceId`; each No workspace chat has its own hidden workspace and so its own canvas (only legacy chats with no `workspaceId` share `default`). An adversarial plan review on 2026-11-23 added amendments A1–A12 to the 1a plan (origin `chatId` on updates, comment tray filtered by chat in 1a, per-window ordered views, Aiden's page change applied in main at once, attach merges the hidden canvas). An adversarial spec review the same day added §12 S1–S15: subframe `will-redirect` fix, a per-workspace start consent with a script-text hash plus a read-only refusal, a fail-closed null-frame rule, `file://` cookie handling, a narrowed network guarantee, a `design` job owner, an install stamp, a permission dispatcher shared with Gemini Live, no `allow-modals`, untrusted bridge output, Vite-client HMR, loopback binding, and 2b–5 behind `AIDEN_EXPERIMENTAL_DESIGN_LIVE` until Phase 7. Phase 2a (app detection: `node-toolchain.ts` lift, `detectWebApp`, `resolveAppToolchain`; no caller until 2b) built 2026-11-24 on `t3/design-mode-v2-p2a`, stacked on PR #908; see "v2 Phase 2a" below and spec S19–S24.
v2 (2026-11-23): owner approved the live app canvas spec `docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md` (live dev-server routes as frames, localhost-only, one canvas per workspace with a page per chat, Aiden-controlled dev server, Inspect tool X, DESIGN.md as the design-system source, React mock apps for non-web React projects). Pre-build checks are in spec §11 (`@google/design.md` 0.4.0: Apache-2.0, `/linter` `lint(content)` offline; v1 `design-system*.ts` removed in 3d (S6), except the scanner, which moved to `design-md/style-scan.ts` (S37); no default-session `webRequest` listener exists; E2E fixture symlinks root `node_modules`). The PR split was revised in §8: 1a must move every `activePageId` reader at once (tools, placement, focus with `pageId`, renderer view store), and 1b only writes `chatPages` and handles lifecycle. Phase 1a plan: `docs/superpowers/plans/2026-11-23-design-mode-v2-p1a-workspace-canvas.md`, built 2026-11-23 on `t3/design-mode-live-app-plan`, PR #894 opened 2026-11-23 after code review fixes (main `d5b1b14e9`, renderer `f78a6b0ef`); see "v2 Phase 1a" below. Key 1a decisions: `DesignChatCanvases` adapter (chat → workspace) so callers keep chat ids; a `.layout-v3` marker in `design-canvases/` triggers the one-time wipe; `designCanvas:updated` carries `workspaceId`; each No workspace chat has its own hidden workspace and so its own canvas (only legacy chats with no `workspaceId` share `default`). An adversarial plan review on 2026-11-23 added amendments A1–A12 to the 1a plan (origin `chatId` on updates, comment tray filtered by chat in 1a, per-window ordered views, Aiden's page change applied in main at once, attach merges the hidden canvas). An adversarial spec review the same day added §12 S1–S15: subframe `will-redirect` fix, a per-workspace start consent with a script-text hash plus a read-only refusal, a fail-closed null-frame rule, `file://` cookie handling, a narrowed network guarantee, a `design` job owner, an install stamp, a permission dispatcher shared with Gemini Live, no `allow-modals`, untrusted bridge output, Vite-client HMR, loopback binding, and 2b–5 behind `AIDEN_EXPERIMENTAL_DESIGN_LIVE` until Phase 7. Phase 2a (app detection: `node-toolchain.ts` lift, `detectWebApp`, `resolveAppToolchain`; no caller until 2b) built 2026-11-24 on `t3/design-mode-v2-p2a`, stacked on PR #908; see "v2 Phase 2a" below and spec S19–S24. Phase 2b (the dev server: `DesignAppServers`, the run-app card, `design_app`, `designApp:*` IPC) built 2026-11-24 on `t3/design-mode-v2-p2b`, stacked on DM, behind the live flag; see "v2 Phase 2b" below and spec S25–S32.

Status: active. P0 (retire Studio), P1 (layout shell) and P2 (canvas and frames, Tasks 1–7) are done. The Mac Studio work was pushed as `claude/design-mode-deep-dive` on 2026-11-05, then merged with `origin/main` on `claude/project-thread-29fzrr` (the PR branch). P3 (Aiden on the canvas) is done (2026-11-05, P3a–P3d, on the PR #778 branch), plan `docs/superpowers/plans/2026-11-05-design-mode-p3-aiden-on-canvas.md`. P3a (canvas tools) is done: `main/services/design-canvas/canvas-tools.ts` (four tools, 20 calls per turn at the time, 60 now, `designCanvasToolsAllowed` gate, `DESIGN_MODE_PROMPT_SECTION`), wired in `llm-client.ts` as the `aiden.design-canvas` runtime extension (static prompt section; since 2026-11-18 the `canvasPromptLine` counts go to the transcript as a `design-canvas-status` section note via `withCanvasStatusNote`, only when they changed, instead of a volatile system prompt line). P3b (artifact frames) is done: `artifact-frames.ts` places committed `render_artifact` visuals after `generativeUiArtifactStore.commit` (never on a failed turn), same-title Aiden frames swap `mediaId` and keep their box; `ArtifactNode` keys its loaded src by mediaId. P3c (skill) is done: `design-canvas/skill.ts` (`aiden-design`, `DESIGN_CANVAS_SKILLS`), registered in `skill-registry-main.ts` only when the flag is on, dropped by `withoutSkills` unless `designCanvasOffered` in llm-client, and from Remote and Telegram catalogs. P3d is done: `design-mode-tool.ts` (`DesignModeConsent`, `design_mode`, on-demand), `canvas-snapshots.ts`, card `renderer/design/design-mode-consent.tsx`, focus store `renderer/design/canvas-focus-requests.ts`; canvas tools held back and added by `withEnteredCanvasTools` after Enter; new tests must also go in `scripts/ci-test-registry.json` or `npm test` fails its registry check. P4 plan (owner chose everything in their reference screenshots): `docs/superpowers/plans/2026-11-05-design-mode-p4-full-canvas.md`; P4a built 2026-11-05, P4e, P4b, P4c, P4d, P4f, P4g and P4h built 2026-11-06, P5 (launch) built 2026-11-06. Placement moved to `renderer/shared/design-canvas/placement.ts`; summaries in `canvas-summary.ts`. P4–P5 plans are written before each phase.

Expand Down Expand Up @@ -406,3 +406,18 @@ Branch `t3/design-mode-v2-dm`, stacked on PR #911 (2a). Lands before 2b. Plan `d
- Events: `design_md_linted` (once per new content per run, never for content lints or the IPC) and `design_md_drafted {source: "app"}` (a drafted target that exists at a delivered turn's end).
- IPC `designCanvas:designSystem {chatId, appRoot?}`: read only, no event, needs the live flag, not design mode; `designCanvasApi.designSystem` has no UI yet (Phase 5).
- Packaging: `build.files` drops the CLI `dist/index.js`, top-level `dist/spec.md` and `dist/spec-config.yaml`, `dist/linter/spec.md` and the nested `node_modules/`, and (after code review) the 18 packages only `@google/design.md` reaches (`DESIGN_MD_ONLY_DEPENDENCIES`; a lockfile-walk test fails if another production dependency needs one). `verifyPackagedDesignMdLinter` (macOS and Linux package checks) requires the worker and linter as packed files, the trimmed files absent, and lints a fixture with the extracted linter. `npm run test:design-md:packaged` launches the release app and reads DESIGN.md over the IPC (release workflow). A local unsigned `--dir` build passed the check; the linter adds about 0.7 MB to the asar. No PR workflow packages macOS, so the packaged acceptance runs only at release. `canvas-config.ts` also exports `configuredRoots` (R2 step 1, for 2b) and `readCanvasConfigText` returns a reason (`missing | link | too-large | unreadable`) or `ok` text; `studioCapabilities()` has `designLive`.

## v2 Phase 2b: dev server (2026-11-24)

Branch `t3/design-mode-v2-p2b`, stacked on DM (`t3/design-mode-v2-dm`). Plan `docs/superpowers/plans/2026-11-24-design-mode-v2-p2b-dev-server.md` (its "As built" lists every deviation); spec S25–S32; guide `docs/design-mode.md` "Live apps (experimental)". Behind `designLiveEnabled()` (DM's flag); macOS and Linux only (relies on `backgroundJobs`).
- Layout under `main/services/design-canvas/app-server/`: `app-detect.ts`, `app-toolchain.ts`, `app-server-core.ts` (2a); `app-launch-core.ts` (pure: launch plan and flags, env scrub `launchEnvironment`, `providerKeyNames`, install decision, readiness port pick, `isAddressInUse`, `missingModuleHint`, `lastLines`); `app-fingerprint.ts` (`readLaunchSurface`: hashed scripts, rc/workspace/lockfile/config files, refuses links, special files and scripts over 4 000 chars); `app-records.ts` (`userData/design-apps.json`: approved fingerprint, `installShown`, Aiden's install stamp, sticky port); `app-ports.ts` (`chooseAppPort`, `defaultOsPort`, loopback only); `app-consent.ts` (`DesignAppConsent`, one card per key, 16 waiting, 2 min, owner-checked answers); `app-server-main.ts` (`DesignAppServers`); `app-tool.ts` (`design_app`). Contract for 2c and 3a: `renderer/shared/design-app.ts` (status, problems, consent union, fixed messages, `consentDisplayText`).
- Jobs: background jobs' `design` owner (cap 8, argv spawn, 25 MB rotating log keeping 50 MB, byte-offset `readDesignLog`, `designSockets` via `follow-through/listening-ports.ts`, failing closed; `onDesignChange` on start, end and port changes only, never output). `stopDesign` also signals setsid descendants found by parent pid before any signal.
- Consent: before every spawn, detection, toolchain and fingerprint run again and the argv is rebuilt; `approveShown` must match what the card showed. The fingerprint (v3) includes `checkout`, the workspace folder's realpath, so a re-pointed or moved checkout asks again. Reasons `first | changed | install | choose`. Every app start for a chat (designApp:* channels, the Design toggle, the design-mode card's Enter) goes through `chatRunsDesignApps` (no `botId`, no `owner`). Toolchain problems answer before any card. Aiden's request for a declined key gets no second card; the person's always asks.
- Install: only for a missing `node_modules`, an unfinished or stale Aiden install, or on request; never over the person's own install; never when the lockfile is outside the workspace.
- Origin `http://127.0.0.1:<port>`. Readiness needs an IPv4 loopback port the job's tree holds (2 min of quiet, 10 min cap; output resets quiet at the next poll). One shared poller (500 ms starting, 2 s running, no overlapping ticks) checks every socket is loopback; 3 failed reads or one wildcard listener stops the server (`exposed` / `exposure-unknown`). Address-in-use retries once on an OS port.
- Presence: `designCanvasViews.visible(workspaceId)` counts visible canvases (pane shown and document visible, reported by `use-design-view.ts`); 60 s after none (E2E knob `AIDEN_E2E_DESIGN_APP_GRACE_MS`, unpackaged only, 1–60 s) the server stops. Each attempt holds a `workspaceMutationGate` admission; a folder or access change stops it.
- Wiring: `design-canvas/main.ts` builds `designAppServers` and `designAppConsent`; `main/index.ts` connects `backgroundJobs`/`onDesignJobChange` (`connectDesignAppJobs`, because llm-client loads follow-through lazily) and `designAppRecoveryDone(processRecoveryReady)`. Turning design mode on (toggle, ⇧⌘L, `/design`, or Enter on Aiden's card) calls `designModeEntered` with the window's owner. Workspace removal forgets its apps (`createDesignWorkspaceCleanup` `apps`).
- IPC (`main/handlers/design-app.ts`, prefix `designApp:`, all through `rendererDocumentOwner`, attended desktop chats with a folder): `status:get`, `start`, `stop`, `restart`, `choose`, `logs`, `consentAnswer`; notifications `designApp:status` (snapshot per workspace), `designApp:consent`, `designApp:consentClosed`. Renderer: `designAppApi` in `renderer/lib/ipc.ts`; card `renderer/design/design-app-consent.tsx` (mounted in `chat-pane.tsx`), problem toasts for person-started apps (`DesignAppProblemToasts` in `app.tsx`).
- Tool: `design_app` joins the canvas tools when the flag and follow-through are available; `REVIEWED_CARDLESS_TOOLS` in `workspace-tool-approval.ts` skips its per-call card (hooks and rules still apply, never judged); 4 starts per turn; waits for the card then 90 s; abort ends the wait only.
- Event `design_app_started {framework, manager?, outcome}`.
- Tests: `app-*.test.ts` (core-git lane), `app-server-process.test.ts` (macos lane; real processes, fixtures in `tests/fixtures/design-app-server/`, the repo's Vite), `main/handlers/design-app.test.ts`, `renderer/design/design-app-consent.test.tsx` (renderer-other), all in `test:design-mode`; E2E `tests/e2e/design-app-server.spec.ts`.
Loading
Loading