Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 15 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` used only by `main.ts`, deleted in 3b; 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.
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` used only by `main.ts`, deleted in 3b; 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.

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 @@ -379,3 +379,17 @@ Branch `t3/design-mode-v2-p1b`, stacked on PR #894. Plan `docs/superpowers/plans
- Lifecycle: `forgetChat(chatId, workspaceId, scope)`: `comments` before a delete commits, `all` (claim, `namedFor`, artifact frames) after; `move` for `moveEmptyToWorkspace` (also deletes an empty page made for the chat). Startup recovery uses `recoverDeletedChatCanvas` (cleanup.ts); when the chat's metadata is already gone (crash after the remove) it runs `all` on every canvas (`DesignCanvasStore.workspaceIds`), because the pending-deletion marker lives in the subagent run stores' strict V1 format and can't carry a workspace id. Attaching from a shared legacy No workspace canvas runs `move` on it. Attach carry claims the first carried page; at a full `chatPages` it asks liveness and evicts gone chats, else skips only the claim.
- Picker (`design-toolbar.tsx`): trailing tertiary label "This chat", "This chat · N more", "1 chat", "N chats"; accessible name "Page 1, This chat". Counts only, from the doc. Only entry, `canvas_page use` and `canvas_page delete` drop leftover claims and `namedFor` marks of chats that are not live; other `canvas_page` actions and other writes don't.
- E2E: `tests/e2e/design-canvas.spec.ts` "two chats on one workspace…" (screenshot `1440-canvas-two-chats-{light,dark}.png` in the test's output folder).

## v2 Phase 2a: app detection (2026-11-24)

Branch `t3/design-mode-v2-p2a`, stacked on PR #908. Plan `docs/superpowers/plans/2026-11-24-design-mode-v2-p2a-app-detection.md`; spec S19–S24.
- Layout: `main/services/node-toolchain.ts` (shared lookup: PATH, then `$SHELL -ilc "command -v <cmd>"`, then Homebrew; fixed `ToolCommand` union checked at runtime; optional `ExecutableCache` of validated login-shell answers; `isStandaloneNodeExecutable(…, { minMajor })`; `prependPathEntries`, `nodeCommandEnvironment(env, binDirs)`). `main/services/design-canvas/app-server/`: `app-server-core.ts` (pure R2–R5, R8, R10 and pattern helpers), `app-detect.ts` (`readBounded`, `detectWebApp`, the only disk reader), `app-toolchain.ts` (`resolveAppToolchain`, `defaultAppToolchainDeps`, `toolchainProblemMessage`).
- Devices: Task 1 (own commit) made `deviceNodeEnvironment`, `androidSdkEnv` and `createNpmRunner` drop empty PATH entries. The lift kept every `device-toolchain.ts` export as a wrapper (Node 22, npm lookup with Node's default buffer, Node lookup at 16 KiB, no cache). The oracle was the existing device tests unedited plus Task 1's cases and two argv guards.
- R3: `dev`, `start`, `serve`; a script running the framework's dev command wins; otherwise the first that isn't a build, production run, Storybook or workspace runner. Word matching on script text, not a shell parser.
- R4 order: invalid package.json; desktop shell (Electron, Tauri) with React → `react-nonweb desktop`, without → `none desktop`; framework + script → `web`; runner script or `nx.json`/`turbo.json`/`lerna.json` → `workspace-runner`; React Native/Expo; framework with no dev/start/serve and no Storybook → `no-dev-script`; usable script, no framework → `unknown-framework`; React → `react-nonweb`; else `none`.
- R5: field wins only with no lockfile or its own (else conflict with `field` set); two managers' lockfiles conflict; a single install marker in `node_modules` settles a conflict (`source: "installed"`, conflict kept); `pnpm-workspace.yaml` → pnpm; Deno → `unsupported`; nothing → npm `none`. Yarn flavour: field major, else `.yarnrc.yml`, `.pnp.cjs` or `__metadata:` in the 512-byte lock head.
- R6: members without their own lockfile install at `.`; a candidate with its own lockfile is its own install root. The enclosing walk runs only when the root has no lockfile, field, `pnpm-workspace.yaml`, Deno marker or `.git`; it stops at `.git`, home, `stopAt` (after realpath) and five levels, and reports only `lockfileLevelsUp`.
- Remix 3 (checked against `remix@3.3.0`): dev command `node --watch`, port 44100. TanStack Start's starter uses port 3000. Only npm gets `--` before extra script arguments (pnpm 12 and Yarn 4 pass a bare `--` through).
- Node 22 for design, the same as devices. No corepack fallback; 2b sets `COREPACK_ENABLE_DOWNLOAD_PROMPT=0` (S19).
- Nothing calls the design modules until 2b. Tests: `node-toolchain.test.ts` (in `test:devices`), `app-server-core.test.ts`, `app-detect.test.ts`, `app-toolchain.test.ts` (in `test:design-mode`).
- Code review fixes (2026-11-24): the agent-device launcher and `run`'s no-Node branch also drop empty PATH entries (plan Q7 settled). Follow-up: `ssh-device-script.ts:26` builds the remote PATH as `…:$PATH`. Detection: the enclosing walk's signal counts only when that folder's `workspaces`/`pnpm-workspace.yaml` lists the workspace; hand-off root scripts (`-w`/`--workspace`/`--prefix`/`--dir` next to a package manager, `yarn workspace`, `pnpm -C`, `concurrently`, `npm-run-all`, `run-p`) are runners; a workspace root is `web` only through the framework's own dev command; a framework app with only production scripts is `no-dev-script`; `clearAppToolchainCache()` for 2c's Retry; conflict messages say how to fix, with plural wording for 3+ managers.
4 changes: 4 additions & 0 deletions .memory/devices-ssh-hosts-toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ This is sibling C of the devices-parity effort (six parallel implementers). It p
- No protocol, mobile DTO, release fuse, provider, or startup network changes. Packaged runtime smoke and PR validation results are recorded in the PR.
- Local validation: device suite 598/598; simulator stream + agent Electron E2E 2/2; type-check, E2E type-check, ESLint and production build passed. An isolated ASAR Electron 43.1.1 app with RunAsNode disabled launched the actual installed expo-device-hub 0.12.0 through standalone Node and received readyz HTTP 200. This is runtime smoke evidence, not a notarized Aiden release or physical-device acceptance.
- PR #447 review follow-up: Node discovery is best effort during daemon shutdown so missing Node cannot block consent revocation, token-config deletion, tool removal or proxy closure. Missing Node uses a recoverable setup error, preserving Settings' existing Retry action. Tests exercise real service removal/revocation and the service-produced Settings error followed by successful Retry. Device suite now passes 600/600.

## Shared Node toolchain and PATH fix (2026-11-24)
- Node and npm resolution now lives in `main/services/node-toolchain.ts`, shared with design mode's live app (v2 Phase 2a). `device-toolchain.ts` keeps the same exports (`resolveNpm`, `defaultNpmResolutionDeps`, `resolveDeviceNode`, `defaultDeviceNodeResolutionDeps`, `isDeviceNodeExecutable`, `deviceNodeEnvironment`, `NpmResolutionDeps`) as wrappers with the device settings: Node 22+, no cache, npm lookup with Node's default buffer, Node lookup at 16 KiB.
- `deviceNodeEnvironment`, `androidSdkEnv` and `createNpmRunner` build PATH through `prependPathEntries`, which drops every empty entry (an empty entry means the working folder). The generated agent-device launcher does the same in its own text, and `run` drops inherited empty entries for commands that start before Node is resolved (an unset PATH stays unset). Follow-up: `ssh-device-script.ts:26` (remote `…:$PATH`).
2 changes: 1 addition & 1 deletion docs/plans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +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. Pre-build checks done and the PR split revised (1a, 1b, 2a–2c, 3a–3d, DM, 4, 5, 7, 6) on 2026-11-23; Phase 1a (workspace canvas document) built 2026-11-23 on `t3/design-mode-live-app-plan`, in review as [PR #894](https://github.com/sambitcreate/aiden-agent/pull/894), plan [p1a](../superpowers/plans/2026-11-23-design-mode-v2-p1a-workspace-canvas.md). Phase 1b (chat pages) built 2026-11-24 on `t3/design-mode-v2-p1b`, in review as [PR #908](https://github.com/sambitcreate/aiden-agent/pull/908), stacked on PR #894, plan [p1b](../superpowers/plans/2026-11-23-design-mode-v2-p1b-chat-pages.md).
- [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. Pre-build checks done and the PR split revised (1a, 1b, 2a–2c, 3a–3d, DM, 4, 5, 7, 6) on 2026-11-23; Phase 1a (workspace canvas document) built 2026-11-23 on `t3/design-mode-live-app-plan`, in review as [PR #894](https://github.com/sambitcreate/aiden-agent/pull/894), plan [p1a](../superpowers/plans/2026-11-23-design-mode-v2-p1a-workspace-canvas.md). Phase 1b (chat pages) built 2026-11-24 on `t3/design-mode-v2-p1b`, in review as [PR #908](https://github.com/sambitcreate/aiden-agent/pull/908), stacked on PR #894, plan [p1b](../superpowers/plans/2026-11-23-design-mode-v2-p1b-chat-pages.md). Phase 2a (app detection) planned and built 2026-11-24 on `t3/design-mode-v2-p2a`, in review as [PR #911](https://github.com/sambitcreate/aiden-agent/pull/911), stacked on PR #908, plan [p2a](../superpowers/plans/2026-11-24-design-mode-v2-p2a-app-detection.md).
- [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:
Expand Down
Loading
Loading