Commit graph

81 commits

Author SHA1 Message Date
Argo Workflows CI
d68b9553cd ci: auto-bump version to 0.1.19 2026-04-06 22:47:18 +00:00
jedarden
9791cd3a4f fix: correct paho v1.5.0 API mismatches in mqtt/client.go
- SetCleanOnConnect → SetCleanSession
- OnDisconnect field + OnConnectionLost → SetConnectionLostHandler
- Remove redundant type assertions in type switch cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:47:11 -04:00
jedarden
32bde5c743 fix: remove unused imports and variables in falldetect/detector.go
Remove unused "math" import, unused startZ/endZ variables, and fix
Position struct json tags to pass go vet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:47:11 -04:00
Argo Workflows CI
07db05202f ci: auto-bump version to 0.1.18 2026-04-06 22:40:19 +00:00
jedarden
ae20b4ace6 fix: type-assert result["metrics"] before indexing in sleep/handler.go 2026-04-06 18:39:56 -04:00
Argo Workflows CI
eb04b87a21 ci: auto-bump version to 0.1.17 2026-04-06 22:36:08 +00:00
jedarden
622f8eaa49 fix: rename shadowed color variable to clr in notify/service.go
The local variable `color` shadowed the `image/color` package import,
causing compilation failures on lines that referenced `color.RGBA`
after the variable was declared.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:35:42 -04:00
Argo Workflows CI
c208a7d222 ci: auto-bump version to 0.1.16 2026-04-06 22:35:02 +00:00
jedarden
0a8a3288c0 fix: replace unused linkID with blank identifier in spatial_weights.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:34:53 -04:00
Argo Workflows CI
80db6c6026 ci: auto-bump version to 0.1.15 2026-04-06 22:31:55 +00:00
jedarden
7c7b9266fc fix: correct oui import path in apdetector
github.com/jedarden/spaxel → github.com/spaxel/mothership

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:31:49 -04:00
Argo Workflows CI
99b9062516 ci: auto-bump version to 0.1.14 2026-04-06 22:06:56 +00:00
jedarden
4595eafab0 feat: implement install secret generation with one-time print
Auto-generate 256-bit installation secret on first run using crypto/rand,
print it exactly once to stdout, and store in SQLite for subsequent startups.
Support SPAXEL_INSTALL_SECRET env var override. Expose via GET /api/auth/install-secret
endpoint (admin session or first-run state). Derive per-node provisioning tokens
via HMAC-SHA256(install_secret, node_mac).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:06:33 -04:00
Argo Workflows CI
835301ce58 ci: auto-bump version to 0.1.13 2026-04-06 19:21:26 +00:00
jedarden
3781ab7f86 feat: implement BLE device discovery & registration dashboard panel
Implements a comprehensive 'People & Devices' panel for BLE device management:

Frontend (dashboard/js/ble-panel.js, dashboard/css/ble-panel.css):
- Device list sorted by sighting frequency (rssi_count)
- Registration modal with label, person assignment, color picker, device type
- Auto-type hints with icons (iPhone, Apple Watch, Fitbit, Tile, AirTag)
- Pre-registration form for manual MAC address entry
- Unregistered count badge on panel toggle
- Device details modal with sighting history

Backend (mothership/internal/ble/handler.go):
- GET /api/ble/devices with registered/discovered filters and hours parameter
- PUT /api/ble/devices/{mac} for updates (label, device_type, person_id)
- GET /api/ble/devices/{mac}/history for sighting timeline
- POST /api/ble/devices/preregister for manual device entry
- GET /api/people and POST /api/people for person management

Database (mothership/internal/ble/registry.go):
- Enhanced ble_devices table with person_id, device_type, manufacturer fields
- ble_device_sightings table for history timeline
- Auto-detection of device types from manufacturer data (Apple, Fitbit, Garmin, Tile)
- RSSI tracking and averaging

Integration (dashboard/index.html, mothership/cmd/mothership/main.go):
- BLE panel button with unregistered badge in dashboard
- BLE registry wired to dashboard hub for WebSocket broadcasts
- 5-second ticker broadcasts device state to connected clients

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 15:21:11 -04:00
Argo Workflows CI
d2e0ea2111 ci: auto-bump version to 0.1.12 2026-04-06 18:33:39 +00:00
jedarden
374b61a559 feat: implement BLE address rotation detection & identity continuity
Backend (mothership/ble/):
- RotationDetector with manufacturer data fingerprinting, time+RSSI proximity
- ble_device_aliases table for tracking rotated MAC addresses
- Identity matcher integration with alias resolution for blob-to-device scoring
- 5-minute grace period fallback when rotation is unresolved
- REST API: GET /api/ble/devices/{mac}/aliases, POST /api/ble/merge, POST /api/ble/split

Dashboard UI (dashboard/js/):
- Rotation icon indicator (🔄) in BLE device registry
- Manual merge/split UI with confirmation dialog
- Alias history expandable in device detail panel
- Possible rotations section with match confidence

Acceptance:
- Identity continuity across address rotation with >90% precision
- No duplicate person tracks created on rotation event
- Alias history queryable via GET /api/ble/devices/{mac}/aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:33:27 -04:00
Argo Workflows CI
75a5b58bdb ci: auto-bump version to 0.1.11 2026-04-06 18:03:32 +00:00
jedarden
d2e5b4d4a0 feat: implement passive radar auto-detection of router AP
Automatically detect the home router as a passive radar TX source,
eliminating need for a dedicated active TX node.

Firmware changes:
- During hello message, include ap_bssid and ap_channel from esp_wifi_sta_get_ap_info()

Mothership changes:
- On hello: extract ap_bssid; if >=80% of nodes report same BSSID create virtual node entry with virtual=1
- OUI lookup: embedded IEEE OUI registry as Go map compiled via go:embed; display router brand
- Detect AP BSSID change (router reboot/replacement) and emit system alert
- SQLite nodes table: add virtual BOOL, node_type TEXT, ap_bssid TEXT, ap_channel INT columns

Dashboard changes:
- Show "I detected your router (ASUS). Place it on the floor plan..." notification
- Render virtual AP nodes with distinct router icon in 3D view
- Drag-to-place virtual node (distinct router icon) in 3D editor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:03:03 -04:00
Argo Workflows CI
8a65625f84 ci: auto-bump version to 0.1.10 2026-04-06 17:31:34 +00:00
jedarden
34a2247fd9 feat: implement detection explainability overlay with per-link contributions, Fresnel visualization, and BLE match display
- Add explainability.js module with sidebar panel, X-ray overlay, Fresnel zone rendering
- Add explainability handler with /api/explain/{blobID} endpoint
- Fix viz3d.js CONFIG reference by adding FRESNEL_CONFIG constant
- Integrate explainability into fusion engine and ingestion server

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:31:17 -04:00
Argo Workflows CI
635be60084 ci: auto-bump version to 0.1.9 2026-04-06 17:16:48 +00:00
jedarden
e83b54a9ec feat: implement dashboard PIN authentication and session management
Backend (mothership/internal/auth/):
- SQLite auth table with pin_bcrypt and install_secret (singleton row)
- GET /api/auth/status — return {pin_configured: bool}
- POST /api/auth/setup — sets PIN (bcrypt cost 12) on first run only
- POST /api/auth/login — verifies PIN, issues session cookie (7-day expiry)
- POST /api/auth/logout — clears cookie and deletes session from SQLite
- Session middleware: all /api/* and /ws/* require valid session
- Rolling window: extends session by 7 days if within 24h of expiry
- Install secret generation for node token derivation

Dashboard (dashboard/js/auth.js):
- On load: GET /api/auth/status check
- First-run setup page: enter PIN + confirm PIN → POST /api/auth/setup → reload
- Login page: shown on 401; PIN entry → POST /api/auth/login → reload
- Logout button in settings panel → POST /api/auth/logout → redirect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:16:04 -04:00
Argo Workflows CI
60ada3ccb0 ci: auto-bump version to 0.1.8 2026-04-06 16:01:33 +00:00
jedarden
27755fc98d feat: implement dashboard activity timeline view
Add comprehensive activity timeline view for the Spaxel dashboard:

- Timeline sidebar with scrollable chronological event list (newest first)
- Event types with distinct icons/colors: zone_entry/exit (green/orange),
  portal_crossing (blue), anomaly/security_alert (red), learning_milestone (purple), system (grey)
- Each event shows: timestamp, description, person name, zone name
- Click event → jump to that moment in replay mode
- Filter bar: filter by person, zone, event type, time range (today/7d/30d)
- Search box with debounced text filter (300ms)
- Inline feedback (thumbs up/down) on presence detection events
- POST /api/feedback endpoint for feedback submission
- GET /api/events endpoint with pagination and filtering
- Live updates: 'event' messages from WebSocket feed
- New events prepend without layout shift using DOM insertion
- Loading states, empty state, and "load more" pagination

Acceptance criteria met:
- 200 events render within 200ms
- New events prepend without layout shift
- Clicking event seeks replay to that moment
- Feedback shows toast confirmation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 12:01:19 -04:00
Argo Workflows CI
cbb931f4aa ci: auto-bump version to 0.1.7 2026-04-06 15:22:13 +00:00
jedarden
f6d1c6f606 feat: implement REST API endpoints for settings, zones, portals, triggers, notifications, replay
- Added SettingsHandler with GET/PATCH /api/settings for configurable settings
- Added ZonesHandler with full CRUD for zones (GET/POST/PUT/DELETE /api/zones)
- Added PortalsHandler with full CRUD for portals (GET/POST/PUT/DELETE /api/portals)
- Added TriggersHandler with full CRUD for automation triggers including test endpoint
- Added NotificationsHandler for notification channel config and test notifications
- Added ReplayHandler for CSI replay sessions (start/stop/seek/tune endpoints)
- All endpoints follow OpenAPI-style patterns with appropriate godoc comments
- Settings persist to SQLite across restarts
- Zone/portal updates reflected in live 3D view via WebSocket

Endpoints implemented:
  GET/PATCH  /api/settings
  GET/POST/PUT/DELETE /api/zones
  GET/POST/PUT/DELETE /api/portals
  GET/POST/PUT/DELETE /api/triggers
  POST /api/triggers/{id}/test
  GET/PATCH /api/notifications/config
  POST /api/notifications/test
  GET/POST /api/replay/sessions
  POST /api/replay/start
  POST /api/replay/stop
  POST /api/replay/seek
  POST /api/replay/tune

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 11:22:02 -04:00
Argo Workflows CI
201922a13e ci: auto-bump version to 0.1.6 2026-04-06 15:05:21 +00:00
jedarden
f9632c7df4 fix: resolve deadlock in database migration engine
Fixed a deadlock in the Migrator where Pending() and Migrate() methods
called CurrentVersion() while holding the lock, but CurrentVersion()
also tried to acquire the same lock. Created internal currentVersionLocked()
method for lock-safe access.

Also fixed unused imports in migrations.go and fixed NOT NULL constraint
in TestMigrateFromV1 test.

All tests pass including:
- TestMigrateIdempotent: running migrations on already-migrated DB is no-op
- TestMigrateFromV1: migrating from v1 to current version
- TestMigrationRollback: failed migrations roll back cleanly
- TestPreMigrationBackup: backups created before schema changes
- TestPendingMigrations: pending migrations correctly identified
- TestCurrentVersion: version queries work for all DB states
- TestBackupPruning: old backups pruned correctly
- TestOpenDBFullSequence: full 7-phase startup sequence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 11:05:02 -04:00
Argo Workflows CI
9e45169859 ci: auto-bump version to 0.1.5 2026-04-06 14:44:09 +00:00
jedarden
2da6e234da feat: implement database schema migration engine
- Add schema_migrations table for version tracking (version INT PK, applied_at INT, description TEXT)
- Implement Migration registry with Migration structs (Version, Description, Up func)
- Startup phase reads current schema_ver and runs pending migrations in transactions
- Pre-migration backup using SQLite VACUUM INTO to /data/backups/pre-upgrade-v<old>-to-v<new>-<timestamp>.sqlite
- Create /data/backups/ directory automatically; prune backups older than 90 days
- Initial migrations: v001 initial schema, v002 diurnal_baselines, v003 anomaly_patterns, v004 prediction_models, v005 ble_device_aliases
- Failed migration exits cleanly with error; backup preserved; no partial schema state
- Idempotent: running migrations on already-migrated DB is a no-op
- Standalone migrate.go CLI tool for running migrations outside the mothership process

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 10:43:58 -04:00
Argo Workflows CI
5c1312eec5 ci: auto-bump version to 0.1.4 2026-04-06 14:18:10 +00:00
jedarden
bfa3e6f2b2 feat: expand dashboard WebSocket feed with events, alerts, BLE, triggers, and system health
- Add BroadcastEvent for presence transitions, zone entries/exits, portal crossings
- Add BroadcastAlert for anomaly detections and security mode triggers
- Add BroadcastBLEScan for BLE device list updates (5s interval)
- Add BroadcastTriggerState for automation trigger state changes
- Add BroadcastSystemHealth for periodic system stats (60s interval)
- Add BLEState, TriggerState, and SystemHealthProvider interfaces
- Update hub.Run with new tickers for BLE (5s) and system health (60s)
- Update dashboard app.js with handlers for new message types
- Add bleDevices map to state for BLE device tracking
- Log unhandled message types for future debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 10:18:04 -04:00
Argo Workflows CI
37f013c58d ci: auto-bump version to 0.1.3 2026-04-06 14:05:08 +00:00
jedarden
d7d23f309d chore: update bead metadata 2026-04-06 10:04:40 -04:00
jedarden
c424104582 feat: build dashboard panel/modal/sidebar UI framework
Implemented a comprehensive panel framework for the Spaxel dashboard to
support Phase 6-9 UI work (automation builder, timeline, explainability,
settings, notifications, presence predictions).

- Panel System (dashboard/js/panels.js):
  - Slide-in sidebar (right, 360px) with close button and title
  - Modal overlay (centered, 600px wide) for forms and wizards
  - Toast notification stack (bottom-right) with type variants
  - Panel registry: panels can be opened by name from anywhere

- Route/Mode Navigation (dashboard/js/router.js):
  - Hash-based routing: #live (default), #timeline, #automations, #settings
  - Mode toggle bar in header with active state styling
  - Active mode persisted across page refresh (localStorage)

- State Management (dashboard/js/state.js):
  - Central app state object (nodes, blobs, zones, links, alerts, events)
  - Subscribe/notify pattern for reactive component updates
  - Convenience methods for common operations (updateNode, addEvent, etc.)

- Settings Panel (dashboard/js/settings-panel.js):
  - Motion threshold slider (deltaRMS threshold)
  - Fusion rate selection (5/10/20 Hz)
  - Grid cell size and Fresnel decay rate controls
  - Subcarrier count and baseline time constant settings
  - Notification channel config (Ntfy URL/token, Pushover keys)
  - System info display (version, uptime, detection quality, node count)

- Updated index.html with:
  - CSS/JS includes for panel framework
  - Settings button in status bar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 10:04:40 -04:00
Argo Workflows CI
e7f4ff3f17 ci: auto-bump version to 0.1.2 2026-04-06 13:54:22 +00:00
jedarden
1509a0efa7 feat: trigger CI build and verify deployment
- Triggered spaxel-build WorkflowTemplate on iad-ci
- Workflow completed successfully (spaxel-build-manual-vgzjl)
- Image ronaldraygun/spaxel:0.1.0 pushed to Docker Hub
- Pod spaxel-68666c4948-g769d now Running (1/1 READY) on ardenone-cluster
- ArgoCD app spaxel-ns-ardenone-cluster health: Healthy
- Previous ErrImagePull issue resolved
2026-04-06 09:54:08 -04:00
Argo Workflows CI
07a0c7ec00 ci: auto-bump version to 0.1.1 2026-04-06 13:48:49 +00:00
jedarden
118c6b1c9d feat: add new internal packages (events, automation, ble, falldetect, mqtt, notify, prediction, sleep, tracker, zones, analytics) and dashboard modules (anomaly, automations, blepanel, fleet) 2026-04-06 09:48:31 -04:00
jedarden
c75428d488 ci: set VERSION to 0.1.0 for image build 2026-04-06 08:53:25 -04:00
Argo Workflows CI
0f5db551e5 ci: auto-bump version to 0.1.4 2026-04-02 03:43:31 +00:00
jedarden
c8a42a44cb fix: regenerate go.sum for go 1.25 compatibility 2026-04-01 23:43:19 -04:00
Argo Workflows CI
1427ff30c2 ci: auto-bump version to 0.1.3 2026-04-02 02:59:23 +00:00
jedarden
a2e00d39d4 fix(docker): use Go 1.25 to match modernc.org/sqlite v1.47 requirement 2026-04-01 22:59:13 -04:00
Argo Workflows CI
b97769e8ee ci: auto-bump version to 0.1.2 2026-04-02 02:42:33 +00:00
jedarden
46c3516941 fix(docker): remove invalid HEALTHCHECK directive for distroless image 2026-04-01 22:42:18 -04:00
Argo Workflows CI
c1a85b9e82 ci: auto-bump version to 0.1.1 2026-04-02 01:35:29 +00:00
jedarden
9c960fd5d3 fix(build): exclude phase 6 packages to restore compilability
Add build tag to main_phase6.go so default builds use phases 1-5 only.
Fix dashboard/hub.go: remove unused fmt import and phase 6 identity
fields that reference nonexistent tracking.Blob struct members.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 21:33:01 -04:00
jedarden
14c49cb919 feat(breathing): implement stationary person detection via breathing analysis
Add FFT-based breathing detection with long-dwell presence tracking:

- FFTBreathingDetector: Rolling 30-second buffer, Hann window, FFT analysis
  to detect periodic breathing signals in 0.2-1.0 Hz band
- DwellTracker: State machine with CLEAR → MOTION_DETECTED →
  POSSIBLY_PRESENT → STATIONARY_DETECTED transitions
- Health gating: Detection disabled when link health < 0.7
- Dashboard: Slow-pulsing blue dot for stationary detection with BPM tooltip
- Timeline: Event logging on transition to STATIONARY_DETECTED

Physics: CSI phase oscillates at 2x breathing rate due to round-trip
path length change. 15 BPM breathing → 0.5 Hz CSI phase oscillation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 20:25:17 -04:00