feat: Add Electron support via Rust sidecar#2
Conversation
- Created `electron-app` workspace to wrapper the application in Electron. - Modified `src-tauri` to support a `--electron` flag that runs in headless server mode. - Implemented `server_mode.rs` in `src-tauri` to expose internal commands via HTTP. - Updated `web-app` to detect Electron platform and route API calls to the local HTTP server or Electron IPC. - Implemented `asset://` protocol in Electron to support local file access. - Updated build scripts to support `yarn build:electron` and `yarn dev:electron`.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Created `electron-app` workspace to wrapper the application in Electron. - Modified `src-tauri` to support a `--electron` flag that runs in headless server mode. - Implemented `server_mode.rs` in `src-tauri` to expose internal commands via HTTP. - Updated `web-app` to detect Electron platform and route API calls to the local HTTP server or Electron IPC. - Implemented `asset://` protocol in Electron to support local file access. - Updated build scripts to support `yarn build:electron` and `yarn dev:electron`. - Updated `.gitignore` to exclude build artifacts.
- Added unit tests for argument parsing in `server_mode.rs`. - Created `.github/workflows/jan-electron-build-nightly.yaml` to automate testing, building, and releasing Electron builds. - Added GitHub Actions to build for Linux, macOS, and Windows. - Configured uploading of artifacts to a nightly release tag.
- Added unit tests for argument parsing in `server_mode.rs`. - Created `.github/workflows/jan-electron-build-nightly.yaml` to automate testing, building, and releasing Electron builds. - Added GitHub Actions to build for Linux, macOS, and Windows. - Configured uploading of artifacts to a nightly release tag.
This PR adds support for compiling and running the Jan application using Electron, while reusing the existing Rust backend as a sidecar process.
Key changes:
Rust Backend (
src-tauri):server_mode.rs: An HTTP server that maps API endpoints to internal Rust commands (e.g.,/api/list_threads->core::threads::commands::list_threads).lib.rs: Detects--electronCLI argument. If present, it hides the main window and starts the HTTP server on a random port, printing the port to stdout.Frontend (
web-app):isPlatformElectrondetection.service.tsto use a new transport layer when running in Electron:fetch.PlatformFeaturesto enable desktop features for Electron.Electron App (
electron-app):@jan/electron-app.main.ts: Spawns the Rust binary with--electronflag, captures the port, and creates a BrowserWindow.asset://protocol to serve local files (replacing Tauri'sconvertFileSrcbehavior).electron-builderto bundle the compiled Rust binary and the React frontend assets.Build System:
electron-appto Yarn workspaces.dev:electronandbuild:electronscripts to rootpackage.json.Verification:
yarn build:electronsuccessfully packages the application.cargo testpasses insrc-tauri.web-appbuilds successfully for web target.PR created automatically by Jules for task 6661250475688752829 started by @Juude