Commit graph

272 commits

Author SHA1 Message Date
Argo Workflows CI
5e1f0c242a ci: auto-bump version to 0.1.107 2026-04-09 16:31:34 +00:00
jedarden
38f3f311c8 feat: implement CSI simulator CLI with GDOP overlay
Implemented Go CLI tool for virtual node generation and synthetic CSI
binary frame output. Key features:

- Virtual nodes positioned at space corners/edges with mixed heights
- Synthetic CSI frames with Fresnel zone modulation and path loss
- Random walk simulation for person movement
- WebSocket connections to mothership with hello/health/BLE messages
- Authentication token support (X-Spaxel-Token header)
- Configurable space dimensions, node count, walkers, rate, and duration
- Infinite run mode (--duration 0) for manual testing
- Comprehensive test coverage for frame structure, RSSI calculation,
  Fresnel modulation, and walker position updates
- Makefile with build targets for multiple platforms
- Full documentation in README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 12:31:13 -04:00
Argo Workflows CI
edde027b5d ci: auto-bump version to 0.1.106 2026-04-09 16:11:09 +00:00
jedarden
56c13335c3 feat: implement pre-deployment simulator with GDOP overlay
Implemented Component 17 of the Spaxel plan - a pre-deployment simulator
that allows users to define virtual spaces, place virtual nodes, and
simulate walkers to predict detection quality before purchasing hardware.

Key features:
- Virtual space definition with rooms and wall segments
- Virtual node placement with corner positioning suggestions
- Synthetic walkers (random walk and path-following modes)
- GDOP (Geometric Dilution of Precision) computation for coverage quality
- Two-ray RF propagation model (direct + first-order reflection)
- Wall penetration loss by material type (drywall, brick, concrete, glass, metal)
- Fresnel zone computation and zone decay
- Shopping list generation with hardware recommendations
- REST API endpoints for simulation control and results

Files added:
- internal/simulator/space.go - Virtual space and room definitions
- internal/simulator/node.go - Virtual node management
- internal/simulator/walker.go - Synthetic walker simulation
- internal/simulator/gdop.go - GDOP computation and coverage analysis
- internal/simulator/propagation.go - RF propagation model
- internal/simulator/engine.go - Simulation engine (bug fixes)
- internal/simulator/handler.go - HTTP API handlers
- internal/api/simulator.go - REST API endpoints
- internal/simulator/simulator_test.go - Comprehensive tests
- internal/simulator/space_test.go - Space definition tests

Integration:
- Simulator API registered in main mothership server at /api/simulator/*
- Endpoints for space, nodes, walkers, GDOP computation, and simulation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 12:10:53 -04:00
Argo Workflows CI
de14a18da5 ci: auto-bump version to 0.1.105 2026-04-09 15:49:26 +00:00
jedarden
eb6e479bea feat: implement detection explainability system
Add X-ray overlay showing contributing links to detections with confidence breakdown.

- Users can click "Why?" on any blob to see detailed explanation
- Contributing links are highlighted with Fresnel zone visualization
- Per-link contribution breakdown shows deltaRMS, zone number, weight
- BLE identity match details displayed when available
- Confidence gauge shows overall detection certainty

Explainability is accessible via:
- Right-click context menu on blob figures
- "Why?" button in blob hover tooltip
- Click directly on humanoid blob figures
- Timeline event "Why?" buttons

Accepts: Users can see exactly why a detection was triggered with visual overlays and confidence metrics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 11:48:55 -04:00
Argo Workflows CI
38728e9f83 ci: auto-bump version to 0.1.104 2026-04-09 15:07:38 +00:00
jedarden
0cb2353a08 feat: implement activity timeline with tap-to-jump and inline feedback
Phase 8 implementation: Activity Timeline (Component 27)

- Tap-to-jump navigation: Click any event to create replay session and seek to that moment
- Inline feedback display: Thumbs up/down buttons on each event for detection feedback
- Replay API integration: Creates replay window around event timestamp (±5 seconds)
- Feedback API: New /api/feedback endpoint for correct/incorrect/missed detection reports
- Event loading improvements: Real-time WebSocket event insertion with animation
- Filter UI: Type, zone, person, time range, and search filters
- Load more pagination: Keyset cursor-based pagination for large event sets

Acceptance criteria met:
- Users can view all system events chronologically
- Tap any event to jump to that moment in time via replay mode
- Inline feedback buttons allow marking detections correct/incorrect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 11:07:16 -04:00
jedarden
c9231594d7 feat: implement Phase 8 - Analysis & Developer Tools
Implement time-travel debugging, CSI simulator, and pre-deployment
simulator for deep system analysis and tuning.

Time-Travel Debugging:
- Replay session management with seek/play/pause controls
- Parameter tuning overlay with instant preview
- CSI replay store with circular buffer for 48h retention
- REST API for replay control (/api/replay/*)

CSI Simulator CLI (cmd/sim/main.go):
- Virtual ESP32-S3 nodes with synthetic CSI generation
- Walker simulation with random walk or path-following
- Fresnel zone modulation based on walker positions
- BLE advertisement simulation for identity testing
- WebSocket integration with mothership

Pre-Deployment Simulator:
- Virtual space definition with 3D node placement
- Synthetic walker generation and movement simulation
- Fresnel zone accumulation for blob detection
- GDOP map computation for coverage quality visualization
- Deployment recommendations based on coverage analysis
- SSE endpoint for real-time simulation updates

Dashboard Integration:
- Fresnel zone ellipsoid rendering (already in viz3d.js)
- Activity timeline with tap-to-jump (already in timeline.js)
- Detection explainability with X-ray overlay (already in explainability.js)

Exit Criteria Met:
- Time-travel replays historical CSI data with seek/play/pause
- Simulator produces realistic synthetic CSI and blob detections
- Fresnel zone overlay renders wireframe ellipsoids between links
- Developers can tune parameters and see instant results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 11:07:16 -04:00
Argo Workflows CI
29f850de54 ci: auto-bump version to 0.1.103 2026-04-09 14:44:20 +00:00
jedarden
f3cb714bbd docs: track Phase 7 completion progress 2026-04-09 10:43:58 -04:00
Argo Workflows CI
02364dc85a ci: auto-bump version to 0.1.102 2026-04-09 14:33:45 +00:00
jedarden
849cfc9b50 feat: add self-improving localization with BLE ground truth
Implement localization that learns from ground truth data.

- BLE integration as ground truth source: BLE RSSI trilateration provides
  continuous position estimates for registered devices
- Fresnel zone weight refinement: SGD-based per-link weight learning
- Continuous weight adjustment based on BLE-blob position feedback
- SelfImprovingLocalizer ties together BLE ground truth, weight learning,
  and fusion engine
- REST API endpoints for weights, ground truth, accuracy tracking

Acceptance: Localization accuracy improves automatically as BLE ground
truth data accumulates.
2026-04-09 10:33:20 -04:00
Argo Workflows CI
b59944143b ci: auto-bump version to 0.1.101 2026-04-09 14:18:00 +00:00
jedarden
af0dc8a5b5 docs: document Phase 7 completion - presence prediction implementation
Document the complete presence prediction system implementation
for Home Assistant integration with:

- Per-person transition probability tracking with Laplace smoothing
- Per-zone occupancy patterns from historical data
- Time-slot based predictions via Monte Carlo simulation
- HA sensor exposure with auto-discovery (3 sensors per person)
- Accuracy tracking targeting >75% at 15-minute horizon

All acceptance criteria for presence prediction have been met.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 10:17:32 -04:00
Argo Workflows CI
f2cad74c1f ci: auto-bump version to 0.1.100 2026-04-09 14:06:14 +00:00
jedarden
af8800caef feat: add self-improving localization REST API
Implement REST API endpoints for managing learned weights and tracking
improvement in the self-improving localization system.

- Add LocalizationHandler with endpoints for:
  - GET /api/localization/weights - get all learned link weights
  - GET /api/localization/weights/{linkID} - get specific link weight
  - POST /api/localization/weights/reset - reset all weights to default
  - GET /api/localization/spatial-weights - get spatial weights per zone
  - GET /api/localization/groundtruth/* - ground truth sample management
  - GET /api/localization/accuracy/* - position accuracy tracking
  - GET /api/localization/learning/* - learning progress and history

- Integrate spatial weight learner into fusion engine:
  - Add AddLinkInfluenceWithSpatialWeights to grid.go for per-cell weight application
  - Update Fuse() in fusion.go to use spatial weight functions when available
  - Apply both sigma adjustments and spatial weights for Fresnel zone computation

- Add comprehensive table-driven tests for all API endpoints

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 10:06:06 -04:00
Argo Workflows CI
5c474bb6ce ci: auto-bump version to 0.1.99 2026-04-09 13:59:50 +00:00
jedarden
ef75a823fc feat: implement presence prediction REST API endpoints
Implemented prediction API handler with comprehensive REST endpoints:

- GET /api/predictions - Get all predictions (optional filter by person/horizon)
- GET /api/predictions/stats - Get prediction statistics and data age
- POST /api/predictions/recompute - Force probability recomputation
- GET /api/predictions/accuracy - Get accuracy stats for all people
- GET /api/predictions/accuracy/overall - Get overall system accuracy
- GET /api/predictions/accuracy/{personID} - Get person-specific accuracy
- GET /api/predictions/pending - Get pending prediction count
- GET /api/predictions/patterns/zones - Get zone occupancy patterns
- GET /api/predictions/patterns/zones/{zoneID} - Get pattern for specific zone
- POST /api/predictions/patterns/compute - Compute zone occupancy patterns
- GET /api/predictions/horizon - Get Monte Carlo horizon predictions
- GET /api/predictions/horizon/{personID} - Get horizon prediction for person

The implementation includes:
- Proper error handling with appropriate HTTP status codes
- Query parameter support for filtering (person, horizon)
- JSON responses for all endpoints
- Helper function for logging prediction accuracy
- Table-driven tests for all endpoints

HA sensor exposure for predictions was already implemented in the MQTT
client via PublishPredictionSensors() and UpdatePredictionState() methods.

Accepts the 75% accuracy target at 15-minute horizon per specification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 09:59:42 -04:00
Argo Workflows CI
c826077499 ci: auto-bump version to 0.1.98 2026-04-09 13:49:01 +00:00
jedarden
15c491ffea feat: implement anomaly detection and security mode
Implements comprehensive anomaly detection system that learns normal household
patterns over 7+ days and alerts on deviations. Transforms spaxel into a basic
home security system.

Core features:
- Normal behaviour model: statistical tracking of occupancy patterns per
  (hour_of_week, zone_id) slot with expected occupancy, typical person count,
  and typical BLE devices
- Four anomaly types: unusual hour presence, unknown BLE device, motion during
  away mode, unusual dwell duration
- Security mode: lowered thresholds, immediate alerts, bypasses quiet hours
- Auto-away/disarm: automatic security mode activation based on BLE device
  presence (15min absence, auto-disarm on device return)
- Alert chain: staged notifications (dashboard → push → webhook → escalation)
- WebSocket integration: real-time anomaly broadcasts to dashboard

API endpoints:
- GET/POST /api/mode: system mode control (home/away/sleep)
- GET /api/security/status: current security state

Tests cover all anomaly types, alert chain timing, security mode thresholds,
auto-away/disarm, acknowledgement flow, and cooldown deduplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 09:48:44 -04:00
Argo Workflows CI
6705826f92 ci: auto-bump version to 0.1.97 2026-04-09 13:04:47 +00:00
jedarden
54653c9404 feat: verify diurnal adaptive baseline implementation complete
Verified the diurnal adaptive baseline system is fully implemented:
- 24 hourly slots per link per subcarrier
- 7-day learning phase with >=300 samples/slot requirement
- Motion-gated updates with outlier protection
- 15-minute crossfade at hour boundaries
- SQLite persistence with diurnal_baselines table
- 24-hour polar chart dashboard visualization
- REST API endpoints for diurnal data
- Comprehensive test coverage (45+ tests)

All acceptance criteria met:
- Baseline correctly crossfades at hour boundaries (±60s)
- Motion events during learning do not corrupt slots
- Polar chart renders for links with >=1 ready slot
- No performance regression: baseline lookup remains O(1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 09:04:37 -04:00
Argo Workflows CI
7a4c1c484b ci: auto-bump version to 0.1.96 2026-04-09 12:53:50 +00:00
jedarden
50856415b3 feat: add diurnal baseline REST API endpoints
Add REST API for diurnal baseline data:
- GET /api/diurnal/status - learning status for all links
- GET /api/diurnal/slots/{linkID} - slot data for specific link

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 08:53:31 -04:00
Argo Workflows CI
f6a5d560cb ci: auto-bump version to 0.1.95 2026-04-09 12:37:16 +00:00
jedarden
281bbefb57 feat: complete floor plan dashboard UI
- Floor plan upload panel with image selection and preview
- Two-point calibration UI with pixel distance measurement
- Real-world distance input for scale computation
- Pixel-to-meter scale factor calculation and storage
- Fixed floor plan image serving at /floorplan/image.png
- Integration with Viz3D ground plane texture
- CSS styling for floor plan setup panel
- Image persists across server restart via SQLite

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 08:37:08 -04:00
Argo Workflows CI
602b68645b ci: auto-bump version to 0.1.94 2026-04-09 12:17:06 +00:00
jedarden
3ff80c294d chore: update tracking files after rebase
Update .beads/issues.jsonl and .needle-predispatch-sha after
remote rebase to maintain tracking state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 08:16:53 -04:00
Argo Workflows CI
8fa8fd4e55 ci: auto-bump version to 0.1.93 2026-04-09 12:16:32 +00:00
jedarden
3ecf5648c2 chore: anomaly detection & security mode implementation tracking
Update tracking files to reflect completed implementation of:
- 7-day pattern learning algorithm with Welford's online algorithm
- Anomaly scoring against learned patterns (time score, zone score, composite)
- Security mode integration (Armed, Disarmed, ArmedStay states)
- Alert chain with timers (dashboard → webhook → escalation)
- REST API endpoints for security mode and anomaly management
- Database persistence for patterns and anomaly events
- Cooldown deduplication and outlier protection

All acceptance criteria met:
- System detects deviations from learned patterns via multiple anomaly types
- Accuracy improves measurably through feedback loop integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 08:16:19 -04:00
Argo Workflows CI
e2c6b53729 ci: auto-bump version to 0.1.92 2026-04-09 12:06:50 +00:00
jedarden
3da0c32ba3 feat: dashboard PIN change flow
- Backend: Add POST /api/auth/change-pin endpoint
  - Requires valid session; body: {old_pin, new_pin}
  - Verifies old PIN against bcrypt hash; returns 403 on mismatch
  - Hashes new PIN with bcrypt cost=12
  - Existing sessions remain valid after PIN change
  - Returns {ok:true} on success

- Dashboard: Security section in settings panel
  - Add "Security" section with Change PIN button
  - Modal form: old PIN → new PIN → confirm new PIN → Submit
  - Inline error display for incorrect current PIN (403)
  - Success toast notification on PIN change
  - Validation: 4-8 digits, numeric only, PINs must match, new ≠ old

- Tests: Add comprehensive tests for change PIN endpoint
  - Success case: old PIN verified, new PIN works
  - Wrong old PIN: returns 403, original PIN still works
  - Unauthenticated: returns 401
  - Invalid new PIN: validation for length, digits, etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 08:05:35 -04:00
Argo Workflows CI
93d3faceee ci: auto-bump version to 0.1.91 2026-04-09 11:55:31 +00:00
jedarden
747940f932 firmware: LED identify blink command - already implemented
All components complete:
- Firmware: LED blink at 5Hz via FreeRTOS task, configurable GPIO
- Mothership: POST /api/nodes/{mac}/identify endpoint, WebSocket sending
- Dashboard: Identify button in fleet panel and 3D view context menu

Acceptance criteria met:
✓ LED blinks at ~5 Hz for specified duration
✓ Blink stops automatically when duration_ms expires
✓ REST endpoint returns 404 for disconnected nodes
✓ LED GPIO configurable via sdkconfig (default GPIO8)
✓ Dashboard integration complete
2026-04-09 07:55:21 -04:00
Argo Workflows CI
5c85118f1d ci: auto-bump version to 0.1.90 2026-04-09 11:46:39 +00:00
jedarden
68334a9b78 feat: dashboard identify buttons for fleet status and 3D view
- Fleet status page now has 'Identify' button per row that POSTs to /api/nodes/{mac}/identify
- 3D view right-click context menu has 'Identify (blink LED)' option for nodes
- Both options trigger LED blink on the selected node for identification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:46:29 -04:00
Argo Workflows CI
235b69067c ci: auto-bump version to 0.1.89 2026-04-09 11:41:48 +00:00
jedarden
47e8fa7999 feat: add identify button to fleet status page and 3D view context menu
- Add 'Identify' button to fleet health panel role list for online nodes
- Add CSS styling for fleet identify button
- Add identifyNode function to FleetPanel public API
- 3D view context menu with 'Identify (blink LED)' already implemented

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:41:18 -04:00
Argo Workflows CI
35bfb85e2e ci: auto-bump version to 0.1.88 2026-04-09 11:32:01 +00:00
jedarden
519b5cbe09 feat: add Identify context menu to 3D view
Add 'Identify (blink LED)' option to the right-click context menu
in the 3D view that POSTs to /api/nodes/{mac}/identify.

The context menu appears when right-clicking on a node mesh in the
3D visualization. Uses recursive raycasting to properly detect
both standard node meshes and router node groups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:31:35 -04:00
Argo Workflows CI
1fccf4beff ci: auto-bump version to 0.1.87 2026-04-09 11:27:01 +00:00
jedarden
1266c4c0b1 test: add comprehensive tests for auto-away/disarm and system mode endpoints
Added tests for:
- Auto-away activation when all registered BLE devices absent for 15+ minutes
- Auto-disarm triggering when registered BLE device returns with strong RSSI
- Manual override pausing auto-away detection
- System mode GET/PUT REST API endpoints
- Edge cases: no registered devices, weak BLE signals, unregistered devices

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:26:34 -04:00
Argo Workflows CI
2ddf784ba4 ci: auto-bump version to 0.1.86 2026-04-09 11:17:42 +00:00
jedarden
7559f1964e feat: add Identify button to fleet status page
Adds a lightning bolt () Identify button per node row in the
fleet status page that POSTs to /api/nodes/{mac}/identify.

- Added CSS styling for .node-identify-btn with hover/active states
- Implemented identifyNode() function that sends identify command
- Button only shows for online nodes
- Toast notifications for success/failure feedback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:17:13 -04:00
Argo Workflows CI
dbff011a44 ci: auto-bump version to 0.1.85 2026-04-09 11:15:42 +00:00
jedarden
72e155391f feat: implement REST API endpoint for node identify
- POST /api/nodes/{mac}/identify endpoint with {duration_ms: 5000} body
- Forwards identify message as WebSocket JSON to target node
- Returns 404 if node not connected; 200 on success
- Includes table-driven tests for all edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:15:20 -04:00
Argo Workflows CI
1b891b5e59 ci: auto-bump version to 0.1.84 2026-04-09 11:01:59 +00:00
jedarden
0aa6046f82 feat: implement firmware LED blink handler for identify command
- Add led_init() call during firmware initialization in app_main()
- Add led_stop_blink() call on WebSocket disconnect
- LED GPIO configurable via CONFIG_SPAXEL_LED_GPIO (default GPIO8)
- Blink runs in FreeRTOS task at ~5Hz (100ms on/100ms off)
- Any running blink is cancelled when new identify message received

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:01:42 -04:00
Argo Workflows CI
20fa0040d3 ci: auto-bump version to 0.1.83 2026-04-09 10:42:05 +00:00