feat(diagnostic): Liste, wer gerade mit dem RVS-Raum verbunden ist

Einstellungen, zwischen Runtime-Konfiguration und App-Onboarding: alle
Verbindungen im Raum des konfigurierten Tokens — Art, Name, Details,
Adresse, verbunden seit, zuletzt aktiv.

RVS merkt sich pro Verbindung, wer sie ist: aus Nachrichten, die ohnehin
fliessen (sat_hello, host_hello, worker_hello, update_check der App,
llm_cluster_*), oder aus dem neuen client_hello (Bridge, Diagnostic, App
mit Geraetename). Adresse aus X-Forwarded-For hinter einem Reverse-Proxy.
room_clients_query liefert NUR den eigenen Raum; room_clients von Clients
wird nicht weitergereicht. Typen in der Allow-List ergaenzt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 12:34:14 +01:00
co-authored by Claude Opus 5.5
parent 2267f0a726
commit 7b4a1f4429
5 changed files with 188 additions and 1 deletions
+16
View File
@@ -1216,6 +1216,12 @@ function connectRVS(forcePlain) {
state.rvs.lastError = null;
rvsWs = ws;
broadcastState();
// Beim RVS vorstellen (Liste "Wer ist im Raum?")
try {
ws.send(JSON.stringify({ type: "client_hello", payload: {
kind: "Diagnostic", name: require("os").hostname(), detail: "ARIA-Diagnostic" },
timestamp: Date.now() }));
} catch (_) {}
// Keepalive: alle 25s ein Ping senden damit die Verbindung nicht stirbt
const keepalive = setInterval(() => {
@@ -1294,6 +1300,9 @@ function connectRVS(forcePlain) {
} else if (msg.type === "host_ping") {
const p = msg.payload || {};
if (p.hostId && hosts.has(p.hostId)) hosts.get(p.hostId).last_seen = Date.now();
} else if (msg.type === "room_clients") {
// Antwort des RVS: wer ist in unserem Raum → an den Browser
broadcast({ type: "room_clients", payload: msg.payload || {} });
} else if (msg.type === "rooms_info") {
// Antwort des RVS auf rooms_query → an den Browser (Raum-Diagnose).
broadcast({ type: "rooms_info", payload: msg.payload || {} });
@@ -3181,6 +3190,13 @@ wss.on("connection", (ws) => {
log("info", "host", `Agent '${id}' aus der Liste entfernt`);
broadcastHosts();
}
} else if (msg.action === "room_clients_query") {
// Nur ueber die feste Verbindung — die Antwort kommt auf ihr zurueck
if (rvsWs && rvsWs.readyState === WebSocket.OPEN) {
rvsWs.send(JSON.stringify({ type: "room_clients_query", payload: {}, timestamp: Date.now() }));
} else {
ws.send(JSON.stringify({ type: "room_clients", payload: { error: "Diagnostic ist nicht mit dem RVS verbunden", clients: [] } }));
}
} else if (msg.action === "rooms_query") {
// Browser will die RVS-Raum-Diagnose — via persistente rvsWs anfragen,
// die Antwort (rooms_info) kommt auf derselben Verbindung zurueck.