From eb0d91e13964ff15b420f3c9dc0eff2930325ae3 Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Mon, 23 Nov 2026 15:40:12 -0500 Subject: [PATCH 01/21] Plan design mode v2: the live app canvas 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. --- .memory/design-mode.md | 2 + docs/plans/README.md | 1 + .../2026-11-23-design-mode-live-app-design.md | 543 ++++++++++++++++++ 3 files changed, 546 insertions(+) create mode 100644 docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md diff --git a/.memory/design-mode.md b/.memory/design-mode.md index 004f63ad4..613c3eca2 100644 --- a/.memory/design-mode.md +++ b/.memory/design-mode.md @@ -1,5 +1,7 @@ # 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). Seven phases; Phase 1 (workspace canvas) is next. No v2 code yet. + 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. - Spec: `docs/superpowers/specs/2026-10-31-design-mode-design.md`. Plans: `docs/superpowers/plans/2026-10-31-design-mode-p0-retire-studio.md`, `docs/superpowers/plans/2026-10-31-design-mode-p1-layout.md`. diff --git a/docs/plans/README.md b/docs/plans/README.md index 41885b9f6..5f49540d0 100644 --- a/docs/plans/README.md +++ b/docs/plans/README.md @@ -63,6 +63,7 @@ Research addition 2026-10-03 against `main` at `3f86d41af` (0.52.0): [all-PR inv - [Design mode Tweaks panel](design-mode-tweaks-panel-plan.md) — Built 2026-11-18 on `claude/project-thread-m755wc`, in review (owner answered 1a 2a 3a+b). DialKit-style Tweaks: folders, typed number values, a 2D pad, words and buttons as page controls; saved versions with in-memory pictures and Show all; Shuffle, Send to Aiden, Copy and Make default with Undo; and the same controls floating over a page you are inside. +- [Design mode v2: the live app canvas](../superpowers/specs/2026-11-23-design-mode-live-app-design.md) — Approved 2026-11-23. The workspace's real dev-server routes as live, interactive frames (localhost-only network), one canvas per workspace with a page per chat, Aiden-controlled dev server, Inspect tool (X) with measure and drift checks, element chips into the composer, change toasts, error frames with Fix with Aiden, live directions with Adopt, a Styles frame, the app's design system kept in Google's open `DESIGN.md` format (read, linted and drafted by Aiden), React mock apps for non-web React projects such as Electron apps, and later `*.canvas.tsx` component cards. Seven phases; no code yet. - [Design Studio + Create Images rebuild](design-studio-create-images-rebuild-plan.md) — Active (Create Images only; Design Studio superseded 2026-10-31). Track F (Studio Foundation) merged in [#375](https://github.com/sambitcreate/aiden-agent/pull/375) and [#376](https://github.com/sambitcreate/aiden-agent/pull/376). Create Images CI-1 merged in [#382](https://github.com/sambitcreate/aiden-agent/pull/382) (headless core) and [#383](https://github.com/sambitcreate/aiden-agent/pull/383) (UI and Playwright); CI-1.10 live OpenRouter acceptance passed (owner, 2026-10-08). Design Studio DS-1a (headless core: projects, design runs, partial publish + Resume, preview resolver, IPC) merged in [#385](https://github.com/sambitcreate/aiden-agent/pull/385) (2026-10-08, shipped in 0.55.0); DS-1b was never started. The Design Studio half was superseded 2026-10-31 by [Design mode](../superpowers/specs/2026-10-31-design-mode-design.md); Studio code removed in P0, and `AIDEN_EXPERIMENTAL_DESIGN_STUDIO` no longer does anything. Create Images continues under this plan behind `AIDEN_EXPERIMENTAL_CREATE_IMAGES` (default off). Haiku-built tasks were independently audited on Opus 5.5 and fixed before merge. Create Images viewer, editor History tab, All Images library and always-on auto-save to Pictures merged in [#689](https://github.com/sambitcreate/aiden-agent/pull/689) (2026-11-02, stacked on [#686](https://github.com/sambitcreate/aiden-agent/pull/686)) and shipped in 0.64.0. - [On-device speech engine foundation (STT sub-project 1)](stt-engine-foundation-spec.md) — Merged in [PR #436](https://github.com/sambitcreate/aiden-agent/pull/436), with hardening in #439; shipped in 0.56.0. Plan: [implementation plan](../superpowers/plans/2026-10-09-stt-engine-foundation.md); the smoke run, packaging check and native client tests are recorded in its Progress section and `.memory/stt-engine-foundation.md`. The onboarding voice step is deferred to sub-project 4. First of four Handy-informed speech-to-text sub-projects (engine foundation, live and accuracy, dictation UX, consistency and onboarding). It stays on sherpa-onnx (pinned 1.13.8) and covers: diff --git a/docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md b/docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md new file mode 100644 index 000000000..7a3fb7dec --- /dev/null +++ b/docs/superpowers/specs/2026-11-23-design-mode-live-app-design.md @@ -0,0 +1,543 @@ +# Design mode v2: the live app canvas + +Status: approved by the owner, 2026-11-23. No code yet. Builds on [Design mode v1](2026-10-31-design-mode-design.md) (P0–P5 shipped, on by default). Project memory: `.memory/design-mode.md`. + +## 1. Intent + +The owner wants design mode to put a project's **real, running web app** on an infinite canvas. Every route becomes a live, interactive frame. The person can inspect any element's real values, measure, spot values that break the design system, compare live directions side by side and see component variants. All of it updates within a second of a file save. + +Tools of this kind usually have no agent of their own: the person copies an element reference and pastes it into a separate coding agent. Aiden's edge is that the agent sits in the same window. Pointing goes straight into the composer, errors get a **Fix with Aiden** button, and Aiden itself starts the app, writes routes and arranges the board. + +Why now: v1 draws HTML mockups under `design/`. People building real React apps can't use them for their actual product, and the mockups have to be translated into code afterwards. v2 makes the canvas the app. + +## 2. Owner decisions (2026-11-23) + +1. Frames show the **live interactive app**: dev-server routes, not HTML mockups. +2. **One canvas per workspace.** Each design chat gets its own page on it, and Aiden can change which page a chat uses. +3. App-frame network is **localhost only** for now. +4. **Aiden can start and control everything** in design mode (dev server start, stop, restart, install and config) without per-call approval. +5. A workspace with no web app: Aiden **asks before scaffolding** a small React app into the repo (§6.8). +8. **Monorepos:** Aiden asks which apps to start and work in (§6.2.1). +9. **Live frames are for web apps only.** For a React project that isn't a web app (Electron, for example), Aiden makes React mocks in a mock app to iterate on (§6.8). +10. **Design mode uses the [DESIGN.md](https://github.com/google-labs-code/design.md) standard** for the app's design system (§6.9). +6. **Comment stays on C, exactly as today.** Inspect is a separate tool with its own key, X (§6.4.1). +7. The dev server **starts by itself when the person turns design mode on** (toggle, ⇧⌘L, `/design`, or Enter on Aiden's card). It never starts just because Aiden relaunched (§6.2.3). + +Standing preferences that apply: pre-1.0 means no migrations (delete old shapes), autonomous phase-by-phase execution, and Opus implementers with reviews in the main session. + +## 3. Goals, non-goals, anti-goals + +**Goals** +- G1. Run or attach to the workspace's dev server from design mode. Aiden and the person can both start, stop, restart and read logs. +- G2. Show any route of the app as a live, interactive frame at a real viewport that reflows on resize. +- G3. Point, comment, inspect, measure and edit text inside live app frames, with React component and `file:line` source mapping. +- G4. One shared canvas per workspace. A chat's page is its working area, and every chat can see the whole board. +- G5. Feedback loops: a "saved · N frames updated" toast, changed-frame dots, and error frames with Fix with Aiden. +- G6. Explore live directions (route variants) and **Adopt** one. Run a drift check against the app's own tokens, and show a Styles frame. +- G7. Component cards from `*.canvas.tsx` files (Phase 6, its own spec before build). +- G8. A workspace with no web app can still design: Aiden scaffolds a small React app (see §6.8). + +**Non-goals (v2)** +- Remote, iOS and Android, and Telegram: design mode stays desktop-only and out of the Remote projection. +- Internet access for app frames (decision 3). Apps that fetch remote APIs, fonts or images show those requests failing. This is a known limit, surfaced in the frame (§6.3.5). +- A native GPU canvas, a plugin runtime, or project tabs. +- Non-React frameworks beyond showing their pages. Vue, Svelte and Astro routes can render as frames, but source mapping and component cards are React-only. +- Collaboration beyond what a shared workspace canvas gives (no multi-user presence). + +**Anti-goals** (a failure even if it technically works) +- An app frame that reaches the internet, navigates the canvas away, or touches Aiden's own renderer. +- A dev server that keeps running after the person has left design mode everywhere in that workspace, or after quit. +- Two chats or windows fighting over the shared canvas: page jumps, lost edits or save-conflict storms. +- Aiden running arbitrary shell commands without approval under the "design mode" banner. Only the fixed dev-server actions skip approval (§6.2.4). +- Losing anything v1 does well: comments, drawing and flows, notes, present and export, tweaks and text edit all keep working on the new canvas. + +## 4. Constraints + +- Electron 43, default session, main window `sandbox: true`, `contextIsolation`, no `webviewTag`. The main-window CSP `frame-src` today is `'self' aiden-genui: aiden-design:` (`main-window.html:8`). +- No `defaultSession.webRequest` handlers exist yet. Electron allows one listener per event per session, so the new filter must own each event through one dispatcher. +- Aiden does not bundle Node. Agent commands use the user's PATH with no login-shell lookup today. `devices/device-toolchain.ts` already resolves `npm`/`node` through `$SHELL -ilc` and rejects the Electron binary. +- `backgroundJobs` (`main/services/follow-through/background-jobs.ts`) already supervises long-running processes: process groups, logs, port polling via lsof or `/proc`, crash reaping, and teardown on quit, chat delete and workspace removal. `hostPlatformCapabilities().backgroundJobs` is true on darwin and linux. +- AGENTS.md: + - New analytics events go in the registry, with a docs row and a test. + - The onboarding gallery tile and art must be updated for a materially changed core capability. + - Docs change in the same PR. + - No source-grep tests. + - New test files are registered in `scripts/ci-test-registry.json` and the `package.json` scripts. + - Window-opening E2E runs in a Cua Space, and darwin-specific paths on the host. + +## 5. Approaches considered + +### 5.1 Hosting a live app frame + +| | A. iframe on the canvas, injected from main (**chosen**) | B. Loopback reverse proxy in main | C. `WebContentsView` per frame on its own partition | +|---|---|---|---| +| How | `