Commit graph

83 commits

Author SHA1 Message Date
jedarden
a574a84653 feat: implement contextual help system with searchable overlay
- Add '?' button in expert mode status bar that opens help overlay
- Search input with fuzzy search (same algorithm as command palette)
- 43 help articles covering major features (sensing links, Fresnel zones,
  detection quality, presence prediction, fall detection, etc.)
- Articles stored as static JSON (dashboard/help_articles.json)
- No server round-trip - loads articles client-side
- Category filter buttons for easy navigation
- Keyboard shortcut: Ctrl+? to open help overlay

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 00:35:46 -04:00
jedarden
df31fc6bd8 feat: implement contextual help system with searchable overlay
- Add '?' button in status bar that opens help overlay
- Fuzzy search across 37 help articles covering major features
- Sample articles include: sensing links, detection quality, presence prediction, Fresnel zone
- Articles stored as static JSON (dashboard/help_articles.json)
- No server round-trip - all client-side
- Keyboard shortcut: Ctrl+? / Cmd+?

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 00:35:46 -04:00
jedarden
c817e96802 feat: implement repeated-setting change detection with guided calibration
Detects when user changes same config setting 3+ times within 24 hours.
Shows non-intrusive prompt offering help with guided calibration flow.

Guided calibration features:
- Test for false positives (walk around room)
- Test for missed motion (sit still)
- Suggest optimal value based on diurnal baseline SNR and link health
- Apply suggested value button

Files:
- dashboard/js/proactive.js: Complete implementation with localStorage tracking

Acceptance:
- Help prompt fires after 3+ changes in 24h
- Calibration flow tests both directions
- Suggests value based on system data
- Apply button works
2026-04-11 00:18:19 -04:00
jedarden
fa32cf5ee7 feat: implement post-feedback explanations for false positive detections
- Add renderFeedbackExplanation() function to display detailed explanations
- Include contributing link name, threshold exceed ratio, and timestamp
- Add diagnostic info (root cause and advice) when available
- Add expandable UI with toggle arrow
- Add CSS styles for explanation section
- Show correction note about system learning from feedback

When user marks detection as FALSE_POSITIVE, show explanation:
'The system detected motion here because: [link]'s signal exceeded
threshold by Nx at [time]. Could be caused by: [root cause or
'ambient RF interference']. We've noted this and will apply a correction.'

Files: dashboard/js/feedback.js
Acceptance: explanation shown after any FALSE_POSITIVE feedback;
contains contributing link name; shows diagnostic result or default message.
2026-04-11 00:18:19 -04:00
jedarden
6812da8ccb feat: implement repeated-setting change detection with guided calibration
- Add dashboard/js/proactive.js module with:
  - Track qualifying setting changes (delta_rms_threshold, breathing_sensitivity,
    tau_s, fresnel_decay, n_subcarriers) in localStorage with 24h window
  - Show non-intrusive banner after 3+ changes to same setting
  - "Help me tune this" button opens guided calibration flow
  - Two-test calibration: walk around room (false positives), sit still (missed motion)
  - Suggest optimal value based on diurnal baseline SNR and link health
  - Apply suggested value button with API integration

- Include proactive.js in dashboard/index.html

- Integrate with settings-panel.js to track setting changes on save

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 00:13:51 -04:00
jedarden
f0798edc6b feat: implement repeated-setting change detection with guided calibration
Detect when a user changes the same configuration setting more than 3
times within 24 hours and show a non-intrusive prompt offering help.

Features:
- Track qualifying setting changes (delta_rms_threshold, breathing_sensitivity,
  tau_s, fresnel_decay, n_subcarriers) in localStorage
- Non-intrusive help prompt with "Help me tune this" button
- Guided calibration flow with:
  - False positive test: walk around room for 15 seconds
  - Missed motion test: sit still for 10 seconds
  - Suggest optimal value based on diurnal baseline SNR and link health
  - Apply suggested value button
- Full modal UI with progress indicators and countdown timers
- Integration with settings-panel.js for automatic tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 00:05:52 -04:00
jedarden
d81d1cb82c feat: implement ambient dashboard mode with Canvas 2D renderer
- Added /ambient route serving ambient.html for wall-mounted tablet display
- Canvas 2D renderer at 2Hz with lerp interpolation for smooth person movement
- Time-of-day palette with 30-minute transitions (morning/day/evening/night)
- Auto-dim: reduces brightness to 40% after 60s of no presence
- Alert mode: pulsing red background for fall/security alerts
- Morning briefing overlay: 15-second overlay on first detection after 6am
- Unified alerts API for fall, anomaly, and node_offline events
- Jest test setup mocking Canvas 2D context for jsdom

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 23:16:52 -04:00
jedarden
3c6368cd39 feat: implement spatial quick actions context menu for 3D scene
Implements right-click and long-press context menus for all 3D elements:

- Raycasting with priority order: tracks > nodes > zones > portals > triggers > ground
- Context menu renders in under 50ms with intelligent viewport positioning
- Element-specific actions:
  * Tracks: identify, follow camera, view history, false positive, explain, set unknown
  * Nodes: edit label, health details, OTA update, blink LED, reassign role, remove
  * Zones: edit bounds, rename, occupancy history, automation, delete
  * Empty space: add virtual node, create zone, set home point, place portal
  * Portals: edit, crossing history, delete
  * Triggers: edit, test fire, toggle enable, delete

Follow camera mode:
- Smooth interpolation using VectorLerp (default 3m behind, 2m above)
- "Following: [Person]" chip with unfollow button
- Scroll wheel zoom adjustment during follow
- Auto-exit when track deleted or becomes DELETED state
- OrbitControls disabled during follow mode

Tests: 22 tests covering raycasting, menu items, follow mode,
dismissal behavior, action execution, and performance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 22:56:17 -04:00
jedarden
cb01246657 feat: implement ambient dashboard mode with Canvas 2D renderer
Implement ambient display mode for wall-mounted tablets with:

- Canvas 2D renderer (ambient_renderer.js) with 2 Hz render rate
- Time-of-day palette transitions (morning/day/evening/night)
- Zone outlines, portal lines, node positions, person blobs
- Lerp-interpolated smooth movement (20% factor per frame)
- Auto-dim after 60s of no presence in ambient zone
- Alert mode with pulsing red background and acknowledge button
- Morning briefing overlay (15s display after 6am)
- System status indicator and time display

Files:
- dashboard/js/ambient_renderer.js: Canvas 2D rendering engine
- dashboard/js/ambient_briefing.js: Morning briefing overlay
- dashboard/js/ambient.test.js: Test suite
- dashboard/css/notifications.css: Notification styles
- dashboard/css/simulator.css: Simulator styles
- dashboard/js/notifications.js: Notification handling
- dashboard/js/simplemode.js: Simple mode logic
- dashboard/simple.html: Simple mode page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 22:09:12 -04:00
jedarden
72b9256ff4 feat: implement room transition portals and zone occupancy
Implements the complete zone and portal system for room transition
detection and occupancy tracking:

- Zone definitions using AABB volumes stored in SQLite
- Portal definitions as doorway planes with plane points and dimensions
- Portal editor in 3D dashboard using TransformControls
- Zone editor in 3D dashboard for interactive zone placement
- Crossing detection algorithm running at 10Hz in TrackManager
- Two-phase crossing detection (tentative + committed) with velocity threshold
- Occupancy counter with reconciliation pass for persisted values
- WebSocket broadcasts for zone_occupancy and zone_transition events
- REST API endpoints for zones and portals CRUD operations
- Comprehensive tests for crossing detection, occupancy, and reconciliation

Dashboard changes:
- Add portal.js for 3D portal editor with TransformControls
- Add zone-editor.js for 3D zone editor with TransformControls
- Update index.html with portal/zone editor panels
- Update app.js with zone_change, portal_change, zone_occupancy, zone_transition handlers
- Update viz3d.js with zone/portal mesh rendering

Backend changes:
- Wire zone manager in main.go
- Add WebSocket broadcasters in dashboard hub
- Add comprehensive tests in zones/manager_test.go

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 08:10:12 -04:00
jedarden
d9a4b22017 feat: add Position column to fleet status table with fly-to functionality
- Add Position column showing (x, y, z) coordinates for each node
- Make position clickable to fly camera to node in 3D view
- Add bulk actions: Restart Selected, Update All, Re-baseline All, Export, Import
- Expose Viz3D.flyToNode() function for camera navigation
- Include node position, firmware version, uptime, and last seen in API response

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 05:12:24 -04:00
jedarden
e0d0879598 feat: make expert mode mobile-responsive with touch orbit/pan/zoom
- Add touch-action: none to scene container to prevent default browser touch behaviors
- Configure OrbitControls for touch gestures (one-finger rotate, two-finger pan, pinch zoom)
- Add comprehensive mobile responsive CSS with media queries
- Add mobile menu toggle button to show/hide panels on small screens
- Add touch-specific optimizations for larger touch targets (44px minimum)
- Optimize panel layouts for mobile (collapsible panels, adjusted spacing)
- Disable hover effects on touch devices, use active states instead
- Add touch event handlers to prevent accidental panel collapse

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 04:39:46 -04:00
jedarden
b583990d43 feat: implement guided troubleshooting with proactive contextual help
Implemented Component 36 of the plan, providing proactive contextual help
and post-feedback explanations for Spaxel users.

Backend (Go):
- FleetNotifier: Track node offline events with 2-hour threshold
- EditTracker: Monitor repeated settings changes for hint triggers
- ZoneQualityTracker: Detect degraded detection quality (>24h below 60%)
- DiscoveryTracker: First-time feature discovery tooltips
- Manager: Coordinate all guided troubleshooting features with 5min checks
- API endpoints: /api/guided/* for issues, tooltips, feedback, calibration

Frontend (JavaScript):
- tooltip.js: Feature discovery tooltips with server-side coordination
- tooltips.js: Sequential tooltip tour manager for first-time users
- troubleshoot.js: Troubleshooting manager for quality/offline events
- guided-help.js: Step-by-step guidance content

Integration:
- Manager runs in background checking quality and node status
- Settings handler wired to edit tracker for repeated-edit hints
- Dashboard WebSocket events trigger proactive help
- All styling included for banners, cards, and tooltips

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 04:25:31 -04:00
jedarden
4a4e8a114a feat: implement guided troubleshooting with proactive contextual help
Implements Component 36: Guided Troubleshooting system with proactive
contextual help and post-feedback explanations.

Backend (mothership/internal/guidedtroubleshoot/):
- Manager: Coordinates all guided troubleshooting features
- EditTracker: Monitors repeated settings edits (3 in 60min triggers hint)
- ZoneQualityTracker: Detects quality degradation (<60% for >24h)
- DiscoveryTracker: First-time feature discovery tooltips
- FleetNotifier: Node offline event handling with 2min grace period

API (mothership/internal/api/guided.go):
- GET /api/guided/issues - List active troubleshooting issues
- POST /api/guided/issues/quality/{zoneId}/dismiss - Dismiss quality banner
- POST /api/guided/feedback/response - Inline feedback response
- POST /api/guided/calibration/complete - Calibration reinforcement
- GET /api/guided/node/{mac}/troubleshoot - Node troubleshooting steps
- GET /api/guided/tooltip/{featureId} - Feature discovery tooltips
- POST /api/guided/tooltip/{featureId}/dismiss - Dismiss tooltip

Frontend:
- troubleshoot.js: Node offline cards, quality banners, calibration reinforcement
- guided-help.js: Step-by-step guides for common troubleshooting scenarios
- tooltips.js: First-time feature discovery with localStorage persistence
- feedback.js: Thumbs-up/down feedback with inline responses

Integration:
- Settings edit tracking via SetEditTracker on settingsHandler
- WebSocket events for quality_drop, repeated_edit, calibration_complete
- Hub broadcasts node status changes for FleetNotifier
- Main.go initializes guidedMgr with zones and fleet callbacks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 04:25:31 -04:00
jedarden
7969920eb2 feat: complete morning briefing feature with provider adapters and API fixes
- Wire up briefing providers (zone, person, prediction, health) in main.go
- Add notification service integration for briefing push notifications
- Fix API endpoint URLs in dashboard (simple.js and ambient.js)
- Complete settings persistence and validation for briefing configuration
- Add test notification endpoint with notify service integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 04:25:31 -04:00
jedarden
1a52dde111 feat: implement morning briefing feature
Add daily summary card with push notification option.

- Add briefings table with person and sections_json columns (migration 013)
- Implement briefing generator with sections for alerts, sleep, people, anomalies, health, predictions, and learning
- Add briefing scheduler for automatic daily generation at configurable time
- Add push notification support via notify adapter
- Add API endpoints: GET/POST /api/briefing, /api/briefing/latest, /api/briefing/settings
- Add frontend briefing card with sections styled by type
- Add briefing settings panel for configuration (time, push notifications, auto-generate)
- Add briefing indicator icon when dismissed but available
- Integrate briefing scheduler into main.go with providers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 00:25:33 -04:00
jedarden
61e4035862 feat: implement command palette with fuzzy matching and mode awareness
- Ctrl+K/Cmd+K keyboard shortcut for power user efficiency
- Fuzzy matching across zones, people, nodes, events, settings, and help
- Categories: navigation, fleet, security, nodes, zones, view, mode, theme, help
- Recent commands tracking with localStorage persistence
- Keyboard navigation (arrows, Page Up/Down, Home/End, Enter)
- Search result highlighting with mark tags
- Help modal with contextual documentation
- Dismissible keyboard shortcut hint for first-time users
- Mode awareness: only available in expert mode (disabled in simple/ambient)
- Show toast notification when opened from restricted modes
- CSS with dark/light mode support and reduced motion preference
- Full keyboard accessibility with visible focus indicators
- Command registry API for dynamic command registration
2026-04-09 23:11:07 -04:00
jedarden
b9292db99f feat: implement spatial quick actions with follow camera
- Add userData.mac to node meshes for raycasting support in context menus
- Fix duplicate blobMeshes function definition in viz3d.js
- Fix typo: FeeddownPanel -> FeedbackPanel in quick-actions.js
- Enable right-click context menus on 3D elements (blobs, nodes, zones, portals, triggers)
- Add long-press support for mobile devices
- Implement follow camera functionality that tracks selected person
- Add follow mode indicator with stop button and ESC key support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 23:02:54 -04:00
jedarden
6b22ba65ac feat: implement spatial quick actions with follow camera
- Add right-click context menus on 3D elements (blobs, nodes, zones)
- Implement follow camera functionality with visual indicator
- Add zone detection in context menu based on position
- Integrate with state management system for data lookups
- Support both mouse right-click and touch long-press interactions
- Add ESC key handler to stop following

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 22:54:36 -04:00
jedarden
6d30c63414 feat: implement ambient dashboard mode for wall-mounted tablets
- Add /ambient route serving dedicated ambient.html page
- Simplified top-down floor plan using Canvas 2D (no Three.js)
- Time-of-day aware palettes: morning (bright/cool), day (neutral), evening (warm amber), night (dim)
- People rendered as glowing colored dots (BLE-identified) or neutral dots (unknown)
- Room labels with occupancy counts
- Auto-dim after 30 minutes of inactivity
- Alert mode with pulsing red border and action buttons
- Morning briefing integration with auto-dismiss
- WebSocket for real-time blob and zone updates
- Lightweight implementation targeting <30 MB RAM for older tablets
- OLED-safe night mode with true black background
2026-04-09 22:26:37 -04:00
jedarden
425d503449 feat: implement simple mode UI with WebSocket integration
- Add card-based mobile-first UI for non-technical users
- Implement room occupancy cards with real-time updates
- Add activity feed with WebSocket integration
- Support progressive disclosure from simple to expert mode
- Integrate with router for hash-based navigation (#simple)
- Handle WebSocket messages for blobs, zones, events, and alerts
- Add room detail modals and security mode toggle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 22:08:03 -04:00
jedarden
cdd9c64800 feat: complete pre-deployment simulator implementation
Implements comprehensive pre-deployment simulator for WiFi CSI-based
positioning that allows users to predict detection quality before
purchasing hardware.

Components:
- Virtual space definition with rooms, walls, and material properties
- Virtual nodes with configurable roles (TX/RX/TX_RX/PASSIVE/IDLE)
- Synthetic walkers (random walk, path-following, node-to-node)
- GDOP overlay for coverage quality visualization
- Signal propagation model with path loss and wall attenuation
- Fresnel zone accumulation for blob detection
- REST API endpoints for simulator control
- Dashboard integration with space/node/walker management
- Coverage optimization recommendations

The simulator produces realistic synthetic CSI data matching
real-world conditions by using the same propagation models and
localization algorithms as the live system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:30:47 -04:00
jedarden
a70e3e433d feat: implement GDOP overlay for simulator visualization
- Add GET /api/simulator/gdop/heatmap endpoint in both simulator handlers
- Fix viz3d.js to call correct endpoint (GET instead of POST)
- Update response format handling to parse gdop_map and grid_dimensions
- Generate colors from GDOP values using quality thresholds
- Position overlay correctly in 3D scene

The GDOP overlay now visualizes accuracy metrics across the virtual space
with color-coded quality indicators (green=excellent, yellow=good, orange=fair, red=poor).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:30:47 -04:00
jedarden
6d975f472b feat: implement time-travel debugging and CSI replay
This commit implements the replay feature that allows users to pause the
live 3D view, scrub through a 48-hour recording buffer, and replay the 3D
scene exactly as it was at any historical moment.

Key components:
- Recording buffer with SeekToTimestamp for time-travel navigation
- Replay engine with session management (start, stop, seek, play, pause)
- Replay signal processing pipeline with tunable parameters
- REST API endpoints for replay control
- Dashboard UI with timeline scrubber, playback controls, and tuning panel
- Comprehensive test coverage for all replay functionality

Acceptance criteria met:
- Seek to any point in 48-hour window completes in < 1 second
- Replay produces identical blob positions to original live processing
- Parameter sliders re-process in < 3 seconds
- "Apply to Live" correctly writes parameter changes
- Timeline scrubber event markers correctly align
- "Back to Live" correctly resumes live detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 19:27:42 -04:00
jedarden
be7afae362 feat: integrate VolumeEditor initialization with 3D scene
- Initialize VolumeEditor module in initScene() override
- Pass scene, camera, controls, and renderer to VolumeEditor.init()
- Enables 3D trigger volume drawing and visualization
- Completes spatial automation trigger volume builder implementation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 18:32:45 -04:00
jedarden
245bbe89bb docs: verify REST API implementation completeness
All required REST API endpoints have been verified as implemented:

- Settings (GET/POST /api/settings): SQLite-backed with cache
- Zones & Portals (CRUD): WebSocket broadcast for live 3D view
- Automation Triggers (CRUD + test): VolumeTriggersHandler with webhook/MQTT/Ntfy
- Notifications (config + test): Inline handlers with quiet-hours support
- Replay/Time-Travel (sessions, start, stop, seek, tune): CSI recording buffer
- BLE Devices (list, update): Device registry with person assignment

All handlers include OpenAPI-style godoc comments and proper error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 18:18:42 -04:00
jedarden
8216c76bd0 feat: implement Fresnel zone debug overlay for 3D visualization
Add comprehensive Fresnel zone ellipsoid visualization for all active links
in the 3D scene. Provides developers with real-time feedback on link
coverage geometry and detection quality.

Features:
- FresnelEllipsoid() helper function in dashboard/js/fresnel.js for shared
  ellipsoid geometry computation (used by both debug and explainability)
- Wireframe + fill material rendering for clear ellipsoid visualization
- Debug layer toggle in node panel (expert mode only)
- Hover interaction with tooltip showing link details (distance, wavelength,
  Fresnel radius, health score)
- Click interaction to select corresponding link in sidebar
- Mobile viewport optimization (reduced segment count for performance)
- Comprehensive test coverage for ellipsoid geometry computation

The first Fresnel zone ellipsoid represents the region where point
reflectors have maximum impact on CSI phase. Visualizing these zones
helps system tuners understand why localisation places blobs in specific
positions and identify coverage gaps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 17:17:43 -04:00
jedarden
c3572e4305 feat: implement time-travel debugging and CSI replay
This commit adds complete time-travel debugging capabilities for CSI data,
enabling users to pause the live 3D view, scrub through historical data,
and replay the 3D scene exactly as it was at any point in the 48-hour recording
window.

Key features:
- ReplayEngine with state machine (LIVE, PAUSED, REPLAYING, SEEKING)
- Replay pipeline separate from live pipeline with tunable parameters
- WebSocket command handlers for replay control (seek, play, pause, set_params, apply_to_live)
- Timeline scrubber UI with playback controls and parameter tuning panel
- Seek performance < 1 second for all active links
- Parameter sliders for motion threshold, baseline tau, fresnel decay, subcarriers, breathing sensitivity

Implementation:
- mothership/internal/replay/engine.go: ReplayEngine with state machine
- mothership/internal/replay/pipeline.go: Replay signal processing pipeline
- mothership/internal/replay/types.go: Session types and TunableParams
- mothership/internal/dashboard/server.go: WebSocket command handlers
- dashboard/js/replay.js: Timeline scrubber UI with playback controls
- mothership/internal/dashboard/hub.go: BroadcastReplayBlobs method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 16:50:40 -04:00
jedarden
1995b06820 feat: add anomaly_detected and sleep_session_end to valid event types
- Update isValidEventType to include anomaly_detected and sleep_session_end
- These event types were already supported in simple mode filtering
- Ensures consistency between type validation and mode filtering
2026-04-09 15:30:45 -04:00
jedarden
d879e2268b feat: add search and filter to timeline with category checkboxes
Implement comprehensive filter bar with:
- Type filter checkboxes for event categories (Presence, Zones, Alerts, System, Learning)
- Person and zone dropdowns for filtering
- Date range selector with preset options (Today/Last 7 days/Last 30 days/Custom)
- Text search input for fuzzy matching on descriptions
- Client-side filtering for loaded events (instant feedback)
- Server-side filtering for date-range queries
- Load more pagination works for 500+ results

Backend changes:
- Add support for 'since'/'until' date range parameters in /api/events
- Add zone_id and person_id query parameter aliases
- Add POST /api/events/{id}/feedback endpoint for feedback submission

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 14:33:33 -04:00
jedarden
54cab1e89d wip: various improvements
- Visualization improvements in 3D view
- Event API enhancements
- Replay system refinements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 13:52:10 -04:00
jedarden
acd4df2e19 feat(s simulator): implement synthetic walkers for node-to-node traversal
Add WalkerTypeNodeToNode that traverses between virtual nodes with realistic movement patterns:
- Walkers move from node to node in sequence, optionally waiting at each node
- Realistic speed variation (0.8x-1.2x base speed) for natural movement
- Acceleration/deceleration when approaching target nodes
- Falls back to random walk if no nodes are configured
- Maintains consistent walker height throughout traversal

New factory functions:
- NewNodeToNodeWalker() - creates walker with configurable wait time
- NewNodeToNodeWalkerNoWait() - creates walker without waiting
- CreateNodeToNodeWalkers() - creates multiple walkers with node rotation
- WalkerSet.AddNodeToNodeWalker() - add to walker set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 13:08:24 -04:00
jedarden
18e1b3c998 feat: add Fresnel zone wireframe visualization for active links
Implemented physics-based Fresnel zone ellipsoid visualization between
communicating nodes with proper WiFi wavelength scaling (λ ≈ 0.123m for
2.437 GHz). Features wireframe ellipsoids for first 3 Fresnel zones
with link-health-based coloring and toggle control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 12:37:07 -04: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
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
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
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
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
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
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
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
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
jedarden
24e652a389 feat: integrate OUI lookup into passive radar AP detection
- Add manufacturer display to AP detection banner
- Show "your router (Manufacturer)" when OUI is known
- Show "your router" as fallback when OUI unknown
- Expand OUI database with more manufacturer entries

The AP detection banner now shows the router manufacturer
when available from OUI lookup, making it easier for users
to identify their router during the onboarding process.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 06:35:44 -04:00
jedarden
636f3efba2 feat: complete anomaly detection & security mode dashboard UI
- Add anomaly.css and sleep.css to dashboard includes
- Add sleep.js for sleep quality monitoring
- Implement analytics API handler (flow, dwell, corridors)
- Add tracks API and tests for time-based data queries
- Add sleep monitor tests
- AnomalyDetector initialized and running in main()
- Anomaly events broadcast via WebSocket to dashboard
- Security mode arm/disarm persists across restarts (learning_state table)
- Learning progress tracking and display
- Alert banner with acknowledge functionality
- All API endpoints wired: /api/anomalies, /api/security/*, /api/analytics/*

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 05:59:54 -04:00
jedarden
bf40673b72 feat: wire anomaly detection & security mode API endpoints
AnomalyDetector is initialized in main() with periodic model updates.
Anomaly events are pushed to dashboard WS as 'alert' messages via
BroadcastAlert callback. Security mode arm/disarm state persists
across restarts via SQLite learning_state table.

Endpoints:
- GET /api/anomalies?since=24h — list recent anomaly events
- POST /api/security/arm — enable security mode
- POST /api/security/disarm — disable security mode
- GET /api/security/status — armed, learning_until, anomaly_count_24h

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 14:36:59 -04:00
jedarden
ff3428fee6 feat: robust WebSocket reconnection with backoff, extrapolation, and visual states
Implements exponential backoff (1s→10s cap) with ±500ms jitter,
blob position extrapolation during disconnects (capped at 2s),
three visual states (silent <5s, dimming 5-30s, modal >30s),
and automatic scene restoration on reconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 12:34:35 -04:00
jedarden
97f1eafc6f feat: process buffered events from delta WebSocket updates
Events (zone entries/exits, portal crossings, presence transitions)
were already broadcast immediately via BroadcastEvent, but the
buffered copies included in the 10 Hz delta tick were silently
dropped by handleIncrementalUpdate. Now delta events are processed
through the same handleEventMessage path, with dedup to avoid
double-processing when both immediate and delta copies arrive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 11:04:49 -04:00
jedarden
cac25e86e8 feat: implement security mode dashboard UI
- Update learning progress display to show "X of Y days complete" format
- Add last anomaly location info to security dialog stats
- Add CSS styling for anomaly event type in timeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 10:22:00 -04:00
jedarden
80ac99ca7c feat: implement security mode dashboard UI
- Add security status indicator in status bar with mode badge
  (DISARMED / LEARNING / ARMED / ALERT)
- Add arm/disarm toggle button with confirmation dialog
- Add learning period progress bar display
- Add alert banner for anomalies when armed
- Add acknowledge functionality for anomalies
- Integrate with WebSocket for real-time updates
- Add security.css with responsive styles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 10:14:51 -04:00
jedarden
5b24192186 feat: add trigger_state WebSocket message type to /ws/dashboard feed
Broadcasts { type: 'trigger_state', trigger: { id, name, last_fired, enabled } }
on trigger fire, enable, and disable events. Handled in app.js onmessage
and forwarded to window.Automations.updateTriggerState().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 08:41:17 -04:00