feat(machine): add HAL IPC bridge for real hardware in Electron

HAL hardware drivers (serialport) run in the main process since they
need Node.js. The renderer communicates via IPC for all hardware ops.

- hal-service.ts: bridge between HAL drivers and Electron IPC
- main.ts: HAL IPC handlers (init, dispense, validator stack/reject)
- preload.ts: expose HAL API to renderer via contextBridge
- atm.ts: IPC-based production init with validator event wiring
- hal.ts: add 'hold' mode for escrow (async stack/reject decision)
- electron.d.ts: HAL type declarations for window.electronAPI

Bills go to escrow first; the renderer checks balance before accepting.
Falls back to Lightning-only mock mode if HAL init fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-02-25 17:02:13 -05:00
commit 2605c44ef8
7 changed files with 515 additions and 24 deletions

View file

@ -9,6 +9,6 @@
"outDir": "../dist-electron",
"rootDir": "."
},
"include": ["main.ts", "state-store.ts"],
"include": ["main.ts", "state-store.ts", "hal-service.ts"],
"exclude": ["preload.ts"]
}