From 6812da8ccb1b0675133a2e545faee98e07559a87 Mon Sep 17 00:00:00 2001 From: jedarden Date: Sat, 11 Apr 2026 00:13:08 -0400 Subject: [PATCH] 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 --- dashboard/index.html | 2 ++ dashboard/js/proactive.js | 4 ++-- dashboard/js/settings-panel.js | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dashboard/index.html b/dashboard/index.html index fc63c62..70b38a4 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -3102,6 +3102,8 @@ + + diff --git a/dashboard/js/proactive.js b/dashboard/js/proactive.js index 480df48..652f087 100644 --- a/dashboard/js/proactive.js +++ b/dashboard/js/proactive.js @@ -835,8 +835,8 @@ const readyCount = diurnalData.filter(d => d.is_ready).length; diurnalReady = readyCount > (diurnalData.length / 2); // Majority ready - // Average learning progress - const progressValues = diurnalData.map(d => d.learning_progress || 0).filter(p => p >= 0); + // Average learning progress (backend returns 'progress' field, 0-100 range) + const progressValues = diurnalData.map(d => (d.progress || 0) / 100).filter(p => p >= 0); if (progressValues.length > 0) { learningProgress = progressValues.reduce((a, b) => a + b, 0) / progressValues.length; } diff --git a/dashboard/js/settings-panel.js b/dashboard/js/settings-panel.js index 2203141..009e460 100644 --- a/dashboard/js/settings-panel.js +++ b/dashboard/js/settings-panel.js @@ -447,6 +447,17 @@ if (window.SpaxelState) { Object.assign(window.SpaxelState.settings, updates); } + + // Track setting changes for proactive assistance + if (window.Proactive) { + // Track each qualifying setting that changed + const qualifyingSettings = ['delta_rms_threshold', 'fresnel_decay', 'n_subcarriers', 'tau_s', 'breathing_sensitivity']; + for (const key in updates) { + if (qualifyingSettings.includes(key)) { + window.Proactive.trackSettingChange(key, updates[key]); + } + } + } }); }