Skip to content

HardwareScript/hsm

Hardware Script Monitor (HSM)

Hardware Script Monitor is a native desktop application for live hardware visualization, inspection, and analysis. It serves as the real-time preview companion for the Hardware Script language — a zero-cost abstraction for hardware description and PCB/EDA workflows.

HSM Splash

Version: 0.1.7 — Pre-Alpha
Author: caneDdev
License: AGPL-3.0 (see LICENSE) · Commercial licenses available (see COMMERCIAL-LICENSE)
Identifier: com.hardwarescript.monitor


Overview

HSM is built on a Rust Data Factory + JS Beauty Layer architecture (the "Aggregate Engine"):

Layer Technology Purpose
Data Factory Rust (Tauri v2) Zero-copy .hwsb/.hsx parsing, GLB augmentation, PourID → DeviceBinding resolution, file watching, memory-mapped I/O
Beauty Layer SolidJS + TypeScript Reactive UI, viewport orchestration, sidebar inspectors, scene management
3D Viewport Babylon.js Interactive 3D board/layout inspection with orbit controls, wireframe, orthographic views, camera presets
2D Viewport Canvas 2D DXF-based 2D layout viewer with layer visibility, measurement tool, unit switching (mm/mil/um)
Netlist View SolidJS Hierarchical netlist browser with search and filtering
SPICE Viewport uPlot + Canvas Simulation waveform plotting and schematic overlay
Desktop Shell Tauri v2 Native OS integration, file dialogs, window management

Architecture

┌──────────────────────────────────────────────────────────┐
│                 HSM Desktop (Tauri v2)                    │
│  ┌────────────────────────────────────────────────────┐  │
│  │           Beauty Layer (SolidJS + Vite)            │  │
│  │  ┌──────────┐ ┌──────────┐ ┌────────┐ ┌────────┐ │  │
│  │  │ Babylon  │ │ Canvas 2D│ │Netlist │ │ SPICE  │ │  │
│  │  │ (3D)     │ │ (DXF)    │ │Browser │ │(uPlot) │ │  │
│  │  └────┬─────┘ └────┬─────┘ └───┬────┘ └───┬────┘ │  │
│  └───────┼─────────────┼───────────┼───────────┼──────┘  │
│           │             │           │           │         │
│  ┌────────┴─────────────┴───────────┴───────────┴──────┐ │
│  │           Data Factory (Rust — Tauri Commands)       │ │
│  │  ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐  │ │
│  │  │.hwsb    │ │ GLB      │ │ PourID   │ │File    │  │ │
│  │  │Parser   │ │Augmenter │ │Resolver  │ │Watcher │  │ │
│  │  └─────────┘ └──────────┘ └──────────┘ └────────┘  │ │
│  └──────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────┘

Features

🎯 3D Viewport (Babylon.js)

  • Interactive 3D scene with orbit/pan/zoom controls
  • Camera presets: Isometric, Top, Front, Side
  • Perspective / Orthographic toggle
  • Wireframe overlay mode
  • Orientation axes helper
  • Custom background color picker
  • Live FPS display
  • Lazy-loaded @babylonjs/core (~2MB loaded on demand)

📐 2D Viewport (Canvas 2D)

  • DXF file import and rendering (LINE, CIRCLE entities)
  • Per-layer visibility toggles with individual color pickers
  • Measurement tool (click-to-measure distance in mm/mil/um)
  • Infinite pan and zoom with mouse controls
  • Entity selection with property inspection
  • Auto-fit to view
  • Unit system: mm / mil / µm

🔗 Netlist Browser

  • Hierarchical net list with signal groups (Power, Signal, Differential)
  • Search and filter
  • Pin count display

⚡ SPICE Simulation Viewport

  • uPlot-based waveform plotting
  • Schematic overlay support
  • Simulation data inspection

🖥️ Native Desktop (Tauri v2)

  • Native OS file dialogs (tauri-plugin-dialog)
  • 3D file picker (GLB/GLTF/OBJ/STL)
  • Transparent window support
  • Hardware-accelerated rendering via WebGPU/Vulkan/Metal
  • Platform: Windows, macOS, Linux

Getting Started

Prerequisites

Install

cd hsm
pnpm install

Development

# Run in browser (Vite dev server — no Tauri shell)
pnpm dev

# Run as native desktop app (Tauri)
pnpm tauri dev

Build

pnpm build
pnpm tauri build

Project Structure

hsm/
├── index.html              # Entry HTML with splash screen
├── package.json            # Node dependencies & scripts
├── tsconfig.json           # TypeScript configuration
├── vite.config.ts          # Vite build configuration
├── pnpm-workspace.yaml     # pnpm workspace (if monorepo)
├── src/
│   ├── index.tsx           # SolidJS entry point
│   ├── App.tsx             # Root component (viewport router)
│   ├── App.css             # Global styles
│   ├── splash.css          # Splash screen styles
│   ├── assets/             # Static assets (logo, images)
│   ├── bridge/             # IPC bridge to Rust backend
│   │   ├── ipc.ts          # Tauri invoke wrappers
│   │   └── dxf-loader.ts   # DXF file parser
│   ├── components/
│   │   ├── BabylonViewport.tsx    # 3D viewport (Babylon.js)
│   │   ├── TwoDViewport.tsx       # 2D viewport (Canvas 2D + DXF)
│   │   ├── SpiceViewport.tsx      # SPICE simulation viewport
│   │   ├── NetlistView.tsx        # Netlist browser
│   │   ├── ViewportContainer.tsx  # Viewport layout container
│   │   ├── Sidebar.tsx            # Reusable sidebar component
│   │   ├── DxfViewport.tsx        # Alternative DXF viewer
│   │   ├── ThreeDViewport.tsx     # Three.js alternative viewport
│   │   ├── babylon-signals.ts     # Shared Babylon signal primitives
│   │   └── Header/                # App header + navigation
│   └── store/
│       ├── selection.ts           # Selection state management
│       └── telemetry.ts           # Telemetry/statistics store
├── src-tauri/
│   ├── Cargo.toml          # Rust dependencies
│   ├── tauri.conf.json     # Tauri app configuration
│   ├── build.rs            # Tauri build script
│   ├── src/
│   │   ├── lib.rs          # Tauri commands (IPC surface)
│   │   ├── main.rs         # Application entry point
│   │   ├── engine/         # Data Factory (parsers, augmenters)
│   │   ├── telemetry/      # Performance telemetry
│   │   └── viewports/      # Legacy viewport renderers
│   ├── capabilities/       # Tauri v2 capability declarations
│   ├── icons/              # Application icons
│   └── gen/                # Generated artifacts
└── public/
    └── images/             # Public images (logo, splash)

Rust Data Factory

The Rust backend (the "Data Factory") implements zero-copy data processing for hardware description files:

Command File Description
open_file lib.rs Memory-map and parse .hwsb binary format
open_3d_file lib.rs Read 3D file and run GLB augmenter for Babylon.js
get_hsx_3d_layer lib.rs Return augmented GLB bytes to the frontend
resolve_device_binding lib.rs PourID → DeviceBinding lookup (picking handshake)
pick_and_read_3d_file lib.rs Native file dialog → bytes → frontend
read_file_bytes lib.rs Generic file reader for JS renderers

Zero-Copy Pipeline

.hwsb/.hsx file
    │
    ▼
memory-map (memmap2)
    │
    ▼
zero-copy cast (bytemuck)
    │
    ▼
rkyv-archived structs
    │
    ▼
GLB augmentation (gltf crate)
    │
    ▼
Babylon.js SceneLoader

Key Dependencies

Frontend

Package Purpose
solid-js Reactive UI framework
@babylonjs/core 3D rendering engine
@babylonjs/viewer Babylon.js high-level viewer
pixi.js 2D WebGL renderer (alternative)
three 3D WebGL renderer (alternative)
uplot High-performance SPICE waveform charts
lucide-solid Icon library
@kobalte/core Accessible UI primitives
dxf / dxf-viewer DXF file parsing and viewing
tailwindcss Utility-first CSS
vite Build tool and dev server

Backend (Rust)

Crate Purpose
tauri v2 Desktop application framework
memmap2 Zero-copy file mapping
rkyv Zero-copy serialization
bytemuck Safe transmutation
gltf / gltf-json GLB augmentation + PourID injection
rayon Parallel mesh generation
notify File system watcher (hot-reload)
crossbeam Lock-free concurrency
rustc-hash Fast PourID hashing (FxHashMap)
glam SIMD math (nm → f32 coordinate conversion)
wgpu Legacy native renderer (being phased out)

Development

Scripts

Command Description
pnpm dev Start Vite dev server (browser)
pnpm build Build frontend for production
pnpm serve Preview production build
pnpm tauri dev Start native desktop app (dev)
pnpm tauri build Build native desktop installer

IPC Protocol

The frontend communicates with the Rust backend via Tauri's invoke API:

import { invoke } from "@tauri-apps/api/core";

// Open a .hwsb file
const result = await invoke("open_file", { path: "/path/to/design.hwsb" });

// Get the augmented 3D layer
const glbBytes: number[] = await invoke("get_hsx_3d_layer");

// Resolve a PourID from a Babylon.js mesh pick
const binding = await invoke("resolve_device_binding", { meshName: "pour_00A3F1C2" });

// Pick and read a 3D file via native dialog
const { name, bytes } = await invoke("pick_and_read_3d_file");

Contributing

See CONTRIBUTING.md.

Governance

See GOVERNANCE.md.

License

This project is dual-licensed:

License Use Case
AGPL-3.0 (GNU Affero General Public License v3) Open-source / community use — see LICENSE.md
Commercial License Proprietary / closed-source use — see COMMERCIAL-LICENSE.md

For details on which license applies to your use case, see LICENSE-FAQ.md.

Changelog

See CHANGELOG.md.

About

Hardware Script Monitor — Native desktop live-preview app (Tauri v2 + Rust + SolidJS) with Babylon.js 3D, DXF 2D, netlist, and SPICE viewports.

Resources

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE.md
Unknown
LICENSE-FAQ.md

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors