amica icon indicating copy to clipboard operation
amica copied to clipboard

Feat/migrate to electron

Open AlphaEcho11 opened this issue 4 months ago • 4 comments

Testing Electron (Rust) build

Summary by CodeRabbit

  • New Features

    • Desktop app now runs via Electron with a secure bridge for blocking/streaming requests and sidecar control.
    • Chat streaming and non-streaming requests are proxied through the desktop app; clearer errors when API key is missing.
  • Documentation

    • Added a comprehensive local deployment guide with configuration, build, and platform-specific output details.
  • Refactor

    • Migrated from Tauri to Electron; removed splash screen and system tray behavior.
  • Chores

    • Updated dev/build scripts to separate web and desktop workflows; added Rust/N-API build step.
    • Expanded .gitignore to exclude Rust artifacts.

AlphaEcho11 avatar Aug 15 '25 01:08 AlphaEcho11

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
amica Error Aug 15, 2025 1:27am

vercel[bot] avatar Aug 15 '25 01:08 vercel[bot]

@google-labs-jules[bot] is attempting to deploy a commit to the heyamica Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 15 '25 01:08 vercel[bot]

Walkthrough

Replaces Tauri with an Electron + Rust (N-API) architecture. Adds a Rust native module for HTTP proxying and sidecar management, wires Electron main/preload IPC to it, and updates frontend chat flows to use IPC proxies. Introduces deployment docs, updates package scripts/tooling, adds ignore rules, and removes all Tauri config/code.

Changes

Cohort / File(s) Summary of Changes
Electron bootstrap & IPC
electron/main.ts, electron/main.js, electron/preload.ts, electron/preload.js
New Electron main and preload implementing secure window creation and IPC bridges for blocking/streaming proxy requests and sidecar start/stop, forwarding events to renderer.
Rust N-API library
rust-lib/Cargo.toml, rust-lib/src/lib.rs, rust-lib/index.js, rust-lib/index.d.ts, rust-lib/package.json
New Rust cdylib exposing proxy_request_blocking/streaming and sidecar start/stop via N-API; Node loader selects platform binary; TypeScript typings added; crate manifest introduced.
App scripts & tooling
package.json
Switch to Electron build/dev workflow; add Electron, electron-builder, concurrently, wait-on, @napi-rs/cli; add rust build hooks; remove Tauri scripts; set main and homepage.
Tauri removal
src-tauri/tauri.conf.json, src-tauri/src/main.rs, src-tauri/Cargo.toml, src-tauri/build.rs, src-tauri/info.plist, src-tauri/Release.entitlements, src-tauri/.gitignore
Remove Tauri app, config, build scripts, entitlements, and related ignores.
Frontend: Chat proxy integration
src/features/chat/openAiChat.ts
Refactor to use window.electronAPI for streaming/non-streaming requests to v1/chat/completions; add parsers and stricter API key handling; update function signature.
Frontend: VRM viewer
src/components/vrmViewer.tsx
Remove Tauri splashscreen invoke and related import; VRM logic unchanged.
Deployment docs
DEPLOYMENT.md
New local deployment guide for Electron + Rust + text-generation-webui configuration and build/run steps.
Root ignore
.gitignore
Add Rust ignore entries for rust-lib outputs and lockfiles.
Formatting
src/pages/_app.tsx
Whitespace-only formatting change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Renderer (Next.js)
  participant Preload as Electron Preload (electronAPI)
  participant Main as Electron Main
  participant Rust as Rust N-API (amica-rust-lib)

  UI->>Preload: electronAPI.proxyRequestBlocking(payload)
  Preload->>Main: ipc.invoke('proxy_request_blocking', payload)
  Main->>Rust: proxy_request_blocking(payload)
  Rust-->>Main: String (response body)
  Main-->>Preload: result
  Preload-->>UI: Promise<String>
sequenceDiagram
  autonumber
  participant UI as Renderer (Next.js)
  participant Preload as Electron Preload
  participant Main as Electron Main
  participant Rust as Rust N-API

  UI->>Preload: proxyRequestStreaming(payload, onChunk,onEnd,onError)
  Preload->>Main: ipc.send('proxy_request_streaming', payload)
  Main->>Rust: proxy_request_streaming(payload, onChunk,onEnd,onError)
  Rust-->>Main: stream callbacks
  Main-->>Preload: 'stream-chunk'/'stream-end'/'stream-error'
  Preload-->>UI: onChunk/onEnd/onError events
sequenceDiagram
  autonumber
  participant UI as Renderer
  participant Preload as Electron Preload
  participant Main as Electron Main
  participant Rust as Rust N-API (Sidecar)

  UI->>Preload: startSidecar({ path }, onOutput)
  Preload->>Main: ipc.invoke('start_sidecar', payload)
  Main->>Rust: start_sidecar(payload, onOutput)
  Rust-->>Main: output events
  Main-->>Preload: 'sidecar-output'
  Preload-->>UI: onOutput(data)
  UI->>Preload: stopSidecar()
  Preload->>Main: ipc.invoke('stop_sidecar')
  Main->>Rust: stop_sidecar()

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

A rabbit taps the Electron key,
Rust hums softly, streaming free.
Tauri bows, exits stage left—
IPC bridges do the heft.
Sidecars purr, proxies sing,
Build and hop—ship the thing!
(_/).oO( shipped ) 🥕

[!TIP]

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Aug 15 '25 01:08 coderabbitai[bot]

Wow that's really something. Will review. Thanks!

slowsynapse avatar Aug 18 '25 11:08 slowsynapse