Commit graph

187 commits

Author SHA1 Message Date
Patrick Mulligan
f5f00108aa feat(machine): add light/dark mode toggle with semantic color styling
Replace hardcoded Tailwind colors (bg-white/5, text-green-400, bg-black/30,
etc.) with theme-aware semantic classes (bg-card, text-success, text-bitcoin,
bg-destructive/20) across CashInView and CashOutView. Add colorMode support
to useTheme composable with localStorage persistence and system preference
detection. QRCode component now reacts to theme/mode changes via
MutationObserver. Debug panel includes Light/Dark/System toggle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 10:57:33 -05:00
Patrick Mulligan
0406a21b0e fix(cash-in): restore cancel button and add displayingQR timeout
Cancel button is now always visible during the cash-in flow. The state
machine routes CANCEL to confirmAbandon when bills are present, so the
user always has an exit path with appropriate warnings. Also adds a
5-minute auto-timeout on displayingQR and allows cancel during
generatingNdebit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:19:01 -05:00
Patrick Mulligan
13ac74ab86 fix(cash-in): prevent cancel after bills inserted in insertingBills state
The cancel button was still accessible during insertingBills after a bill
had been stacked (physically irreversible). Now CANCEL in insertingBills
is guarded: no bills → idle, bills present → confirmAbandon warning.
The UI also hides the cancel button once bills are detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:35:34 -05:00
Patrick Mulligan
642f0c5951 fix(machine): hide cancel after bills inserted, kiosk-only UI cleanup
- Hide header cancel button after bills are in cash box
- Add spinning hourglass to displayingQR waiting indicator
- Hide keyboard-dependent UI in Electron kiosk mode:
  QR mode selector, manual payment options, copy buttons
  These remain available in browser (web-ui) mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:26:06 -05:00
Patrick Mulligan
165ad59704 feat(machine): confirm-abandon warning, retry on error, hourglass animation
- Add confirmAbandon state UI: warns user cash can't be returned,
  offers "Show QR Code Again" or "Abandon (lose cash)"
- Error state shows "Try Again" button when bills are inserted
- Replace Skeleton loading placeholders with hourglass emoji
- Add animate-hourglass: 45-degree step rotation (Tailwind v4 @utility)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:15:51 -05:00
Patrick Mulligan
625af457d1 feat(machine): live BTC price badge with 10s polling from LNbits
- Poll LNbits /api/v1/rate/ every 10s for live price display
- Show local currency rate + USD reference (e.g. GTQ/BTC: Q525,034 ($67,960))
- Reduce rate cache from 5min to 10s for responsive display
- Use simpler /api/v1/rate/ endpoint instead of /conversion POST

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:12:52 -05:00
Patrick Mulligan
648f089ac2 feat(machine): real exchange rate with LNbits, ShockWallet, CoinGecko fallback
Replace hardcoded mock rate (1000 sats/USD) with live price feeds:
1. LNbits (lnbits.atitlan.io) — primary, supports GTQ/USD/EUR
2. rates.shockwallet.app — ShockWallet ecosystem fallback
3. CoinGecko — last resort

Includes 5-minute cache and request deduplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:50:30 -05:00
Patrick Mulligan
0ea9640f49 fix(machine): production hardware fixes for Douro cash-out
- Fix cassette denominations: Douro uses Q100/Q200, not Q20
- Add hal:get-inventory IPC so renderer can read HAL cassette inventory
- Add balance fetch/display to HAL+IPC init path and idle screen
- Enable/disable bill validator via watch on nested state transitions
- Pass fiatCode to state machine context (was hardcoded to USD)
- Preserve currency across state machine resetContext
- Add CANCEL handler to dispenseError state (was stuck)
- Fix remaining hardcoded $ symbols in CashInView

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:13:45 -05:00
Patrick Mulligan
2605c44ef8 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>
2026-02-25 17:02:13 -05:00
Patrick Mulligan
10293d0ab5 fix(machine): auto-init HAL in production, wire dispense completion, add GTQ
- App.vue detects Electron and calls initializeForProduction() to start
  real hardware drivers instead of Lightning-only mode
- Auto-send CASH_DISPENSED when HAL is active since dispenseCash already
  waits for bills to be removed before resolving
- Add GTQ (Guatemalan Quetzal) bill lengths to F56 and Puloon dispensers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:20:51 -05:00
Patrick Mulligan
ba42820c71 feat(machine): add Tejo machine preset with 4-cassette F56 dispenser
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:04:29 -05:00
Patrick Mulligan
350e7a8974 feat(hal): add Puloon bill dispenser driver for Douro ATM
Port the Puloon RS232 dispenser protocol from lamassu-machine to
the lamassu-next HAL package. Adds Douro machine preset with Puloon
dispenser on /dev/ttyS1 and ID003 validator on /dev/ttyS0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 20:01:26 -05:00
Patrick Mulligan
658c3c2b4d fix(machine): live USB ISO with native modules and debug mode
Enable debugMode by default (simulated bill buttons) until real
hardware validator is connected. Fix live.nix to include native
node_modules (better-sqlite3, bindings) from pnpm virtual store,
add LD_LIBRARY_PATH for NixOS, bake aiolabs.dev endpoints into
env template, and enable Electron renderer logging in journalctl.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 15:14:35 -05:00
Patrick Mulligan
3634509ed4 fix(machine): mobile UI polish and shadcn-vue ScrollArea
- Use h-dvh instead of h-screen for mobile browser viewport
- Add ScrollArea component (shadcn-vue) to replace native scrollbars
- Move Hide Debug into debug bar row, show Show Debug only when off
- Responsive cash-out denomination grid (single col on mobile)
- Add safe-area padding for mobile gesture bar
- Add business model documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:44:39 -05:00
Patrick Mulligan
98e373c5ce fix(machine): make debug bar in-flow and slim down bill acceptor
- Debug bar is now a normal flex child (shrink-0) instead of fixed
  overlay, so content naturally fits above it without padding hacks
- Replace bulky dashed bill acceptor box with a single text line

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:45:24 -05:00
Patrick Mulligan
56e7aa5f24 fix(machine): add min-h-0 to view roots so content scrolls above debug bar
Without min-h-0, flex children won't shrink below their content size,
so the parent's pb-28 padding is ignored and the debug bar overlaps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:36:22 -05:00
Patrick Mulligan
b6b544d45a fix(machine): responsive mobile layout for cash-in/cash-out views
- Push header below fixed status badges on mobile (pt-12)
- Use w-full max-w-* instead of fixed widths so cards fit mobile screens
- Make main content scrollable with overflow-auto
- Reduce padding on mobile (p-4 vs p-8)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:31:22 -05:00
Patrick Mulligan
1f312abcaf fix(machine): increase bottom padding for debug bar on mobile
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:55:58 -05:00
Patrick Mulligan
b3b156c3ed fix(machine): add bottom padding when debug bar is active
Prevents the fixed debug overlay from covering content (QR links)
on mobile by reserving space at the bottom of the main container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:52:26 -05:00
Patrick Mulligan
a0e0c98573 fix(machine): wrap debug footer so theme buttons don't get cut off
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:50:10 -05:00
Patrick Mulligan
a9da1067b3 feat(machine): responsive mobile-friendly layout with Tailwind v4
- IdleView: stack cards vertically on mobile, side-by-side on sm+
- Scale logo, cards, text, and badges down for small screens
- QR overlays use smaller codes on mobile (280px vs 400px)
- Status badges wrap and use smaller text on mobile
- Hide subtitle text on mobile cards to save space

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:47:26 -05:00
Patrick Mulligan
e40545671e fix(machine): stack idle view sections vertically instead of inline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:44:32 -05:00
Patrick Mulligan
1023e459aa fix(machine): prefix balance badge with "bal:" for clarity
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:42:33 -05:00
Patrick Mulligan
45975bccd4 feat(machine): add regtest network badge and rename Zeus lnd-3 to lnd-alice
Shows a warning-colored badge with the network name (regtest/testnet) when
not on mainnet. Also renames Zeus QR references from lnd-3 to lnd-alice.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:33:11 -05:00
Patrick Mulligan
f37555565e feat(machine): add SQLite persistence and remove npub linking
Add crash-safe persistence for cassette inventory, cashbox state, and
transaction history using better-sqlite3 in the Electron main process.
The state machine now loads inventory from the database at runtime
instead of using hardcoded values, and transactions are automatically
persisted on completion.

Remove the unnecessary npub linking code — Lightning.Pub auto-creates
and associates Nostr users when appId is included in RPC requests,
making the HTTP-based user creation and token linking redundant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 11:45:09 -05:00
Patrick Mulligan
722635a5a6 feat(machine): landscape layout and fullscreen mode
- Switch Electron window to landscape (1920x1080) with fullscreen fallback
- Rearrange IdleView for horizontal layout (logo+badges left, action cards right)
- Fix hostname command in provision/build scripts (use ip route instead of hostname -I)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:43:49 -05:00
Patrick Mulligan
19d43c2939 feat(deploy): add NixOS live USB ISO for ATM hardware testing
Add NixOS configuration to build a bootable live USB ISO that runs the
ATM Electron app in kiosk mode on physical hardware (UpBoard). The ISO
boots from squashfs, auto-starts X11/openbox, and launches Electron in
production mode.

Key changes:
- deploy/nixos/live.nix: Live USB module (squashfs+tmpfs, no disk install)
- deploy/nixos/flake.nix: Nix flake with ISO build output
- deploy/nixos/provision-atm.sh: Auto-provision LP credentials via API
- deploy/nixos/build-iso.sh: End-to-end build workflow script
- apps/machine: Fix Electron production mode (ELECTRON_FORCE_PROD),
  Vue Router hash mode for file:// protocol, relative asset paths

Build: cd deploy/nixos && bash build-iso.sh
Test:  qemu-system-x86_64 -enable-kvm -m 2G -cdrom result/iso/*.iso

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:11:23 -05:00
Patrick Mulligan
60f4eb6639 feat(machine): add Zeus and Lightning.Pub QR codes to mock UI
dev.sh atm auto-injects VITE_LNDCONNECT_URL from lnd-3 credentials.
Idle screen shows "Zeus QR" and "Lightning.Pub nprofile" buttons (debug
mode) that open fullscreen overlays with scannable 400px QR codes and
copy-to-clipboard support. Also makes the debug overlay collapsible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:38:32 -05:00
Patrick Mulligan
333b8b9357 feat(machine): add logo with float animation to idle screen
Integrate pyramid logo into idle view with a gentle floating animation
and theme-aware glow. Rename title to Bitcoinmat, enlarge action cards,
and use BitcoinIcon for Buy Bitcoin / cash emoji for Sell Bitcoin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 21:18:02 -05:00
Patrick Mulligan
b0fc5cf585 feat(machine): add 6 switchable color themes
Add theme system with Gruvbox (default), Catppuccin, Dracula, Nord,
Tokyo Night, and Cyberpunk palettes — each with light/dark variants.
Theme picker on idle screen and debug overlay, persisted to localStorage.

Also fixes @custom-variant dark to use :where() per Tailwind v4 best
practice, and replaces Buy Bitcoin emoji with BitcoinIcon component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 21:03:20 -05:00
Patrick Mulligan
01bac04cdf chore(machine): remove unused express dependency
express is only used in Lightning.Pub's withdraw extension for LNURL
HTTP endpoints, not in the ATM Electron/Vue app.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:44:27 -05:00
Patrick Mulligan
3f0247313d feat(machine): add optimized BitcoinIcon component
SVGO-optimized bitcoin.svg (62% smaller) as a reusable Vue component
with configurable size prop. Used in CashInView balance limit message
instead of dollar-sign emoji.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:33:33 -05:00
Patrick Mulligan
16159334a4 feat(machine): limit bill insertion to available balance
Add billWithinBalance guard to state machine that rejects bills
exceeding the ATM's available sats. UI disables denomination buttons
and shows informational message when limit is reached.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:21:45 -05:00
Patrick Mulligan
9569f849e7 fix(machine): track relay connection state for live status badge
Listen for nostrClient disconnect/connect events to update the
connection status badge. Previously it was set once on init and
never reflected WebSocket disconnections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:05:14 -05:00
Patrick Mulligan
c4fadd7438 feat(machine): add Electron serial port IPC for hardware access
Expose serialport APIs through Electron preload for bill validator
and dispenser communication. Update HAL service with device path
configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:58:19 -05:00
Patrick Mulligan
b410917e52 feat(machine): LNURL-withdraw support and real-time balance display
- Add LNURL-withdraw as payment option in cash-in flow
- Generate withdraw links via Nostr RPC (NIP-44 encrypted)
- Poll withdraw link status to detect wallet claims
- Add npub linking during Lightning.Pub initialization
- Display live balance badge in ATM UI header
- Subscribe to balance updates via LiveUserOperation events

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:58:05 -05:00
Patrick Mulligan
c98f126ba7 feat(docker): add dev.sh with auto-funding and ATM app setup
- Add dev.sh script for managing regtest development environment
- Implement cmd_fund to fund ATM app owner via Lightning.Pub API
- Add --fund flag to cmd_up for automatic funding on startup
- Update setup_atm_app to write VITE_APP_ID to machine .env
- Fix Electron IPC to pass appId and extensionApiUrl to renderer
- Restructure repo from nested lamassu-next/ to root

The dev.sh script now supports:
- ./dev.sh up --fund  # Start regtest and auto-fund ATM
- ./dev.sh fund       # Fund existing ATM app
- ./dev.sh status     # Show environment status
- ./dev.sh reset      # Clean restart

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 14:19:16 -05:00