multiuser: token identity, invites + bootstrap, owner-gated runs, fork, user packages; spectator spa; utc house rule
This commit is contained in:
@@ -55,6 +55,47 @@ gendered and the shared prompts say "she" throughout; the postulate is
|
||||
cheaper than a gender system no customer has asked for yet. When a male
|
||||
or otherwise PC ever needs support, this is the line to revisit.
|
||||
|
||||
## The deployment (multiuser)
|
||||
|
||||
A deployment is one clone plus `server.json`, `state/`, and `runs/` —
|
||||
all gitignored state. The LLM key lives on the backend; invited users
|
||||
need neither the key nor a local clone. Identity is a token, nothing
|
||||
else: no usernames, no passwords, no external IDPs. A single-use
|
||||
invite code — spent codes are recorded forever and rejected loudly on
|
||||
reuse — is exchanged at claim time for a persistent token; display
|
||||
names are freeform labels, collisions allowed. On a fresh deployment
|
||||
(empty users table) the server mints the superuser's bootstrap invite
|
||||
to `state/bootstrap-invite.txt` and the console; it is dead the moment
|
||||
any superuser exists, and recovery for the superuser is filesystem
|
||||
access. The superuser mints and revokes invites, lists and revokes
|
||||
users — that is the whole of admin. Revocation destroys the identity:
|
||||
no suspend, no restore; a returning user is a new identity, and
|
||||
forking makes that cheap — stories outlive identities by design.
|
||||
|
||||
- Every API route except `GET /api/session` and `POST /api/claim`
|
||||
requires a signed-in user (`Authorization: Bearer <token>`).
|
||||
- **Runs belong to their starter.** Every mutation and every model
|
||||
call is owner-only; every run is readable by any user — transcript,
|
||||
paper, rings, config, notepad included. The boundary is the model
|
||||
boundary: gm.md is secret from the player-model, never from people.
|
||||
Ownerless runs — pre-user, or the owner was revoked — are one
|
||||
uniform state: readable, forkable, no owner actions, never
|
||||
re-claimed. Ownership is resolved, never maintained: run.json keeps
|
||||
the record, a dead owner id reads as absent.
|
||||
- **Fork is the way in:** any user can fork any run, including their
|
||||
own. A mechanical atomic copy — staged, swapped in by a same-volume
|
||||
rename, under the run's activity lock — with the owner replaced. No
|
||||
lineage is recorded (runs are entirely independent); the fork's only
|
||||
mark is `forked: unixtime` in run.json, beside the carried-over
|
||||
`created`.
|
||||
- **Packages are system or user.** System packages ship with the repo;
|
||||
a user can save their run's craft as a user package under
|
||||
`state/packages/` — published to everyone, gm.md included (saving is
|
||||
the act of publishing), the pc never riding.
|
||||
- Every logged LLM call records the acting user. Quotas and limits are
|
||||
an extension point, not built.
|
||||
- All dates and times are UTC everywhere. No time zones, ever.
|
||||
|
||||
## Runs
|
||||
|
||||
Two interleaved stories calibrate the memory system against itself:
|
||||
@@ -176,8 +217,8 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
the session transcript — pasted, or the latest
|
||||
`runs/<id>/sessions/*.jsonl` when playing through the server (the
|
||||
phase-3 housekeeping job automates this). Save
|
||||
its manifest to `packages/<story>/manifests/<window>.json`.
|
||||
6. **Apply:** `node tool/memory.mjs apply packages/<story>/manifests/<window>.json`
|
||||
its manifest to `runs/<id>/manifests/<window>.json`.
|
||||
6. **Apply:** `node tool/memory.mjs --run <id> apply runs/<id>/manifests/<window>.json`
|
||||
— the tool validates, applies, handles overflow, writes the run's
|
||||
`log/<window>.md`, re-renders the views. A rejected manifest changes
|
||||
nothing and says why.
|
||||
@@ -186,7 +227,7 @@ window, and sends turn-0 as the first GM turn in one action.
|
||||
|
||||
## The memory model
|
||||
|
||||
State lives in **SQLite** (`packages/<story>/db/memory.db`); `canon/ring-*.md`
|
||||
State lives in **SQLite** (`runs/<id>/db/memory.db`); `canon/ring-*.md`
|
||||
are generated views. Markdown survives as rendering, dies as storage — the
|
||||
models see prose, the machine sees rows.
|
||||
|
||||
@@ -421,9 +462,17 @@ tool/
|
||||
packages/runs/status)
|
||||
server/ the substrate: a zero-dependency node:http service
|
||||
main.mjs entry + REST spine (node server/main.mjs [--mock]);
|
||||
loopback, single-human, synchronous JSON; boot-rebuilds
|
||||
open windows from the session logs on start
|
||||
bearer-token auth on every route (session/claim are
|
||||
public), ownership gating, per-run activity locks
|
||||
(turn, ask, turn0, the housekeeping job, fork);
|
||||
boot-rebuilds open windows from the session logs on
|
||||
start; bootstraps the fresh-deployment superuser
|
||||
invite; the request log and every LLM call carry the
|
||||
acting user
|
||||
provider.mjs the endpoint client (chat completions, models listing)
|
||||
users.mjs the deployment's people: users, invites, tokens
|
||||
(state/deployment.db; hashes only, spent invites
|
||||
recorded forever)
|
||||
bundle.mjs run context: prompt assembly (the trio system message,
|
||||
the GM-message bundle, @ sigils + $ vars), the tool manifest
|
||||
and its clerk dispatch
|
||||
@@ -432,31 +481,37 @@ server/ the substrate: a zero-dependency node:http service
|
||||
renderer (elision, thinking-strip, pairing check)
|
||||
loop.mjs the turn loop: ask_gm pause/resume, paper ride and
|
||||
delta apply, conflict carry; the scripted mock model
|
||||
fork.mjs fork: the staged atomic copy with the owner replaced
|
||||
and the `forked` stamp
|
||||
clerk.mjs the clerk boundary (every state op via memory.mjs)
|
||||
housekeeping.mjs the window-close ritual as an async job: transcript
|
||||
with labeled thinking, run-state injection, the
|
||||
housekeeper call, manifest save, apply, autorestart;
|
||||
rejections hold and surface why
|
||||
web/ the SPA — no build, vanilla ES modules, path-routed
|
||||
index.html the shell: home (runs), new (packages), setup (editor),
|
||||
play (transcript, status pane, context meter, GM input,
|
||||
ask modal) — the server serves it for any extensionless
|
||||
path
|
||||
app.mjs the client: routing, the setup editor, register parsing
|
||||
(speech / narration / OOC), bundle cards, turns,
|
||||
housekeeping polling
|
||||
index.html the shell: claim (invite), home (runs + admin), new
|
||||
(packages), setup (editor), play (transcript, status
|
||||
pane, context meter, GM input, ask modal, fork) —
|
||||
the server serves it for any extensionless path
|
||||
app.mjs the client: routing, the token session, the setup
|
||||
editor, register parsing (speech / narration / OOC),
|
||||
bundle cards, turns, housekeeping polling, spectator
|
||||
mode
|
||||
style.css dark, quiet, fiction-first
|
||||
server.example.json copy to server.json (gitignored) — bind, endpoint +
|
||||
key env, models, contextWindow, params passthrough
|
||||
db/
|
||||
schema.sql entries, records, paper, events journal (shared)
|
||||
state/ per-deployment people + shared packages (gitignored):
|
||||
deployment.db (users, invites), bootstrap-invite.txt,
|
||||
packages/ (user-saved, published to everyone)
|
||||
runs/ per-deployment run state (gitignored) — one anonymous
|
||||
id per run (carries no facts): the copied package,
|
||||
the craft prompt (handbook.md),
|
||||
run.json (lineage,
|
||||
run.json (lineage, owner, `forked` stamp on a fork,
|
||||
model override), db/, canon/ (rendered views), dumps/,
|
||||
log/, manifests/, sessions/
|
||||
packages/ presets — authored content only, never state
|
||||
packages/ system presets — authored content only, never state
|
||||
la-caramba/ backdrop.md, turn-0.md (new-game opener), character.md,
|
||||
seed.json, settings.json, gm.md (the GM's notepad —
|
||||
seeded per run, always editable in the SPA, never in
|
||||
|
||||
Reference in New Issue
Block a user