Compare commits
3 Commits
feat/mnemo
...
fix/entity
| Author | SHA1 | Date | |
|---|---|---|---|
| 75f39e4195 | |||
| 8c6255d262 | |||
| dd853a21c3 |
153
app.js
153
app.js
@@ -707,6 +707,7 @@ async function init() {
|
||||
createWorkshopTerminal();
|
||||
createAshStorm();
|
||||
SpatialMemory.init(scene);
|
||||
SpatialMemory.setCamera(camera);
|
||||
updateLoad(90);
|
||||
|
||||
loadSession();
|
||||
@@ -1869,6 +1870,7 @@ function setupControls() {
|
||||
if (portalOverlayActive) closePortalOverlay();
|
||||
if (visionOverlayActive) closeVisionOverlay();
|
||||
if (atlasOverlayActive) closePortalAtlas();
|
||||
if (_archiveDashboardOpen) toggleArchiveHealthDashboard();
|
||||
}
|
||||
if (e.key.toLowerCase() === 'v' && document.activeElement !== document.getElementById('chat-input')) {
|
||||
cycleNavMode();
|
||||
@@ -1879,6 +1881,9 @@ function setupControls() {
|
||||
if (e.key.toLowerCase() === 'e' && activeVisionPoint && !visionOverlayActive) {
|
||||
activateVisionPoint(activeVisionPoint);
|
||||
}
|
||||
if (e.key.toLowerCase() === 'h' && document.activeElement !== document.getElementById('chat-input')) {
|
||||
toggleArchiveHealthDashboard();
|
||||
}
|
||||
});
|
||||
document.addEventListener('keyup', (e) => {
|
||||
keys[e.key.toLowerCase()] = false;
|
||||
@@ -2165,6 +2170,7 @@ function handleMemoryMessage(data) {
|
||||
} else {
|
||||
console.warn('[Mnemosyne] Unknown memory action:', action);
|
||||
}
|
||||
if (_archiveDashboardOpen) updateArchiveHealthDashboard();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2225,6 +2231,153 @@ function renderMemoryFeed() {
|
||||
}
|
||||
|
||||
|
||||
// ── Archive Health Dashboard (issue #1210) ────────────────────────────
|
||||
|
||||
let _archiveDashboardOpen = false;
|
||||
|
||||
/**
|
||||
* Toggle the archive health dashboard panel (hotkey H).
|
||||
*/
|
||||
function toggleArchiveHealthDashboard() {
|
||||
_archiveDashboardOpen = !_archiveDashboardOpen;
|
||||
const panel = document.getElementById('archive-health-dashboard');
|
||||
if (!panel) return;
|
||||
if (_archiveDashboardOpen) {
|
||||
updateArchiveHealthDashboard();
|
||||
panel.style.display = 'block';
|
||||
} else {
|
||||
panel.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render current archive statistics into the dashboard panel.
|
||||
* Reads live from SpatialMemory.getAllMemories() — no backend needed.
|
||||
*/
|
||||
function updateArchiveHealthDashboard() {
|
||||
const container = document.getElementById('archive-health-content');
|
||||
if (!container) return;
|
||||
|
||||
const memories = SpatialMemory.getAllMemories();
|
||||
const regions = SpatialMemory.REGIONS;
|
||||
const total = memories.length;
|
||||
|
||||
// ── Category breakdown ────────────────────────────────────────────
|
||||
const catCounts = {};
|
||||
memories.forEach(m => {
|
||||
const cat = m.category || 'working';
|
||||
catCounts[cat] = (catCounts[cat] || 0) + 1;
|
||||
});
|
||||
|
||||
// ── Trust distribution (using strength field as trust score) ──────
|
||||
let trustHigh = 0, trustMid = 0, trustLow = 0;
|
||||
memories.forEach(m => {
|
||||
const t = m.strength != null ? m.strength : 0.7;
|
||||
if (t > 0.8) trustHigh++;
|
||||
else if (t >= 0.5) trustMid++;
|
||||
else trustLow++;
|
||||
});
|
||||
|
||||
// ── Timestamps ────────────────────────────────────────────────────
|
||||
let newestMs = null, oldestMs = null;
|
||||
memories.forEach(m => {
|
||||
const ts = m.timestamp ? new Date(m.timestamp).getTime() : null;
|
||||
if (ts && !isNaN(ts)) {
|
||||
if (newestMs === null || ts > newestMs) newestMs = ts;
|
||||
if (oldestMs === null || ts < oldestMs) oldestMs = ts;
|
||||
}
|
||||
});
|
||||
const fmtDate = ms => ms ? new Date(ms).toLocaleString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }) : '—';
|
||||
|
||||
// ── Entity connection count ───────────────────────────────────────
|
||||
let entityConnCount = 0;
|
||||
memories.forEach(m => {
|
||||
if (m.connections && Array.isArray(m.connections)) {
|
||||
entityConnCount += m.connections.length;
|
||||
}
|
||||
});
|
||||
// Each connection is stored on both ends, divide by 2 for unique links
|
||||
const uniqueLinks = Math.floor(entityConnCount / 2);
|
||||
|
||||
// ── Build HTML ────────────────────────────────────────────────────
|
||||
let html = '';
|
||||
|
||||
// Total count
|
||||
html += `<div>
|
||||
<div class="ah-section-label">Total Memories</div>
|
||||
<div class="ah-total">
|
||||
<span class="ah-total-count">${total}</span>
|
||||
<span class="ah-total-label">crystals in archive</span>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// Category breakdown
|
||||
const sortedCats = Object.entries(catCounts).sort((a, b) => b[1] - a[1]);
|
||||
if (sortedCats.length > 0) {
|
||||
html += `<div><div class="ah-section-label">Categories</div>`;
|
||||
sortedCats.forEach(([cat, count]) => {
|
||||
const region = regions[cat] || regions.working;
|
||||
const color = '#' + region.color.toString(16).padStart(6, '0');
|
||||
const pct = total > 0 ? Math.round((count / total) * 100) : 0;
|
||||
html += `<div class="ah-category-row">
|
||||
<span class="ah-cat-dot" style="background:${color}"></span>
|
||||
<span class="ah-cat-label">${region.label || cat}</span>
|
||||
<div class="ah-cat-bar-wrap">
|
||||
<div class="ah-cat-bar" style="width:${pct}%;background:${color}"></div>
|
||||
</div>
|
||||
<span class="ah-cat-count">${count}</span>
|
||||
</div>`;
|
||||
});
|
||||
html += `</div>`;
|
||||
}
|
||||
|
||||
// Trust distribution
|
||||
html += `<div>
|
||||
<div class="ah-section-label">Trust Distribution</div>
|
||||
<div class="ah-trust-row">
|
||||
<div class="ah-trust-band ah-trust-high">
|
||||
<div class="ah-trust-band-count">${trustHigh}</div>
|
||||
<div class="ah-trust-band-label">High >0.8</div>
|
||||
</div>
|
||||
<div class="ah-trust-band ah-trust-mid">
|
||||
<div class="ah-trust-band-count">${trustMid}</div>
|
||||
<div class="ah-trust-band-label">Mid 0.5–0.8</div>
|
||||
</div>
|
||||
<div class="ah-trust-band ah-trust-low">
|
||||
<div class="ah-trust-band-count">${trustLow}</div>
|
||||
<div class="ah-trust-band-label">Low <0.5</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// Timestamps
|
||||
html += `<div>
|
||||
<div class="ah-section-label">Timeline</div>
|
||||
<div class="ah-timestamps">
|
||||
<div class="ah-ts-row">
|
||||
<span class="ah-ts-label">Newest</span>
|
||||
<span class="ah-ts-value">${fmtDate(newestMs)}</span>
|
||||
</div>
|
||||
<div class="ah-ts-row">
|
||||
<span class="ah-ts-label">Oldest</span>
|
||||
<span class="ah-ts-value">${fmtDate(oldestMs)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// Entity connections
|
||||
html += `<div>
|
||||
<div class="ah-section-label">Entity Connections</div>
|
||||
<span class="ah-entity-count">${uniqueLinks}</span>
|
||||
<span class="ah-entity-label">unique links</span>
|
||||
</div>`;
|
||||
|
||||
// Hotkey hint
|
||||
html += `<div class="ah-hotkey-hint">PRESS H TO CLOSE</div>`;
|
||||
|
||||
container.innerHTML = html;
|
||||
}
|
||||
|
||||
function updateWsHudStatus(connected) {
|
||||
// Update MemPalace status alongside regular WS status
|
||||
updateMemPalaceStatus();
|
||||
|
||||
12
index.html
12
index.html
@@ -159,7 +159,8 @@
|
||||
<span>WASD</span> move <span>Mouse</span> look <span>Enter</span> chat
|
||||
<span>V</span> mode: <span id="nav-mode-label">WALK</span>
|
||||
<span id="nav-mode-hint" class="nav-mode-hint"></span>
|
||||
<span class="ws-hud-status">HERMES: <span id="ws-status-dot" class="chat-status-dot"></span></span>
|
||||
<span>H</span> archive
|
||||
<span class="ws-hud-status">HERMES: <span id="ws-status-dot" class="chat-status-dot"></span></span>
|
||||
</div>
|
||||
|
||||
<!-- Portal Hint -->
|
||||
@@ -440,6 +441,15 @@ index.html
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Archive Health Dashboard (Mnemosyne, issue #1210) -->
|
||||
<div id="archive-health-dashboard" class="archive-health-dashboard" style="display:none;" aria-label="Archive Health Dashboard">
|
||||
<div class="archive-health-header">
|
||||
<span class="archive-health-title">◈ ARCHIVE HEALTH</span>
|
||||
<button class="archive-health-close" onclick="toggleArchiveHealthDashboard()" aria-label="Close dashboard">✕</button>
|
||||
</div>
|
||||
<div id="archive-health-content" class="archive-health-content"></div>
|
||||
</div>
|
||||
|
||||
<!-- Memory Activity Feed (Mnemosyne) -->
|
||||
<div id="memory-feed" class="memory-feed" style="display:none;">
|
||||
<div class="memory-feed-header">
|
||||
|
||||
@@ -829,7 +829,7 @@ const SpatialMemory = (() => {
|
||||
getCrystalMeshes, getMemoryFromMesh, highlightMemory, clearHighlight, getSelectedId,
|
||||
exportIndex, importIndex, searchNearby, REGIONS,
|
||||
saveToStorage, loadFromStorage, clearStorage,
|
||||
runGravityLayout
|
||||
runGravityLayout, setCamera
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
202
style.css
202
style.css
@@ -1344,3 +1344,205 @@ canvas#nexus-canvas {
|
||||
.memory-feed-remove { border-left: 2px solid #ff4466; }
|
||||
.memory-feed-update { border-left: 2px solid #ffd700; }
|
||||
.memory-feed-sync { border-left: 2px solid #7b5cff; }
|
||||
|
||||
/* ── Archive Health Dashboard (issue #1210) ─────────────────────────── */
|
||||
.archive-health-dashboard {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 420px;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
background: rgba(10, 15, 40, 0.95);
|
||||
border: 1px solid rgba(74, 240, 192, 0.35);
|
||||
border-radius: 12px;
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
z-index: 1100;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
box-shadow: 0 0 40px rgba(74, 240, 192, 0.12), 0 0 80px rgba(123, 92, 255, 0.08);
|
||||
animation: archiveDashIn 0.25s ease-out;
|
||||
}
|
||||
|
||||
@keyframes archiveDashIn {
|
||||
from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
|
||||
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
||||
}
|
||||
|
||||
.archive-health-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid rgba(74, 240, 192, 0.2);
|
||||
}
|
||||
|
||||
.archive-health-title {
|
||||
color: #4af0c0;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.archive-health-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
line-height: 1;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
.archive-health-close:hover { color: #fff; }
|
||||
|
||||
.archive-health-content {
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.ah-section-label {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
font-size: 10px;
|
||||
letter-spacing: 1.2px;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.ah-total {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ah-total-count {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
color: #4af0c0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ah-total-label {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.ah-category-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.ah-cat-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ah-cat-label {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ah-cat-bar-wrap {
|
||||
flex: 2;
|
||||
height: 5px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ah-cat-bar {
|
||||
height: 100%;
|
||||
border-radius: 3px;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
|
||||
.ah-cat-count {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.ah-trust-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ah-trust-band {
|
||||
flex: 1;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 8px;
|
||||
padding: 8px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ah-trust-band-count {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ah-trust-band-label {
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.8px;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 3px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.ah-trust-high .ah-trust-band-count { color: #4af0c0; }
|
||||
.ah-trust-mid .ah-trust-band-count { color: #ffd700; }
|
||||
.ah-trust-low .ah-trust-band-count { color: #ff4466; }
|
||||
|
||||
.ah-timestamps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.ah-ts-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ah-ts-label {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
.ah-ts-value {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.ah-entity-count {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #7b5cff;
|
||||
}
|
||||
|
||||
.ah-entity-label {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.ah-hotkey-hint {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: rgba(255, 255, 255, 0.2);
|
||||
letter-spacing: 0.8px;
|
||||
padding-top: 4px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user