Skip to content

Conversation

@google-labs-jules
Copy link

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:

  1. Rust Backend (src-tauri):

    • Added server_mode.rs: An HTTP server that maps API endpoints to internal Rust commands (e.g., /api/list_threads -> core::threads::commands::list_threads).
    • Modified lib.rs: Detects --electron CLI argument. If present, it hides the main window and starts the HTTP server on a random port, printing the port to stdout.
  2. Frontend (web-app):

    • Added isPlatformElectron detection.
    • Updated service.ts to use a new transport layer when running in Electron:
      • UI commands (dialogs) are sent to Electron Main process via IPC.
      • Logic commands (AI, threads, settings) are sent to the Rust sidecar via HTTP fetch.
    • Updated PlatformFeatures to enable desktop features for Electron.
  3. Electron App (electron-app):

    • Created a new package @jan/electron-app.
    • main.ts: Spawns the Rust binary with --electron flag, captures the port, and creates a BrowserWindow.
    • Registers asset:// protocol to serve local files (replacing Tauri's convertFileSrc behavior).
    • Configured electron-builder to bundle the compiled Rust binary and the React frontend assets.
  4. Build System:

    • Added electron-app to Yarn workspaces.
    • Added dev:electron and build:electron scripts to root package.json.

Verification:

  • Verified yarn build:electron successfully packages the application.
  • Verified cargo test passes in src-tauri.
  • Verified web-app builds successfully for web target.

PR created automatically by Jules for task 6661250475688752829 started by @Juude

- 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`.
@google-labs-jules
Copy link
Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant