How 13point5/gemini-cursor works
• Electron Main Process: Represented in files such as src/main.ts. This is the entry point, managing application lifecycles, window creation, and interprocess communication.
• Preload Scripts: Files like src/preload.ts are used for securely exposing limited APIs to the renderer processes.
• Renderer Processes/Frontend: There are separate renderer layers for the “controls” and “cursor” functionalities. Under src/apps/controls/ you see various React components (e.g., App.tsx, CursorControl.tsx, ControlTray.tsx, Logger.tsx, SidePanel.tsx) that build up the UI.
• Auxiliary Modules and Libraries: In the src/apps/controls/lib directory, you have modules handling media (audio-recorder, audio-streamer, worklets for audio-processing, vol-meter, etc.) and the multimodal live functionality (multimodal-live-client.ts).
• API Integration: The project leverages Google Gemini’s API as described in the README, so a clear node should indicate external API calls for the multimodal live features (see use-live-api hook and LiveAPIContext).
• Utility & Configuration: Configuration files (e.g., forge.config.ts, vite.*.config.ts, tsconfig.json) and environment declarations indicate build and runtime configurations.
Relationships and Interactions
• Renderer Processes to the Preload script, which safely channels between the two processes.
• That these components access shared contexts (e.g., LiveAPIContext) and hooks (e.g., use-live-api, use-media-stream-mux, etc.) that encapsulate business logic and media streaming functionalities.
• Relationship between UI components/hooks and the auxiliary libraries (found under src/apps/controls/lib), which perform tasks such as audio recording, live streaming, and worklet-based audio processing.
• An outward connection from the multimodal functionality (the Live API layer integrated via hooks and the LiveAPIContext) to the external Google Gemini API.
Architectural Patterns and Design Principles
• Electron Architecture: Clearly segment the Main process, Preload scripts, and Renderer processes to emphasize Electron’s security and separation responsibilities.
• Component-Based Design: For the frontend, underline the React-based, modular UI components.
• Modular Abstraction: Highlight the use of hooks, contexts, and library abstractions to manage media streams and API communications.
Relevant Technologies and Frameworks
• Electron (for the desktop application shell and system-level management).
• React with TypeScript (for the Frontend).
• Vite (for fast bundling and development).
• Google Gemini API (for multimodal AI features).
• Web Audio API elements and worklets integrated for audio processing.