the night rounds: the GM-input rework and the reasoning-effort knob -- the workbench renders no faces: the composer overlay and the transcript share colour-only tokens (.narration dim, .emph accent), source verbatim, asterisks tinted and kept on screen, so the input's caret can never drift (the old overlay's real bold/italic shifted advance widths -- keeping every character preserved count, not width; the scrollbar-gutter match killed the second drift source); the story view carries its OWN renderer (view-story storyBody/storySpans) -- the book keeps real bold/italic with the asterisks spent, narration italic via #story-scoped CSS, one rule for the tool and typography for the deliverable, deliberately separate; the composer is turn-shaped: rows=6 floor, field-sizing: content grows it with the turn (the thing the GM remembered Firefox doing -- it was never in use), max-height 50vh caps with internal scroll, the footer moved under the transcript's column only so the input's width is the pane's; the transcript's stick-to-bottom was DEAD CODE all along (#transcript has no height or overflow -- main is the scroller, the scrollTop assignments were no-ops in every browser): stickBottom scrolls main and re-asserts next frame (Firefox's scroll anchoring can reclaim a same-tick scroll around a content wipe), main carries overflow-anchor: none; the prose pane drops its machinery by ruling: the status/agenda chips and the retired delta tags strip (the panes carry the derived state), the reminder card never renders (it is the same every turn -- the raw tab keeps every copy), and the status/agenda note receipts (the old delta applies and the whole-list sets alike) skip the prose walk while the raw keeps them; the model dropdown collapsed to one plain list of ids sorted, ceilings riding along (the family grouping left the user guessing what a family name means, and the curator's tier labels only made sense inside their groups); and the reasoning-effort round: the battery probes the ladder (probeEfforts -- each of none/minimal/low/medium/high/xhigh/max measured for mean thinking, two samples, efforts recorded per model, effortDefault the argmax mean over minimal..max, 'none' never a candidate -- it is the off switch; null when the model shows no thinking), the knob is first-class and the GM's alone (GM, 2026-11-16: hidden from the model, not her call -- never in the mind verb, never in the <model> display block, and renderView's via-derived block filters it too, both surfaces; it rides the via record for the raw surfaces), its unset state SENDS the measured max-mean default (the one knob with an honestly nameable default -- the registry measured it; layers run override > deployment > registry per-model, explicit null clears to nothing), the first non-numeric knob (RoleParams carries the string, the /model route validates against the ladder, the knob row a select whose unset label names what rides and rebuilds on model-select change); the GLM ladder verified live by hand before the build (low suppresses to a third of baseline, max elevates about double, the whole ladder accepted on both families without 400s, and reasoning_effort 'none' doubles as a standardized thinking-off switch); the model dropdown, the composer, and the knob UX browser-proven with zero console errors (the pass caught the unreachable-helpers bug: code after a factory's return never runs, a hoisted function referencing the uninitialized const throws silently mid-fill and stale rows render); smoke ALL PASS with the effort battery (the canned mock ladders, the default riding a bare turn's via, the override riding the next turn, the bogus-level 400, the null clear, no reasoning_effort in any <model> block) + restart + reminder + repo checks green, typecheck green on both programs; ROADMAP gains the distant extension point (n-choice inference composed by a turn-editor agent) and the operator's queue moved there from QUESTIONS by the GM; HANDOFF prepared as the handoff (the typing-round bullet trimmed into the rounds list, the server line now truthful -- the debug server runs, the registry bullet carries the six-knob state and the pending-effort refine)
This commit is contained in:
@@ -137,6 +137,41 @@ memory the agent owes itself across sessions.
|
|||||||
|
|
||||||
## State pointers
|
## State pointers
|
||||||
|
|
||||||
|
- **The reasoning-effort round is BUILT (2026-11-16, late night): the
|
||||||
|
battery probes the effort ladder, the knob is first-class, hidden
|
||||||
|
from the model, and its default SENDS.** The probe (discovery.mjs
|
||||||
|
probeEfforts): each level of EFFORT_LEVELS (none/minimal/low/
|
||||||
|
medium/high/xhigh/max -- mirrored in web/knobs.mjs, keep in step)
|
||||||
|
measured for mean thinking (2 samples), efforts recorded per
|
||||||
|
model, effortDefault = the argmax mean over minimal..max ('none'
|
||||||
|
is the off switch, never a default candidate; null when the model
|
||||||
|
shows no thinking or nothing moved). The knob (GM's rulings: not
|
||||||
|
her call, hidden entirely -- never in the mind verb, never in the
|
||||||
|
<model> display block, BOTH the loop's live push and renderView's
|
||||||
|
via-derived block filter it; it rides the via record, raw shows
|
||||||
|
it): resolveEffort layers run override > deployment (server.json)
|
||||||
|
> registry per-model default, explicit null clears to nothing.
|
||||||
|
UNLIKE the numeric knobs the unset state sends -- the registry
|
||||||
|
measured the default, so it is honest. First non-numeric knob:
|
||||||
|
RoleParams carries reasoning_effort?: string, the /model route
|
||||||
|
validates against the ladder, the knob row is a select whose
|
||||||
|
unset label names what rides ('(default: max)'), and the rows
|
||||||
|
rebuild on model-select change (the effort context follows the
|
||||||
|
picked model -- modelsBox's rebuildKnobs). Lessons: the loop's
|
||||||
|
mock path hardcodes model 'mock' (resolveModel never runs under
|
||||||
|
--mock, which is why cfg's real glm-5.3 never 409s the smoke);
|
||||||
|
declare helpers BEFORE the factory's return statement -- code
|
||||||
|
after return is unreachable, a hoisted function referencing an
|
||||||
|
uninitialized const throws silently mid-fill and stale rows
|
||||||
|
render (the browser pass caught it); renderView renders the via
|
||||||
|
record as the turn's <model> block -- a second <model> surface
|
||||||
|
beyond the loop's live push, both need the effort filter. The
|
||||||
|
dv endpoint honors the ladder on the GLMs (probed live: low
|
||||||
|
suppresses to a third of baseline, max elevates ~2x), accepts
|
||||||
|
the whole ladder on both families without 400s, and
|
||||||
|
reasoning_effort 'none' doubles as a standardized thinking-off
|
||||||
|
switch. The registry on disk predates the probe -- efforts land
|
||||||
|
at the next refine (the GM's one click, post-curator-review).
|
||||||
- **The state-scan round is BUILT (2026-11-16, evening): the log is
|
- **The state-scan round is BUILT (2026-11-16, evening): the log is
|
||||||
the one truth for status and agenda, the db tiers are retired.**
|
the one truth for status and agenda, the db tiers are retired.**
|
||||||
scanState (server/session.mjs) derives each kind newest-wins
|
scanState (server/session.mjs) derives each kind newest-wins
|
||||||
@@ -177,6 +212,32 @@ memory the agent owes itself across sessions.
|
|||||||
the browser heuristically caches ES modules across reloads --
|
the browser heuristically caches ES modules across reloads --
|
||||||
after editing web/ warm them with fetch(url, {cache:'reload'})
|
after editing web/ warm them with fetch(url, {cache:'reload'})
|
||||||
from evaluate before judging the page stale or fresh.
|
from evaluate before judging the page stale or fresh.
|
||||||
|
- **The GM-input round is BUILT (2026-11-16, night): the composer
|
||||||
|
reads like a turn, the tokens are colour-only, the stick-to-bottom
|
||||||
|
works.** The overlay's real bold/italic faces shifted advance
|
||||||
|
widths and dragged the caret (the "every character stays" trick
|
||||||
|
preserved count, not width) -- the ruling: no faces on the
|
||||||
|
workbench at all. One rule, colour-only, source verbatim
|
||||||
|
(asterisks tinted, kept on screen): the input overlay and the
|
||||||
|
transcript share the same token classes (.narration dim,
|
||||||
|
.emph accent), zero drift by construction; the scrollbar-gutter
|
||||||
|
match killed the second drift source (the textarea's gutter
|
||||||
|
appearing on scroll while the pre had overflow hidden). The story
|
||||||
|
view got its OWN renderer (view-story.mjs storyBody/storySpans):
|
||||||
|
the book keeps real faces, asterisks spent, narration italic via
|
||||||
|
#story-scoped CSS -- one rule for the tool, typography for the
|
||||||
|
deliverable, deliberately separate. The composer: rows=6 floor,
|
||||||
|
field-sizing: content grows it with the turn, max-height 50vh
|
||||||
|
caps with internal scroll (rows is the no-support fallback --
|
||||||
|
field-sizing is the thing the GM remembered Firefox doing; it
|
||||||
|
wasn't in use, now it is). The footer moved under the transcript's
|
||||||
|
column only (the input's width is the pane's width), padding
|
||||||
|
aligned to main's. The pane stick-to-bottom was DEAD CODE all
|
||||||
|
along: #transcript has no height/overflow (main is the scroller),
|
||||||
|
so scrollTop assignments on it were no-ops in every browser --
|
||||||
|
stickBottom() now scrolls main, re-asserts on the next frame
|
||||||
|
(Firefox's scroll anchoring can reclaim a same-tick scroll around
|
||||||
|
a content wipe), main carries overflow-anchor: none.
|
||||||
- **The 2026-11-16 rounds are built and live-proven: the
|
- **The 2026-11-16 rounds are built and live-proven: the
|
||||||
play-protocol batch and model discovery.** The protocol batch: OOC
|
play-protocol batch and model discovery.** The protocol batch: OOC
|
||||||
GM turns (paren-led, post-expansion) carry no status/agenda blocks;
|
GM turns (paren-led, post-expansion) carry no status/agenda blocks;
|
||||||
|
|||||||
+43
-24
@@ -9,18 +9,8 @@ file is the "where did we leave off" map.
|
|||||||
|
|
||||||
## Where we are
|
## Where we are
|
||||||
|
|
||||||
- **The JSDoc typing round is COMPLETE, all four phases (2026-11-15,
|
- **Everything is built, proven, and committed (through the
|
||||||
through `8d4a6b9`): the server core (`f81b188`), the clerk, and
|
2026-11-16 night rounds -- see the git log).** The
|
||||||
web/.** tsc runs as a no-emit checker over plain `.mjs` with JSDoc
|
|
||||||
annotations (`npm run typecheck` -- two programs: `tsconfig.json`
|
|
||||||
for server + tool, `tsconfig.web.json` for the SPA's DOM libs);
|
|
||||||
the shared shapes live in `server/shapes.mjs`, the db row shapes
|
|
||||||
local to their owners, the SPA's response envelopes in
|
|
||||||
`web/shapes.mjs`. The audit lists live in the commit messages;
|
|
||||||
the type gate and its working lessons live in AGENTS.
|
|
||||||
|
|
||||||
- **Everything is built, proven, and committed (through `8d4a6b9`,
|
|
||||||
2026-11-15, plus the 2026-11-16 rounds -- see the git log).** The
|
|
||||||
full scope, each round mock-proven end to end and live-proven
|
full scope, each round mock-proven end to end and live-proven
|
||||||
where live could reach: the MVP substrate (clerk, server,
|
where live could reach: the MVP substrate (clerk, server,
|
||||||
housekeeping job, SPA), multiuser (token identity, invites, fork,
|
housekeeping job, SPA), multiuser (token identity, invites, fork,
|
||||||
@@ -63,7 +53,22 @@ file is the "where did we leave off" map.
|
|||||||
the state note at the carry head (the resume-reconcile skips
|
the state note at the carry head (the resume-reconcile skips
|
||||||
it); the start gate's n=1 seeding died (her authored opening
|
it); the start gate's n=1 seeding died (her authored opening
|
||||||
turn IS the seed); continuation carryovers are writable in the
|
turn IS the seed); continuation carryovers are writable in the
|
||||||
file editor during dormancy. The design record lives in README /
|
file editor during dormancy), and the GM-input round (2026-11-16,
|
||||||
|
night): the workbench renders no faces -- the composer overlay and
|
||||||
|
the transcript share colour-only tokens, source verbatim (the
|
||||||
|
caret-drift died with the faces), the story view carries its own
|
||||||
|
renderer (the book keeps bold/italic, asterisks spent), the
|
||||||
|
composer is turn-shaped (six-line floor, field-sizing growth,
|
||||||
|
50vh cap, the input's width is the pane's), and the transcript's
|
||||||
|
stick-to-bottom actually scrolls now (it was dead code -- main is
|
||||||
|
the scroller, not the div), and the reasoning-effort round
|
||||||
|
(2026-11-16, late night): the battery probes the effort ladder
|
||||||
|
per model (efforts + effortDefault in the registry), the knob is
|
||||||
|
first-class and the GM's alone -- hidden from the model (never in
|
||||||
|
the mind verb, never in the <model> block, riding the via record
|
||||||
|
for the raw surfaces), its unset state sends the measured
|
||||||
|
max-mean default, explicit null clears, the knob row a select
|
||||||
|
that follows the picked model. The design record lives in README /
|
||||||
DICTIONARY / ROADMAP; the build history in the git log.
|
DICTIONARY / ROADMAP; the build history in the git log.
|
||||||
- **The project is named: Tiny Worlds.** The invariant it names is
|
- **The project is named: Tiny Worlds.** The invariant it names is
|
||||||
stated in README's premise -- each package is a tiny world on
|
stated in README's premise -- each package is a tiny world on
|
||||||
@@ -99,9 +104,12 @@ file is the "where did we leave off" map.
|
|||||||
deterministic battery + the curator pass), the registry
|
deterministic battery + the curator pass), the registry
|
||||||
(state/models.json -- the truth of selectable models; a fresh
|
(state/models.json -- the truth of selectable models; a fresh
|
||||||
deployment has none and model use is disabled), registry-gated
|
deployment has none and model use is disabled), registry-gated
|
||||||
model routes and turn loop, and the five named knobs
|
model routes and turn loop, and the named knobs per
|
||||||
(temperature, top_p, top_k, repetition_penalty, max_tokens) per
|
role, run layer over deployment layer -- the five numeric ones
|
||||||
role, run layer over deployment layer, sent only when set.
|
(temperature, top_p, top_k, repetition_penalty, max_tokens) sent
|
||||||
|
only when set, plus reasoning_effort (2026-11-16, late night --
|
||||||
|
the sixth, an enum whose unset state sends the measured default;
|
||||||
|
see the rounds bullet above).
|
||||||
Live-verified against the real endpoint across three refine runs:
|
Live-verified against the real endpoint across three refine runs:
|
||||||
gev fails the tool probe and drops (capability detection, no
|
gev fails the tool probe and drops (capability detection, no
|
||||||
names in code), off-switch spellings verified per model, the
|
names in code), off-switch spellings verified per model, the
|
||||||
@@ -120,13 +128,16 @@ file is the "where did we leave off" map.
|
|||||||
(mock / mock-tie, same bucket, same windows) and the smoke asserts
|
(mock / mock-tie, same bucket, same windows) and the smoke asserts
|
||||||
the lex-bottom pick. The on-disk registry still names glm-5.2-max
|
the lex-bottom pick. The on-disk registry still names glm-5.2-max
|
||||||
as its default (the coin-flip run) -- inert while server.json
|
as its default (the coin-flip run) -- inert while server.json
|
||||||
pins its own pick, and the next refine re-picks deterministically
|
pins its own pick; the next refine re-picks deterministically
|
||||||
(glm-5.3-max, the lex bottom). PENDING: the curator.md review
|
(glm-5.3-max, the lex bottom) and brings the effort measurements
|
||||||
|
(the registry predates the probe). PENDING: the curator.md review
|
||||||
(GM-led, the housekeeper.md precedent).
|
(GM-led, the housekeeper.md precedent).
|
||||||
- **The server is stopped; state/ holds only the registry**
|
- **The server runs in debug mode** (the GM's session:
|
||||||
(models.json, the alias-aware curated run). The auth side is
|
`node server/main.mjs --debug` -- auth bypassed, loopback-bound).
|
||||||
pristine -- no users, so the next start mints the real bootstrap
|
state/ holds the registry (models.json, the alias-aware curated
|
||||||
invite to state/bootstrap-invite.txt and the console.
|
run) plus the debug boot's bootstrap-invite mint (no user ever
|
||||||
|
claimed; the first NORMAL start mints the real bootstrap invite
|
||||||
|
to state/bootstrap-invite.txt and the console).
|
||||||
|
|
||||||
## Immediate next steps, in order
|
## Immediate next steps, in order
|
||||||
|
|
||||||
@@ -166,7 +177,10 @@ file is the "where did we leave off" map.
|
|||||||
calibration), and whether she ever states a `<mind>`. The
|
calibration), and whether she ever states a `<mind>`. The
|
||||||
override's own watchable: whether a GM block edit reads as her
|
override's own watchable: whether a GM block edit reads as her
|
||||||
state to her (it must -- the composition is the design) and
|
state to her (it must -- the composition is the design) and
|
||||||
whether she adopts or fights it on her next emission.
|
whether she adopts or fights it on her next emission. The
|
||||||
|
effort knob's watchable: whether max-effort changes her texture
|
||||||
|
and her cost curve -- the first knob that changes how much she
|
||||||
|
thinks, not how she samples.
|
||||||
Variantary: the metric's curve (`/story` variance -- how often,
|
Variantary: the metric's curve (`/story` variance -- how often,
|
||||||
how many candidates), coin-flip personality (choices offloaded
|
how many candidates), coin-flip personality (choices offloaded
|
||||||
to chance that should be character), and whether her variants
|
to chance that should be character), and whether her variants
|
||||||
@@ -180,7 +194,12 @@ file is the "where did we leave off" map.
|
|||||||
- **A knob riding a real request** -- the knobs, their explicit-override
|
- **A knob riding a real request** -- the knobs, their explicit-override
|
||||||
UX, and the request recording are smoke- and browser-proven, but no
|
UX, and the request recording are smoke- and browser-proven, but no
|
||||||
live turn has carried one; the max-reasoning defaults are likewise
|
live turn has carried one; the max-reasoning defaults are likewise
|
||||||
unplayed (Chloe runs -high; no turn has run on a -max model).
|
unplayed (Chloe runs -high; no turn has run on a -max model). The
|
||||||
|
effort knob doubly so: the registry on disk predates the probe, so
|
||||||
|
no live turn has carried reasoning_effort either -- the first
|
||||||
|
refine (the op's one click, post-curator-review) brings the
|
||||||
|
measured defaults, and the GLM ladder is already verified live by
|
||||||
|
hand (low suppresses, max elevates).
|
||||||
- **The full-block protocol against a live model** -- whole-list
|
- **The full-block protocol against a live model** -- whole-list
|
||||||
emission, the stamping, the `<model>` blocks, and whether she ever
|
emission, the stamping, the `<model>` blocks, and whether she ever
|
||||||
states a `<mind>` are all unexercised live; Chloe's session two
|
states a `<mind>` are all unexercised live; Chloe's session two
|
||||||
|
|||||||
@@ -6,16 +6,6 @@ the reasoning as written) is DECISIONS.md, keyed by the same numbers;
|
|||||||
durable decisions also graduate into README.md, ROADMAP.md,
|
durable decisions also graduate into README.md, ROADMAP.md,
|
||||||
DICTIONARY.md, or the prompts. Tiered by urgency, FIFO within a tier.
|
DICTIONARY.md, or the prompts. Tiered by urgency, FIFO within a tier.
|
||||||
|
|
||||||
## Operator's queue (don't edit, don't work on)
|
|
||||||
|
|
||||||
- what's the "n" parameter?
|
|
||||||
- the model tends to summarise GM's turns or quote from them
|
|
||||||
- italics is cursed in the editor
|
|
||||||
- calibration package: escape room
|
|
||||||
- calibration package: the detention
|
|
||||||
- user manual
|
|
||||||
- session rewind
|
|
||||||
|
|
||||||
## Open
|
## Open
|
||||||
|
|
||||||
### 16. Housekeeping model configuration -- OPEN (mechanism settled)
|
### 16. Housekeeping model configuration -- OPEN (mechanism settled)
|
||||||
|
|||||||
@@ -554,11 +554,21 @@ and housekeeper defaults (the op's explicit pick -- it beats the
|
|||||||
registry's discovered default), `contwin` (the context window; the old
|
registry's discovered default), `contwin` (the context window; the old
|
||||||
`contextWindow` key still accepted) drives the context meter,
|
`contextWindow` key still accepted) drives the context meter,
|
||||||
`params` holds the deployment-default sampling knobs per role
|
`params` holds the deployment-default sampling knobs per role
|
||||||
(temperature, top_p, top_k, repetition_penalty, max_tokens) -- a
|
(temperature, top_p, top_k, repetition_penalty, max_tokens,
|
||||||
|
reasoning_effort) -- a
|
||||||
run carries its own overrides for models and knobs in `run.json`,
|
run carries its own overrides for models and knobs in `run.json`,
|
||||||
merged over the deployment layer, sent only when set. The knob UX
|
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,
|
(web/knobs.mjs) is explicit: a per-knob override toggle (off = unset,
|
||||||
the input disabled; on demands a number), the definitions table
|
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 --
|
carrying every text -- label, hint, this endpoint's probed bounds --
|
||||||
and one shared hint bar driven by focus; unset and set-to-the-
|
and one shared hint bar driven by focus; unset and set-to-the-
|
||||||
deployment-default are distinct states, the run detail exposes the
|
deployment-default are distinct states, the run detail exposes the
|
||||||
@@ -583,9 +593,13 @@ surface: API metadata only, zero inference, the preliminary list.
|
|||||||
**Refine** runs the deterministic battery over that list -- the
|
**Refine** runs the deterministic battery over that list -- the
|
||||||
tool-manifest ping (the exact request shape a player turn takes; a
|
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
|
model that cannot take it is not an inference model and stays out of
|
||||||
the selectors), two reasoning samples on a fixed puzzle, and the
|
the selectors), two reasoning samples on a fixed puzzle, the
|
||||||
disable-thinking probe whose working spelling is recorded as a
|
disable-thinking probe whose working spelling is recorded as a
|
||||||
discovered fact -- then hands the adjudicated results to the
|
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
|
best-measured model (repo craft: `curator.md`) for the
|
||||||
presentation layer: families, labels, descriptions, role
|
presentation layer: families, labels, descriptions, role
|
||||||
eligibility. The curator's output is strictly validated; any
|
eligibility. The curator's output is strictly validated; any
|
||||||
@@ -740,8 +754,10 @@ web/ the SPA -- no build, vanilla ES modules, path-routed;
|
|||||||
override toggle and the shared hint bar
|
override toggle and the shared hint bar
|
||||||
transcript.mjs register rendering (speech / narration / OOC) and
|
transcript.mjs register rendering (speech / narration / OOC) and
|
||||||
the session-log entry walk (historical opening
|
the session-log entry walk (historical opening
|
||||||
events render as machinery); renderContent is shared with the
|
events render as machinery); colour-only tokens,
|
||||||
story view
|
source verbatim -- the workbench renders no faces
|
||||||
|
(the book does: the story view carries its own
|
||||||
|
renderer)
|
||||||
view-*.mjs one module per view -- claim, home, new, setup, play
|
view-*.mjs one module per view -- claim, home, new, setup, play
|
||||||
(the table), story (the whole deliverable, read-only)
|
(the table), story (the whole deliverable, read-only)
|
||||||
-- each owning its elements, its state, and its wiring
|
-- each owning its elements, its state, and its wiring
|
||||||
|
|||||||
+28
@@ -4,6 +4,16 @@ Reviewed 2026-11-11 via web survey: consumer companion apps, power
|
|||||||
frontends, agent RP frameworks, memory research. Items below are meant to
|
frontends, agent RP frameworks, memory research. Items below are meant to
|
||||||
be worked through one by one; statuses in caps, decisions dated.
|
be worked through one by one; statuses in caps, decisions dated.
|
||||||
|
|
||||||
|
## Operator's queue (don't edit, don't work on)
|
||||||
|
|
||||||
|
- the model tends to summarise GM's turns or quote from them
|
||||||
|
- teach the model to stop using italics for emphasis
|
||||||
|
- revisit what fetch does and SPA reactivity
|
||||||
|
- calibration package: escape room
|
||||||
|
- calibration package: the detention
|
||||||
|
- user manual
|
||||||
|
- session rewind
|
||||||
|
|
||||||
## The landscape (what exists, as of the review)
|
## The landscape (what exists, as of the review)
|
||||||
|
|
||||||
| Family | Exemplars | Memory approach |
|
| Family | Exemplars | Memory approach |
|
||||||
@@ -518,6 +528,24 @@ duplicate handbook cut is the GM's red pen).
|
|||||||
dormancy) but has no editing surface yet; the dormant view renders
|
dormancy) but has no editing surface yet; the dormant view renders
|
||||||
it raw, read-only. The proper editor is its own task.
|
it raw, read-only. The proper editor is its own task.
|
||||||
|
|
||||||
|
## Distant extension points (someday, not scheduled)
|
||||||
|
|
||||||
|
- **n-choice inference composed by a turn-editor agent.** The
|
||||||
|
provider's `n` parameter asks for several statistically independent
|
||||||
|
completions of the same prompt -- the same moment re-rolled by the
|
||||||
|
dice, where variant literature is her deliberate alternatives. The
|
||||||
|
composition: request n choices, hand them to a turn-editor agent
|
||||||
|
that splices/edits them into the one turn that lands. Open
|
||||||
|
questions if it ever earns a keep: who edits (the agent's brief,
|
||||||
|
the GM's veto), what the log keeps (every choice belongs on the
|
||||||
|
raw surface, and the variance metric wants them -- today the loop
|
||||||
|
reads choices[0] only), cost (every choice bills its completion
|
||||||
|
tokens), provider support (patchy outside the first-party APIs --
|
||||||
|
the discovery battery would need to probe it), and the knob
|
||||||
|
surface (`n` is not a named knob; whose is it to set?). Until
|
||||||
|
then, variant literature plus the crypto pick is the ruled
|
||||||
|
mechanism for chance in play.
|
||||||
|
|
||||||
## Rejected, with reasons
|
## Rejected, with reasons
|
||||||
|
|
||||||
- **Keyword-triggered lorebook injection** -- push pollutes context and
|
- **Keyword-triggered lorebook injection** -- push pollutes context and
|
||||||
|
|||||||
+47
-6
@@ -113,6 +113,12 @@ export async function discover(ctx) {
|
|||||||
|
|
||||||
// --- step two: refine (the battery + the curator) -----------------------------
|
// --- step two: refine (the battery + the curator) -----------------------------
|
||||||
|
|
||||||
|
// the reasoning-effort ladder: the spellings the OpenAI-compatible
|
||||||
|
// world agrees on. `none` doubles as the standardized thinking-off
|
||||||
|
// switch. Mirrored in web/knobs.mjs for the select -- keep them in
|
||||||
|
// step.
|
||||||
|
export const EFFORT_LEVELS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
||||||
|
|
||||||
/** One model's measured thinking under given request params.
|
/** One model's measured thinking under given request params.
|
||||||
* @param {Ctx} ctx @param {string} id @param {Record<string, unknown>} params @returns {Promise<number>} */
|
* @param {Ctx} ctx @param {string} id @param {Record<string, unknown>} params @returns {Promise<number>} */
|
||||||
async function thinkingTokens(ctx, id, params) {
|
async function thinkingTokens(ctx, id, params) {
|
||||||
@@ -120,9 +126,32 @@ async function thinkingTokens(ctx, id, params) {
|
|||||||
return Number(data.usage?.completion_tokens_details?.reasoning_tokens ?? 0);
|
return Number(data.usage?.completion_tokens_details?.reasoning_tokens ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The reasoning-effort probe: each level's measured mean thinking
|
||||||
|
* (two samples, the battery's granularity). The default is the
|
||||||
|
* level with the highest observed mean -- `none` is never a
|
||||||
|
* candidate, it is the off switch, not a thinking level (GM,
|
||||||
|
* 2026-11-16: maximum observable thinking by default, overridable
|
||||||
|
* by the user). A model that shows no thinking, or that no level
|
||||||
|
* moves, gets null -- nothing rides.
|
||||||
|
* @param {Ctx} ctx @param {string} id @returns {Promise<{ efforts: Record<string, number>, effortDefault: ?string }>} */
|
||||||
|
async function probeEfforts(ctx, id) {
|
||||||
|
/** @type {Record<string, number>} */ const efforts = {};
|
||||||
|
for (const level of EFFORT_LEVELS) {
|
||||||
|
const xs = [];
|
||||||
|
for (let i = 0; i < 2; i++) {
|
||||||
|
try { xs.push(await thinkingTokens(ctx, id, { reasoning_effort: level })); } catch { xs.push(0); }
|
||||||
|
}
|
||||||
|
efforts[level] = Math.round(xs.reduce((a, b) => a + b, 0) / xs.length);
|
||||||
|
}
|
||||||
|
const candidates = EFFORT_LEVELS.filter((l) => l !== 'none');
|
||||||
|
const best = candidates.reduce((acc, l) => (efforts[l] > efforts[acc] ? l : acc), candidates[0]);
|
||||||
|
return { efforts, effortDefault: efforts[best] > 0 ? best : null };
|
||||||
|
}
|
||||||
|
|
||||||
/** The deterministic battery over one model: the tool ping (the
|
/** The deterministic battery over one model: the tool ping (the
|
||||||
* exact request shape a player turn takes), the reasoning samples,
|
* exact request shape a player turn takes), the reasoning samples,
|
||||||
* the off-switch probe. Every failure is a verdict, never an abort.
|
* the off-switch probe, the effort ladder. Every failure is a
|
||||||
|
* verdict, never an abort.
|
||||||
* @param {Ctx} ctx @param {RegistryModel} m @returns {Promise<RegistryModel>} */
|
* @param {Ctx} ctx @param {RegistryModel} m @returns {Promise<RegistryModel>} */
|
||||||
async function probeOne(ctx, m) {
|
async function probeOne(ctx, m) {
|
||||||
const base = { ...m };
|
const base = { ...m };
|
||||||
@@ -131,17 +160,21 @@ async function probeOne(ctx, m) {
|
|||||||
// the canned battery: all three stand-ins are inference models;
|
// the canned battery: all three stand-ins are inference models;
|
||||||
// mock and mock-tie are a deliberate tie pair (same deep bucket,
|
// mock and mock-tie are a deliberate tie pair (same deep bucket,
|
||||||
// same windows -- only the lex rule can part them), the cheap
|
// same windows -- only the lex rule can part them), the cheap
|
||||||
// tier standard
|
// tier standard. The canned effort ladders exercise both shapes:
|
||||||
|
// the full ladder with max on top, and a capped ladder whose
|
||||||
|
// default is high
|
||||||
return m.id === 'mock-cheap'
|
return m.id === 'mock-cheap'
|
||||||
? { ...base, inference: true, think: 120, reasoning: 'standard', offSwitch: null, latency: 5 }
|
? { ...base, inference: true, think: 120, reasoning: 'standard', offSwitch: null, latency: 5,
|
||||||
: { ...base, inference: true, think: 300, reasoning: 'deep', offSwitch: null, latency: 7 };
|
efforts: { none: 0, minimal: 20, low: 60, medium: 90, high: 120 }, effortDefault: 'high' }
|
||||||
|
: { ...base, inference: true, think: 300, reasoning: 'deep', offSwitch: null, latency: 7,
|
||||||
|
efforts: { none: 0, minimal: 40, low: 100, medium: 200, high: 300, xhigh: 400, max: 500 }, effortDefault: 'max' };
|
||||||
}
|
}
|
||||||
const t0 = Date.now();
|
const t0 = Date.now();
|
||||||
try {
|
try {
|
||||||
await ctx.provider.chat(m.id, [{ role: 'user', content: 'Say OK.' }], [ASK_GM_TOOL], { max_tokens: 400 });
|
await ctx.provider.chat(m.id, [{ role: 'user', content: 'Say OK.' }], [ASK_GM_TOOL], { max_tokens: 400 });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const fail = String(e.message ?? e).split('\n')[0].slice(0, 200);
|
const fail = String(e.message ?? e).split('\n')[0].slice(0, 200);
|
||||||
return { ...base, inference: false, fail, reasoning: null, offSwitch: null, latency: Date.now() - t0 };
|
return { ...base, inference: false, fail, reasoning: null, offSwitch: null, efforts: null, effortDefault: null, latency: Date.now() - t0 };
|
||||||
}
|
}
|
||||||
const latency = Date.now() - t0;
|
const latency = Date.now() - t0;
|
||||||
const samples = [];
|
const samples = [];
|
||||||
@@ -157,7 +190,14 @@ async function probeOne(ctx, m) {
|
|||||||
}
|
}
|
||||||
} catch { /* no off switch -- recorded as absent */ }
|
} catch { /* no off switch -- recorded as absent */ }
|
||||||
}
|
}
|
||||||
return { ...base, inference: true, think, reasoning: bucket(think), offSwitch, latency };
|
/** @type {Record<string, number>|null} */ let efforts = null;
|
||||||
|
/** @type {?string} */ let effortDefault = null;
|
||||||
|
if (think > 0) {
|
||||||
|
try {
|
||||||
|
({ efforts, effortDefault } = await probeEfforts(ctx, m.id));
|
||||||
|
} catch { /* the ladder is optional knowledge -- absent on a flaky endpoint */ }
|
||||||
|
}
|
||||||
|
return { ...base, inference: true, think, reasoning: bucket(think), offSwitch, efforts, effortDefault, latency };
|
||||||
}
|
}
|
||||||
|
|
||||||
// the pick rule, deterministic: the deepest reasoning bucket, then
|
// the pick rule, deterministic: the deepest reasoning bucket, then
|
||||||
@@ -199,6 +239,7 @@ async function curate(ctx, probed, best, user) {
|
|||||||
const facts = probed.map((m) => ({
|
const facts = probed.map((m) => ({
|
||||||
id: m.id, input: m.input, output: m.output, inference: m.inference ?? false,
|
id: m.id, input: m.input, output: m.output, inference: m.inference ?? false,
|
||||||
fail: m.fail ?? null, reasoning: m.reasoning ?? null, hasOffSwitch: !!m.offSwitch, latencyMs: m.latency ?? null,
|
fail: m.fail ?? null, reasoning: m.reasoning ?? null, hasOffSwitch: !!m.offSwitch, latencyMs: m.latency ?? null,
|
||||||
|
effortDefault: m.effortDefault ?? null,
|
||||||
}));
|
}));
|
||||||
const messages = /** @type {import('./shapes.mjs').ViewMessage[]} */ ([
|
const messages = /** @type {import('./shapes.mjs').ViewMessage[]} */ ([
|
||||||
{ role: 'system', content: fs.readFileSync(CURATOR_PROMPT, 'utf8').trim() },
|
{ role: 'system', content: fs.readFileSync(CURATOR_PROMPT, 'utf8').trim() },
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import {
|
|||||||
latestSession, sessionMeta, sessionDir, listSessions, loadSession, stopSession, writeMeta,
|
latestSession, sessionMeta, sessionDir, listSessions, loadSession, stopSession, writeMeta,
|
||||||
} from './session.mjs';
|
} from './session.mjs';
|
||||||
import { effectiveContents } from './variants.mjs';
|
import { effectiveContents } from './variants.mjs';
|
||||||
import { HttpError, resolveParams } from './loop.mjs';
|
import { HttpError, resolveParams, resolveEffort } from './loop.mjs';
|
||||||
import { registry, usable } from './discovery.mjs';
|
import { registry, usable } from './discovery.mjs';
|
||||||
|
|
||||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||||
@@ -243,7 +243,11 @@ async function callHousekeeper(ctx, runId, messages, user) {
|
|||||||
if (!usable(reg, model)) {
|
if (!usable(reg, model)) {
|
||||||
throw new Error(`model '${model}' is not in the deployment's model registry${reg ? ' (or failed the inference probe)' : ' -- the op has not run discovery yet'}`);
|
throw new Error(`model '${model}' is not in the deployment's model registry${reg ? ' (or failed the inference probe)' : ' -- the op has not run discovery yet'}`);
|
||||||
}
|
}
|
||||||
const params = resolveParams(ctx, runId, 'housekeeper');
|
const params = { ...resolveParams(ctx, runId, 'housekeeper') };
|
||||||
|
// the effort knob's own layers (its unset state sends the
|
||||||
|
// registry's measured default for this model)
|
||||||
|
const effort = resolveEffort(ctx, runId, 'housekeeper', model);
|
||||||
|
if (effort !== null) params.reasoning_effort = effort;
|
||||||
// attribution (#22): every LLM call names the acting user
|
// attribution (#22): every LLM call names the acting user
|
||||||
console.log(`${new Date().toISOString().slice(11, 19)} llm ${model} u:${user?.id ?? '?'}`);
|
console.log(`${new Date().toISOString().slice(11, 19)} llm ${model} u:${user?.id ?? '?'}`);
|
||||||
const data = await ctx.provider.chat(model, messages, undefined, params);
|
const data = await ctx.provider.chat(model, messages, undefined, params);
|
||||||
|
|||||||
+37
-9
@@ -129,15 +129,26 @@ async function runLoop(ctx, runId, user) {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
const view = renderView(s);
|
const view = renderView(s);
|
||||||
// the request's resolved params: the mind layer rides over the
|
// the request's resolved params: the mind layer rides over the
|
||||||
// run and deployment layers. The current call's <model> block
|
// run and deployment layers, the effort knob resolves its own
|
||||||
// shows them to her when anything is set -- nothing set means no
|
// layers (its unset state sends the registry's measured default).
|
||||||
// block (the absent grammar); the via record lands the same truth
|
// The current call's <model> block shows her the knobs that are
|
||||||
|
// hers to answer with <mind> -- reasoning_effort is filtered out
|
||||||
|
// (hidden from the model, GM 2026-11-16: not her call); nothing
|
||||||
|
// set means no block (the absent grammar); the via record lands
|
||||||
|
// the same truth unfiltered, the raw surfaces carry it
|
||||||
|
/** @type {string} */ let model;
|
||||||
|
if (ctx.mock) model = 'mock';
|
||||||
|
else model = resolveModel(ctx, runId);
|
||||||
const params = { ...resolveParams(ctx, runId, 'player'), ...(s.mind ?? {}) };
|
const params = { ...resolveParams(ctx, runId, 'player'), ...(s.mind ?? {}) };
|
||||||
if (Object.keys(params).length) {
|
const effort = resolveEffort(ctx, runId, 'player', model);
|
||||||
view.push({ role: 'system', content: `<model>${JSON.stringify(params)}</model>` });
|
if (effort !== null) params.reasoning_effort = effort;
|
||||||
|
const shown = { ...params };
|
||||||
|
delete shown.reasoning_effort;
|
||||||
|
if (Object.keys(shown).length) {
|
||||||
|
view.push({ role: 'system', content: `<model>${JSON.stringify(shown)}</model>` });
|
||||||
}
|
}
|
||||||
let msg;
|
let msg;
|
||||||
/** @type {{ model: string, params: Record<string, number> }} */ let via;
|
/** @type {{ model: string, params: import('./shapes.mjs').RoleParams }} */ let via;
|
||||||
if (ctx.mock) {
|
if (ctx.mock) {
|
||||||
// the synthetic marker: no provider call happens, but the knobs
|
// the synthetic marker: no provider call happens, but the knobs
|
||||||
// resolve for real (the mind layer included), so the smoke can
|
// resolve for real (the mind layer included), so the smoke can
|
||||||
@@ -145,7 +156,6 @@ async function runLoop(ctx, runId, user) {
|
|||||||
msg = mockModel(s, view);
|
msg = mockModel(s, view);
|
||||||
via = { model: 'mock', params };
|
via = { model: 'mock', params };
|
||||||
} else {
|
} else {
|
||||||
const model = resolveModel(ctx, runId);
|
|
||||||
via = { model, params };
|
via = { model, params };
|
||||||
// attribution (#22): every LLM call names the acting user
|
// attribution (#22): every LLM call names the acting user
|
||||||
console.log(`${new Date().toISOString().slice(11, 19)} llm ${model} u:${user?.id ?? '?'}`);
|
console.log(`${new Date().toISOString().slice(11, 19)} llm ${model} u:${user?.id ?? '?'}`);
|
||||||
@@ -275,7 +285,7 @@ function resolveModel(ctx, runId) {
|
|||||||
|
|
||||||
/** The effective sampling knobs for a role: the deployment default
|
/** The effective sampling knobs for a role: the deployment default
|
||||||
* layer (server.json params) under the run's own overrides. */
|
* layer (server.json params) under the run's own overrides. */
|
||||||
/** @param {Ctx} ctx @param {string} runId @param {'player'|'housekeeper'} role @returns {Record<string, number>} */
|
/** @param {Ctx} ctx @param {string} runId @param {'player'|'housekeeper'} role @returns {import('./shapes.mjs').RoleParams} */
|
||||||
function resolveParams(ctx, runId, role) {
|
function resolveParams(ctx, runId, role) {
|
||||||
const meta = ctx.runMeta(runId) ?? /** @type {import('./shapes.mjs').RunMeta} */ ({});
|
const meta = ctx.runMeta(runId) ?? /** @type {import('./shapes.mjs').RunMeta} */ ({});
|
||||||
return {
|
return {
|
||||||
@@ -283,7 +293,25 @@ function resolveParams(ctx, runId, role) {
|
|||||||
...(meta.params?.[role] ?? {}),
|
...(meta.params?.[role] ?? {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export { resolveModel, resolveParams };
|
|
||||||
|
// The reasoning-effort knob's own resolution (GM, 2026-11-16): unlike
|
||||||
|
// the numeric knobs its unset state SENDS -- the registry measured a
|
||||||
|
// default, so one honestly exists. Layers: the run's override, then
|
||||||
|
// the deployment layer (server.json params), then the registry's
|
||||||
|
// per-model pick -- the level with the highest observed mean
|
||||||
|
// thinking. An explicit null clears the layers: nothing rides, the
|
||||||
|
// model id's baked default applies. Hidden from the model entirely:
|
||||||
|
// never in the mind verb, never in the <model> display block -- it
|
||||||
|
// rides the via record, the raw surfaces carry it.
|
||||||
|
/** @param {Ctx} ctx @param {string} runId @param {'player'|'housekeeper'} role @param {string} model @returns {?string} */
|
||||||
|
function resolveEffort(ctx, runId, role, model) {
|
||||||
|
const meta = ctx.runMeta(runId) ?? /** @type {import('./shapes.mjs').RunMeta} */ ({});
|
||||||
|
const set = meta.params?.[role]?.reasoning_effort ?? ctx.cfg.params?.[role]?.reasoning_effort ?? undefined;
|
||||||
|
if (set !== undefined) return set === null ? null : String(set);
|
||||||
|
const m = registry()?.models.find((x) => x.id === model);
|
||||||
|
return m?.effortDefault ?? null;
|
||||||
|
}
|
||||||
|
export { resolveModel, resolveParams, resolveEffort };
|
||||||
|
|
||||||
// --- the mind verb ------------------------------------------------------------
|
// --- the mind verb ------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|||||||
+14
-3
@@ -603,8 +603,10 @@ route('POST', '/api/runs/:id/vars', async ({ params, body, user }) => {
|
|||||||
// pick), selected from the registry (GET /api/models). Owner-only,
|
// pick), selected from the registry (GET /api/models). Owner-only,
|
||||||
// changeable at any time -- every call resolves fresh, so a
|
// changeable at any time -- every call resolves fresh, so a
|
||||||
// mid-session switch simply takes the next turn. null clears a role
|
// mid-session switch simply takes the next turn. null clears a role
|
||||||
// back to its deployment default; a null knob clears the knob.
|
// back to its deployment default; a null knob clears the knob (for
|
||||||
const KNOBS = ['temperature', 'top_p', 'top_k', 'repetition_penalty', 'max_tokens'];
|
// reasoning_effort, clearing means the registry's measured default
|
||||||
|
// rides again).
|
||||||
|
const KNOBS = ['temperature', 'top_p', 'top_k', 'repetition_penalty', 'max_tokens', 'reasoning_effort'];
|
||||||
route('POST', '/api/runs/:id/model', async ({ params, body, user }) => {
|
route('POST', '/api/runs/:id/model', async ({ params, body, user }) => {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
bundle.requireRun(id);
|
bundle.requireRun(id);
|
||||||
@@ -640,6 +642,14 @@ route('POST', '/api/runs/:id/model', async ({ params, body, user }) => {
|
|||||||
}
|
}
|
||||||
for (const [k, v] of Object.entries(knobs)) {
|
for (const [k, v] of Object.entries(knobs)) {
|
||||||
if (!KNOBS.includes(k)) throw new HttpError(400, `unknown knob: ${k} -- ${KNOBS.join(', ')}`);
|
if (!KNOBS.includes(k)) throw new HttpError(400, `unknown knob: ${k} -- ${KNOBS.join(', ')}`);
|
||||||
|
if (k === 'reasoning_effort') {
|
||||||
|
// the enum knob: one of the ladder's levels, or null to
|
||||||
|
// clear back to the measured default
|
||||||
|
if (v !== null && !discovery.EFFORT_LEVELS.includes(String(v))) {
|
||||||
|
throw new HttpError(400, `params.${role}.reasoning_effort must be one of ${discovery.EFFORT_LEVELS.join(', ')} -- or null to ride the model's measured default`);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (v !== null && !Number.isFinite(v)) throw new HttpError(400, `params.${role}.${k} must be a number, or null to clear`);
|
if (v !== null && !Number.isFinite(v)) throw new HttpError(400, `params.${role}.${k} must be a number, or null to clear`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,7 +659,8 @@ route('POST', '/api/runs/:id/model', async ({ params, body, user }) => {
|
|||||||
if (knobs === undefined) continue;
|
if (knobs === undefined) continue;
|
||||||
const cur = { ...(rp[role] ?? {}) };
|
const cur = { ...(rp[role] ?? {}) };
|
||||||
for (const [k, v] of Object.entries(knobs)) {
|
for (const [k, v] of Object.entries(knobs)) {
|
||||||
if (v === null) delete cur[/** @type {'temperature'|'top_p'|'top_k'|'repetition_penalty'|'max_tokens'} */ (k)];
|
if (v === null) delete cur[/** @type {keyof import('./shapes.mjs').RoleParams} */ (k)];
|
||||||
|
else if (k === 'reasoning_effort') cur[/** @type {'reasoning_effort'} */ (k)] = String(v);
|
||||||
else cur[/** @type {'temperature'|'top_p'|'top_k'|'repetition_penalty'|'max_tokens'} */ (k)] = Number(v);
|
else cur[/** @type {'temperature'|'top_p'|'top_k'|'repetition_penalty'|'max_tokens'} */ (k)] = Number(v);
|
||||||
}
|
}
|
||||||
if (Object.keys(cur).length) rp[role] = cur;
|
if (Object.keys(cur).length) rp[role] = cur;
|
||||||
|
|||||||
+8
-1
@@ -653,7 +653,14 @@ export function renderView(s, keepToolResults = 4) {
|
|||||||
if (typeof content === 'string') {
|
if (typeof content === 'string') {
|
||||||
content = content.replace(STRIP_HERS, '').trim();
|
content = content.replace(STRIP_HERS, '').trim();
|
||||||
if (e.via && Object.keys(e.via.params ?? {}).length) {
|
if (e.via && Object.keys(e.via.params ?? {}).length) {
|
||||||
content = `<model>${JSON.stringify(e.via.params)}</model>\n${content}`;
|
// the via-derived block is the mind verb's read side:
|
||||||
|
// reasoning_effort is hidden from her (GM, 2026-11-16 --
|
||||||
|
// not her call), it rides the raw surfaces only
|
||||||
|
const shownVia = { ...e.via.params };
|
||||||
|
delete shownVia.reasoning_effort;
|
||||||
|
if (Object.keys(shownVia).length) {
|
||||||
|
content = `<model>${JSON.stringify(shownVia)}</model>\n${content}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i === lastProse) {
|
if (i === lastProse) {
|
||||||
// the canonical stamp: status comma-separated (the wire
|
// the canonical stamp: status comma-separated (the wire
|
||||||
|
|||||||
+11
-4
@@ -88,15 +88,22 @@ export {};
|
|||||||
/** @typedef {{ package: string, created?: string, owner?: ?string, forked?: number, models?: { player?: ?string, housekeeper?: ?string }, params?: { player?: ?RoleParams, housekeeper?: ?RoleParams } }} RunMeta */
|
/** @typedef {{ package: string, created?: string, owner?: ?string, forked?: number, models?: { player?: ?string, housekeeper?: ?string }, params?: { player?: ?RoleParams, housekeeper?: ?RoleParams } }} RunMeta */
|
||||||
|
|
||||||
/** The named sampling knobs, per role -- the well-known, widely
|
/** The named sampling knobs, per role -- the well-known, widely
|
||||||
* supported set. Numbers ride the wire verbatim; null clears. */
|
* supported set, plus the reasoning-effort enum (GM, 2026-11-16:
|
||||||
/** @typedef {{ temperature?: number, top_p?: number, top_k?: number, repetition_penalty?: number, max_tokens?: number }} RoleParams */
|
* first-class, hidden from the model -- not her call). Numbers ride
|
||||||
|
* the wire verbatim; null clears; reasoning_effort is one of the
|
||||||
|
* effort ladder's levels. */
|
||||||
|
/** @typedef {{ temperature?: number, top_p?: number, top_k?: number, repetition_penalty?: number, max_tokens?: number, reasoning_effort?: string }} RoleParams */
|
||||||
|
|
||||||
/** One model of the discovered registry. Preliminary entries carry
|
/** One model of the discovered registry. Preliminary entries carry
|
||||||
* the scrape only (status unrefined); refined entries carry the
|
* the scrape only (status unrefined); refined entries carry the
|
||||||
* battery's verdicts and the curator's presentation. think is the
|
* battery's verdicts and the curator's presentation. think is the
|
||||||
* battery's best measured thinking-token count -- the pick rule
|
* battery's best measured thinking-token count -- the pick rule
|
||||||
* ranks on it (the bucket is display). */
|
* ranks on it (the bucket is display). efforts is the
|
||||||
/** @typedef {{ id: string, input: ?number, output: ?number, status?: 'unrefined', inference?: boolean, fail?: string, think?: ?number, reasoning?: 'off'|'low'|'standard'|'deep'|null, offSwitch?: Record<string, unknown>|null, latency?: ?number, family?: ?string, label?: ?string, description?: ?string, roles?: { player: boolean, housekeeper: boolean } }} RegistryModel */
|
* reasoning-effort probe: the measured mean thinking per level of
|
||||||
|
* the ladder; effortDefault is the level with the highest observed
|
||||||
|
* mean (GM, 2026-11-16: maximum thinking by default, overridable)
|
||||||
|
* -- null when the model shows no thinking or no level moved it. */
|
||||||
|
/** @typedef {{ id: string, input: ?number, output: ?number, status?: 'unrefined', inference?: boolean, fail?: string, think?: ?number, reasoning?: 'off'|'low'|'standard'|'deep'|null, offSwitch?: Record<string, unknown>|null, efforts?: ?Record<string, number>, effortDefault?: ?string, latency?: ?number, family?: ?string, label?: ?string, description?: ?string, roles?: { player: boolean, housekeeper: boolean } }} RegistryModel */
|
||||||
|
|
||||||
/** state/models.json: the deployment's model registry -- the truth of
|
/** state/models.json: the deployment's model registry -- the truth of
|
||||||
* what is selectable. Written by discovery (the scrape) and refine
|
* what is selectable. Written by discovery (the scrape) and refine
|
||||||
|
|||||||
+22
-4
@@ -3,7 +3,10 @@
|
|||||||
// user, the model registry (a fresh deployment has no models,
|
// user, the model registry (a fresh deployment has no models,
|
||||||
// discover scrapes, refine runs the battery + the curator, registry-
|
// discover scrapes, refine runs the battery + the curator, registry-
|
||||||
// gated picks, the pick rule's lex tie-break, the named sampling
|
// gated picks, the pick rule's lex tie-break, the named sampling
|
||||||
// knobs, the request record -- resolved model + effective params on
|
// knobs, the reasoning-effort knob (the battery's effort probe, the
|
||||||
|
// max-mean default that sends, the override that rides the turn,
|
||||||
|
// hidden from the model), the request record -- resolved model +
|
||||||
|
// effective params on
|
||||||
// every turn, the pass log's model), the mind verb (the player sets
|
// every turn, the pass log's model), the mind verb (the player sets
|
||||||
// its sampling for its next turn: one-shot, JSON, bounds enforced,
|
// its sampling for its next turn: one-shot, JSON, bounds enforced,
|
||||||
// conflict-healed, carried unconsumed across a session boundary,
|
// conflict-healed, carried unconsumed across a session boundary,
|
||||||
@@ -125,6 +128,10 @@ ok('the refined registry carries verdicts and curation', reg.data.phase === 'ref
|
|||||||
&& reg.data.models.some((m) => m.id === 'mock' && m.inference === true && m.reasoning === 'deep' && m.label === 'Mock' && m.family === 'mock')
|
&& reg.data.models.some((m) => m.id === 'mock' && m.inference === true && m.reasoning === 'deep' && m.label === 'Mock' && m.family === 'mock')
|
||||||
&& reg.data.models.some((m) => m.id === 'mock-tie' && m.reasoning === 'deep' && m.label === 'Mock (tie)')
|
&& reg.data.models.some((m) => m.id === 'mock-tie' && m.reasoning === 'deep' && m.label === 'Mock (tie)')
|
||||||
&& reg.data.models.some((m) => m.id === 'mock-cheap' && m.reasoning === 'standard'), JSON.stringify(reg.data.models));
|
&& reg.data.models.some((m) => m.id === 'mock-cheap' && m.reasoning === 'standard'), JSON.stringify(reg.data.models));
|
||||||
|
ok('the effort probe: measured ladders and the max-mean defaults',
|
||||||
|
reg.data.models.some((m) => m.id === 'mock' && m.effortDefault === 'max' && m.efforts?.max === 500 && m.efforts?.none === 0)
|
||||||
|
&& reg.data.models.some((m) => m.id === 'mock-cheap' && m.effortDefault === 'high' && m.efforts?.max === undefined),
|
||||||
|
JSON.stringify(reg.data.models.filter((m) => m.efforts).map((m) => ({ id: m.id, effortDefault: m.effortDefault }))));
|
||||||
const regFile = JSON.parse(readFileSync(`${ROOT}/state/models.json`, 'utf8'));
|
const regFile = JSON.parse(readFileSync(`${ROOT}/state/models.json`, 'utf8'));
|
||||||
ok('the pick rule: deepest reasoning wins, full ties settle sort-lex-pick-bottom',
|
ok('the pick rule: deepest reasoning wins, full ties settle sort-lex-pick-bottom',
|
||||||
regFile.defaults.player === 'mock-tie' && regFile.defaults.housekeeper === 'mock-tie', JSON.stringify(regFile.defaults));
|
regFile.defaults.player === 'mock-tie' && regFile.defaults.housekeeper === 'mock-tie', JSON.stringify(regFile.defaults));
|
||||||
@@ -196,8 +203,8 @@ ok('raw session keeps the whole block', r.data.entries.some((e) => e.t === 'msg'
|
|||||||
const pickNote = r.data.entries.find((e) => e.t === 'note' && e.kind === 'pick');
|
const pickNote = r.data.entries.find((e) => e.t === 'note' && e.kind === 'pick');
|
||||||
ok('pick note logged (the metric)', !!pickNote && pickNote.count === 2 && [0, 1].includes(pickNote.chosen), JSON.stringify(pickNote ?? null));
|
ok('pick note logged (the metric)', !!pickNote && pickNote.count === 2 && [0, 1].includes(pickNote.chosen), JSON.stringify(pickNote ?? null));
|
||||||
const viaMsg = r.data.entries.find((e) => e.t === 'msg' && e.m.role === 'assistant' && e.via);
|
const viaMsg = r.data.entries.find((e) => e.t === 'msg' && e.m.role === 'assistant' && e.via);
|
||||||
ok('the request record rides the turn (resolved model + effective params)',
|
ok('the request record rides the turn (resolved model + effective params, the measured effort default included)',
|
||||||
!!viaMsg && viaMsg.via.model === 'mock' && JSON.stringify(viaMsg.via.params) === '{}', JSON.stringify(viaMsg?.via ?? null));
|
!!viaMsg && viaMsg.via.model === 'mock' && JSON.stringify(viaMsg.via.params) === '{"reasoning_effort":"max"}', JSON.stringify(viaMsg?.via ?? null));
|
||||||
r = await call(`/runs/${runId}/table`, { token: op });
|
r = await call(`/runs/${runId}/table`, { token: op });
|
||||||
ok('the table carries only the picked variant', r.data.entries.every((e) => e.t !== 'msg' || e.m.role !== 'assistant' || !/<\/?variants?>/.test(e.m.content ?? '')), 'variant syntax leaked into the table');
|
ok('the table carries only the picked variant', r.data.entries.every((e) => e.t !== 'msg' || e.m.role !== 'assistant' || !/<\/?variants?>/.test(e.m.content ?? '')), 'variant syntax leaked into the table');
|
||||||
ok('the picked turn is her turn on the table', r.data.entries.some((e) => e.t === 'msg' && e.m.role === 'assistant' && e.m.content.includes(`<status>cuffed, belted, naked, barefoot, ${pickedStatus}</status>`)), pickedStatus);
|
ok('the picked turn is her turn on the table', r.data.entries.some((e) => e.t === 'msg' && e.m.role === 'assistant' && e.m.content.includes(`<status>cuffed, belted, naked, barefoot, ${pickedStatus}</status>`)), pickedStatus);
|
||||||
@@ -304,6 +311,8 @@ ok('an emitted <model> block strips from the view',
|
|||||||
her1.every((m) => !/\n<model>/.test(String(m.content ?? ''))), '');
|
her1.every((m) => !/\n<model>/.test(String(m.content ?? ''))), '');
|
||||||
ok('each past turn carries its <model> block when params rode',
|
ok('each past turn carries its <model> block when params rode',
|
||||||
her1.some((m) => String(m.content ?? '').startsWith('<model>{"temperature":1.2}</model>')), '');
|
her1.some((m) => String(m.content ?? '').startsWith('<model>{"temperature":1.2}</model>')), '');
|
||||||
|
ok('the <model> block hides the effort knob (not her call)',
|
||||||
|
her1.every((m) => !/reasoning_effort/.test(String(m.content ?? ''))), 'the effort leaked into her display');
|
||||||
ok('GM prose goes pure in the view',
|
ok('GM prose goes pure in the view',
|
||||||
view1.filter((m) => m.role === 'user').every((m) => !/<\/?(status|agenda)>/.test(String(m.content ?? ''))), '');
|
view1.filter((m) => m.role === 'user').every((m) => !/<\/?(status|agenda)>/.test(String(m.content ?? ''))), '');
|
||||||
|
|
||||||
@@ -396,6 +405,14 @@ ok('set knobs', r.status === 200 && r.data.params.player?.temperature === 0.7 &&
|
|||||||
ok('knobs stamped in run.json', meta(forkId).params?.player?.temperature === 0.7);
|
ok('knobs stamped in run.json', meta(forkId).params?.player?.temperature === 0.7);
|
||||||
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { temperature: null } } } });
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { temperature: null } } } });
|
||||||
ok('a null knob clears', r.status === 200 && r.data.params.player?.temperature === undefined && r.data.params.player?.max_tokens === 4096, JSON.stringify(r.data.params));
|
ok('a null knob clears', r.status === 200 && r.data.params.player?.temperature === undefined && r.data.params.player?.max_tokens === 4096, JSON.stringify(r.data.params));
|
||||||
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { reasoning_effort: 'low' } } } });
|
||||||
|
ok('the effort knob sets', r.status === 200 && r.data.params.player?.reasoning_effort === 'low', JSON.stringify(r.data.params));
|
||||||
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { reasoning_effort: 'turbo' } } } });
|
||||||
|
ok('a bogus effort level refuses', r.status === 400 && /must be one of/.test(r.data.error), r.data.error ?? '');
|
||||||
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { reasoning_effort: null } } } });
|
||||||
|
ok('a null effort clears back to the measured default', r.status === 200 && r.data.params.player?.reasoning_effort === undefined, JSON.stringify(r.data.params));
|
||||||
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { reasoning_effort: 'low' } } } });
|
||||||
|
ok('the effort override stays for the turn', r.status === 200 && r.data.params.player?.reasoning_effort === 'low', JSON.stringify(r.data.params));
|
||||||
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { vibes: 1 } } } });
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { params: { player: { vibes: 1 } } } });
|
||||||
ok('an unknown knob refuses', r.status === 400 && /unknown knob/.test(r.data.error), r.data.error ?? '');
|
ok('an unknown knob refuses', r.status === 400 && /unknown knob/.test(r.data.error), r.data.error ?? '');
|
||||||
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { player: 'not-a-model' } });
|
r = await call(`/runs/${forkId}/model`, { method: 'POST', token: ash, body: { player: 'not-a-model' } });
|
||||||
@@ -416,7 +433,8 @@ ok('gm turn on the fork (post-knobs)', r.status === 200, r.data.error ?? '');
|
|||||||
r = await call(`/runs/${forkId}/session`, { token: ash });
|
r = await call(`/runs/${forkId}/session`, { token: ash });
|
||||||
const viaTurn = [...r.data.entries].reverse().find((e) => e.t === 'msg' && e.m.role === 'assistant');
|
const viaTurn = [...r.data.entries].reverse().find((e) => e.t === 'msg' && e.m.role === 'assistant');
|
||||||
ok('the recorded request carries the run\'s knobs under the mind layer',
|
ok('the recorded request carries the run\'s knobs under the mind layer',
|
||||||
!!viaTurn?.via && viaTurn.via.model === 'mock' && viaTurn.via.params.max_tokens === 4096 && viaTurn.via.params.temperature === 1.2,
|
!!viaTurn?.via && viaTurn.via.model === 'mock' && viaTurn.via.params.max_tokens === 4096 && viaTurn.via.params.temperature === 1.2
|
||||||
|
&& viaTurn.via.params.reasoning_effort === 'low',
|
||||||
JSON.stringify(viaTurn?.via ?? null));
|
JSON.stringify(viaTurn?.via ?? null));
|
||||||
r = await call('/models', { token: ash });
|
r = await call('/models', { token: ash });
|
||||||
ok('model listing (the registry)', r.status === 200 && r.data.phase === 'refined' && r.data.models.some((m) => m.id === 'mock' && m.label === 'Mock'), JSON.stringify(r.data.phase));
|
ok('model listing (the registry)', r.status === 200 && r.data.phase === 'refined' && r.data.models.some((m) => m.id === 'mock' && m.label === 'Mock'), JSON.stringify(r.data.phase));
|
||||||
|
|||||||
+1
-1
@@ -173,7 +173,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<div id="gm-stack">
|
<div id="gm-stack">
|
||||||
<pre id="gm-hl" aria-hidden="true"></pre>
|
<pre id="gm-hl" aria-hidden="true"></pre>
|
||||||
<textarea id="gm-input" rows="2" placeholder="GM line -- Ctrl+Space sends" disabled></textarea>
|
<textarea id="gm-input" rows="6" placeholder="GM turn -- Enter newlines, Ctrl+Space sends" disabled></textarea>
|
||||||
</div>
|
</div>
|
||||||
<span id="busy" hidden>her turn...</span>
|
<span id="busy" hidden>her turn...</span>
|
||||||
<button id="gm-send" disabled>send</button>
|
<button id="gm-send" disabled>send</button>
|
||||||
|
|||||||
+93
-35
@@ -5,17 +5,20 @@
|
|||||||
// table is the single home of every knob text -- label, hint, bounds
|
// table is the single home of every knob text -- label, hint, bounds
|
||||||
// -- red-pen the prose here, in place. Bounds are display knowledge
|
// -- red-pen the prose here, in place. Bounds are display knowledge
|
||||||
// probed from this endpoint's own validation errors (the /model
|
// probed from this endpoint's own validation errors (the /model
|
||||||
// route's validation stays generic: a finite number). The provider's
|
// route's validation stays generic: a finite number, or one of the
|
||||||
// serving defaults are unknown and stay unstated; the only default
|
// effort ladder's levels). The provider's serving defaults are
|
||||||
// anyone can honestly name is the deployment layer (server.json
|
// unknown and stay unstated; the only default anyone can honestly
|
||||||
// params), which rides the run detail as paramDefaults.
|
// name is the deployment layer (server.json params), which rides the
|
||||||
|
// run detail as paramDefaults -- reasoning_effort is the one
|
||||||
|
// exception: the registry measured a per-model default (the maximum
|
||||||
|
// observed mean thinking), so its unset state honestly sends.
|
||||||
//
|
//
|
||||||
// Two defaults, never conflated: a knob unset means its value is NOT
|
// Two defaults, never conflated: a knob unset means its value is NOT
|
||||||
// sent to the provider; a value present is sent, and the row marks it
|
// sent to the provider; a value present is sent, and the row marks it
|
||||||
// when it equals the deployment default. The explicit override toggle
|
// when it equals the deployment default. The explicit override toggle
|
||||||
// carries the distinction: off (the visible default) disables the
|
// carries the distinction: off (the visible default) disables the
|
||||||
// input and saving sends nothing for the knob (null clears a
|
// input and saving sends nothing for the knob (null clears a
|
||||||
// previously-set value); on demands a number.
|
// previously-set value); on demands a number (a level, for the enum).
|
||||||
//
|
//
|
||||||
// The hint bar is shared by both roles -- one explanation at a time,
|
// The hint bar is shared by both roles -- one explanation at a time,
|
||||||
// driven by focus (a tap focuses), cleared when focus leaves the
|
// driven by focus (a tap focuses), cleared when focus leaves the
|
||||||
@@ -25,13 +28,20 @@
|
|||||||
|
|
||||||
import { el } from './dom.mjs';
|
import { el } from './dom.mjs';
|
||||||
|
|
||||||
/** One knob's definition: the texts are the product, the shape is
|
// the reasoning-effort ladder -- mirrors server/discovery.mjs's
|
||||||
* schema-ready for later kinds (bools: what to expect on and off;
|
// EFFORT_LEVELS (the web cannot import server runtime code); keep
|
||||||
* enums: explanation-only) -- nothing else ships today. All five
|
// them in step
|
||||||
|
const EFFORT_LEVELS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
||||||
|
|
||||||
|
/** One knob's definition: the texts are the product. Two kinds ship:
|
||||||
|
* numbers, and the effort enum (a select over the ladder). All six
|
||||||
* knobs are the GM's here; the mind verb (server/loop.mjs) sets
|
* knobs are the GM's here; the mind verb (server/loop.mjs) sets
|
||||||
* only the four that are hers -- max_tokens is excluded by ruling
|
* only the four that are hers -- max_tokens is excluded by ruling
|
||||||
* (a budget, not a mind). */
|
* (a budget, not a mind), reasoning_effort is hidden from her
|
||||||
/** @typedef {{ key: keyof RoleParams, kind: 'number', label: string, hint: string, bounds: string }} KnobDef */
|
* entirely (not her call). */
|
||||||
|
/** @typedef {{ key: keyof RoleParams, kind: 'number', label: string, hint: string, bounds: string }} NumberDef */
|
||||||
|
/** @typedef {{ key: keyof RoleParams, kind: 'enum', label: string, hint: string }} EnumDef */
|
||||||
|
/** @typedef {NumberDef|EnumDef} KnobDef */
|
||||||
|
|
||||||
/** @type {KnobDef[]} */
|
/** @type {KnobDef[]} */
|
||||||
const DEFS = [
|
const DEFS = [
|
||||||
@@ -70,17 +80,35 @@ const DEFS = [
|
|||||||
hint: 'The response\'s hard length budget. Higher: room for long turns. Lower: cheaper and shorter, but the turn can cut off mid-sentence -- and on reasoning models thinking counts against this budget first, so a low cap can be eaten entirely before she writes a word.',
|
hint: 'The response\'s hard length budget. Higher: room for long turns. Lower: cheaper and shorter, but the turn can cut off mid-sentence -- and on reasoning models thinking counts against this budget first, so a low cap can be eaten entirely before she writes a word.',
|
||||||
bounds: '1 or more on this endpoint; no enforced max (values above the model\'s output ceiling are accepted).',
|
bounds: '1 or more on this endpoint; no enforced max (values above the model\'s output ceiling are accepted).',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'reasoning_effort',
|
||||||
|
kind: 'enum',
|
||||||
|
label: 'reasoning effort',
|
||||||
|
hint: 'How hard the model thinks before answering. Higher levels reason more thoroughly and cost more (thinking bills as output tokens); lower levels answer faster. The level is a request, not a guarantee -- the model adapts to the task. Not hers to set: the mind verb never carries it.',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/** The hint bar's text for one knob: label, the explanation, the
|
/** The hint bar's text for one knob: label, the explanation, the
|
||||||
* bounds, and the honest default statement for this role's
|
* bounds, and the honest default statement for this role's
|
||||||
* deployment layer. Never invents an unknown value. */
|
* deployment layer. Never invents an unknown value. The enum knob
|
||||||
/** @param {KnobDef} def @param {number|undefined|null} dep @returns {string} */
|
* states its own honest default: the measured pick. */
|
||||||
function hintText(def, dep) {
|
/** @param {KnobDef} def @param {number|string|undefined|null} dep @param {?{ measured: Record<string, number>, fallback: ?string }} [effort] @returns {string} */
|
||||||
|
function hintText(def, dep, effort) {
|
||||||
|
if (def.kind === 'enum') {
|
||||||
|
const table = effort
|
||||||
|
? `Measured mean thinking for this model: ${Object.entries(effort.measured).map(([k, v]) => `${k} ${v}`).join(', ')}.`
|
||||||
|
: 'No effort measurements for this model (an unrefined registry, or the model shows no thinking).';
|
||||||
|
const rides = (dep !== undefined && dep !== null ? String(dep) : null) ?? effort?.fallback ?? null;
|
||||||
|
const defLine = rides
|
||||||
|
? `Unset = ${rides} rides (the measured default: the level with the highest observed thinking).`
|
||||||
|
: 'Unset = not sent; the model id\'s own baked default applies.';
|
||||||
|
return `${def.label} -- ${def.hint} ${table} ${defLine}`;
|
||||||
|
}
|
||||||
|
const d = /** @type {NumberDef} */ (def);
|
||||||
const defLine = dep !== undefined && dep !== null
|
const defLine = dep !== undefined && dep !== null
|
||||||
? `Unset = the deployment default (${dep}).`
|
? `Unset = the deployment default (${dep}).`
|
||||||
: 'Unset = not sent; the provider\'s own default applies (unknown).';
|
: 'Unset = not sent; the provider\'s own default applies (unknown).';
|
||||||
return `${def.label.replace(/_/g, ' ')} -- ${def.hint} ${def.bounds} ${defLine}`;
|
return `${d.label.replace(/_/g, ' ')} -- ${d.hint} ${d.bounds} ${defLine}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One role's knob row.
|
/** One role's knob row.
|
||||||
@@ -88,12 +116,13 @@ function hintText(def, dep) {
|
|||||||
* @param {RoleParams|undefined} current the run's own knobs
|
* @param {RoleParams|undefined} current the run's own knobs
|
||||||
* @param {RoleParams|undefined|null} deployment the deployment layer (server.json params)
|
* @param {RoleParams|undefined|null} deployment the deployment layer (server.json params)
|
||||||
* @param {HTMLElement} hintBar the shared hint bar
|
* @param {HTMLElement} hintBar the shared hint bar
|
||||||
* @returns {{ wrap: HTMLElement, read: () => Record<string, number|null> }}
|
* @param {?{ measured: Record<string, number>, fallback: ?string }} [effort] the current model's measured effort ladder (null: none)
|
||||||
|
* @returns {{ wrap: HTMLElement, read: () => Record<string, number|string|null> }}
|
||||||
*/
|
*/
|
||||||
export function knobsBox(role, current, deployment, hintBar) {
|
export function knobsBox(role, current, deployment, hintBar, effort = null) {
|
||||||
const wrap = el('div', 'knobs');
|
const wrap = el('div', 'knobs');
|
||||||
wrap.appendChild(el('div', 'knobs-head', `${role} knobs`));
|
wrap.appendChild(el('div', 'knobs-head', `${role} knobs`));
|
||||||
/** @type {Record<string, { tog: HTMLInputElement, inp: HTMLInputElement }>} */
|
/** @type {Record<string, { tog: HTMLInputElement, inp: HTMLInputElement, sel: ?HTMLSelectElement }>} */
|
||||||
const rows = {};
|
const rows = {};
|
||||||
for (const def of DEFS) {
|
for (const def of DEFS) {
|
||||||
const row = el('div', 'knob');
|
const row = el('div', 'knob');
|
||||||
@@ -101,11 +130,28 @@ export function knobsBox(role, current, deployment, hintBar) {
|
|||||||
tog.type = 'checkbox';
|
tog.type = 'checkbox';
|
||||||
tog.title = 'override';
|
tog.title = 'override';
|
||||||
const lab = el('label', null, `${def.label.replace(/_/g, ' ')} `);
|
const lab = el('label', null, `${def.label.replace(/_/g, ' ')} `);
|
||||||
const inp = /** @type {HTMLInputElement} */ (el('input'));
|
|
||||||
inp.type = 'number';
|
|
||||||
inp.step = 'any';
|
|
||||||
const mark = el('span', 'knob-default', ' \u00b7 deployment default');
|
const mark = el('span', 'knob-default', ' \u00b7 deployment default');
|
||||||
lab.appendChild(inp);
|
/** @type {?HTMLSelectElement} */ let sel = null;
|
||||||
|
const inp = /** @type {HTMLInputElement} */ (el('input'));
|
||||||
|
if (def.kind === 'enum') {
|
||||||
|
// the effort row: a select over the ladder; unset sends the
|
||||||
|
// measured default (the registry's pick for the current model)
|
||||||
|
sel = /** @type {HTMLSelectElement} */ (el('select'));
|
||||||
|
const rides = deployment?.[def.key] ?? effort?.fallback ?? null;
|
||||||
|
const unset = /** @type {HTMLOptionElement} */ (el('option', null, rides ? `(default: ${rides})` : '(not sent)'));
|
||||||
|
unset.value = '';
|
||||||
|
sel.appendChild(unset);
|
||||||
|
for (const lv of EFFORT_LEVELS) {
|
||||||
|
const o = /** @type {HTMLOptionElement} */ (el('option', null, lv));
|
||||||
|
o.value = lv;
|
||||||
|
sel.appendChild(o);
|
||||||
|
}
|
||||||
|
lab.appendChild(sel);
|
||||||
|
} else {
|
||||||
|
inp.type = 'number';
|
||||||
|
inp.step = 'any';
|
||||||
|
lab.appendChild(inp);
|
||||||
|
}
|
||||||
lab.appendChild(mark);
|
lab.appendChild(mark);
|
||||||
row.appendChild(tog);
|
row.appendChild(tog);
|
||||||
row.appendChild(lab);
|
row.appendChild(lab);
|
||||||
@@ -113,20 +159,26 @@ export function knobsBox(role, current, deployment, hintBar) {
|
|||||||
|
|
||||||
const set = current?.[def.key];
|
const set = current?.[def.key];
|
||||||
tog.checked = set !== undefined;
|
tog.checked = set !== undefined;
|
||||||
if (set !== undefined) inp.value = String(set);
|
|
||||||
const dep = deployment?.[def.key];
|
const dep = deployment?.[def.key];
|
||||||
// the toggle owns the state: off disables the input (the value
|
// the toggle owns the state: off disables the input (the value
|
||||||
// stays for a change of mind), on demands a number; a value equal
|
// stays for a change of mind), on demands a number (a level);
|
||||||
// to the deployment default is still sent, and the row marks it
|
// a value equal to the deployment default is still sent, and
|
||||||
|
// the row marks it
|
||||||
const sync = () => {
|
const sync = () => {
|
||||||
inp.disabled = !tog.checked;
|
const field = /** @type {HTMLInputElement|HTMLSelectElement} */ (sel ?? inp);
|
||||||
mark.hidden = !(tog.checked && inp.value.trim() !== '' && Number(inp.value) === dep);
|
field.disabled = !tog.checked;
|
||||||
|
const v = sel ? sel.value : inp.value.trim();
|
||||||
|
mark.hidden = !(tog.checked && v !== '' && v === String(dep ?? '\u0000'));
|
||||||
};
|
};
|
||||||
tog.addEventListener('change', sync);
|
tog.addEventListener('change', sync);
|
||||||
inp.addEventListener('input', sync);
|
if (sel) sel.addEventListener('change', sync);
|
||||||
|
else inp.addEventListener('input', sync);
|
||||||
sync();
|
sync();
|
||||||
inp.addEventListener('focus', () => { hintBar.textContent = hintText(def, dep); });
|
const focusEl = /** @type {HTMLElement} */ (sel ?? inp);
|
||||||
rows[def.key] = { tog, inp };
|
focusEl.addEventListener('focus', () => { hintBar.textContent = hintText(def, dep, effort); });
|
||||||
|
if (sel && set !== undefined) sel.value = String(set);
|
||||||
|
else if (!sel && set !== undefined) inp.value = String(set);
|
||||||
|
rows[def.key] = { tog, inp, sel };
|
||||||
}
|
}
|
||||||
// the bar keeps its text while focus moves inside the row, clears
|
// the bar keeps its text while focus moves inside the row, clears
|
||||||
// when it leaves the knobs entirely
|
// when it leaves the knobs entirely
|
||||||
@@ -134,15 +186,21 @@ export function knobsBox(role, current, deployment, hintBar) {
|
|||||||
if (!wrap.contains(/** @type {?Node} */ (e.relatedTarget))) hintBar.textContent = '';
|
if (!wrap.contains(/** @type {?Node} */ (e.relatedTarget))) hintBar.textContent = '';
|
||||||
});
|
});
|
||||||
const read = () => {
|
const read = () => {
|
||||||
/** @type {Record<string, number|null>} */ const out = {};
|
/** @type {Record<string, number|string|null>} */ const out = {};
|
||||||
for (const def of DEFS) {
|
for (const def of DEFS) {
|
||||||
const { tog, inp } = rows[def.key];
|
const { tog, inp, sel } = rows[def.key];
|
||||||
if (tog.checked) {
|
if (tog.checked) {
|
||||||
const v = inp.value.trim();
|
if (sel) {
|
||||||
if (v === '' || !Number.isFinite(Number(v))) {
|
const v = sel.value;
|
||||||
throw new Error(`${def.label}: a number is required -- or switch the override off`);
|
if (!v) throw new Error(`${def.label}: a level is required -- or switch the override off`);
|
||||||
|
out[def.key] = v;
|
||||||
|
} else {
|
||||||
|
const v = inp.value.trim();
|
||||||
|
if (v === '' || !Number.isFinite(Number(v))) {
|
||||||
|
throw new Error(`${def.label}: a number is required -- or switch the override off`);
|
||||||
|
}
|
||||||
|
out[def.key] = Number(v);
|
||||||
}
|
}
|
||||||
out[def.key] = Number(v);
|
|
||||||
} else if (current?.[def.key] !== undefined) {
|
} else if (current?.[def.key] !== undefined) {
|
||||||
out[def.key] = null; // clearing a previously-set knob
|
out[def.key] = null; // clearing a previously-set knob
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-9
@@ -33,12 +33,14 @@ body {
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* play keeps the two-column transcript + aside layout */
|
/* play keeps the two-column transcript + aside layout; the footer
|
||||||
|
(the composer) sits under the transcript's column only -- the
|
||||||
|
input's width is the pane's width (GM, 2026-11-16) */
|
||||||
body.play {
|
body.play {
|
||||||
grid-template:
|
grid-template:
|
||||||
"header header" auto
|
"header header" auto
|
||||||
"main aside" 1fr
|
"main aside" 1fr
|
||||||
"footer footer" auto / 1fr 300px;
|
"footer ." auto / 1fr 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- header --- */
|
/* --- header --- */
|
||||||
@@ -98,7 +100,7 @@ button.primary { border-color: var(--accent); color: var(--accent); }
|
|||||||
|
|
||||||
/* --- main / views --- */
|
/* --- main / views --- */
|
||||||
|
|
||||||
main { grid-area: main; overflow-y: auto; padding: 18px 22px; }
|
main { grid-area: main; overflow-y: auto; padding: 18px 22px; overflow-anchor: none; }
|
||||||
|
|
||||||
h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: normal; margin: 4px 0 14px; }
|
h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: normal; margin: 4px 0 14px; }
|
||||||
|
|
||||||
@@ -276,8 +278,8 @@ h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: nor
|
|||||||
.raw-slot { margin: 10px 0 2px; }
|
.raw-slot { margin: 10px 0 2px; }
|
||||||
|
|
||||||
.line { margin: 2px 0; white-space: pre-wrap; }
|
.line { margin: 2px 0; white-space: pre-wrap; }
|
||||||
.narration { color: var(--dim); font-style: italic; }
|
.narration { color: var(--dim); } /* colour-only: no italic face -- same glyphs, same widths */
|
||||||
.narration strong { color: var(--text); font-style: italic; }
|
.emph { color: var(--accent); }
|
||||||
.ooc { color: var(--dim); border-left: 2px solid var(--line); padding-left: 8px; font-size: 13px; }
|
.ooc { color: var(--dim); border-left: 2px solid var(--line); padding-left: 8px; font-size: 13px; }
|
||||||
|
|
||||||
.tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
|
.tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
|
||||||
@@ -290,8 +292,6 @@ h1 { font-size: 15px; letter-spacing: 0.1em; color: var(--dim); font-weight: nor
|
|||||||
.chip.drop { text-decoration: line-through; }
|
.chip.drop { text-decoration: line-through; }
|
||||||
.chip.add { color: var(--ok); border-color: var(--ok); }
|
.chip.add { color: var(--ok); border-color: var(--ok); }
|
||||||
.chip.mind { color: var(--accent); border-color: var(--accent); }
|
.chip.mind { color: var(--accent); border-color: var(--accent); }
|
||||||
.chip.status { color: var(--text); }
|
|
||||||
.chip.agenda { color: var(--accent); border-color: var(--accent); }
|
|
||||||
|
|
||||||
.machinery {
|
.machinery {
|
||||||
margin: 6px 0; font-size: 12px; color: var(--dim);
|
margin: 6px 0; font-size: 12px; color: var(--dim);
|
||||||
@@ -351,6 +351,11 @@ details.bundle pre { margin: 0; padding: 0 12px 10px; white-space: pre-wrap; fon
|
|||||||
}
|
}
|
||||||
.story-head h1 { margin: 0; }
|
.story-head h1 { margin: 0; }
|
||||||
#story { max-width: 760px; }
|
#story { max-width: 760px; }
|
||||||
|
/* the book earns its typography: the story's narration is italic and
|
||||||
|
its emphasis is bold -- the workbench's colour-only rule stops at
|
||||||
|
the story's door (the renderers are separate by the same ruling) */
|
||||||
|
#story .narration { color: var(--dim); font-style: italic; }
|
||||||
|
#story .narration strong { color: var(--text); font-style: italic; }
|
||||||
.session-break { margin: 26px 0 12px; border-top: 1px solid var(--line); }
|
.session-break { margin: 26px 0 12px; border-top: 1px solid var(--line); }
|
||||||
|
|
||||||
/* --- aside (play) --- */
|
/* --- aside (play) --- */
|
||||||
@@ -417,7 +422,7 @@ body.play #play-aside { display: block; }
|
|||||||
|
|
||||||
footer {
|
footer {
|
||||||
grid-area: footer;
|
grid-area: footer;
|
||||||
gap: 8px; padding: 10px 14px;
|
gap: 8px; padding: 10px 22px 14px; /* the composer's edges align with the transcript's column */
|
||||||
background: var(--panel); border-top: 1px solid var(--line);
|
background: var(--panel); border-top: 1px solid var(--line);
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -426,16 +431,24 @@ body.play footer { display: flex; }
|
|||||||
#gm-stack.off { opacity: 0.4; }
|
#gm-stack.off { opacity: 0.4; }
|
||||||
/* the highlight overlay: the setup editor's stack pattern -- a pre
|
/* the highlight overlay: the setup editor's stack pattern -- a pre
|
||||||
behind a transparent-text textarea, identical metrics, so the
|
behind a transparent-text textarea, identical metrics, so the
|
||||||
tokens light up in place without moving the caret */
|
tokens light up in place without moving the caret. The tokens are
|
||||||
|
colour-only (real faces shift advance widths and dragged the
|
||||||
|
caret); scrollbar-gutter keeps the columns aligned when the box
|
||||||
|
starts scrolling; field-sizing grows the box with the turn from
|
||||||
|
its six-line floor (the rows attribute is the no-support floor) */
|
||||||
#gm-hl, #gm-input {
|
#gm-hl, #gm-input {
|
||||||
grid-area: 1 / 1;
|
grid-area: 1 / 1;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px 8px;
|
padding: 5px 8px;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
|
line-height: 1.5;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
min-height: 6lh;
|
||||||
|
max-height: 50vh;
|
||||||
}
|
}
|
||||||
#gm-hl { pointer-events: none; overflow: hidden; color: var(--text); border-color: transparent; background: transparent; }
|
#gm-hl { pointer-events: none; overflow: hidden; color: var(--text); border-color: transparent; background: transparent; }
|
||||||
#gm-input {
|
#gm-input {
|
||||||
@@ -444,6 +457,7 @@ body.play footer { display: flex; }
|
|||||||
caret-color: var(--text);
|
caret-color: var(--text);
|
||||||
resize: none;
|
resize: none;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
field-sizing: content; /* the box grows with the turn; max-height caps it */
|
||||||
}
|
}
|
||||||
#gm-input::placeholder { color: var(--dim); }
|
#gm-input::placeholder { color: var(--dim); }
|
||||||
#gm-send { padding: 5px 18px; }
|
#gm-send { padding: 5px 18px; }
|
||||||
|
|||||||
+50
-29
@@ -4,9 +4,11 @@
|
|||||||
// The transcript renders three registers by the ruled markers: plain
|
// The transcript renders three registers by the ruled markers: plain
|
||||||
// text is speech, *italics* is narration, a line opening with `(` is
|
// text is speech, *italics* is narration, a line opening with `(` is
|
||||||
// OOC (closing paren optional; a lone paren is an empty OOC line and
|
// OOC (closing paren optional; a lone paren is an empty OOC line and
|
||||||
// is skipped). The <status>/<agenda> blocks riding GM turns and the
|
// is skipped). The machinery never shows here: the status and agenda
|
||||||
// delta tags on player turns are machinery, not prose -- they render
|
// blocks (and the retired delta tags) strip from the prose -- the
|
||||||
// as chips and pane state, mirroring the live-context policy.
|
// dedicated panes carry the derived state -- and the reminder rides
|
||||||
|
// only on the raw tab. The mind chip is the one exception: the mind
|
||||||
|
// is write-only, the chip is its display.
|
||||||
|
|
||||||
/** @typedef {import('../server/shapes.mjs').LogEvent} LogEvent */
|
/** @typedef {import('../server/shapes.mjs').LogEvent} LogEvent */
|
||||||
/** @typedef {import('../server/shapes.mjs').BundleEvent} BundleEvent */
|
/** @typedef {import('../server/shapes.mjs').BundleEvent} BundleEvent */
|
||||||
@@ -15,21 +17,20 @@
|
|||||||
|
|
||||||
import { $, el } from './dom.mjs';
|
import { $, el } from './dom.mjs';
|
||||||
|
|
||||||
// splits text into spans: *italics* = narration, **bold** = emphasis
|
// splits text into spans: *italics* = narration, **bold** = emphasis.
|
||||||
|
// Colour-only (GM, 2026-11-16): the workbench renders no faces --
|
||||||
|
// same glyphs, same widths, only paint differs, and the input's
|
||||||
|
// caret can never drift from what it overlays. The asterisks stay
|
||||||
|
// on screen: the authored text is the rendered text
|
||||||
/** @param {HTMLElement} target @param {string} text */
|
/** @param {HTMLElement} target @param {string} text */
|
||||||
function renderSpans(target, text) {
|
function renderSpans(target, text) {
|
||||||
const parts = String(text).split(/(\*\*[^*]+\*\*|\*[^*\n]+\*)/g);
|
const parts = String(text).split(/(\*\*[^*]+\*\*|\*[^*\n]+\*)/g);
|
||||||
for (const p of parts) {
|
for (const p of parts) {
|
||||||
if (!p) continue;
|
if (!p) continue;
|
||||||
if (p.startsWith('**') && p.endsWith('**')) {
|
if (p.startsWith('**') && p.endsWith('**')) {
|
||||||
const b = document.createElement('strong');
|
target.appendChild(el('span', 'emph', p));
|
||||||
b.textContent = p.slice(2, -2);
|
|
||||||
target.appendChild(b);
|
|
||||||
} else if (p.startsWith('*') && p.endsWith('*') && p.length > 2) {
|
} else if (p.startsWith('*') && p.endsWith('*') && p.length > 2) {
|
||||||
const i = document.createElement('em');
|
target.appendChild(el('span', 'narration', p));
|
||||||
i.className = 'narration';
|
|
||||||
i.textContent = p.slice(1, -1);
|
|
||||||
target.appendChild(i);
|
|
||||||
} else {
|
} else {
|
||||||
target.appendChild(document.createTextNode(p));
|
target.appendChild(document.createTextNode(p));
|
||||||
}
|
}
|
||||||
@@ -38,10 +39,12 @@ function renderSpans(target, text) {
|
|||||||
|
|
||||||
// one content block (a GM or player turn) -> DOM lines. extract pulls
|
// one content block (a GM or player turn) -> DOM lines. extract pulls
|
||||||
// the riding blocks (status/conflict/agenda) out of GM prose; the
|
// the riding blocks (status/conflict/agenda) out of GM prose; the
|
||||||
// delta tags on player turns always render as chips. Exported for
|
// delta tags on player turns always render as chips. The workbench's
|
||||||
// the story view, which renders the same registers.
|
// register renderer -- colour-only, source verbatim; the story view
|
||||||
|
// carries its own (view-story.mjs), the book's typography is not the
|
||||||
|
// tool's (GM, 2026-11-16).
|
||||||
/** @param {HTMLElement} target @param {?string} text @param {{ extract?: boolean }} opts @returns {{ status: ?string, conflict: ?string, agenda: ?string }} */
|
/** @param {HTMLElement} target @param {?string} text @param {{ extract?: boolean }} opts @returns {{ status: ?string, conflict: ?string, agenda: ?string }} */
|
||||||
export function renderContent(target, text, { extract }) {
|
function renderContent(target, text, { extract }) {
|
||||||
let body = String(text ?? '');
|
let body = String(text ?? '');
|
||||||
let status = null;
|
let status = null;
|
||||||
let conflict = null;
|
let conflict = null;
|
||||||
@@ -122,10 +125,16 @@ export function renderContent(target, text, { extract }) {
|
|||||||
renderSpans(d, content);
|
renderSpans(d, content);
|
||||||
target.appendChild(d);
|
target.appendChild(d);
|
||||||
}
|
}
|
||||||
if (tags.length) {
|
if (tags.some((t) => t.kind === 'mind')) {
|
||||||
|
// only the mind chips: it is write-only, the chip is its one
|
||||||
|
// table-side display. The state machinery (status, agenda, the
|
||||||
|
// retired delta tags) renders nowhere in the prose pane -- the
|
||||||
|
// dedicated panes carry the derived state, the transcript
|
||||||
|
// carries the prose (GM, 2026-11-16)
|
||||||
const wrap = document.createElement('div');
|
const wrap = document.createElement('div');
|
||||||
wrap.className = 'tags';
|
wrap.className = 'tags';
|
||||||
for (const t of tags) {
|
for (const t of tags) {
|
||||||
|
if (t.kind !== 'mind') continue;
|
||||||
for (const item of t.items) {
|
for (const item of t.items) {
|
||||||
const c = document.createElement('span');
|
const c = document.createElement('span');
|
||||||
c.className = `chip ${t.kind}`;
|
c.className = `chip ${t.kind}`;
|
||||||
@@ -142,7 +151,7 @@ export function renderContent(target, text, { extract }) {
|
|||||||
// params as sent (the merged layer actually sent). Shared by the raw
|
// params as sent (the merged layer actually sent). Shared by the raw
|
||||||
// walk and the per-turn raw control. fail is present when the call
|
// walk and the per-turn raw control. fail is present when the call
|
||||||
// failed -- no message resulted.
|
// failed -- no message resulted.
|
||||||
/** @param {{ model: string, params?: Record<string, number> }} via @param {?string} [fail] @returns {string} */
|
/** @param {{ model: string, params?: Record<string, number|string> }} via @param {?string} [fail] @returns {string} */
|
||||||
export function viaLine(via, fail = null) {
|
export function viaLine(via, fail = null) {
|
||||||
const ks = Object.entries(via.params ?? {});
|
const ks = Object.entries(via.params ?? {});
|
||||||
const p = ks.length ? ` -- ${ks.map(([k, v]) => `${k}: ${v}`).join(', ')}` : ' (no knobs set)';
|
const p = ks.length ? ` -- ${ks.map(([k, v]) => `${k}: ${v}`).join(', ')}` : ' (no knobs set)';
|
||||||
@@ -186,6 +195,18 @@ function noteText(e) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the transcript's stick-to-bottom: the div itself just grows -- main
|
||||||
|
// is the scroller. Firefox can also reclaim a same-tick programmatic
|
||||||
|
// scroll around a content wipe (scroll anchoring re-anchoring after
|
||||||
|
// the rebuild), so the position re-asserts on the next frame
|
||||||
|
/** @param {HTMLElement} t */
|
||||||
|
function stickBottom(t) {
|
||||||
|
const sc = t.closest('main');
|
||||||
|
if (!sc) return;
|
||||||
|
sc.scrollTop = sc.scrollHeight;
|
||||||
|
requestAnimationFrame(() => { sc.scrollTop = sc.scrollHeight; });
|
||||||
|
}
|
||||||
|
|
||||||
// the raw walk: the audit surface over the same log -- everything as
|
// the raw walk: the audit surface over the same log -- everything as
|
||||||
// it rode the wire. Thinking, whole variant blocks, every reminder
|
// it rode the wire. Thinking, whole variant blocks, every reminder
|
||||||
// copy, full tool results, the rides inline in the GM prose; plain
|
// copy, full tool results, the rides inline in the GM prose; plain
|
||||||
@@ -259,7 +280,7 @@ export function renderRaw(entries) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.scrollTop = t.scrollHeight;
|
stickBottom(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the entry walk. onConflict receives a conflict block found on a GM
|
// the entry walk. onConflict receives a conflict block found on a GM
|
||||||
@@ -299,16 +320,9 @@ export function renderTranscript(entries, { onConflict, onRaw } = {}) {
|
|||||||
}
|
}
|
||||||
flushBundle();
|
flushBundle();
|
||||||
if (e.t === 'msg' && e.reminder) {
|
if (e.t === 'msg' && e.reminder) {
|
||||||
// the turn reminder: the transcript mirrors the live-context
|
// the reminder never renders in the prose pane (GM, 2026-11-16):
|
||||||
// policy -- one collapsed card for the newest copy, superseded
|
// it is the same every turn -- the raw tab keeps every copy,
|
||||||
// ones elide (the log keeps every as-sent chunk)
|
// the audit surface is its home
|
||||||
const newest = [...entries].reverse().find((x) => x.t === 'msg' && x.reminder);
|
|
||||||
if (e === newest) {
|
|
||||||
const d = el('details', 'bundle');
|
|
||||||
d.appendChild(el('summary', null, 'turn reminder -- rides every GM turn'));
|
|
||||||
d.appendChild(el('pre', null, e.m.content));
|
|
||||||
t.appendChild(d);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (e.t === 'opening') {
|
if (e.t === 'opening') {
|
||||||
@@ -330,10 +344,17 @@ export function renderTranscript(entries, { onConflict, onRaw } = {}) {
|
|||||||
t.appendChild(el('div', 'machinery', `${e.ask ? '[ruling] ' : '[tool result] '}${String(e.m.content).split('\n')[0]}`));
|
t.appendChild(el('div', 'machinery', `${e.ask ? '[ruling] ' : '[tool result] '}${String(e.m.content).split('\n')[0]}`));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (e.t === 'note') renderNote(e);
|
if (e.t === 'note') {
|
||||||
|
// the state receipts never render in the prose pane (GM,
|
||||||
|
// 2026-11-16): the status/agenda notes -- the old delta applies
|
||||||
|
// and the whole-list sets alike -- duplicate the panes; the raw
|
||||||
|
// tab keeps every receipt
|
||||||
|
if (e.kind === 'status' || e.kind === 'agenda') continue;
|
||||||
|
renderNote(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
flushBundle();
|
flushBundle();
|
||||||
t.scrollTop = t.scrollHeight;
|
stickBottom(t);
|
||||||
|
|
||||||
/** @param {MsgEvent} e @param {number} idx @param {string} who */
|
/** @param {MsgEvent} e @param {number} idx @param {string} who */
|
||||||
function gmTurn(e, idx, who) {
|
function gmTurn(e, idx, who) {
|
||||||
|
|||||||
+4
-3
@@ -497,8 +497,9 @@ $('gm-input').addEventListener('keydown', (e) => {
|
|||||||
// the GM input's highlight overlay: the setup editor's stack pattern
|
// the GM input's highlight overlay: the setup editor's stack pattern
|
||||||
// -- the pre behind a transparent-text textarea renders the tokens in
|
// -- the pre behind a transparent-text textarea renders the tokens in
|
||||||
// place. Every character stays (the asterisks too) so the caret never
|
// place. Every character stays (the asterisks too) so the caret never
|
||||||
// desyncs from the visible glyphs: italics and bold style their whole
|
// desyncs from the visible glyphs, and the tokens are colour-only
|
||||||
// token, sigils and vars color theirs
|
// (GM, 2026-11-16): real faces shift advance widths and dragged the
|
||||||
|
// caret with them -- same glyphs, same widths, only paint differs
|
||||||
const SIGIL_RE = /@(PC|Package)\b/g;
|
const SIGIL_RE = /@(PC|Package)\b/g;
|
||||||
const VAR_RE = /\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
const VAR_RE = /\$([A-Za-z_][A-Za-z0-9_]*)/g;
|
||||||
function renderInputHl() {
|
function renderInputHl() {
|
||||||
@@ -508,7 +509,7 @@ function renderInputHl() {
|
|||||||
// per-line tokens, matching the transcript's renderer: bold and
|
// per-line tokens, matching the transcript's renderer: bold and
|
||||||
// italics never span lines
|
// italics never span lines
|
||||||
hl.innerHTML = esc
|
hl.innerHTML = esc
|
||||||
.replace(/(\*\*[^*\n]+\*\*|\*[^*\n]+\*)/g, (m) => (m.startsWith('**') ? `<strong>${m}</strong>` : `<em>${m}</em>`))
|
.replace(/(\*\*[^*\n]+\*\*|\*[^*\n]+\*)/g, (m) => (m.startsWith('**') ? `<span class="emph">${m}</span>` : `<span class="narration">${m}</span>`))
|
||||||
.replace(VAR_RE, '<span class="tok-var">$&</span>')
|
.replace(VAR_RE, '<span class="tok-var">$&</span>')
|
||||||
.replace(SIGIL_RE, '<span class="tok-sigil">$&</span>');
|
.replace(SIGIL_RE, '<span class="tok-sigil">$&</span>');
|
||||||
hl.scrollTop = ta.scrollTop;
|
hl.scrollTop = ta.scrollTop;
|
||||||
|
|||||||
+57
-2
@@ -14,10 +14,65 @@ import { state } from './state.mjs';
|
|||||||
import { banner } from './chrome.mjs';
|
import { banner } from './chrome.mjs';
|
||||||
import { logEvent } from './log.mjs';
|
import { logEvent } from './log.mjs';
|
||||||
import { navigate, runGone } from './router.mjs';
|
import { navigate, runGone } from './router.mjs';
|
||||||
import { renderContent } from './transcript.mjs';
|
|
||||||
|
|
||||||
/** @typedef {import('./shapes.mjs').StoryResponse} StoryResponse */
|
/** @typedef {import('./shapes.mjs').StoryResponse} StoryResponse */
|
||||||
|
|
||||||
|
// the story's own renderer, deliberately not the workbench's (GM,
|
||||||
|
// 2026-11-16: one rule -- the table and the composer render
|
||||||
|
// colour-only, source text verbatim; the book is the deliverable and
|
||||||
|
// earns its typography). Real faces, asterisks spent: *italics* is
|
||||||
|
// the narration register, **bold** is emphasis, the prose reads like
|
||||||
|
// print. The server already stripped rides, verbs, and whole OOC
|
||||||
|
// turns; mid-turn OOC lines and stray tags can still arrive and
|
||||||
|
// render in their dim style.
|
||||||
|
/** @param {HTMLElement} target @param {string} text */
|
||||||
|
function storySpans(target, text) {
|
||||||
|
const parts = String(text).split(/(\*\*[^*]+\*\*|\*[^*\n]+\*)/g);
|
||||||
|
for (const p of parts) {
|
||||||
|
if (!p) continue;
|
||||||
|
if (p.startsWith('**') && p.endsWith('**')) {
|
||||||
|
target.appendChild(el('strong', null, p.slice(2, -2)));
|
||||||
|
} else if (p.startsWith('*') && p.endsWith('*') && p.length > 2) {
|
||||||
|
target.appendChild(el('em', 'narration', p.slice(1, -1)));
|
||||||
|
} else {
|
||||||
|
target.appendChild(document.createTextNode(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param {HTMLElement} target @param {string} text */
|
||||||
|
function storyBody(target, text) {
|
||||||
|
let narr = false; // an open multi-line narration block
|
||||||
|
for (const line of String(text ?? '').split('\n')) {
|
||||||
|
const t = line.trim();
|
||||||
|
if (!t) { target.appendChild(document.createElement('br')); continue; }
|
||||||
|
if (t.startsWith('(') || t.startsWith('<')) {
|
||||||
|
// a mid-turn OOC line or a stray tag -- dim, kept visible
|
||||||
|
target.appendChild(el('div', 'line ooc', t));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const stars = (line.match(/\*/g) ?? []).length;
|
||||||
|
if (!narr && (stars % 2 === 0 || !(t.startsWith('*') && !t.startsWith('**')))) {
|
||||||
|
// balanced spans, or a stray unpaired * mid-line (not a block
|
||||||
|
// opener -- the stray stays literal)
|
||||||
|
const d = el('div', 'line speech');
|
||||||
|
storySpans(d, line);
|
||||||
|
target.appendChild(d);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// block narration: an unpaired leading * opens it, a trailing * closes
|
||||||
|
let content = line.replace(/^\s*\*/, '');
|
||||||
|
narr = true;
|
||||||
|
if (t.endsWith('*') && !t.endsWith('**')) {
|
||||||
|
narr = false;
|
||||||
|
content = content.trimEnd().slice(0, -1);
|
||||||
|
}
|
||||||
|
const d = el('div', 'line narration');
|
||||||
|
storySpans(d, content);
|
||||||
|
target.appendChild(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @type {?string} */ let storyRun = null;
|
/** @type {?string} */ let storyRun = null;
|
||||||
|
|
||||||
/** @param {?string} id @param {number} seq @returns {Promise<void>} */
|
/** @param {?string} id @param {number} seq @returns {Promise<void>} */
|
||||||
@@ -54,7 +109,7 @@ export async function enter(id, seq) {
|
|||||||
d.appendChild(el('div', 'who', turn.who === 'gm' ? 'GM' : 'player'));
|
d.appendChild(el('div', 'who', turn.who === 'gm' ? 'GM' : 'player'));
|
||||||
const body = el('div');
|
const body = el('div');
|
||||||
d.appendChild(body);
|
d.appendChild(body);
|
||||||
renderContent(body, turn.text, { extract: turn.who === 'gm' });
|
storyBody(body, turn.text);
|
||||||
box.appendChild(d);
|
box.appendChild(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-30
@@ -131,10 +131,12 @@ export function fmtCeiling(tokens) {
|
|||||||
|
|
||||||
// A select's "" value means "deployment default"; a current override
|
// A select's "" value means "deployment default"; a current override
|
||||||
// missing from the registry stays selectable, so a stale pick never
|
// missing from the registry stays selectable, so a stale pick never
|
||||||
// silently rewrites itself. The registry's usable models group by
|
// silently rewrites itself. One plain list, sorted by id (GM,
|
||||||
// family; the label is the curator's (or the id before refinement),
|
// 2026-11-16: the family grouping left the user guessing what a
|
||||||
// and the input ceiling rides along -- the user picks against the
|
// family name means, and the curator's tier labels only made sense
|
||||||
// contwin, so the context limit belongs in the open.
|
// inside their groups -- the id is the self-describing name). The
|
||||||
|
// input ceiling rides along -- the user picks against the contwin,
|
||||||
|
// so the context limit belongs in the open.
|
||||||
/** @param {HTMLSelectElement} sel @param {?string} current @param {import('./shapes.mjs').ModelsRegistryResponse} reg @param {?string} [def] */
|
/** @param {HTMLSelectElement} sel @param {?string} current @param {import('./shapes.mjs').ModelsRegistryResponse} reg @param {?string} [def] */
|
||||||
function fillSelect(sel, current, reg, def) {
|
function fillSelect(sel, current, reg, def) {
|
||||||
sel.textContent = '';
|
sel.textContent = '';
|
||||||
@@ -147,23 +149,9 @@ function fillSelect(sel, current, reg, def) {
|
|||||||
mk('', `deployment default${def ? ` -- ${def}` : ' (unset)'}`);
|
mk('', `deployment default${def ? ` -- ${def}` : ' (unset)'}`);
|
||||||
const usableModels = reg.models.filter((m) => m.inference !== false && (m.roles?.player ?? true));
|
const usableModels = reg.models.filter((m) => m.inference !== false && (m.roles?.player ?? true));
|
||||||
const extras = current && !usableModels.some((m) => m.id === current) ? [current] : [];
|
const extras = current && !usableModels.some((m) => m.id === current) ? [current] : [];
|
||||||
/** @type {Record<string, import('../server/shapes.mjs').RegistryModel[]>} */ const byFamily = {};
|
for (const m of [...usableModels].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))) {
|
||||||
for (const m of usableModels) {
|
const ceil = fmtCeiling(m.input);
|
||||||
const f = m.family ?? m.id;
|
mk(m.id, ceil ? `${m.id} \u00b7 ${ceil}` : m.id);
|
||||||
(byFamily[f] ??= []).push(m);
|
|
||||||
}
|
|
||||||
const families = Object.keys(byFamily).sort();
|
|
||||||
for (const f of families) {
|
|
||||||
const group = /** @type {HTMLOptGroupElement} */ (el('optgroup'));
|
|
||||||
group.label = f;
|
|
||||||
for (const m of byFamily[f]) {
|
|
||||||
const label = m.label ?? m.id;
|
|
||||||
const ceil = fmtCeiling(m.input);
|
|
||||||
const o = /** @type {HTMLOptionElement} */ (el('option', null, ceil ? `${label} \u00b7 ${ceil}` : label));
|
|
||||||
o.value = m.id;
|
|
||||||
group.appendChild(o);
|
|
||||||
}
|
|
||||||
sel.appendChild(group);
|
|
||||||
}
|
}
|
||||||
for (const x of extras) mk(x, `${x} (not in the registry)`);
|
for (const x of extras) mk(x, `${x} (not in the registry)`);
|
||||||
sel.value = current ?? '';
|
sel.value = current ?? '';
|
||||||
@@ -171,7 +159,10 @@ function fillSelect(sel, current, reg, def) {
|
|||||||
|
|
||||||
// the models box: player/housekeeper selects over the registry, the
|
// the models box: player/housekeeper selects over the registry, the
|
||||||
// sampling knobs per role (one shared hint bar under both rows), and
|
// sampling knobs per role (one shared hint bar under both rows), and
|
||||||
// one save. The mount keeps its id -- the CSS panels it.
|
// one save. The mount keeps its id -- the CSS panels it. The knob
|
||||||
|
// rows rebuild when the model select changes: the effort knob's
|
||||||
|
// default is measured per model, so switching the model switches the
|
||||||
|
// honest default.
|
||||||
/** @param {string|HTMLElement} mount @param {{ title: string }} opts */
|
/** @param {string|HTMLElement} mount @param {{ title: string }} opts */
|
||||||
export function modelsBox(mount, { title }) {
|
export function modelsBox(mount, { title }) {
|
||||||
const root = typeof mount === 'string' ? $(mount) : mount;
|
const root = typeof mount === 'string' ? $(mount) : mount;
|
||||||
@@ -186,11 +177,37 @@ export function modelsBox(mount, { title }) {
|
|||||||
root.appendChild(pField);
|
root.appendChild(pField);
|
||||||
root.appendChild(hField);
|
root.appendChild(hField);
|
||||||
const knobHint = el('div', 'knob-hint'); // one bar, both roles
|
const knobHint = el('div', 'knob-hint'); // one bar, both roles
|
||||||
/** @type {{ wrap: HTMLElement, read: () => Record<string, number|null> }} */ let playerKnobs = knobsBox('player', undefined, undefined, knobHint);
|
/** @type {{ wrap: HTMLElement, read: () => Record<string, number|string|null> }} */ let playerKnobs = knobsBox('player', undefined, undefined, knobHint);
|
||||||
/** @type {{ wrap: HTMLElement, read: () => Record<string, number|null> }} */ let houseKnobs = knobsBox('housekeeper', undefined, undefined, knobHint);
|
/** @type {{ wrap: HTMLElement, read: () => Record<string, number|string|null> }} */ let houseKnobs = knobsBox('housekeeper', undefined, undefined, knobHint);
|
||||||
root.appendChild(playerKnobs.wrap);
|
root.appendChild(playerKnobs.wrap);
|
||||||
root.appendChild(houseKnobs.wrap);
|
root.appendChild(houseKnobs.wrap);
|
||||||
root.appendChild(knobHint);
|
root.appendChild(knobHint);
|
||||||
|
// the latest fill's inputs -- the select-change refresh rebuilds
|
||||||
|
// the knob rows against them (the effort context follows the
|
||||||
|
// newly-picked model)
|
||||||
|
/** @type {?{ params: ?{ player?: ?import('../server/shapes.mjs').RoleParams, housekeeper?: ?import('../server/shapes.mjs').RoleParams }, paramDefaults: ?{ player?: ?import('../server/shapes.mjs').RoleParams, housekeeper?: ?import('../server/shapes.mjs').RoleParams }, reg: import('./shapes.mjs').ModelsRegistryResponse }} */ let last = null;
|
||||||
|
// the effort knob's context: the currently-selected model's
|
||||||
|
// measured ladder (null when the registry has none for it)
|
||||||
|
/** @param {'player'|'housekeeper'} role @param {import('./shapes.mjs').ModelsRegistryResponse} reg @returns {?{ measured: Record<string, number>, fallback: ?string }} */
|
||||||
|
const effortOf = (role, reg) => {
|
||||||
|
const id = (role === 'player' ? playerSel.value : houseSel.value)
|
||||||
|
|| reg.defaults?.[role] || null;
|
||||||
|
const m = id ? reg.models.find((x) => x.id === id) : null;
|
||||||
|
return m?.efforts ? { measured: m.efforts, fallback: m.effortDefault ?? null } : null;
|
||||||
|
};
|
||||||
|
/** rebuild both knob rows against the current selects and the
|
||||||
|
* latest fill (fill and select-change both land here) */
|
||||||
|
function rebuildKnobs() {
|
||||||
|
if (!last) return;
|
||||||
|
const pk = knobsBox('player', last.params?.player ?? undefined, last.paramDefaults?.player ?? undefined, knobHint, effortOf('player', last.reg));
|
||||||
|
const hk = knobsBox('housekeeper', last.params?.housekeeper ?? undefined, last.paramDefaults?.housekeeper ?? undefined, knobHint, effortOf('housekeeper', last.reg));
|
||||||
|
playerKnobs.wrap.replaceWith(pk.wrap);
|
||||||
|
houseKnobs.wrap.replaceWith(hk.wrap);
|
||||||
|
playerKnobs = pk;
|
||||||
|
houseKnobs = hk;
|
||||||
|
}
|
||||||
|
playerSel.addEventListener('change', rebuildKnobs);
|
||||||
|
houseSel.addEventListener('change', rebuildKnobs);
|
||||||
if (!root.querySelector('.registry-hint')) {
|
if (!root.querySelector('.registry-hint')) {
|
||||||
const hint = el('div', 'hint registry-hint', '');
|
const hint = el('div', 'hint registry-hint', '');
|
||||||
root.appendChild(hint);
|
root.appendChild(hint);
|
||||||
@@ -224,12 +241,8 @@ export function modelsBox(mount, { title }) {
|
|||||||
fill(models, defaults, params, paramDefaults, reg) {
|
fill(models, defaults, params, paramDefaults, reg) {
|
||||||
fillSelect(playerSel, models?.player ?? null, reg, defaults?.player);
|
fillSelect(playerSel, models?.player ?? null, reg, defaults?.player);
|
||||||
fillSelect(houseSel, models?.housekeeper ?? null, reg, defaults?.housekeeper);
|
fillSelect(houseSel, models?.housekeeper ?? null, reg, defaults?.housekeeper);
|
||||||
const pk = knobsBox('player', params?.player ?? undefined, paramDefaults?.player ?? undefined, knobHint);
|
last = { params: params ?? null, paramDefaults: paramDefaults ?? null, reg };
|
||||||
const hk = knobsBox('housekeeper', params?.housekeeper ?? undefined, paramDefaults?.housekeeper ?? undefined, knobHint);
|
rebuildKnobs();
|
||||||
playerKnobs.wrap.replaceWith(pk.wrap);
|
|
||||||
houseKnobs.wrap.replaceWith(hk.wrap);
|
|
||||||
playerKnobs = pk;
|
|
||||||
houseKnobs = hk;
|
|
||||||
const hint = root.querySelector('.registry-hint');
|
const hint = root.querySelector('.registry-hint');
|
||||||
if (hint) {
|
if (hint) {
|
||||||
hint.textContent = reg.phase === 'none'
|
hint.textContent = reg.phase === 'none'
|
||||||
|
|||||||
Reference in New Issue
Block a user