multiuser: token identity, invites + bootstrap, owner-gated runs, fork, user packages; spectator spa; utc house rule

This commit is contained in:
2026-11-14 20:01:15 +00:00
parent 9f85adc3c6
commit 711634cc38
15 changed files with 1134 additions and 105 deletions
+108
View File
@@ -67,6 +67,114 @@ as housekeeper evidence (observable #12). Status leaves the opening
bundle: system, backdrop, character, ring-b, ring-a (+ prelude on a
new game).
## The multiuser server
Design round opened 2026-11-14. The pitch, on the record: invite-only
onboarding (no usernames, no external IDPs); the value proposition is the
substrate ruling ("invited instance, key on the backend, no secrets in the
repo"); multiple users on one run is an extension point, out of scope.
Users can save an edited draft as a new package; packages split system
(repo, read-only) vs user (saved, gitignored storage). Runs attribute to
the starting user, GM actions are owner-only, and every run is readable
by any user and forkable (copied) to continue as a new GM. Read-only
is strict: spectators read everything in the run, notepad included, and
mutate nothing (GM-clarified 2026-11-14).
### 22. LLM call attribution — RESOLVED (2026-11-14)
Every logged LLM call records the acting user. Quotas and limits are an
extension point, not v1.
### 23. Identity mechanism — RESOLVED (2026-11-14)
No usernames, no passwords: a single-use invite code is exchanged at claim
time for a persistent token (random hex; the server stores a hash, the
client keeps the token). A display name is picked at claim — freeform
label, collisions allowed. Recovery for a lost token is a new invite;
recovery for the superuser is filesystem access. Client posture (GM,
same day): signing in is permanent and per-browser — no sign-out
exists, deliberately; the lifecycle story is a ROADMAP extension
point.
### 24. Saved-state location — RESOLVED (2026-11-14)
In-repo, gitignored — the same pattern as runs/. The requirement is only
that saved state never dirties git status; exact paths are free.
### 25. Bootstrap of the superuser — RESOLVED (2026-11-14)
Variant (b): on the fresh-deployment condition (empty users table), the
server generates the initial superuser invite itself, writes it to a file
in the gitignored storage dir, and echoes it to the console. One
bootstrap invite exists until claimed: generated on first fresh start,
reused across restarts so a restart never invalidates what the op saw.
The moment a superuser exists, bootstrap invites are never generated
again. Recovery for the superuser is filesystem access. Invite tokens
are single-use with an explicit record: spent tokens stay recorded and
claiming with a spent token is rejected, never silently dropped.
### 26. Superuser powers — RESOLVED (2026-11-14)
The minimum, ruled as proposed: mint invites (single-use code, seen once);
revoke an unclaimed invite; list users; revoke a user (token dies on the
spot, sessions end; runs and packages stay — ownerless but readable and
adoptable). Revocation destroys the identity: no suspend, no restore —
identity is just the token, so a revoked user who returns via a new
invite is a new identity. Ruled cheap because forking covers the loss:
any previous run can be forked and continued, so only attribution
metadata is lost, never data. Not in scope: touching another user's runs
or packages, reading another user's notepad, any user management beyond
revocation.
### 27. gm.md on save-as-package — RESOLVED (2026-11-14)
gm.md is part of the package and travels with every save; user packages
publish it to all users. A package has no players yet — nothing to hide.
### 28. gm.md in the read-only run view — RESOLVED (2026-11-14)
The agent's owner-only lean was overruled by a cleaner principle: gm.md
is secret from players only — the player-model, whose play the notes
would change. Humans are never the player (multi-user same-run is out
of scope; a fork's owner becomes the GM and inherits the notepad anyway).
So the notepad is owner-writable, readable by any user including
spectators, and never model-facing. The boundary is the model boundary,
not the human boundary.
### 29. Fork (formerly "adopt") — RESOLVED (2026-11-14, renamed same day)
The action is named fork, not adopt: it is about copying a run, not
re-homing one, and any user can fork any run, including their own. The
mechanics: a mechanical atomic copy of the run with the owner replaced —
rings, paper, db, session log, bundle — everything — into a new run id
under the forker. No inconsistent state on disk at any point: the copy
lands staged and is swapped in atomically (directory rename on the same
volume), taken under the run's existing activity lock so a mid-turn
fork can't torn-copy. Mid-window forking allowed; the copy inherits
window state honestly, unhousekept-session guard included. No lineage:
runs are entirely independent, so the fork records no source — it
stamps `forked: unixtime` in run.json (`created` carries over
unchanged), and that stamp is the only mark a fork bears.
Fresh-run-from-package needs no new verb — that is just create-run.
### 30. Migration of pre-user runs — RESOLVED (2026-11-14, revised same day)
No migration code. The GM prefers no legacy luggage: nothing stamps
owners automatically, and pre-user runs are left as they are until the
op fixes them by hand — editing run.json to add the owner id is trivial
for the person with filesystem access. This costs nothing because
ownerless is a legitimate runtime state anyway (revoked users' runs):
readable, forkable, no owner actions, no re-claiming mechanism. One
uniform rule, zero special cases.
### 31. Run display identity — RESOLVED (2026-11-14)
Fork broke the (package, pc) uniqueness that made "Package / PC" a safe
identifier — a fork copies both, and the pc name cannot change without
a retcon. Ruled apart: the run id is the identifier (strictly unique,
internal, factless, unchanged — it already exists and needs no
decoration); the visible name is a content descriptor for quick
selection, which must carry facts about the contents and be unique
ENOUGH — collisions unlikely and harmless, never load-bearing. The
visible name stays "Package / PC" (the content facts, and the only
name form the model ever sees, via @Package); the SPA garnish adds
owner and started-or-forked, rendered from run.json — chrome only,
never written to settings, never model-facing. `created` stays
recorded as it is and carries over unchanged on fork; a fork adds
`forked: unixtime` beside it — second precision, formatted as such in
the garnish. House rule: all dates and times are UTC everywhere, no
time zones, ever.
## Small / non-blocking
### 9. Unresolved-token check in expandVars — OPEN