Skip to content

Latest commit

 

History

History
 
 

desktop

README.md

Desktop

The Electron app. Main hosts the window, serves the UI from apps/web and starts the app server from apps/server as a child process. It is a client: agents run on a CodeWork RPC server, never here.

What It Owns

  • The window and its scheme. Main serves the built UI from codework://app when packaged and codeworkdev://app from the repo, or proxies to a web dev server when CODEWORK_WEB_URL is set.
  • The app server's lifetime. Main runs it with Electron's own binary and ELECTRON_RUN_AS_NODE, so no system Node is needed. If the app server exits, the app quits, and quitting waits for it to stop.
  • The bridge. The renderer is sandboxed and sees only the narrow desktopBridge from the preload: the app server's URL and token, the home folder, a folder picker and reveal.
  • Channels. Each channel (latest, dev, canary, and local from the repo) installs side by side with its own identity and data.

Main holds no CodeWork state and makes no RPC calls of its own. Everything the UI shows comes through the app server, so the app keeps one owner for app.db and one client of each host.

Code Map

Working Locally

From the repository root, with a dev home exported:

vp run dev:desktop

This starts the UI on Vite, watches the Electron and app server bundles, and opens Electron as CodeWork Local. To package a build, run this from apps/desktop:

vp run package <canary|dev|latest> [electron-builder args]   # e.g. latest --mac --arm64 --dir

See development for the dev home and run order, and desktop internals for processes, channels and data.