plans/desktop-mobile-web-unification.md
Generated by swarm planning workflow on 2026-02-15
Evolve Dyad from a desktop-only Electron runtime into a multi-platform product with one core experience available on desktop, web, and mobile. Preserve Dyad's local-first strengths on desktop while introducing a secure cloud execution runtime that powers equivalent capabilities on web/mobile where local process and filesystem access are unavailable. Deliver this in phased releases with strict compatibility, observability, and rollback controls.
Dyad's architecture currently assumes a privileged local host (Electron main process) that can mutate files, spawn processes, run git/npm/docker, handle native protocol links, and store secrets via OS APIs. That creates three constraints:
The core user problem is cross-device continuity for AI app building without losing the trust, transparency, and production-grade workflows Dyad already supports.
This plan explicitly preserves Dyad's principles:
Backend-Flexible: runtime providers (local host, cloud runtime) are pluggable behind one capability interface.Productionizable: generated code remains standard user-owned code; cloud runtime is execution infrastructure, not a proprietary app runtime.Intuitive + Power User Friendly: default paths are simplified, advanced knobs remain available per host.Transparent Over Magical: every remote execution action is surfaced with logs, diffs, approvals, and host/source labels.Bridge, Don't Replace: existing git, npm, Docker, Supabase workflows continue; web/mobile use remote bridges where local host access is impossible.Delightful: consistent high-quality interactions across platforms with platform-native ergonomics.LocalHost (desktop) + CloudHost (web/mobile, optional desktop).Global top-level structure across platforms:
Every execution surface displays host source:
Local Host (Desktop)Cloud Host (Region)Every action card includes:
user, assistant, system)write, rename, command, git, sql, etc.)Desktop:
Local, Cloud, Hybrid later).Web:
Mobile:
Introduce a Host Capability Layer and split concerns:
Client Shells
Shared Product Core
Host Providers
ElectronLocalHostProvider (desktop local)CloudHostProvider (web/mobile + optional desktop)Dyad Cloud Runtime Services
Define one canonical interface consumed by shared product logic:
host.project.readFile/writeFile/rename/delete/list/searchhost.exec.runCommand/stop/streamLogshost.git.*host.preview.start/stop/getUrlhost.db.executeSql (or delegated integration service)host.secrets.get/set/listScopeshost.system.openExternal/showInFolder (optional capability)host.session.*Each method includes:
Desktop local:
Web/mobile:
Introduce platform-neutral IDs and workspace ownership:
workspacesprojectsproject_hosts (local/cloud binding + capabilities)sessionsoperationsoperation_logscredentials (scoped/rotatable/encrypted)runtime_instancesDesktop local DB remains for local-only metadata and cache; cloud state is source of truth for cloud projects.
owner, admin, editor, viewer).rm, destructive SQL, force push).v1: legacy IPC contractsv2: host API contractssrc/main.ts — split shell bootstrap from capability execution wiring.src/preload.ts + src/ipc/preload/channels.ts — transition to host adapter entrypoints.src/ipc/contracts/core.ts + src/ipc/types/* — extract reusable contract/core package.src/ipc/handlers/* — split into:
src/ipc/processors/response_processor.ts — host-agnostic operation application engine.src/ipc/handlers/chat_stream_handlers.ts — move stream orchestration into shared domain + host-specific execution delegates.src/main/settings.ts — evolve to multi-host config model.src/db/* — local cache role clarification and migration helpers.packages/core-domain/
packages/contracts/
packages/client-sdk/
packages/ui-shared/
apps/desktop-electron/apps/web/apps/mobile/services/runtime-api/services/runtime-worker/services/git-api/services/ops-audit/Core, Advanced, Desktop-only).p95 latency, stream reliability, runtime startup time).Exit criteria:
packages/contracts from src/ipc/contracts + src/ipc/types.packages/core-domain for shared orchestration logic.Exit criteria:
ElectronLocalHostProvider that wraps existing handlers.chat stream, response apply, run app, git) through host interface.supportsProcess, supportsNativeDialogs, etc.).Exit criteria:
runtime-api service with authn/authz + workspace/project model.runtime-worker for isolated filesystem/process execution.Exit criteria:
CloudHostProvider SDK in client packages.Local, Cloud).Exit criteria:
apps/web shell using shared core/domain/contracts.Exit criteria:
apps/mobile shell with shared domain and cloud provider.Exit criteria:
Exit criteria:
Exit criteria:
Exit criteria:
Exit criteria:
Exit criteria:
| Current Desktop-Tied Change Area | Why It Breaks on Web/Mobile | Planned Solution | Migration Steps | Risks | Mitigations |
|---|---|---|---|---|---|
| Electron window lifecycle | Browser/mobile don't expose app-level window control APIs | Abstract window controls as optional capabilities; no-op/alt UX on web/mobile | Add capabilities.system.windowControls checks and branch UI actions | UX inconsistency | Platform-specific UI patterns with explicit affordances |
| Preload/IPC channel model | No contextBridge outside Electron | Replace IPC with shared host API transport adapters | Build client-sdk with IPC adapter + HTTP/WS adapter | Contract drift | Shared contract package + compatibility tests |
Direct FS mutation (fs, recursive ops) | Browser sandbox and mobile filesystem constraints | Move FS ops to cloud runtime service for web/mobile | Route all file ops through host provider interface | Latency, partial failures | Operation queue + optimistic UI + retry/idempotency |
Local process spawn (spawn, npm, pnpm, docker) | Impossible in browser and limited on mobile | Cloud execution workers provide command runtime | Map command operations to runtime API endpoints | Multi-tenant security | Sandbox isolation, policy engine, egress restrictions |
| Local git binaries and repo operations | Browser/mobile lack full git CLI integration | Cloud git service + optional libgit implementation | Wrap existing git utils behind host provider | Repo corruption/conflicts | Transactional git ops + snapshot + conflict UI |
| Local SQLite + settings files | Different storage semantics across platforms | Split metadata: cloud source of truth + local cache | Introduce workspace/project cloud schema and cache layer | Data divergence | Versioned sync protocol + conflict resolution policies |
safeStorage OS secret encryption | Not portable to web runtime | Centralized secret vault + device secure storage for tokens | Migrate secrets to scoped vault entries | Secret exposure | KMS encryption, short-lived tokens, RBAC + audit |
dyad:// protocol deep links | Different deep-link systems per platform | Unified auth/deeplink router abstraction | Implement desktop protocol + web redirect + mobile deep links | Auth loop bugs | End-to-end deep-link integration tests |
| Auto-update packaging model | Web/mobile release channels differ | Per-platform release orchestration | Desktop keeps auto-update; web CI deploy; mobile app-store release tracks | Version skew | API contract version checks + forced upgrade gates |
| Clipboard/screenshot/system dialogs | Limited browser/mobile APIs | Capability-based action model with platform fallbacks | Add capabilities.system.* gating and alternate UX | Missing features confusion | UI labels for unavailable actions + docs |
| Node PATH / environment probing | Not meaningful in web/mobile | Host-specific environment diagnostics | Keep on desktop only; cloud diagnostics endpoints for remote runtime | Support complexity | Host-tagged diagnostics bundle |
| Local preview proxy assumptions | Remote preview URLs and CORS/security differences | Cloud preview gateway + signed access tokens | Refactor preview proxy to support remote sources | Security headers misconfig | Security review + automated integration checks |
| Local-only backup/reset semantics | Cloud data is multi-tenant and persistent | Cloud snapshot/restore service | Replace destructive reset with scoped project reset endpoints | Accidental data loss | Confirmation gates + point-in-time restore |
| Existing e2e Electron-only test harness | No coverage for web/mobile runtime paths | Multi-platform CI matrix and contract tests | Add web playwright, mobile detox/appium flows, shared contract test suite | Test explosion | Risk-based test pyramid + shared fixtures |
Host API v1:
Host API v2 (follow-up):
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Cloud runtime complexity delays schedule | High | High | Phase gates, strict MVP slice, dedicated platform team |
| Desktop regressions during refactor | Medium | High | Adapter-first migration, dual-path fallbacks, heavy regression e2e |
| Security incident in remote execution | Medium | High | Defense-in-depth sandboxing, policy engine, external security review |
| Cost overrun for cloud execution | High | Medium | Quotas, metering, auto-hibernate, runtime class tiers |
| Poor mobile UX if desktop parity is forced | Medium | Medium | Mobile-native scope (review/approval first), defer full IDE parity |
| Data migration failures | Medium | High | Dry-run validation, reversible migrations, snapshot restore |
| API version drift across clients | Medium | Medium | Shared contracts package, CI compatibility gates |
| Adoption confusion (local vs cloud modes) | Medium | Medium | Clear host labels, onboarding decision guides, safe defaults |
Product:
Reliability:
Business: