the rewind and conflict-persistence rounds, plus the GM's reminder edit: the take-back and the honest error record.

The rewind (GM, 2026-11-17): "session rewind" came off the operator queue and was redesigned simpler than the turn-surgery proposal -- physical truncation, not typed cut events; fork is the preservation story (fork before rewinding keeps the branch, no fork no archaeology), and the derivation model made the simple design free: status, agenda, and the sheet are all scanState-derived from the log, so a cut re-derives every channel with zero compensation, and every log reader (the view, the scan, the carry walk, the story, housekeeping) sees the same shorter log with nothing new between them. As built: the send commits the rewind -- POST /turn takes optional rewind (a log line index naming one of your turns; that turn and everything after it leave the log, the send replaces it) and optional expect (the log line count the client composed against; the log only moves through sends, so a mismatch means a stale tab and refuses before anything rides -- the ask answer carries it too); gmTurn's order is pendingAsk-refusal -> expect -> expand -> truncate -> land, one commit inside the activity lock, a crash between truncate and land leaving a consistent shorter log and no rewound-but-waiting state ever existing; the floor is the start marker ({t:'note', kind:'start'} written once at start right after the carryover) -- the frozen opening never unwinds, the rule reads the LAST marker (a carried log may hold an older one inside its opening), and a pre-build log refuses loudly as unmarked; the player-facing records tools are OFF until rewind-compatible (their verbs mutate the session db, which a truncation does not compensate; the manifest carries ask_gm alone whatever the settings gate says, while the CLI's --gm filings never ride a turn and stand, rewind-safe by construction); and /retry never existed -- resending the same words after a rewind IS the retry (the GM had no recollection of where the idea came from; dropped, subsumed). The SPA stages the gesture client-side until the send: a per-GM-turn rewind control (the transcript walk's onRewind, offered live and ask-free only), two-click armed, the target's EXPANDED words auto-filling the composer (the log is truth, $vars baked), a composer tint plus a note naming the cut in entries (the colour alone says something is pending, not what dies), cancel restoring the pre-gesture state, text in the box disabling the buttons under the rename "to rewind delete your current input" (a visible affordance, not hiding), and a failed send keeping the gesture armed only on a 400 (anything else may have moved the log). The gm.md desync is parked to ROADMAP's deferred list (notes taken at turn 30 surviving a rewind to 20, orphaned from the narrative -- nothing mechanical is safe there, fork covers it meanwhile). Verified: typecheck green on both programs, smoke ALL PASS with +14 rewind assertions (the floor refusals, her-turn refusal, the stale-expect 409, the truncation 45->42 lines, the dead-range sheet record reverting, the story dropping the cut, the marker surviving), restart + reminder checks green, check-repo clean after staging, and a browser pass committing a real rewind through the UI end to end (the gesture staged, cancelled, re-staged, edited, sent: 20 turns to 8 on the table, the wire body exactly {line, expect, rewind}, zero console errors).

The conflict-persistence round (GM, 2026-11-18): conflicts stay in the contwin and are self-contained. The old view policy treated conflicts as transient (visible only while the latest word, elided after) -- overruled: a mistake remains visible so it is not made again. Self-contained means the conflict DESCRIBES ITS PROBLEM IN FULL, quoting the offending emission, because the block it answers strips from the view (STRIP_HERS takes her <model>/<mind>/<sheet>) -- an old conflict cannot lean on the turn it immediately follows, and the quote is the only visible trace of what went wrong. As built: renderView renders conflictOnly unconditionally (the lastGmIdx elision gone, the variable with it); a shared quote() helper (trim, collapse whitespace, cap at 160 -- enough to identify the mistake, never a wall) feeds the guards ("yours said: {...}" on <model> and <sheet>, "(you set: ...)" on the mind verb's per-key refusals, "-- yours: {the block}" on mind JSON that does not parse; the out-of-bounds mind already carried "(got 7)" and keeps its exact form); and the ripple caught: carry.mjs's visibleBytes counted conflicts as zero-cost on the grounds they "elide once the story moves on" -- carried conflicts now render in the new session, so they cost against the 96KB budget like the prose they are. The story keeps omitting conflicts (machinery, not deliverable) and invariants' one line still reads true, so no prompt-side change was needed. Verified: smoke ALL PASS with +3 assertions (both session-1 conflicts rendering in the view despite being old news, the model-guard quote, the sheet-guard quote), restart + reminder checks green, check-repo clean.

The GM's prompt-side edit rides the same commit: the reminder's decision passage gains the checked-action metrics -- three probes for when an action should be written as intent (external conditions: the lever; scope expansion: the mall; unilateral canonisation: the gasp at what is inside), each example attempt-form under the handbook's "the attempt, never the outcome", and the third deliberately bending that line with the price named in the same breath (the reaction is hers to have, the contents never hers to say, and the dud reveal embraced as a subversion vehicle -- purview taught as a negotiation, not a prohibition); the impulsive/irrational line now names the channel ("mention it in the narration"); the two tab-indented continuations normalized to the file's spaces.

Also: the smoke's final line now prints the draft id (a smoke draft survived cleanup because "run ids" never named it -- caught on the runs listing, deleted, the print is the fix). Docs: README's protocol passage carries the rewind and the conflict lifetime, with the records-off notes in the substrate section, the tiers table, and the layout; DECISIONS #15 gains the full amendment (the ruling record: a-g, expect, the ask refusal, records-off, the gm.md park); QUESTIONS' turn-surgery details closed (retry dropped, truncation ruled); ROADMAP's surgery sections built-and-amended, the operator queue line removed, the gm.md desync parked; DICTIONARY gains the rewind entry and amends the conflict and view entries. The box package and detention stay untracked WIP, untouched.
This commit is contained in:
2026-11-18 17:24:37 +00:00
parent eefb721675
commit 53f992a5e0
19 changed files with 806 additions and 297 deletions
+99 -4
View File
@@ -25,6 +25,70 @@ import { renderRaw, renderTranscript, stickBottom, viaLine } from './transcript.
/** @type {?string} */ let rawRun = null;
let rawOpen = false;
// --- the rewind (GM, 2026-11-17) -------------------------------------------------
//
// The GM's take-back, staged client-side and committed by the send:
// clicking rewind on one of your turns fills the box with that turn's
// words (the expanded line as logged -- $vars are baked, the log is
// truth) and arms the send; sending replaces the turn and everything
// after it leaves the log (truncation -- fork first if you want the
// branch kept). Until the send the log is untouched: a reload or the
// cancel drops the gesture whole. The tinted composer is the mark --
// the note under it says what the colour means and names the cut.
/** @type {?{ idx: number, drop: number, label: string }} */ let pendingRewind = null;
let entryCount = 0; // the log length the last render saw -- the send's expect
/** @returns {void} */
function syncRewind() {
const blocked = pendingRewind !== null || /** @type {HTMLTextAreaElement} */ ($('gm-input')).value.trim().length > 0;
for (const b of /** @type {NodeListOf<HTMLButtonElement>} */ ($('transcript').querySelectorAll('button.rewind-toggle'))) {
b.disabled = blocked;
// the armed confirm text holds its place until it fires or disarms
b.textContent = b.dataset.armed === '1'
? 'sure? click again to rewind here'
: (blocked ? 'to rewind delete your current input' : 'rewind');
}
$('rewind-note').hidden = pendingRewind === null;
$('gm-stack').classList.toggle('rewind-pending', pendingRewind !== null);
if (pendingRewind) {
$('rewind-note-text').textContent =
`rewind armed: sending replaces this turn and drops the ${pendingRewind.drop} entries after it -- the tinted box marks the outgoing rewrite`;
}
}
/** @param {number} idx @param {string} text @param {HTMLButtonElement} btn */
function offerRewind(idx, text, btn) {
/** @type {?ReturnType<typeof setTimeout>} */ let timer = null;
btn.addEventListener('click', () => {
if (btn.disabled) return;
if (btn.dataset.armed !== '1') {
btn.dataset.armed = '1';
syncRewind();
clearTimeout(timer ?? undefined);
timer = setTimeout(() => { btn.dataset.armed = ''; if (btn.isConnected) syncRewind(); }, 5000);
return;
}
clearTimeout(timer ?? undefined);
btn.dataset.armed = '';
// the gesture: client-side only -- the send commits it. The label
// is the first words of the turn as the note's handle on it
pendingRewind = { idx, drop: entryCount - idx, label: text.split('\n')[0].slice(0, 60) };
/** @type {HTMLTextAreaElement} */ ($('gm-input')).value = text;
renderInputHl();
syncRewind();
/** @type {HTMLTextAreaElement} */ ($('gm-input')).focus();
});
}
/** @returns {void} */
function cancelRewind() {
pendingRewind = null;
/** @type {HTMLTextAreaElement} */ ($('gm-input')).value = '';
renderInputHl();
syncRewind();
}
// her two blocks, split along the seam: how she is (the status) vs
// what she means to do (the agenda). Both render compact, mirroring
// the wire formats the model cites. The edit button stages a block
@@ -75,6 +139,8 @@ export function leave() {
export async function enter(id, seq) {
if (id == null) return; // unreachable: the router only enters play with a run id
if (rawRun !== id) { rawRun = id; rawOpen = false; } // a new run starts at the table
pendingRewind = null; // the gesture belongs to the run it was staged on
entryCount = 0;
statusPane.reset();
agendaPane.reset();
theSheet.reset();
@@ -119,6 +185,9 @@ async function refreshPlay(id, seq) {
theSheet.setEditable(detail.phase === 'live');
/** @type {HTMLTextAreaElement} */ ($('gm-notes')).readOnly = false;
// a pending gesture cannot outlive the live session (a stop or a
// failed send ends the table it was staged on)
if (detail.phase !== 'live') pendingRewind = null;
$('table-tabs').hidden = true; // the tabs are the live session's
if (detail.phase === 'live') {
// the table has two faces: the curated projection (thinking never
@@ -130,12 +199,22 @@ async function refreshPlay(id, seq) {
if (rawOpen) {
/** @type {TableResponse} */ const session = await api(`/runs/${id}/session`);
if (seq !== state.seq) return;
entryCount = session.entries.length;
renderRaw(session.entries);
} else {
/** @type {TableResponse} */ const session = await api(`/runs/${id}/table`);
if (seq !== state.seq) return;
renderTranscript(session.entries, { onConflict: showConflict, onRaw: showRawEntry });
entryCount = session.entries.length;
// the rewind control rides GM turns while it may fire: a pending
// ask refuses sends anyway, so the buttons stay off until it
// resolves (the server would refuse -- the surface says so first)
renderTranscript(session.entries, {
onConflict: showConflict,
onRaw: showRawEntry,
...(detail.pendingAsk ? {} : { onRewind: offerRewind }),
});
}
syncRewind();
} else if (detail.phase === 'dormant') {
// the review window: the carryover is the preview of the next
// contwin's opening, rendered exactly as the table will hold it
@@ -145,8 +224,10 @@ async function refreshPlay(id, seq) {
if (carry && carry.entries.length) renderTranscript(carry.entries, {});
else $('transcript').appendChild(el('div', 'hint', 'nothing carries -- the next session opens on the bundle alone'));
$('transcript').prepend(dormantBar(detail, carry));
syncRewind();
} else {
$('transcript').textContent = '';
syncRewind();
}
// controls
@@ -470,8 +551,11 @@ async function sendTurn() {
// staged block edits ride the turn (the override): only the kinds
// staged attach, whole-list. The staged sheet rides the same way --
// the GM's ledger record ({} is a live empty ledger, so the null
// check, not truthiness)
/** @type {{ line: string, status?: string[], agenda?: string[], sheet?: Record<string, unknown> }} */ const body = { line };
// check, not truthiness). The pending rewind names the GM turn this
// send replaces; expect states the log this was composed against --
// a stale tab refuses before anything rides
/** @type {{ line: string, status?: string[], agenda?: string[], sheet?: Record<string, unknown>, rewind?: number, expect?: number }} */ const body = { line, expect: entryCount };
if (pendingRewind) body.rewind = pendingRewind.idx;
if (statusPane.staged) body.status = statusPane.staged;
if (agendaPane.staged) body.agenda = agendaPane.staged;
if (theSheet.staged !== null) body.sheet = theSheet.staged;
@@ -490,10 +574,16 @@ async function sendTurn() {
statusPane.clearStaged(); // sent -- the panes re-render from the scan
agendaPane.clearStaged();
theSheet.clearStaged();
pendingRewind = null; // committed -- the new log is the truth now
} catch (e) {
failed = e.message;
/** @type {HTMLInputElement} */ ($('gm-input')).value = line; // a failed send must not eat the line
renderInputHl();
// a 400 refused before anything touched the log (validation,
// expansion, a bad rewind target) -- the gesture stays armed for
// the re-send. Anything else may have moved the log: drop it and
// let the re-render show the truth
if (e.status !== 400) pendingRewind = null;
}
meterStop();
setBusy(false);
@@ -510,7 +600,7 @@ async function sendAnswer() {
meterStart();
let failed = null;
try {
await api(`/runs/${state.runId}/ask`, { method: 'POST', body: { answer } });
await api(`/runs/${state.runId}/ask`, { method: 'POST', body: { answer, expect: entryCount } });
} catch (e) {
failed = e.message;
/** @type {HTMLInputElement} */ ($('ask-answer')).value = answer;
@@ -627,6 +717,11 @@ $('gm-send').addEventListener('click', sendTurn);
$('gm-input').addEventListener('keydown', (e) => {
if (e.key === ' ' && e.ctrlKey) { e.preventDefault(); sendTurn(); }
});
// text in the box blocks the rewind gesture (GM, 2026-11-17): the
// button disables and renames rather than hiding, so the affordance
// says what unlocks it. Clearing the box re-enables it
$('gm-input').addEventListener('input', syncRewind);
$('rewind-cancel').addEventListener('click', cancelRewind);
// the GM input's highlight overlay: the setup editor's stack pattern
// -- the pre behind a transparent-text textarea renders the tokens in