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/transcript.mjs -- the transcript: register rendering and the
|
2026-11-14 23:48:27 +00:00
|
|
|
// entry walk.
|
|
|
|
|
//
|
|
|
|
|
// The transcript renders three registers by the ruled markers: plain
|
|
|
|
|
// text is speech, *italics* is narration, a line opening with `(` is
|
|
|
|
|
// OOC (closing paren optional; a lone paren is an empty OOC line and
|
|
|
|
|
// is skipped). The <status>/<agenda> blocks riding GM turns and the
|
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
|
|
|
// delta tags on player turns are machinery, not prose -- they render
|
2026-11-14 23:48:27 +00:00
|
|
|
// as chips and pane state, mirroring the live-context policy.
|
|
|
|
|
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @typedef {import('../server/shapes.mjs').LogEvent} LogEvent */
|
|
|
|
|
/** @typedef {import('../server/shapes.mjs').BundleEvent} BundleEvent */
|
|
|
|
|
/** @typedef {import('../server/shapes.mjs').MsgEvent} MsgEvent */
|
|
|
|
|
/** @typedef {import('../server/shapes.mjs').NoteEvent} NoteEvent */
|
|
|
|
|
|
2026-11-14 23:48:27 +00:00
|
|
|
import { $, el } from './dom.mjs';
|
|
|
|
|
|
|
|
|
|
// splits text into spans: *italics* = narration, **bold** = emphasis
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {HTMLElement} target @param {string} text */
|
2026-11-14 23:48:27 +00:00
|
|
|
function renderSpans(target, text) {
|
|
|
|
|
const parts = String(text).split(/(\*\*[^*]+\*\*|\*[^*\n]+\*)/g);
|
|
|
|
|
for (const p of parts) {
|
|
|
|
|
if (!p) continue;
|
|
|
|
|
if (p.startsWith('**') && p.endsWith('**')) {
|
|
|
|
|
const b = document.createElement('strong');
|
|
|
|
|
b.textContent = p.slice(2, -2);
|
|
|
|
|
target.appendChild(b);
|
|
|
|
|
} else if (p.startsWith('*') && p.endsWith('*') && p.length > 2) {
|
|
|
|
|
const i = document.createElement('em');
|
|
|
|
|
i.className = 'narration';
|
|
|
|
|
i.textContent = p.slice(1, -1);
|
|
|
|
|
target.appendChild(i);
|
|
|
|
|
} else {
|
|
|
|
|
target.appendChild(document.createTextNode(p));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// one content block (a GM or player turn) -> DOM lines. extract pulls
|
|
|
|
|
// the riding blocks (status/conflict/agenda) out of GM prose; the
|
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
|
|
|
// delta tags on player turns always render as chips. Exported for
|
|
|
|
|
// the story view, which renders the same registers.
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {HTMLElement} target @param {?string} text @param {{ extract?: boolean }} opts @returns {{ status: ?string, conflict: ?string, agenda: ?string }} */
|
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
|
|
|
export function renderContent(target, text, { extract }) {
|
2026-11-14 23:48:27 +00:00
|
|
|
let body = String(text ?? '');
|
|
|
|
|
let status = null;
|
|
|
|
|
let conflict = null;
|
|
|
|
|
let agenda = null;
|
|
|
|
|
if (extract) {
|
|
|
|
|
const sm = body.match(/<status>([\s\S]*?)<\/status>/);
|
|
|
|
|
if (sm) { status = sm[1]; body = body.replace(sm[0], ''); }
|
|
|
|
|
const cm = body.match(/<conflict>([\s\S]*?)<\/conflict>/);
|
|
|
|
|
if (cm) { conflict = cm[1]; body = body.replace(cm[0], ''); }
|
|
|
|
|
const am = body.match(/<agenda>([\s\S]*?)<\/agenda>/);
|
|
|
|
|
if (am) { agenda = am[1]; body = body.replace(am[0], ''); }
|
|
|
|
|
}
|
|
|
|
|
const tags = [];
|
|
|
|
|
for (const m of body.matchAll(/<(lost|gained|add|drop)>([\s\S]*?)<\/\1>/g)) {
|
|
|
|
|
tags.push({ kind: m[1], items: m[2].split('\n').flatMap((l) => l.split(',')).map((x) => x.trim()).filter(Boolean) });
|
|
|
|
|
}
|
|
|
|
|
for (const t of tags) body = body.replace(new RegExp(`<${t.kind}>[\\s\\S]*?</${t.kind}>`), '');
|
|
|
|
|
|
|
|
|
|
let narr = false; // an open multi-line narration block
|
|
|
|
|
for (const line of body.split('\n')) {
|
|
|
|
|
const t = line.trim();
|
|
|
|
|
if (!t) { target.appendChild(document.createElement('br')); continue; }
|
|
|
|
|
if (t.startsWith('(')) {
|
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
|
|
|
if (t === '(') continue; // empty OOC -- skip
|
2026-11-14 23:48:27 +00:00
|
|
|
const d = document.createElement('div');
|
|
|
|
|
d.className = 'line ooc';
|
|
|
|
|
d.textContent = t;
|
|
|
|
|
target.appendChild(d);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (t.startsWith('<')) {
|
|
|
|
|
// substrate lines: an opening <tag> is always OOC (invariants.md).
|
|
|
|
|
// Known blocks were extracted above; whatever remains is an
|
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
|
|
|
// unknown or unbalanced tag -- keep it visible, styled as OOC
|
2026-11-14 23:48:27 +00:00
|
|
|
const d = document.createElement('div');
|
|
|
|
|
d.className = 'line ooc';
|
|
|
|
|
d.textContent = t;
|
|
|
|
|
target.appendChild(d);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const stars = (line.match(/\*/g) ?? []).length;
|
|
|
|
|
if (!narr && stars % 2 === 0) {
|
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
|
|
|
// balanced: spans carry the registers -- mixed lines
|
2026-11-14 23:48:27 +00:00
|
|
|
// (`*foo* bar *baz*`), whole-line narration (`*she sleeps.*`),
|
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
|
|
|
// bold -- all render correctly
|
2026-11-14 23:48:27 +00:00
|
|
|
const d = document.createElement('div');
|
|
|
|
|
d.className = 'line speech';
|
|
|
|
|
renderSpans(d, line);
|
|
|
|
|
target.appendChild(d);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!narr && !(t.startsWith('*') && !t.startsWith('**'))) {
|
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
|
|
|
// a stray unpaired * mid-line is not a block opener -- render
|
2026-11-14 23:48:27 +00:00
|
|
|
// as-is; the stray stays literal
|
|
|
|
|
const d = document.createElement('div');
|
|
|
|
|
d.className = 'line speech';
|
|
|
|
|
renderSpans(d, line);
|
|
|
|
|
target.appendChild(d);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// block narration: an unpaired leading * opens a multi-line
|
|
|
|
|
// block, a trailing * closes it
|
|
|
|
|
let content = line.replace(/^\s*\*/, '');
|
|
|
|
|
narr = true;
|
|
|
|
|
if (t.endsWith('*') && !t.endsWith('**')) {
|
|
|
|
|
narr = false;
|
|
|
|
|
content = content.trimEnd().slice(0, -1);
|
|
|
|
|
}
|
|
|
|
|
const d = document.createElement('div');
|
|
|
|
|
d.className = 'line narration';
|
|
|
|
|
renderSpans(d, content);
|
|
|
|
|
target.appendChild(d);
|
|
|
|
|
}
|
|
|
|
|
if (tags.length) {
|
|
|
|
|
const wrap = document.createElement('div');
|
|
|
|
|
wrap.className = 'tags';
|
|
|
|
|
for (const t of tags) {
|
|
|
|
|
for (const item of t.items) {
|
|
|
|
|
const c = document.createElement('span');
|
|
|
|
|
c.className = `chip ${t.kind}`;
|
|
|
|
|
c.textContent = item;
|
|
|
|
|
wrap.appendChild(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
target.appendChild(wrap);
|
|
|
|
|
}
|
|
|
|
|
return { status, conflict, agenda };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the entry walk. onConflict receives a conflict block found on a GM
|
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
|
|
|
// turn -- the play view owns where it lands (the status pane). The
|
|
|
|
|
// opening event (her opening status) renders as machinery, mirroring
|
|
|
|
|
// the wire policy: it is set once, never re-sent.
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {LogEvent[]} entries @param {{ onConflict?: (text: string) => void }} [opts] */
|
2026-11-14 23:48:27 +00:00
|
|
|
export function renderTranscript(entries, { onConflict } = {}) {
|
|
|
|
|
const t = $('transcript');
|
|
|
|
|
t.textContent = '';
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @type {BundleEvent[]} */ const bundleParts = [];
|
2026-11-14 23:48:27 +00:00
|
|
|
const flushBundle = () => {
|
|
|
|
|
if (!bundleParts.length) return;
|
|
|
|
|
const d = el('details', 'bundle');
|
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
|
|
|
d.appendChild(el('summary', null, `session bundle -- ${bundleParts.map((p) => p.part).join(', ')}`));
|
2026-11-14 23:48:27 +00:00
|
|
|
for (const p of bundleParts) {
|
|
|
|
|
const sec = el('details');
|
|
|
|
|
sec.appendChild(el('summary', null, p.part));
|
|
|
|
|
sec.appendChild(el('pre', null, p.m.content));
|
|
|
|
|
d.appendChild(sec);
|
|
|
|
|
}
|
|
|
|
|
t.appendChild(d);
|
|
|
|
|
bundleParts.length = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (const e of entries) {
|
|
|
|
|
if (e.t === 'bundle') {
|
|
|
|
|
// every part is inspectable, read-only: system (guards +
|
|
|
|
|
// substrate + craft), backdrop, character, the rings
|
|
|
|
|
bundleParts.push(e);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
flushBundle();
|
|
|
|
|
if (e.t === 'msg' && e.reminder) {
|
|
|
|
|
// the turn reminder: the transcript mirrors the live-context
|
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
|
|
|
// policy -- one collapsed card for the newest copy, superseded
|
2026-11-14 23:48:27 +00:00
|
|
|
// ones elide (the log keeps every as-sent chunk)
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
const newest = [...entries].reverse().find((x) => x.t === 'msg' && x.reminder);
|
2026-11-14 23:48:27 +00:00
|
|
|
if (e === newest) {
|
|
|
|
|
const d = el('details', 'bundle');
|
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
|
|
|
d.appendChild(el('summary', null, 'turn reminder -- rides every GM turn'));
|
2026-11-14 23:48:27 +00:00
|
|
|
d.appendChild(el('pre', null, e.m.content));
|
|
|
|
|
t.appendChild(d);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
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
|
|
|
if (e.t === 'opening') {
|
|
|
|
|
t.appendChild(el('div', 'machinery', `her opening status: ${JSON.stringify(e.status)}`));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2026-11-14 23:48:27 +00:00
|
|
|
if (e.t === 'msg') {
|
|
|
|
|
if (e.m.role === 'user' && e.conflictOnly) {
|
|
|
|
|
// the self-heal message: error traffic on its own, never GM prose
|
|
|
|
|
t.appendChild(el('div', 'machinery', `[conflict] ${String(e.m.content).replace(/<\/?conflict>/g, '').trim()}`));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (e.m.role === 'user') gmTurn(e.m.content, 'GM');
|
|
|
|
|
else if (e.m.role === 'assistant') playerTurn(e);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (e.t === 'tool') {
|
|
|
|
|
t.appendChild(el('div', 'machinery', `${e.ask ? '[ruling] ' : '[tool result] '}${String(e.m.content).split('\n')[0]}`));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (e.t === 'note') renderNote(e);
|
|
|
|
|
}
|
|
|
|
|
flushBundle();
|
|
|
|
|
t.scrollTop = t.scrollHeight;
|
|
|
|
|
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {?string} content @param {string} who */
|
2026-11-14 23:48:27 +00:00
|
|
|
function gmTurn(content, who) {
|
|
|
|
|
const d = el('div', 'turn gm');
|
|
|
|
|
d.appendChild(el('div', 'who', who));
|
|
|
|
|
const body = el('div');
|
|
|
|
|
d.appendChild(body);
|
|
|
|
|
const { conflict } = renderContent(body, content, { extract: true });
|
|
|
|
|
if (conflict) onConflict?.(conflict);
|
|
|
|
|
t.appendChild(d);
|
|
|
|
|
}
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {MsgEvent} e */
|
2026-11-14 23:48:27 +00:00
|
|
|
function playerTurn(e) {
|
|
|
|
|
const d = el('div', 'turn player');
|
|
|
|
|
d.appendChild(el('div', 'who', 'player'));
|
|
|
|
|
const body = el('div');
|
|
|
|
|
d.appendChild(body);
|
|
|
|
|
renderContent(body, e.m.content, { extract: false });
|
|
|
|
|
for (const c of e.m.tool_calls ?? []) {
|
|
|
|
|
d.appendChild(el('div', 'machinery', `[tool call] ${c.function.name}`));
|
|
|
|
|
}
|
|
|
|
|
t.appendChild(d);
|
|
|
|
|
}
|
jsdoc typing round, phases 3-4: the clerk (tool/memory.mjs) and the SPA (web/) typed under strict -- row shapes local to their owners (the clerk's five tables in its header; the SPA's response envelopes in the new web/shapes.mjs, the server's shared shapes imported at their use sites: User, LogEvent, JobState, HttpError); the db boundary cast at every .get()/.all(), fail as @returns {never} so guard-narrowing works; web via a second tsconfig (tsconfig.web.json: DOM libs in their own program, node types riding along because shapes.mjs's Provider typedef pulls provider.mjs in), npm run typecheck runs both; every non-annotation delta audited onto a small intended list (COUNT(*) Number() wraps, impossible-path guards, ?? ''/?? undefined null-absorbers, the RewordOp reason fix -- the validator demands it, the reminder-find naming its tag); smoke 110/110 + restart + reminder + repo checks + a zero-console-error browser pass green; the typing round is complete
2026-11-15 19:57:07 +00:00
|
|
|
/** @param {NoteEvent} e */
|
2026-11-14 23:48:27 +00:00
|
|
|
function renderNote(e) {
|
|
|
|
|
let text = null;
|
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
|
|
|
if (e.kind === 'session') text = `session ${e.n} opened`;
|
2026-11-14 23:48:27 +00:00
|
|
|
else if (e.kind === 'ask') text = `ask_gm: ${e.question}`;
|
|
|
|
|
else if (e.kind === 'status') text = `status: lost ${JSON.stringify(e.applied?.lost ?? [])}, gained ${JSON.stringify(e.applied?.gained ?? [])}`;
|
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
|
|
|
else if (e.kind === 'agenda') text = `agenda: added ${JSON.stringify(e.applied?.added ?? [])}, dropped ${JSON.stringify(e.applied?.dropped ?? [])}`;
|
|
|
|
|
else if (e.kind === 'pick') text = `variant literature: ${e.count} offered, #${e.chosen + 1} picked`;
|
2026-11-14 23:48:27 +00:00
|
|
|
if (text) t.appendChild(el('div', 'machinery', text));
|
|
|
|
|
}
|
|
|
|
|
}
|