feat: Add Electron support via Rust sidecar #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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