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
|
2026-11-14 23:48:27 +00:00
|
|
|
// button, an inline editor; the section shell stays in index.html
|
|
|
|
|
// - modelsBox: the per-run player/housekeeper selects over the
|
|
|
|
|
// upstream listing; setup and the play aside each carry one
|
|
|
|
|
|
|
|
|
|
import { $, el } from './dom.mjs';
|
|
|
|
|
import { api } from './client.mjs';
|
|
|
|
|
import { state } from './state.mjs';
|
|
|
|
|
import { banner } from './chrome.mjs';
|
|
|
|
|
import { render } from './router.mjs';
|
|
|
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// a pane: body line + edit button + inline editor. save(items)
|
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
|
|
|
// resolves on success and throws on failure -- a failed save keeps
|
2026-11-14 23:48:27 +00:00
|
|
|
// the editor open, nothing was changed. setEditable(false) is the
|
the access round: spectator mode removed and reads made story-only -- the table, raw session, carryover, files, status, and the notepad are owner-only; the story is the one public read (any signed-in user, fork button on it that copies the run that made the story, never the view); #28's human-side open read overturned with the ruling, gm.md stays never model-facing; non-owners land in the story view (play/setup redirect on the 403, home cards link there directly), the story view names its owner and stands alone on the story response, which now carries display/owner/ownerName; the table gains a raw tab -- the whole log as it rode the wire (thinking, every variant block, every reminder copy, full tool results, rides inline) next to the curated projection, live sessions only, sticky across turn re-renders; --debug mode for easy testing: every request is a fixed superuser that bypasses the users db entirely, no invite dance, loopback-bound regardless of config (found live: the SPA boot only asked the server who it was when a token existed, so tokenless browsers never learned they were the debug user -- boot now always asks); lint rule 10: no laptop-visible facts anywhere and all commits always from Mute -- the username and home paths are derived at runtime so the checker never contains them, scanned over the tracked tree, every historical blob, and commit messages, identity enforced on author and committer on every ref plus git config; the queue split: resolved questions relocated to DECISIONS.md verbatim by number (day's words kept, reversals annotate never rewrite, the agenda/reminder trio gets its own section), QUESTIONS is open items only (stale OPENs resolved on the way: #10 by the 2026-11-13 pairing default, #11 by the raw tab); smoke reworked to the story-only battery -- ash 403s on every run surface, 200 on the story alone, the ownerless-run check rides the runs list; all twelve QUESTIONS-number citations re-pointed at DECISIONS; smoke ALL PASS in a worktree (111 checks), two-user browser pass (the non-owner's whole run surface is a 403 detail and a 200 story, back-to-table hidden, owner views intact), raw-tab browser pass (curated table leak-free, raw shows the whole variants block, tabs vanish on dormancy), typecheck green on both programs, check-repo clean
2026-11-15 22:37:06 +00:00
|
|
|
// not-the-owner state: no edit button, an open editor cancels.
|
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
|
|
|
/** @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[], save: (items: string[]) => Promise<unknown> }} PaneOpts */
|
|
|
|
|
/** @typedef {{ set: (next?: ?string[]) => void, setEditable: (ok: boolean) => void, reset: () => void, items: string[] }} Pane */
|
|
|
|
|
/** @param {PaneOpts} opts @returns {Pane} */
|
2026-11-14 23:48:27 +00:00
|
|
|
export function paneEditor({ section, body, empty, placeholder, rows, format, toText, fromText, save }) {
|
|
|
|
|
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');
|
|
|
|
|
const saveBtn = el('button', null, 'save');
|
|
|
|
|
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)
|
|
|
|
|
|
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 = [];
|
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;
|
|
|
|
|
};
|
|
|
|
|
const renderBody = () => {
|
|
|
|
|
bodyEl.textContent = items.length ? format(items) : empty;
|
|
|
|
|
bodyEl.classList.toggle('empty', !items.length);
|
|
|
|
|
};
|
|
|
|
|
const openEditor = () => {
|
|
|
|
|
area.value = toText(items);
|
|
|
|
|
open = true;
|
|
|
|
|
sync();
|
|
|
|
|
area.focus();
|
|
|
|
|
};
|
|
|
|
|
const cancel = () => { open = false; sync(); };
|
|
|
|
|
const doSave = async () => {
|
|
|
|
|
const next = fromText(area.value);
|
|
|
|
|
try {
|
|
|
|
|
await save(next);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
banner(e.message);
|
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
|
|
|
return; // stay in the editor -- nothing was changed
|
2026-11-14 23:48:27 +00:00
|
|
|
}
|
|
|
|
|
items = next;
|
|
|
|
|
cancel();
|
|
|
|
|
render(); // the server's truth re-renders the panes
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
editBtn.addEventListener('click', openEditor);
|
|
|
|
|
cancelBtn.addEventListener('click', cancel);
|
|
|
|
|
saveBtn.addEventListener('click', doSave);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
set(next) { items = next ?? []; renderBody(); },
|
|
|
|
|
setEditable(ok) { mayEdit = ok; cancel(); },
|
|
|
|
|
reset() { cancel(); },
|
|
|
|
|
get items() { return items; },
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
// the upstream model listing, fetched once per session -- a live
|
2026-11-14 23:48:27 +00:00
|
|
|
// /models call every render would hammer the endpoint for a list
|
|
|
|
|
// that rarely changes
|
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 cachedModels = null;
|
|
|
|
|
/** @returns {Promise<string[]>} */
|
2026-11-14 23:48:27 +00:00
|
|
|
export async function modelList() {
|
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
|
|
|
if (!cachedModels) cachedModels = /** @type {string[]} */ (await api('/models').catch(() => []));
|
2026-11-14 23:48:27 +00:00
|
|
|
return cachedModels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A select's "" value means "deployment default"; a current override
|
|
|
|
|
// missing from the listing stays selectable, so a stale pick never
|
|
|
|
|
// silently rewrites itself.
|
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 {HTMLSelectElement} sel @param {?string} current @param {string[]} list @param {?string} [def] */
|
2026-11-14 23:48:27 +00:00
|
|
|
function fillSelect(sel, current, list, def) {
|
|
|
|
|
sel.textContent = '';
|
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} v @param {string} label */
|
2026-11-14 23:48:27 +00:00
|
|
|
const mk = (v, label) => {
|
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 o = /** @type {HTMLOptionElement} */ (el('option', null, label));
|
2026-11-14 23:48:27 +00:00
|
|
|
o.value = v;
|
|
|
|
|
sel.appendChild(o);
|
|
|
|
|
};
|
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
|
|
|
mk('', `deployment default${def ? ` -- ${def}` : ' (unset)'}`);
|
2026-11-14 23:48:27 +00:00
|
|
|
const opts = [...list];
|
|
|
|
|
if (current && !opts.includes(current)) opts.push(current);
|
|
|
|
|
for (const m of opts) mk(m, m);
|
|
|
|
|
sel.value = current ?? '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the models box: player/housekeeper selects + save, posting the
|
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
|
|
|
// per-run overrides. The mount keeps its id -- the CSS panels it.
|
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));
|
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 playerSel = /** @type {HTMLSelectElement} */ (el('select'));
|
|
|
|
|
const houseSel = /** @type {HTMLSelectElement} */ (el('select'));
|
2026-11-14 23:48:27 +00:00
|
|
|
const pField = el('label', 'field', 'player ');
|
|
|
|
|
pField.appendChild(playerSel);
|
|
|
|
|
const hField = el('label', 'field', 'housekeeper ');
|
|
|
|
|
hField.appendChild(houseSel);
|
|
|
|
|
root.appendChild(pField);
|
|
|
|
|
root.appendChild(hField);
|
|
|
|
|
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);
|
|
|
|
|
saveBtn.addEventListener('click', async () => {
|
|
|
|
|
try {
|
|
|
|
|
await api(`/runs/${state.runId}/model`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: { player: playerSel.value || null, housekeeper: houseSel.value || null },
|
|
|
|
|
});
|
|
|
|
|
saveState.textContent = 'saved';
|
|
|
|
|
} catch (e) {
|
|
|
|
|
banner(e.message);
|
|
|
|
|
saveState.textContent = 'not saved';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return {
|
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 {?{ player?: ?string, housekeeper?: ?string }} models @param {?{ player?: ?string, housekeeper?: ?string }} defaults @param {string[]} list */
|
2026-11-14 23:48:27 +00:00
|
|
|
fill(models, defaults, list) {
|
|
|
|
|
fillSelect(playerSel, models?.player ?? null, list, defaults?.player);
|
|
|
|
|
fillSelect(houseSel, models?.housekeeper ?? null, list, defaults?.housekeeper);
|
|
|
|
|
saveState.textContent = '';
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|