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
This commit is contained in:
+53
-42
@@ -17,7 +17,13 @@ import { banner, hideBanner, renderMeter, setBusy, setSessionInfo } from './chro
|
||||
import { navigate, render, runGone } from './router.mjs';
|
||||
import { logEvent } from './log.mjs';
|
||||
import { armedButton, modelList, modelsBox, paneEditor } from './widgets.mjs';
|
||||
import { renderTranscript } from './transcript.mjs';
|
||||
import { renderRaw, renderTranscript } from './transcript.mjs';
|
||||
|
||||
// the table's two faces: the curated projection (the table) and the
|
||||
// raw audit log. Sticky across the re-renders a turn triggers;
|
||||
// switching runs resets to the table.
|
||||
/** @type {?string} */ let rawRun = null;
|
||||
let rawOpen = false;
|
||||
|
||||
// her two blocks, split along the seam: how she is (the status) vs
|
||||
// what she means to do (the agenda). Both render compact, mirroring
|
||||
@@ -62,6 +68,7 @@ export function leave() {
|
||||
/** @param {?string} id @param {number} seq @returns {Promise<void>} */
|
||||
export async function enter(id, seq) {
|
||||
if (id == null) return; // unreachable: the router only enters play with a run id
|
||||
if (rawRun !== id) { rawRun = id; rawOpen = false; } // a new run starts at the table
|
||||
statusPane.reset();
|
||||
agendaPane.reset();
|
||||
$('conflict').hidden = true;
|
||||
@@ -80,41 +87,44 @@ async function refreshPlay(id, seq) {
|
||||
detail = await api(`/runs/${id}`);
|
||||
} catch (e) {
|
||||
if (e.status === 404) return runGone(id, location.pathname);
|
||||
// the table is the owner's: everyone else reads the story
|
||||
if (e.status === 403) return navigate(`/runs/${id}/story`);
|
||||
return banner(`could not reach the server: ${e.message}`); // stay put -- transient
|
||||
}
|
||||
if (seq !== state.seq) return;
|
||||
const mine = !!(state.me && detail.run.owner === state.me.id);
|
||||
if (detail.draft) {
|
||||
if (mine) return navigate(`/runs/${id}/setup`);
|
||||
// someone else's unstarted run: nothing to read but its existence
|
||||
setSessionInfo(`${detail.display} -- a draft, not yours`);
|
||||
$('transcript').textContent = '';
|
||||
$('transcript').appendChild(el('div', 'hint', 'this run is still a draft -- fork it to make it yours and edit it'));
|
||||
return;
|
||||
}
|
||||
if (detail.draft) return navigate(`/runs/${id}/setup`); // the owner's draft opens the editor
|
||||
|
||||
setSessionInfo((detail.phase === 'live'
|
||||
setSessionInfo(detail.phase === 'live'
|
||||
? `${detail.display} -- session ${detail.session}${detail.pendingAsk ? ' -- waiting for your answer' : ''}`
|
||||
: `${detail.display} -- session ${detail.sessions} dormant`)
|
||||
+ (mine ? '' : detail.run.owner == null ? ' -- ownerless' : ' -- spectating'));
|
||||
: `${detail.display} -- session ${detail.sessions} dormant`);
|
||||
renderMeter(detail);
|
||||
statusPane.set(detail.status);
|
||||
agendaPane.set(detail.agenda);
|
||||
$('conflict').hidden = true;
|
||||
|
||||
// spectator mode: read everything, mutate nothing -- the fork is the
|
||||
// way in. Ownerless runs are spectators for everyone alike.
|
||||
statusPane.setEditable(mine);
|
||||
agendaPane.setEditable(mine);
|
||||
/** @type {HTMLTextAreaElement} */ ($('gm-notes')).readOnly = !mine;
|
||||
// the owner's table: everything here edits -- anyone else was
|
||||
// redirected to the story above
|
||||
statusPane.setEditable(true);
|
||||
agendaPane.setEditable(true);
|
||||
/** @type {HTMLTextAreaElement} */ ($('gm-notes')).readOnly = false;
|
||||
|
||||
$('table-tabs').hidden = true; // the tabs are the live session's
|
||||
if (detail.phase === 'live') {
|
||||
// the table: the live session's projection -- thinking never
|
||||
// crosses the wire, variant turns carry only the picked one (the
|
||||
// raw /session is the audit surface, one fetch away)
|
||||
/** @type {TableResponse} */ const session = await api(`/runs/${id}/table`);
|
||||
if (seq !== state.seq) return;
|
||||
renderTranscript(session.entries, { onConflict: showConflict });
|
||||
// the table has two faces: the curated projection (thinking never
|
||||
// crosses the wire, variant turns carry only the picked one) and
|
||||
// the raw audit log (everything as it rode the wire)
|
||||
$('table-tabs').hidden = false;
|
||||
$('tab-table').classList.toggle('active', !rawOpen);
|
||||
$('tab-raw').classList.toggle('active', rawOpen);
|
||||
if (rawOpen) {
|
||||
/** @type {TableResponse} */ const session = await api(`/runs/${id}/session`);
|
||||
if (seq !== state.seq) return;
|
||||
renderRaw(session.entries);
|
||||
} else {
|
||||
/** @type {TableResponse} */ const session = await api(`/runs/${id}/table`);
|
||||
if (seq !== state.seq) return;
|
||||
renderTranscript(session.entries, { onConflict: showConflict });
|
||||
}
|
||||
} else if (detail.phase === 'dormant') {
|
||||
// the review window: the carryover is the preview of the next
|
||||
// contwin's opening, rendered exactly as the table will hold it
|
||||
@@ -123,34 +133,30 @@ async function refreshPlay(id, seq) {
|
||||
$('transcript').textContent = '';
|
||||
if (carry && carry.entries.length) renderTranscript(carry.entries, {});
|
||||
else $('transcript').appendChild(el('div', 'hint', 'nothing carries -- the next session opens on the bundle alone'));
|
||||
if (mine) $('transcript').prepend(dormantBar(detail, carry));
|
||||
$('transcript').prepend(dormantBar(detail, carry));
|
||||
} else {
|
||||
$('transcript').textContent = '';
|
||||
}
|
||||
|
||||
// controls
|
||||
$('session-open').hidden = detail.phase !== 'dormant' || !mine;
|
||||
$('session-open').hidden = detail.phase !== 'dormant';
|
||||
if (!$('session-open').hidden) $('session-open').textContent = `start session ${detail.sessions}`;
|
||||
$('hk-run').hidden = detail.phase !== 'live' || !mine;
|
||||
$('hk-rerun').hidden = !(detail.phase === 'dormant' && detail.sessions >= 2) || !mine;
|
||||
$('hk-replay').hidden = !((detail.phase === 'live') || (detail.phase === 'dormant' && detail.sessions >= 2)) || !mine;
|
||||
$('hk-override-row').hidden = !(detail.phase === 'dormant' && detail.ready === false) || !mine;
|
||||
setInput(detail.phase === 'live' && !detail.pendingAsk && mine);
|
||||
/** @type {HTMLInputElement} */ ($('gm-input')).placeholder = mine
|
||||
? 'GM line -- Enter sends, Shift+Enter newlines'
|
||||
: 'spectating -- fork this run to continue it as yours';
|
||||
$('hk-run').hidden = detail.phase !== 'live';
|
||||
$('hk-rerun').hidden = !(detail.phase === 'dormant' && detail.sessions >= 2);
|
||||
$('hk-replay').hidden = !((detail.phase === 'live') || (detail.phase === 'dormant' && detail.sessions >= 2));
|
||||
$('hk-override-row').hidden = !(detail.phase === 'dormant' && detail.ready === false);
|
||||
setInput(detail.phase === 'live' && !detail.pendingAsk);
|
||||
/** @type {HTMLInputElement} */ ($('gm-input')).placeholder = 'GM line -- Enter sends, Shift+Enter newlines';
|
||||
|
||||
// models: the owner's per-run overrides
|
||||
$('models-pane').hidden = !mine;
|
||||
if (mine) {
|
||||
const mlist = await modelList();
|
||||
if (seq !== state.seq) return;
|
||||
models.fill(detail.run.models, detail.run.modelDefaults, mlist);
|
||||
}
|
||||
$('models-pane').hidden = false;
|
||||
const mlist = await modelList();
|
||||
if (seq !== state.seq) return;
|
||||
models.fill(detail.run.models, detail.run.modelDefaults, mlist);
|
||||
|
||||
// pending ask: the modal re-presents after a refresh -- the owner's
|
||||
// to answer; a spectator follows the thread in the transcript
|
||||
if (detail.pendingAsk && mine) {
|
||||
// to answer
|
||||
if (detail.pendingAsk) {
|
||||
$('ask-question').textContent = detail.pendingAsk;
|
||||
/** @type {HTMLDialogElement} */ ($('ask-modal')).showModal();
|
||||
/** @type {HTMLInputElement} */ ($('ask-answer')).focus();
|
||||
@@ -431,6 +437,11 @@ $('ask-answer').addEventListener('keydown', (e) => {
|
||||
$('session-open').addEventListener('click', startRun);
|
||||
$('hk-replay').addEventListener('click', replayHousekeeping);
|
||||
$('fork-btn').addEventListener('click', forkRun);
|
||||
|
||||
// the table's tabs: switching re-renders -- the same pass a turn
|
||||
// takes, fetching the face that is open
|
||||
$('tab-table').addEventListener('click', () => { if (rawOpen) { rawOpen = false; render(); } });
|
||||
$('tab-raw').addEventListener('click', () => { if (!rawOpen) { rawOpen = true; render(); } });
|
||||
$('story-link').addEventListener('click', () => { if (state.runId) navigate(`/runs/${state.runId}/story`); });
|
||||
$('gm-notes').addEventListener('input', notesInput);
|
||||
$('gm-notes').addEventListener('blur', saveNotes);
|
||||
|
||||
Reference in New Issue
Block a user