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
+67
View File
@@ -174,6 +174,73 @@ example, gitignored real file, env-var option).
clerk-side; the web side at loopback single-user scale is the easy
part.
## The multiuser server (2026-11-14, GM)
The invited-instance half of the harness goal, designed in one round
(rulings QUESTIONS #22-31). The LLM key stays on the backend; invited
users need neither the host's secrets nor their own key, and can play
without running anything locally.
- **Identity is a token, nothing else.** No usernames, no passwords, no
external IDPs. 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). Display names are freeform labels picked at
claim, collisions allowed. Recovery for a lost token is a new invite;
recovery for the superuser is filesystem access. Revocation destroys
the identity — no suspend, no restore — and that is cheap because
stories outlive identities by design (forking).
- **Bootstrap:** on the fresh-deployment condition (empty users table)
the server generates the initial superuser invite itself, writes it
to `state/bootstrap-invite.txt` and echoes it to the console. Exactly
one bootstrap invite exists until claimed, reused across restarts so
a restart never invalidates what the op saw; dead the moment any
superuser exists. Invite tokens are single-use with an explicit
spent record — reuse is rejected loudly, never silently dropped.
- **Superuser powers:** mint/revoke invites, list/revoke users.
Nothing else — no touching another user's runs or packages, no user
management beyond revocation.
- **The boundary is the model boundary.** gm.md is secret from the
player-model only; humans read freely. Saving a draft as a package
publishes its gm.md to everyone (saving is the act of publishing).
Spectators read everything in a run, notepad included, and mutate
nothing. `housekeeper.md` stays never-exposed (it prompts an
internal agent).
- **Runs:** attributed to the starting user; every GM action is
owner-only (including anything that spends a model call); every run
is readable by any user. Any user can fork any run, including their
own: a mechanical atomic copy — staged, swapped in by same-volume
rename, taken under the run's activity lock so a mid-turn fork can't
torn-copy — with the owner replaced. No lineage: runs are entirely
independent, and a fork's only mark is `forked: unixtime` beside the
carried-over `created`. Ownerless (pre-user or revoked-owner) is one
uniform runtime state: readable, forkable, no owner actions, no
re-claiming mechanism. No migration code — pre-user runs stay as
they are until the op hand-stamps an owner id into run.json.
- **Packages split system and user.** System packages ship with the
repo (authored, read-only); a user can save their run's craft as a
new user package under `state/packages/`, published to everyone,
gm.md included. The saved package carries no pc — the next create
asks for one; the display name is the save's one decision.
- **Display identity:** the run id is the identifier (strictly unique,
internal, factless, undecorated). The visible name is a content
descriptor — "Package / PC" plus SPA garnish (owner, started or
forked) — unique ENOUGH: collisions unlikely and harmless, never
load-bearing, never model-facing.
- **Every logged LLM call records the acting user.** Quotas and limits
are an extension point, not v1. Saved state lives gitignored
(`runs/`, `state/`) — the repo stays clean by construction.
- **House rule: all dates and times are UTC everywhere.** No time
zones, ever.
- **Extension point (later): proper user lifecycle and auth story.**
Signing in is permanent and per-browser — the token lives in the
client's localStorage, and sign-out is deliberately absent: less
functional, much easier to reason about. A user who loses their
browser storage is re-invited as a new identity (their old runs
stay owned by the old, unreachable one — readable, forkable,
frozen). Revisit when a real need shows: sign-out/token
expiry/refresh, multiple devices per user, token backup
affordances.
## SPA v1 — substrate decisions (2026-11-12, GM)
- **The whole story is recorded; publishing is a someday option.**