the provider round and the provider-flow round, plus the template and box packages

the provider round (2026-11-18, batteries-included): providers are first-class entities, the config is server-written state (state/config.json), and a fresh clone boots playable -- the opencode/free singleton auto-added and discovered on the empty list, playable with zero secrets. Every request resolves a full spec {provider, model, effort}: no unset effort, the per-run params layer retired, the mind verb the only sampling source. The registry is per-provider sections (state/models.json), refine caches adjudications under the double spec tuple (state/refine-cache.json), run picks are invalidatable (a removed provider or drifted model blocks the run with the note naming what died), and the housekeeper inherits the player spec's provider default (#16 closed). The no-legacy pass died the same day it shipped: bootImport deleted (server.json is bind + contwin), the registry's v1/v2 in-memory migrations deleted (models.json rewritten on disk into the per-provider shape), bare-string model picks deleted (Chloe's run.json migrated to spec objects, shape-preserving), the clerk's create model arg deleted, apiKeyEnv and the contextWindow alias gone. The live arc proven from a bare boot: invite minted, o/f auto-added, a custom provider with a bogus key (the recognizable 401), the auth fixed (13 models), the default pair selected, and a real glm-5.3 turn through the full path. Two live findings: opencode.ai serves 89 models keyless but 401s an empty Bearer header (the auth header rides only when a key exists), and the failure log line rides stderr.

the provider-flow round (2026-11-19, GM-designed): discovery IS the probe. The add takes only the endpoint -- {slug, baseUrl} or {builtin: true}, an apiKey in the body 400s (the auth route is the only key path) -- and a working keyless listing never sees a key field. A 401/403 stands the provider broken: the entity carries a probe record (outcome ok/auth/error, detail, at), the card opens the ask, and only the explicit acts move the record -- add, key, remove-key, discover; usage errors are transient and the op's to fix, nothing in the runtime flips provider state. The auth route is probe-then-save: the candidate key checks on reception, saves only on success -- a still-refused key never reaches the config, the previous state returns, the ask repeats. Every other discovery failure refuses the add outright with rollback: an endpoint that cannot answer is not a provider, nothing stands (the old code let it stand on any failure). The remove-key control (custom providers, armed) clears and re-probes: a provider gone public lands working keyless, a locked one re-opens the ask -- which is the key-replacement path. o/f never asks in any state: its auth failures are upstream breakage to show, not a prompt. The universal retry rule: NO automatic retries anywhere -- every inference call is user-initiated (the send, the housekeeping run, the refine) and every act has its manual retry; the curator's one auto-retry (the 2026-11-17 hiccup lesson) is deleted, the machine-label fallback the designed outcome. And failures never cache (GM: a failure is the absence of a measurement, not a measurement) -- the adjudication cache skips inference:false entries, the receipt line says "never cached, retried at every refine", and a transient battery error can never pin a false verdict; gev's 400s cost one cheap probe per refine and self-heal the day the backend learns tools. En-route fix the smoke earned: the create route validated body.spec AFTER the clerk built the run dir -- a refused spec left an orphan run (restart-check's exact count caught the sixth run); the spec validates first now, nothing lands on refusal.

the sheet's transport at the lint: the record is the only channel, the tag is view machinery composed by renderView, never authored by anyone -- the authored gate names the tag in any content (hers would never apply and primes the guarded emission; GM prose rides the view and story raw, the GM-side strips do not know it), names a sheet record on her turn, and checks object-ness on GM-turn records and boundary state notes both kinds; her emitted sheet in a carried tail stays legitimate history (the log keeps guard-conflicted emissions verbatim, and a stop can move one into the slidwin). The carryover editor teaches its own format now: a per-file hint between the editor and the save bar (one JSON object per line; status and agenda ride her turns; the sheet rides yours as the "sheet" field, never as a tag; the sigils and $VARS expand at start on the authored opening only).

the packages: template (the base for new packages -- the mood-indexed voice examples, the settings comment convention, non-playable as-is) and box (the sheet's first consumer: an incremental-game economy as ERP, GP and BP as two currencies with the room pushing her to fund her own punishments; the opening turn third-person per the typography ruling, ending on the display that needs a second read; the amnesiac rings empty by design; the erased name reading "(redacted)" after sigil expansion). The review found and fixed: both carryovers were pretty-printed JSON with duplicate keys -- unstartable under every per-line reader, flattened to true JSONL; the box's opening sheet rode her authored prose -- dead on every surface (the scan reads GM-turn records only, the strips eat it) and priming the exact emission the guard conflicts -- moved to the GM turn's sheet record, the override's shape; the gm.md "take of leave" typo fixed in all three packages.

the lint's rule 4 scoped to the substrate (GM, 2026-11-19): a banned word in a package's prose is fine -- the packages are the fiction and their words are the story's; README and the root prompts stay patrolled, and the box's "Or windows" is an architectural plural in a padded cell.

verified: typecheck green both programs; smoke ALL PASS (+27 the provider-flow battery: apiKey-on-add 400, the dead-endpoint refusal with config rollback, the auth-standing card with its probe record, probe-then-save both ways, the remove-key round trip, the o/f guards, the failures-never-cache proof over mock-fail -- verdict with the marker, absent from the cache file, re-probed fresh while the passing three serve from cache, not selectable, no orphan run; +8 the sheet-transport lint battery); restart + reminder checks green; a browser pass driving the whole add-flow machine on a mock+debug server (the hidden key field opening on the 401, the key landing through the auth route, the remove-key round trip re-opening the ask, the dead add refusing with the banner and no card, zero console errors beyond the expected 401/500 resource lines); check-repo clean with the box's windows. detention stays untracked WIP, untouched.
This commit is contained in:
2026-11-19 08:35:23 +00:00
parent 14b9b01d86
commit e60fd63d2b
42 changed files with 3071 additions and 1086 deletions
+126 -82
View File
@@ -62,8 +62,10 @@ or otherwise PC ever needs support, this is the line to revisit.
## The deployment (multiuser)
A deployment is one clone plus `server.json`, `state/`, and `runs/` --
all gitignored state. The LLM key lives on the backend; invited users
A deployment is one clone plus `state/` and `runs/` (all gitignored
state) and an optional `server.json` -- bind and contwin only; the
provider entities live in `state/config.json`, server-written,
SPA-managed, zero manual file edits. The LLM key lives on the backend
need neither the key nor a local clone. Identity is a token, nothing
else: no usernames, no passwords, no external IDPs. A single-use
invite code -- spent codes are recorded forever and rejected loudly on
@@ -100,11 +102,19 @@ forking makes that cheap -- stories outlive identities by design.
a user can save their run's craft as a user package under
`state/packages/` -- published to everyone, gm.md included (saving is
the act of publishing), the pc never riding.
- **Models are per-run over the deployment defaults.** `server.json`
names the defaults (player, housekeeper); a run's owner overrides
either role from the upstream listing -- in setup for drafts, in the
play aside for started runs. Each call resolves fresh, so a
mid-session switch simply takes the next turn.
- **Models are per-run picks of full specs.** A pick is
{provider, model, effort} -- there is no unset effort (it
substantially changes inference quality, so it is a property of the
pick, GM 2026-11-18), and the per-run sampling-knob layer is
retired: params are per-turn, the <mind> verb's alone. The
provider's default pair (the op's selection, also the refine
curator) pre-selects the create flow; a run's owner overrides
either role -- in setup for drafts, in the play aside for started
runs. Each call resolves fresh, so a mid-session switch simply
takes the next turn. A pick is invalidatable: a provider removed
from the config, a model gone from its registry, a model the
battery disqualified -- the run blocks with the note naming what
died until the GM sets it up again.
- Every logged LLM call records the acting user. Quotas and limits are
an extension point, not built.
- All dates and times are UTC everywhere. No time zones, ever.
@@ -589,35 +599,40 @@ the request returns with the question, the answer call resumes it,
and a refresh re-presents it after a restart. The old
`tool/bridge.mjs` is deleted: it never went live, and the server
reached mock-parity (2026-11-14).
Config: copy `server.example.json` to `server.json` (gitignored) -- any
OpenAI-compatible endpoint; put the key in the endpoint's `apiKey`
field or name an env var via `apiKeyEnv`; `models` names the player
and housekeeper defaults (the op's explicit pick -- it beats the
registry's discovered default), `contwin` (the context window; the old
`contextWindow` key still accepted) drives the context meter,
`params` holds the deployment-default sampling knobs per role
(temperature, top_p, top_k, repetition_penalty, max_tokens,
reasoning_effort) -- a
run carries its own overrides for models and knobs in `run.json`,
merged over the deployment layer. The five numeric knobs send only
when set (the provider's serving defaults are unknowable, so no
default is honestly nameable); reasoning_effort is the exception --
the battery measured a per-model default (the effort level with the
highest observed mean thinking), so its unset state sends that, and
an explicit null clears to nothing (the model id's baked default
applies). It is the GM's knob alone: hidden from the model, never
in the mind verb, never in the `<model>` display block -- it rides
the via record, the raw surfaces carry it. The knob UX
(web/knobs.mjs) is explicit: a per-knob override toggle (off = unset,
the input disabled; on demands a number, a level for the enum), the
definitions table
carrying every text -- label, hint, this endpoint's probed bounds --
and one shared hint bar driven by focus; unset and set-to-the-
deployment-default are distinct states, the run detail exposes the
deployment layer (`paramDefaults`), and the provider's own serving
defaults stay unstated. Above every layer sits the mind verb -- the
player's own one-shot statement for its next turn (the play protocol
above). `--mock` runs
Config is self-healing state, not a hand-edited file (GM, 2026-11-18):
the provider entities -- slug, baseUrl, optional key, the op's
default model spec -- live in `state/config.json`, written only by
the server, managed from the SPA's admin block. `server.json`
(gitignored, optional) is the static remainder: `bind` and `contwin`
(the context budget in tokens). No legacy config shapes are read:
shape changes come with one-time migrations, not permanent tolerance
(the no-legacy rule, GM, 2026-11-18). Boot always succeeds: a fresh clone with nothing comes
up serving and mints the superuser invite, and -- the self-heal
rule, broadly: an error that can be mechanically fixed to a
reasonable degree without requiring human input gets fixed -- the
empty provider list is auto-fixed by adding opencode/free (the
anonymous, keyless fallback: fixed slug and base, never carrying
auth -- a 401 from it is upstream breakage to show, not a prompt to
fix) and running its discovery in the background. The list is never
empty in lifetime either: opencode/free is removable only while
another provider stands. Custom providers add from the SPA taking
only the endpoint (a slug and a baseUrl -- never a key): discovery
runs on add and IS the probe (GM, 2026-11-19). A working keyless
listing never sees a key field; a recognizable auth refusal (401/403)
stands the provider broken and opens the key path -- the key rides
the auth route, checked on reception, saved only on success, asked
again on the next refusal; every other failure refuses the add
outright, nothing stands. The card reads the last probe outcome, and
only the explicit acts move it (add, key, remove-key, discover) --
usage errors are transient and the op's to fix, nothing auto-flips.
A keyed provider carries a remove-key control: a provider gone
public, or the first half of a replacement (the ask re-opens when
the keyless probe meets the refusal again). The housekeeper
inherits: no pick of its own means the
player spec's provider default. The mind verb stands above every
pick -- the player's own one-shot statement for its next turn (the
play protocol above), and the only params source there is.
`--mock` runs
a scripted fake model that proves the loop without a key. The SPA is
the server plus a fiction-first UI, a
GM console, and the housekeeping job runner -- and the
@@ -627,30 +642,49 @@ player-side status maintenance proves too costly for the player-model's
attention, the fallback is a dedicated status-keeper agent reading
transcripts -- same pattern as the housekeeper, smaller job.
**Model discovery** is the op's two-step act from the SPA's admin
block, and the registry it writes (`state/models.json`) is the truth
of selectable models -- a fresh deployment has none and model use is
disabled until the op acts. **Discover** scrapes the provider
surface: API metadata only, zero inference, the preliminary list.
**Refine** runs the deterministic battery over that list -- the
tool-manifest ping (the exact request shape a player turn takes; a
model that cannot take it is not an inference model and stays out of
the selectors), two reasoning samples on a fixed puzzle, the
disable-thinking probe whose working spelling is recorded as a
discovered fact, and the reasoning-effort probe: each level of the
ladder (`none` through `max`) measured for mean thinking, the
per-model default being the level with the highest observed mean
(GM, 2026-11-16: maximum thinking by default, overridable) -- then
hands the adjudicated results to the
best-measured model (repo craft: `curator.md`) for the
presentation layer: families, labels, descriptions, role
eligibility. The curator's output is strictly validated; any
failure falls back to the machine list, so discovery can never be
blocked by a bad model day. Defaults never consult the curator: the
max-reasoning rule picks them (most measured thinking, then input
ceiling, then output ceiling, then id), for both roles. Refine sends
real traffic over every listed model and is armed with the warning;
discover is free but resets a refined registry to the fresh scrape.
**Model discovery** is per provider, the op's acts from the SPA's
admin block, and the registry it writes (`state/models.json`, one
section per provider) is the truth of selectable models -- a
provider not discovered has nothing selectable. **Discover** scrapes
one provider's surface: API metadata only, zero inference, the
section written preliminary (free, but it resets a refined section
-- the battery results are re-earned by refining). **Refine** runs
the deterministic battery over that provider's list -- the
tool-manifest ping at the working effort (the exact request shape a
player turn takes; a model that cannot take it is not an inference
model and stays out of the selectors), two reasoning samples on a
fixed puzzle, the disable-thinking probe whose working spelling is
recorded as a discovered fact, and the reasoning-effort ladder
(each level measured for mean thinking) -- then hands the
adjudicated results to the op's selected default model (repo
craft: `curator.md`) for the presentation layer: families, labels,
descriptions, role eligibility, and one overall-best recommendation
{model, effort} -- intel only, shown beside the op's selection,
applied by one click, never auto-landed, and never a deterministic
stand-in on a bad model day (the op gets no advice, not machine
advice). The curator's output is strictly validated; any failure
falls back to the machine list, so refine can never be blocked by a
bad model day. The battery's measured effortDefault is pre-fill and
hint only -- nothing rides implicitly anymore (GM, 2026-11-18,
amending 2026-11-16: with effort a property of the pick, the
selection prompt pre-selects and the recommendation informs, no
silent layer). The adjudication cache (`state/refine-cache.json`)
keys each refined entry by the full spec tuples on both sides --
the probed model at the effort the deployment sends, and the
curator at its own spec (a weak curator at a low effort adjudicates
worse; reasoning effort substantially changes inference quality) --
so churn is cheap: discovery re-runs freely (opencode/free rotates
its models), and a refine that sees the same tuple reuses the
cached verdict, refreshing it in place when it re-probes. Failures
never cache (GM, 2026-11-19): a failure is the absence of a
measurement, not a measurement -- every refine re-probes the models
that failed the last one, so a transient error never pins a false
verdict, and a model that fails for real costs one cheap probe per
refine. No inference call retries itself (GM, 2026-11-19, the
universal rule): every call is user-initiated and every act has its
manual retry -- the send again, the housekeeping re-run, the refine
button; a dead curator call lands the machine-label fallback, which
is the designed outcome, not a degraded one.
## Layout
@@ -718,16 +752,23 @@ server/ the substrate: a zero-dependency node:http service
/session (raw, the audit surface), GET /table (the
play view), GET /story (the whole deliverable),
GET /carryover (the dormant preview)
provider.mjs the endpoint client (chat completions, models listing
with metadata)
provider.mjs the provider clients (one per configured entity --
chat completions, models listing with metadata; API
failures carry their HTTP status) and providerFor,
the slug-keyed routing
providers.mjs the provider entities: state/config.json (the
server-written truth), the one-time server.json
import, the opencode/free singleton (authless,
guarded removal), the self-heal auto-add
users.mjs the deployment's people: users, invites, tokens
(state/deployment.db; hashes only, spent invites
recorded forever)
discovery.mjs model discovery: the two op acts -- discover (the
metadata scrape) and refine (the deterministic
battery, the curator pass, the registry write);
state/models.json is the registry the selectors,
model routes, and the turn loop gate on
discovery.mjs model discovery, per provider: discover (the
metadata scrape, the section reset) and refine (the
battery, the curator pass, the recommendation, the
spec-keyed adjudication cache);
state/models.json is the per-provider registry the
selectors, model routes, and the turn loop gate on
bundle.mjs run context: prompt assembly (the trio system message,
the GM-message bundle, @ sigils + $ vars), the tool manifest
and its clerk dispatch (records off until
@@ -793,12 +834,12 @@ web/ the SPA -- no build, vanilla ES modules, path-routed;
log.mjs the diagnostics event log (sessionStorage, survives
refreshes; the header's "log" button)
widgets.mjs the shared factories: armedButton (the two-click
confirm), paneEditor (the status/agenda pattern),
modelsBox (per-run model selects over the listing)
knobs.mjs the sampling knobs: the definitions table (every
knob text -- label, hint, this endpoint's probed
bounds) and the per-role row with the explicit
override toggle and the shared hint bar
confirm), paneEditor (the status/agenda pattern),
modelsBox (the per-run spec picks: provider, model,
effort per role, the invalidation health line)
knobs.mjs the reasoning-effort ladder (mirrors the server's)
and the effort select -- the per-run knob rows are
retired (params are per-turn, the mind verb's alone)
transcript.mjs register rendering (speech / narration / OOC) and
the session-log entry walk (historical opening
events render as machinery); colour-only tokens,
@@ -827,21 +868,24 @@ test/ the mock smoke, kept next to the code
prose, zero-dependency imports, utc discipline, web/
static naming (never "api"), the bundle boundary,
dateless memory
server.example.json copy to server.json (gitignored) -- bind, endpoint +
key env, models, contwin, params passthrough
server.example.json copy to server.json (gitignored, optional) --
bind, contwin; the providers are SPA-managed state
db/
schema.sql entries, records, events journal (shared; the status
and agenda tables are retired -- the log is their
one truth, old runs keep dead tables, never read)
state/ per-deployment people + shared packages (gitignored):
deployment.db (users, invites), bootstrap-invite.txt,
models.json (the discovered registry -- the truth of
selectable models), packages/ (user-saved, published
to everyone)
deployment.db (users, invites), bootstrap-invite.txt,
config.json (the provider entities -- server-written,
SPA-managed), models.json (the per-provider registry
-- the truth of selectable models), refine-cache.json
(the adjudication cache), packages/ (user-saved,
published to everyone)
runs/ per-deployment run state (gitignored) -- one anonymous
id per run (carries no facts): run.json (lineage,
owner, `forked` stamp on a fork, models and params --
per-run player/housekeeper overrides and sampling
id per run (carries no facts): run.json (lineage,
owner, `forked` stamp on a fork, models -- the
per-run player/housekeeper specs; the params layer is
retired, per-turn via the mind verb), settings.json
knobs), settings.json, gm.md
(the GM's notepad), manifests/, and sessions/<n>/ per
session: session.json (phase, ready), bundle/ (the