How dusancar-sudo/ruby-diamond-client works
Purpose and Entry Points
Ruby Diamond Client is a native Tauri 2 desktop workbench for AI-assisted coding: editor, terminal, agent chat, system administration, memory, mesh connectivity, and extensible skills/plugins. The frontend starts at src/main.tsx and composes the workspace in src/App.tsx; the native executable enters through src-tauri/src/main.rs and initializes backend services in src-tauri/src/lib.rs. An optional standalone Flask/NVIDIA API service starts at app.py.
React Workspace and State
The React/Vite WebView provides the multi-pane desktop interface. Central application state is held in src/store.ts, with agent/API/provider-facing client code in src/lib/agent.ts, src/lib/api.ts, and src/lib/provider.ts. The UI is a client boundary: it invokes Tauri-native commands for privileged local operations rather than directly owning system access.
Coding and Terminal Surfaces
The primary workbench surfaces are the editor, terminal, file explorer, and chat: src/components/Editor.tsx, src/components/Terminal.tsx, src/components/Explorer.tsx, and src/components/Chat.tsx. They support the core flow of navigating local files, editing code, running shell commands, and passing coding context into AI conversations. Editor and terminal dependencies run in the WebView, while filesystem and shell effects cross into Rust/Tauri.
Native Command and System Layer
Rust exposes the privileged desktop boundary through src-tauri/src/commands.rs, with shared types in src-tauri/src/types.rs. Application composition and command registration belong in src-tauri/src/lib.rs; native packaging, permissions/capabilities, and platform setup are defined by src-tauri/tauri.conf.json and generated schemas under src-tauri/gen/schemas/. This layer mediates file operations, shell execution, clipboard integration, and local system/process information.
Agent, Model, and Tool Execution
The backend agent subsystem in src-tauri/src/agent/mod.rs coordinates LLM interaction, tools, skills, and contextual capabilities. Provider/model abstractions live in src-tauri/src/llm/mod.rs, while local llama.cpp support is isolated in src-tauri/src/llamacpp/mod.rs. Tool dispatch is structured around built-ins and a registry in src-tauri/src/tools/builtin.rs and src-tauri/src/tools/registry.rs, creating a control boundary between model-requested actions and allowed local execution.
Extensibility, Memory, and Mesh
Skills and plugins are backend concepts implemented in src-tauri/src/skills/mod.rs and src-tauri/src/plugins/mod.rs, backed by distributable skill definitions such as skills/code-review/SKILL.md and skills/rust-analyzer/SKILL.md. Learned episodes, lessons, and effectiveness data are managed through src-tauri/src/memory/mod.rs and displayed by src/components/MemoryPanel.tsx. AgentMesh orchestration connectivity is handled by src-tauri/src/mesh/mod.rs with UI exposure in src/components/MeshPanel.tsx.
External Services and Deployment Modes
The desktop app can use NVIDIA NIM, OpenAI, Anthropic, or OpenAI-compatible providers via its frontend/provider and Rust LLM layers. app.py is an optional Flask service using the OpenAI Python SDK to reach NVIDIA APIs, configured through requirements.txt and NVIDIA_API_KEY. The main distributable is built as a Tauri application from the React/Vite frontend and Rust native backend; Python is a separate, optional runtime.
Main entry points: mod.rs Agent coordinator · commands.rs Native commands · App.tsx Workspace shell · agent.ts Agent/API clients
Components 19
React WebView
Desktop workspace UI and client state.
- Frontend entry
src/main.tsx - Workspace shell · Composes the multi-pane desktop workbench.
src/App.tsx - Application state
src/store.ts - Agent/API clients · Provider-facing and agent-facing WebView clients.
src/lib/agent.ts - Editor, terminal & explorer · Navigate, edit, and run code in the WebView.
src/components/Editor.tsx - Agent chat · Passes coding context into AI conversations.
src/components/Chat.tsx
Tauri Native
Privileged local operations and application composition.
- Native executable
src-tauri/src/main.rs - Tauri application · Initializes services and registers commands.
src-tauri/src/lib.rs - Native commands · Mediates filesystem, shell, clipboard, and system access.
src-tauri/src/commands.rs - Shared command types
src-tauri/src/types.rs - Packaging & permissions · Defines platform setup and capabilities.
src-tauri/tauri.conf.json
Agent Runtime
Model orchestration, controlled tools, and extensions.
- Agent coordinator · Coordinates models, context, tools, and skills.
src-tauri/src/agent/mod.rs - LLM providers · Connects supported hosted and compatible model providers.
src-tauri/src/llm/mod.rs - Local llama.cpp
src-tauri/src/llamacpp/mod.rs - Tool registry · Maps model-requested actions to permitted built-in tools.
src-tauri/src/tools/registry.rs - Skills & plugins · Loads extensible agent capabilities and skill definitions.
src-tauri/src/skills/mod.rs - Agent memory · Manages episodes, lessons, and effectiveness data.
src-tauri/src/memory/mod.rs - AgentMesh
src-tauri/src/mesh/mod.rs
Optional Service
Separate Python runtime for NVIDIA API access.
- NVIDIA API service · Optional standalone service using the OpenAI Python SDK.
app.py
Connections 21
- Frontend entry → Workspace shell: mounts
- Workspace shell → Application state: uses
- Workspace shell → Editor, terminal & explorer: composes
- Workspace shell → Agent chat: composes
- Workspace shell → Agent/API clients: uses
- Editor, terminal & explorer → Native commands: invokes local operations
- Agent chat → Agent/API clients: sends conversations
- Agent/API clients → Native commands: invokes native agent APIs
- Native executable → Tauri application: starts
- Tauri application → Native commands: registers
- Native commands → Shared command types: uses
- Packaging & permissions → Tauri application: packages & permits
- Native commands → Agent coordinator: routes agent work
- Agent coordinator → LLM providers: requests models
- LLM providers → Local llama.cpp: supports local runtime
- Agent coordinator → Tool registry: dispatches actions
- Tool registry → Native commands: performs allowed system actions
- Agent coordinator → Skills & plugins: loads capabilities
- Agent coordinator → Agent memory: learns and retrieves
- Agent coordinator → AgentMesh: orchestrates through
- Agent/API clients → NVIDIA API service: optional API route