diff --git a/internal/web/static/index.html b/internal/web/static/index.html index 35934418..0c68ce39 100644 --- a/internal/web/static/index.html +++ b/internal/web/static/index.html @@ -1265,9 +1265,9 @@

Activity

var epTitle = ep.title || (ep.state === 'open' ? 'Episode in progress\u2026' : 'Untitled Episode'); html += '
' + escapeHtml(epTitle) + ''; if (ep.outcome) { - html += '' + ep.outcome + ''; + html += '' + escapeHtml(ep.outcome) + ''; } else { - html += '' + (ep.state || 'open') + ''; + html += '' + escapeHtml(ep.state || 'open') + ''; } html += '
'; if (ep.summary) { @@ -1397,8 +1397,8 @@

Activity

var age = p.created_at ? timeAgo(p.created_at) : ''; var html = '
' + escapeHtml(p.title || 'Untitled'); if (p.project) html += ' [' + escapeHtml(p.project) + ']'; - html += '
' + (p.pattern_type || 'pattern') + ''; - if (p.state && p.state !== 'active') html += ' ' + p.state + ''; + html += '
' + escapeHtml(p.pattern_type || 'pattern') + ''; + if (p.state && p.state !== 'active') html += ' ' + escapeHtml(p.state) + ''; html += '
' + escapeHtml(p.description || '') + '
'; html += '
'; html += 'Strength ' + strengthPct + '%'; @@ -1424,7 +1424,7 @@

Activity

var age = a.created_at ? timeAgo(a.created_at) : ''; var html = '
' + escapeHtml(a.title || 'Untitled'); html += ' ' + levelLabel + ''; - if (a.state && a.state !== 'active') html += ' ' + a.state + ''; + if (a.state && a.state !== 'active') html += ' ' + escapeHtml(a.state) + ''; html += '
'; html += '
' + escapeHtml(a.description || '') + '
'; html += '
'; @@ -1463,7 +1463,7 @@

Activity

state.graphData = data; renderGraph(data); state.graphInitialized = true; - } catch (e) { console.error('Failed to load graph:', e); } + } catch (e) { console.error('Failed to load graph:', e); showToast('Failed to load graph', 'error'); } } function renderGraph(data) { @@ -1527,7 +1527,7 @@

Activity

var tooltip = document.getElementById('graphTooltip'); node.on('mouseover', function(event, d) { tooltip.style.display = 'block'; - tooltip.innerHTML = '' + escapeHtml((d.summary || '').slice(0, 60)) + '
Salience: ' + (d.salience || 0).toFixed(2) + ' | State: ' + (d.state || '?') + '' + (d.concepts ? '
' + (d.concepts || []).slice(0, 4).join(', ') + '' : ''); + tooltip.innerHTML = '' + escapeHtml((d.summary || '').slice(0, 60)) + '
Salience: ' + (d.salience || 0).toFixed(2) + ' | State: ' + escapeHtml(d.state || '?') + '' + (d.concepts ? '
' + escapeHtml((d.concepts || []).slice(0, 4).join(', ')) + '' : ''); tooltip.style.left = (event.pageX + 12) + 'px'; tooltip.style.top = (event.pageY - 10) + 'px'; var connectedIds = new Set(); connectedIds.add(d.id); @@ -1569,9 +1569,9 @@

Activity

var detail = document.getElementById('graphDetail'); detail.classList.add('open'); document.getElementById('graphDetailTitle').textContent = (d.summary || '').slice(0, 80); - var meta = '
State: ' + (d.state || '?') + ' • Salience: ' + (d.salience || 0).toFixed(2) + '
'; - if (d.concepts) meta += '
' + (d.concepts || []).join(', ') + '
'; - if (d.emotional_tone) meta += '
Tone: ' + d.emotional_tone + '
'; + var meta = '
State: ' + escapeHtml(d.state || '?') + ' • Salience: ' + (d.salience || 0).toFixed(2) + '
'; + if (d.concepts) meta += '
' + escapeHtml((d.concepts || []).join(', ')) + '
'; + if (d.emotional_tone) meta += '
Tone: ' + escapeHtml(d.emotional_tone) + '
'; document.getElementById('graphDetailMeta').innerHTML = meta; var conns = []; edges.forEach(function(e) { @@ -1580,7 +1580,7 @@

Activity

if (src === d.id) { var t = nodeMap.get(tgt); if (t) conns.push({ summary: t.summary, type: e.relation_type, strength: e.strength }); } else if (tgt === d.id) { var s = nodeMap.get(src); if (s) conns.push({ summary: s.summary, type: e.relation_type, strength: e.strength }); } }); - document.getElementById('graphDetailConns').innerHTML = conns.length === 0 ? '
  • No connections
  • ' : conns.map(function(c) { return '
  • ' + c.type + ' → ' + escapeHtml((c.summary || '').slice(0, 50)) + ' (' + (c.strength || 0).toFixed(2) + ')
  • '; }).join(''); + document.getElementById('graphDetailConns').innerHTML = conns.length === 0 ? '
  • No connections
  • ' : conns.map(function(c) { return '
  • ' + escapeHtml(c.type) + ' → ' + escapeHtml((c.summary || '').slice(0, 50)) + ' (' + (c.strength || 0).toFixed(2) + ')
  • '; }).join(''); } function closeGraphDetail() { document.getElementById('graphDetail').classList.remove('open'); } @@ -1640,7 +1640,7 @@

    Activity

    var detailStr = Object.entries(details).map(function(kv) { return kv[0] + ': ' + kv[1]; }).join(' • '); return '
    ' + escapeHtml(obs.observation_type || '') + '
    ' + escapeHtml(detailStr) + '
    '; }).join(''); - } catch (e) {} + } catch (e) { console.error('Failed to load insights:', e); showToast('Failed to load insights', 'error'); } } // ── Stats ── @@ -1673,7 +1673,7 @@

    Activity

    opt.value = p; opt.textContent = p; select.appendChild(opt); }); - } catch (e) {} + } catch (e) { console.error('Failed to load projects:', e); } } // ── WebSocket ── @@ -1703,7 +1703,7 @@

    Activity

    } addEvent(type, desc, msg.timestamp || new Date().toISOString()); if (['memory_encoded', 'consolidation_completed', 'dream_cycle_completed'].includes(type) && state.currentView === 'graph') loadGraphData(); - } catch (e) {} + } catch (e) { console.error('Failed to parse WebSocket message:', e); } }; ws.onclose = function() { var delay = Math.min(30000, 1000 * Math.pow(1.5, state.wsReconnectAttempts));