feat: wire LLM stats into GameScene admin panel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-03-10 13:28:48 +00:00
parent 28ce0822e6
commit f9e99ff09a

View File

@@ -326,6 +326,21 @@ export class GameScene extends Phaser.Scene {
this.adminPanel.updateConstants(data);
};
// LLM stats callbacks
this.adminPanel.onRequestLlmStats = () => {
this.client.requestLlmStats();
};
this.adminPanel.onToggleLlmTracking = (enabled) => {
this.client.toggleLlmTracking(enabled);
};
this.client.onLlmStatsResult = (data) => {
this.adminPanel.updateLlmStats(data);
};
this.client.onLlmTrackingToggled = () => {
this.client.requestLlmStats();
};
// Log socket callbacks
this.client.onLogHistory = (data) => {
this.logPanel.loadHistory(data);
@@ -338,6 +353,13 @@ export class GameScene extends Phaser.Scene {
// Flush any history events that arrived before these handlers were registered
this.client.flushBufferedHistory();
document.addEventListener('left-panel-opened', (e: Event) => {
const detail = (e as CustomEvent).detail;
if (detail?.tab === 'admin') {
this.adminPanel.requestStatsRefresh();
}
});
document.addEventListener('narration-follow', ((e: CustomEvent) => {
const { entityId } = e.detail;
const npcIds = this.getNpcIds();