Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Whitestone
e95d22a35e fix: closes #729
Some checks failed
CI / test (pull_request) Failing after 9s
CI / validate (pull_request) Failing after 16s
Review Approval Gate / verify-review (pull_request) Failing after 2s
2026-04-12 12:13:40 -04:00
3 changed files with 149 additions and 0 deletions

72
app.js
View File

@@ -54,11 +54,18 @@ let _clickStartX = 0, _clickStartY = 0; // Mnemosyne: click-vs-drag detection
let loadProgress = 0;
let performanceTier = 'high';
/** Escape HTML entities for safe innerHTML insertion. */
function escHtml(s) {
return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
}
// ═══ HERMES WS STATE ═══
let hermesWs = null;
let wsReconnectTimer = null;
let wsConnected = false;
let recentToolOutputs = [];
let actionStreamEntries = []; // Evennia command/result flow for action stream panel
let actionStreamRoom = ''; // Current room from movement events
let workshopPanelCtx = null;
let workshopPanelTexture = null;
let workshopPanelCanvas = null;
@@ -2169,6 +2176,71 @@ function handleHermesMessage(data) {
else addChatMessage(msg.agent, msg.text, false);
});
}
// Evennia event bridge — process command/result/room fields if present
handleEvenniaEvent(data);
}
// ═══════════════════════════════════════════
// TIMMY ACTION STREAM — EVENNIA COMMAND FLOW
// ═══════════════════════════════════════════
const MAX_ACTION_STREAM = 8;
/**
* Add an entry to the action stream panel.
* @param {'cmd'|'result'|'room'} type
* @param {string} text
*/
function addActionStreamEntry(type, text) {
const entry = { type, text, ts: Date.now() };
actionStreamEntries.unshift(entry);
if (actionStreamEntries.length > MAX_ACTION_STREAM) actionStreamEntries.pop();
renderActionStream();
}
/**
* Update the current room display in the action stream.
* @param {string} room
*/
function setActionStreamRoom(room) {
actionStreamRoom = room;
const el = document.getElementById('action-stream-room');
if (el) el.textContent = room ? `${room}` : '';
}
/**
* Render the action stream panel entries.
*/
function renderActionStream() {
const el = document.getElementById('action-stream-content');
if (!el) return;
el.innerHTML = actionStreamEntries.map(e => {
const ts = new Date(e.ts).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });
const cls = e.type === 'cmd' ? 'as-cmd' : e.type === 'result' ? 'as-result' : 'as-room';
const prefix = e.type === 'cmd' ? '>' : e.type === 'result' ? '←' : '◈';
return `<div class="as-entry ${cls}"><span class="as-prefix">${prefix}</span> <span class="as-text">${escHtml(e.text)}</span> <span class="as-ts">${ts}</span></div>`;
}).join('');
}
/**
* Process Evennia-specific fields from Hermes WS messages.
* Called from handleHermesMessage for any message carrying evennia metadata.
*/
function handleEvenniaEvent(data) {
if (data.evennia_command) {
addActionStreamEntry('cmd', data.evennia_command);
}
if (data.evennia_result) {
const excerpt = typeof data.evennia_result === 'string'
? data.evennia_result.substring(0, 120)
: JSON.stringify(data.evennia_result).substring(0, 120);
addActionStreamEntry('result', excerpt);
}
if (data.evennia_room) {
setActionStreamRoom(data.evennia_room);
addActionStreamEntry('room', `Moved to: ${data.evennia_room}`);
}
}

View File

@@ -127,6 +127,15 @@
</div>
</div>
<!-- Timmy Action Stream (Evennia command/result flow) -->
<div id="action-stream" class="action-stream">
<div class="action-stream-header">
<span class="action-stream-icon"></span> TIMMY ACTION STREAM
</div>
<div id="action-stream-room" class="action-stream-room"></div>
<div id="action-stream-content" class="action-stream-content"></div>
</div>
<!-- Bottom: Chat Interface -->
<div id="chat-panel" class="chat-panel">
<div class="chat-header">

View File

@@ -719,6 +719,70 @@ canvas#nexus-canvas {
color: var(--color-text-muted);
}
/* Timmy Action Stream (Evennia command/result flow) — issue #729 */
.action-stream {
position: absolute;
bottom: 200px;
right: var(--space-3);
width: 320px;
max-height: 260px;
background: rgba(0, 0, 0, 0.65);
backdrop-filter: blur(8px);
border-left: 2px solid var(--color-gold);
padding: var(--space-3);
font-size: 10px;
font-family: var(--font-mono);
pointer-events: none;
overflow: hidden;
display: flex;
flex-direction: column;
}
.action-stream-header {
font-family: var(--font-display);
color: var(--color-gold);
letter-spacing: 0.1em;
font-size: 10px;
margin-bottom: var(--space-2);
opacity: 0.9;
}
.action-stream-icon {
margin-right: 4px;
}
.action-stream-room {
color: var(--color-primary);
font-size: 11px;
font-weight: 600;
margin-bottom: var(--space-1);
opacity: 0.9;
}
.action-stream-content {
display: flex;
flex-direction: column;
gap: 3px;
overflow-y: auto;
flex: 1;
}
.as-entry {
animation: log-fade-in 0.4s ease-out forwards;
opacity: 0;
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.as-cmd .as-prefix { color: var(--color-gold); font-weight: 700; }
.as-cmd .as-text { color: var(--color-gold); opacity: 0.85; }
.as-result .as-prefix { color: var(--color-primary); font-weight: 700; }
.as-result .as-text { color: var(--color-text-muted); }
.as-room .as-prefix { color: var(--color-secondary); font-weight: 700; }
.as-room .as-text { color: var(--color-secondary); opacity: 0.8; }
.as-ts {
color: var(--color-text-muted);
opacity: 0.4;
font-size: 9px;
float: right;
}
/* Vision Hint */
.vision-hint {
position: absolute;
@@ -1122,6 +1186,10 @@ canvas#nexus-canvas {
.hud-agent-log {
width: 220px;
}
.action-stream {
width: 240px;
bottom: 180px;
}
}
@media (max-width: 768px) {