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
|
|
|
// web/shapes.mjs -- the SPA's wire shapes: the REST responses the
|
|
|
|
|
// views consume. No runtime code: like server/shapes.mjs, this module
|
|
|
|
|
// exists so the tsc checker (JSDoc mode, no emit) and the humans
|
|
|
|
|
// reading the code agree on the load-bearing shapes. The server's own
|
|
|
|
|
// shared shapes (User, LogEvent, JobState, RunMeta) are imported from
|
|
|
|
|
// ../server/shapes.mjs at their use sites -- the API response
|
|
|
|
|
// envelopes live here because main.mjs's handlers build them as
|
|
|
|
|
// untyped literals; the smoke owns their behavioral truth.
|
|
|
|
|
export {};
|
|
|
|
|
|
|
|
|
|
/** One run card as GET /runs serves it (the clerk's listing,
|
|
|
|
|
* enriched by the server with the live-session state). fill is
|
|
|
|
|
* present exactly when the run is initialized. */
|
|
|
|
|
/** @typedef {{ id: string, package: string, models: ?{ player?: ?string, housekeeper?: ?string }, owner: ?string, ownerName: ?string, created: ?string, forked: ?number, pc: ?string, display: string, sessions: number, phase: ?string, ready: ?boolean, initialized: boolean, fill?: { a: number, b: number, cold: number }, open: boolean, session: ?number, pendingAsk: ?string }} RunCard */
|
|
|
|
|
|
|
|
|
|
/** GET /runs/:id -- the run detail: identity, the phase bookkeeping,
|
|
|
|
|
* her two blocks, the fill, the context meter's numbers. */
|
|
|
|
|
/** @typedef {{ run: { id: string, package: ?string, created: ?string, forked: ?number, owner: ?string, ownerName: ?string, models: { player?: ?string, housekeeper?: ?string }, modelDefaults: { player?: ?string, housekeeper?: ?string } }, display: string, open: boolean, phase: ?string, session: ?number, sessions: number, draft: boolean, ready: ?boolean, status: string[], agenda: string[], records: number, fill: Record<string, number>, events: number, pendingAsk: ?string, usage: ?{ promptTokens: number, completionTokens: number }, context: ?{ used: number, contwin: ?boolean, pct: ?number } }} RunDetail */
|
|
|
|
|
|
|
|
|
|
/** GET /runs/:id/table -- the live session's projection (thinking
|
|
|
|
|
* never crosses the wire, variant turns carry only the picked one). */
|
|
|
|
|
/** @typedef {{ run: string, session: number, entries: import('../server/shapes.mjs').LogEvent[], pendingAsk: ?string }} TableResponse */
|
|
|
|
|
|
|
|
|
|
/** GET /runs/:id/carryover -- the dormant session's opening material,
|
|
|
|
|
* projected like the table; ends decides the opening flow. */
|
|
|
|
|
/** @typedef {{ run: string, session: number, ready: boolean, entries: import('../server/shapes.mjs').LogEvent[], ends: ?('gm'|'player') }} CarryoverResponse */
|
|
|
|
|
|
|
|
|
|
/** GET /runs/:id/story -- the whole deliverable, read-only: every
|
|
|
|
|
* non-dropped literature turn, across all sessions in order. */
|
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
|
|
|
/** @typedef {{ run: string, display: string, owner: ?string, ownerName: ?string, sessions: { session: number, turns: { who: string, text: string }[] }[] }} StoryResponse */
|
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
|
|
|
|
|
|
|
|
/** GET /api/runs/:id/files -- the editor surface: a fixed whitelist,
|
|
|
|
|
* each file with its phase-truth mode. */
|
|
|
|
|
/** @typedef {{ session: number, phase: ?string, files: Record<string, { mode: string, exists: boolean, content?: string }> }} FilesResponse */
|
|
|
|
|
|
|
|
|
|
/** GET /api/prompts -- the repo-fed prompts, read-only context. */
|
|
|
|
|
/** @typedef {{ system: ?string, invariants: ?string, reminder: ?string }} PromptsResponse */
|
|
|
|
|
|
|
|
|
|
/** GET /api/runs/:id/notes -- the GM's notepad. */
|
|
|
|
|
/** @typedef {{ content: string }} NotesResponse */
|
|
|
|
|
|
|
|
|
|
/** GET /api/runs/:id/housekeeping/log -- the latest apply log. */
|
|
|
|
|
/** @typedef {{ content: string }} HousekeepingLogResponse */
|