fix(diagnostic): JS-Crash beim Laden durch Ghost-IDs aus OpenClaw-Zeit

Die Diagnostic-Seite lud nicht mehr richtig: bei jedem state-Update vom
Server crashte updateState() auf null.className weil 'gw-dot' nicht mehr
existiert (Gateway-Card wurde durch Brain-Card ersetzt). Mehrere weitere
Stellen waren ebenfalls auf nicht mehr existierende Elemente geleitet.

Bereinigt:
  - updateState() nutzt jetzt brain-dot/short/error (null-safe)
  - openCoreTerminal entfernt (aria-core ist raus)
  - closeTermModal null-safe fuer btn-core-term
  - 'core_auth' WS-Event entfernt
  - 'session_restarted' WS-Event entfernt (perms-status-Element war auch raus)
  - 'openclaw_config' WS-Event entfernt
  - rc-compact-after read/write aus loadRuntimeConfig/saveRuntimeConfig raus
    (Compact-After-Messages-Setting wurde mit aria-core entfernt)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 22:53:30 +02:00
parent 7b55d6a91f
commit d12f356ebe
+18 -43
View File
@@ -1230,12 +1230,7 @@
el.textContent = msg.error ? `Fehler: ${msg.error}` : msg.info; el.textContent = msg.error ? `Fehler: ${msg.error}` : msg.info;
return; return;
} }
if (msg.type === 'core_auth') { // core_auth WS-Event entfernt — aria-core ist raus.
const el = document.getElementById('core-auth');
el.style.display = 'block';
el.textContent = msg.error ? `Fehler: ${msg.error}` : msg.info;
return;
}
// Live SSH + Desktop // Live SSH + Desktop
if (msg.type?.startsWith('live_ssh_')) { handleLiveSSH(msg); return; } if (msg.type?.startsWith('live_ssh_')) { handleLiveSSH(msg); return; }
if (msg.type === 'desktop_status') { handleDesktop(msg); return; } if (msg.type === 'desktop_status') { handleDesktop(msg); return; }
@@ -1310,32 +1305,15 @@
return; return;
} }
// Settings (permissions_list/permissions_saved entfernt — Alles-oder-Nichts via --dangerously-skip-permissions) // session_restarted / openclaw_config WS-Events entfernt — aria-core ist raus.
if (msg.type === 'session_restarted') {
const s = document.getElementById('perms-status');
s.style.display = 'block';
if (msg.status === 'restarting') {
s.style.color = '#FFD60A';
s.textContent = 'aria-core wird neu gestartet...';
} else if (msg.status === 'ok') {
s.style.color = '#34C759';
s.textContent = msg.info || 'Session neu gestartet!';
} else {
s.style.color = '#FF6B6B';
s.textContent = 'Restart fehlgeschlagen: ' + (msg.error || '?');
}
return;
}
if (msg.type === 'model_info') { if (msg.type === 'model_info') {
const el = document.getElementById('setting-model'); const el = document.getElementById('setting-model');
const st = document.getElementById('model-status'); const st = document.getElementById('model-status');
if (msg.model) el.value = msg.model; if (el && msg.model) el.value = msg.model;
st.textContent = msg.info || ''; if (st) {
st.style.color = msg.error ? '#FF6B6B' : '#34C759'; st.textContent = msg.info || msg.error || '';
return; st.style.color = msg.error ? '#FF6B6B' : '#34C759';
} }
if (msg.type === 'openclaw_config') {
document.getElementById('openclaw-config').textContent = msg.config || msg.error || '(leer)';
return; return;
} }
if (msg.type === 'response') { return; } if (msg.type === 'response') { return; }
@@ -1422,15 +1400,12 @@
openTermModal('Claude Login Terminal (aria-proxy)', { action: 'proxy_login' }); openTermModal('Claude Login Terminal (aria-proxy)', { action: 'proxy_login' });
} }
function openCoreTerminal() { // openCoreTerminal entfernt — aria-core ist raus.
document.getElementById('btn-core-term').disabled = true;
openTermModal('aria-core Shell', { action: 'core_terminal' });
}
function closeTermModal() { function closeTermModal() {
document.getElementById('term-modal').classList.remove('open'); document.getElementById('term-modal').classList.remove('open');
document.getElementById('btn-proxy-login').disabled = false; const proxyBtn = document.getElementById('btn-proxy-login');
document.getElementById('btn-core-term').disabled = false; if (proxyBtn) proxyBtn.disabled = false;
// Terminal aufraeumen // Terminal aufraeumen
if (term) { term.dispose(); term = null; } if (term) { term.dispose(); term = null; }
} }
@@ -1496,12 +1471,15 @@
} }
function updateState(state) { function updateState(state) {
// Gateway // Brain-Status (loest die alte gw-* Gateway-Card ab — wenn loadBrainStatus
// gleich danach laeuft, kriegt es die korrekten Werte; hier nur Default)
const brainDot = document.getElementById('brain-dot');
const brainShort = document.getElementById('brain-status-short');
const brainErr = document.getElementById('brain-error');
const gw = state.gateway || {}; const gw = state.gateway || {};
document.getElementById('gw-dot').className = `dot ${gw.status || 'disconnected'}`; if (brainDot) brainDot.className = `dot ${gw.status === 'connected' ? 'connected' : 'disconnected'}`;
document.getElementById('gw-status').textContent = if (brainShort) brainShort.textContent = gw.status === 'disabled' ? 'aria-core entfernt — Brain-Loop' : (STATUS_LABELS[gw.status] || gw.status || '-');
(STATUS_LABELS[gw.status] || gw.status) + (gw.handshakeOk ? ' (Handshake OK)' : ''); if (brainErr) brainErr.textContent = gw.lastError || '';
document.getElementById('gw-error').textContent = gw.lastError || '';
// RVS // RVS
const rvs = state.rvs || {}; const rvs = state.rvs || {};
@@ -2280,7 +2258,6 @@
document.getElementById('rc-rvs-tls').value = String(cfg.RVS_TLS) === 'false' ? 'false' : 'true'; document.getElementById('rc-rvs-tls').value = String(cfg.RVS_TLS) === 'false' ? 'false' : 'true';
document.getElementById('rc-rvs-token').value = cfg.RVS_TOKEN || ''; document.getElementById('rc-rvs-token').value = cfg.RVS_TOKEN || '';
document.getElementById('rc-auth-token').value = cfg.ARIA_AUTH_TOKEN || ''; document.getElementById('rc-auth-token').value = cfg.ARIA_AUTH_TOKEN || '';
document.getElementById('rc-compact-after').value = cfg.compactAfterMessages != null ? cfg.compactAfterMessages : 140;
statusEl.textContent = 'Geladen.'; statusEl.textContent = 'Geladen.';
statusEl.style.color = '#34C759'; statusEl.style.color = '#34C759';
loadOnboardingQR(); // QR bei Config-Wechsel neu generieren loadOnboardingQR(); // QR bei Config-Wechsel neu generieren
@@ -2293,14 +2270,12 @@
async function saveRuntimeConfig() { async function saveRuntimeConfig() {
const statusEl = document.getElementById('rc-status'); const statusEl = document.getElementById('rc-status');
statusEl.textContent = 'Speichere...'; statusEl.textContent = 'Speichere...';
const compactRaw = document.getElementById('rc-compact-after').value.trim();
const patch = { const patch = {
RVS_HOST: document.getElementById('rc-rvs-host').value.trim(), RVS_HOST: document.getElementById('rc-rvs-host').value.trim(),
RVS_PORT: document.getElementById('rc-rvs-port').value.trim(), RVS_PORT: document.getElementById('rc-rvs-port').value.trim(),
RVS_TLS: document.getElementById('rc-rvs-tls').value, RVS_TLS: document.getElementById('rc-rvs-tls').value,
RVS_TOKEN: document.getElementById('rc-rvs-token').value.trim(), RVS_TOKEN: document.getElementById('rc-rvs-token').value.trim(),
ARIA_AUTH_TOKEN: document.getElementById('rc-auth-token').value.trim(), ARIA_AUTH_TOKEN: document.getElementById('rc-auth-token').value.trim(),
compactAfterMessages: compactRaw === '' ? 140 : Math.max(0, parseInt(compactRaw, 10) || 0),
}; };
try { try {
const resp = await fetch('/api/runtime-config', { const resp = await fetch('/api/runtime-config', {