Fix agent mode UI state sync for pager, WiFi, and Bluetooth

- Fix device dropdown for agent mode by checking sdr_devices key
- Fix pager checkStatus() to use agent endpoint when in agent mode
- Fix WiFi checkScanStatus() to be agent-aware
- Fix Bluetooth checkScanStatus() to be agent-aware

These fixes prevent the UI from reverting to 'stopped' state when
the agent is actually running a mode.
This commit is contained in:
cemaxecuter
2026-01-27 09:09:29 -05:00
parent f916b9fa19
commit afccb6fe0a
4 changed files with 48 additions and 17 deletions

View File

@@ -650,10 +650,17 @@ const BluetoothMode = (function() {
async function checkScanStatus() {
try {
const response = await fetch('/api/bluetooth/scan/status');
const data = await response.json();
const isAgentMode = typeof currentAgent !== 'undefined' && currentAgent !== 'local';
const endpoint = isAgentMode
? `/controller/agents/${currentAgent}/bluetooth/status`
: '/api/bluetooth/scan/status';
if (data.is_scanning) {
const response = await fetch(endpoint);
const responseData = await response.json();
// Handle agent response format (may be nested in 'result')
const data = isAgentMode && responseData.result ? responseData.result : responseData;
if (data.is_scanning || data.running) {
setScanning(true);
startEventStream();
}