4b8fbd7471
The rulings (developer, 2026-11-19, in conversation): a deployment basically always needs a fronting proxy, so the listen address is code -- loopback, no override (an op who wants otherwise owns their own socat); the port rides the RP_PORT env var (the RP_BASE twin the test scripts use, default 7350, garbage refused loud); server.json is deleted entirely, file and reader both, because it held no meaningful configuration once the bind died -- only the dead bind and the declared contwin; and contwin is provider/model dependent, never a deployment global, so the meter must DISCOVER it, not read a declaration.
The meter: the run detail's context block now derives its window from the registry -- modelState's resolved player spec, findModel, the model's input ceiling -- null when the provider states none or no pick stands, pct computed against that. A dividend named in review: pct is uncapped, so a mid-run re-pick onto a smaller model shows the meter over 100% BEFORE the first send refuses (the endpoint's own context-length 400 is the designed refusal -- no pre-request check, nothing truncates, the failed call lands its req event, the composer keeps the line per the standing rule).
Debug mode reworked around its real purpose (skip the invite dance on a fresh server, mocks in particular): the old shape -- every request the superuser, no auth at all -- left any debug server that somehow reached a network fully open. Now one fixed superuser behind a real bearer token: minted into state/debug-token.txt (the bootstrap-invite precedent -- a raw secret on disk so a restart never invalidates what the tester already pasted; the developer ruled persist), printed at every boot, and the claim screen gains the paste path ("or paste a token": store it, verify through the public /session, land or banner). The paste path is generic surface, not debug-only: tokens are returned once and never listed, so a pasted saved token is the only browser-migration path that existed to build. The public /session carries a debug flag so the claim hint says "paste the token the server printed at boot" instead of pointing at the bootstrap file debug never mints. Debug browser passes now exercise the real auth path (the 401, the u: attribution line) instead of bypassing it.
En-route mock fidelity fix the smoke earned: the mock path never set s.usage (no provider call happens), so every usage and context surface was null under the smoke -- the first cut of the new gauge assertion failed on exactly that. The mock now carries a synthetic usage (the assembled view's chars over 4), riding the msg events like the real path's, so the detail's usage and the context gauge are smoke-assertable: contwin 524288 straight from the mock's registry input ceiling, pct computed.
Verified: typecheck green both programs; smoke ALL PASS (+1, the discovered-gauge assertion); restart + reminder checks green (5 runs again); a browser pass on --mock --debug end to end -- the wrong token banners "token rejected" and stays on claim, the printed token lands as Debug the op, the stored token survives a server restart (the persistence proof), zero console errors; check-repo clean (it caught the round's own "window" in the new README passage -- contwin is the word); the dev machine's server.json deleted and the debug server restarted on the real state (Chloe and Irene rebuilt, the token minted into the real state/). Docs: README's deployment and debug passages, the config passage, and the layout tree (the server.example.json lines gone with the file); DICTIONARY's meter and contwin entries (the config key died with the file -- the dated rename record keeps its day's words); AGENTS's server entry and the two server.json gotchas; HANDOFF's round record and the push-queue count (now eight). The developer's operator-queue line ("revisit the debug mode, hardcode loopback") is struck by them in the same commit. packages/detention stays untracked WIP, untouched.
221 lines
7.7 KiB
HTML
221 lines
7.7 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>
|
|
<form id="token-form">
|
|
<label class="field">or paste a token <input id="token-paste" autocomplete="off"></label>
|
|
<div class="form-actions">
|
|
<button type="submit">sign in</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="providers-admin">
|
|
<h3>providers</h3>
|
|
<div id="providers-banner" class="hint" hidden></div>
|
|
<div id="provider-list"></div>
|
|
<div class="form-actions">
|
|
<button id="provider-add-of">add opencode/free</button>
|
|
<button id="provider-add-custom">add custom provider</button>
|
|
</div>
|
|
<form id="provider-form" hidden>
|
|
<label class="field">slug <input id="provider-slug" autocomplete="off" placeholder="my-shop"></label>
|
|
<label class="field">baseUrl <input id="provider-base" autocomplete="off" placeholder="https://api.example.com/v1"></label>
|
|
<label class="field" id="provider-key-field" hidden>API key <input id="provider-key" type="password" autocomplete="off"></label>
|
|
<div class="form-actions">
|
|
<button type="button" id="provider-add-go">add and discover</button>
|
|
<button type="button" id="provider-add-cancel">cancel</button>
|
|
</div>
|
|
</form>
|
|
</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="edit-hint" hidden></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="sheet-pane">
|
|
<div class="pane-head">
|
|
<h2>the sheet</h2>
|
|
</div>
|
|
<div id="sheet"></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="rewind-note" hidden>
|
|
<span id="rewind-note-text"></span>
|
|
<button id="rewind-cancel">cancel rewind</button>
|
|
</div>
|
|
<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>
|