DEV Community

Archak Aryan
Archak Aryan

Posted on

LABYRINTH // Visualizing Codebases as Interactive 3D Cities for Private AI Security Audits

LABYRINTH // Interactive 3D Codebase Architecture & Local AI Auditor

● THE COGNITIVE GAP IN STATIC ANALYSIS

"Reading thousands of lines of nested terminal logs to map a massive repository is an engineering anti-pattern. We are forced to trade our spatial awareness for flat text, while simultaneously being expected to trust external cloud providers with proprietary codebases just to get intelligent security tracking."

Labyrinth changes this paradigm completely. It acts as a performance-optimized desktop application that compiles raw source directories into an interactive, high-fidelity 3D city grid. By utilizing a native system runtime, it brings structural visualization and secure, completely offline local AI audits straight to your local hardware.


● SYSTEM ARCHITECTURE VISUALIZATION

https://github.com/Krish/labyrinth

The layout engine uses a refined industrial monochrome aesthetic inspired by Nothing UI design rules, combined with sharp high-contrast overlays to make codebase metrics instantly scannable:

  • Base Structures: Rendered in low-luminance matte values (#18181B for dark mode / #F4F4F5 for light mode) to eliminate mirror glares and visual fatigue.
  • Vulnerability Indicators: Tracked using bright signal orange (#FFA500) for real-time visual priority.
  • Metric Tooltips: Implemented as physical planes mapped into the WebGL coordinate space via transformed, depth-occluded HTML wrappers.

● PRODUCTION ENGINEERING BREAKDOWN

1. Blender-Style Turntable Physics Controls

We completely rewrote the canvas interaction schema to map directly into the frame-rate rendering hook loop. Viewport movement is smooth and mirrors default professional asset manipulation workflows exactly:

  1. Turntable Rotation: Handled exclusively via Middle-Mouse Button (MMB) drag states above the horizontal floor grid.
  2. Node Selections: Left-Click is fully decoupled from camera physics, ensuring zero perspective drift when interacting with structural boxes.
  3. Spatial Panning: Holding down the Shift key programmatically intercepts mouse delta vectors inside the render frame loop to switch middle-mouse button actions seamlessly over to physical panning along the X and Z axes.

2. Zero-CORS Native Inter-Process AI Proxy

To eliminate webview cross-origin resource sharing limitations where browsers (http://tauri.localhost) block direct API communication pipelines to local ports, we built a native asynchronous HTTP routing client inside the Tauri Rust core.

The background engine handles automated runtime fallback sequences gracefully:


rust
// Native Rust command executing secure local model target handshakes
#[tauri::command]
async fn proxy_ollama_request(endpoint: String, payload: serde_json::Value) -> Result<serde_json::Value, String> {
    let client = reqwest::Client::builder()
        .timeout(std::time::Duration::from_secs(30))
        .build()
        .map_err(|e| e.to_string())?;
    // Connection execution details...
}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
black_boy_3ba56c23db6207b profile image
B_Man

Looks Goood... 👌