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/widgets.mjs -- the small factories the views share.
|
2026-11-14 23:48:27 +00:00
|
|
|
//
|
|
|
|
|
// Three patterns that were hand-copied per use, now one each:
|
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
|
|
|
// - armedButton: the two-click confirm (no JS confirm() -- it blocks
|
2026-11-14 23:48:27 +00:00
|
|
|
// the embedded pane; every destructive act is armed instead)
|
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
|
|
|
// - paneEditor: the status/agenda pattern -- a body line, an edit
|
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
2026-11-16 22:49:50 +00:00
|
|
|
// button, an inline editor; the edit stages, the send rides it
|
|
|
|
|
// with the turn; the section shell stays in index.html
|
2026-11-19 08:35:23 +00:00
|
|
|
// - modelsBox: the per-run spec picks -- {provider, model, effort}
|
|
|
|
|
// per role, no unset effort, no stored params (the <mind> verb is
|
|
|
|
|
// the only sampling source); setup and the play aside each carry
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
// one
|
2026-11-14 23:48:27 +00:00
|
|
|
|
|
|
|
|
import { $, el } from './dom.mjs';
|
|
|
|
|
import { api } from './client.mjs';
|
|
|
|
|
import { state } from './state.mjs';
|
|
|
|
|
import { banner } from './chrome.mjs';
|
2026-11-19 08:35:23 +00:00
|
|
|
import { EFFORT_LEVELS } from './knobs.mjs';
|
2026-11-14 23:48:27 +00:00
|
|
|
|
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
|
|
|
// two-click confirm -- the second click within 5s fires; anything
|
2026-11-14 23:48:27 +00:00
|
|
|
// else disarms. Each button owns its own arm state.
|
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} btn @param {{ label: string, confirm: string, fire: () => Promise<void> }} opts */
|
2026-11-14 23:48:27 +00:00
|
|
|
export function armedButton(btn, { label, confirm, fire }) {
|
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 {?ReturnType<typeof setTimeout>} */ let timer = null;
|
2026-11-14 23:48:27 +00:00
|
|
|
btn.addEventListener('click', async () => {
|
|
|
|
|
if (timer === null) {
|
|
|
|
|
btn.textContent = confirm;
|
|
|
|
|
timer = setTimeout(() => { timer = null; btn.textContent = label; }, 5000);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
clearTimeout(timer);
|
|
|
|
|
timer = null;
|
|
|
|
|
btn.textContent = label;
|
|
|
|
|
await fire();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
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
2026-11-16 22:49:50 +00:00
|
|
|
// a pane: body line + edit button + inline editor. The edit does
|
|
|
|
|
// not save anywhere -- it STAGES a block edit that rides the next
|
|
|
|
|
// GM turn (the server logs the override on the turn; the composition
|
|
|
|
|
// overwrites her newest blocks with it). setEditable(false) is the
|
|
|
|
|
// not-live state: no edit button, an open editor cancels, a staged
|
|
|
|
|
// edit drops -- dormancy edits the carryover, not the panes.
|
|
|
|
|
/** @typedef {{ section: string|HTMLElement, body: string|HTMLElement, empty: string, placeholder: string, rows: number, format: (items: string[]) => string, toText: (items: string[]) => string, fromText: (text: string) => string[] }} PaneOpts */
|
|
|
|
|
/** @typedef {{ set: (next?: ?string[]) => void, setEditable: (ok: boolean) => void, reset: () => void, items: string[], staged: ?string[], clearStaged: () => void }} Pane */
|
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 {PaneOpts} opts @returns {Pane} */
|
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
2026-11-16 22:49:50 +00:00
|
|
|
export function paneEditor({ section, body, empty, placeholder, rows, format, toText, fromText }) {
|
2026-11-14 23:48:27 +00:00
|
|
|
const sec = typeof section === 'string' ? $(section) : section;
|
|
|
|
|
const bodyEl = typeof body === 'string' ? $(body) : body;
|
|
|
|
|
const editBtn = el('button', null, 'edit');
|
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 {HTMLElement} */ (sec.querySelector('.pane-head'))).appendChild(editBtn);
|
2026-11-14 23:48:27 +00:00
|
|
|
const editor = el('div', 'pane-editor');
|
|
|
|
|
editor.hidden = true;
|
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 area = /** @type {HTMLTextAreaElement} */ (el('textarea'));
|
2026-11-14 23:48:27 +00:00
|
|
|
area.rows = rows;
|
|
|
|
|
area.placeholder = placeholder;
|
|
|
|
|
const actions = el('div', 'pane-editor-actions');
|
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
2026-11-16 22:49:50 +00:00
|
|
|
const saveBtn = el('button', null, 'stage');
|
2026-11-14 23:48:27 +00:00
|
|
|
const cancelBtn = el('button', null, 'cancel');
|
|
|
|
|
actions.appendChild(saveBtn);
|
|
|
|
|
actions.appendChild(cancelBtn);
|
|
|
|
|
editor.appendChild(area);
|
|
|
|
|
editor.appendChild(actions);
|
|
|
|
|
bodyEl.after(editor); // before anything that follows the body (#conflict on the status pane)
|
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
2026-11-16 22:49:50 +00:00
|
|
|
const pending = el('div', 'pane-pending');
|
|
|
|
|
pending.hidden = true;
|
|
|
|
|
pending.appendChild(el('span', null, 'edited -- rides your next turn'));
|
|
|
|
|
const dropBtn = el('button', null, 'discard edit');
|
|
|
|
|
pending.appendChild(dropBtn);
|
|
|
|
|
editor.after(pending);
|
2026-11-14 23:48:27 +00:00
|
|
|
|
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 {string[]} */ let items = [];
|
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
2026-11-16 22:49:50 +00:00
|
|
|
/** @type {?string[]} */ let staged = null;
|
2026-11-14 23:48:27 +00:00
|
|
|
let mayEdit = false;
|
|
|
|
|
let open = false;
|
|
|
|
|
|
|
|
|
|
const sync = () => {
|
|
|
|
|
bodyEl.hidden = open;
|
|
|
|
|
editBtn.hidden = open || !mayEdit;
|
|
|
|
|
editor.hidden = !open;
|
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
2026-11-16 22:49:50 +00:00
|
|
|
pending.hidden = staged === null;
|
2026-11-14 23:48:27 +00:00
|
|
|
};
|
|
|
|
|
const renderBody = () => {
|
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
2026-11-16 22:49:50 +00:00
|
|
|
const show = staged ?? items;
|
|
|
|
|
bodyEl.textContent = show.length ? format(show) : empty;
|
|
|
|
|
bodyEl.classList.toggle('empty', !show.length);
|
2026-11-14 23:48:27 +00:00
|
|
|
};
|
|
|
|
|
const openEditor = () => {
|
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
2026-11-16 22:49:50 +00:00
|
|
|
area.value = toText(staged ?? items);
|
2026-11-14 23:48:27 +00:00
|
|
|
open = true;
|
|
|
|
|
sync();
|
|
|
|
|
area.focus();
|
|
|
|
|
};
|
|
|
|
|
const cancel = () => { open = false; sync(); };
|
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
2026-11-16 22:49:50 +00:00
|
|
|
const doSave = () => { staged = fromText(area.value); cancel(); renderBody(); };
|
|
|
|
|
const dropStaged = () => { staged = null; sync(); renderBody(); };
|
2026-11-14 23:48:27 +00:00
|
|
|
|
|
|
|
|
editBtn.addEventListener('click', openEditor);
|
|
|
|
|
cancelBtn.addEventListener('click', cancel);
|
|
|
|
|
saveBtn.addEventListener('click', doSave);
|
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
2026-11-16 22:49:50 +00:00
|
|
|
dropBtn.addEventListener('click', dropStaged);
|
2026-11-14 23:48:27 +00:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
set(next) { items = next ?? []; renderBody(); },
|
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
2026-11-16 22:49:50 +00:00
|
|
|
setEditable(ok) { mayEdit = ok; cancel(); if (!ok) dropStaged(); },
|
|
|
|
|
reset() { cancel(); dropStaged(); },
|
2026-11-14 23:48:27 +00:00
|
|
|
get items() { return items; },
|
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
2026-11-16 22:49:50 +00:00
|
|
|
get staged() { return staged; },
|
the sheet round: the GM's ledger of arbitrated run state -- the second state channel, split from status and agenda by truth model (GM, 2026-11-17). The rulings first: status and agenda are narrative self-report (their truth is "she said so", the scan caches her latest words); the sheet is actual run state (its truth is "the GM set so", the record IS the truth event -- nothing cached from anyone's words). The override channel promoted to a standing section, and that precedent decided the presentation: the sheet renders as its OWN authoritative system chunk at the freshest end, never a canon-point stamp, which would read as her words -- the same reason the override composes as hers and the sheet never does. Schemaless JSON in the tag (the mind-verb philosophy: the substrate teaches the channel, the package teaches the vocabulary -- the invariants rule the GM wrote is one universal paragraph with deliberately non-box examples, clothes and grades, and the propose-additions line as her schema-evolution channel); details learnt in-place; NO package gating -- the channel is universal and "optional, if given" makes the invariant forward-compatible in every bundle that never sets one. The build: a sheet record rides the GM turn like the override (readSheet: object-ness is the route's only law, 400 loud on arrays and scalars, nothing appended; OOC turns refuse it exactly like block edits); scanState derives newest-wins whole-set -- an absent key drops, never keeps, and {} is a live empty ledger (a truthy check, never falsy); the boundary state note carries it across stops and the dormant read path serves it; renderView appends the chunk once per assembly so one live copy holds by construction; the guard is the <model> sibling (an emitted <sheet> conflicts with "the GM's ledger -- propose changes in prose", healed in-turn, cap 3, and her emission never applies -- the scan holds the GM's record); every strip surface learned the tag (the view's STRIP_HERS, the story's verbs, the table's chip regex -- the standing grep-every-strip-list lesson, applied); and the web gains sheetEditor, the paneEditor's JSON sibling in widgets.mjs (same stage/pending/discard pattern, bad JSON refuses at the stage), the third pane in the aside, the send attaching body.sheet, and [sheet] machinery lines on both table and raw walks. The mock's sheet-guard branch is CUE-KEYED, not position-keyed: the carried tail shifts the script's counts (session 4's log starts the script over -- the battery's first attempt landed on the ask position and crashed renderView on the unpaired call; the battery now answers the script ask and moves on), while a marked GM turn is immune to every shift -- mockModel reads the view, the marked turn earns the emission, the conflict it earns earns the plain-prose heal. check-reminder is sheet-aware (the chunk is a legitimate third system surface; the count and freshest-end assertions tolerate exactly one, and the freshest-end check now allows her latest reply and/or the chunk to follow the reminder). Verified: smoke ALL PASS with +15 sheet assertions (newest-wins, whole-set semantics, the chunk one-live-copy -- ANCHORED with startsWith because the invariants bundle itself mentions the tag and a bare regex matches it twice, an honest test bug caught by an honest test), the guard's conflict and heal with her emission kept verbatim in the raw log and never applied, the view and story strips, the empty ledger rendering its chunk, the boundary note carrying the sheet, the dormant read deriving it, and session 5 deriving it from the carried note end to end), restart + reminder checks green, typecheck green on both programs, check-repo clean (it caught the round's own prose twice: "window" is a retired term in README, the contwin vocabulary wins), and a browser pass over the pane end to end with zero console errors -- staging, the pending marker, the ride, the scan re-render, and both machinery lines on the table. Docs: README's protocol passage carries the sheet with the numbers-live-on-the-sheet line (prose numbers die with the contwin; sheet numbers ride the scan forever) -- NOT in the memory tiers table, where the first draft wrongly put it (the GM's ruling: the sheet belongs in neither memories nor records); the identity tier lost its loose "character sheet" name now that the term is technical; DICTIONARY gains the sheet entry with the history line (dice retired into variant literature, sheets arrived as the state machinery -- the tabletop metaphor completing while its realism stays advisory, players hold their own pencils in the real thing and we don't, for drift); ROADMAP parks the bookkeeper extension (the housekeeper's arithmetic sibling: reads the setting's rules prose and the latest turns, computes the ledger delta from a purchase in her prose, lands it as a STAGED edit -- applied on the GM's next turn or discarded; sheet-only authority, curator fallback, per-package opt-in because an agent cannot bookkeep what is not arithmetic). The GM's prompt-side edits ride the same commit: invariants' "Character's sheet" section (the universal rule, the trailing-clause flag taken in review), the reminder's inventory line gaining "the sheet (optional)", and la caramba's gm.md lore updates. The box package (the first consumer) and detention stay untracked WIP, untouched. The 2026-11-17 roadmap audit rides the same commit (GM: "done items can retire"): retired outright -- the SPA-vs-bridge and voice-examples decisions (long resolved) and steal items #1, #3, #4, #8, #11 (done, or in #8's case never work -- the housekeeper model is per-run selection, built); retired with tombstones -- the multiuser section (built 2026-11-14, the rulings live in DECISIONS #22-31 and README, the lifecycle tail kept visible) and the SPA v1 section (all four phases done, the API sketch superseded by README's living API docs, the substrate doctrine in README), with the one unbuilt design it held -- the turn-surgery saga rule -- surviving as its own bullet cross-referenced at steal #2; amended in place, dated -- seed.json (dead, successors named: the authored carryover and memory.json), turn-0.md (dead: her authored opening turn), the upstream model listing (never queried in play since discovery), the delta-tag transport (the full-block protocol, the sheet named), the service step (multiuser built, hosting remains), the carryover editor (the raw file-editor surface exists, the purpose-built UI stays deferred); kept -- the operator's queue, the landscape and receipts, the live constraints, the open steals with numbering preserved so cross-references resolve, the deferred tasks, the distant points, the rejections, the notes. 582 lines to 338; the first deletion pass duplicated the steal-list header and the verification re-read caught it
2026-11-17 22:35:44 +00:00
|
|
|
clearStaged: dropStaged,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the sheet pane: the same stage-and-ride pattern as the block panes,
|
2026-11-19 09:56:56 +00:00
|
|
|
// JSON-typed -- the GM's ledger of arbitrated run state (developer,
|
the sheet round: the GM's ledger of arbitrated run state -- the second state channel, split from status and agenda by truth model (GM, 2026-11-17). The rulings first: status and agenda are narrative self-report (their truth is "she said so", the scan caches her latest words); the sheet is actual run state (its truth is "the GM set so", the record IS the truth event -- nothing cached from anyone's words). The override channel promoted to a standing section, and that precedent decided the presentation: the sheet renders as its OWN authoritative system chunk at the freshest end, never a canon-point stamp, which would read as her words -- the same reason the override composes as hers and the sheet never does. Schemaless JSON in the tag (the mind-verb philosophy: the substrate teaches the channel, the package teaches the vocabulary -- the invariants rule the GM wrote is one universal paragraph with deliberately non-box examples, clothes and grades, and the propose-additions line as her schema-evolution channel); details learnt in-place; NO package gating -- the channel is universal and "optional, if given" makes the invariant forward-compatible in every bundle that never sets one. The build: a sheet record rides the GM turn like the override (readSheet: object-ness is the route's only law, 400 loud on arrays and scalars, nothing appended; OOC turns refuse it exactly like block edits); scanState derives newest-wins whole-set -- an absent key drops, never keeps, and {} is a live empty ledger (a truthy check, never falsy); the boundary state note carries it across stops and the dormant read path serves it; renderView appends the chunk once per assembly so one live copy holds by construction; the guard is the <model> sibling (an emitted <sheet> conflicts with "the GM's ledger -- propose changes in prose", healed in-turn, cap 3, and her emission never applies -- the scan holds the GM's record); every strip surface learned the tag (the view's STRIP_HERS, the story's verbs, the table's chip regex -- the standing grep-every-strip-list lesson, applied); and the web gains sheetEditor, the paneEditor's JSON sibling in widgets.mjs (same stage/pending/discard pattern, bad JSON refuses at the stage), the third pane in the aside, the send attaching body.sheet, and [sheet] machinery lines on both table and raw walks. The mock's sheet-guard branch is CUE-KEYED, not position-keyed: the carried tail shifts the script's counts (session 4's log starts the script over -- the battery's first attempt landed on the ask position and crashed renderView on the unpaired call; the battery now answers the script ask and moves on), while a marked GM turn is immune to every shift -- mockModel reads the view, the marked turn earns the emission, the conflict it earns earns the plain-prose heal. check-reminder is sheet-aware (the chunk is a legitimate third system surface; the count and freshest-end assertions tolerate exactly one, and the freshest-end check now allows her latest reply and/or the chunk to follow the reminder). Verified: smoke ALL PASS with +15 sheet assertions (newest-wins, whole-set semantics, the chunk one-live-copy -- ANCHORED with startsWith because the invariants bundle itself mentions the tag and a bare regex matches it twice, an honest test bug caught by an honest test), the guard's conflict and heal with her emission kept verbatim in the raw log and never applied, the view and story strips, the empty ledger rendering its chunk, the boundary note carrying the sheet, the dormant read deriving it, and session 5 deriving it from the carried note end to end), restart + reminder checks green, typecheck green on both programs, check-repo clean (it caught the round's own prose twice: "window" is a retired term in README, the contwin vocabulary wins), and a browser pass over the pane end to end with zero console errors -- staging, the pending marker, the ride, the scan re-render, and both machinery lines on the table. Docs: README's protocol passage carries the sheet with the numbers-live-on-the-sheet line (prose numbers die with the contwin; sheet numbers ride the scan forever) -- NOT in the memory tiers table, where the first draft wrongly put it (the GM's ruling: the sheet belongs in neither memories nor records); the identity tier lost its loose "character sheet" name now that the term is technical; DICTIONARY gains the sheet entry with the history line (dice retired into variant literature, sheets arrived as the state machinery -- the tabletop metaphor completing while its realism stays advisory, players hold their own pencils in the real thing and we don't, for drift); ROADMAP parks the bookkeeper extension (the housekeeper's arithmetic sibling: reads the setting's rules prose and the latest turns, computes the ledger delta from a purchase in her prose, lands it as a STAGED edit -- applied on the GM's next turn or discarded; sheet-only authority, curator fallback, per-package opt-in because an agent cannot bookkeep what is not arithmetic). The GM's prompt-side edits ride the same commit: invariants' "Character's sheet" section (the universal rule, the trailing-clause flag taken in review), the reminder's inventory line gaining "the sheet (optional)", and la caramba's gm.md lore updates. The box package (the first consumer) and detention stay untracked WIP, untouched. The 2026-11-17 roadmap audit rides the same commit (GM: "done items can retire"): retired outright -- the SPA-vs-bridge and voice-examples decisions (long resolved) and steal items #1, #3, #4, #8, #11 (done, or in #8's case never work -- the housekeeper model is per-run selection, built); retired with tombstones -- the multiuser section (built 2026-11-14, the rulings live in DECISIONS #22-31 and README, the lifecycle tail kept visible) and the SPA v1 section (all four phases done, the API sketch superseded by README's living API docs, the substrate doctrine in README), with the one unbuilt design it held -- the turn-surgery saga rule -- surviving as its own bullet cross-referenced at steal #2; amended in place, dated -- seed.json (dead, successors named: the authored carryover and memory.json), turn-0.md (dead: her authored opening turn), the upstream model listing (never queried in play since discovery), the delta-tag transport (the full-block protocol, the sheet named), the service step (multiuser built, hosting remains), the carryover editor (the raw file-editor surface exists, the purpose-built UI stays deferred); kept -- the operator's queue, the landscape and receipts, the live constraints, the open steals with numbering preserved so cross-references resolve, the deferred tasks, the distant points, the rejections, the notes. 582 lines to 338; the first deletion pass duplicated the steal-list header and the verification re-read caught it
2026-11-17 22:35:44 +00:00
|
|
|
// 2026-11-17: the model reads it, never writes it; her proposals
|
|
|
|
|
// arrive in prose). A record is a whole set: staging replaces the
|
|
|
|
|
// entire object, an empty object is a deliberate empty ledger. Bad
|
|
|
|
|
// JSON refuses at the stage -- the server would refuse it at the turn.
|
|
|
|
|
/** @typedef {{ set: (next?: ?Record<string, unknown>) => void, setEditable: (ok: boolean) => void, reset: () => void, staged: ?Record<string, unknown>, clearStaged: () => void }} SheetPane */
|
|
|
|
|
/** @param {string} section @param {string} body @returns {SheetPane} */
|
|
|
|
|
export function sheetEditor(section, body) {
|
|
|
|
|
const sec = $(section);
|
|
|
|
|
const bodyEl = $(body);
|
|
|
|
|
const editBtn = el('button', null, 'edit');
|
|
|
|
|
(/** @type {HTMLElement} */ (sec.querySelector('.pane-head'))).appendChild(editBtn);
|
|
|
|
|
const editor = el('div', 'pane-editor');
|
|
|
|
|
editor.hidden = true;
|
|
|
|
|
const area = /** @type {HTMLTextAreaElement} */ (el('textarea'));
|
|
|
|
|
area.rows = 6;
|
|
|
|
|
area.placeholder = 'the sheet is JSON -- the GM\'s ledger of the run\'s objective state';
|
|
|
|
|
const actions = el('div', 'pane-editor-actions');
|
|
|
|
|
const saveBtn = el('button', null, 'stage');
|
|
|
|
|
const cancelBtn = el('button', null, 'cancel');
|
|
|
|
|
actions.appendChild(saveBtn);
|
|
|
|
|
actions.appendChild(cancelBtn);
|
|
|
|
|
editor.appendChild(area);
|
|
|
|
|
editor.appendChild(actions);
|
|
|
|
|
bodyEl.after(editor);
|
|
|
|
|
const pending = el('div', 'pane-pending');
|
|
|
|
|
pending.hidden = true;
|
|
|
|
|
pending.appendChild(el('span', null, 'edited -- rides your next turn'));
|
|
|
|
|
const dropBtn = el('button', null, 'discard edit');
|
|
|
|
|
pending.appendChild(dropBtn);
|
|
|
|
|
editor.after(pending);
|
|
|
|
|
|
|
|
|
|
/** @type {?Record<string, unknown>} */ let sheet = null; // the current truth (never a falsy check -- {} is a live empty ledger)
|
|
|
|
|
/** @type {?Record<string, unknown>} */ let staged = null;
|
|
|
|
|
let mayEdit = false;
|
|
|
|
|
let open = false;
|
|
|
|
|
|
|
|
|
|
const sync = () => {
|
|
|
|
|
bodyEl.hidden = open;
|
|
|
|
|
editBtn.hidden = open || !mayEdit;
|
|
|
|
|
editor.hidden = !open;
|
|
|
|
|
pending.hidden = staged === null;
|
|
|
|
|
};
|
|
|
|
|
const renderBody = () => {
|
|
|
|
|
const show = staged ?? sheet;
|
|
|
|
|
bodyEl.textContent = show == null ? 'nothing tracked' : JSON.stringify(show, null, 2);
|
|
|
|
|
bodyEl.classList.toggle('empty', show == null);
|
|
|
|
|
};
|
|
|
|
|
const openEditor = () => {
|
|
|
|
|
area.value = JSON.stringify(staged ?? sheet ?? {}, null, 2);
|
|
|
|
|
open = true;
|
|
|
|
|
sync();
|
|
|
|
|
area.focus();
|
|
|
|
|
};
|
|
|
|
|
const cancel = () => { open = false; sync(); };
|
|
|
|
|
const doSave = () => {
|
|
|
|
|
try {
|
|
|
|
|
const parsed = JSON.parse(area.value);
|
|
|
|
|
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
|
|
|
banner('the sheet wants a JSON object');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
staged = /** @type {Record<string, unknown>} */ (parsed);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
banner(`the sheet is JSON -- ${String(e.message ?? e).split('\n')[0]}`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
cancel();
|
|
|
|
|
renderBody();
|
|
|
|
|
};
|
|
|
|
|
const dropStaged = () => { staged = null; sync(); renderBody(); };
|
|
|
|
|
|
|
|
|
|
editBtn.addEventListener('click', openEditor);
|
|
|
|
|
cancelBtn.addEventListener('click', cancel);
|
|
|
|
|
saveBtn.addEventListener('click', doSave);
|
|
|
|
|
dropBtn.addEventListener('click', dropStaged);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
set(next) { sheet = next ?? null; renderBody(); },
|
|
|
|
|
setEditable(ok) { mayEdit = ok; cancel(); if (!ok) dropStaged(); },
|
|
|
|
|
reset() { cancel(); dropStaged(); },
|
|
|
|
|
get staged() { return staged; },
|
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
2026-11-16 22:49:50 +00:00
|
|
|
clearStaged: dropStaged,
|
2026-11-14 23:48:27 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
// the model registry, fetched once per session -- the selectors read
|
|
|
|
|
// the saved registry, never the live provider (discovery is the op's
|
2026-11-19 08:35:23 +00:00
|
|
|
// act; a listing fetch every render would hammer the endpoint for a
|
|
|
|
|
// list that rarely changes)
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
/** @type {?import('./shapes.mjs').ModelsRegistryResponse} */ let cachedRegistry = null;
|
|
|
|
|
/** @returns {Promise<import('./shapes.mjs').ModelsRegistryResponse>} */
|
2026-11-14 23:48:27 +00:00
|
|
|
export async function modelList() {
|
2026-11-19 08:35:23 +00:00
|
|
|
if (!cachedRegistry) cachedRegistry = /** @type {import('./shapes.mjs').ModelsRegistryResponse} */ (await api('/models').catch(() => /** @type {import('./shapes.mjs').ModelsRegistryResponse} */ ({ providers: [] })));
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
return cachedRegistry;
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-19 08:35:23 +00:00
|
|
|
/** Invalidate the cached registry -- provider state changed (the op
|
|
|
|
|
* added, removed, discovered, or refined), the next modelList
|
|
|
|
|
* refetches. */
|
|
|
|
|
export function dropModelCache() {
|
|
|
|
|
cachedRegistry = null;
|
|
|
|
|
}
|
|
|
|
|
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
// a context ceiling as the short human form: 1048576 -> "1M",
|
|
|
|
|
// 524288 -> "512K". Null when the provider stated nothing.
|
|
|
|
|
/** @param {?number} tokens @returns {?string} */
|
|
|
|
|
export function fmtCeiling(tokens) {
|
|
|
|
|
if (tokens == null || !Number.isFinite(tokens) || tokens <= 0) return null;
|
|
|
|
|
return tokens >= 1048576 ? `${Math.round(tokens / 1048576)}M` : `${Math.round(tokens / 1024)}K`;
|
2026-11-14 23:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
2026-11-19 08:35:23 +00:00
|
|
|
// the model picks: per role a full spec {provider, model, effort} --
|
2026-11-19 09:56:56 +00:00
|
|
|
// there is no unset effort (developer, 2026-11-18), and the params layer is
|
2026-11-19 08:35:23 +00:00
|
|
|
// the <mind> verb's alone (per-turn, nothing stored). The health
|
|
|
|
|
// line under the rows is the invalidation surface: a pick the server
|
|
|
|
|
// no longer carries names what died and stays visible until the GM
|
|
|
|
|
// sets it up again. A housekeeper with no pick inherits (the player
|
|
|
|
|
// spec's provider default) -- the '' provider option says so.
|
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|HTMLElement} mount @param {{ title: string }} opts */
|
2026-11-14 23:48:27 +00:00
|
|
|
export function modelsBox(mount, { title }) {
|
|
|
|
|
const root = typeof mount === 'string' ? $(mount) : mount;
|
|
|
|
|
root.textContent = '';
|
|
|
|
|
root.appendChild(el('h2', null, title));
|
2026-11-19 08:35:23 +00:00
|
|
|
|
|
|
|
|
/** @typedef {{ prov: HTMLSelectElement, mod: HTMLSelectElement, eff: HTMLSelectElement }} Row */
|
|
|
|
|
/** @param {string} role @returns {Row} */
|
|
|
|
|
const mkRow = (role) => {
|
|
|
|
|
const prov = /** @type {HTMLSelectElement} */ (el('select'));
|
|
|
|
|
const mod = /** @type {HTMLSelectElement} */ (el('select'));
|
|
|
|
|
const eff = /** @type {HTMLSelectElement} */ (el('select'));
|
|
|
|
|
const field = el('label', 'field', `${role} `);
|
|
|
|
|
field.appendChild(prov);
|
|
|
|
|
field.appendChild(mod);
|
|
|
|
|
field.appendChild(eff);
|
|
|
|
|
root.appendChild(field);
|
|
|
|
|
return { prov, mod, eff };
|
the night rounds: the GM-input rework and the reasoning-effort knob -- the workbench renders no faces: the composer overlay and the transcript share colour-only tokens (.narration dim, .emph accent), source verbatim, asterisks tinted and kept on screen, so the input's caret can never drift (the old overlay's real bold/italic shifted advance widths -- keeping every character preserved count, not width; the scrollbar-gutter match killed the second drift source); the story view carries its OWN renderer (view-story storyBody/storySpans) -- the book keeps real bold/italic with the asterisks spent, narration italic via #story-scoped CSS, one rule for the tool and typography for the deliverable, deliberately separate; the composer is turn-shaped: rows=6 floor, field-sizing: content grows it with the turn (the thing the GM remembered Firefox doing -- it was never in use), max-height 50vh caps with internal scroll, the footer moved under the transcript's column only so the input's width is the pane's; the transcript's stick-to-bottom was DEAD CODE all along (#transcript has no height or overflow -- main is the scroller, the scrollTop assignments were no-ops in every browser): stickBottom scrolls main and re-asserts next frame (Firefox's scroll anchoring can reclaim a same-tick scroll around a content wipe), main carries overflow-anchor: none; the prose pane drops its machinery by ruling: the status/agenda chips and the retired delta tags strip (the panes carry the derived state), the reminder card never renders (it is the same every turn -- the raw tab keeps every copy), and the status/agenda note receipts (the old delta applies and the whole-list sets alike) skip the prose walk while the raw keeps them; the model dropdown collapsed to one plain list of ids sorted, ceilings riding along (the family grouping left the user guessing what a family name means, and the curator's tier labels only made sense inside their groups); and the reasoning-effort round: the battery probes the ladder (probeEfforts -- each of none/minimal/low/medium/high/xhigh/max measured for mean thinking, two samples, efforts recorded per model, effortDefault the argmax mean over minimal..max, 'none' never a candidate -- it is the off switch; null when the model shows no thinking), the knob is first-class and the GM's alone (GM, 2026-11-16: hidden from the model, not her call -- never in the mind verb, never in the <model> display block, and renderView's via-derived block filters it too, both surfaces; it rides the via record for the raw surfaces), its unset state SENDS the measured max-mean default (the one knob with an honestly nameable default -- the registry measured it; layers run override > deployment > registry per-model, explicit null clears to nothing), the first non-numeric knob (RoleParams carries the string, the /model route validates against the ladder, the knob row a select whose unset label names what rides and rebuilds on model-select change); the GLM ladder verified live by hand before the build (low suppresses to a third of baseline, max elevates about double, the whole ladder accepted on both families without 400s, and reasoning_effort 'none' doubles as a standardized thinking-off switch); the model dropdown, the composer, and the knob UX browser-proven with zero console errors (the pass caught the unreachable-helpers bug: code after a factory's return never runs, a hoisted function referencing the uninitialized const throws silently mid-fill and stale rows render); smoke ALL PASS with the effort battery (the canned mock ladders, the default riding a bare turn's via, the override riding the next turn, the bogus-level 400, the null clear, no reasoning_effort in any <model> block) + restart + reminder + repo checks green, typecheck green on both programs; ROADMAP gains the distant extension point (n-choice inference composed by a turn-editor agent) and the operator's queue moved there from QUESTIONS by the GM; HANDOFF prepared as the handoff (the typing-round bullet trimmed into the rounds list, the server line now truthful -- the debug server runs, the registry bullet carries the six-knob state and the pending-effort refine)
2026-11-16 23:52:58 +00:00
|
|
|
};
|
2026-11-19 08:35:23 +00:00
|
|
|
const player = mkRow('player');
|
|
|
|
|
const house = mkRow('housekeeper');
|
|
|
|
|
const healthLine = el('div', 'hint');
|
|
|
|
|
root.appendChild(healthLine);
|
|
|
|
|
const hint = el('div', 'hint');
|
|
|
|
|
root.appendChild(hint);
|
2026-11-14 23:48:27 +00:00
|
|
|
const saveBtn = el('button', null, 'save models');
|
|
|
|
|
const saveState = el('span', 'save-state');
|
|
|
|
|
const actions = el('div', 'form-actions');
|
|
|
|
|
actions.appendChild(saveBtn);
|
|
|
|
|
actions.appendChild(saveState);
|
|
|
|
|
root.appendChild(actions);
|
2026-11-19 08:35:23 +00:00
|
|
|
|
|
|
|
|
/** @type {?import('./shapes.mjs').ModelsRegistryResponse} */ let reg = null;
|
|
|
|
|
|
|
|
|
|
/** @param {HTMLSelectElement} sel @param {string} v @param {string} label */
|
|
|
|
|
const opt = (sel, v, label) => {
|
|
|
|
|
const o = /** @type {HTMLOptionElement} */ (el('option', null, label));
|
|
|
|
|
o.value = v;
|
|
|
|
|
sel.appendChild(o);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// one provider's usable player models; a stale pick stays selectable
|
|
|
|
|
// (a stale pick never silently rewrites itself)
|
|
|
|
|
/** @param {HTMLSelectElement} sel @param {string} slug @param {?string} current */
|
|
|
|
|
const fillModels = (sel, slug, current) => {
|
|
|
|
|
const section = reg?.providers.find((p) => p.slug === slug) ?? null;
|
|
|
|
|
sel.textContent = '';
|
|
|
|
|
opt(sel, '', '(no model picked)');
|
|
|
|
|
const usable = (section?.models ?? []).filter((m) => m.inference !== false && (m.roles?.player ?? true));
|
|
|
|
|
const sorted = [...usable].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
|
|
|
for (const m of sorted) {
|
|
|
|
|
const ceil = fmtCeiling(m.input);
|
|
|
|
|
opt(sel, m.id, ceil ? `${m.id} \u00b7 ${ceil}` : m.id);
|
|
|
|
|
}
|
|
|
|
|
if (current && !sorted.some((m) => m.id === current)) opt(sel, current, `${current} (not in this provider's registry)`);
|
|
|
|
|
sel.value = current ?? '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// the effort select: the ladder, the '' option naming the measured
|
|
|
|
|
// default when the registry carries one
|
|
|
|
|
/** @param {HTMLSelectElement} sel @param {string} slug @param {?string} modelId @param {?string} current */
|
|
|
|
|
const fillEffort = (sel, slug, modelId, current) => {
|
|
|
|
|
const m = reg?.providers.find((p) => p.slug === slug)?.models.find((x) => x.id === modelId) ?? null;
|
|
|
|
|
sel.textContent = '';
|
|
|
|
|
opt(sel, '', m?.effortDefault ? `(measured default: ${m.effortDefault})` : '(pick a level)');
|
|
|
|
|
for (const lv of EFFORT_LEVELS) opt(sel, lv, lv);
|
|
|
|
|
sel.value = EFFORT_LEVELS.includes(String(current)) ? String(current) : '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// a provider or model change re-derives the dependent options (the
|
|
|
|
|
// effort choice survives a model switch -- it is the pick's, not
|
|
|
|
|
// the model's)
|
|
|
|
|
for (const row of [player, house]) {
|
|
|
|
|
row.prov.addEventListener('change', () => {
|
|
|
|
|
fillModels(row.mod, row.prov.value, null);
|
|
|
|
|
fillEffort(row.eff, row.prov.value, row.mod.value, row.eff.value);
|
|
|
|
|
});
|
|
|
|
|
row.mod.addEventListener('change', () => {
|
|
|
|
|
fillEffort(row.eff, row.prov.value, row.mod.value, row.eff.value);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-14 23:48:27 +00:00
|
|
|
saveBtn.addEventListener('click', async () => {
|
|
|
|
|
try {
|
2026-11-19 08:35:23 +00:00
|
|
|
/** @param {Row} row @param {string} role @returns {?{ provider: string, model: string, effort: string }} */
|
|
|
|
|
const specOf = (row, role) => {
|
|
|
|
|
if (!row.prov.value) return null;
|
|
|
|
|
if (!row.mod.value) throw new Error(`${role}: pick a model (or clear the provider)`);
|
|
|
|
|
if (!row.eff.value) throw new Error(`${role}: pick an effort level -- there is no unset effort`);
|
|
|
|
|
return { provider: row.prov.value, model: row.mod.value, effort: row.eff.value };
|
|
|
|
|
};
|
2026-11-14 23:48:27 +00:00
|
|
|
await api(`/runs/${state.runId}/model`, {
|
|
|
|
|
method: 'POST',
|
2026-11-19 08:35:23 +00:00
|
|
|
body: { player: specOf(player, 'player'), housekeeper: specOf(house, 'housekeeper') },
|
2026-11-14 23:48:27 +00:00
|
|
|
});
|
|
|
|
|
saveState.textContent = 'saved';
|
|
|
|
|
} catch (e) {
|
|
|
|
|
banner(e.message);
|
|
|
|
|
saveState.textContent = 'not saved';
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-11-19 08:35:23 +00:00
|
|
|
|
2026-11-14 23:48:27 +00:00
|
|
|
return {
|
2026-11-19 08:35:23 +00:00
|
|
|
/** @param {{ player?: ?{ provider: string, model: string, effort: string }, housekeeper?: ?{ provider: string, model: string, effort: string } }} models run.json verbatim (the spec picks)
|
|
|
|
|
* @param {?{ player?: ?import('./shapes.mjs').RoleHealth, housekeeper?: ?import('./shapes.mjs').RoleHealth }} modelState the resolved truth
|
|
|
|
|
* @param {?{ slug: string, default: ?{ model: string, effort: string } }[]} providerDefaults
|
|
|
|
|
* @param {import('./shapes.mjs').ModelsRegistryResponse} theReg */
|
|
|
|
|
fill(models, modelState, providerDefaults, theReg) {
|
|
|
|
|
reg = theReg;
|
|
|
|
|
/** @param {Row} row @param {'player'|'housekeeper'} role */
|
|
|
|
|
const fillRole = (row, role) => {
|
|
|
|
|
// the prefill is the run's OWN stored pick only -- an
|
|
|
|
|
// inherited housekeeper stays '' (saving an explicit pick is
|
|
|
|
|
// a deliberate act; the health line states what inherits)
|
|
|
|
|
const raw = models?.[role];
|
|
|
|
|
const spec = raw && typeof raw === 'object' && !Array.isArray(raw)
|
|
|
|
|
? /** @type {{ provider?: unknown, model?: unknown, effort?: unknown }} */ (raw) : null;
|
|
|
|
|
const pick = spec && typeof spec.provider === 'string' && typeof spec.model === 'string' && typeof spec.effort === 'string'
|
|
|
|
|
? { provider: spec.provider, model: spec.model, effort: spec.effort } : null;
|
|
|
|
|
row.prov.textContent = '';
|
|
|
|
|
opt(row.prov, '', role === 'housekeeper' ? '(inherit -- the player provider\'s default)' : '(no provider picked)');
|
|
|
|
|
const slugs = (reg?.providers ?? []).map((p) => p.slug);
|
|
|
|
|
if (pick && !slugs.includes(pick.provider)) opt(row.prov, pick.provider, `${pick.provider} (no longer configured)`);
|
|
|
|
|
for (const s of slugs) opt(row.prov, s, s);
|
|
|
|
|
row.prov.value = pick?.provider ?? '';
|
|
|
|
|
if (pick) {
|
|
|
|
|
fillModels(row.mod, pick.provider, pick.model);
|
|
|
|
|
fillEffort(row.eff, pick.provider, pick.model, pick.effort);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// no stored pick: the player pre-selects the first provider's
|
|
|
|
|
// default (the create flow lands an explicit pick); the
|
|
|
|
|
// housekeeper inherits, so it stays ''
|
|
|
|
|
if (role === 'player' && slugs.length) {
|
|
|
|
|
const withDef = providerDefaults?.find((x) => x.default && slugs.includes(x.slug)) ?? null;
|
|
|
|
|
const slug = withDef?.slug ?? slugs[0];
|
|
|
|
|
row.prov.value = slug;
|
|
|
|
|
fillModels(row.mod, slug, withDef?.default?.model ?? null);
|
|
|
|
|
fillEffort(row.eff, slug, withDef?.default?.model ?? null, withDef?.default?.effort ?? null);
|
|
|
|
|
} else {
|
|
|
|
|
fillModels(row.mod, row.prov.value, null);
|
|
|
|
|
fillEffort(row.eff, row.prov.value, null, null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
fillRole(player, 'player');
|
|
|
|
|
fillRole(house, 'housekeeper');
|
|
|
|
|
// the health line: the invalidation notes and the inheritance
|
|
|
|
|
const notes = [];
|
|
|
|
|
for (const role of /** @type {('player'|'housekeeper')[]} */ (['player', 'housekeeper'])) {
|
|
|
|
|
const st = modelState?.[role];
|
|
|
|
|
if (!st) continue;
|
|
|
|
|
if (st.ok && st.inherited && st.spec) notes.push(`${role}: inherits ${st.spec.provider}'s default (${st.spec.model} at ${st.spec.effort})`);
|
|
|
|
|
if (!st.ok && st.note) notes.push(`${role}: ${st.note}`);
|
the 2026-11-16 rounds, the whole day in one commit: model discovery (the two-step op act -- discover scrapes the provider metadata, refine runs the deterministic battery over every id and hands the adjudicated results to the best passing model for the curated registry; state/models.json is the truth of selectable models and gates all model use, a fresh deployment has none; the five named sampling knobs ride run.json params over server.json params, sent only when set; the curator call retries once on the host's network hiccups, its output strictly validated with the machine-list fallback, and the do-not-deliberate line keeps its thinking tokens down); the pick rule reworked on the GM's rulings -- the dv endpoint's 5.2/5.3-max flip was an alias (one model behind both ids), the rank keys on the reasoning bucket not the raw token count (within-bucket differences are sampling noise, the thresholds sit in the endpoint's observed gaps) and full ties settle sort-lex-pick-bottom, with the mock registry carrying a canned tie pair (mock/mock-tie) and the smoke asserting the lex-bottom pick; the play-protocol batch (OOC GM turns carry no cache blocks, memory.json is authored draft applied by the start gate's reapply over a fresh db, /story filters OOC whole, the per-turn raw control on the table); the tunables UX round (web/knobs.mjs: the definitions table with the GM's hint texts and the probed this-endpoint bounds, the per-knob explicit override toggle replacing implicit empty-means-unset diffing, the shared focus-driven hint bar; the run detail and /model responses carry paramDefaults, the deployment layer -- the only default anyone can honestly name); request recording (every provider call lands its resolved model + effective params on the msg event as via, a failed call lands a req event with the failure, both surface on the raw tab and the per-turn raw control on no model-facing surface, a req riding the slidwin tail passes the start lint as conversation machinery; the housekeeping pass log names its model via the clerk's --model flag); the mind verb (<mind> JSON in a player turn sets its sampling for its next turn -- one-shot, max_tokens excluded, a budget not a mind; bounds enforced in KNOB_BOUNDS with the range named in the conflict and the heal restatement the statement that counts; derive() makes a statement live until a player reply consumes it, honest across restarts, session boundaries and forks -- an unconsumed mind rides on); the full-block protocol (the GM rewrote system/invariants/reminder to eliminate the diff verbs: she emits whole <status>/<agenda> at her turn tail, a present block is a whole-list set, absent means unchanged never blank, over-cap agendas evict from the bottom silently -- ruled a feature, silent to her, the note shows the GM; renderView strips every copy and stamps the newest of each kind at the tail of her most recent prose turn, her own emission, so the context reads as the same sequence of events the game had; GM prose goes pure, old logs' composited rides strip, they were never GM words; <mind> is write-only, its tags strip from the view; every turn of hers carries its <model> block -- the params it rode, bare JSON from the via record, the current call included, suppressed when nothing is set, emitting one refused with a pointer at <mind>; the clerk's status-apply/agenda-apply delta verbs RETIRED with their dispatch and collectors, status-set/agenda-set are the player path now; the story strips her blocks, the table chips them; the smoke imports renderView and asserts the view policy directly -- the pattern for testing view-only policy no API exposes); and the opening event RETIRED (the start gate seeds the clerk from her last authored turn's blocks -- the GM moved la-caramba's initial status into her opening turn; old carryovers keep their events as inert history; the event's pre-existing double-landing in every started log, pre-bundle and in-carry, died with the branch); smoke ALL PASS + restart + reminder + repo checks green, browser passes over the knob UX and the new chips and notes with zero console errors, typecheck green on both programs; README and DICTIONARY carry the durable design, HANDOFF trimmed to the map
2026-11-16 21:32:02 +00:00
|
|
|
}
|
2026-11-19 08:35:23 +00:00
|
|
|
healthLine.textContent = notes.join(' \u00b7 ');
|
|
|
|
|
const providers = reg?.providers ?? [];
|
|
|
|
|
hint.textContent = !providers.length
|
|
|
|
|
? 'no providers configured -- the op fixes this from the admin block on home'
|
|
|
|
|
: providers.every((p) => p.phase === 'none')
|
|
|
|
|
? 'providers configured but nothing discovered -- the op discovers from the admin block on home'
|
|
|
|
|
: providers.some((p) => p.phase === 'preliminary')
|
|
|
|
|
? 'a preliminary registry is unrefined: the op can run refine to verify and label its models'
|
|
|
|
|
: '';
|
2026-11-14 23:48:27 +00:00
|
|
|
saveState.textContent = '';
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-11-19 11:11:23 +00:00
|
|
|
|
|
|
|
|
// --- the file editor ------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// The shared editor surface: a file nav, a textarea with the sigil/var
|
|
|
|
|
// highlight overlay, per-file hints, a save bar. Extracted from the
|
|
|
|
|
// setup view (2026-11-19) when the package editor needed the same
|
|
|
|
|
// machinery -- the host supplies the DOM ids, the ordered file specs,
|
|
|
|
|
// and the PUT call; drafts, dirty marks, the highlight, and the save
|
|
|
|
|
// flow live here. The deep validation stays server-side (the
|
|
|
|
|
// save-time lints refuse at the PUT).
|
|
|
|
|
/** One file as the editor sees it.
|
|
|
|
|
* @typedef {{ name: string, mode: string, exists: boolean, content: string }} EditorFile */
|
|
|
|
|
/** @typedef {{ load: (specs: EditorFile[]) => void, select: (name: string) => void, saveCurrent: () => Promise<void>, saveDirty: () => Promise<void>, isDirty: () => boolean, current: () => ?string }} FileEditor */
|
|
|
|
|
/** @param {{ nav: string, edit: string, hl: string, save: string, state: string, hint: string }} ids
|
|
|
|
|
* @param {{ put: (file: string, content: string) => Promise<unknown>, hints?: Record<string, string> }} opts
|
|
|
|
|
* @returns {FileEditor} */
|
|
|
|
|
export function fileEditor(ids, { put, hints = {} }) {
|
|
|
|
|
const nav = $(ids.nav);
|
|
|
|
|
const ta = /** @type {HTMLTextAreaElement} */ ($(ids.edit));
|
|
|
|
|
const hl = $(ids.hl);
|
|
|
|
|
const saveBtn = /** @type {HTMLButtonElement} */ ($(ids.save));
|
|
|
|
|
const stateEl = $(ids.state);
|
|
|
|
|
const hintEl = $(ids.hint);
|
|
|
|
|
/** @type {Record<string, EditorFile>} */ let files = {};
|
|
|
|
|
/** @type {Record<string, string>} */ let drafts = {}; // unsaved edits by file name
|
|
|
|
|
/** @type {?string} */ let current = null;
|
|
|
|
|
|
|
|
|
|
// the highlight overlay: known sigils (gold) and every $VAR (green)
|
|
|
|
|
// light up in place; unknown @-words are the author's own text and
|
|
|
|
|
// stay plain -- @ syntax is not owned here
|
|
|
|
|
const SIGIL_RE = /@(PC|Package)\b/g;
|
|
|
|
|
const VAR_RE = /\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
|
|
|
function renderHighlight() {
|
|
|
|
|
const esc = ta.value.replace(/[&<>]/g, (c) => /** @type {Record<string, string>} */ ({ '&': '&', '<': '<', '>': '>' })[c]);
|
|
|
|
|
hl.innerHTML = esc
|
|
|
|
|
.replace(VAR_RE, '<span class="tok-var">$&</span>')
|
|
|
|
|
.replace(SIGIL_RE, '<span class="tok-sigil">$&</span>')
|
|
|
|
|
+ '\n\u200b'; // keep the trailing empty line's height honest
|
|
|
|
|
hl.scrollTop = ta.scrollTop;
|
|
|
|
|
hl.scrollLeft = ta.scrollLeft;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @param {string} f */
|
|
|
|
|
function stashDraft(f) {
|
|
|
|
|
if (files[f]?.mode !== 'rw') return; // read-only files never become drafts
|
|
|
|
|
const v = ta.value;
|
|
|
|
|
if (v === (files[f]?.content ?? '')) { delete drafts[f]; markNav(); return; }
|
|
|
|
|
drafts[f] = v;
|
|
|
|
|
markNav();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function markNav() {
|
|
|
|
|
for (const item of /** @type {HTMLElement[]} */ (Array.from(nav.children))) {
|
|
|
|
|
const name = (/** @type {HTMLElement} */ (item.querySelector('.file-name'))).textContent.replace(' (new)', '');
|
|
|
|
|
const dirty = drafts[name] !== undefined;
|
|
|
|
|
item.classList.toggle('dirty', dirty);
|
|
|
|
|
// the dirty marker is authored text, never css-generated -- the
|
|
|
|
|
// rendered text must match the source (house rule, 2026-11-15)
|
|
|
|
|
(/** @type {HTMLElement} */ (item.querySelector('.file-dirty'))).textContent = dirty ? '*' : '';
|
|
|
|
|
item.classList.toggle('current', name === current);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @param {string} f */
|
|
|
|
|
function select(f) {
|
|
|
|
|
const prev = current;
|
|
|
|
|
if (prev === f) return;
|
|
|
|
|
if (prev && files[prev]?.mode === 'rw') stashDraft(prev);
|
|
|
|
|
current = f;
|
|
|
|
|
const spec = files[f] ?? { name: f, mode: 'rw', exists: false, content: '' };
|
|
|
|
|
ta.value = drafts[f] ?? spec.content ?? '';
|
|
|
|
|
ta.disabled = spec.mode !== 'rw';
|
|
|
|
|
saveBtn.hidden = spec.mode !== 'rw';
|
|
|
|
|
stateEl.textContent = spec.mode === 'rw' ? '' : 'read-only';
|
|
|
|
|
const hint = hints[f] ?? '';
|
|
|
|
|
hintEl.textContent = hint;
|
|
|
|
|
hintEl.hidden = !hint;
|
|
|
|
|
renderHighlight();
|
|
|
|
|
markNav();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @param {EditorFile[]} specs */
|
|
|
|
|
function load(specs) {
|
|
|
|
|
drafts = {};
|
|
|
|
|
current = null;
|
|
|
|
|
files = {};
|
|
|
|
|
nav.textContent = '';
|
|
|
|
|
for (const spec of specs) {
|
|
|
|
|
files[spec.name] = spec;
|
|
|
|
|
const item = el('button', `file-item${spec.mode === 'ro' ? ' ro' : ''}${spec.exists ? '' : ' absent'}`);
|
|
|
|
|
item.appendChild(el('span', 'file-name', spec.name + (spec.exists ? '' : ' (new)')));
|
|
|
|
|
item.appendChild(el('span', 'file-dirty', ''));
|
|
|
|
|
item.addEventListener('click', () => select(spec.name));
|
|
|
|
|
nav.appendChild(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @returns {Promise<void>} */
|
|
|
|
|
async function saveCurrent() {
|
|
|
|
|
const f = current;
|
|
|
|
|
if (!f) return;
|
|
|
|
|
saveBtn.disabled = true;
|
|
|
|
|
try {
|
|
|
|
|
await put(f, ta.value);
|
|
|
|
|
files[f].content = ta.value;
|
|
|
|
|
files[f].exists = true;
|
|
|
|
|
delete drafts[f];
|
|
|
|
|
stateEl.textContent = 'saved';
|
|
|
|
|
markNav();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
banner(/** @type {Error} */ (e).message);
|
|
|
|
|
stateEl.textContent = 'not saved';
|
|
|
|
|
}
|
|
|
|
|
saveBtn.disabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flush every draft (start and publish flows): a refusal stops the
|
|
|
|
|
// flow -- the caller decides what to tell the author
|
|
|
|
|
/** @returns {Promise<void>} */
|
|
|
|
|
async function saveDirty() {
|
|
|
|
|
if (current != null) stashDraft(current);
|
|
|
|
|
for (const [f, content] of Object.entries({ ...drafts })) {
|
|
|
|
|
await put(f, content);
|
|
|
|
|
files[f].content = content;
|
|
|
|
|
files[f].exists = true;
|
|
|
|
|
delete drafts[f];
|
|
|
|
|
}
|
|
|
|
|
markNav();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveBtn.addEventListener('click', saveCurrent);
|
|
|
|
|
ta.addEventListener('input', () => {
|
|
|
|
|
if (current) stashDraft(current);
|
|
|
|
|
stateEl.textContent = 'unsaved';
|
|
|
|
|
renderHighlight();
|
|
|
|
|
});
|
|
|
|
|
ta.addEventListener('scroll', () => {
|
|
|
|
|
hl.scrollTop = ta.scrollTop;
|
|
|
|
|
hl.scrollLeft = ta.scrollLeft;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
load,
|
|
|
|
|
select,
|
|
|
|
|
saveCurrent,
|
|
|
|
|
saveDirty,
|
|
|
|
|
isDirty: () => Object.keys(drafts).length > 0,
|
|
|
|
|
current: () => current,
|
|
|
|
|
};
|
|
|
|
|
}
|