(msg)
| 93 | } |
| 94 | |
| 95 | function broadcast(msg) { |
| 96 | if (!state.wss) return; |
| 97 | const raw = JSON.stringify(msg); |
| 98 | const recipients = []; |
| 99 | for (const ws of state.wss.clients) { |
| 100 | if (isAuthenticatedClient(ws)) { |
| 101 | ws.send(raw); |
| 102 | recipients.push(wsLabel(ws)); |
| 103 | } |
| 104 | } |
| 105 | if (msg.type === 'status' || msg.type === 'transcript_ready' || msg.type === 'turn_state') { |
| 106 | log(`Broadcast ${msg.type} -> ${recipients.length} client(s)${recipients.length ? ` [${recipients.join(', ')}]` : ''}`); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | function autoResolveAllPendingApprovals(reason = '') { |
| 111 | if (state.pendingApprovals.size === 0) return; |
no test coverage detected