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:
+77
-4
@@ -10,7 +10,14 @@
|
||||
// every turn, the pass log's model), the mind verb (the player sets
|
||||
// its sampling for its next turn: one-shot, JSON, bounds enforced,
|
||||
// conflict-healed, carried unconsumed across a session boundary,
|
||||
// inherited by a fork), the full-block protocol (whole-list status
|
||||
// inherited by a fork), the rewind (GM, 2026-11-17: the send that
|
||||
// carries it replaces its target GM turn -- physical truncation, the
|
||||
// frozen-opening floor, the sheet records of the dead range reverting,
|
||||
// the staleness guard on every send), the conflict channel's
|
||||
// persistence (GM, 2026-11-18: conflicts stay in the contwin and are
|
||||
// self-contained -- the offending emission quoted, because the block
|
||||
// it answers strips from the view), the full-block protocol
|
||||
// (whole-list status
|
||||
// and agenda sets, absent = unchanged, the silent over-cap eviction,
|
||||
// the view stamping at the canon point, the <model> display blocks,
|
||||
// the emitted-<model> guard, GM prose pure), the state scan (the log
|
||||
@@ -324,6 +331,11 @@ ok('her mind tags are write-only (stripped from the view)',
|
||||
her1.every((m) => !/<mind>/.test(String(m.content ?? ''))), '');
|
||||
ok('an emitted <model> block strips from the view',
|
||||
her1.every((m) => !/\n<model>/.test(String(m.content ?? ''))), '');
|
||||
const viewConflicts = view1.filter((m) => m.role === 'user' && /^<conflict>/.test(String(m.content ?? '')));
|
||||
ok('past conflicts stay in the context (a mistake remains visible, GM 2026-11-18)',
|
||||
viewConflicts.length === 2, `${viewConflicts.length} render`);
|
||||
ok('a conflict describes its problem in full (the stripped emission quoted)',
|
||||
viewConflicts.some((m) => /yours said: \{"temperature": 0\.1\}/.test(String(m.content ?? ''))), '');
|
||||
ok('each past turn carries its <model> block when params rode',
|
||||
her1.some((m) => String(m.content ?? '').startsWith('<model>{"temperature":1.2}</model>')), '');
|
||||
ok('the <model> block hides the effort knob (not her call)',
|
||||
@@ -648,8 +660,9 @@ ok('the scan derives the sheet newest-wins', JSON.stringify(r.data.sheet) === '{
|
||||
// script's ask position -- answer it, then the view asserts (pairing
|
||||
// must be whole for renderView)
|
||||
if (r.data.pendingAsk) {
|
||||
r = await call(`/runs/${runId}/ask`, { method: 'POST', token: op, body: { answer: 'clear enough' } });
|
||||
ok('the sheet battery answers the script ask', r.status === 200, r.data.error ?? '');
|
||||
const preAsk = await call(`/runs/${runId}/session`, { token: op });
|
||||
r = await call(`/runs/${runId}/ask`, { method: 'POST', token: op, body: { answer: 'clear enough', expect: preAsk.data.entries.length } });
|
||||
ok('the sheet battery answers the script ask (a fresh expect passes)', r.status === 200, r.data.error ?? '');
|
||||
}
|
||||
{
|
||||
const view = renderView({ lines: jsonl(runId, 4, 'log.jsonl'), pendingAsk: null });
|
||||
@@ -685,6 +698,9 @@ ok('her emitted sheet never applies (the scan holds the GM\'s record)',
|
||||
const view = renderView({ lines: jsonl(runId, 4, 'log.jsonl'), pendingAsk: null });
|
||||
ok('the view strips her emitted sheet (the chunk alone carries it)',
|
||||
view.every((m) => m.role !== 'assistant' || !/<sheet>/.test(String(m.content ?? ''))), 'her emission rode the view');
|
||||
const sheetConf = view.find((m) => m.role === 'user' && /GM's ledger/.test(String(m.content ?? '')));
|
||||
ok('the sheet guard quotes her emission (self-contained)',
|
||||
!!sheetConf && /yours said: \{"gp": 99\}/.test(String(sheetConf?.content ?? '')), String(sheetConf?.content ?? 'no conflict in the view'));
|
||||
}
|
||||
r = await call(`/runs/${runId}/story`, { token: op });
|
||||
ok('the story strips her emitted sheet',
|
||||
@@ -717,7 +733,64 @@ ok('the sheet crossed the boundary (the note feeds the new session\'s scan)', JS
|
||||
ok('session 5 renders the sheet chunk from the carried note', chunk?.content === '<sheet>{}</sheet>', chunk?.content ?? 'no chunk');
|
||||
}
|
||||
|
||||
console.log(`\nrun ids: source=${runId} fork=${forkId} second=${secondId} refork=${reforkId}`);
|
||||
// 24. the rewind (GM, 2026-11-17): the GM's take-back. The send that
|
||||
// carries rewind replaces the target GM turn -- the target and
|
||||
// everything after it leave the log (physical truncation; fork is the
|
||||
// preservation story). The floor is the start marker (the frozen
|
||||
// opening), and every send guards against a stale view via expect.
|
||||
{
|
||||
// the floor marker rides session 5's log, after the carry
|
||||
const s5 = jsonl(runId, 5, 'log.jsonl');
|
||||
const marker = s5.map((e, i) => (e.t === 'note' && e.kind === 'start' ? i : -1)).filter((i) => i >= 0).pop();
|
||||
ok('the start marker rides the log (the rewind floor)', marker != null && marker >= 0, String(marker ?? 'none'));
|
||||
|
||||
// two turns with ledger records: the rewind will revert the second
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*Rewind battery one.*', sheet: { rb: 1 } } });
|
||||
ok('rewind battery: turn one sends', r.status === 200, r.data.error ?? '');
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*Rewind battery two.*', sheet: { rb: 2 } } });
|
||||
ok('rewind battery: turn two sends', r.status === 200, r.data.error ?? '');
|
||||
r = await call(`/runs/${runId}`, { token: op });
|
||||
ok('rewind battery: the second record leads', JSON.stringify(r.data.sheet) === '{"rb":2}', JSON.stringify(r.data.sheet));
|
||||
|
||||
const now = await call(`/runs/${runId}/session`, { token: op });
|
||||
const len = now.data.entries.length;
|
||||
const target = now.data.entries.findIndex((e) => e.t === 'msg' && e.m.role === 'user' && !e.conflictOnly && /Rewind battery one\./.test(String(e.m.content ?? '')));
|
||||
ok('the target GM turn is addressed by log index', target >= 0, String(target));
|
||||
|
||||
// the staleness guard: a wrong expect refuses before anything rides
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*Stale.*', expect: len - 1 } });
|
||||
ok('a stale expect refuses the send', r.status === 409 && /stale/.test(r.data.error), r.data.error ?? '');
|
||||
// her turn is not a valid target
|
||||
const herIdx = now.data.entries.map((e, i) => (e.t === 'msg' && e.m.role === 'assistant' && !e.m.tool_calls?.length ? i : -1)).filter((i) => i >= 0).pop();
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*No.*', rewind: herIdx, expect: len } });
|
||||
ok('her turn is not a rewind target', r.status === 400 && /your turns/.test(r.data.error), r.data.error ?? '');
|
||||
// the frozen opening: a carried GM turn (above the marker) refuses
|
||||
const carriedGm = now.data.entries.findIndex((e, i) => e.t === 'msg' && e.m.role === 'user' && !e.conflictOnly && i < (marker ?? 0));
|
||||
ok('the battery found a carried GM turn above the floor', carriedGm >= 0, 'none before the marker');
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*No.*', rewind: carriedGm, expect: len } });
|
||||
ok('the frozen opening refuses the rewind', r.status === 400 && /frozen/.test(r.data.error), r.data.error ?? '');
|
||||
// the refusals landed nothing
|
||||
r = await call(`/runs/${runId}/session`, { token: op });
|
||||
ok('the refused rewinds touched nothing', r.data.entries.length === len, `${len} -> ${r.data.entries.length}`);
|
||||
|
||||
// the rewind send itself: the edited turn replaces its target, the
|
||||
// ledger record restated as part of the rewrite
|
||||
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: op, body: { line: '*Rewind battery one, edited.*', sheet: { rb: 1 }, rewind: target, expect: len } });
|
||||
ok('the rewind send lands', r.status === 200, r.data.error ?? '');
|
||||
r = await call(`/runs/${runId}/session`, { token: op });
|
||||
ok('the log truncated (the target replaced, everything after it gone)',
|
||||
r.data.entries.some((e) => e.t === 'msg' && e.m.role === 'user' && /Rewind battery one, edited/.test(String(e.m.content ?? '')))
|
||||
&& r.data.entries.every((e) => !/Rewind battery (one\.|two)/.test(JSON.stringify(e)))
|
||||
&& r.data.entries.length < len,
|
||||
`${len} -> ${r.data.entries.length}`);
|
||||
ok('the marker survives the cut (the floor holds)', r.data.entries.some((e) => e.t === 'note' && e.kind === 'start'), '');
|
||||
r = await call(`/runs/${runId}`, { token: op });
|
||||
ok("the dead range's records re-derive away (the sheet reverts)", JSON.stringify(r.data.sheet) === '{"rb":1}', JSON.stringify(r.data.sheet));
|
||||
r = await call(`/runs/${runId}/story`, { token: op });
|
||||
ok('the story drops the cut range', r.data.sessions.every((s) => s.turns.every((t) => !/Rewind battery two/.test(t.text))), 'the dropped prose survived in the story');
|
||||
}
|
||||
|
||||
console.log(`\nrun ids: source=${runId} draft=${draftId} fork=${forkId} second=${secondId} refork=${reforkId}`);
|
||||
writeFileSync(TOKEN_FILE, `${op} ${reforkId} ${secondId}`);
|
||||
console.log(failures ? `\n${failures} FAILURES` : '\nALL PASS');
|
||||
process.exit(failures ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user