Files
tiny-worlds/web/index.html
T
mute bbaf33635c the progress round: the provider streams, and the two long waits get honest meters -- the refine battery and her turn. The provider (provider.mjs): every completion now streams (vLLM SSE, probed live first: reasoning_content deltas arrive before content deltas, stream_options include_usage puts the full usage on the tail chunk) and assembles back into the one ChatResponse shape every caller already consumed -- content and reasoning in order, tool_calls stitched by index (id and name on the first fragment, arguments concatenated from shards, the assembled arguments parse), usage from the tail; a malformed data line fails loud where a skipped one would silently truncate, the log still records the assembled message whole, and an optional fifth param onProgress({phase, chars}) fires per delta as the meters' feed (ChatResponse names finish_reason, the wire shape the old typedef omitted). One cosmetic wire delta, named: streamed messages carry no provider_specific_fields (vLLM's duplicate reasoning channel plus refusal:null) -- nothing reads it. The refine meter (discovery.mjs + the home admin block): the job carries steps {total, done, label, chars} where the total is the scrape's model count plus the curator's two (thinking, writing), known the moment the scrape lands; the bar moves ONLY on real completions (GM, 2026-11-17: no step has a knowable duration, the point is meaningful feedback, not smooth fill), the label names the running call down to the effort-ladder sample, every completion lands a receipt line (elapsed seconds + the battery verdict), and the lines SURVIVE the job -- the receipt renders until the next refine (GM ruling: no reason to delete the log) and a rejected pass keeps its post-mortem; the curator's thinking step closes at the first prose delta (the streaming boundary -- why the provider went first), writing at the call's resolve, and a dead call closes both honestly; the 2s poll stays the transport (GM-ruled; SSE was rejected -- EventSource cannot send the Bearer header, and tokens in query strings are worse). The turn meter (loop.mjs + the progress route + the play view): the session carries a live progress record, one per provider call (a heal or tool round restarts it), fed by the streaming callback and cleared at every exit (the ask pause, the 422, the completing return, the failed request); GET /runs/:id/progress (owner-only, never queued) returns it plus the scale the bar guesstimates against -- the only true budget is max_tokens when the knobs set one (reasoning counts inside it, the usage arithmetic proves it; the route mirrors the loop's own param resolution at ~4 chars a token), else her own history: the longest past assistant turn in chars, thinking and prose both, the authored opening included (GM: a guesstimate, but an informed one). The 100% crossing pushes back geometrically: the scale grows by a quarter until the count fits, so the bar re-lands in the 80-100% band and climbs again, the same arithmetic every poll, never pinning (a count just under a grown bracket can still round to 100% for a moment -- named and accepted). No scale at all falls to the chunk-driven fallback: a twelve-segment strip, one lit, stepping ONLY when characters actually arrived -- never a free-running spinner, which would claim liveness the stream may not have; a stall shows as a stall. NO live partial prose in the transcript (the log is the one truth; streaming raw text would leak unpicked variants and half-formed heals onto the surface that shows them composed) -- the placeholder is a live div at the transcript foot, rebuilt when a render wipes it, sticking to bottom only when the scroller was already there, and the poll runs at 1s for turns (2s for refine). Verified: the provider live-probed against the real endpoint (prose+usage, thinking+progress transitions, a forced tool call with parseable arguments, the 403 path), a REAL refine run end to end on the GM's authorization (13 models, 541s, the meter exactly to spec with the curator's thinking ticking 4k-17k chars across polls) which also landed the effort measurements the registry was waiting for -- the deterministic re-pick is glm-5.3-max, and server.json's own pin still beats it until the op edits it -- smoke ALL PASS with the new assertions (the refine steps closed, the receipt's lines, the meter idle on a dormant run, idle-between-turns scaled by history, owner-gating; the first cut of the receipt assertion named the wrong mock tie-winner and the first cut of the dormant check clobbered a shared response variable -- both assertion bugs, the code was right), restart + reminder + repo checks green, typecheck green on both programs, and a disposable live run (created, three real turns, housekept, deleted) proving the meter in the browser with zero console errors: chars ticking, the phase flip at the streaming boundary, the scale re-anchoring to her new longest after each turn. Live findings on record: the measured effort default now rides every unset turn, and the test run's turns thought 12.1k/3.9k/6.5k chars against ~1.4k prose -- the max-observable default working as ruled, and the fresh-run decision the GM will make with the knob one click away; and the browser lesson pinned in AGENTS: the meter's DOM is invisible to a11y wait-text matching, so a whole frozen-meter scare during testing was a sampling artifact (the waits matched instantly against unrelated text) -- probe such widgets by DOM, never by wait
2026-11-17 02:21:38 +00:00

203 lines
6.8 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tiny Worlds</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header>
<a id="home-link" href="/">Tiny Worlds</a>
<span id="who"></span>
<div id="session-info"></div>
<div id="context-meter" title="context usage of the last call">
<div id="context-bar"><div id="context-fill"></div></div>
<span id="context-label"></span>
</div>
<button id="diag-btn" title="diagnostics log">log</button>
</header>
<main>
<section id="view-claim" hidden>
<h1>claim an invite</h1>
<p class="hint" id="claim-hint"></p>
<form id="claim-form">
<label class="field">invite code <input id="claim-code" autocomplete="off"></label>
<label class="field">display name <input id="claim-name" autocomplete="off"></label>
<div class="form-actions">
<button type="submit" class="primary">claim</button>
</div>
</form>
</section>
<section id="view-home" hidden>
<h1>runs</h1>
<div id="run-list"></div>
<button id="new-run-btn" class="primary">new run</button>
<section id="admin" hidden>
<h2>admin</h2>
<div class="form-actions">
<button id="invite-mint">mint invite</button>
<span id="invite-code"></span>
</div>
<div id="invite-list"></div>
<div id="user-list"></div>
<div id="models-admin">
<h3>models</h3>
<div id="models-state" class="hint"></div>
<div class="form-actions">
<button id="models-discover">discover</button>
<button id="models-refine">refine</button>
</div>
<div id="refine-progress" hidden>
<div id="refine-topline">
<span id="refine-count"></span>
<span id="refine-label" class="hint"></span>
</div>
<div id="refine-bar"><div id="refine-fill"></div></div>
</div>
<div id="refine-lines"></div>
<div id="models-list"></div>
</div>
</section>
</section>
<section id="view-new" hidden>
<h1>new run</h1>
<div id="package-pick">
<p class="hint">a run is a copy of the package -- everything stays editable until the session opens</p>
<div id="package-list"></div>
</div>
<form id="create-form" hidden>
<h2 id="create-title"></h2>
<label class="field">package name <input id="create-name" autocomplete="off"></label>
<label class="field">main character name <input id="create-pc" autocomplete="off"></label>
<div class="form-actions">
<button type="button" id="create-back">back</button>
<button type="submit" class="primary">create</button>
</div>
</form>
</section>
<section id="view-setup" hidden>
<div class="setup-head">
<h1 id="setup-title"></h1>
<span id="setup-state"></span>
<button id="setup-delete">delete draft</button>
<button id="setup-start" class="primary">start</button>
</div>
<div id="setup-vars" hidden>
<h2>prompt variables -- declared by the prompts, filled per run</h2>
<div id="setup-vars-list"></div>
<div class="form-actions">
<button id="setup-vars-save">save variables</button>
<span id="setup-vars-state"></span>
</div>
</div>
<div id="setup-models"></div>
<div id="setup-savepkg">
<input id="savepkg-name" placeholder="new package display name" autocomplete="off">
<button id="savepkg-btn">save as package</button>
<span id="savepkg-state"></span>
</div>
<div class="setup-body">
<nav id="setup-files"></nav>
<div id="setup-editor">
<div id="edit-stack">
<pre id="edit-hl" aria-hidden="true"></pre>
<textarea id="setup-edit" spellcheck="false"></textarea>
</div>
<div id="setup-edit-bar">
<button id="setup-save">save</button>
<span id="setup-edit-state"></span>
</div>
</div>
</div>
</section>
<section id="view-play" hidden>
<nav id="table-tabs" hidden>
<button id="tab-table" class="tab">table</button>
<button id="tab-raw" class="tab">raw</button>
</nav>
<div id="transcript" aria-live="polite"></div>
</section>
<section id="view-story" hidden>
<div class="story-head">
<h1 id="story-title"></h1>
<button id="story-fork">fork this run</button>
<button id="story-back">back to the table</button>
</div>
<div id="story"></div>
</section>
</main>
<aside id="play-aside">
<section id="status-pane">
<div class="pane-head">
<h2>her status</h2>
</div>
<div id="status"></div>
<div id="conflict" hidden></div>
</section>
<section id="agenda-pane">
<div class="pane-head">
<h2>her agenda</h2>
</div>
<div id="agenda"></div>
</section>
<section id="notes-pane">
<div class="pane-head">
<h2>gm notes</h2>
<span id="notes-state"></span>
</div>
<textarea id="gm-notes" placeholder="yours alone -- never sent to the model"></textarea>
</section>
<section id="housekeeping">
<h2>housekeeping</h2>
<div id="hk-state"></div>
<button id="hk-run" hidden>stop session</button>
<label id="hk-override-row" hidden><input type="checkbox" id="hk-override"> override: skip the unhousekept check</label>
<button id="session-open" hidden>start session</button>
<button id="hk-rerun" hidden title="a fresh pass over the finished predecessor -- the dormant session's rings are replaced">re-run housekeeping</button>
<button id="hk-replay" hidden title="run the housekeeper over a session log -- nothing applied">dry-run housekeeping</button>
<details id="hk-log" hidden><summary>session log</summary><pre id="hk-log-content"></pre></details>
<details id="hk-replay-log" hidden><summary>replay manifest</summary><pre id="hk-replay-content"></pre></details>
</section>
<section id="story-pane">
<h2>the story</h2>
<button id="story-link">read the story so far</button>
</section>
<section id="fork-pane">
<h2>fork</h2>
<p class="hint">a copy of this run -- yours to continue</p>
<button id="fork-btn">fork this run</button>
</section>
<section id="models-pane" hidden></section>
</aside>
<footer>
<div id="gm-stack">
<pre id="gm-hl" aria-hidden="true"></pre>
<textarea id="gm-input" rows="6" placeholder="GM turn -- Enter newlines, Ctrl+Space sends" disabled></textarea>
</div>
<span id="busy" hidden>her turn...</span>
<button id="gm-send" disabled>send</button>
</footer>
<div id="banner" hidden></div>
<pre id="diag" hidden></pre>
<dialog id="ask-modal">
<h2>the player asks</h2>
<p id="ask-question"></p>
<textarea id="ask-answer" rows="3" placeholder="your ruling -- Enter sends"></textarea>
<button id="ask-send">answer</button>
</dialog>
<script type="module" src="/app.mjs"></script>
</body>
</html>