the state-scan round: the log is the one truth for status and agenda, the db tiers retired -- scanState (server/session.mjs) derives each kind newest-wins across her emissions (the picked variant's text), the GM's override records, and the boundary state notes; the panes, the run detail, and the stamp all read it, GET /status and detail.status are derived reads, no clerk call, no db copy; the agenda cap is a derivation rule (GM, 2026-11-16: we log all seven items on reception, but the only way to see all seven is the raw event -- at no point an over-cap list can be derived), the reception note still shows the GM what sank; the stamp renders the canonical grammar -- status comma-separated, agenda markdown bullets, matching the line the GM added to invariants; the GM's block edits are overrides (GM, 2026-11-16: mutate during the contwin composition, the logs record the overrides arriving with the GM's turn as they should, the model sees the blocks overwritten with GM's edits attached to her turn, append if empty): the pane editors STAGE (paneEditor reworked -- no save callback, staged state, pending marker, discard), the send attaches them to POST /turn, node logs the override field on the GM turn, the composition renders it as hers -- the log never mutates, her words stay verbatim, the raw surfaces show the record; OOC turns refuse edits client and server both, the out-of-band POST /status and /agenda routes retired; stop writes the boundary state note at the carry head always (the crash-reconcile filters it before comparing), the start gate's n=1 seeding is dead (her authored opening turn IS the seed, the lint keeps requiring it), continuation carryovers are writable in the file editor during dormancy -- the review window's one editing surface, blocks included, no new pane; the clerk lost the tiers wholesale (schema tables, four verbs, canon status/agenda views, dump sections, report fields; the events CHECK keeps the historical op names; old dbs keep dead tables, never read, never dropped -- Irene is hands-off, and by the same day's ruling she is broken and never runs again: logs and db kept as they are, no replay, no continuation, no compatibility designed for her); Chloe hand-migrated to the new protocol -- her most recent turn carries the whole-list blocks applied from her db's exact values, her next context stamps them, her older lost/gained tags stay as history; the mock's agenda blocks went bullet, a new script position for the override turn's reply restates the mind so the boundary assert holds; smoke reworked to the scan battery (+ the 10f override block: the record rides its turn, the composition stamps at her canon point, the log keeps her emission verbatim, the OOC refusal, the boundary note at the carry head, the retired routes 404) -- ALL PASS; restart + reminder + repo checks green; the browser pass caught and fixed two real bugs (the pending marker's display:flex beat the hidden attribute -- any display rule needs a [hidden] override; setEditable(true) never ran the widget sync so the edit button stayed hidden) and proved the whole UX end to end with zero console errors -- staging, send-with-turn, the machinery lines on the table and raw, the OOC gate banner, discard, dormant read-only panes, the boundary note in the dormant preview; typecheck green on both programs; README/DICTIONARY carry the single-truth design, HANDOFF the round record and the Irene rewording, AGENTS the state pointer and the browser lessons
This commit is contained in:
+42
-28
@@ -6,25 +6,26 @@
|
||||
// answer call resumes the loop. GM prose goes pure (the full-block
|
||||
// protocol, GM 2026-11-16): no cache blocks ride any turn -- her
|
||||
// <status>/<agenda>/<mind> blocks ride at her own tail, the view
|
||||
// stamps the newest of each kind at her most recent turn, and the
|
||||
// clerk holds the one truth for the panes. The player's present
|
||||
// blocks are whole-list SETs (absent means unchanged, never blank);
|
||||
// conflicts (a refused <mind>, an emitted <model>) ride the
|
||||
// self-heal channel. GM input expands at ingestion (strict,
|
||||
// DECISIONS #9): @PC/@Package and $vars resolve before the line is
|
||||
// logged; an expansion error refuses the turn and the line is handed
|
||||
// back for editing. Every provider request records its resolved
|
||||
// model and effective params on the resulting msg event (via); a
|
||||
// failed call lands a req event with the failure -- the turn still
|
||||
// fails loud.
|
||||
// stamps the scan's newest values at her most recent turn, and the
|
||||
// log is the one truth (the state scan -- the db holds no copy). A
|
||||
// GM block edit rides its GM turn as the override record; the
|
||||
// composition overwrites her newest blocks with it, the log keeps
|
||||
// her words verbatim. The player's present blocks are whole-list
|
||||
// SETs (absent means unchanged, never blank); conflicts (a refused
|
||||
// <mind>, an emitted <model>) ride the self-heal channel. GM input
|
||||
// expands at ingestion (strict, DECISIONS #9): @PC/@Package and
|
||||
// $vars resolve before the line is logged; an expansion error
|
||||
// refuses the turn and the line is handed back for editing. Every
|
||||
// provider request records its resolved model and effective params
|
||||
// on the resulting msg event (via); a failed call lands a req event
|
||||
// with the failure -- the turn still fails loud.
|
||||
/** @typedef {import('./shapes.mjs').Ctx} Ctx */
|
||||
/** @typedef {import('./shapes.mjs').LiveSession} LiveSession */
|
||||
/** @typedef {import('./shapes.mjs').Actor} Actor */
|
||||
/** @typedef {import('./shapes.mjs').ViewMessage} ViewMessage */
|
||||
|
||||
import { clerkJson } from './clerk.mjs';
|
||||
import { toolList, runTool, assembleReminder, expandVars } from './bundle.mjs';
|
||||
import { renderView, blockList } from './session.mjs';
|
||||
import { renderView, cleanBlockList, AGENDA_CAP } from './session.mjs';
|
||||
import { parseVariants, pickVariant } from './variants.mjs';
|
||||
import { registry, usable } from './discovery.mjs';
|
||||
|
||||
@@ -51,9 +52,10 @@ function needSession(ctx, runId) {
|
||||
|
||||
/**
|
||||
* @param {Ctx} ctx @param {string} runId @param {string} line @param {?Actor} user
|
||||
* @param {?{ status?: string[], agenda?: string[] }} [override]
|
||||
* @returns {Promise<TurnOut>}
|
||||
*/
|
||||
export async function gmTurn(ctx, runId, line, user) {
|
||||
export async function gmTurn(ctx, runId, line, user, override = null) {
|
||||
const s = needSession(ctx, runId);
|
||||
if (s.pendingAsk) throw new HttpError(409, 'a question is pending -- answer it first (POST /ask)');
|
||||
// GM-input expansion (strict, DECISIONS #9): the line resolves at
|
||||
@@ -66,10 +68,11 @@ export async function gmTurn(ctx, runId, line, user) {
|
||||
} catch (e) {
|
||||
throw new HttpError(400, `the line was not sent -- ${e.message}`);
|
||||
}
|
||||
// GM prose goes pure: no cache blocks ride any turn. Her blocks
|
||||
// stamp at her own tail in the view (renderView); the clerk holds
|
||||
// the one truth for the panes
|
||||
s.append({ t: 'msg', m: { role: 'user', content: prose } });
|
||||
// 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
|
||||
// it newest-wins), the log keeps her words verbatim
|
||||
s.append({ t: 'msg', m: { role: 'user', content: prose }, ...(override ? { override } : {}) });
|
||||
// the reminder follows the GM's prose as its own system chunk --
|
||||
// every turn, one live copy (older ones elide in the view)
|
||||
const reminder = assembleReminder(runId);
|
||||
@@ -203,16 +206,20 @@ async function runLoop(ctx, runId, user) {
|
||||
// for variant literature). The full-block protocol (GM,
|
||||
// 2026-11-16): a present block is a whole-list SET -- absent
|
||||
// means unchanged, never blank; a present-but-empty block is a
|
||||
// deliberate clear. Same-verb blocks combine into one set.
|
||||
// deliberate clear. Same-verb blocks combine into one set. No
|
||||
// apply happens -- the log is the truth; the notes are the GM's
|
||||
// receipt and the housekeeper's reading, the derivation is the
|
||||
// scan's (its clean, its cap)
|
||||
const carry = [];
|
||||
if (/<status>/.test(text)) {
|
||||
const set = clerkJson(runId, 'status-set', ...blockList(text, 'status'));
|
||||
s.append({ t: 'note', kind: 'status', set });
|
||||
s.append({ t: 'note', kind: 'status', set: cleanBlockList(text, 'status') });
|
||||
}
|
||||
if (/<agenda>/.test(text)) {
|
||||
const r = clerkJson(runId, 'agenda-set', ...blockList(text, 'agenda'));
|
||||
// the eviction is silent to her, visible to the GM (the note)
|
||||
s.append({ t: 'note', kind: 'agenda', set: r.set, evicted: r.evicted });
|
||||
const items = cleanBlockList(text, 'agenda');
|
||||
// the cap is a derivation rule: the log keeps all her items,
|
||||
// every derived surface shows the top five. The eviction is
|
||||
// silent to her, visible to the GM (the note)
|
||||
s.append({ t: 'note', kind: 'agenda', set: items.slice(0, AGENDA_CAP), evicted: items.slice(AGENDA_CAP) });
|
||||
}
|
||||
// the mind verb: parse now so a refused statement heals in-turn
|
||||
// like any conflict; the stash itself lands only at the completing
|
||||
@@ -383,7 +390,8 @@ export { parseMind };
|
||||
// whole-list status and agenda sets, then a restated agenda, an
|
||||
// over-cap agenda with a valid mind, the <model> guard and its
|
||||
// plain-prose heal, an out-of-bounds mind and its restating heal,
|
||||
// and everything after is plain prose.
|
||||
// the GM-override turn's reply (no blocks, the mind restated), and
|
||||
// everything after is plain prose.
|
||||
/** @typedef {import('./shapes.mjs').WireMessage} WireMessage */
|
||||
|
||||
/**
|
||||
@@ -416,16 +424,16 @@ function mockModel(s, view) {
|
||||
}
|
||||
if (count === 2 && toolResults >= 1) {
|
||||
// the full-block protocol: whole-list sets
|
||||
return { role: 'assistant', content: 'Mock: good to know. *She exhales and lets her shoulders drop.*\n<status>cuffed, belted, naked, barefoot, settled, curious about the clicking</status>\n<agenda>find fresh water\nsignal any passing ship\nbuild a shelter</agenda>' };
|
||||
return { role: 'assistant', content: 'Mock: good to know. *She exhales and lets her shoulders drop.*\n<status>cuffed, belted, naked, barefoot, settled, curious about the clicking</status>\n<agenda>\n- find fresh water\n- signal any passing ship\n- build a shelter\n</agenda>' };
|
||||
}
|
||||
if (count === 3) {
|
||||
// a restated agenda replaces the list (the first item is done)
|
||||
return { role: 'assistant', content: 'Mock: *She settles on the first task and starts walking.*\n<agenda>signal any passing ship\nbuild a shelter</agenda>' };
|
||||
return { role: 'assistant', content: 'Mock: *She settles on the first task and starts walking.*\n<agenda>\n- signal any passing ship\n- build a shelter\n</agenda>' };
|
||||
}
|
||||
if (count === 4) {
|
||||
// an over-cap agenda evicts from the bottom, silently; a valid
|
||||
// mind rides the same turn
|
||||
return { role: 'assistant', content: 'Mock: *Her thoughts race ahead of her feet.*\n<agenda>item one\nitem two\nitem three\nitem four\nitem five\nitem six\nitem seven</agenda>\n<mind>{"temperature": 1.2}</mind>' };
|
||||
return { role: 'assistant', content: 'Mock: *Her thoughts race ahead of her feet.*\n<agenda>\n- item one\n- item two\n- item three\n- item four\n- item five\n- item six\n- item seven\n</agenda>\n<mind>{"temperature": 1.2}</mind>' };
|
||||
}
|
||||
if (count === 5) {
|
||||
// the <model> block is display-only: the guard conflicts
|
||||
@@ -444,5 +452,11 @@ function mockModel(s, view) {
|
||||
// last word of the session, so it rides the boundary unconsumed)
|
||||
return { role: 'assistant', content: 'Mock: *She breathes until the numbers behave.*\n<mind>{"temperature": 1.2}</mind>' };
|
||||
}
|
||||
if (count === 9) {
|
||||
// the GM-override turn's reply: no blocks (the override stands as
|
||||
// the newest word), the mind restated so it rides the boundary
|
||||
// unconsumed
|
||||
return { role: 'assistant', content: 'Mock: *She nods to herself and settles in.*\n<mind>{"temperature": 1.2}</mind>' };
|
||||
}
|
||||
return { role: 'assistant', content: 'Mock: *She watches the water and waits for the world to move.*' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user