variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
// web/log.mjs -- diagnostics: a rolling event log that survives
|
2026-11-14 23:48:27 +00:00
|
|
|
// refreshes.
|
|
|
|
|
//
|
|
|
|
|
// The api() choke point records every server call (status + duration),
|
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
// uncaught errors land here, and so do navigation ejections -- the
|
2026-11-14 23:48:27 +00:00
|
|
|
// "why did the app throw me out" history the ten-second banner loses.
|
|
|
|
|
// Kept in sessionStorage; the header's "log" button shows it.
|
|
|
|
|
|
|
|
|
|
import { $ } from './dom.mjs';
|
|
|
|
|
|
|
|
|
|
const log = [];
|
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
try { log.push(...JSON.parse(sessionStorage.getItem('diag') ?? '[]')); } catch { /* fresh or corrupt -- start empty */ }
|
2026-11-14 23:48:27 +00:00
|
|
|
|
|
|
|
|
export function logEvent(kind, text) {
|
|
|
|
|
log.push(`${new Date().toISOString().slice(11, 19)} ${kind} ${text}`);
|
|
|
|
|
if (log.length > 300) log.splice(0, log.length - 300);
|
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
try { sessionStorage.setItem('diag', JSON.stringify(log)); } catch { /* storage full or blocked -- the in-memory copy lives on */ }
|
2026-11-14 23:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderDiag() {
|
|
|
|
|
const d = $('diag');
|
|
|
|
|
d.textContent = log.join('\n');
|
|
|
|
|
d.scrollTop = d.scrollHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('diag-btn').addEventListener('click', () => {
|
|
|
|
|
const d = $('diag');
|
|
|
|
|
d.hidden = !d.hidden;
|
|
|
|
|
if (!d.hidden) renderDiag();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.addEventListener('error', (e) => logEvent('error', e.message));
|
|
|
|
|
window.addEventListener('unhandledrejection', (e) => logEvent('error', `unhandled: ${e.reason?.message ?? e.reason}`));
|