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:
+9
-1
@@ -190,7 +190,15 @@ const RECORD_TOOLS = [
|
||||
|
||||
/** @param {string} runId @returns {import('./shapes.mjs').ToolDef[]} */
|
||||
export function toolList(runId) {
|
||||
return [ASK_GM_TOOL, ...(readSettings(runId).records === true ? RECORD_TOOLS : [])];
|
||||
// Records are OFF for now (GM, 2026-11-17): their verbs mutate the
|
||||
// session db, and a rewind does not compensate db state -- until the
|
||||
// verbs are rewind-compatible the manifest carries ask_gm alone,
|
||||
// whatever the run's settings say. The CLI's --gm path is
|
||||
// unaffected: it never rides a turn, and GM filings ahead of play
|
||||
// are rewind-safe by construction (the db only moves at housekeeping
|
||||
// or by the GM's hand).
|
||||
void runId;
|
||||
return [ASK_GM_TOOL];
|
||||
}
|
||||
|
||||
// tool name -> clerk argv
|
||||
|
||||
+7
-1
@@ -38,6 +38,12 @@ function visibleBytes(lines, eff, i) {
|
||||
// old GM turns elide their rides in the view
|
||||
return String(e.m.content ?? '').replace(STRIP_BLOCKS, '').length;
|
||||
}
|
||||
if (e.m.role === 'user') {
|
||||
// conflict traffic stays in the contwin (GM, 2026-11-18) -- a
|
||||
// carried conflict renders in the new session, so it costs like
|
||||
// the prose it now is
|
||||
return String(e.m.content ?? '').length;
|
||||
}
|
||||
if (e.m.role === 'assistant') {
|
||||
// variant turns count only the chosen variant; drafts are
|
||||
// invisible and cost nothing; thinking rides in the message
|
||||
@@ -45,7 +51,7 @@ function visibleBytes(lines, eff, i) {
|
||||
const c = eff.has(i) ? eff.get(i) : e.m.content;
|
||||
return String(c ?? '').length;
|
||||
}
|
||||
return 0; // conflict-only traffic elides once the story moves on
|
||||
return 0;
|
||||
}
|
||||
if (e.t === 'tool') return String(e.m.content ?? '').length; // conservative: the full result, never the stub
|
||||
return 0; // notes and bundle: machinery, never model prose
|
||||
|
||||
+52
-14
@@ -25,7 +25,7 @@
|
||||
/** @typedef {import('./shapes.mjs').ViewMessage} ViewMessage */
|
||||
|
||||
import { toolList, runTool, assembleReminder, expandVars } from './bundle.mjs';
|
||||
import { renderView, cleanBlockList, AGENDA_CAP } from './session.mjs';
|
||||
import { renderView, cleanBlockList, AGENDA_CAP, rewindTo } from './session.mjs';
|
||||
import { parseVariants, pickVariant } from './variants.mjs';
|
||||
import { registry, usable } from './discovery.mjs';
|
||||
|
||||
@@ -54,11 +54,18 @@ function needSession(ctx, runId) {
|
||||
* @param {Ctx} ctx @param {string} runId @param {string} line @param {?Actor} user
|
||||
* @param {?{ status?: string[], agenda?: string[] }} [override]
|
||||
* @param {?Record<string, unknown>} [sheet]
|
||||
* @param {?{ rewind?: ?number, expect?: ?number }} [send]
|
||||
* @returns {Promise<TurnOut>}
|
||||
*/
|
||||
export async function gmTurn(ctx, runId, line, user, override = null, sheet = null) {
|
||||
export async function gmTurn(ctx, runId, line, user, override = null, sheet = null, send = null) {
|
||||
const s = needSession(ctx, runId);
|
||||
if (s.pendingAsk) throw new HttpError(409, 'a question is pending -- answer it first (POST /ask)');
|
||||
// the staleness guard (GM, 2026-11-17): the client states the log it
|
||||
// composed against. The log only moves through sends, so a mismatch
|
||||
// means a stale tab -- refuse before anything rides, rewind or not
|
||||
if (send?.expect != null && send.expect !== s.lines.length) {
|
||||
throw new HttpError(409, `the session moved on -- this send was composed against a stale view (${send.expect} lines then, ${s.lines.length} now); refresh and re-send`);
|
||||
}
|
||||
// GM-input expansion (strict, DECISIONS #9): the line resolves at
|
||||
// ingestion -- the log records the expanded words, which is what
|
||||
// keeps continuation carryovers expansion-free forever. A refused
|
||||
@@ -69,6 +76,12 @@ export async function gmTurn(ctx, runId, line, user, override = null, sheet = nu
|
||||
} catch (e) {
|
||||
throw new HttpError(400, `the line was not sent -- ${e.message}`);
|
||||
}
|
||||
// the rewind (GM, 2026-11-17): the target GM turn and everything
|
||||
// after it leave the log, and this send takes its place. The commit
|
||||
// happens here -- after the line expanded cleanly, so a refusal
|
||||
// truncates nothing -- and as one landing with the turn: the log is
|
||||
// never left rewound-and-waiting
|
||||
if (send?.rewind != null) rewindTo(s, send.rewind);
|
||||
// GM prose goes pure: no cache blocks ride any turn. A block edit,
|
||||
// when given, rides this turn as the override record -- the
|
||||
// composition overwrites her newest blocks with it (the scan reads
|
||||
@@ -96,11 +109,16 @@ export async function openingCall(ctx, runId, user) {
|
||||
|
||||
/**
|
||||
* @param {Ctx} ctx @param {string} runId @param {string} answer @param {?Actor} user
|
||||
* @param {?number} [expect]
|
||||
* @returns {Promise<TurnOut>}
|
||||
*/
|
||||
export async function answerAsk(ctx, runId, answer, user) {
|
||||
export async function answerAsk(ctx, runId, answer, user, expect = null) {
|
||||
const s = needSession(ctx, runId);
|
||||
if (!s.pendingAsk) throw new HttpError(409, 'no pending question');
|
||||
// the same staleness guard as the turn send: the answer appends too
|
||||
if (expect != null && expect !== s.lines.length) {
|
||||
throw new HttpError(409, `the session moved on -- this answer was composed against a stale view (${expect} lines then, ${s.lines.length} now); refresh and re-answer`);
|
||||
}
|
||||
// the answer is GM input: same strict expansion, same hand-back --
|
||||
// a refusal leaves the pending question untouched
|
||||
let resolved;
|
||||
@@ -255,14 +273,19 @@ async function runLoop(ctx, runId, user) {
|
||||
mindNext = mind.params;
|
||||
}
|
||||
// the <model> block is display-only: the read side of the mind
|
||||
// verb, never hers to emit
|
||||
// verb, never hers to emit. The <sheet> block is the same
|
||||
// (GM, 2026-11-17) -- the GM's ledger, changes propose in prose.
|
||||
// Both guards quote the offending emission: a conflict must be
|
||||
// self-contained (GM, 2026-11-18) -- it stays in the contwin, and
|
||||
// the block it answers strips from the view, so the quote is the
|
||||
// only visible trace of what went wrong
|
||||
if (/<model>/.test(text)) {
|
||||
carry.push('the <model> block is a read-only display of your active parameters -- state them in a <mind> block');
|
||||
const emitted = quote(String(text.match(/<model>([\s\S]*?)<\/model>/)?.[1] ?? ''));
|
||||
carry.push(`the <model> block is a read-only display of your active parameters -- state them in a <mind> block (yours said: ${emitted})`);
|
||||
}
|
||||
// the <sheet> block is display-only the same way: the GM's ledger,
|
||||
// read-only for her (GM, 2026-11-17) -- changes propose in prose
|
||||
if (/<sheet>/.test(text)) {
|
||||
carry.push('the <sheet> block is the GM\'s ledger -- propose changes in prose');
|
||||
const emitted = quote(String(text.match(/<sheet>([\s\S]*?)<\/sheet>/)?.[1] ?? ''));
|
||||
carry.push(`the <sheet> block is the GM's ledger -- propose changes in prose (yours said: ${emitted})`);
|
||||
}
|
||||
if (carry.length && heals < 3) {
|
||||
// a conflict answers for itself: it goes back as its own message,
|
||||
@@ -373,10 +396,25 @@ function rangeText(key, r) {
|
||||
return `${key} accepts any number (-1 and 0 turn the filter off)`;
|
||||
}
|
||||
|
||||
// a conflict quotes the offending emission (self-contained, GM,
|
||||
// 2026-11-18): the conflict stays in the contwin, the block it
|
||||
// answers strips from the view, so the quote is the only visible
|
||||
// trace of what went wrong. Trim, collapse whitespace, cap the
|
||||
// length -- enough to identify the mistake, never a wall
|
||||
/** @param {string} s @returns {string} */
|
||||
function quote(s) {
|
||||
const flat = s.trim().replace(/\s+/g, ' ');
|
||||
return flat.length > 160 ? `${flat.slice(0, 160)}...` : flat;
|
||||
}
|
||||
|
||||
/** Parse one turn's <mind> blocks: a JSON object of knobs per block,
|
||||
* all blocks combined (last wins per key, the same-verb rule). Every
|
||||
* wrong thing is named -- the caller rides the conflict path, and
|
||||
* she heals by restating.
|
||||
* she heals by restating. The errors carry what she wrote: a
|
||||
* conflict must describe its problem in full (GM, 2026-11-18), even
|
||||
* when the problem originates in the turn it immediately follows --
|
||||
* the block itself strips from the view, the conflict is what
|
||||
* remains.
|
||||
* @param {string} text @returns {{ params: Record<string, number>, errors: string[] }}
|
||||
*/
|
||||
function parseMind(text) {
|
||||
@@ -388,25 +426,25 @@ function parseMind(text) {
|
||||
try {
|
||||
obj = JSON.parse(block);
|
||||
} catch (e) {
|
||||
errors.push(`the <mind> block wants a JSON object (${String(e.message ?? e).split('\n')[0].slice(0, 120)})`);
|
||||
errors.push(`the <mind> block wants a JSON object -- yours: ${quote(block)} (${String(e.message ?? e).split('\n')[0].slice(0, 120)})`);
|
||||
continue;
|
||||
}
|
||||
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
||||
errors.push('the <mind> block wants a JSON object of knobs');
|
||||
errors.push(`the <mind> block wants a JSON object of knobs -- yours: ${quote(block)}`);
|
||||
continue;
|
||||
}
|
||||
for (const [key, v] of Object.entries(obj)) {
|
||||
if (key === 'max_tokens') {
|
||||
errors.push('max_tokens is not hers to set -- the mind verb sets temperature, top_p, top_k, repetition_penalty');
|
||||
errors.push(`max_tokens is not hers to set -- the mind verb sets temperature, top_p, top_k, repetition_penalty (you set: max_tokens ${JSON.stringify(v)})`);
|
||||
continue;
|
||||
}
|
||||
const range = KNOB_BOUNDS[key];
|
||||
if (!range) {
|
||||
errors.push(`the <mind> block names an unknown knob: ${key} -- ${Object.keys(KNOB_BOUNDS).join(', ')}`);
|
||||
errors.push(`the <mind> block names an unknown knob: ${key} (you set: ${JSON.stringify(v)}) -- ${Object.keys(KNOB_BOUNDS).join(', ')}`);
|
||||
continue;
|
||||
}
|
||||
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
||||
errors.push(`the <mind> block wants a number for ${key}`);
|
||||
errors.push(`the <mind> block wants a number for ${key} (you set: ${JSON.stringify(v)})`);
|
||||
continue;
|
||||
}
|
||||
if ((range.min !== undefined && (range.minExclusive ? v <= range.min : v < range.min))
|
||||
|
||||
+30
-2
@@ -936,6 +936,30 @@ function readSheet(body) {
|
||||
return /** @type {Record<string, unknown>} */ (body.sheet);
|
||||
}
|
||||
|
||||
// The rewind and the staleness guard (GM, 2026-11-17), both optional
|
||||
// fields on the send, both native API with no UX rules riding here:
|
||||
// rewind names the GM turn (a log line index) this send replaces --
|
||||
// the target and everything after it leave the log; expect states the
|
||||
// log line count the send was composed against, and a mismatch (a
|
||||
// stale tab; the log only moves through sends) refuses before
|
||||
// anything rides. The SPA always sends expect; curl may omit it.
|
||||
/** @param {Record<string, unknown>} body @returns {number} */
|
||||
function readRewind(body) {
|
||||
if (body.rewind === undefined || body.rewind === null) return Number.NaN;
|
||||
if (!Number.isInteger(body.rewind)) {
|
||||
throw new HttpError(400, 'rewind must be a log line index (an integer) -- the GM turn this send replaces');
|
||||
}
|
||||
return Number(body.rewind);
|
||||
}
|
||||
/** @param {Record<string, unknown>} body @returns {?number} */
|
||||
function readExpect(body) {
|
||||
if (body.expect === undefined || body.expect === null) return null;
|
||||
if (!Number.isInteger(body.expect)) {
|
||||
throw new HttpError(400, 'expect must be the log line count this send was composed against (an integer)');
|
||||
}
|
||||
return Number(body.expect);
|
||||
}
|
||||
|
||||
route('POST', '/api/runs/:id/turn', async ({ params, body, user }) => {
|
||||
const line = String(body.line ?? '').trim();
|
||||
if (!line) throw new HttpError(400, 'line is required');
|
||||
@@ -944,15 +968,19 @@ route('POST', '/api/runs/:id/turn', async ({ params, body, user }) => {
|
||||
if ((override || sheet) && line.startsWith('(')) {
|
||||
throw new HttpError(400, 'a block edit cannot ride an OOC turn -- overrides arrive with a non-OOC GM turn');
|
||||
}
|
||||
const rewind = readRewind(body);
|
||||
const expect = readExpect(body);
|
||||
requireOwner(user, params.id);
|
||||
return { ok: true, ...(await ctx.enqueue(params.id, async () => gmTurn(ctx, params.id, line, user, override, sheet))) };
|
||||
const send = { rewind: Number.isNaN(rewind) ? null : rewind, expect };
|
||||
return { ok: true, ...(await ctx.enqueue(params.id, async () => gmTurn(ctx, params.id, line, user, override, sheet, send))) };
|
||||
});
|
||||
|
||||
route('POST', '/api/runs/:id/ask', async ({ params, body, user }) => {
|
||||
const answer = String(body.answer ?? '').trim();
|
||||
if (!answer) throw new HttpError(400, 'answer is required');
|
||||
const expect = readExpect(body);
|
||||
requireOwner(user, params.id);
|
||||
return { ok: true, ...(await ctx.enqueue(params.id, async () => answerAsk(ctx, params.id, answer, user))) };
|
||||
return { ok: true, ...(await ctx.enqueue(params.id, async () => answerAsk(ctx, params.id, answer, user, expect))) };
|
||||
});
|
||||
|
||||
// the turn meter's read (GM, 2026-11-17): the live progress record
|
||||
|
||||
+69
-10
@@ -10,13 +10,17 @@
|
||||
//
|
||||
// The append-only jsonl is the truth; the in-memory context is a view
|
||||
// rebuilt from it on boot. Entries are typed (bundle / msg / tool /
|
||||
// note / opening) so later features (turn surgery) can append their
|
||||
// own kinds without a format migration. The view renderer is pure
|
||||
// note / opening) so later features can append their own kinds without
|
||||
// a format migration. The one sanctioned break of append-only is the
|
||||
// rewind (2026-11-17): a rewind-send truncates the log to its target
|
||||
// and lands the new turn in one commit -- fork is the preservation
|
||||
// story, no fork no archaeology. The view renderer is pure
|
||||
// policy over the log: thinking never goes back, variant turns render
|
||||
// only the picked variant, old tool results elide to stubs
|
||||
// (the last few and every ask_gm answer stay), old GM-side
|
||||
// <status>/<conflict> blocks elide -- the current status rides the
|
||||
// newest GM turn.
|
||||
// <status>/<conflict> blocks elide from GM prose -- the current status
|
||||
// rides the newest GM turn -- and conflict messages never elide: a
|
||||
// mistake stays visible so it is not made again (GM, 2026-11-18).
|
||||
/** @typedef {import('./shapes.mjs').LogEvent} LogEvent */
|
||||
/** @typedef {import('./shapes.mjs').LiveSession} LiveSession */
|
||||
/** @typedef {import('./shapes.mjs').PendingAsk} PendingAsk */
|
||||
@@ -363,6 +367,56 @@ export function findStalledStop(runId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// --- rewind: the GM's take-back (GM, 2026-11-17) ------------------------------
|
||||
//
|
||||
// The in-place rollback of the live session, deliberately destructive:
|
||||
// the target GM turn and everything after it leave the log, and the
|
||||
// send that carries the rewind takes the target's place -- edit-and-
|
||||
// resend, the turn-surgery principle of DECISIONS #15. Where the old
|
||||
// proposal kept the discarded range as typed cut events, the ruling
|
||||
// here is physical truncation: fork is the preservation story (fork
|
||||
// before rewinding keeps the branch), and with no fork there is no
|
||||
// archaeology. Truncation is also why the feature is cheap -- every
|
||||
// reader of the log (the view, the state scan, the carry walk, the
|
||||
// story, housekeeping) sees the same shorter log with zero new
|
||||
// machinery; the rings never move mid-session, so nothing else needs
|
||||
// compensating. The floor is the start marker: the frozen opening
|
||||
// never unwinds. Called from the send path only, inside the run's
|
||||
// activity lock, after the new line expanded cleanly -- the commit is
|
||||
// one landing with the turn that replaces the cut.
|
||||
|
||||
/**
|
||||
* @param {LiveSession} s @param {number} idx the target GM turn's line index
|
||||
* @returns {number} the lines dropped
|
||||
*/
|
||||
export function rewindTo(s, idx) {
|
||||
if (!Number.isInteger(idx) || idx < 0 || idx >= s.lines.length) {
|
||||
throw err(400, `the rewind target ${JSON.stringify(idx)} is not a line of this session's log`);
|
||||
}
|
||||
const e = s.lines[idx];
|
||||
if (e.t !== 'msg' || e.m.role !== 'user' || e.conflictOnly) {
|
||||
throw err(400, 'the rewind target must be one of your turns (a GM turn)');
|
||||
}
|
||||
// the floor: the LAST start marker (a carried log may hold an older
|
||||
// one inside its opening -- only turns after the newest marker are
|
||||
// this session's live play)
|
||||
let floor = -1;
|
||||
for (const [i, x] of s.lines.entries()) {
|
||||
if (x.t === 'note' && x.kind === 'start') floor = i;
|
||||
}
|
||||
if (floor === -1) {
|
||||
throw err(409, 'this session predates the rewind build -- its opening boundary is unmarked, so nothing is rewindable');
|
||||
}
|
||||
if (idx <= floor) {
|
||||
throw err(400, 'the opening is frozen -- rewind reaches your turns after it only');
|
||||
}
|
||||
const dropped = s.lines.length - idx;
|
||||
s.lines = s.lines.slice(0, idx);
|
||||
writeLog(s.file, s.lines);
|
||||
derive(s); // mind and usage re-derive from the shorter log
|
||||
return dropped;
|
||||
}
|
||||
|
||||
// --- start: lint, freeze, consume, go live -------------------------------------
|
||||
|
||||
// the authored carryover's event vocabulary: her opening as msg
|
||||
@@ -577,6 +631,10 @@ export function startSession(runId, { override = false } = {}) {
|
||||
{ t: 'bundle', m: system, part: 'system' },
|
||||
...bundle.map((m, i) => /** @type {LogEvent} */ ({ t: 'bundle', m, part: partNames[i] })),
|
||||
...carry,
|
||||
// the rewind floor (GM, 2026-11-17): the opening -- authored or
|
||||
// carried -- is frozen; live play starts at this line, and a
|
||||
// rewind may only ever target GM turns below it
|
||||
{ t: 'note', kind: 'start' },
|
||||
];
|
||||
// the assembled context must be sound before anything lands:
|
||||
// tool pairing, variants resolution, every render invariant
|
||||
@@ -623,7 +681,6 @@ export function renderView(s, keepToolResults = 4) {
|
||||
const toolIdx = [];
|
||||
/** @type {number[]} */
|
||||
const reminderIdx = [];
|
||||
let lastGmIdx = -1;
|
||||
// the stamping pre-pass (the full-block protocol): the canon point
|
||||
// is her most recent prose turn -- the newest status and agenda
|
||||
// stamp at its tail, whatever their source (her emission, a GM
|
||||
@@ -635,7 +692,6 @@ export function renderView(s, keepToolResults = 4) {
|
||||
let lastProse = -1;
|
||||
s.lines.forEach((e, i) => {
|
||||
if (e.t === 'tool') toolIdx.push(i);
|
||||
if (e.t === 'msg' && e.m.role === 'user') lastGmIdx = i;
|
||||
if (e.t === 'msg' && e.reminder) reminderIdx.push(i);
|
||||
if (e.t === 'msg' && e.m.role === 'assistant') {
|
||||
const c = eff.has(i) ? eff.get(i) : e.m.content;
|
||||
@@ -691,10 +747,13 @@ export function renderView(s, keepToolResults = 4) {
|
||||
if (e.m.tool_calls?.length) m.tool_calls = e.m.tool_calls;
|
||||
msgs.push(m);
|
||||
} else if (e.conflictOnly) {
|
||||
// transient error traffic: visible while it is the latest word
|
||||
// (the model answers it), elided entirely once the story moves
|
||||
// on -- the log keeps it for provenance
|
||||
if (i === lastGmIdx) msgs.push({ role: e.m.role, content: String(e.m.content ?? '').trim() });
|
||||
// the self-heal channel stays in the contwin (GM, 2026-11-18):
|
||||
// a mistake remains visible so it is not made again. This is
|
||||
// why conflicts must be self-contained -- describe the problem
|
||||
// in full, quoting the offending emission, because the
|
||||
// emission itself strips from the view and an old conflict
|
||||
// cannot lean on the turn it answered
|
||||
msgs.push({ role: e.m.role, content: String(e.m.content ?? '').trim() });
|
||||
} else {
|
||||
// GM prose goes pure (the full-block protocol): the rides were
|
||||
// server-composited, never GM words -- strip from every GM
|
||||
|
||||
+7
-1
@@ -63,7 +63,13 @@ export {};
|
||||
* scan reads it newest-wins (it loses to any emission inside the
|
||||
* tail by position). */
|
||||
/** @typedef {{ t: 'note', kind: 'state', status?: string[], agenda?: string[], sheet?: Record<string, unknown> }} StateNote */
|
||||
/** @typedef {SessionNote|AskNote|PickNote|StatusNote|AgendaNote|MindNote|StateNote} NoteEvent */
|
||||
/** start: the frozen-opening boundary (rewind, GM, 2026-11-17) --
|
||||
* written once at start, right after the consumed carryover: the
|
||||
* opening (authored or carried) above it is what a rewind can never
|
||||
* reach. A session whose log predates the build carries none, and
|
||||
* its rewind refuses loudly. */
|
||||
/** @typedef {{ t: 'note', kind: 'start' }} StartNote */
|
||||
/** @typedef {SessionNote|AskNote|PickNote|StatusNote|AgendaNote|MindNote|StateNote|StartNote} NoteEvent */
|
||||
|
||||
/** bundle: one frozen prompt part (system, backdrop, character, rings). */
|
||||
/** @typedef {{ t: 'bundle', m: { role: 'user'|'system', content: string }, part: string }} BundleEvent */
|
||||
|
||||
Reference in New Issue
Block a user