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

This commit is contained in:
2026-11-15 19:57:07 +00:00
parent f81b188ce1
commit 8d4a6b91df
22 changed files with 567 additions and 227 deletions
+11 -2
View File
@@ -5,20 +5,27 @@
// embedded browser pane. Errors and notices land in the banner
// instead; destructive confirms are two-click armed (widgets.mjs).
/** @typedef {import('../server/shapes.mjs').User} User */
import { $ } from './dom.mjs';
// identity chrome: who is signed in. Signing in is permanent and
// per-browser (the token lives in localStorage); there is no sign-out
// -- the lifecycle story is a roadmap extension point
/** @param {?User} [me] */
export function setWho(me) {
$('who').textContent = me ? `${me.name}${me.superuser ? ' \u00b7 op' : ''}` : '';
$('who').title = me?.id ?? '';
}
/** @param {string} text */
export function setSessionInfo(text) {
$('session-info').textContent = text;
}
/** The run detail (GET /runs/:id) carries the meter's numbers; null
* is the router's "no run addressed" reset.
* @param {?{ context?: ?{ used?: ?number, pct?: ?number, contwin?: ?boolean } }} [detail] */
export function renderMeter(detail) {
const fill = $('context-fill');
const label = $('context-label');
@@ -34,18 +41,20 @@ export function renderMeter(detail) {
label.textContent = c.contwin ? `${pct}% -- close & housekeep past 85%` : '';
}
/** @param {boolean} on @param {string} [text] */
export function setBusy(on, text = 'her turn...') {
$('busy').hidden = !on; // model calls take their time -- say so
if (on) $('busy').textContent = text;
}
let bannerTimer = null;
/** @type {?ReturnType<typeof setTimeout>} */ let bannerTimer = null;
/** @param {string} text @param {string} [kind] */
export function banner(text, kind = 'error') {
const b = $('banner');
b.textContent = text;
b.className = kind;
b.hidden = false;
clearTimeout(bannerTimer);
clearTimeout(bannerTimer ?? undefined);
bannerTimer = setTimeout(() => { b.hidden = true; }, 10000);
}